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"
32 
33 #include "pxr/imaging/hgi/hgi.h"
34 
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 
48 #ifdef PXR_MATERIALX_SUPPORT_ENABLED
49 #include <MaterialXCore/Library.h>
51  using ShaderPtr = std::shared_ptr<class Shader>;
53 #endif
54 
56 
57 using HdStComputationSharedPtr = std::shared_ptr<class HdStComputation>;
58 using HdStDispatchBufferSharedPtr = std::shared_ptr<class HdStDispatchBuffer>;
59 using HdStGLSLProgramSharedPtr = std::shared_ptr<class HdStGLSLProgram>;
60 using HioGlslfxSharedPtr = std::shared_ptr<class HioGlslfx>;
61 
63  std::shared_ptr<class HdSt_BasisCurvesTopology>;
64 
65 using HdStShaderCodePtr =
66  std::weak_ptr<class HdStShaderCode>;
68  std::shared_ptr<class HdSt_GeometricShader>;
69 
71  std::shared_ptr<class HdStTextureHandle>;
73  std::shared_ptr<class HdStTextureObject>;
75  std::shared_ptr<class HdStBufferResource>;
77  std::shared_ptr<class HdStResourceRegistry>;
79  std::shared_ptr<class HdSt_VertexAdjacencyBuilder>;
81  std::shared_ptr<class HdSt_MeshTopology>;
83  std::shared_ptr<HgiResourceBindingsHandle>;
85  std::shared_ptr<HgiGraphicsPipelineHandle>;
87  std::shared_ptr<HgiComputePipelineHandle>;
88 
91 class HdStStagingBuffer;
92 
93 /// \enum HdStComputeQueue
94 ///
95 /// Determines the 'compute queue' a computation should be added into.
96 ///
97 /// We only perform synchronization between queues, not within one queue.
98 /// In OpenGL terms that means we insert memory barriers between computations
99 /// of two queues, but not between two computations in the same queue.
100 ///
101 /// A prim determines the role for each queue based on its local knowledge of
102 /// compute dependencies. Eg. HdStMesh knows computing normals should wait
103 /// until the primvar refinement computation has fnished. It can assign one
104 /// queue to primvar refinement and a following queue for normal computations.
105 ///
112 
114  std::vector<std::pair<HdStComputationSharedPtr, HdStComputeQueue>>;
115 
116 
117 /// \class HdStResourceRegistry
118 ///
119 /// A central registry of all GPU resources.
120 ///
122 {
123 public:
124  HF_MALLOC_TAG_NEW("new HdStResourceRegistry");
125 
126  HDST_API
127  explicit HdStResourceRegistry(Hgi* hgi);
128 
129  HDST_API
130  ~HdStResourceRegistry() override;
131 
132  HDST_API
133  void InvalidateShaderRegistry() override;
134 
135  HDST_API
136  void ReloadResource(TfToken const& resourceType,
137  std::string const& path) override;
138 
139  HDST_API
140  VtDictionary GetResourceAllocation() const override;
141 
142  /// Returns Hgi used to create/destroy GPU resources.
143  HDST_API
144  Hgi* GetHgi();
145 
146  /// ------------------------------------------------------------------------
147  /// Texture allocation API
148  /// ------------------------------------------------------------------------
149  ///
150 
151  /// Allocate texture handle (encapsulates texture and sampler
152  /// object, memory request and callback to shader).
153  ///
154  /// The actual allocation of the associated GPU texture and
155  /// sampler resources and loading of the texture file is delayed
156  /// until the commit phase.
157  HDST_API
159  /// Path to file and information to identify a texture if the
160  /// file is a container for several textures (e.g., OpenVDB
161  /// file containing several grids, movie file containing frames).
162  const HdStTextureIdentifier &textureId,
163  /// Texture type, e.g., uv, ptex, ...
164  HdTextureType textureType,
165  /// Sampling parameters such as wrapS, ...
166  /// wrapS, wrapT, wrapR mode, min filer, mag filter
167  const HdSamplerParameters &samplerParams,
168  /// Memory request. The texture is down-sampled to meet the
169  /// target memory which is the maximum of all memory requests
170  /// associated to the texture.
171  /// If all memory requests are 0, no down-sampling will happen.
172  size_t memoryRequest,
173  /// After the texture is committed (or after it has been
174  /// changed) the given shader code can add additional buffer
175  /// sources and computations using the texture metadata with
176  /// AddResourcesFromTextures.
177  HdStShaderCodePtr const &shaderCode);
178 
179  /// Allocate texture object.
180  ///
181  /// The actual allocation of the associated GPU texture and
182  /// sampler resources and loading of the texture file is delayed
183  /// until the commit phase.
184  HDST_API
186  /// Path to file and information to identify a texture if the
187  /// file is a container for several textures (e.g., OpenVDB
188  /// file containing several grids, movie file containing frames).
189  const HdStTextureIdentifier &textureId,
190  /// Texture type, e.g., uv, ptex, ...
191  HdTextureType textureType);
192 
193  /// Sets how much memory a single texture can consume in bytes by
194  /// texture type.
195  ///
196  /// Only has an effect if non-zero and only applies to textures if
197  /// no texture handle referencing the texture has a memory
198  /// request.
199  ///
200  HDST_API
202  HdTextureType textureType,
203  size_t memoryRequest);
204 
205  /// ------------------------------------------------------------------------
206  /// BAR allocation API
207  /// ------------------------------------------------------------------------
208  ///
209  /// The Allocate* flavor of methods allocate a new BAR for the given buffer
210  /// specs using the chosen aggregation strategy.
211 
212  HDST_API
214  TfToken const &role,
215  HdBufferSpecVector const &bufferSpecs,
216  HdBufferArrayUsageHint usageHint);
217 
218  HDST_API
220  TfToken const &role,
221  HdBufferSpecVector const &bufferSpecs,
222  HdBufferArrayUsageHint usageHint);
223 
224  HDST_API
226  TfToken const &role,
227  HdBufferSpecVector const &bufferSpecs,
228  HdBufferArrayUsageHint usageHint);
229 
230  HDST_API
232  TfToken const &role,
233  HdBufferSpecVector const &bufferSpecs,
234  HdBufferArrayUsageHint usageHint);
235 
236  HDST_API
238  TfToken const &role,
239  HdBufferSpecVector const &bufferSpecs,
240  HdBufferArrayUsageHint usageHint);
241 
242  /// ------------------------------------------------------------------------
243  /// BAR allocation/migration/update API
244  /// ------------------------------------------------------------------------
245  ///
246  /// The Update* flavor of methods handle both allocation of a new BAR and
247  /// reallocation-migration based on the existing range, updated/added specs,
248  /// removed specs and usage hint. This allows client code to be less verbose
249  /// when a range's signature (specs) can change.
250  ///
251  /// If \p curRange is invalid, this is equivalent to calling Allocate*.
252  /// Otherwise, checks if \p curRange needs to be migrated to a new range
253  /// (based on \p updatedOrAddedSpecs and \p removedSpecs and \p usageHint).
254  /// If migration is necessary, allocate a new range and register necessary
255  /// migration computations and return the new range.
256  /// Otherwise, just return the same range.
257 
258  HDST_API
260  TfToken const &role,
261  HdBufferArrayRangeSharedPtr const& curRange,
262  HdBufferSpecVector const &updatedOrAddedSpecs,
263  HdBufferSpecVector const& removedSpecs,
264  HdBufferArrayUsageHint usageHint);
265 
266  HDST_API
268  TfToken const &role,
269  HdBufferArrayRangeSharedPtr const& curRange,
270  HdBufferSpecVector const &updatedOrAddedSpecs,
271  HdBufferSpecVector const& removedSpecs,
272  HdBufferArrayUsageHint usageHint);
273 
274  HDST_API
276  TfToken const &role,
277  HdBufferArrayRangeSharedPtr const& curRange,
278  HdBufferSpecVector const &updatedOrAddedSpecs,
279  HdBufferSpecVector const& removedSpecs,
280  HdBufferArrayUsageHint usageHint);
281 
282  HDST_API
284  TfToken const &role,
285  HdBufferArrayRangeSharedPtr const& curRange,
286  HdBufferSpecVector const &updatedOrAddedSpecs,
287  HdBufferSpecVector const& removedSpecs,
288  HdBufferArrayUsageHint usageHint);
289 
290  /// ------------------------------------------------------------------------
291  /// Resource update & computation queuing API
292  /// ------------------------------------------------------------------------
293 
294  /// Append source data for given range to be committed later.
295  HDST_API
298 
299  /// Append a source data for given range to be committed later.
300  HDST_API
301  void AddSource(HdBufferArrayRangeSharedPtr const &range,
303 
304  /// Append a source data just to be resolved (used for cpu computations).
305  HDST_API
306  void AddSource(HdBufferSourceSharedPtr const &source);
307 
308  /// Append a gpu computation into queue.
309  /// The parameter 'range' specifies the destination buffer range,
310  /// which has to be allocated by caller of this function.
311  ///
312  /// note: GPU computations will be executed in the order that
313  /// they are registered.
314  HDST_API
316  HdStComputationSharedPtr const &computation,
317  HdStComputeQueue const queue);
318 
319  /// ------------------------------------------------------------------------
320  /// Dispatch & buffer API
321  /// ------------------------------------------------------------------------
322 
323  /// Register a buffer allocated with \a count * \a commandNumUints *
324  /// sizeof(uint32_t) to be used as an indirect dispatch buffer.
325  HDST_API
327  TfToken const &role, int count, int commandNumUints);
328 
329  /// Register a misc buffer resource.
330  /// Usually buffers are part of a buffer array (buffer aggregation) and are
331  /// managed via buffer array APIs.
332  /// RegisterBufferResource lets you create a standalone buffer that can
333  /// be used for misc purposes (Eg. GPU frustum cull prim count read back).
334  HDST_API
336  TfToken const &role,
337  HdTupleType tupleType);
338 
339  /// Remove any entries associated with expired dispatch buffers.
340  HDST_API
342 
343  /// Remove any entries associated with expired misc buffers.
344  HDST_API
346 
347  /// ------------------------------------------------------------------------
348  /// Instance Registries
349  /// ------------------------------------------------------------------------
350 
351  /// These registries implement sharing and deduplication of data based
352  /// on computed hash identifiers. Each returned HdInstance object retains
353  /// a shared pointer to a data instance. When an HdInstance is registered
354  /// for a previously unused ID, the data pointer will be null and it is
355  /// the caller's responsibility to set its value. The instance registries
356  /// are cleaned of unreferenced entries during garbage collection.
357  ///
358  /// Note: As entries can be registered from multiple threads, the returned
359  /// object holds a lock on the instance registry. This lock is held
360  /// until the returned HdInstance object is destroyed.
361 
362  /// Topology instancing
363  HDST_API
366 
367  HDST_API
371 
372  HDST_API
376 
377  /// Topology Index buffer array range instancing
378  /// Returns the HdInstance points to shared HdBufferArrayRange,
379  /// distinguished by given ID.
380  /// *Refer the comment on RegisterTopology for the same consideration.
381  HDST_API
385 
386  HDST_API
390 
391  /// Primvar array range instancing
392  /// Returns the HdInstance pointing to shared HdBufferArrayRange,
393  /// distinguished by given ID.
394  /// *Refer the comment on RegisterTopology for the same consideration.
395  HDST_API
399 
400  /// ExtComputation data array range instancing
401  /// Returns the HdInstance pointing to shared HdBufferArrayRange,
402  /// distinguished by given ID.
403  /// *Refer the comment on RegisterTopology for the same consideration.
404  HDST_API
408 
409  /// Register a geometric shader.
410  HDST_API
413 
414  /// Register a GLSL program into the program registry.
415  HDST_API
418 
419  /// Register a GLSLFX file.
420  HDST_API
423 
424 #ifdef PXR_MATERIALX_SUPPORT_ENABLED
425  /// Register MaterialX GLSLFX Shader.
426  HDST_API
428  RegisterMaterialXShader(HdInstance<MaterialX::ShaderPtr>::ID id);
429 #endif
430 
431  /// Register a Hgi resource bindings into the registry.
432  HDST_API
435 
436  /// Register a Hgi graphics pipeline into the registry.
437  HDST_API
440 
441  /// Register a Hgi compute pipeline into the registry.
442  HDST_API
445 
446  /// Returns the global hgi blit command queue for recording blitting work.
447  /// When using this global cmd instead of creating a new HgiBlitCmds we
448  /// reduce the number of command buffers being created.
449  /// The returned pointer should not be held onto by the client as it is
450  /// only valid until the HgiBlitCmds has been submitted.
451  HDST_API
453 
454  /// Returns the global hgi compute cmd queue for recording compute work.
455  /// When using this global cmd instead of creating a new HgiComputeCmds we
456  /// reduce the number of command buffers being created.
457  /// The returned pointer should not be held onto by the client as it is
458  /// only valid until the HgiComputeCmds has been submitted.
459  HDST_API
462 
463  /// Submits blit work queued in global blit cmds for GPU execution.
464  /// We can call this when we want to submit some work to the GPU.
465  /// To stall the CPU and wait for the GPU to finish, 'wait' can be provided.
466  /// To insert a barrier to ensure memory writes are visible after the
467  /// barrier a HgiMemoryBarrier can be provided.
468  HDST_API
470 
471  /// Submits compute work queued in global compute cmds for GPU execution.
472  /// We can call this when we want to submit some work to the GPU.
473  /// To stall the CPU and wait for the GPU to finish, 'wait' can be provided.
474  /// To insert a barrier to ensure memory writes are visible after the
475  /// barrier a HgiMemoryBarrier can be provided.
476  HDST_API
478 
479  /// Returns the staging buffer used when committing data to the GPU.
480  HDST_API
482 
483 public:
484  //
485  // Unit test API
486  //
487 
488  /// Set the aggregation strategy for non uniform parameters
489  /// (vertex, varying, facevarying)
490  /// Takes ownership of the passed in strategy object.
492  std::unique_ptr<HdStAggregationStrategy> &&strategy) {
493  _nonUniformAggregationStrategy = std::move(strategy);
494  }
495 
496  /// Set the aggregation strategy for non uniform immutable parameters
497  /// (vertex, varying, facevarying)
498  /// Takes ownership of the passed in strategy object.
500  std::unique_ptr<HdStAggregationStrategy> &&strategy) {
501  _nonUniformImmutableAggregationStrategy = std::move(strategy);
502  }
503 
504  /// Set the aggregation strategy for uniform (shader globals)
505  /// Takes ownership of the passed in strategy object.
507  std::unique_ptr<HdStAggregationStrategy> &&strategy) {
508  _uniformUboAggregationStrategy = std::move(strategy);
509  }
510 
511  /// Set the aggregation strategy for SSBO (uniform primvars)
512  /// Takes ownership of the passed in strategy object.
514  std::unique_ptr<HdStAggregationStrategy> &&strategy) {
515  _uniformSsboAggregationStrategy = std::move(strategy);
516  }
517 
518  /// Set the aggregation strategy for single buffers (for nested instancer).
519  /// Takes ownership of the passed in strategy object.
521  std::unique_ptr<HdStAggregationStrategy> &&strategy) {
522  _singleAggregationStrategy = std::move(strategy);
523  }
524 
525  /// Debug dump
526  HDST_API
527  friend std::ostream &operator <<(
528  std::ostream &out,
529  const HdStResourceRegistry& self);
530 
531 protected:
532  void _Commit() override;
533  void _GarbageCollect() override;
534 
535 private:
536  void _CommitTextures();
537  // Wrapper function for BAR allocation
538  HdBufferArrayRangeSharedPtr _AllocateBufferArrayRange(
539  HdStAggregationStrategy *strategy,
540  HdStBufferArrayRegistry &bufferArrayRegistry,
541  TfToken const &role,
542  HdBufferSpecVector const &bufferSpecs,
543  HdBufferArrayUsageHint usageHint);
544 
545  /// Wrapper function for BAR allocation/reallocation-migration.
546  HdBufferArrayRangeSharedPtr _UpdateBufferArrayRange(
547  HdStAggregationStrategy *strategy,
548  HdStBufferArrayRegistry &bufferArrayRegistry,
549  TfToken const &role,
550  HdBufferArrayRangeSharedPtr const& curRange,
551  HdBufferSpecVector const &updatedOrAddedSpecs,
552  HdBufferSpecVector const& removedSpecs,
553  HdBufferArrayUsageHint usageHint);
554 
555  // Tally resources by key into the given dictionary. Any additions should
556  // be cumulative with the existing key values.
557  void _TallyResourceAllocation(VtDictionary *result) const;
558 
559  // TODO: this is a transient structure. we'll revisit the BufferSource
560  // interface later.
561  struct _PendingSource {
562  _PendingSource(HdBufferArrayRangeSharedPtr const &range)
563  : range(range)
564  , sources()
565  {
566  }
567 
568  _PendingSource(HdBufferArrayRangeSharedPtr const &range,
569  HdBufferSourceSharedPtr const &source)
570  : range(range)
571  , sources(1, source)
572  {
573  }
574 
575  _PendingSource(HdBufferArrayRangeSharedPtr const &range,
577  : range(range)
578  , sources(std::move(sources))
579  {
580  }
581 
584  };
585 
586  Hgi* _hgi;
587 
588  typedef tbb::concurrent_vector<_PendingSource> _PendingSourceList;
589  _PendingSourceList _pendingSources;
590  std::atomic_size_t _numBufferSourcesToResolve;
591 
592  struct _PendingComputation{
593  _PendingComputation(HdBufferArrayRangeSharedPtr const &range,
594  HdStComputationSharedPtr const &computation)
595  : range(range), computation(computation) { }
597  HdStComputationSharedPtr computation;
598  };
599 
600  // If we need more 'compute queues' we can increase HdStComputeQueueCount.
601  // We could also consider tbb::concurrent_priority_queue if we want this
602  // to be dynamically scalable.
603  typedef tbb::concurrent_vector<_PendingComputation> _PendingComputationList;
604  _PendingComputationList _pendingComputations[HdStComputeQueueCount];
605 
606  // aggregated buffer array
607  HdStBufferArrayRegistry _nonUniformBufferArrayRegistry;
608  HdStBufferArrayRegistry _nonUniformImmutableBufferArrayRegistry;
609  HdStBufferArrayRegistry _uniformUboBufferArrayRegistry;
610  HdStBufferArrayRegistry _uniformSsboBufferArrayRegistry;
611  HdStBufferArrayRegistry _singleBufferArrayRegistry;
612 
613  // current aggregation strategies
614  std::unique_ptr<HdStAggregationStrategy> _nonUniformAggregationStrategy;
615  std::unique_ptr<HdStAggregationStrategy>
616  _nonUniformImmutableAggregationStrategy;
617  std::unique_ptr<HdStAggregationStrategy> _uniformUboAggregationStrategy;
618  std::unique_ptr<HdStAggregationStrategy> _uniformSsboAggregationStrategy;
619  std::unique_ptr<HdStAggregationStrategy> _singleAggregationStrategy;
620 
621  typedef std::vector<HdStDispatchBufferSharedPtr>
622  _DispatchBufferRegistry;
623  _DispatchBufferRegistry _dispatchBufferRegistry;
624 
625  typedef std::vector<HdStBufferResourceSharedPtr>
626  _BufferResourceRegistry;
627  _BufferResourceRegistry _bufferResourceRegistry;
628 
629  // Register mesh topology.
631  _meshTopologyRegistry;
632 
633  // Register basisCurves topology.
635  _basisCurvesTopologyRegistry;
636 
637  // Register vertex adjacency.
639  _vertexAdjacencyBuilderRegistry;
640 
641  // Register topology index buffers.
643  _TopologyIndexRangeInstanceRegistry;
644  typedef tbb::concurrent_unordered_map< TfToken,
645  _TopologyIndexRangeInstanceRegistry,
647  _TopologyIndexRangeInstanceRegMap;
648 
649  _TopologyIndexRangeInstanceRegMap _meshTopologyIndexRangeRegistry;
650  _TopologyIndexRangeInstanceRegMap _basisCurvesTopologyIndexRangeRegistry;
651 
652  // Register shared primvar buffers.
654  _primvarRangeRegistry;
655 
656  // Register ext computation resource.
658  _extComputationDataRangeRegistry;
659 
660  // geometric shader registry
662  _geometricShaderRegistry;
663 
664  // glsl shader program registry
666  _glslProgramRegistry;
667 
668  // glslfx file registry
670  _glslfxFileRegistry;
671 
672 #ifdef PXR_MATERIALX_SUPPORT_ENABLED
673  // MaterialX glslfx shader registry
674  HdInstanceRegistry<MaterialX::ShaderPtr> _materialXShaderRegistry;
675 #endif
676 
677  // texture handle registry
678  std::unique_ptr<class HdSt_TextureHandleRegistry> _textureHandleRegistry;
679 
680  // Hgi resource bindings registry
682  _resourceBindingsRegistry;
683 
684  // Hgi graphics pipeline registry
686  _graphicsPipelineRegistry;
687 
688  // Hgi compute pipeline registry
690  _computePipelineRegistry;
691 
692  HgiBlitCmdsUniquePtr _blitCmds;
693  HgiComputeCmdsUniquePtr _computeCmds;
694 
695  std::unique_ptr<HdStStagingBuffer> _stagingBuffer;
696 };
697 
698 
700 
701 #endif //PXR_IMAGING_HD_ST_RESOURCE_REGISTRY_H
HDST_API HdStStagingBuffer * GetStagingBuffer()
Returns the staging buffer used when committing data to the GPU.
std::shared_ptr< class HdStDispatchBuffer > HdStDispatchBufferSharedPtr
void SetUniformAggregationStrategy(std::unique_ptr< HdStAggregationStrategy > &&strategy)
HDST_API HdBufferArrayRangeSharedPtr UpdateUniformBufferArrayRange(TfToken const &role, HdBufferArrayRangeSharedPtr const &curRange, HdBufferSpecVector const &updatedOrAddedSpecs, HdBufferSpecVector const &removedSpecs, HdBufferArrayUsageHint usageHint)
GLenum GLint * range
Definition: glcorearb.h:1925
HDST_API HdInstance< HdSt_MeshTopologySharedPtr > RegisterMeshTopology(HdInstance< HdSt_MeshTopologySharedPtr >::ID id)
Topology instancing.
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
std::weak_ptr< class HdStShaderCode > HdStShaderCodePtr
#define MATERIALX_NAMESPACE_BEGIN
Definition: Generated.h:25
GLsizei const GLchar *const * string
Definition: glcorearb.h:814
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
std::shared_ptr< class HdSt_GeometricShader > HdSt_GeometricShaderSharedPtr
Definition: drawItem.h:36
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)
**But if you need a result
Definition: thread.h:613
void SetSingleStorageAggregationStrategy(std::unique_ptr< HdStAggregationStrategy > &&strategy)
HDST_API HdInstance< HdBufferArrayRangeSharedPtr > RegisterExtComputationDataRange(HdInstance< HdBufferArrayRangeSharedPtr >::ID id)
HDST_API HdInstance< HdBufferArrayRangeSharedPtr > RegisterPrimvarRange(HdInstance< HdBufferArrayRangeSharedPtr >::ID id)
HDST_API HdInstance< HdSt_VertexAdjacencyBuilderSharedPtr > RegisterVertexAdjacencyBuilder(HdInstance< HdSt_VertexAdjacencyBuilderSharedPtr >::ID id)
HDST_API HdInstance< HdSt_GeometricShaderSharedPtr > RegisterGeometricShader(HdInstance< HdSt_GeometricShaderSharedPtr >::ID id)
Register a geometric shader.
HgiSubmitWaitType
Definition: enums.h:663
GLsizei GLenum * sources
Definition: glcorearb.h:2542
Definition: token.h:87
std::shared_ptr< class HdSt_MeshTopology > HdSt_MeshTopologySharedPtr
Definition: mesh.h:49
HDST_API HdBufferArrayRangeSharedPtr AllocateNonUniformBufferArrayRange(TfToken const &role, HdBufferSpecVector const &bufferSpecs, HdBufferArrayUsageHint usageHint)
HgiComputeDispatch
Definition: enums.h:825
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
HDST_API void AddComputation(HdBufferArrayRangeSharedPtr const &range, HdStComputationSharedPtr const &computation, HdStComputeQueue const queue)
void _Commit() override
A hook for derived registries to perform additional resource commits.
std::shared_ptr< HgiResourceBindingsHandle > HgiResourceBindingsSharedPtr
GLsizei GLsizei GLchar * source
Definition: glcorearb.h:803
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)
std::shared_ptr< class HdStComputation > HdStComputationSharedPtr
Definition: computation.h:41
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.
*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.
GLuint const GLchar * name
Definition: glcorearb.h:786
HDST_API ~HdStResourceRegistry() override
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:110
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
HDST_API HgiComputeCmds * GetGlobalComputeCmds(HgiComputeDispatch dispatchMethod=HgiComputeDispatchSerial)
HDST_API void InvalidateShaderRegistry() override
Invalidate any shaders registered with this registry.
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1441
HDST_API HdBufferArrayRangeSharedPtr UpdateShaderStorageBufferArrayRange(TfToken const &role, HdBufferArrayRangeSharedPtr const &curRange, HdBufferSpecVector const &updatedOrAddedSpecs, HdBufferSpecVector const &removedSpecs, HdBufferArrayUsageHint usageHint)
std::vector< std::pair< HdStComputationSharedPtr, HdStComputeQueue >> HdStComputationComputeQueuePairVector
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:44
void _GarbageCollect() override
std::shared_ptr< class HdSt_VertexAdjacencyBuilder > HdSt_VertexAdjacencyBuilderSharedPtr
Definition: mesh.h:47
shared_ptr< Shader > ShaderPtr
Shared pointer to a Shader.
Definition: Library.h:34
void SetNonUniformImmutableAggregationStrategy(std::unique_ptr< HdStAggregationStrategy > &&strategy)
HDST_API HgiBlitCmds * GetGlobalBlitCmds()
#define MATERIALX_NAMESPACE_END
Definition: Generated.h:26
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.
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 HdBufferSource > HdBufferSourceSharedPtr
void SetShaderStorageAggregationStrategy(std::unique_ptr< HdStAggregationStrategy > &&strategy)
std::shared_ptr< class HdStResourceRegistry > HdStResourceRegistrySharedPtr
Definition: commandBuffer.h:47
HDST_API HdStResourceRegistry(Hgi *hgi)
HDST_API HdBufferArrayRangeSharedPtr AllocateUniformBufferArrayRange(TfToken const &role, HdBufferSpecVector const &bufferSpecs, HdBufferArrayUsageHint usageHint)
void SetNonUniformAggregationStrategy(std::unique_ptr< HdStAggregationStrategy > &&strategy)
HDST_API HdInstance< HdStGLSLProgramSharedPtr > RegisterGLSLProgram(HdInstance< HdStGLSLProgramSharedPtr >::ID id)
Register a GLSL program into the program registry.
GLint GLsizei count
Definition: glcorearb.h:405