From c72191a465edd01905181aa47cc57e47fcc29b9e Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Mon, 4 Mar 2019 19:17:32 -0800 Subject: Completed D3D12 back-end refactor to comply with the new API --- .../include/PipelineStateD3D11Impl.h | 25 ++++++++++++---------- .../src/ShaderResourceLayoutD3D11.cpp | 8 +++---- .../src/ShaderResourcesD3D11.cpp | 4 ++-- 3 files changed, 20 insertions(+), 17 deletions(-) (limited to 'Graphics/GraphicsEngineD3D11') diff --git a/Graphics/GraphicsEngineD3D11/include/PipelineStateD3D11Impl.h b/Graphics/GraphicsEngineD3D11/include/PipelineStateD3D11Impl.h index 71830432..81e03ca2 100644 --- a/Graphics/GraphicsEngineD3D11/include/PipelineStateD3D11Impl.h +++ b/Graphics/GraphicsEngineD3D11/include/PipelineStateD3D11Impl.h @@ -50,6 +50,20 @@ public: virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface)override final; + + virtual void BindStaticResources(IResourceMapping* pResourceMapping, Uint32 Flags)override final; + + virtual Uint32 GetStaticVariableCount(SHADER_TYPE ShaderType) const override final; + + virtual IShaderResourceVariable* GetStaticShaderVariable(SHADER_TYPE ShaderType, const Char* Name) override final; + + virtual IShaderResourceVariable* GetStaticShaderVariable(SHADER_TYPE ShaderType, Uint32 Index) override final; + + virtual void CreateShaderResourceBinding( IShaderResourceBinding **ppShaderResourceBinding, bool InitStaticResources )override final; + + virtual bool IsCompatibleWith(const IPipelineState *pPSO)const override final; + + /// Implementation of the IPipelineStateD3D11::GetD3D11BlendState() method. virtual ID3D11BlendState* GetD3D11BlendState()override final; @@ -68,17 +82,6 @@ public: virtual ID3D11HullShader* GetD3D11HullShader()override final; virtual ID3D11ComputeShader* GetD3D11ComputeShader()override final; - virtual void CreateShaderResourceBinding( IShaderResourceBinding **ppShaderResourceBinding, bool InitStaticResources )override final; - - virtual bool IsCompatibleWith(const IPipelineState *pPSO)const override final; - - virtual void BindStaticResources(IResourceMapping* pResourceMapping, Uint32 Flags)override final; - - virtual Uint32 GetStaticVariableCount(SHADER_TYPE ShaderType) const override final; - - virtual IShaderResourceVariable* GetStaticShaderVariable(SHADER_TYPE ShaderType, const Char* Name) override final; - - virtual IShaderResourceVariable* GetStaticShaderVariable(SHADER_TYPE ShaderType, Uint32 Index) override final; SRBMemoryAllocator& GetSRBMemoryAllocator() { diff --git a/Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp b/Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp index 12ca400a..262902b0 100755 --- a/Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp +++ b/Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp @@ -199,9 +199,9 @@ ShaderResourceLayoutD3D11::ShaderResourceLayoutD3D11(IObject& VERIFY(sam == NumSamplers, "All samplers must be initialized before texture SRVs"); Uint32 AssignedSamplerIndex = TexSRVBindInfo::InvalidSamplerIndex; - if (TexSRV.ValidSamplerAssigned()) + if (TexSRV.IsCombinedWithSampler()) { - const auto& AssignedSamplerAttribs = m_pResources->GetSampler(TexSRV.GetSamplerId()); + const auto& AssignedSamplerAttribs = m_pResources->GetCombinedSampler(TexSRV); auto AssignedSamplerType = m_pResources->FindVariableType(AssignedSamplerAttribs, ResourceLayout); DEV_CHECK_ERR(AssignedSamplerType == VarType, "The type (", GetShaderVariableTypeLiteralName(VarType),") of texture SRV variable '", TexSRV.Name, @@ -553,9 +553,9 @@ void ShaderResourceLayoutD3D11::SamplerBindInfo::BindResource(IDeviceObject* pSa if (pSampler && !pSamplerD3D11) LOG_RESOURCE_BINDING_ERROR("sampler", pSampler, m_Attribs, ArrayIndex, m_ParentResLayout.GetShaderName(), "Incorect resource type: sampler is expected."); - if (m_Attribs.ValidTexSRVAssigned()) + if (m_Attribs.IsCombinedWithTexSRV()) { - auto* TexSRVName = m_ParentResLayout.m_pResources->GetTexSRV(m_Attribs.GetTexSRVId()).Name; + auto* TexSRVName = m_ParentResLayout.m_pResources->GetCombinedTextureSRV(m_Attribs).Name; LOG_WARNING_MESSAGE("Texture sampler sampler '", m_Attribs.Name, "' is assigned to texture SRV '", TexSRVName, "' and should not be accessed directly. The sampler is initialized when texture SRV is set to '", TexSRVName, "' variable."); } diff --git a/Graphics/GraphicsEngineD3D11/src/ShaderResourcesD3D11.cpp b/Graphics/GraphicsEngineD3D11/src/ShaderResourcesD3D11.cpp index a12a8ff6..b80cbccd 100755 --- a/Graphics/GraphicsEngineD3D11/src/ShaderResourcesD3D11.cpp +++ b/Graphics/GraphicsEngineD3D11/src/ShaderResourcesD3D11.cpp @@ -252,9 +252,9 @@ void ShaderResourcesD3D11::dvpVerifyCommittedResources(ID3D11Buffer* } } - if (tex.ValidSamplerAssigned()) + if (tex.IsCombinedWithSampler()) { - const auto& SamAttribs = GetSampler( tex.GetSamplerId() ); + const auto& SamAttribs = GetCombinedSampler(tex); VERIFY_EXPR(SamAttribs.IsValidBindPoint()); VERIFY_EXPR(SamAttribs.BindCount == 1 || SamAttribs.BindCount == tex.BindCount); } -- cgit v1.2.3