All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HdStResourceRegistry Class Reference

A central registry of all GPU resources. More...

+ Inheritance diagram for HdStResourceRegistry:

Public Member Functions

 HF_MALLOC_TAG_NEW ("new HdStResourceRegistry")
 
HDST_API
HdStDispatchBufferSharedPtr 
RegisterDispatchBuffer (TfToken const &role, int count, int commandNumUints)
 Register a buffer allocated with count * commandNumUints * sizeof(GLuint) to be used as an indirect dispatch buffer. More...
 
HDST_API
HdStPersistentBufferSharedPtr 
RegisterPersistentBuffer (TfToken const &role, size_t dataSize, void *data)
 Register a buffer initialized with dataSize bytes of data to be used as a persistently mapped shader storage buffer. More...
 
HDST_API void GarbageCollectDispatchBuffers ()
 Remove any entries associated with expired dispatch buffers. More...
 
HDST_API void GarbageCollectPersistentBuffers ()
 Remove any entries associated with expired persistently mapped buffers. More...
 
HDST_API
HdBufferArrayRangeSharedPtr 
MergeBufferArrayRange (HdAggregationStrategy *strategy, HdBufferArrayRegistry &bufferArrayRegistry, TfToken const &role, HdBufferSpecVector const &newBufferSpecs, HdBufferArrayUsageHint newUsageHint, HdBufferArrayRangeSharedPtr const &range)
 Check if range is compatible with newBufferSpecs. More...
 
HDST_API
HdBufferArrayRangeSharedPtr 
MergeNonUniformBufferArrayRange (TfToken const &role, HdBufferSpecVector const &newBufferSpecs, HdBufferArrayUsageHint newUsageHint, HdBufferArrayRangeSharedPtr const &range)
 MergeBufferArrayRange of non uniform buffer. More...
 
HDST_API
HdBufferArrayRangeSharedPtr 
MergeNonUniformImmutableBufferArrayRange (TfToken const &role, HdBufferSpecVector const &newBufferSpecs, HdBufferArrayUsageHint newUsageHint, HdBufferArrayRangeSharedPtr const &range)
 MergeBufferArrayRange of non uniform immutable buffer. More...
 
HDST_API
HdBufferArrayRangeSharedPtr 
MergeUniformBufferArrayRange (TfToken const &role, HdBufferSpecVector const &newBufferSpecs, HdBufferArrayUsageHint newUsageHint, HdBufferArrayRangeSharedPtr const &range)
 MergeBufferArrayRange of uniform buffer. More...
 
HDST_API
HdBufferArrayRangeSharedPtr 
MergeShaderStorageBufferArrayRange (TfToken const &role, HdBufferSpecVector const &newBufferSpecs, HdBufferArrayUsageHint newUsageHint, HdBufferArrayRangeSharedPtr const &range)
 MergeBufferArrayRange of shader storage buffer. More...
 
HDST_API std::unique_lock
< std::mutex > 
RegisterGeometricShader (HdStShaderKey::ID id, HdInstance< HdStShaderKey::ID, HdSt_GeometricShaderSharedPtr > *pInstance)
 Register a geometric shader. More...
 
HDST_API std::unique_lock
< std::mutex > 
RegisterGLSLProgram (HdStGLSLProgram::ID id, HdInstance< HdStGLSLProgram::ID, HdStGLSLProgramSharedPtr > *pInstance)
 Register a GLSL program into the program registry. More...
 
HDST_API std::unique_lock
< std::mutex > 
RegisterTextureResourceHandle (HdStShaderKey::ID id, HdInstance< HdStShaderKey::ID, HdStTextureResourceHandleSharedPtr > *pInstance)
 Register a texture resource handle. More...
 
HDST_API std::unique_lock
< std::mutex > 
FindTextureResourceHandle (TextureKey id, HdInstance< TextureKey, HdStTextureResourceHandleSharedPtr > *instance, bool *found)
 
void InvalidateShaderRegistry () override
 Invalidate any shaders registered with this registry. More...
 
- Public Member Functions inherited from HdResourceRegistry
 HF_MALLOC_TAG_NEW ("new HdResourceRegistry")
 
HD_API HdBufferArrayRangeSharedPtr AllocateNonUniformBufferArrayRange (TfToken const &role, HdBufferSpecVector const &bufferSpecs, HdBufferArrayUsageHint usageHint)
 Allocate new non uniform buffer array range. More...
 
HD_API HdBufferArrayRangeSharedPtr AllocateNonUniformImmutableBufferArrayRange (TfToken const &role, HdBufferSpecVector const &bufferSpecs, HdBufferArrayUsageHint usageHint)
 Allocate new immutable non uniform buffer array range. More...
 
HD_API HdBufferArrayRangeSharedPtr AllocateUniformBufferArrayRange (TfToken const &role, HdBufferSpecVector const &bufferSpecs, HdBufferArrayUsageHint usageHint)
 Allocate new uniform buffer range. More...
 
HD_API HdBufferArrayRangeSharedPtr AllocateShaderStorageBufferArrayRange (TfToken const &role, HdBufferSpecVector const &bufferSpecs, HdBufferArrayUsageHint usageHint)
 Allocate new shader storage buffer range. More...
 
HD_API HdBufferArrayRangeSharedPtr AllocateSingleBufferArrayRange (TfToken const &role, HdBufferSpecVector const &bufferSpecs, HdBufferArrayUsageHint usageHint)
 Allocate single entry (non-aggregated) buffer array range. More...
 
HD_API void AddSources (HdBufferArrayRangeSharedPtr const &range, HdBufferSourceVector &sources)
 Append source data for given range to be committed later. More...
 
HD_API void AddSource (HdBufferArrayRangeSharedPtr const &range, HdBufferSourceSharedPtr const &source)
 Append a source data for given range to be committed later. More...
 
HD_API void AddSource (HdBufferSourceSharedPtr const &source)
 Append a source data just to be resolved (used for cpu computations). More...
 
HD_API void AddComputation (HdBufferArrayRangeSharedPtr const &range, HdComputationSharedPtr const &computaion)
 Append a gpu computation into queue. More...
 
HD_API void Commit ()
 Commits all in-flight source data to the GPU, freeing the source buffers. More...
 
HD_API void GarbageCollect ()
 cleanup all buffers and remove if empty More...
 
HD_API void GarbageCollectBprims ()
 cleanup all Bprim registries More...
 
void SetNonUniformAggregationStrategy (HdAggregationStrategy *strategy)
 Set the aggregation strategy for non uniform parameters (vertex, varying, facevarying) Takes ownership of the passed in strategy object. More...
 
void SetNonUniformImmutableAggregationStrategy (HdAggregationStrategy *strategy)
 Set the aggregation strategy for non uniform immutable parameters (vertex, varying, facevarying) Takes ownership of the passed in strategy object. More...
 
void SetUniformAggregationStrategy (HdAggregationStrategy *strategy)
 Set the aggregation strategy for uniform (shader globals) Takes ownership of the passed in strategy object. More...
 
void SetShaderStorageAggregationStrategy (HdAggregationStrategy *strategy)
 Set the aggregation strategy for SSBO (uniform primvars) Takes ownership of the passed in strategy object. More...
 
void SetSingleStorageAggregationStrategy (HdAggregationStrategy *strategy)
 Set the aggregation strategy for single buffers (for nested instancer). More...
 
bool HasNonUniformAggregationStrategy () const
 Returns whether an aggregation strategy is set for non uniform params. More...
 
bool HasNonUniformImmutableAggregationStrategy () const
 Returns whether an aggregation strategy is set for non uniform immutable params. More...
 
bool HasUniformAggregationStrategy () const
 Returns whether an aggregation strategy is set for uniform params. More...
 
bool HasShaderStorageAggregationStrategy () const
 Returns whether an aggregation strategy is set for SSBO. More...
 
bool HasSingleStorageAggregationStrategy () const
 Returns whether an aggregation strategy is set for single buffers. More...
 
HD_API VtDictionary GetResourceAllocation () const
 Returns a report of resource allocation by role in bytes and a summary total allocation of GPU memory in bytes for this registry. More...
 
HD_API std::unique_lock
< std::mutex > 
RegisterMeshTopology (HdTopology::ID id, HdInstance< HdTopology::ID, HdMeshTopologySharedPtr > *pInstance)
 Topology instancing Returns (in the pointer) the HdInstance points to shared HdMeshTopology, distinguished by given ID. More...
 
HD_API std::unique_lock
< std::mutex > 
RegisterBasisCurvesTopology (HdTopology::ID id, HdInstance< HdTopology::ID, HdBasisCurvesTopologySharedPtr > *pInstance)
 
HD_API std::unique_lock
< std::mutex > 
RegisterVertexAdjacency (HdTopology::ID id, HdInstance< HdTopology::ID, Hd_VertexAdjacencySharedPtr > *pInstance)
 
HD_API std::unique_lock
< std::mutex > 
RegisterMeshIndexRange (HdTopology::ID id, TfToken const &name, HdInstance< HdTopology::ID, HdBufferArrayRangeSharedPtr > *pInstance)
 Index buffer array range instancing Returns the HdInstance points to shared HdBufferArrayRange, distinguished by given ID. More...
 
HD_API std::unique_lock
< std::mutex > 
RegisterBasisCurvesIndexRange (HdTopology::ID id, TfToken const &name, HdInstance< HdTopology::ID, HdBufferArrayRangeSharedPtr > *pInstance)
 
HD_API std::unique_lock
< std::mutex > 
RegisterPrimvarRange (HdTopology::ID id, HdInstance< HdTopology::ID, HdBufferArrayRangeSharedPtr > *pInstance)
 Primvar array range instancing Returns the HdInstance pointing to shared HdBufferArrayRange, distinguished by given ID. More...
 
HD_API std::unique_lock
< std::mutex > 
RegisterExtComputationDataRange (HdTopology::ID id, HdInstance< HdTopology::ID, HdBufferArrayRangeSharedPtr > *pInstance)
 ExtComputation data array range instancing Returns the HdInstance pointing to shared HdBufferArrayRange, distinguished by given ID. More...
 
HD_API std::unique_lock
< std::mutex > 
RegisterTextureResource (TextureKey id, HdInstance< TextureKey, HdTextureResourceSharedPtr > *pInstance)
 Register a texture into the texture registry. More...
 
HD_API std::unique_lock
< std::mutex > 
FindTextureResource (TextureKey id, HdInstance< TextureKey, HdTextureResourceSharedPtr > *instance, bool *found)
 Find a texture in the texture registry. More...
 

Protected Member Functions

virtual void _GarbageCollect () override
 A hook for derived registries to perform additional GC when GarbageCollect() is invoked. More...
 
virtual void _TallyResourceAllocation (VtDictionary *result) const override
 A hook for derived registries to tally their resources by key into the given dictionary. More...
 

Additional Inherited Members

- Public Types inherited from HdResourceRegistry
typedef size_t TextureKey
 Globally unique id for texture, see RegisterTextureResource() for details. More...
 
- Protected Attributes inherited from HdResourceRegistry
HdBufferArrayRegistry _nonUniformBufferArrayRegistry
 
HdBufferArrayRegistry _nonUniformImmutableBufferArrayRegistry
 
HdBufferArrayRegistry _uniformUboBufferArrayRegistry
 
HdBufferArrayRegistry _uniformSsboBufferArrayRegistry
 
HdBufferArrayRegistry _singleBufferArrayRegistry
 
std::unique_ptr
< HdAggregationStrategy
_nonUniformAggregationStrategy
 
std::unique_ptr
< HdAggregationStrategy
_nonUniformImmutableAggregationStrategy
 
std::unique_ptr
< HdAggregationStrategy
_uniformUboAggregationStrategy
 
std::unique_ptr
< HdAggregationStrategy
_uniformSsboAggregationStrategy
 
std::unique_ptr
< HdAggregationStrategy
_singleAggregationStrategy
 

Detailed Description

A central registry of all GPU resources.

Definition at line 51 of file resourceRegistry.h.

Member Function Documentation

virtual void _GarbageCollect ( )
overrideprotectedvirtual

A hook for derived registries to perform additional GC when GarbageCollect() is invoked.

Reimplemented from HdResourceRegistry.

virtual void _TallyResourceAllocation ( VtDictionary result) const
overrideprotectedvirtual

A hook for derived registries to tally their resources by key into the given dictionary.

Any additions should be cumulative with the existing key values.

Reimplemented from HdResourceRegistry.

HDST_API void GarbageCollectDispatchBuffers ( )

Remove any entries associated with expired dispatch buffers.

HDST_API void GarbageCollectPersistentBuffers ( )

Remove any entries associated with expired persistently mapped buffers.

void InvalidateShaderRegistry ( )
overridevirtual

Invalidate any shaders registered with this registry.

Reimplemented from HdResourceRegistry.

HDST_API HdBufferArrayRangeSharedPtr MergeBufferArrayRange ( HdAggregationStrategy strategy,
HdBufferArrayRegistry bufferArrayRegistry,
TfToken const &  role,
HdBufferSpecVector const &  newBufferSpecs,
HdBufferArrayUsageHint  newUsageHint,
HdBufferArrayRangeSharedPtr const &  range 
)

Check if range is compatible with newBufferSpecs.

If not, allocate new bufferArrayRange with merged buffer specs, register migration computation and return the new range. Otherwise just return the same range.

HDST_API HdBufferArrayRangeSharedPtr MergeNonUniformBufferArrayRange ( TfToken const &  role,
HdBufferSpecVector const &  newBufferSpecs,
HdBufferArrayUsageHint  newUsageHint,
HdBufferArrayRangeSharedPtr const &  range 
)

MergeBufferArrayRange of non uniform buffer.

HDST_API HdBufferArrayRangeSharedPtr MergeNonUniformImmutableBufferArrayRange ( TfToken const &  role,
HdBufferSpecVector const &  newBufferSpecs,
HdBufferArrayUsageHint  newUsageHint,
HdBufferArrayRangeSharedPtr const &  range 
)

MergeBufferArrayRange of non uniform immutable buffer.

HDST_API HdBufferArrayRangeSharedPtr MergeShaderStorageBufferArrayRange ( TfToken const &  role,
HdBufferSpecVector const &  newBufferSpecs,
HdBufferArrayUsageHint  newUsageHint,
HdBufferArrayRangeSharedPtr const &  range 
)

MergeBufferArrayRange of shader storage buffer.

HDST_API HdBufferArrayRangeSharedPtr MergeUniformBufferArrayRange ( TfToken const &  role,
HdBufferSpecVector const &  newBufferSpecs,
HdBufferArrayUsageHint  newUsageHint,
HdBufferArrayRangeSharedPtr const &  range 
)

MergeBufferArrayRange of uniform buffer.

HDST_API HdStDispatchBufferSharedPtr RegisterDispatchBuffer ( TfToken const &  role,
int  count,
int  commandNumUints 
)

Register a buffer allocated with count * commandNumUints * sizeof(GLuint) to be used as an indirect dispatch buffer.

HDST_API std::unique_lock<std::mutex> RegisterGeometricShader ( HdStShaderKey::ID  id,
HdInstance< HdStShaderKey::ID, HdSt_GeometricShaderSharedPtr > *  pInstance 
)

Register a geometric shader.

HDST_API std::unique_lock<std::mutex> RegisterGLSLProgram ( HdStGLSLProgram::ID  id,
HdInstance< HdStGLSLProgram::ID, HdStGLSLProgramSharedPtr > *  pInstance 
)

Register a GLSL program into the program registry.

note: Currently no garbage collection enforced on the shader registry

HDST_API HdStPersistentBufferSharedPtr RegisterPersistentBuffer ( TfToken const &  role,
size_t  dataSize,
void *  data 
)

Register a buffer initialized with dataSize bytes of data to be used as a persistently mapped shader storage buffer.

HDST_API std::unique_lock<std::mutex> RegisterTextureResourceHandle ( HdStShaderKey::ID  id,
HdInstance< HdStShaderKey::ID, HdStTextureResourceHandleSharedPtr > *  pInstance 
)

Register a texture resource handle.


The documentation for this class was generated from the following file: