From f3698c9127d6e384eabe779b8fb3519c94e0babb Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Wed, 24 Apr 2019 22:17:09 -0700 Subject: Added IShaderResourceVariable::IsBound method (updated API version to 240024) --- .../include/ShaderResourceLayoutD3D11.h | 38 +++++++++++++++++---- .../src/ShaderResourceLayoutD3D11.cpp | 39 ---------------------- 2 files changed, 32 insertions(+), 45 deletions(-) (limited to 'Graphics/GraphicsEngineD3D11') diff --git a/Graphics/GraphicsEngineD3D11/include/ShaderResourceLayoutD3D11.h b/Graphics/GraphicsEngineD3D11/include/ShaderResourceLayoutD3D11.h index bfc39727..d19a611b 100644 --- a/Graphics/GraphicsEngineD3D11/include/ShaderResourceLayoutD3D11.h +++ b/Graphics/GraphicsEngineD3D11/include/ShaderResourceLayoutD3D11.h @@ -87,7 +87,11 @@ public: BindResource(ppObjects[elem], FirstElement+elem); } - __forceinline bool IsBound(Uint32 ArrayIndex)const; + virtual bool IsBound(Uint32 ArrayIndex)const override final + { + VERIFY_EXPR(ArrayIndex < m_Attribs.BindCount); + return m_ParentResLayout.m_ResourceCache.IsCBBound(m_Attribs.BindPoint + ArrayIndex); + } }; struct TexSRVBindInfo final : ShaderVariableD3D11Base @@ -110,7 +114,12 @@ public: BindResource(ppObjects[elem], FirstElement+elem); } - __forceinline bool IsBound(Uint32 ArrayIndex)const; + virtual bool IsBound(Uint32 ArrayIndex)const override final + { + VERIFY_EXPR(ArrayIndex < m_Attribs.BindCount); + return m_ParentResLayout.m_ResourceCache.IsSRVBound(m_Attribs.BindPoint + ArrayIndex, true); + } + bool ValidSamplerAssigned() const {return SamplerIndex != InvalidSamplerIndex;} @@ -136,7 +145,11 @@ public: BindResource(ppObjects[elem], FirstElement+elem); } - __forceinline bool IsBound(Uint32 ArrayIndex)const; + __forceinline virtual bool IsBound(Uint32 ArrayIndex)const override final + { + VERIFY_EXPR(ArrayIndex < m_Attribs.BindCount); + return m_ParentResLayout.m_ResourceCache.IsUAVBound(m_Attribs.BindPoint + ArrayIndex, true); + } }; struct BuffUAVBindInfo final : ShaderVariableD3D11Base @@ -157,7 +170,12 @@ public: BindResource(ppObjects[elem], FirstElement+elem); } - __forceinline bool IsBound(Uint32 ArrayIndex)const; + virtual bool IsBound(Uint32 ArrayIndex)const override final + { + VERIFY_EXPR(ArrayIndex < m_Attribs.BindCount); + return m_ParentResLayout.m_ResourceCache.IsUAVBound(m_Attribs.BindPoint + ArrayIndex, false); + } + }; struct BuffSRVBindInfo final : ShaderVariableD3D11Base @@ -178,7 +196,11 @@ public: BindResource(ppObjects[elem], FirstElement+elem); } - __forceinline bool IsBound(Uint32 ArrayIndex)const; + virtual bool IsBound(Uint32 ArrayIndex)const override final + { + VERIFY_EXPR(ArrayIndex < m_Attribs.BindCount); + return m_ParentResLayout.m_ResourceCache.IsSRVBound(m_Attribs.BindPoint + ArrayIndex, false); + } }; struct SamplerBindInfo final : ShaderVariableD3D11Base @@ -199,7 +221,11 @@ public: BindResource(ppObjects[elem], FirstElement+elem); } - __forceinline bool IsBound(Uint32 ArrayIndex)const; + virtual bool IsBound(Uint32 ArrayIndex)const override final + { + VERIFY_EXPR(ArrayIndex < m_Attribs.BindCount); + return m_ParentResLayout.m_ResourceCache.IsSamplerBound(m_Attribs.BindPoint + ArrayIndex); + } }; // dbgResourceCache is only used for sanity check and as a remainder that the resource cache must be alive diff --git a/Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp b/Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp index 4ac61366..7f8623b0 100755 --- a/Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp +++ b/Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp @@ -441,13 +441,6 @@ void ShaderResourceLayoutD3D11::ConstBuffBindInfo::BindResource(IDeviceObject* p -bool ShaderResourceLayoutD3D11::ConstBuffBindInfo::IsBound(Uint32 ArrayIndex)const -{ - VERIFY_EXPR(ArrayIndex < m_Attribs.BindCount); - return m_ParentResLayout.m_ResourceCache.IsCBBound(m_Attribs.BindPoint + ArrayIndex); -} - - #ifdef DEVELOPMENT template