Go to the documentation of this file.
50 m_ResourceCache{ResourceCache}
56 void Destroy(IMemoryAllocator& Allocator);
66 void Initialize(
const PipelineResourceSignatureD3D11Impl& Signature,
67 IMemoryAllocator& Allocator,
83 template <
typename ThisImplType, D3D11_RESOURCE_RANGE ResRange>
103 if (ppInterface ==
nullptr)
106 *ppInterface =
nullptr;
107 if (IID == IID_ShaderResourceVariableD3D || IID == IID_ShaderResourceVariable || IID == IID_Unknown)
110 (*ppInterface)->AddRef();
217 using OffsetType =
Uint16;
218 template<
typename ResourceType> OffsetType GetResourceOffset()
const;
219 template<> OffsetType GetResourceOffset<ConstBuffBindInfo>()
const {
return 0; }
220 template<> OffsetType GetResourceOffset<TexSRVBindInfo> ()
const {
return m_TexSRVsOffset; }
221 template<> OffsetType GetResourceOffset<TexUAVBindInfo> ()
const {
return m_TexUAVsOffset; }
222 template<> OffsetType GetResourceOffset<BuffSRVBindInfo> ()
const {
return m_BuffSRVsOffset; }
223 template<> OffsetType GetResourceOffset<BuffUAVBindInfo> ()
const {
return m_BuffUAVsOffset; }
224 template<> OffsetType GetResourceOffset<SamplerBindInfo> ()
const {
return m_SamplerOffset; }
227 template <
typename ResourceType>
228 ResourceType& GetResource(
Uint32 ResIndex)
const
230 VERIFY(ResIndex < GetNumResources<ResourceType>(),
"Resource index (", ResIndex,
") must be less than (", GetNumResources<ResourceType>(),
")");
231 auto Offset = GetResourceOffset<ResourceType>();
232 return reinterpret_cast<ResourceType*
>(
reinterpret_cast<Uint8*
>(m_ResourceBuffer) + Offset)[ResIndex];
235 template <
typename ResourceType>
236 const ResourceType& GetConstResource(
Uint32 ResIndex)
const
238 VERIFY(ResIndex < GetNumResources<ResourceType>(),
"Resource index (", ResIndex,
") must be less than (", GetNumResources<ResourceType>(),
")");
239 auto Offset = GetResourceOffset<ResourceType>();
240 return reinterpret_cast<const ResourceType*
>(
reinterpret_cast<const Uint8*
>(m_ResourceBuffer) + Offset)[ResIndex];
243 template <
typename ResourceType>
244 IShaderResourceVariable* GetResourceByName(
const Char* Name)
const;
246 template <
typename THandleCB,
247 typename THandleTexSRV,
248 typename THandleTexUAV,
249 typename THandleBufSRV,
250 typename THandleBufUAV,
251 typename THandleSampler>
252 void HandleResources(THandleCB HandleCB,
253 THandleTexSRV HandleTexSRV,
254 THandleTexUAV HandleTexUAV,
255 THandleBufSRV HandleBufSRV,
256 THandleBufUAV HandleBufUAV,
257 THandleSampler HandleSampler)
259 for (
Uint32 cb = 0; cb < GetNumResources<ConstBuffBindInfo>(); ++cb)
260 HandleCB(GetResource<ConstBuffBindInfo>(cb));
262 for (
Uint32 t = 0; t < GetNumResources<TexSRVBindInfo>(); ++t)
263 HandleTexSRV(GetResource<TexSRVBindInfo>(t));
265 for (
Uint32 u = 0; u < GetNumResources<TexUAVBindInfo>(); ++u)
266 HandleTexUAV(GetResource<TexUAVBindInfo>(u));
268 for (
Uint32 s = 0; s < GetNumResources<BuffSRVBindInfo>(); ++s)
269 HandleBufSRV(GetResource<BuffSRVBindInfo>(s));
271 for (
Uint32 u = 0; u < GetNumResources<BuffUAVBindInfo>(); ++u)
272 HandleBufUAV(GetResource<BuffUAVBindInfo>(u));
274 for (
Uint32 s = 0; s < GetNumResources<SamplerBindInfo>(); ++s)
275 HandleSampler(GetResource<SamplerBindInfo>(s));
278 template <
typename THandleCB,
279 typename THandleTexSRV,
280 typename THandleTexUAV,
281 typename THandleBufSRV,
282 typename THandleBufUAV,
283 typename THandleSampler>
284 void HandleConstResources(THandleCB HandleCB,
285 THandleTexSRV HandleTexSRV,
286 THandleTexUAV HandleTexUAV,
287 THandleBufSRV HandleBufSRV,
288 THandleBufUAV HandleBufUAV,
289 THandleSampler HandleSampler)
const
291 for (
Uint32 cb = 0; cb < GetNumResources<ConstBuffBindInfo>(); ++cb)
292 HandleCB(GetConstResource<ConstBuffBindInfo>(cb));
294 for (
Uint32 t = 0; t < GetNumResources<TexSRVBindInfo>(); ++t)
295 HandleTexSRV(GetConstResource<TexSRVBindInfo>(t));
297 for (
Uint32 u = 0; u < GetNumResources<TexUAVBindInfo>(); ++u)
298 HandleTexUAV(GetConstResource<TexUAVBindInfo>(u));
300 for (
Uint32 s = 0; s < GetNumResources<BuffSRVBindInfo>(); ++s)
301 HandleBufSRV(GetConstResource<BuffSRVBindInfo>(s));
303 for (
Uint32 u = 0; u < GetNumResources<BuffUAVBindInfo>(); ++u)
304 HandleBufUAV(GetConstResource<BuffUAVBindInfo>(u));
306 for (
Uint32 s = 0; s < GetNumResources<SamplerBindInfo>(); ++s)
307 HandleSampler(GetConstResource<SamplerBindInfo>(s));
310 void SetSampler(
Uint32 ResIdx,
class SamplerD3D11Impl* pSamplerD3D11,
Uint32 ArrayIndex);
323 void* m_ResourceBuffer =
nullptr;
326 OffsetType m_TexSRVsOffset = 0;
327 OffsetType m_TexUAVsOffset = 0;
328 OffsetType m_BuffSRVsOffset = 0;
329 OffsetType m_BuffUAVsOffset = 0;
330 OffsetType m_SamplerOffset = 0;
331 OffsetType m_MemorySize = 0;
333 Uint8 m_ShaderTypeIndex = 0;
335 #ifdef DILIGENT_DEBUG
__forceinline void BindResource(IDeviceObject *pObject, Uint32 ArrayIndex)
Definition: ShaderVariableManagerD3D11.cpp:427
Definition: D3DShaderResourceLoader.hpp:43
Definition: PipelineResourceAttribsD3D11.hpp:275
Base implementation of a shader variable.
Definition: ShaderResourceVariableBase.hpp:524
Shader resource variable.
Definition: ShaderResourceVariable.h:117
char Char
Definition: BasicTypes.h:64
ShaderVariableD3D11Base(ShaderVariableManagerD3D11 &ParentLayout, Uint32 ResIndex)
Definition: ShaderVariableManagerD3D11.hpp:87
__forceinline void BindResource(IDeviceObject *pObject, Uint32 ArrayIndex)
Definition: ShaderVariableManagerD3D11.cpp:305
TexUAVBindInfo(ShaderVariableManagerD3D11 &ParentLayout, Uint32 ResIndex)
Definition: ShaderVariableManagerD3D11.hpp:147
SHADER_TYPE
Describes the shader type.
Definition: GraphicsTypes.h:65
virtual void QueryInterface(const INTERFACE_ID &IID, IObject **ppInterface) override final
Definition: ShaderVariableManagerD3D11.hpp:101
Uint32 Flags
Definition: DXBCUtils.cpp:71
Definition: ShaderVariableManagerD3D11.hpp:127
Base interface for all dynamic objects in the engine.
Definition: Object.h:41
HLSL resource description.
Definition: ShaderD3D.h:46
Definition: ShaderVariableManagerD3D11.hpp:154
void Initialize(const PipelineResourceSignatureD3D11Impl &Signature, IMemoryAllocator &Allocator, const SHADER_RESOURCE_VARIABLE_TYPE *AllowedVarTypes, Uint32 NumAllowedTypes, SHADER_TYPE ShaderType)
Definition: ShaderVariableManagerD3D11.cpp:168
Definition: ShaderVariableManagerD3D11.hpp:84
BuffSRVBindInfo(ShaderVariableManagerD3D11 &ParentLayout, Uint32 ResIndex)
Definition: ShaderVariableManagerD3D11.hpp:165
@ D3D11_RESOURCE_RANGE_SAMPLER
Definition: PipelineResourceAttribsD3D11.hpp:47
void Destroy(IMemoryAllocator &Allocator)
Definition: ShaderVariableManagerD3D11.cpp:75
@ D3D11_RESOURCE_RANGE_SRV
Definition: PipelineResourceAttribsD3D11.hpp:46
__forceinline void BindResource(IDeviceObject *pObject, Uint32 ArrayIndex)
Definition: ShaderVariableManagerD3D11.cpp:451
Definition: ShaderVariableManagerD3D11.cpp:627
@ D3D11_RESOURCE_RANGE_CBV
Definition: PipelineResourceAttribsD3D11.hpp:45
ShaderVariableD3D11Base & operator=(const ShaderVariableD3D11Base &)=delete
Uint32 GetNumTexUAVs() const
Definition: ShaderVariableManagerD3D11.hpp:195
Base interface for all objects created by the render device Diligent::IRenderDevice.
Definition: DeviceObject.h:52
BuffUAVBindInfo(ShaderVariableManagerD3D11 &ParentLayout, Uint32 ResIndex)
Definition: ShaderVariableManagerD3D11.hpp:156
Unique interface identifier.
Definition: InterfaceID.h:37
virtual bool IsBound(Uint32 ArrayIndex) const override final
Definition: ShaderVariableManagerD3D11.hpp:120
Uint32 GetVariableIndex(const IShaderResourceVariable &Variable) const
Definition: ShaderVariableManagerD3D11.cpp:593
Uint32 GetNumBufSRVs() const
Definition: ShaderVariableManagerD3D11.hpp:196
const ResourceAttribs & GetAttribs(Uint32 Index) const
Definition: ShaderVariableManagerD3D11.cpp:113
D3D11ResourceBindPoints BindPoints
Definition: PipelineResourceAttribsD3D11.hpp:288
const PipelineResourceDesc & GetDesc() const
Definition: ShaderVariableManagerD3D11.hpp:98
Definition: ShaderVariableManagerD3D11.cpp:548
Uint32 GetNumSamplers() const
Definition: ShaderVariableManagerD3D11.hpp:198
void BindResources(IResourceMapping *pResourceMapping, Uint32 Flags)
Definition: ShaderVariableManagerD3D11.cpp:475
static size_t GetRequiredMemorySize(const PipelineResourceSignatureD3D11Impl &Signature, const SHADER_RESOURCE_VARIABLE_TYPE *AllowedVarTypes, Uint32 NumAllowedTypes, SHADER_TYPE ShaderType)
Definition: ShaderVariableManagerD3D11.cpp:150
#define DILIGENT_CALL_TYPE
Definition: CommonDefinitions.h:45
Uint32 GetNumTexSRVs() const
Definition: ShaderVariableManagerD3D11.hpp:194
~ShaderVariableManagerD3D11()
Definition: ShaderVariableManagerD3D11.cpp:70
Pipeline resource description.
Definition: PipelineResourceSignature.h:120
uint32_t Uint32
32-bit unsigned integer
Definition: BasicTypes.h:51
virtual void GetResourceDesc(ShaderResourceDesc &ResourceDesc) const override final
Definition: ShaderResourceVariableBase.hpp:580
__forceinline void BindResource(IDeviceObject *pObject, Uint32 ArrayIndex)
Definition: ShaderVariableManagerD3D11.cpp:380
Uint32 GetNumResources() const
Definition: ShaderVariableManagerD3D11.hpp:145
Uint32 GetVariableCount() const
Definition: ShaderVariableManagerD3D11.cpp:694
const ResourceAttribs & GetAttribs() const
Definition: ShaderVariableManagerD3D11.hpp:99
The class implements a cache that holds resources bound to all shader stages.
Definition: ShaderResourceCacheD3D11.hpp:58
TexSRVBindInfo(ShaderVariableManagerD3D11 &ParentLayout, Uint32 ResIndex)
Definition: ShaderVariableManagerD3D11.hpp:138
ShaderVariableManagerD3D11 & operator=(const ShaderVariableManagerD3D11 &)=delete
Base interface for a raw memory allocator.
Definition: MemoryAllocator.h:41
Implementation of the Diligent::PipelineResourceSignatureD3D11Impl class.
Definition: PipelineResourceSignatureD3D11Impl.hpp:52
__forceinline void BindResource(IDeviceObject *pObject, Uint32 ArrayIndex)
Definition: ShaderVariableManagerD3D11.cpp:402
@ D3D11_RESOURCE_RANGE_UAV
Definition: PipelineResourceAttribsD3D11.hpp:48
SamplerBindInfo(ShaderVariableManagerD3D11 &ParentLayout, Uint32 ResIndex)
Definition: ShaderVariableManagerD3D11.hpp:174
uint16_t Uint16
16-bit unsigned integer
Definition: BasicTypes.h:52
__forceinline bool IsResourceBound(const D3D11ResourceBindPoints &BindPoints) const
Definition: ShaderResourceCacheD3D11.hpp:233
Interface to the Direct3D ShaderResourceVariable resource variable.
Definition: ShaderResourceVariableD3D.h:45
uint8_t Uint8
8-bit unsigned integer
Definition: BasicTypes.h:53
const Uint32 m_ResIndex
Definition: ShaderResourceVariableBase.hpp:633
#define VERIFY_EXPR(...)
Definition: DebugUtilities.hpp:79
ShaderVariableManagerD3D11(IObject &Owner, ShaderResourceCacheD3D11 &ResourceCache) noexcept
Definition: ShaderVariableManagerD3D11.hpp:47
IShaderResourceVariable * GetVariable(const Char *Name) const
Definition: ShaderVariableManagerD3D11.cpp:521
#define VERIFY(...)
Definition: DebugUtilities.hpp:76
__forceinline void BindResource(IDeviceObject *pObj, Uint32 ArrayIndex)
Definition: ShaderVariableManagerD3D11.cpp:283
Uint16 ShaderType
Definition: DXBCUtils.cpp:70
Definition: ShaderVariableManagerD3D11.hpp:163
virtual void GetHLSLResourceDesc(HLSLShaderResourceDesc &HLSLResDesc) const override final
Definition: ShaderVariableManagerD3D11.hpp:114
ConstBuffBindInfo(ShaderVariableManagerD3D11 &ParentLayout, Uint32 ResIndex)
Definition: ShaderVariableManagerD3D11.hpp:129
const PipelineResourceDesc & GetResourceDesc(Uint32 Index) const
Definition: ShaderVariableManagerD3D11.cpp:107
Diligent::ShaderVariableManagerD3D11 class.
Definition: ShaderVariableManagerD3D11.hpp:44
Definition: ShaderVariableManagerD3D11.hpp:136
Uint32 GetNumCBs() const
Definition: ShaderVariableManagerD3D11.hpp:193
ShaderVariableManagerD3D11 & m_ParentManager
Definition: ShaderResourceVariableBase.hpp:630
The library uses Direct3D-style math:
Definition: AdvancedMath.hpp:37
Definition: ShaderVariableManagerD3D11.hpp:172
IObject & GetOwner()
Definition: ShaderVariableManagerD3D11.hpp:186
SHADER_RESOURCE_VARIABLE_TYPE
Describes the type of the shader resource variable.
Definition: ShaderResourceVariable.h:48
Uint32 GetNumBufUAVs() const
Definition: ShaderVariableManagerD3D11.hpp:197