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 
85 /// \enum HdStComputeQueue
86 ///
87 /// Determines the 'compute queue' a computation should be added into.
88 ///
89 /// We only perform synchronization between queues, not within one queue.
90 /// In OpenGL terms that means we insert memory barriers between computations
91 /// of two queues, but not between two computations in the same queue.
92 ///
93 /// A prim determines the role for each queue based on its local knowledge of
94 /// compute dependencies. Eg. HdStMesh knows computing normals should wait
95 /// until the primvar refinement computation has fnished. It can assign one
96 /// queue to primvar refinement and a following queue for normal computations.
97 ///
104 
106  std::vector<std::pair<HdComputationSharedPtr, HdStComputeQueue>>;
107 
108 
109 /// \class HdStResourceRegistry
110 ///
111 /// A central registry of all GPU resources.
112 ///
114 {
115 public:
116  HF_MALLOC_TAG_NEW("new HdStResourceRegistry");
117 
118  HDST_API
119  explicit HdStResourceRegistry(Hgi* hgi);
120 
121  HDST_API
122  ~HdStResourceRegistry() override;
123 
124  HDST_API
125  void InvalidateShaderRegistry() override;
126 
127  HDST_API
128  void ReloadResource(TfToken const& resourceType,
129  std::string const& path) override;
130 
131  HDST_API
132  VtDictionary GetResourceAllocation() const override;
133 
134  /// Returns Hgi used to create/destroy GPU resources.
135  HDST_API
136  Hgi* GetHgi();
137 
138  /// ------------------------------------------------------------------------
139  /// Texture allocation API
140  /// ------------------------------------------------------------------------
141  ///
142 
143  /// Allocate texture handle (encapsulates texture and sampler
144  /// object, bindless texture sampler handle, memory request and
145  /// 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  /// Also create a GL texture sampler handle for bindless
167  /// textures.
168  bool createBindlessHandle,
169  /// After the texture is committed (or after it has been
170  /// changed) the given shader code can add additional buffer
171  /// sources and computations using the texture metadata with
172  /// AddResourcesFromTextures.
173  HdStShaderCodePtr const &shaderCode);
174 
175  /// Allocate texture object.
176  ///
177  /// The actual allocation of the associated GPU texture and
178  /// sampler resources and loading of the texture file is delayed
179  /// until the commit phase.
180  HDST_API
182  /// Path to file and information to identify a texture if the
183  /// file is a container for several textures (e.g., OpenVDB
184  /// file containing several grids, movie file containing frames).
185  const HdStTextureIdentifier &textureId,
186  /// Texture type, e.g., uv, ptex, ...
187  HdTextureType textureType);
188 
189  /// Sets how much memory a single texture can consume in bytes by
190  /// texture type.
191  ///
192  /// Only has an effect if non-zero and only applies to textures if
193  /// no texture handle referencing the texture has a memory
194  /// request.
195  ///
196  HDST_API
198  HdTextureType textureType,
199  size_t memoryRequest);
200 
201  /// ------------------------------------------------------------------------
202  /// BAR allocation API
203  /// ------------------------------------------------------------------------
204  ///
205  /// The Allocate* flavor of methods allocate a new BAR for the given buffer
206  /// specs using the chosen aggregation strategy.
207 
208  HDST_API
210  TfToken const &role,
211  HdBufferSpecVector const &bufferSpecs,
212  HdBufferArrayUsageHint usageHint);
213 
214  HDST_API
216  TfToken const &role,
217  HdBufferSpecVector const &bufferSpecs,
218  HdBufferArrayUsageHint usageHint);
219 
220  HDST_API
222  TfToken const &role,
223  HdBufferSpecVector const &bufferSpecs,
224  HdBufferArrayUsageHint usageHint);
225 
226  HDST_API
228  TfToken const &role,
229  HdBufferSpecVector const &bufferSpecs,
230  HdBufferArrayUsageHint usageHint);
231 
232  HDST_API
234  TfToken const &role,
235  HdBufferSpecVector const &bufferSpecs,
236  HdBufferArrayUsageHint usageHint);
237 
238  /// ------------------------------------------------------------------------
239  /// BAR allocation/migration/update API
240  /// ------------------------------------------------------------------------
241  ///
242  /// The Update* flavor of methods handle both allocation of a new BAR and
243  /// reallocation-migration based on the existing range, updated/added specs,
244  /// removed specs and usage hint. This allows client code to be less verbose
245  /// when a range's signature (specs) can change.
246  ///
247  /// If \p curRange is invalid, this is equivalent to calling Allocate*.
248  /// Otherwise, checks if \p curRange needs to be migrated to a new range
249  /// (based on \p updatedOrAddedSpecs and \p removedSpecs and \p usageHint).
250  /// If migration is necessary, allocate a new range and register necessary
251  /// migration computations and return the new range.
252  /// Otherwise, just return the same range.
253 
254  HDST_API
256  TfToken const &role,
257  HdBufferArrayRangeSharedPtr const& curRange,
258  HdBufferSpecVector const &updatedOrAddedSpecs,
259  HdBufferSpecVector const& removedSpecs,
260  HdBufferArrayUsageHint usageHint);
261 
262  HDST_API
264  TfToken const &role,
265  HdBufferArrayRangeSharedPtr const& curRange,
266  HdBufferSpecVector const &updatedOrAddedSpecs,
267  HdBufferSpecVector const& removedSpecs,
268  HdBufferArrayUsageHint usageHint);
269 
270  HDST_API
272  TfToken const &role,
273  HdBufferArrayRangeSharedPtr const& curRange,
274  HdBufferSpecVector const &updatedOrAddedSpecs,
275  HdBufferSpecVector const& removedSpecs,
276  HdBufferArrayUsageHint usageHint);
277 
278  HDST_API
280  TfToken const &role,
281  HdBufferArrayRangeSharedPtr const& curRange,
282  HdBufferSpecVector const &updatedOrAddedSpecs,
283  HdBufferSpecVector const& removedSpecs,
284  HdBufferArrayUsageHint usageHint);
285 
286  /// ------------------------------------------------------------------------
287  /// Resource update & computation queuing API
288  /// ------------------------------------------------------------------------
289 
290  /// Append source data for given range to be committed later.
291  HDST_API
294 
295  /// Append a source data for given range to be committed later.
296  HDST_API
297  void AddSource(HdBufferArrayRangeSharedPtr const &range,
299 
300  /// Append a source data just to be resolved (used for cpu computations).
301  HDST_API
302  void AddSource(HdBufferSourceSharedPtr const &source);
303 
304  /// Append a gpu computation into queue.
305  /// The parameter 'range' specifies the destination buffer range,
306  /// which has to be allocated by caller of this function.
307  ///
308  /// note: GPU computations will be executed in the order that
309  /// they are registered.
310  HDST_API
312  HdComputationSharedPtr const &computation,
313  HdStComputeQueue const queue);
314 
315  /// ------------------------------------------------------------------------
316  /// Dispatch & buffer API
317  /// ------------------------------------------------------------------------
318 
319  /// Register a buffer allocated with \a count * \a commandNumUints *
320  /// sizeof(uint32_t) to be used as an indirect dispatch buffer.
321  HDST_API
323  TfToken const &role, int count, int commandNumUints);
324 
325  /// Register a misc buffer resource.
326  /// Usually buffers are part of a buffer array (buffer aggregation) and are
327  /// managed via buffer array APIs.
328  /// RegisterBufferResource lets you create a standalone buffer that can
329  /// be used for misc purposes (Eg. GPU frustum cull prim count read back).
330  HDST_API
332  TfToken const &role,
333  HdTupleType tupleType);
334 
335  /// Remove any entries associated with expired dispatch buffers.
336  HDST_API
338 
339  /// Remove any entries associated with expired misc buffers.
340  HDST_API
342 
343  /// ------------------------------------------------------------------------
344  /// Instance Registries
345  /// ------------------------------------------------------------------------
346 
347  /// These registries implement sharing and deduplication of data based
348  /// on computed hash identifiers. Each returned HdInstance object retains
349  /// a shared pointer to a data instance. When an HdInstance is registered
350  /// for a previously unused ID, the data pointer will be null and it is
351  /// the caller's responsibility to set its value. The instance registries
352  /// are cleaned of unreferenced entries during garbage collection.
353  ///
354  /// Note: As entries can be registered from multiple threads, the returned
355  /// object holds a lock on the instance registry. This lock is held
356  /// until the returned HdInstance object is destroyed.
357 
358  /// Topology instancing
359  HDST_API
362 
363  HDST_API
367 
368  HDST_API
371 
372  /// Topology Index buffer array range instancing
373  /// Returns the HdInstance points to shared HdBufferArrayRange,
374  /// distinguished by given ID.
375  /// *Refer the comment on RegisterTopology for the same consideration.
376  HDST_API
380 
381  HDST_API
385 
386  /// Primvar array range instancing
387  /// Returns the HdInstance pointing to shared HdBufferArrayRange,
388  /// distinguished by given ID.
389  /// *Refer the comment on RegisterTopology for the same consideration.
390  HDST_API
394 
395  /// ExtComputation data array range instancing
396  /// Returns the HdInstance pointing to shared HdBufferArrayRange,
397  /// distinguished by given ID.
398  /// *Refer the comment on RegisterTopology for the same consideration.
399  HDST_API
403 
404  /// Register a geometric shader.
405  HDST_API
408 
409  /// Register a GLSL program into the program registry.
410  HDST_API
413 
414  /// Register a GLSLFX file.
415  HDST_API
418 
419  /// Register a Hgi resource bindings into the registry.
420  HDST_API
423 
424  /// Register a Hgi graphics pipeline into the registry.
425  HDST_API
428 
429  /// Register a Hgi compute pipeline into the registry.
430  HDST_API
433 
434  /// Returns the global hgi blit command queue for recording blitting work.
435  /// When using this global cmd instead of creating a new HgiBlitCmds we
436  /// reduce the number of command buffers being created.
437  /// The returned pointer should not be held onto by the client as it is
438  /// only valid until the HgiBlitCmds has been submitted.
439  HDST_API
441 
442  /// Returns the global hgi compute cmd queue for recording compute work.
443  /// When using this global cmd instead of creating a new HgiComputeCmds we
444  /// reduce the number of command buffers being created.
445  /// The returned pointer should not be held onto by the client as it is
446  /// only valid until the HgiComputeCmds has been submitted.
447  HDST_API
449 
450  /// Submits blit work queued in global blit cmds for GPU execution.
451  /// We can call this when we want to submit some work to the GPU.
452  /// To stall the CPU and wait for the GPU to finish, 'wait' can be provided.
453  /// To insert a barrier to ensure memory writes are visible after the
454  /// barrier a HgiMemoryBarrier can be provided.
455  HDST_API
457 
458  /// Submits compute work queued in global compute cmds for GPU execution.
459  /// We can call this when we want to submit some work to the GPU.
460  /// To stall the CPU and wait for the GPU to finish, 'wait' can be provided.
461  /// To insert a barrier to ensure memory writes are visible after the
462  /// barrier a HgiMemoryBarrier can be provided.
463  HDST_API
465 
466 public:
467  //
468  // Unit test API
469  //
470 
471  /// Set the aggregation strategy for non uniform parameters
472  /// (vertex, varying, facevarying)
473  /// Takes ownership of the passed in strategy object.
475  std::unique_ptr<HdAggregationStrategy> &&strategy) {
476  _nonUniformAggregationStrategy = std::move(strategy);
477  }
478 
479  /// Set the aggregation strategy for non uniform immutable parameters
480  /// (vertex, varying, facevarying)
481  /// Takes ownership of the passed in strategy object.
483  std::unique_ptr<HdAggregationStrategy> &&strategy) {
484  _nonUniformImmutableAggregationStrategy = std::move(strategy);
485  }
486 
487  /// Set the aggregation strategy for uniform (shader globals)
488  /// Takes ownership of the passed in strategy object.
490  std::unique_ptr<HdAggregationStrategy> &&strategy) {
491  _uniformUboAggregationStrategy = std::move(strategy);
492  }
493 
494  /// Set the aggregation strategy for SSBO (uniform primvars)
495  /// Takes ownership of the passed in strategy object.
497  std::unique_ptr<HdAggregationStrategy> &&strategy) {
498  _uniformSsboAggregationStrategy = std::move(strategy);
499  }
500 
501  /// Set the aggregation strategy for single buffers (for nested instancer).
502  /// Takes ownership of the passed in strategy object.
504  std::unique_ptr<HdAggregationStrategy> &&strategy) {
505  _singleAggregationStrategy = std::move(strategy);
506  }
507 
508  /// Debug dump
509  HDST_API
510  friend std::ostream &operator <<(
511  std::ostream &out,
512  const HdStResourceRegistry& self);
513 
514 protected:
515  void _Commit() override;
516  void _GarbageCollect() override;
517 
518 private:
519  void _CommitTextures();
520  // Wrapper function for BAR allocation
521  HdBufferArrayRangeSharedPtr _AllocateBufferArrayRange(
522  HdAggregationStrategy *strategy,
523  HdBufferArrayRegistry &bufferArrayRegistry,
524  TfToken const &role,
525  HdBufferSpecVector const &bufferSpecs,
526  HdBufferArrayUsageHint usageHint);
527 
528  /// Wrapper function for BAR allocation/reallocation-migration.
529  HdBufferArrayRangeSharedPtr _UpdateBufferArrayRange(
530  HdAggregationStrategy *strategy,
531  HdBufferArrayRegistry &bufferArrayRegistry,
532  TfToken const &role,
533  HdBufferArrayRangeSharedPtr const& curRange,
534  HdBufferSpecVector const &updatedOrAddedSpecs,
535  HdBufferSpecVector const& removedSpecs,
536  HdBufferArrayUsageHint usageHint);
537 
538  // Tally resources by key into the given dictionary. Any additions should
539  // be cumulative with the existing key values.
540  void _TallyResourceAllocation(VtDictionary *result) const;
541 
542  // TODO: this is a transient structure. we'll revisit the BufferSource
543  // interface later.
544  struct _PendingSource {
545  _PendingSource(HdBufferArrayRangeSharedPtr const &range)
546  : range(range)
547  , sources()
548  {
549  }
550 
551  _PendingSource(HdBufferArrayRangeSharedPtr const &range,
552  HdBufferSourceSharedPtr const &source)
553  : range(range)
554  , sources(1, source)
555  {
556  }
557 
558  _PendingSource(HdBufferArrayRangeSharedPtr const &range,
560  : range(range)
561  , sources(std::move(sources))
562  {
563  }
564 
567  };
568 
569  Hgi* _hgi;
570 
571  typedef tbb::concurrent_vector<_PendingSource> _PendingSourceList;
572  _PendingSourceList _pendingSources;
573  std::atomic_size_t _numBufferSourcesToResolve;
574 
575  struct _PendingComputation{
576  _PendingComputation(HdBufferArrayRangeSharedPtr const &range,
577  HdComputationSharedPtr const &computation)
578  : range(range), computation(computation) { }
580  HdComputationSharedPtr computation;
581  };
582 
583  // If we need more 'compute queues' we can increase HdStComputeQueueCount.
584  // We could also consider tbb::concurrent_priority_queue if we want this
585  // to be dynamically scalable.
586  typedef tbb::concurrent_vector<_PendingComputation> _PendingComputationList;
587  _PendingComputationList _pendingComputations[HdStComputeQueueCount];
588 
589  // aggregated buffer array
590  HdBufferArrayRegistry _nonUniformBufferArrayRegistry;
591  HdBufferArrayRegistry _nonUniformImmutableBufferArrayRegistry;
592  HdBufferArrayRegistry _uniformUboBufferArrayRegistry;
593  HdBufferArrayRegistry _uniformSsboBufferArrayRegistry;
594  HdBufferArrayRegistry _singleBufferArrayRegistry;
595 
596  // current aggregation strategies
597  std::unique_ptr<HdAggregationStrategy> _nonUniformAggregationStrategy;
598  std::unique_ptr<HdAggregationStrategy>
599  _nonUniformImmutableAggregationStrategy;
600  std::unique_ptr<HdAggregationStrategy> _uniformUboAggregationStrategy;
601  std::unique_ptr<HdAggregationStrategy> _uniformSsboAggregationStrategy;
602  std::unique_ptr<HdAggregationStrategy> _singleAggregationStrategy;
603 
604  typedef std::vector<HdStDispatchBufferSharedPtr>
605  _DispatchBufferRegistry;
606  _DispatchBufferRegistry _dispatchBufferRegistry;
607 
608  typedef std::vector<HdStBufferResourceSharedPtr>
609  _BufferResourceRegistry;
610  _BufferResourceRegistry _bufferResourceRegistry;
611 
612  // Register mesh topology.
614  _meshTopologyRegistry;
615 
616  // Register basisCurves topology.
618  _basisCurvesTopologyRegistry;
619 
620  // Register vertex adjacency.
622  _vertexAdjacencyRegistry;
623 
624  // Register topology index buffers.
626  _TopologyIndexRangeInstanceRegistry;
627  typedef tbb::concurrent_unordered_map< TfToken,
628  _TopologyIndexRangeInstanceRegistry,
630  _TopologyIndexRangeInstanceRegMap;
631 
632  _TopologyIndexRangeInstanceRegMap _meshTopologyIndexRangeRegistry;
633  _TopologyIndexRangeInstanceRegMap _basisCurvesTopologyIndexRangeRegistry;
634 
635  // Register shared primvar buffers.
637  _primvarRangeRegistry;
638 
639  // Register ext computation resource.
641  _extComputationDataRangeRegistry;
642 
643  // geometric shader registry
645  _geometricShaderRegistry;
646 
647  // glsl shader program registry
649  _glslProgramRegistry;
650 
651  // glslfx file registry
653  _glslfxFileRegistry;
654 
655  // texture handle registry
656  std::unique_ptr<class HdSt_TextureHandleRegistry> _textureHandleRegistry;
657 
658  // Hgi resource bindings registry
660  _resourceBindingsRegistry;
661 
662  // Hgi graphics pipeline registry
664  _graphicsPipelineRegistry;
665 
666  // Hgi compute pipeline registry
668  _computePipelineRegistry;
669 
670  HgiBlitCmdsUniquePtr _blitCmds;
671  HgiComputeCmdsUniquePtr _computeCmds;
672 };
673 
674 
676 
677 #endif //PXR_IMAGING_HD_ST_RESOURCE_REGISTRY_H
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:3340
void SetShaderStorageAggregationStrategy(std::unique_ptr< HdAggregationStrategy > &&strategy)
std::shared_ptr< class HdSt_GeometricShader > HdSt_GeometricShaderSharedPtr
Definition: drawItem.h:33
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:785
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:516
GLsizei GLenum * sources
Definition: glcorearb.h:2541
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:802
HDST_API HdStTextureHandleSharedPtr AllocateTextureHandle(const HdStTextureIdentifier &textureId, HdTextureType textureType, const HdSamplerParameters &samplerParams, size_t memoryRequest, bool createBindlessHandle, HdStShaderCodePtr const &shaderCode)
GLsizei const GLchar *const * string
Definition: glcorearb.h:813
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:629
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:404
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:106
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:1375
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)
std::shared_ptr< HdBufferArrayRange > HdBufferArrayRangeSharedPtr
Definition: bufferArray.h:45
void _GarbageCollect() override
GLenum GLint * range
Definition: glcorearb.h:1924
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:47
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.