Diligent Engine
 
Loading...
Searching...
No Matches
Diligent::IRenderStateCache Struct Referenceabstract

Render state cache interface. More...

#include <RenderStateCache.h>

Inheritance diagram for Diligent::IRenderStateCache:
Diligent.IObject

Public Member Functions

virtual bool DILIGENT_CALL_TYPE Load (const IDataBlob *pCacheData, Uint32 ContentVersion=~0u, bool MakeCopy=false)=0
 Loads the cache contents.
 
virtual bool DILIGENT_CALL_TYPE CreateShader (const ShaderCreateInfo &ShaderCI, IShader **ppShader)=0
 Creates a shader object from cached data.
 
virtual bool DILIGENT_CALL_TYPE CreateGraphicsPipelineState (const GraphicsPipelineStateCreateInfo &PSOCreateInfo, IPipelineState **ppPipelineState)=0
 Creates a graphics pipeline state object from cached data.
 
virtual bool DILIGENT_CALL_TYPE CreateComputePipelineState (const ComputePipelineStateCreateInfo &PSOCreateInfo, IPipelineState **ppPipelineState)=0
 Creates a compute pipeline state object from cached data.
 
virtual bool DILIGENT_CALL_TYPE CreateRayTracingPipelineState (const RayTracingPipelineStateCreateInfo &PSOCreateInfo, IPipelineState **ppPipelineState)=0
 Creates a ray tracing pipeline state object from cached data.
 
virtual bool DILIGENT_CALL_TYPE CreateTilePipelineState (const TilePipelineStateCreateInfo &PSOCreateInfo, IPipelineState **ppPipelineState)=0
 Creates a tile pipeline state object from cached data.
 
virtual Bool DILIGENT_CALL_TYPE WriteToBlob (Uint32 ContentVersion, IDataBlob **ppBlob)=0
 Writes cache contents to a memory blob.
 
virtual Bool DILIGENT_CALL_TYPE WriteToStream (Uint32 ContentVersion, IFileStream *pStream)=0
 Writes cache contents to a file stream.
 
virtual void DILIGENT_CALL_TYPE Reset ()=0
 Resets the cache to default state.
 
virtual Uint32 DILIGENT_CALL_TYPE Reload (ReloadGraphicsPipelineCallbackType ReloadGraphicsPipeline=nullptr, void *pUserData=nullptr)=0
 Reloads render states in the cache.
 
virtual Uint32 DILIGENT_CALL_TYPE GetContentVersion () const =0
 Returns the content version of the cache data.
 
virtual Uint32 DILIGENT_CALL_TYPE GetReloadVersion () const =0
 Returns the reload version of the cache data.
 
- Public Member Functions inherited from Diligent.IObject
virtual void DILIGENT_CALL_TYPE QueryInterface (const INTERFACE_ID &IID, IObject **ppInterface)=0
 Queries the specific interface.
 
virtual ReferenceCounterValueType DILIGENT_CALL_TYPE AddRef ()=0
 Increments the number of strong references by 1.
 
virtual ReferenceCounterValueType DILIGENT_CALL_TYPE Release ()=0
 
virtual IReferenceCounters *DILIGENT_CALL_TYPE GetReferenceCounters () const =0
 

Detailed Description

Render state cache interface.

Member Function Documentation

◆ CreateComputePipelineState()

virtual bool DILIGENT_CALL_TYPE Diligent::IRenderStateCache::CreateComputePipelineState ( const ComputePipelineStateCreateInfo & PSOCreateInfo,
IPipelineState ** ppPipelineState )
pure virtual

Creates a compute pipeline state object from cached data.

Parameters
[in]PSOCreateInfo- Compute pipeline state create info, see Diligent::ComputePipelineStateCreateInfo for details.
[out]ppPipelineState- Address of the memory location where a pointer to the created pipeline state object will be written.
Returns
true if the pipeline state was loaded from the cache, and false otherwise.

◆ CreateGraphicsPipelineState()

virtual bool DILIGENT_CALL_TYPE Diligent::IRenderStateCache::CreateGraphicsPipelineState ( const GraphicsPipelineStateCreateInfo & PSOCreateInfo,
IPipelineState ** ppPipelineState )
pure virtual

Creates a graphics pipeline state object from cached data.

Parameters
[in]PSOCreateInfo- Graphics pipeline state create info, see Diligent::GraphicsPipelineStateCreateInfo for details.
[out]ppPipelineState- Address of the memory location where a pointer to the created pipeline state object will be written.
Returns
true if the pipeline state was loaded from the cache, and false otherwise.

◆ CreateRayTracingPipelineState()

virtual bool DILIGENT_CALL_TYPE Diligent::IRenderStateCache::CreateRayTracingPipelineState ( const RayTracingPipelineStateCreateInfo & PSOCreateInfo,
IPipelineState ** ppPipelineState )
pure virtual

Creates a ray tracing pipeline state object from cached data.

Parameters
[in]PSOCreateInfo- Ray tracing pipeline state create info, see Diligent::RayTracingPipelineStateCreateInfo for details.
[out]ppPipelineState- Address of the memory location where a pointer to the created pipeline state object will be written.
Returns
true if the pipeline state was loaded from the cache, and false otherwise.

◆ CreateShader()

virtual bool DILIGENT_CALL_TYPE Diligent::IRenderStateCache::CreateShader ( const ShaderCreateInfo & ShaderCI,
IShader ** ppShader )
pure virtual

Creates a shader object from cached data.

Parameters
[in]ShaderCI- Shader create info, see Diligent::ShaderCreateInfo for details.
[out]ppShader- Address of the memory location where a pointer to the created shader object will be written.
Returns
true if the shader was loaded from the cache, and false otherwise.

◆ CreateTilePipelineState()

virtual bool DILIGENT_CALL_TYPE Diligent::IRenderStateCache::CreateTilePipelineState ( const TilePipelineStateCreateInfo & PSOCreateInfo,
IPipelineState ** ppPipelineState )
pure virtual

Creates a tile pipeline state object from cached data.

Parameters
[in]PSOCreateInfo- Tile pipeline state create info, see Diligent::TilePipelineStateCreateInfo for details.
[out]ppPipelineState- Address of the memory location where a pointer to the created pipeline state object will be written.
Returns
true if the pipeline state was loaded from the cache, and false otherwise.

◆ GetContentVersion()

virtual Uint32 DILIGENT_CALL_TYPE Diligent::IRenderStateCache::GetContentVersion ( ) const
pure virtual

Returns the content version of the cache data.

If no data has been loaded, returns ~0u (aka 0xFFFFFFFF).

◆ GetReloadVersion()

virtual Uint32 DILIGENT_CALL_TYPE Diligent::IRenderStateCache::GetReloadVersion ( ) const
pure virtual

Returns the reload version of the cache data.

The reload version is incremented every time the cache is reloaded.

◆ Load()

virtual bool DILIGENT_CALL_TYPE Diligent::IRenderStateCache::Load ( const IDataBlob * pCacheData,
Uint32 ContentVersion = ~0u,
bool MakeCopy = false )
pure virtual

Loads the cache contents.

Parameters
[in]pCacheData- A pointer to the cache data to load objects from.
[in]ContentVersion- The expected version of the content in the cache. If the version of the content in the cache does not match the expected version, the method will fail. If default value is used (~0u aka 0xFFFFFFFF), the version will not be checked.
[in]MakeCopy- Whether to make a copy of the data blob, or use the the original contents.
Returns
true if the data were loaded successfully, and false otherwise.

If the data were not copied, the cache will keep a strong reference to the pCacheData data blob. It will be kept alive until the cache object is released or the Reset() method is called.

Warning
If the data were loaded without making a copy, the application must not modify it while it is in use by the cache object.
Note
This method is not thread-safe and must not be called simultaneously with other methods.

◆ Reload()

virtual Uint32 DILIGENT_CALL_TYPE Diligent::IRenderStateCache::Reload ( ReloadGraphicsPipelineCallbackType ReloadGraphicsPipeline = nullptr,
void * pUserData = nullptr )
pure virtual

Reloads render states in the cache.

Parameters
[in]ReloadGraphicsPipeline- An optional callback function that will be called by the render state cache to let the application modify graphics pipeline state info before creating new pipeline.
[in]pUserData- A pointer to the user-specific data to pass to ReloadGraphicsPipeline callback.
Returns
The total number of render states (shaders and pipelines) that were reloaded.

Reloading is only enabled if the cache was created with the EnableHotReload member of Diligent::RenderStateCacheCreateInfo struct set to true.

◆ WriteToBlob()

virtual Bool DILIGENT_CALL_TYPE Diligent::IRenderStateCache::WriteToBlob ( Uint32 ContentVersion,
IDataBlob ** ppBlob )
pure virtual

Writes cache contents to a memory blob.

Parameters
[in]ContentVersion- The version of the content to write.
[out]ppBlob- Address of the memory location where a pointer to the created data blob will be written.
Returns
true if the data was written successfully, and false otherwise.
Remarks
If ContentVersion is ~0u (aka 0xFFFFFFFF), the version of the previously loaded content will be used, or 0 if none was loaded.

◆ WriteToStream()

virtual Bool DILIGENT_CALL_TYPE Diligent::IRenderStateCache::WriteToStream ( Uint32 ContentVersion,
IFileStream * pStream )
pure virtual

Writes cache contents to a file stream.

Parameters
[in]ContentVersion- The version of the content to write.
[in]pStream- Pointer to the IFileStream interface to use for writing.
Returns
true if the data was written successfully, and false otherwise.
Remarks
If ContentVersion is ~0u (aka 0xFFFFFFFF), the version of the previously loaded content will be used, or 0 if none was loaded.