summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngine
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-11-24 00:07:34 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-11-24 00:07:34 +0000
commit84d8fedc201a66835f5c234160bda63bbc40f682 (patch)
tree6edc9cac7e76058a5e2b6f61804ab3a04e562e6f /Graphics/GraphicsEngine
parentFixed issue with resource state transition in D3D11 backend (diff)
downloadDiligentCore-84d8fedc201a66835f5c234160bda63bbc40f682.tar.gz
DiligentCore-84d8fedc201a66835f5c234160bda63bbc40f682.zip
Added IShaderResourceBinding::InitializeStaticResources() method to allow explicit initialization of static shader resources in a SRB
Diffstat (limited to 'Graphics/GraphicsEngine')
-rw-r--r--Graphics/GraphicsEngine/interface/PipelineState.h5
-rw-r--r--Graphics/GraphicsEngine/interface/ShaderResourceBinding.h20
2 files changed, 23 insertions, 2 deletions
diff --git a/Graphics/GraphicsEngine/interface/PipelineState.h b/Graphics/GraphicsEngine/interface/PipelineState.h
index ca12dda4..2169eefb 100644
--- a/Graphics/GraphicsEngine/interface/PipelineState.h
+++ b/Graphics/GraphicsEngine/interface/PipelineState.h
@@ -190,7 +190,10 @@ public:
/// \param [out] ppShaderResourceBinding - memory location where pointer to the new shader resource
/// binding object is written.
- virtual void CreateShaderResourceBinding( IShaderResourceBinding **ppShaderResourceBinding ) = 0;
+ /// \param [in] InitStaticResources - if set to true, the method will initialize static resources in
+ /// the created object, which has the exact same effect as calling
+ /// IShaderResourceBinding::InitializeStaticResources().
+ virtual void CreateShaderResourceBinding( IShaderResourceBinding **ppShaderResourceBinding, bool InitStaticResources = false ) = 0;
/// Checks if this pipeline state object is compatible with another PSO
diff --git a/Graphics/GraphicsEngine/interface/ShaderResourceBinding.h b/Graphics/GraphicsEngine/interface/ShaderResourceBinding.h
index 2c177926..9b71f06c 100644
--- a/Graphics/GraphicsEngine/interface/ShaderResourceBinding.h
+++ b/Graphics/GraphicsEngine/interface/ShaderResourceBinding.h
@@ -58,7 +58,7 @@ public:
/// Any combination of Diligent::SHADER_TYPE may be specified.
/// \param [in] pResMapping - Shader resource mapping, where required resources will be looked up
/// \param [in] Flags - Additional flags. See Diligent::BIND_SHADER_RESOURCES_FLAGS.
- virtual void BindResources(Uint32 ShaderFlags, IResourceMapping *pResMapping, Uint32 Flags) = 0;
+ virtual void BindResources(Uint32 ShaderFlags, IResourceMapping* pResMapping, Uint32 Flags) = 0;
/// Returns variable
@@ -84,6 +84,24 @@ public:
/// \remark Only mutable and dynamic variables can be accessed through this method.
/// Static variables are accessed through the Shader object.
virtual IShaderVariable* GetVariable(SHADER_TYPE ShaderType, Uint32 Index) = 0;
+
+
+ /// Initializes static resources
+
+ /// If shaders in the pipeline state contain static resources
+ /// (see Diligent::SHADER_VARIABLE_TYPE_STATIC), this method must be called
+ /// once to initialize static resources in this shader resource binding object.
+ /// The method must be called after all static variables are initialized
+ /// in the shaders.
+ /// \param [in] pPipelineState - Pipeline state to copy static shader resource
+ /// bindings from. The pipeline state must be compatible
+ /// with this shader resource binding object.
+ /// If null pointer is provided, the pipeline state
+ /// that this SRB object was created from is used.
+ /// \note The method must be called exactly once. If static resources have
+ /// already been initialized and the method is called again, it will have
+ /// no effect and a warning messge will be displayed.
+ virtual void InitializeStaticResources(const IPipelineState* pPipelineState = nullptr) = 0;
};
}