From ef42c5459abd4f0d7e438f90adcad8577c1a686e Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Mon, 18 Jun 2018 21:06:44 -0700 Subject: Cleaned D3D Shader Resource implementation --- .../src/ShaderResourceLayoutD3D11.cpp | 34 +++++++++++----------- .../src/ShaderResourcesD3D11.cpp | 4 +-- 2 files changed, 19 insertions(+), 19 deletions(-) (limited to 'Graphics/GraphicsEngineD3D11') diff --git a/Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp b/Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp index bc952619..db1d9c4b 100644 --- a/Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp +++ b/Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp @@ -145,7 +145,7 @@ void ShaderResourceLayoutD3D11::Initialize(const std::shared_ptr(CB.BindPoint + CB.BindCount)); @@ -153,7 +153,7 @@ void ShaderResourceLayoutD3D11::Initialize(const std::shared_ptrGetSamplerCount() && SamplerSlot < DstCache.GetSamplerCount() ); DstSamplers[SamplerSlot] = CachedSamplers[SamplerSlot]; @@ -385,12 +385,12 @@ void ShaderResourceLayoutD3D11::ConstBuffBindInfo::BindResource(IDeviceObject *p } #ifdef VERIFY_SHADER_BINDINGS - if( Attribs.GetVariableType() != SHADER_VARIABLE_TYPE_DYNAMIC) + if( Attribs.VariableType != SHADER_VARIABLE_TYPE_DYNAMIC) { auto &CachedCB = pResourceCache->GetCB(Attribs.BindPoint + ArrayIndex); if( CachedCB.pBuff != nullptr && CachedCB.pBuff != pBuffD3D11Impl) { - auto VarTypeStr = GetShaderVariableTypeLiteralName(Attribs.GetVariableType()); + auto VarTypeStr = GetShaderVariableTypeLiteralName(Attribs.VariableType); LOG_ERROR_MESSAGE( "Non-null constant buffer is already bound to ", VarTypeStr, " shader variable \"", Attribs.GetPrintName(ArrayIndex), "\" in shader \"", m_ParentResLayout.GetShaderName(), "\". Attempting to bind another resource or null is an error and may cause unpredicted behavior. Use another shader resource binding instance or mark shader variable as dynamic." ); } } @@ -454,12 +454,12 @@ void ShaderResourceLayoutD3D11::TexAndSamplerBindInfo::BindResource( IDeviceObje if(pViewD3D11 && !dbgVerifyViewType("texture view", pViewD3D11.RawPtr(), Attribs, ArrayIndex, TEXTURE_VIEW_SHADER_RESOURCE, m_ParentResLayout.GetShaderName())) pViewD3D11.Release(); - if( Attribs.GetVariableType() != SHADER_VARIABLE_TYPE_DYNAMIC) + if( Attribs.VariableType != SHADER_VARIABLE_TYPE_DYNAMIC) { auto &CachedSRV = pResourceCache->GetSRV(Attribs.BindPoint + ArrayIndex); if( CachedSRV.pView != nullptr && CachedSRV.pView != pViewD3D11) { - auto VarTypeStr = GetShaderVariableTypeLiteralName(Attribs.GetVariableType()); + auto VarTypeStr = GetShaderVariableTypeLiteralName(Attribs.VariableType); LOG_ERROR_MESSAGE( "Non-null texture SRV is already bound to ", VarTypeStr, " shader variable \"", Attribs.GetPrintName(ArrayIndex), "\" in shader \"", m_ParentResLayout.GetShaderName(), "\". Attempting to bind another resource or null is an error and may cause unpredicted behavior. Use another shader resource binding instance or mark shader variable as dynamic." ); } } @@ -469,7 +469,7 @@ void ShaderResourceLayoutD3D11::TexAndSamplerBindInfo::BindResource( IDeviceObje { VERIFY_EXPR(SamplerAttribs.BindCount == Attribs.BindCount || SamplerAttribs.BindCount == 1); auto SamplerBindPoint = SamplerAttribs.BindPoint + (SamplerAttribs.BindCount != 1 ? ArrayIndex : 0); - if( !SamplerAttribs.IsStaticSampler() ) + if( !SamplerAttribs.GetIsStaticSampler() ) { SamplerD3D11Impl *pSamplerD3D11Impl = nullptr; if( pViewD3D11 ) @@ -515,12 +515,12 @@ void ShaderResourceLayoutD3D11::BuffSRVBindInfo::BindResource( IDeviceObject *pV if(pViewD3D11 && !dbgVerifyViewType("buffer view", pViewD3D11.RawPtr(), Attribs, ArrayIndex, BUFFER_VIEW_SHADER_RESOURCE, m_ParentResLayout.GetShaderName())) pViewD3D11.Release(); - if( Attribs.GetVariableType() != SHADER_VARIABLE_TYPE_DYNAMIC) + if( Attribs.VariableType != SHADER_VARIABLE_TYPE_DYNAMIC) { auto &CachedSRV = pResourceCache->GetSRV(Attribs.BindPoint + ArrayIndex); if( CachedSRV.pView != nullptr && CachedSRV.pView != pViewD3D11) { - auto VarTypeStr = GetShaderVariableTypeLiteralName(Attribs.GetVariableType()); + auto VarTypeStr = GetShaderVariableTypeLiteralName(Attribs.VariableType); LOG_ERROR_MESSAGE( "Non-null buffer SRV is already bound to ", VarTypeStr, " shader variable \"", Attribs.GetPrintName(ArrayIndex), "\" in shader \"", m_ParentResLayout.GetShaderName(), "\". Attempting to bind another resource or null is an error and may cause unpredicted behavior. Use another shader resource binding instance or mark shader variable as dynamic." ); } } @@ -546,12 +546,12 @@ void ShaderResourceLayoutD3D11::TexUAVBindInfo::BindResource( IDeviceObject *pVi if(pViewD3D11 && !dbgVerifyViewType("texture view", pViewD3D11.RawPtr(), Attribs, ArrayIndex, TEXTURE_VIEW_UNORDERED_ACCESS, m_ParentResLayout.GetShaderName())) pViewD3D11.Release(); - if( Attribs.GetVariableType() != SHADER_VARIABLE_TYPE_DYNAMIC) + if( Attribs.VariableType != SHADER_VARIABLE_TYPE_DYNAMIC) { auto &CachedUAV = pResourceCache->GetUAV(Attribs.BindPoint + ArrayIndex); if( CachedUAV.pView != nullptr && CachedUAV.pView != pViewD3D11) { - auto VarTypeStr = GetShaderVariableTypeLiteralName(Attribs.GetVariableType()); + auto VarTypeStr = GetShaderVariableTypeLiteralName(Attribs.VariableType); LOG_ERROR_MESSAGE( "Non-null texture UAV is already bound to ", VarTypeStr, " shader variable \"", Attribs.GetPrintName(ArrayIndex), "\" in shader \"", m_ParentResLayout.GetShaderName(), "\". Attempting to bind another resource or null is an error and may cause unpredicted behavior. Use another shader resource binding instance or mark shader variable as dynamic." ); } } @@ -577,12 +577,12 @@ void ShaderResourceLayoutD3D11::BuffUAVBindInfo::BindResource( IDeviceObject *pV if(pViewD3D11 && !dbgVerifyViewType("buffer view", pViewD3D11.RawPtr(), Attribs, ArrayIndex, BUFFER_VIEW_UNORDERED_ACCESS, m_ParentResLayout.GetShaderName()) ) pViewD3D11.Release(); - if( Attribs.GetVariableType() != SHADER_VARIABLE_TYPE_DYNAMIC) + if( Attribs.VariableType != SHADER_VARIABLE_TYPE_DYNAMIC) { auto &CachedUAV = pResourceCache->GetUAV(Attribs.BindPoint + ArrayIndex); if( CachedUAV.pView != nullptr && CachedUAV.pView != pViewD3D11) { - auto VarTypeStr = GetShaderVariableTypeLiteralName(Attribs.GetVariableType()); + auto VarTypeStr = GetShaderVariableTypeLiteralName(Attribs.VariableType); LOG_ERROR_MESSAGE( "Non-null buffer UAV is already bound to ", VarTypeStr, " shader variable \"", Attribs.GetPrintName(ArrayIndex), "\" in shader \"", m_ParentResLayout.GetShaderName(), "\". Attempting to bind another resource or null is an error and may cause unpredicted behavior. Use another shader resource binding instance or mark shader variable as dynamic." ); } } diff --git a/Graphics/GraphicsEngineD3D11/src/ShaderResourcesD3D11.cpp b/Graphics/GraphicsEngineD3D11/src/ShaderResourcesD3D11.cpp index ffc3a963..1fec3454 100644 --- a/Graphics/GraphicsEngineD3D11/src/ShaderResourcesD3D11.cpp +++ b/Graphics/GraphicsEngineD3D11/src/ShaderResourcesD3D11.cpp @@ -84,7 +84,7 @@ ShaderResourcesD3D11::ShaderResourcesD3D11(RenderDeviceD3D11Impl *pDeviceD3D11Im { VERIFY( SamplerAttribs.BindPoint + SamplerAttribs.BindCount-1 <= MaxAllowedBindPoint, "Sampler bind point exceeds supported range" ); m_MaxSamplerBindPoint = std::max(m_MaxSamplerBindPoint, static_cast(SamplerAttribs.BindPoint + SamplerAttribs.BindCount-1)); - m_NumStaticSamplers += SamplerAttribs.IsStaticSampler() ? 1 : 0; + m_NumStaticSamplers += SamplerAttribs.GetIsStaticSampler() ? 1 : 0; new (&GetSampler(CurrSampler++)) D3DShaderResourceAttribs( std::move(SamplerAttribs) ); }, @@ -124,7 +124,7 @@ ShaderResourcesD3D11::ShaderResourcesD3D11(RenderDeviceD3D11Impl *pDeviceD3D11Im for (Uint32 s = 0; s < GetNumSamplers(); ++s) { const auto &Sam = GetSampler(s); - if (Sam.IsStaticSampler()) + if (Sam.GetIsStaticSampler()) { Uint32 ssd = 0; for (; ssd < ShdrDesc.NumStaticSamplers; ++ssd) -- cgit v1.2.3