HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
resourceRegistry.h
Go to the documentation of this file.
1 //
2 // Copyright 2016 Pixar
3 //
4 // Licensed under the Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 #ifndef PXR_IMAGING_HD_ST_RESOURCE_REGISTRY_H
25 #define PXR_IMAGING_HD_ST_RESOURCE_REGISTRY_H
26 
27 #include "pxr/pxr.h"
28 #include "pxr/base/vt/dictionary.h"
29 
30 #include "pxr/imaging/hdSt/api.h"
31 
32 #include "pxr/imaging/hgi/hgi.h"
33 
38 #include "pxr/imaging/hd/enums.h"
41 
42 #include <tbb/concurrent_vector.h>
43 
44 #include <atomic>
45 #include <map>
46 #include <memory>
47 
49 
50 using HdComputationSharedPtr = std::shared_ptr<class HdComputation>;
51 using HdStDispatchBufferSharedPtr = std::shared_ptr<class HdStDispatchBuffer>;
52 using HdStGLSLProgramSharedPtr = std::shared_ptr<class HdStGLSLProgram>;
53 using HioGlslfxSharedPtr = std::shared_ptr<class HioGlslfx>;
54 
56  std::shared_ptr<class HdSt_BasisCurvesTopology>;
57 
58 using HdStShaderCodePtr =
59  std::weak_ptr<class HdStShaderCode>;
61  std::shared_ptr<class HdSt_GeometricShader>;
62 
64  std::shared_ptr<class HdStTextureHandle>;
66  std::shared_ptr<class HdStTextureObject>;
68  std::shared_ptr<class HdStBufferResource>;
70  std::shared_ptr<class HdStResourceRegistry>;
72  std::shared_ptr<class Hd_VertexAdjacency>;
74  std::shared_ptr<class HdSt_MeshTopology>;
76  std::shared_ptr<HgiResourceBindingsHandle>;
78  std::shared_ptr<HgiGraphicsPipelineHandle>;
80  std::shared_ptr<HgiComputePipelineHandle>;
81 
84 class HdStStagingBuffer;
85 
86 /// \enum HdStComputeQueue
87 ///
88 /// Determines the 'compute queue' a computation should be added into.
89 ///
90 /// We only perform synchronization between queues, not within one queue.
91 /// In OpenGL terms that means we insert memory barriers between computations
92 /// of two queues, but not between two computations in the same queue.
93 ///
94 /// A prim determines the role for each queue based on its local knowledge of
95 /// compute dependencies. Eg. HdStMesh knows computing normals should wait
96 /// until the primvar refinement computation has fnished. It can assign one
97 /// queue to primvar refinement and a following queue for normal computations.
98 ///
105 
107  std::vector<std::pair<HdComputationSharedPtr, HdStComputeQueue>>;
108 
109 
110 /// \class HdStResourceRegistry
111 ///
112 /// A central registry of all GPU resources.
113 ///
115 {
116 public:
117  HF_MALLOC_TAG_NEW("new HdStResourceRegistry");
118 
119  HDST_API
120  explicit HdStResourceRegistry(Hgi* hgi);
121 
122  HDST_API
123  ~HdStResourceRegistry() override;
124 
125  HDST_API
126  void InvalidateShaderRegistry() override;
127 
128  HDST_API
129  void ReloadResource(TfToken const& resourceType,
130  std::string const& path) override;
131 
132  HDST_API
133  VtDictionary GetResourceAllocation() const override;
134 
135  /// Returns Hgi used to create/destroy GPU resources.
136  HDST_API
137  Hgi* GetHgi();
138 
139  /// ------------------------------------------------------------------------
140  /// Texture allocation API
141  /// ------------------------------------------------------------------------
142  ///
143 
144  /// Allocate texture handle (encapsulates texture and sampler
145  /// object, memory request and callback to shader).
146  ///
147  /// The actual allocation of the associated GPU texture and
148  /// sampler resources and loading of the texture file is delayed
149  /// until the commit phase.
150  HDST_API
152  /// Path to file and information to identify a texture if the
153  /// file is a container for several textures (e.g., OpenVDB
154  /// file containing several grids, movie file containing frames).
155  const HdStTextureIdentifier &textureId,
156  /// Texture type, e.g., uv, ptex, ...
157  HdTextureType textureType,
158  /// Sampling parameters such as wrapS, ...
159  /// wrapS, wrapT, wrapR mode, min filer, mag filter
160  const HdSamplerParameters &samplerParams,
161  /// Memory request. The texture is down-sampled to meet the
162  /// target memory which is the maximum of all memory requests
163  /// associated to the texture.
164  /// If all memory requests are 0, no down-sampling will happen.
165  size_t memoryRequest,
166  /// After the texture is committed (or after it has been
167  /// changed) the given shader code can add additional buffer
168  /// sources and computations using the texture metadata with
169  /// AddResourcesFromTextures.
170  HdStShaderCodePtr const &shaderCode);
171 
172  /// Allocate texture object.
173  ///
174  /// The actual allocation of the associated GPU texture and
175  /// sampler resources and loading of the texture file is delayed
176  /// until the commit phase.
177  HDST_API
179  /// Path to file and information to identify a texture if the
180  /// file is a container for several textures (e.g., OpenVDB
181  /// file containing several grids, movie file containing frames).
182  const HdStTextureIdentifier &textureId,
183  /// Texture type, e.g., uv, ptex, ...
184  HdTextureType textureType);
185 
186  /// Sets how much memory a single texture can consume in bytes by
187  /// texture type.
188  ///
189  /// Only has an effect if non-zero and only applies to textures if
190  /// no texture handle referencing the texture has a memory
191  /// request.
192  ///
193  HDST_API
195  HdTextureType textureType,
196  size_t memoryRequest);
197 
198  /// ------------------------------------------------------------------------
199  /// BAR allocation API
200  /// ------------------------------------------------------------------------
201  ///
202  /// The Allocate* flavor of methods allocate a new BAR for the given buffer
203  /// specs using the chosen aggregation strategy.
204 
205  HDST_API
207  TfToken const &role,
208  HdBufferSpecVector const &bufferSpecs,
209  HdBufferArrayUsageHint usageHint);
210 
211  HDST_API
213  TfToken const &role,
214  HdBufferSpecVector const &bufferSpecs,
215  HdBufferArrayUsageHint usageHint);
216 
217  HDST_API
219  TfToken const &role,
220  HdBufferSpecVector const &bufferSpecs,
221  HdBufferArrayUsageHint usageHint);
222 
223  HDST_API
225  TfToken const &role,
226  HdBufferSpecVector const &bufferSpecs,
227  HdBufferArrayUsageHint usageHint);
228 
229  HDST_API
231  TfToken const &role,
232  HdBufferSpecVector const &bufferSpecs,
233  HdBufferArrayUsageHint usageHint);
234 
235  /// ------------------------------------------------------------------------
236  /// BAR allocation/migration/update API
237  /// ------------------------------------------------------------------------
238  ///
239  /// The Update* flavor of methods handle both allocation of a new BAR and
240  /// reallocation-migration based on the existing range, updated/added specs,
241  /// removed specs and usage hint. This allows client code to be less verbose
242  /// when a range's signature (specs) can change.
243  ///
244  /// If \p curRange is invalid, this is equivalent to calling Allocate*.
245  /// Otherwise, checks if \p curRange needs to be migrated to a new range
246  /// (based on \p updatedOrAddedSpecs and \p removedSpecs and \p usageHint).
247  /// If migration is necessary, allocate a new range and register necessary
248  /// migration computations and return the new range.
249  /// Otherwise, just return the same range.
250 
251  HDST_API
253  TfToken const &role,
254  HdBufferArrayRangeSharedPtr const& curRange,
255  HdBufferSpecVector const &updatedOrAddedSpecs,
256  HdBufferSpecVector const& removedSpecs,
257  HdBufferArrayUsageHint usageHint);
258 
259  HDST_API
261  TfToken const &role,
262  HdBufferArrayRangeSharedPtr const& curRange,
263  HdBufferSpecVector const &updatedOrAddedSpecs,
264  HdBufferSpecVector const& removedSpecs,
265  HdBufferArrayUsageHint usageHint);
266 
267  HDST_API
269  TfToken const &role,
270  HdBufferArrayRangeSharedPtr const& curRange,
271  HdBufferSpecVector const &updatedOrAddedSpecs,
272  HdBufferSpecVector const& removedSpecs,
273  HdBufferArrayUsageHint usageHint);
274 
275  HDST_API
277  TfToken const &role,
278  HdBufferArrayRangeSharedPtr const& curRange,
279  HdBufferSpecVector const &updatedOrAddedSpecs,
280  HdBufferSpecVector const& removedSpecs,
281  HdBufferArrayUsageHint usageHint);
282 
283  /// ------------------------------------------------------------------------
284  /// Resource update & computation queuing API
285  /// ------------------------------------------------------------------------
286 
287  /// Append source data for given range to be committed later.
288  HDST_API
291 
292  /// Append a source data for given range to be committed later.
293  HDST_API
294  void AddSource(HdBufferArrayRangeSharedPtr const &range,
296 
297  /// Append a source data just to be resolved (used for cpu computations).
298  HDST_API
299  void AddSource(HdBufferSourceSharedPtr const &source);
300 
301  /// Append a gpu computation into queue.
302  /// The parameter 'range' specifies the destination buffer range,
303  /// which has to be allocated by caller of this function.
304  ///
305  /// note: GPU computations will be executed in the order that
306  /// they are registered.
307  HDST_API
309  HdComputationSharedPtr const &computation,
310  HdStComputeQueue const queue);
311 
312  /// ------------------------------------------------------------------------
313  /// Dispatch & buffer API
314  /// ------------------------------------------------------------------------
315 
316  /// Register a buffer allocated with \a count * \a commandNumUints *
317  /// sizeof(uint32_t) to be used as an indirect dispatch buffer.
318  HDST_API
320  TfToken const &role, int count, int commandNumUints);
321 
322  /// Register a misc buffer resource.
323  /// Usually buffers are part of a buffer array (buffer aggregation) and are
324  /// managed via buffer array APIs.
325  /// RegisterBufferResource lets you create a standalone buffer that can
326  /// be used for misc purposes (Eg. GPU frustum cull prim count read back).
327  HDST_API
329  TfToken const &role,
330  HdTupleType tupleType);
331 
332  /// Remove any entries associated with expired dispatch buffers.
333  HDST_API
335 
336  /// Remove any entries associated with expired misc buffers.
337  HDST_API
339 
340  /// ------------------------------------------------------------------------
341  /// Instance Registries
342  /// ------------------------------------------------------------------------
343 
344  /// These registries implement sharing and deduplication of data based
345  /// on computed hash identifiers. Each returned HdInstance object retains
346  /// a shared pointer to a data instance. When an HdInstance is registered
347  /// for a previously unused ID, the data pointer will be null and it is
348  /// the caller's responsibility to set its value. The instance registries
349  /// are cleaned of unreferenced entries during garbage collection.
350  ///
351  /// Note: As entries can be registered from multiple threads, the returned
352  /// object holds a lock on the instance registry. This lock is held
353  /// until the returned HdInstance object is destroyed.
354 
355  /// Topology instancing
356  HDST_API
359 
360  HDST_API
364 
365  HDST_API
368 
369  /// Topology Index buffer array range instancing
370  /// Returns the HdInstance points to shared HdBufferArrayRange,
371  /// distinguished by given ID.
372  /// *Refer the comment on RegisterTopology for the same consideration.
373  HDST_API
377 
378  HDST_API
382 
383  /// Primvar array range instancing
384  /// Returns the HdInstance pointing to shared HdBufferArrayRange,
385  /// distinguished by given ID.
386  /// *Refer the comment on RegisterTopology for the same consideration.
387  HDST_API
391 
392  /// ExtComputation data array range instancing
393  /// Returns the HdInstance pointing to shared HdBufferArrayRange,
394  /// distinguished by given ID.
395  /// *Refer the comment on RegisterTopology for the same consideration.
396  HDST_API
400 
401  /// Register a geometric shader.
402  HDST_API
405 
406  /// Register a GLSL program into the program registry.
407  HDST_API
410 
411  /// Register a GLSLFX file.
412  HDST_API
415 
416  /// Register a Hgi resource bindings into the registry.
417  HDST_API
420 
421  /// Register a Hgi graphics pipeline into the registry.
422  HDST_API
425 
426  /// Register a Hgi compute pipeline into the registry.
427  HDST_API
430 
431  /// Returns the global hgi blit command queue for recording blitting work.
432  /// When using this global cmd instead of creating a new HgiBlitCmds we
433  /// reduce the number of command buffers being created.
434  /// The returned pointer should not be held onto by the client as it is
435  /// only valid until the HgiBlitCmds has been submitted.
436  HDST_API
438 
439  /// Returns the global hgi compute cmd queue for recording compute work.
440  /// When using this global cmd instead of creating a new HgiComputeCmds we
441  /// reduce the number of command buffers being created.
442  /// The returned pointer should not be held onto by the client as it is
443  /// only valid until the HgiComputeCmds has been submitted.
444  HDST_API
446 
447  /// Submits blit work queued in global blit cmds for GPU execution.
448  /// We can call this when we want to submit some work to the GPU.
449  /// To stall the CPU and wait for the GPU to finish, 'wait' can be provided.
450  /// To insert a barrier to ensure memory writes are visible after the
451  /// barrier a HgiMemoryBarrier can be provided.
452  HDST_API
454 
455  /// Submits compute work queued in global compute cmds for GPU execution.
456  /// We can call this when we want to submit some work to the GPU.
457  /// To stall the CPU and wait for the GPU to finish, 'wait' can be provided.
458  /// To insert a barrier to ensure memory writes are visible after the
459  /// barrier a HgiMemoryBarrier can be provided.
460  HDST_API
462 
463  /// Returns the staging buffer used when committing data to the GPU.
464  HDST_API
466 
467 public:
468  //
469  // Unit test API
470  //
471 
472  /// Set the aggregation strategy for non uniform parameters
473  /// (vertex, varying, facevarying)
474  /// Takes ownership of the passed in strategy object.
476  std::unique_ptr<HdAggregationStrategy> &&strategy) {
477  _nonUniformAggregationStrategy = std::move(strategy);
478  }
479 
480  /// Set the aggregation strategy for non uniform immutable parameters
481  /// (vertex, varying, facevarying)
482  /// Takes ownership of the passed in strategy object.
484  std::unique_ptr<HdAggregationStrategy> &&strategy) {
485  _nonUniformImmutableAggregationStrategy = std::move(strategy);
486  }
487 
488  /// Set the aggregation strategy for uniform (shader globals)
489  /// Takes ownership of the passed in strategy object.
491  std::unique_ptr<HdAggregationStrategy> &&strategy) {
492  _uniformUboAggregationStrategy = std::move(strategy);
493  }
494 
495  /// Set the aggregation strategy for SSBO (uniform primvars)
496  /// Takes ownership of the passed in strategy object.
498  std::unique_ptr<HdAggregationStrategy> &&strategy) {
499  _uniformSsboAggregationStrategy = std::move(strategy);
500  }
501 
502  /// Set the aggregation strategy for single buffers (for nested instancer).
503  /// Takes ownership of the passed in strategy object.
505  std::unique_ptr<HdAggregationStrategy> &&strategy) {
506  _singleAggregationStrategy = std::move(strategy);
507  }
508 
509  /// Debug dump
510  HDST_API
511  friend std::ostream &operator <<(
512  std::ostream &out,
513  const HdStResourceRegistry& self);
514 
515 protected:
516  void _Commit() override;
517  void _GarbageCollect() override;
518 
519 private:
520  void _CommitTextures();
521  // Wrapper function for BAR allocation
522  HdBufferArrayRangeSharedPtr _AllocateBufferArrayRange(
523  HdAggregationStrategy *strategy,
524  HdBufferArrayRegistry &bufferArrayRegistry,
525  TfToken const &role,
526  HdBufferSpecVector const &bufferSpecs,
527  HdBufferArrayUsageHint usageHint);
528 
529  /// Wrapper function for BAR allocation/reallocation-migration.
530  HdBufferArrayRangeSharedPtr _UpdateBufferArrayRange(
531  HdAggregationStrategy *strategy,
532  HdBufferArrayRegistry &bufferArrayRegistry,
533  TfToken const &role,
534  HdBufferArrayRangeSharedPtr const& curRange,
535  HdBufferSpecVector const &updatedOrAddedSpecs,
536  HdBufferSpecVector const& removedSpecs,
537  HdBufferArrayUsageHint usageHint);
538 
539  // Tally resources by key into the given dictionary. Any additions should
540  // be cumulative with the existing key values.
541  void _TallyResourceAllocation(VtDictionary *result) const;
542 
543  // TODO: this is a transient structure. we'll revisit the BufferSource
544  // interface later.
545  struct _PendingSource {
546  _PendingSource(HdBufferArrayRangeSharedPtr const &range)
547  : range(range)
548  , sources()
549  {
550  }
551 
552  _PendingSource(HdBufferArrayRangeSharedPtr const &range,
553  HdBufferSourceSharedPtr const &source)
554  : range(range)
555  , sources(1, source)
556  {
557  }
558 
559  _PendingSource(HdBufferArrayRangeSharedPtr const &range,
561  : range(range)
562  , sources(std::move(sources))
563  {
564  }
565 
568  };
569 
570  Hgi* _hgi;
571 
572  typedef tbb::concurrent_vector<_PendingSource> _PendingSourceList;
573  _PendingSourceList _pendingSources;
574  std::atomic_size_t _numBufferSourcesToResolve;
575 
576  struct _PendingComputation{
577  _PendingComputation(HdBufferArrayRangeSharedPtr const &range,
578  HdComputationSharedPtr const &computation)
579  : range(range), computation(computation) { }
581  HdComputationSharedPtr computation;
582  };
583 
584  // If we need more 'compute queues' we can increase HdStComputeQueueCount.
585  // We could also consider tbb::concurrent_priority_queue if we want this
586  // to be dynamically scalable.
587  typedef tbb::concurrent_vector<_PendingComputation> _PendingComputationList;
588  _PendingComputationList _pendingComputations[HdStComputeQueueCount];
589 
590  // aggregated buffer array
591  HdBufferArrayRegistry _nonUniformBufferArrayRegistry;
592  HdBufferArrayRegistry _nonUniformImmutableBufferArrayRegistry;
593  HdBufferArrayRegistry _uniformUboBufferArrayRegistry;
594  HdBufferArrayRegistry _uniformSsboBufferArrayRegistry;
595  HdBufferArrayRegistry _singleBufferArrayRegistry;
596 
597  // current aggregation strategies
598  std::unique_ptr<HdAggregationStrategy> _nonUniformAggregationStrategy;
599  std::unique_ptr<HdAggregationStrategy>
600  _nonUniformImmutableAggregationStrategy;
601  std::unique_ptr<HdAggregationStrategy> _uniformUboAggregationStrategy;
602  std::unique_ptr<HdAggregationStrategy> _uniformSsboAggregationStrategy;
603  std::unique_ptr<HdAggregationStrategy> _singleAggregationStrategy;
604 
605  typedef std::vector<HdStDispatchBufferSharedPtr>
606  _DispatchBufferRegistry;
607  _DispatchBufferRegistry _dispatchBufferRegistry;
608 
609  typedef std::vector<HdStBufferResourceSharedPtr>
610  _BufferResourceRegistry;
611  _BufferResourceRegistry _bufferResourceRegistry;
612 
613  // Register mesh topology.
615  _meshTopologyRegistry;
616 
617  // Register basisCurves topology.
619  _basisCurvesTopologyRegistry;
620 
621  // Register vertex adjacency.
623  _vertexAdjacencyRegistry;
624 
625  // Register topology index buffers.
627  _TopologyIndexRangeInstanceRegistry;
628  typedef tbb::concurrent_unordered_map< TfToken,
629  _TopologyIndexRangeInstanceRegistry,
631  _TopologyIndexRangeInstanceRegMap;
632 
633  _TopologyIndexRangeInstanceRegMap _meshTopologyIndexRangeRegistry;
634  _TopologyIndexRangeInstanceRegMap _basisCurvesTopologyIndexRangeRegistry;
635 
636  // Register shared primvar buffers.
638  _primvarRangeRegistry;
639 
640  // Register ext computation resource.
642  _extComputationDataRangeRegistry;
643 
644  // geometric shader registry
646  _geometricShaderRegistry;
647 
648  // glsl shader program registry
650  _glslProgramRegistry;
651 
652  // glslfx file registry
654  _glslfxFileRegistry;
655 
656  // texture handle registry
657  std::unique_ptr<class HdSt_TextureHandleRegistry> _textureHandleRegistry;
658 
659  // Hgi resource bindings registry
661  _resourceBindingsRegistry;
662 
663  // Hgi graphics pipeline registry
665  _graphicsPipelineRegistry;
666 
667  // Hgi compute pipeline registry
669  _computePipelineRegistry;
670 
671  HgiBlitCmdsUniquePtr _blitCmds;
672  HgiComputeCmdsUniquePtr _computeCmds;
673 
674  std::unique_ptr<HdStStagingBuffer> _stagingBuffer;
675 };
676 
677 
679 
680 #endif //PXR_IMAGING_HD_ST_RESOURCE_REGISTRY_H
HDST_API HdStStagingBuffer * GetStagingBuffer()
Returns the staging buffer used when committing data to the GPU.
void SetSingleStorageAggregationStrategy(std::unique_ptr< HdAggregationStrategy > &&strategy)
std::shared_ptr< class HdStDispatchBuffer > HdStDispatchBufferSharedPtr
HDST_API HdBufferArrayRangeSharedPtr UpdateUniformBufferArrayRange(TfToken const &role, HdBufferArrayRangeSharedPtr const &curRange, HdBufferSpecVector const &updatedOrAddedSpecs, HdBufferSpecVector const &removedSpecs, HdBufferArrayUsageHint usageHint)
HDST_API HdInstance< HdSt_MeshTopologySharedPtr > RegisterMeshTopology(HdInstance< HdSt_MeshTopologySharedPtr >::ID id)
Topology instancing.
void SetNonUniformImmutableAggregationStrategy(std::unique_ptr< HdAggregationStrategy > &&strategy)
HDST_API HdInstance< HgiResourceBindingsSharedPtr > RegisterResourceBindings(HdInstance< HgiResourceBindingsSharedPtr >::ID id)
Register a Hgi resource bindings into the registry.
std::shared_ptr< class HdSt_BasisCurvesTopology > HdSt_BasisCurvesTopologySharedPtr
Definition: basisCurves.h:44
HDST_API HgiComputeCmds * GetGlobalComputeCmds()
std::weak_ptr< class HdStShaderCode > HdStShaderCodePtr
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
void SetShaderStorageAggregationStrategy(std::unique_ptr< HdAggregationStrategy > &&strategy)
std::shared_ptr< class HdSt_GeometricShader > HdSt_GeometricShaderSharedPtr
Definition: drawItem.h:34
HDST_API void GarbageCollectBufferResources()
Remove any entries associated with expired misc buffers.
HDST_API void SetMemoryRequestForTextureType(HdTextureType textureType, size_t memoryRequest)
Functor to use for hash maps from tokens to other things.
Definition: token.h:166
std::vector< HdBufferSourceSharedPtr > HdBufferSourceSharedPtrVector
Definition: bufferSource.h:44
HF_MALLOC_TAG_NEW("new HdStResourceRegistry")
HDST_API HdBufferArrayRangeSharedPtr AllocateShaderStorageBufferArrayRange(TfToken const &role, HdBufferSpecVector const &bufferSpecs, HdBufferArrayUsageHint usageHint)
GLuint const GLchar * name
Definition: glcorearb.h:786
HDST_API HdInstance< HdBufferArrayRangeSharedPtr > RegisterExtComputationDataRange(HdInstance< HdBufferArrayRangeSharedPtr >::ID id)
HDST_API HdInstance< HdBufferArrayRangeSharedPtr > RegisterPrimvarRange(HdInstance< HdBufferArrayRangeSharedPtr >::ID id)
HDST_API HdInstance< HdSt_GeometricShaderSharedPtr > RegisterGeometricShader(HdInstance< HdSt_GeometricShaderSharedPtr >::ID id)
Register a geometric shader.
HgiSubmitWaitType
Definition: enums.h:654
GLsizei GLenum * sources
Definition: glcorearb.h:2542
Definition: token.h:87
std::shared_ptr< class HdSt_MeshTopology > HdSt_MeshTopologySharedPtr
Definition: mesh.h:48
GLuint64EXT * result
Definition: glew.h:14311
HDST_API HdBufferArrayRangeSharedPtr AllocateNonUniformBufferArrayRange(TfToken const &role, HdBufferSpecVector const &bufferSpecs, HdBufferArrayUsageHint usageHint)
HDST_API HdBufferArrayRangeSharedPtr AllocateNonUniformImmutableBufferArrayRange(TfToken const &role, HdBufferSpecVector const &bufferSpecs, HdBufferArrayUsageHint usageHint)
HDST_API HdInstance< HgiGraphicsPipelineSharedPtr > RegisterGraphicsPipeline(HdInstance< HgiGraphicsPipelineSharedPtr >::ID id)
Register a Hgi graphics pipeline into the registry.
std::shared_ptr< HgiGraphicsPipelineHandle > HgiGraphicsPipelineSharedPtr
void _Commit() override
A hook for derived registries to perform additional resource commits.
std::shared_ptr< HgiResourceBindingsHandle > HgiResourceBindingsSharedPtr
HDST_API HdInstance< Hd_VertexAdjacencySharedPtr > RegisterVertexAdjacency(HdInstance< Hd_VertexAdjacencySharedPtr >::ID id)
GLsizei GLsizei GLchar * source
Definition: glcorearb.h:803
GLsizei const GLchar *const * string
Definition: glcorearb.h:814
HdTextureType
Definition: enums.h:221
HDST_API Hgi * GetHgi()
Returns Hgi used to create/destroy GPU resources.
HDST_API HdBufferArrayRangeSharedPtr UpdateNonUniformImmutableBufferArrayRange(TfToken const &role, HdBufferArrayRangeSharedPtr const &curRange, HdBufferSpecVector const &updatedOrAddedSpecs, HdBufferSpecVector const &removedSpecs, HdBufferArrayUsageHint usageHint)
HDST_API HdBufferArrayRangeSharedPtr AllocateSingleBufferArrayRange(TfToken const &role, HdBufferSpecVector const &bufferSpecs, HdBufferArrayUsageHint usageHint)
std::shared_ptr< HgiComputePipelineHandle > HgiComputePipelineSharedPtr
HDST_API void GarbageCollectDispatchBuffers()
Remove any entries associated with expired dispatch buffers.
std::shared_ptr< class HdComputation > HdComputationSharedPtr
Definition: computation.h:41
*get result *(waiting if necessary)*A common idiom is to fire a bunch of sub tasks at the queue
Definition: thread.h:623
HDST_API void AddSources(HdBufferArrayRangeSharedPtr const &range, HdBufferSourceSharedPtrVector &&sources)
Append source data for given range to be committed later.
GLint GLsizei count
Definition: glcorearb.h:405
HDST_API ~HdStResourceRegistry() override
std::vector< std::pair< HdComputationSharedPtr, HdStComputeQueue >> HdStComputationSharedPtrVector
std::vector< struct HdBufferSpec > HdBufferSpecVector
HDST_API void SubmitComputeWork(HgiSubmitWaitType wait=HgiSubmitWaitTypeNoWait)
HDST_API HdInstance< HioGlslfxSharedPtr > RegisterGLSLFXFile(HdInstance< HioGlslfxSharedPtr >::ID id)
Register a GLSLFX file.
HdStComputeQueue
std::shared_ptr< class HdStTextureObject > HdStTextureObjectSharedPtr
std::unique_ptr< class HgiComputeCmds > HgiComputeCmdsUniquePtr
Definition: computeCmds.h:36
HDST_API HdInstance< HdBufferArrayRangeSharedPtr > RegisterMeshIndexRange(HdInstance< HdBufferArrayRangeSharedPtr >::ID id, TfToken const &name)
std::shared_ptr< class HdStBufferResource > HdStBufferResourceSharedPtr
std::shared_ptr< class HdStGLSLProgram > HdStGLSLProgramSharedPtr
HDST_API void SubmitBlitWork(HgiSubmitWaitType wait=HgiSubmitWaitTypeNoWait)
*tasks wait()
HDST_API HdBufferArrayRangeSharedPtr UpdateNonUniformBufferArrayRange(TfToken const &role, HdBufferArrayRangeSharedPtr const &curRange, HdBufferSpecVector const &updatedOrAddedSpecs, HdBufferSpecVector const &removedSpecs, HdBufferArrayUsageHint usageHint)
Definition: hgi.h:108
HDST_API void ReloadResource(TfToken const &resourceType, std::string const &path) override
std::unique_ptr< class HgiBlitCmds > HgiBlitCmdsUniquePtr
Definition: blitCmds.h:45
HDST_API VtDictionary GetResourceAllocation() const override
void SetNonUniformAggregationStrategy(std::unique_ptr< HdAggregationStrategy > &&strategy)
HDST_API void InvalidateShaderRegistry() override
Invalidate any shaders registered with this registry.
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1394
HDST_API HdBufferArrayRangeSharedPtr UpdateShaderStorageBufferArrayRange(TfToken const &role, HdBufferArrayRangeSharedPtr const &curRange, HdBufferSpecVector const &updatedOrAddedSpecs, HdBufferSpecVector const &removedSpecs, HdBufferArrayUsageHint usageHint)
HDST_API void AddSource(HdBufferArrayRangeSharedPtr const &range, HdBufferSourceSharedPtr const &source)
Append a source data for given range to be committed later.
HDST_API HdStBufferResourceSharedPtr RegisterBufferResource(TfToken const &role, HdTupleType tupleType)
std::shared_ptr< class HdStTextureHandle > HdStTextureHandleSharedPtr
#define HDST_API
Definition: api.h:40
HDST_API HdInstance< HdSt_BasisCurvesTopologySharedPtr > RegisterBasisCurvesTopology(HdInstance< HdSt_BasisCurvesTopologySharedPtr >::ID id)
std::shared_ptr< class HioGlslfx > HioGlslfxSharedPtr
Definition: glslfxShader.h:34
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
HDST_API HdStDispatchBufferSharedPtr RegisterDispatchBuffer(TfToken const &role, int count, int commandNumUints)
HDST_API HdStTextureHandleSharedPtr AllocateTextureHandle(const HdStTextureIdentifier &textureId, HdTextureType textureType, const HdSamplerParameters &samplerParams, size_t memoryRequest, HdStShaderCodePtr const &shaderCode)
std::shared_ptr< HdBufferArrayRange > HdBufferArrayRangeSharedPtr
Definition: bufferArray.h:45
void _GarbageCollect() override
GLenum GLint * range
Definition: glcorearb.h:1925
HDST_API HgiBlitCmds * GetGlobalBlitCmds()
HDST_API HdInstance< HgiComputePipelineSharedPtr > RegisterComputePipeline(HdInstance< HgiComputePipelineSharedPtr >::ID id)
Register a Hgi compute pipeline into the registry.
HDST_API friend std::ostream & operator<<(std::ostream &out, const HdStResourceRegistry &self)
Debug dump.
void SetUniformAggregationStrategy(std::unique_ptr< HdAggregationStrategy > &&strategy)
HDST_API HdStTextureObjectSharedPtr AllocateTextureObject(const HdStTextureIdentifier &textureId, HdTextureType textureType)
HDST_API HdInstance< HdBufferArrayRangeSharedPtr > RegisterBasisCurvesIndexRange(HdInstance< HdBufferArrayRangeSharedPtr >::ID id, TfToken const &name)
std::shared_ptr< class Hd_VertexAdjacency > Hd_VertexAdjacencySharedPtr
std::shared_ptr< class HdBufferSource > HdBufferSourceSharedPtr
std::shared_ptr< class HdStResourceRegistry > HdStResourceRegistrySharedPtr
Definition: commandBuffer.h:49
HDST_API HdStResourceRegistry(Hgi *hgi)
HDST_API HdBufferArrayRangeSharedPtr AllocateUniformBufferArrayRange(TfToken const &role, HdBufferSpecVector const &bufferSpecs, HdBufferArrayUsageHint usageHint)
HDST_API void AddComputation(HdBufferArrayRangeSharedPtr const &range, HdComputationSharedPtr const &computation, HdStComputeQueue const queue)
HDST_API HdInstance< HdStGLSLProgramSharedPtr > RegisterGLSLProgram(HdInstance< HdStGLSLProgramSharedPtr >::ID id)
Register a GLSL program into the program registry.