diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2018-06-19 04:06:44 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2018-06-19 04:06:44 +0000 |
| commit | ef42c5459abd4f0d7e438f90adcad8577c1a686e (patch) | |
| tree | 7cd27f1e2eb2571c74be903eff0d9cf0e917c03a /Graphics/GraphicsEngineD3D11 | |
| parent | Updated 3D texture clears in Vulkan backend (diff) | |
| download | DiligentCore-ef42c5459abd4f0d7e438f90adcad8577c1a686e.tar.gz DiligentCore-ef42c5459abd4f0d7e438f90adcad8577c1a686e.zip | |
Cleaned D3D Shader Resource implementation
Diffstat (limited to 'Graphics/GraphicsEngineD3D11')
| -rw-r--r-- | Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp | 34 | ||||
| -rw-r--r-- | Graphics/GraphicsEngineD3D11/src/ShaderResourcesD3D11.cpp | 4 |
2 files changed, 19 insertions, 19 deletions
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<const ShaderRes [&](const D3DShaderResourceAttribs &CB, Uint32) { - VERIFY_EXPR( IsAllowedType(CB.GetVariableType(), AllowedTypeBits) ); + VERIFY_EXPR( IsAllowedType(CB.VariableType, AllowedTypeBits) ); // Initialize current CB in place, increment CB counter new (&GetCB(cb++)) ConstBuffBindInfo( CB, *this ); NumCBSlots = std::max(NumCBSlots, static_cast<Uint32>(CB.BindPoint + CB.BindCount)); @@ -153,7 +153,7 @@ void ShaderResourceLayoutD3D11::Initialize(const std::shared_ptr<const ShaderRes [&](const D3DShaderResourceAttribs& TexSRV, Uint32) { - VERIFY_EXPR( IsAllowedType(TexSRV.GetVariableType(), AllowedTypeBits) ); + VERIFY_EXPR( IsAllowedType(TexSRV.VariableType, AllowedTypeBits) ); // Set reference to a special static instance representing invalid sampler // if no sampler is assigned to texture SRV const D3DShaderResourceAttribs& SamplerAttribs = TexSRV.IsValidSampler() ? @@ -167,7 +167,7 @@ void ShaderResourceLayoutD3D11::Initialize(const std::shared_ptr<const ShaderRes [&](const D3DShaderResourceAttribs &TexUAV, Uint32) { - VERIFY_EXPR( IsAllowedType(TexUAV.GetVariableType(), AllowedTypeBits) ); + VERIFY_EXPR( IsAllowedType(TexUAV.VariableType, AllowedTypeBits) ); // Initialize tex UAV in place, increment counter of tex UAVs new (&GetTexUAV(texUav++)) TexUAVBindInfo( TexUAV, *this ); @@ -176,7 +176,7 @@ void ShaderResourceLayoutD3D11::Initialize(const std::shared_ptr<const ShaderRes [&](const D3DShaderResourceAttribs &BuffSRV, Uint32) { - VERIFY_EXPR(IsAllowedType(BuffSRV.GetVariableType(), AllowedTypeBits)); + VERIFY_EXPR(IsAllowedType(BuffSRV.VariableType, AllowedTypeBits)); // Initialize buff SRV in place, increment counter of buff SRVs new (&GetBufSRV(bufSrv++)) BuffSRVBindInfo( BuffSRV, *this ); @@ -185,7 +185,7 @@ void ShaderResourceLayoutD3D11::Initialize(const std::shared_ptr<const ShaderRes [&](const D3DShaderResourceAttribs &BuffUAV, Uint32) { - VERIFY_EXPR(IsAllowedType(BuffUAV.GetVariableType(), AllowedTypeBits)); + VERIFY_EXPR(IsAllowedType(BuffUAV.VariableType, AllowedTypeBits)); // Initialize buff UAV in place, increment counter of buff UAVs new (&GetBufUAV(bufUav++)) BuffUAVBindInfo( BuffUAV, *this ); @@ -264,7 +264,7 @@ void ShaderResourceLayoutD3D11::CopyResources(ShaderResourceCacheD3D11 &DstCache { VERIFY_EXPR(ts.SamplerAttribs.BindCount == ts.Attribs.BindCount || ts.SamplerAttribs.BindCount == 1); Uint32 SamplerSlot = ts.SamplerAttribs.BindPoint + (ts.SamplerAttribs.BindCount == 1 ? 0 : (SRVSlot - ts.Attribs.BindPoint)); - if( !ts.SamplerAttribs.IsStaticSampler() ) + if( !ts.SamplerAttribs.GetIsStaticSampler() ) { VERIFY_EXPR( SamplerSlot < m_pResourceCache->GetSamplerCount() && 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<MaxBindPointType>(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) |
