HDK
|
#include <resourceRegistry.h>
Protected Member Functions | |
void | _Commit () override |
A hook for derived registries to perform additional resource commits. More... | |
void | _GarbageCollect () override |
Friends | |
HDST_API friend std::ostream & | operator<< (std::ostream &out, const HdStResourceRegistry &self) |
Debug dump. More... | |
Additional Inherited Members | |
![]() | |
typedef size_t | TextureKey |
A central registry of all GPU resources.
Definition at line 121 of file resourceRegistry.h.
|
override |
|
overrideprotectedvirtual |
A hook for derived registries to perform additional resource commits.
Reimplemented from HdResourceRegistry.
|
overrideprotectedvirtual |
Hooks for derived registries to perform additional GC when GarbageCollect() is invoked.
Reimplemented from HdResourceRegistry.
HDST_API void HdStResourceRegistry::AddComputation | ( | HdBufferArrayRangeSharedPtr const & | range, |
HdStComputationSharedPtr const & | computation, | ||
HdStComputeQueue const | queue | ||
) |
Append a gpu computation into queue. The parameter 'range' specifies the destination buffer range, which has to be allocated by caller of this function.
note: GPU computations will be executed in the order that they are registered.
HDST_API void HdStResourceRegistry::AddSource | ( | HdBufferArrayRangeSharedPtr const & | range, |
HdBufferSourceSharedPtr const & | source | ||
) |
Append a source data for given range to be committed later.
HDST_API void HdStResourceRegistry::AddSource | ( | HdBufferSourceSharedPtr const & | source | ) |
Append a source data just to be resolved (used for cpu computations).
HDST_API void HdStResourceRegistry::AddSources | ( | HdBufferArrayRangeSharedPtr const & | range, |
HdBufferSourceSharedPtrVector && | sources | ||
) |
Append source data for given range to be committed later.
HDST_API HdBufferArrayRangeSharedPtr HdStResourceRegistry::AllocateNonUniformBufferArrayRange | ( | TfToken const & | role, |
HdBufferSpecVector const & | bufferSpecs, | ||
HdBufferArrayUsageHint | usageHint | ||
) |
The Allocate* flavor of methods allocate a new BAR for the given buffer specs using the chosen aggregation strategy.
HDST_API HdBufferArrayRangeSharedPtr HdStResourceRegistry::AllocateNonUniformImmutableBufferArrayRange | ( | TfToken const & | role, |
HdBufferSpecVector const & | bufferSpecs, | ||
HdBufferArrayUsageHint | usageHint | ||
) |
HDST_API HdBufferArrayRangeSharedPtr HdStResourceRegistry::AllocateShaderStorageBufferArrayRange | ( | TfToken const & | role, |
HdBufferSpecVector const & | bufferSpecs, | ||
HdBufferArrayUsageHint | usageHint | ||
) |
HDST_API HdBufferArrayRangeSharedPtr HdStResourceRegistry::AllocateSingleBufferArrayRange | ( | TfToken const & | role, |
HdBufferSpecVector const & | bufferSpecs, | ||
HdBufferArrayUsageHint | usageHint | ||
) |
HDST_API HdStTextureHandleSharedPtr HdStResourceRegistry::AllocateTextureHandle | ( | const HdStTextureIdentifier & | textureId, |
HdTextureType | textureType, | ||
const HdSamplerParameters & | samplerParams, | ||
size_t | memoryRequest, | ||
HdStShaderCodePtr const & | shaderCode | ||
) |
Allocate texture handle (encapsulates texture and sampler object, memory request and callback to shader).
The actual allocation of the associated GPU texture and sampler resources and loading of the texture file is delayed until the commit phase.
textureId | Path to file and information to identify a texture if the file is a container for several textures (e.g., OpenVDB file containing several grids, movie file containing frames). |
textureType | Texture type, e.g., uv, ptex, ... |
samplerParams | Sampling parameters such as wrapS, ... wrapS, wrapT, wrapR mode, min filer, mag filter |
memoryRequest | Memory request. The texture is down-sampled to meet the target memory which is the maximum of all memory requests associated to the texture. If all memory requests are 0, no down-sampling will happen. |
shaderCode | After the texture is committed (or after it has been changed) the given shader code can add additional buffer sources and computations using the texture metadata with AddResourcesFromTextures. |
HDST_API HdStTextureObjectSharedPtr HdStResourceRegistry::AllocateTextureObject | ( | const HdStTextureIdentifier & | textureId, |
HdTextureType | textureType | ||
) |
Allocate texture object.
The actual allocation of the associated GPU texture and sampler resources and loading of the texture file is delayed until the commit phase.
textureId | Path to file and information to identify a texture if the file is a container for several textures (e.g., OpenVDB file containing several grids, movie file containing frames). |
textureType | Texture type, e.g., uv, ptex, ... |
HDST_API HdBufferArrayRangeSharedPtr HdStResourceRegistry::AllocateUniformBufferArrayRange | ( | TfToken const & | role, |
HdBufferSpecVector const & | bufferSpecs, | ||
HdBufferArrayUsageHint | usageHint | ||
) |
Remove any entries associated with expired misc buffers.
Remove any entries associated with expired dispatch buffers.
HDST_API HgiBlitCmds* HdStResourceRegistry::GetGlobalBlitCmds | ( | ) |
Returns the global hgi blit command queue for recording blitting work. When using this global cmd instead of creating a new HgiBlitCmds we reduce the number of command buffers being created. The returned pointer should not be held onto by the client as it is only valid until the HgiBlitCmds has been submitted.
HDST_API HgiComputeCmds* HdStResourceRegistry::GetGlobalComputeCmds | ( | HgiComputeDispatch | dispatchMethod = HgiComputeDispatchSerial | ) |
Returns the global hgi compute cmd queue for recording compute work. When using this global cmd instead of creating a new HgiComputeCmds we reduce the number of command buffers being created. The returned pointer should not be held onto by the client as it is only valid until the HgiComputeCmds has been submitted.
|
overridevirtual |
Returns a report of resource allocation by role in bytes and a summary total allocation of GPU memory in bytes for this registry.
Reimplemented from HdResourceRegistry.
HDST_API HdStStagingBuffer* HdStResourceRegistry::GetStagingBuffer | ( | ) |
Returns the staging buffer used when committing data to the GPU.
HdStResourceRegistry::HF_MALLOC_TAG_NEW | ( | "new HdStResourceRegistry" | ) |
Invalidate any shaders registered with this registry.
Reimplemented from HdResourceRegistry.
HDST_API HdInstance<HdBufferArrayRangeSharedPtr> HdStResourceRegistry::RegisterBasisCurvesIndexRange | ( | HdInstance< HdBufferArrayRangeSharedPtr >::ID | id, |
TfToken const & | name | ||
) |
HDST_API HdInstance<HdSt_BasisCurvesTopologySharedPtr> HdStResourceRegistry::RegisterBasisCurvesTopology | ( | HdInstance< HdSt_BasisCurvesTopologySharedPtr >::ID | id | ) |
HDST_API HdStBufferResourceSharedPtr HdStResourceRegistry::RegisterBufferResource | ( | TfToken const & | role, |
HdTupleType | tupleType, | ||
HgiBufferUsage | bufferUsage | ||
) |
Register a misc buffer resource. Usually buffers are part of a buffer array (buffer aggregation) and are managed via buffer array APIs. RegisterBufferResource lets you create a standalone buffer that can be used for misc purposes (Eg. GPU frustum cull prim count read back).
HDST_API HdInstance<HgiComputePipelineSharedPtr> HdStResourceRegistry::RegisterComputePipeline | ( | HdInstance< HgiComputePipelineSharedPtr >::ID | id | ) |
Register a Hgi compute pipeline into the registry.
HDST_API HdStDispatchBufferSharedPtr HdStResourceRegistry::RegisterDispatchBuffer | ( | TfToken const & | role, |
int | count, | ||
int | commandNumUints | ||
) |
Register a buffer allocated with count * commandNumUints * sizeof(uint32_t) to be used as an indirect dispatch buffer.
HDST_API HdInstance<HdBufferArrayRangeSharedPtr> HdStResourceRegistry::RegisterExtComputationDataRange | ( | HdInstance< HdBufferArrayRangeSharedPtr >::ID | id | ) |
ExtComputation data array range instancing Returns the HdInstance pointing to shared HdBufferArrayRange, distinguished by given ID. *Refer the comment on RegisterTopology for the same consideration.
HDST_API HdInstance<HdSt_GeometricShaderSharedPtr> HdStResourceRegistry::RegisterGeometricShader | ( | HdInstance< HdSt_GeometricShaderSharedPtr >::ID | id | ) |
Register a geometric shader.
HDST_API HdInstance<HioGlslfxSharedPtr> HdStResourceRegistry::RegisterGLSLFXFile | ( | HdInstance< HioGlslfxSharedPtr >::ID | id | ) |
Register a GLSLFX file.
HDST_API HdInstance<HdStGLSLProgramSharedPtr> HdStResourceRegistry::RegisterGLSLProgram | ( | HdInstance< HdStGLSLProgramSharedPtr >::ID | id | ) |
Register a GLSL program into the program registry.
HDST_API HdInstance<HgiGraphicsPipelineSharedPtr> HdStResourceRegistry::RegisterGraphicsPipeline | ( | HdInstance< HgiGraphicsPipelineSharedPtr >::ID | id | ) |
Register a Hgi graphics pipeline into the registry.
HDST_API HdInstance<HdBufferArrayRangeSharedPtr> HdStResourceRegistry::RegisterMeshIndexRange | ( | HdInstance< HdBufferArrayRangeSharedPtr >::ID | id, |
TfToken const & | name | ||
) |
Topology Index buffer array range instancing Returns the HdInstance points to shared HdBufferArrayRange, distinguished by given ID. *Refer the comment on RegisterTopology for the same consideration.
HDST_API HdInstance<HdSt_MeshTopologySharedPtr> HdStResourceRegistry::RegisterMeshTopology | ( | HdInstance< HdSt_MeshTopologySharedPtr >::ID | id | ) |
Topology instancing.
These registries implement sharing and deduplication of data based on computed hash identifiers. Each returned HdInstance object retains a shared pointer to a data instance. When an HdInstance is registered for a previously unused ID, the data pointer will be null and it is the caller's responsibility to set its value. The instance registries are cleaned of unreferenced entries during garbage collection.
Note: As entries can be registered from multiple threads, the returned object holds a lock on the instance registry. This lock is held until the returned HdInstance object is destroyed.
HDST_API HdInstance<HdBufferArrayRangeSharedPtr> HdStResourceRegistry::RegisterPrimvarRange | ( | HdInstance< HdBufferArrayRangeSharedPtr >::ID | id | ) |
Primvar array range instancing Returns the HdInstance pointing to shared HdBufferArrayRange, distinguished by given ID. *Refer the comment on RegisterTopology for the same consideration.
HDST_API HdInstance<HgiResourceBindingsSharedPtr> HdStResourceRegistry::RegisterResourceBindings | ( | HdInstance< HgiResourceBindingsSharedPtr >::ID | id | ) |
Register a Hgi resource bindings into the registry.
HDST_API HdInstance<HdSt_VertexAdjacencyBuilderSharedPtr> HdStResourceRegistry::RegisterVertexAdjacencyBuilder | ( | HdInstance< HdSt_VertexAdjacencyBuilderSharedPtr >::ID | id | ) |
|
overridevirtual |
Generic method to inform RenderDelegate a resource needs to be reloaded. This method can be used by the application to inform the renderDelegate that a resource, which may not have any prim representation in Hydra, needs to be reloaded. For example a texture found in a material network. The path
can be absolute or relative. It should usually match the path found for textures during HdMaterial::Sync.
Reimplemented from HdResourceRegistry.
HDST_API void HdStResourceRegistry::SetMemoryRequestForTextureType | ( | HdTextureType | textureType, |
size_t | memoryRequest | ||
) |
Sets how much memory a single texture can consume in bytes by texture type.
Only has an effect if non-zero and only applies to textures if no texture handle referencing the texture has a memory request.
|
inline |
Set the aggregation strategy for non uniform parameters (vertex, varying, facevarying) Takes ownership of the passed in strategy object.
Definition at line 492 of file resourceRegistry.h.
|
inline |
Set the aggregation strategy for non uniform immutable parameters (vertex, varying, facevarying) Takes ownership of the passed in strategy object.
Definition at line 500 of file resourceRegistry.h.
|
inline |
Set the aggregation strategy for SSBO (uniform primvars) Takes ownership of the passed in strategy object.
Definition at line 514 of file resourceRegistry.h.
|
inline |
Set the aggregation strategy for single buffers (for nested instancer). Takes ownership of the passed in strategy object.
Definition at line 521 of file resourceRegistry.h.
|
inline |
Set the aggregation strategy for uniform (shader globals) Takes ownership of the passed in strategy object.
Definition at line 507 of file resourceRegistry.h.
HDST_API void HdStResourceRegistry::SubmitBlitWork | ( | HgiSubmitWaitType | wait = HgiSubmitWaitTypeNoWait | ) |
Submits blit work queued in global blit cmds for GPU execution. We can call this when we want to submit some work to the GPU. To stall the CPU and wait for the GPU to finish, 'wait' can be provided. To insert a barrier to ensure memory writes are visible after the barrier a HgiMemoryBarrier can be provided.
HDST_API void HdStResourceRegistry::SubmitComputeWork | ( | HgiSubmitWaitType | wait = HgiSubmitWaitTypeNoWait | ) |
Submits compute work queued in global compute cmds for GPU execution. We can call this when we want to submit some work to the GPU. To stall the CPU and wait for the GPU to finish, 'wait' can be provided. To insert a barrier to ensure memory writes are visible after the barrier a HgiMemoryBarrier can be provided.
HDST_API HdBufferArrayRangeSharedPtr HdStResourceRegistry::UpdateNonUniformBufferArrayRange | ( | TfToken const & | role, |
HdBufferArrayRangeSharedPtr const & | curRange, | ||
HdBufferSpecVector const & | updatedOrAddedSpecs, | ||
HdBufferSpecVector const & | removedSpecs, | ||
HdBufferArrayUsageHint | usageHint | ||
) |
The Update* flavor of methods handle both allocation of a new BAR and reallocation-migration based on the existing range, updated/added specs, removed specs and usage hint. This allows client code to be less verbose when a range's signature (specs) can change.
If curRange
is invalid, this is equivalent to calling Allocate*. Otherwise, checks if curRange
needs to be migrated to a new range (based on updatedOrAddedSpecs
and removedSpecs
and usageHint
). If migration is necessary, allocate a new range and register necessary migration computations and return the new range. Otherwise, just return the same range.
HDST_API HdBufferArrayRangeSharedPtr HdStResourceRegistry::UpdateNonUniformImmutableBufferArrayRange | ( | TfToken const & | role, |
HdBufferArrayRangeSharedPtr const & | curRange, | ||
HdBufferSpecVector const & | updatedOrAddedSpecs, | ||
HdBufferSpecVector const & | removedSpecs, | ||
HdBufferArrayUsageHint | usageHint | ||
) |
HDST_API HdBufferArrayRangeSharedPtr HdStResourceRegistry::UpdateShaderStorageBufferArrayRange | ( | TfToken const & | role, |
HdBufferArrayRangeSharedPtr const & | curRange, | ||
HdBufferSpecVector const & | updatedOrAddedSpecs, | ||
HdBufferSpecVector const & | removedSpecs, | ||
HdBufferArrayUsageHint | usageHint | ||
) |
HDST_API HdBufferArrayRangeSharedPtr HdStResourceRegistry::UpdateUniformBufferArrayRange | ( | TfToken const & | role, |
HdBufferArrayRangeSharedPtr const & | curRange, | ||
HdBufferSpecVector const & | updatedOrAddedSpecs, | ||
HdBufferSpecVector const & | removedSpecs, | ||
HdBufferArrayUsageHint | usageHint | ||
) |
|
friend |
Debug dump.