diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2017-12-28 05:45:08 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2017-12-28 05:45:08 +0000 |
| commit | 5cf012cfbc7017b46912b9f59a9f76a2d4b870b3 (patch) | |
| tree | 911054514a37c26a82cb4152bf04fcf148d9556b /Graphics/GraphicsEngineD3D11 | |
| parent | Removed legacy visual studio project and solution files (diff) | |
| download | DiligentCore-5cf012cfbc7017b46912b9f59a9f76a2d4b870b3.tar.gz DiligentCore-5cf012cfbc7017b46912b9f59a9f76a2d4b870b3.zip | |
Reworked Common and Platform modules to break interdependenices;
Replaced static const->static constexpr where appropriate
Diffstat (limited to 'Graphics/GraphicsEngineD3D11')
20 files changed, 110 insertions, 110 deletions
diff --git a/Graphics/GraphicsEngineD3D11/include/DeviceContextD3D11Impl.h b/Graphics/GraphicsEngineD3D11/include/DeviceContextD3D11Impl.h index a48b5ef6..2036f045 100644 --- a/Graphics/GraphicsEngineD3D11/include/DeviceContextD3D11Impl.h +++ b/Graphics/GraphicsEngineD3D11/include/DeviceContextD3D11Impl.h @@ -95,7 +95,7 @@ public: void ReleaseCommittedShaderResources(); /// Number of different shader types (Vertex, Pixel, Geometry, Domain, Hull, Compute) - static const int NumShaderTypes = 6; + static constexpr int NumShaderTypes = 6; private: diff --git a/Graphics/GraphicsEngineD3D11/include/ShaderResourceCacheD3D11.h b/Graphics/GraphicsEngineD3D11/include/ShaderResourceCacheD3D11.h index e38f08f0..5d84a489 100644 --- a/Graphics/GraphicsEngineD3D11/include/ShaderResourceCacheD3D11.h +++ b/Graphics/GraphicsEngineD3D11/include/ShaderResourceCacheD3D11.h @@ -201,7 +201,7 @@ public: const_cast<ShaderResourceCacheD3D11*>(this)->GetCBArrays(CBs, d3d11CBs); if( Slot < GetCBCount() && d3d11CBs[Slot] != nullptr ) { - VERIFY(CBs[Slot].pBuff != nullptr, "No relevant buffer resource") + VERIFY(CBs[Slot].pBuff != nullptr, "No relevant buffer resource"); return true; } return false; @@ -242,7 +242,7 @@ public: const_cast<ShaderResourceCacheD3D11*>(this)->GetSamplerArrays(Samplers, d3d11Samplers); if( Slot < GetSamplerCount() && d3d11Samplers[Slot] != nullptr ) { - VERIFY(Samplers[Slot].pSampler != nullptr, "No relevant sampler") + VERIFY(Samplers[Slot].pSampler != nullptr, "No relevant sampler"); return true; } return false; @@ -326,9 +326,9 @@ private: TSrcResourceType &&pResource, TD3D11ResourceType *pd3d11Resource) { - VERIFY(Slot < Size, "Resource cache is not big enough" ) + VERIFY(Slot < Size, "Resource cache is not big enough" ); VERIFY(pResource != nullptr && pd3d11Resource != nullptr || pResource == nullptr && pd3d11Resource == nullptr, - "Resource and D3D11 resource must be set/unset atomically") + "Resource and D3D11 resource must be set/unset atomically"); TCachedResourceType* Resources; TD3D11ResourceType** d3d11ResArr; (this->*GetArrays)(Resources, d3d11ResArr); @@ -336,7 +336,7 @@ private: d3d11ResArr[Slot] = pd3d11Resource; } - static const Uint32 InvalidResourceCounts = 0xFFFFFFFF; + static constexpr Uint32 InvalidResourceCounts = 0xFFFFFFFF; // Resource limits in D3D11: // Max CB count: 14 // Max SRV count: 128 diff --git a/Graphics/GraphicsEngineD3D11/include/ShaderResourcesD3D11.h b/Graphics/GraphicsEngineD3D11/include/ShaderResourcesD3D11.h index 599c8ef2..80a7f3e1 100644 --- a/Graphics/GraphicsEngineD3D11/include/ShaderResourcesD3D11.h +++ b/Graphics/GraphicsEngineD3D11/include/ShaderResourcesD3D11.h @@ -115,7 +115,7 @@ private: MaxBindPointType m_MaxUAVBindPoint = -1; // Max == 7 Uint8 m_NumStaticSamplers = 0; // Max == 16 - static const UINT MaxAllowedBindPoint = std::numeric_limits<MaxBindPointType>::max(); + static constexpr UINT MaxAllowedBindPoint = std::numeric_limits<MaxBindPointType>::max(); static_assert(D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT-1 <= MaxAllowedBindPoint, "Not enough bits to represent max CB slot" ); static_assert(D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT-1 <= MaxAllowedBindPoint, "Not enough bits to represent max SRV slot"); static_assert(D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT-1 <= MaxAllowedBindPoint, "Not enough bits to represent max Sampler slot"); diff --git a/Graphics/GraphicsEngineD3D11/interface/BufferD3D11.h b/Graphics/GraphicsEngineD3D11/interface/BufferD3D11.h index 818f56ac..889b629e 100644 --- a/Graphics/GraphicsEngineD3D11/interface/BufferD3D11.h +++ b/Graphics/GraphicsEngineD3D11/interface/BufferD3D11.h @@ -32,11 +32,11 @@ namespace Diligent { // {4A696D2E-44BB-4C4B-9DE2-3AF7C94DCFC0} -static const Diligent::INTERFACE_ID IID_BufferD3D11 = +static constexpr INTERFACE_ID IID_BufferD3D11 = { 0x4a696d2e, 0x44bb, 0x4c4b, { 0x9d, 0xe2, 0x3a, 0xf7, 0xc9, 0x4d, 0xcf, 0xc0 } }; /// Interface to the buffer object implemented in D3D11 -class IBufferD3D11 : public Diligent::IBuffer +class IBufferD3D11 : public IBuffer { public: diff --git a/Graphics/GraphicsEngineD3D11/interface/BufferViewD3D11.h b/Graphics/GraphicsEngineD3D11/interface/BufferViewD3D11.h index 95089492..d569ec05 100644 --- a/Graphics/GraphicsEngineD3D11/interface/BufferViewD3D11.h +++ b/Graphics/GraphicsEngineD3D11/interface/BufferViewD3D11.h @@ -32,11 +32,11 @@ namespace Diligent { // {6ABA95FC-CD7D-4C03-8CAE-AFC45F9696B7} -static const Diligent::INTERFACE_ID IID_BufferViewD3D11 = +static constexpr INTERFACE_ID IID_BufferViewD3D11 = { 0x6aba95fc, 0xcd7d, 0x4c03, { 0x8c, 0xae, 0xaf, 0xc4, 0x5f, 0x96, 0x96, 0xb7 } }; /// Interface to the buffer view object implemented in D3D11 -class IBufferViewD3D11 : public Diligent::IBufferView +class IBufferViewD3D11 : public IBufferView { public: diff --git a/Graphics/GraphicsEngineD3D11/interface/DeviceContextD3D11.h b/Graphics/GraphicsEngineD3D11/interface/DeviceContextD3D11.h index 3e90af8a..76aa1a26 100644 --- a/Graphics/GraphicsEngineD3D11/interface/DeviceContextD3D11.h +++ b/Graphics/GraphicsEngineD3D11/interface/DeviceContextD3D11.h @@ -32,11 +32,11 @@ namespace Diligent { // {F0EE0335-C8AB-4EC1-BB15-B8EE5F003B99} -static const Diligent::INTERFACE_ID IID_DeviceContextD3D11 = +static constexpr INTERFACE_ID IID_DeviceContextD3D11 = { 0xf0ee0335, 0xc8ab, 0x4ec1, { 0xbb, 0x15, 0xb8, 0xee, 0x5f, 0x0, 0x3b, 0x99 } }; /// Interface to the device context object implemented in D3D11 -class IDeviceContextD3D11 : public Diligent::IDeviceContext +class IDeviceContextD3D11 : public IDeviceContext { public: diff --git a/Graphics/GraphicsEngineD3D11/interface/PipelineStateD3D11.h b/Graphics/GraphicsEngineD3D11/interface/PipelineStateD3D11.h index d21bea39..1294a3fb 100644 --- a/Graphics/GraphicsEngineD3D11/interface/PipelineStateD3D11.h +++ b/Graphics/GraphicsEngineD3D11/interface/PipelineStateD3D11.h @@ -32,7 +32,7 @@ namespace Diligent { // {3EA6E3F4-9966-47FC-8CE8-0EB3E2273061} -static const INTERFACE_ID IID_PipelineStateD3D11 = +static constexpr INTERFACE_ID IID_PipelineStateD3D11 = { 0x3ea6e3f4, 0x9966, 0x47fc, { 0x8c, 0xe8, 0xe, 0xb3, 0xe2, 0x27, 0x30, 0x61 } }; /// Interface to the blend state object implemented in D3D11 diff --git a/Graphics/GraphicsEngineD3D11/interface/RenderDeviceD3D11.h b/Graphics/GraphicsEngineD3D11/interface/RenderDeviceD3D11.h index 62f56d30..f3d03a8f 100644 --- a/Graphics/GraphicsEngineD3D11/interface/RenderDeviceD3D11.h +++ b/Graphics/GraphicsEngineD3D11/interface/RenderDeviceD3D11.h @@ -32,7 +32,7 @@ namespace Diligent { // {05B1CBB8-FCAD-49EE-BADA-7801223EC3FE} -static const Diligent::INTERFACE_ID IID_RenderDeviceD3D11 = +static constexpr INTERFACE_ID IID_RenderDeviceD3D11 = { 0x5b1cbb8, 0xfcad, 0x49ee, { 0xba, 0xda, 0x78, 0x1, 0x22, 0x3e, 0xc3, 0xfe } }; /// Interface to the render device object implemented in D3D11 diff --git a/Graphics/GraphicsEngineD3D11/interface/SamplerD3D11.h b/Graphics/GraphicsEngineD3D11/interface/SamplerD3D11.h index ca8551f2..3a05d6db 100644 --- a/Graphics/GraphicsEngineD3D11/interface/SamplerD3D11.h +++ b/Graphics/GraphicsEngineD3D11/interface/SamplerD3D11.h @@ -32,11 +32,11 @@ namespace Diligent { // {31A3BFAF-738E-4D8C-AD18-B021C5D948DD} -static const Diligent::INTERFACE_ID IID_SamplerD3D11 = +static constexpr INTERFACE_ID IID_SamplerD3D11 = { 0x31a3bfaf, 0x738e, 0x4d8c, { 0xad, 0x18, 0xb0, 0x21, 0xc5, 0xd9, 0x48, 0xdd } }; /// Interface to the sampler object implemented in D3D11 -class ISamplerD3D11 : public Diligent::ISampler +class ISamplerD3D11 : public ISampler { public: diff --git a/Graphics/GraphicsEngineD3D11/interface/ShaderD3D11.h b/Graphics/GraphicsEngineD3D11/interface/ShaderD3D11.h index 6008adc8..ac7faa7e 100644 --- a/Graphics/GraphicsEngineD3D11/interface/ShaderD3D11.h +++ b/Graphics/GraphicsEngineD3D11/interface/ShaderD3D11.h @@ -32,11 +32,11 @@ namespace Diligent { // {C513E83E-B037-405B-8B49-BF8F5C220DEE} -static const Diligent::INTERFACE_ID IID_ShaderD3D11 = +static constexpr INTERFACE_ID IID_ShaderD3D11 = { 0xc513e83e, 0xb037, 0x405b, { 0x8b, 0x49, 0xbf, 0x8f, 0x5c, 0x22, 0xd, 0xee } }; /// Interface to the shader object implemented in D3D11 -class IShaderD3D11 : public Diligent::IShader +class IShaderD3D11 : public IShader { public: diff --git a/Graphics/GraphicsEngineD3D11/interface/ShaderResourceBindingD3D11.h b/Graphics/GraphicsEngineD3D11/interface/ShaderResourceBindingD3D11.h index 0c1665bd..2d7295fb 100644 --- a/Graphics/GraphicsEngineD3D11/interface/ShaderResourceBindingD3D11.h +++ b/Graphics/GraphicsEngineD3D11/interface/ShaderResourceBindingD3D11.h @@ -32,7 +32,7 @@ namespace Diligent { // {97A6D4AC-D4AF-4AA9-B46C-67417B89026A} -static const Diligent::INTERFACE_ID IID_ShaderResourceBindingD3D11 = +static constexpr INTERFACE_ID IID_ShaderResourceBindingD3D11 = { 0x97a6d4ac, 0xd4af, 0x4aa9, { 0xb4, 0x6c, 0x67, 0x41, 0x7b, 0x89, 0x2, 0x6a } }; /// Shader resource binding interface diff --git a/Graphics/GraphicsEngineD3D11/interface/SwapChainD3D11.h b/Graphics/GraphicsEngineD3D11/interface/SwapChainD3D11.h index c516e8ab..38b95aef 100644 --- a/Graphics/GraphicsEngineD3D11/interface/SwapChainD3D11.h +++ b/Graphics/GraphicsEngineD3D11/interface/SwapChainD3D11.h @@ -32,7 +32,7 @@ namespace Diligent { // {4DAF2E76-9204-4DC4-A53A-B00097412D3A} -static const Diligent::INTERFACE_ID IID_SwapChainD3D11 = +static constexpr INTERFACE_ID IID_SwapChainD3D11 = { 0x4daf2e76, 0x9204, 0x4dc4, { 0xa5, 0x3a, 0xb0, 0x0, 0x97, 0x41, 0x2d, 0x3a } }; /// Interface to the swap chain object implemented in D3D11 diff --git a/Graphics/GraphicsEngineD3D11/interface/TextureD3D11.h b/Graphics/GraphicsEngineD3D11/interface/TextureD3D11.h index c52b005e..cb49d00d 100644 --- a/Graphics/GraphicsEngineD3D11/interface/TextureD3D11.h +++ b/Graphics/GraphicsEngineD3D11/interface/TextureD3D11.h @@ -32,11 +32,11 @@ namespace Diligent { // {F3A84CC2-E485-4E72-A08A-437D7FFBA3AB} -static const Diligent::INTERFACE_ID IID_TextureD3D11 = +static constexpr INTERFACE_ID IID_TextureD3D11 = { 0xf3a84cc2, 0xe485, 0x4e72, { 0xa0, 0x8a, 0x43, 0x7d, 0x7f, 0xfb, 0xa3, 0xab } }; /// Interface to the texture object implemented in D3D11 -class ITextureD3D11 : public Diligent::ITexture +class ITextureD3D11 : public ITexture { public: diff --git a/Graphics/GraphicsEngineD3D11/interface/TextureViewD3D11.h b/Graphics/GraphicsEngineD3D11/interface/TextureViewD3D11.h index 9aa71d9e..59e8d787 100644 --- a/Graphics/GraphicsEngineD3D11/interface/TextureViewD3D11.h +++ b/Graphics/GraphicsEngineD3D11/interface/TextureViewD3D11.h @@ -32,11 +32,11 @@ namespace Diligent { // {0767EBE4-AD47-4E70-9B65-38C6B9CAC37D} -static const Diligent::INTERFACE_ID IID_TextureViewD3D11 = +static constexpr INTERFACE_ID IID_TextureViewD3D11 = { 0x767ebe4, 0xad47, 0x4e70, { 0x9b, 0x65, 0x38, 0xc6, 0xb9, 0xca, 0xc3, 0x7d } }; /// Interface to the texture view object implemented in D3D11 -class ITextureViewD3D11 : public Diligent::ITextureView +class ITextureViewD3D11 : public ITextureView { public: diff --git a/Graphics/GraphicsEngineD3D11/src/BufferD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/BufferD3D11Impl.cpp index 45aa9c58..27fc8792 100644 --- a/Graphics/GraphicsEngineD3D11/src/BufferD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/BufferD3D11Impl.cpp @@ -102,35 +102,35 @@ static BufferDesc BuffDescFromD3D11Buffer(ID3D11Buffer *pd3d11Buffer, BufferDesc D3D11_BUFFER_DESC D3D11BuffDesc; pd3d11Buffer->GetDesc(&D3D11BuffDesc); - VERIFY(BuffDesc.uiSizeInBytes == 0 || BuffDesc.uiSizeInBytes == D3D11BuffDesc.ByteWidth, "Buffer size specified by the BufferDesc (",BuffDesc.uiSizeInBytes,") does not match d3d11 buffer size (", D3D11BuffDesc.ByteWidth, ")" ) + VERIFY(BuffDesc.uiSizeInBytes == 0 || BuffDesc.uiSizeInBytes == D3D11BuffDesc.ByteWidth, "Buffer size specified by the BufferDesc (",BuffDesc.uiSizeInBytes,") does not match d3d11 buffer size (", D3D11BuffDesc.ByteWidth, ")" ); BuffDesc.uiSizeInBytes = Uint32{ D3D11BuffDesc.ByteWidth }; auto BindFlags = D3D11BindFlagsToBindFlags(D3D11BuffDesc.BindFlags); if (D3D11BuffDesc.MiscFlags & D3D11_RESOURCE_MISC_DRAWINDIRECT_ARGS) BindFlags |= BIND_INDIRECT_DRAW_ARGS; - VERIFY(BuffDesc.BindFlags == 0 || BuffDesc.BindFlags == BindFlags, "Bind flags specified by the BufferDesc (", BuffDesc.BindFlags,") do not match bind flags recovered from d3d11 buffer desc (", BindFlags, ")" ) + VERIFY(BuffDesc.BindFlags == 0 || BuffDesc.BindFlags == BindFlags, "Bind flags specified by the BufferDesc (", BuffDesc.BindFlags,") do not match bind flags recovered from d3d11 buffer desc (", BindFlags, ")" ); BuffDesc.BindFlags = BindFlags; auto Usage = D3D11UsageToUsage(D3D11BuffDesc.Usage); - VERIFY(BuffDesc.Usage == 0 || BuffDesc.Usage == Usage, "Usage specified by the BufferDesc (", BuffDesc.Usage,") do not match buffer usage recovered from d3d11 buffer desc (", Usage, ")" ) + VERIFY(BuffDesc.Usage == 0 || BuffDesc.Usage == Usage, "Usage specified by the BufferDesc (", BuffDesc.Usage,") do not match buffer usage recovered from d3d11 buffer desc (", Usage, ")" ); BuffDesc.Usage = Usage; auto CPUAccessFlags = D3D11CPUAccessFlagsToCPUAccessFlags(D3D11BuffDesc.CPUAccessFlags); - VERIFY(BuffDesc.CPUAccessFlags == 0 || BuffDesc.CPUAccessFlags == CPUAccessFlags, "CPU access flags specified by the BufferDesc (", BuffDesc.CPUAccessFlags, ") do not match CPU access flags recovered from d3d11 buffer desc (", CPUAccessFlags, ")") + VERIFY(BuffDesc.CPUAccessFlags == 0 || BuffDesc.CPUAccessFlags == CPUAccessFlags, "CPU access flags specified by the BufferDesc (", BuffDesc.CPUAccessFlags, ") do not match CPU access flags recovered from d3d11 buffer desc (", CPUAccessFlags, ")"); BuffDesc.CPUAccessFlags = CPUAccessFlags; if( (BuffDesc.BindFlags & BIND_UNORDERED_ACCESS) || (BuffDesc.BindFlags & BIND_SHADER_RESOURCE) ) { if(D3D11BuffDesc.MiscFlags & D3D11_RESOURCE_MISC_BUFFER_STRUCTURED) { - VERIFY(BuffDesc.Mode == BUFFER_MODE_UNDEFINED || BuffDesc.Mode == BUFFER_MODE_STRUCTURED, "Unexpected buffer mode") + VERIFY(BuffDesc.Mode == BUFFER_MODE_UNDEFINED || BuffDesc.Mode == BUFFER_MODE_STRUCTURED, "Unexpected buffer mode"); BuffDesc.Mode = BUFFER_MODE_STRUCTURED; - VERIFY(BuffDesc.ElementByteStride == 0 || BuffDesc.ElementByteStride == D3D11BuffDesc.StructureByteStride, "Element byte stride specified by the BufferDesc (", BuffDesc.ElementByteStride, ") does not match structured byte stride recovered from d3d11 buffer desc (", D3D11BuffDesc.StructureByteStride, ")") + VERIFY(BuffDesc.ElementByteStride == 0 || BuffDesc.ElementByteStride == D3D11BuffDesc.StructureByteStride, "Element byte stride specified by the BufferDesc (", BuffDesc.ElementByteStride, ") does not match structured byte stride recovered from d3d11 buffer desc (", D3D11BuffDesc.StructureByteStride, ")"); BuffDesc.ElementByteStride = Uint32{ D3D11BuffDesc.StructureByteStride }; } else { - VERIFY(BuffDesc.Mode == BUFFER_MODE_UNDEFINED || BuffDesc.Mode == BUFFER_MODE_FORMATTED, "Unexpected buffer mode") + VERIFY(BuffDesc.Mode == BUFFER_MODE_UNDEFINED || BuffDesc.Mode == BUFFER_MODE_FORMATTED, "Unexpected buffer mode"); BuffDesc.Mode = BUFFER_MODE_FORMATTED; VERIFY( BuffDesc.Format.ValueType != VT_UNDEFINED, "Value type is not specified for a formatted buffer" ); VERIFY( BuffDesc.Format.NumComponents != 0, "Num components cannot be zero in a formated buffer" ); @@ -250,7 +250,7 @@ void BufferD3D11Impl::CreateViewInternal( const BufferViewDesc &OrigViewDesc, IB catch( const std::runtime_error & ) { const auto *ViewTypeName = GetBufferViewTypeLiteralName(OrigViewDesc.ViewType); - LOG_ERROR("Failed to create view \"", OrigViewDesc.Name ? OrigViewDesc.Name : "", "\" (", ViewTypeName, ") for buffer \"", m_Desc.Name, "\"" ) + LOG_ERROR("Failed to create view \"", OrigViewDesc.Name ? OrigViewDesc.Name : "", "\" (", ViewTypeName, ") for buffer \"", m_Desc.Name, "\"" ); } } diff --git a/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp index a64f943d..92f89811 100644 --- a/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp @@ -246,13 +246,13 @@ namespace Diligent #ifdef _DEBUG else { - VERIFY_EXPR(CommitResources) + VERIFY_EXPR(CommitResources); auto &CB = CachedCBs[cb]; if( auto *pBuff = const_cast<BufferD3D11Impl*>(CB.pBuff.RawPtr()) ) { if (!pBuff->CheckState(D3D11BufferState::ConstantBuffer)) { - LOG_ERROR_MESSAGE("Buffer \"", pBuff->GetDesc().Name, "\" has not been transitioned to Constant Buffer state. Did you forget to call TransitionResources()?") + LOG_ERROR_MESSAGE("Buffer \"", pBuff->GetDesc().Name, "\" has not been transitioned to Constant Buffer state. Did you forget to call TransitionResources()?"); } } } @@ -336,19 +336,19 @@ namespace Diligent #ifdef _DEBUG else { - VERIFY_EXPR(CommitResources) + VERIFY_EXPR(CommitResources); if (auto *pTexture = const_cast<TextureBaseD3D11*>(SRVRes.pTexture)) { if( !pTexture->CheckState(D3D11TextureState::ShaderResource) ) { - LOG_ERROR_MESSAGE("Texture \"", pTexture->GetDesc().Name, "\" has not been transitioned to Shader Resource state. Did you forget to call TransitionResources()?") + LOG_ERROR_MESSAGE("Texture \"", pTexture->GetDesc().Name, "\" has not been transitioned to Shader Resource state. Did you forget to call TransitionResources()?"); } } else if(auto *pBuffer = const_cast<BufferD3D11Impl*>(SRVRes.pBuffer)) { if( !pBuffer->CheckState(D3D11BufferState::ShaderResource) ) { - LOG_ERROR_MESSAGE("Texture \"", pBuffer->GetDesc().Name, "\" has not been transitioned to Shader Resource state. Did you forget to call TransitionResources()?") + LOG_ERROR_MESSAGE("Texture \"", pBuffer->GetDesc().Name, "\" has not been transitioned to Shader Resource state. Did you forget to call TransitionResources()?"); } } } @@ -463,14 +463,14 @@ namespace Diligent { if( !pTexture->CheckState(D3D11TextureState::UnorderedAccess) ) { - LOG_ERROR_MESSAGE("Texture \"", pTexture->GetDesc().Name, "\" has not been transitioned to Unordered Access state. Did you forget to call TransitionResources()?") + LOG_ERROR_MESSAGE("Texture \"", pTexture->GetDesc().Name, "\" has not been transitioned to Unordered Access state. Did you forget to call TransitionResources()?"); } } else if( auto *pBuffer = const_cast<BufferD3D11Impl*>(UAVRes.pBuffer) ) { if( !pBuffer->CheckState(D3D11BufferState::UnorderedAccess) ) { - LOG_ERROR_MESSAGE("Buffer \"", pBuffer->GetDesc().Name, "\" has not been transitioned to Unordered Access state. Did you forget to call TransitionResources()?") + LOG_ERROR_MESSAGE("Buffer \"", pBuffer->GetDesc().Name, "\" has not been transitioned to Unordered Access state. Did you forget to call TransitionResources()?"); } } } @@ -1013,7 +1013,7 @@ namespace Diligent // Pop null resources from the end of arrays while( NumCommittedSlots > 0 && CommittedD3D11Resources[NumCommittedSlots-1] == nullptr ) { - VERIFY( CommittedD3D11Views[NumSlots-1] == nullptr, "Unexpected non-null resource view" ) + VERIFY( CommittedD3D11Views[NumSlots-1] == nullptr, "Unexpected non-null resource view" ); --NumCommittedSlots; } } @@ -1021,7 +1021,7 @@ namespace Diligent void DeviceContextD3D11Impl::UnbindTextureFromInput( TextureBaseD3D11 *pTexture, ID3D11Resource *pd3d11Resource ) { - VERIFY( pTexture, "Null texture provided" ) + VERIFY( pTexture, "Null texture provided" ); if( !pTexture )return; UnbindResourceView( m_CommittedD3D11SRVs, m_CommittedD3D11SRVResources, m_NumCommittedSRVs, pTexture, pd3d11Resource, SetSRVMethods ); @@ -1030,7 +1030,7 @@ namespace Diligent void DeviceContextD3D11Impl::UnbindBufferFromInput( BufferD3D11Impl *pBuffer, ID3D11Resource *pd3d11Buffer ) { - VERIFY( pBuffer, "Null buffer provided" ) + VERIFY( pBuffer, "Null buffer provided" ); if( !pBuffer )return; if( pBuffer->CheckState(D3D11BufferState::ShaderResource) ) @@ -1112,7 +1112,7 @@ namespace Diligent void DeviceContextD3D11Impl::UnbindResourceFromUAV( IDeviceObject *pResource, ID3D11Resource *pd3d11Resource ) { - VERIFY( pResource, "Null resource provided" ) + VERIFY( pResource, "Null resource provided" ); if( !pResource )return; UnbindResourceView( m_CommittedD3D11UAVs, m_CommittedD3D11UAVResources, m_NumCommittedUAVs, pResource, pd3d11Resource, SetUAVMethods ); @@ -1120,7 +1120,7 @@ namespace Diligent void DeviceContextD3D11Impl::UnbindTextureFromRenderTarget( TextureBaseD3D11 *pTexture ) { - VERIFY( pTexture, "Null resource provided" ) + VERIFY( pTexture, "Null resource provided" ); if( !pTexture )return; bool bCommitRenderTargets = false; @@ -1144,7 +1144,7 @@ namespace Diligent void DeviceContextD3D11Impl::UnbindTextureFromDepthStencil(TextureBaseD3D11 *pTexD3D11) { - VERIFY( pTexD3D11, "Null resource provided" ) + VERIFY( pTexD3D11, "Null resource provided" ); if( !pTexD3D11 )return; if( m_pBoundDepthStencil && m_pBoundDepthStencil->GetTexture() == pTexD3D11 ) @@ -1518,12 +1518,12 @@ namespace Diligent { if( Slot < NumCommittedResources ) { - VERIFY( CommittedResources[Slot] == pctxResources[Slot], ResourceName, " binding mismatch found for ", ShaderName, " shader type at slot ", Slot ) + VERIFY( CommittedResources[Slot] == pctxResources[Slot], ResourceName, " binding mismatch found for ", ShaderName, " shader type at slot ", Slot ); } else { - VERIFY( pctxResources[Slot] == nullptr, ResourceName, " binding mismatch found for ", ShaderName, " shader type at slot ", Slot ) - VERIFY( CommittedResources[Slot] == nullptr, ResourceName, " unexpected non-null resource found for ", ShaderName, " shader type at slot ", Slot ) + VERIFY( pctxResources[Slot] == nullptr, ResourceName, " binding mismatch found for ", ShaderName, " shader type at slot ", Slot ); + VERIFY( CommittedResources[Slot] == nullptr, ResourceName, " unexpected non-null resource found for ", ShaderName, " shader type at slot ", Slot ); } if( pctxResources[Slot] ) @@ -1557,7 +1557,7 @@ namespace Diligent { CComPtr<ID3D11Resource> pRefRes; Views[Slot]->GetResource(&pRefRes); - VERIFY( pRefRes == Resources[Slot], "Inconsistent ", ResourceName, " detected at slot ", Slot, " in shader ", ShaderName, ". The resource in the view does not match cached D3D11 resource" ) + VERIFY( pRefRes == Resources[Slot], "Inconsistent ", ResourceName, " detected at slot ", Slot, " in shader ", ShaderName, ". The resource in the view does not match cached D3D11 resource" ); } } } @@ -1601,7 +1601,7 @@ namespace Diligent VERIFY(m_CommittedD3D11IndexBuffer == pctxIndexBuffer, "Index buffer binding mismatch detected"); if( Fmt==DXGI_FORMAT_R32_UINT ) { - VERIFY(m_CommittedIBFormat == VT_UINT32, "Index buffer format mismatch detected") + VERIFY(m_CommittedIBFormat == VT_UINT32, "Index buffer format mismatch detected"); } else if( Fmt==DXGI_FORMAT_R16_UINT ) { diff --git a/Graphics/GraphicsEngineD3D11/src/ShaderResourceCacheD3D11.cpp b/Graphics/GraphicsEngineD3D11/src/ShaderResourceCacheD3D11.cpp index 0567eb8d..95846347 100644 --- a/Graphics/GraphicsEngineD3D11/src/ShaderResourceCacheD3D11.cpp +++ b/Graphics/GraphicsEngineD3D11/src/ShaderResourceCacheD3D11.cpp @@ -37,7 +37,7 @@ namespace Diligent // http://diligentgraphics.com/diligent-engine/architecture/d3d11/shader-resource-cache/ if (IsInitialized()) { - LOG_ERROR_MESSAGE("Resource cache is already intialized") + LOG_ERROR_MESSAGE("Resource cache is already intialized"); return; } @@ -127,8 +127,8 @@ namespace Diligent void ShaderResourceCacheD3D11::Destroy(IMemoryAllocator &MemAllocator) { - VERIFY( IsInitialized(), "Resource cache is not initialized") - VERIFY( m_pdbgMemoryAllocator == &MemAllocator, "The allocator does not match the one used to create resources") + VERIFY( IsInitialized(), "Resource cache is not initialized"); + VERIFY( m_pdbgMemoryAllocator == &MemAllocator, "The allocator does not match the one used to create resources"); if( IsInitialized() ) { @@ -164,54 +164,54 @@ namespace Diligent ShaderResourceCacheD3D11::~ShaderResourceCacheD3D11() { - VERIFY( !IsInitialized(), "Shader resource cache memory must be released with ShaderResourceCacheD3D11::Destroy()" ) + VERIFY( !IsInitialized(), "Shader resource cache memory must be released with ShaderResourceCacheD3D11::Destroy()" ); } void dbgVerifyResource(ShaderResourceCacheD3D11::CachedResource &Res, ID3D11View *pd3d11View, const char *ViewType) { if (pd3d11View != nullptr) { - VERIFY(Res.pView != nullptr, "Resource view is not initialized") - VERIFY(Res.pBuffer==nullptr && Res.pTexture!=nullptr || Res.pBuffer!=nullptr && Res.pTexture==nullptr, "Texture and buffer resources are mutually exclusive") - VERIFY(Res.pd3d11Resource!=nullptr, "D3D11 resource is missing") + VERIFY(Res.pView != nullptr, "Resource view is not initialized"); + VERIFY(Res.pBuffer==nullptr && Res.pTexture!=nullptr || Res.pBuffer!=nullptr && Res.pTexture==nullptr, "Texture and buffer resources are mutually exclusive"); + VERIFY(Res.pd3d11Resource!=nullptr, "D3D11 resource is missing"); CComPtr<ID3D11Resource> pd3d11ActualResource; pd3d11View->GetResource(&pd3d11ActualResource); - VERIFY(pd3d11ActualResource == Res.pd3d11Resource, "Inconsistent D3D11 resource") + VERIFY(pd3d11ActualResource == Res.pd3d11Resource, "Inconsistent D3D11 resource"); if (Res.pBuffer) { - VERIFY(pd3d11ActualResource == Res.pBuffer->GetD3D11Buffer(), "Inconsistent buffer ", ViewType) + VERIFY(pd3d11ActualResource == Res.pBuffer->GetD3D11Buffer(), "Inconsistent buffer ", ViewType); if (Res.pView) { RefCntAutoPtr<IBufferViewD3D11> pBufView(Res.pView, IID_BufferViewD3D11); - VERIFY(pBufView != nullptr, "Provided resource view is not D3D11 buffer view") + VERIFY(pBufView != nullptr, "Provided resource view is not D3D11 buffer view"); if(pBufView) - VERIFY(pBufView->GetBuffer() == Res.pBuffer, "Provided resource view is not a view of the buffer") + VERIFY(pBufView->GetBuffer() == Res.pBuffer, "Provided resource view is not a view of the buffer"); } } else if(Res.pTexture) { - VERIFY(pd3d11ActualResource == Res.pTexture->GetD3D11Texture(), "Inconsistent texture ", ViewType) + VERIFY(pd3d11ActualResource == Res.pTexture->GetD3D11Texture(), "Inconsistent texture ", ViewType); if (Res.pView) { RefCntAutoPtr<ITextureViewD3D11> pTexView(Res.pView, IID_TextureViewD3D11); - VERIFY(pTexView != nullptr, "Provided resource view is not D3D11 texture view") + VERIFY(pTexView != nullptr, "Provided resource view is not D3D11 texture view"); if(pTexView) - VERIFY(pTexView->GetTexture() == Res.pTexture, "Provided resource view is not a view of the texture") + VERIFY(pTexView->GetTexture() == Res.pTexture, "Provided resource view is not a view of the texture"); } } } else { - VERIFY(Res.pView==nullptr, "Resource view is unexpected") - VERIFY(Res.pBuffer==nullptr && Res.pTexture==nullptr, "Niether texture nor buffer resource is expected") - VERIFY(Res.pd3d11Resource==nullptr, "Unexepected D3D11 resource") + VERIFY(Res.pView==nullptr, "Resource view is unexpected"); + VERIFY(Res.pBuffer==nullptr && Res.pTexture==nullptr, "Niether texture nor buffer resource is expected"); + VERIFY(Res.pd3d11Resource==nullptr, "Unexepected D3D11 resource"); } } void ShaderResourceCacheD3D11::dbgVerifyCacheConsistency() { - VERIFY(IsInitialized(), "Cache is not initialized") + VERIFY(IsInitialized(), "Cache is not initialized"); CachedCB* CBs = nullptr; ID3D11Buffer** d3d11CBs = nullptr; @@ -228,10 +228,10 @@ namespace Diligent { auto &pBuff = CBs[cb].pBuff; auto *pd3d11Buff = d3d11CBs[cb]; - VERIFY(pBuff==nullptr && pd3d11Buff==nullptr || pBuff!=nullptr && pd3d11Buff!=nullptr, "CB resource and d3d11 buffer must be set/unset atomically") + VERIFY(pBuff==nullptr && pd3d11Buff==nullptr || pBuff!=nullptr && pd3d11Buff!=nullptr, "CB resource and d3d11 buffer must be set/unset atomically"); if(pBuff != nullptr && pd3d11Buff != nullptr ) { - VERIFY(pd3d11Buff == pBuff->GetD3D11Buffer(), "Inconsistent D3D11 buffer") + VERIFY(pd3d11Buff == pBuff->GetD3D11Buffer(), "Inconsistent D3D11 buffer"); } } @@ -256,10 +256,10 @@ namespace Diligent { auto &pSampler = Samplers[sam].pSampler; auto *pd3d11Sampler = d3d11Samplers[sam]; - VERIFY(pSampler==nullptr && pd3d11Sampler==nullptr || pSampler!=nullptr && pd3d11Sampler!=nullptr, "CB resource and d3d11 buffer must be set/unset atomically") + VERIFY(pSampler==nullptr && pd3d11Sampler==nullptr || pSampler!=nullptr && pd3d11Sampler!=nullptr, "CB resource and d3d11 buffer must be set/unset atomically"); if(pSampler!=nullptr && pd3d11Sampler!=nullptr) { - VERIFY(pd3d11Sampler==pSampler->GetD3D11SamplerState(), "Inconsistent D3D11 sampler") + VERIFY(pd3d11Sampler==pSampler->GetD3D11SamplerState(), "Inconsistent D3D11 sampler"); } } } diff --git a/Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp b/Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp index f4c51ced..f08977e6 100644 --- a/Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp +++ b/Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp @@ -216,10 +216,10 @@ void ShaderResourceLayoutD3D11::CopyResources(ShaderResourceCacheD3D11 &DstCache { VERIFY(m_pResourceCache, "Resource cache must not be null"); - VERIFY( DstCache.GetCBCount() >= m_pResourceCache->GetCBCount(), "Dst cache is not large enough to contain all CBs" ) - VERIFY( DstCache.GetSRVCount() >= m_pResourceCache->GetSRVCount(), "Dst cache is not large enough to contain all SRVs" ) - VERIFY( DstCache.GetSamplerCount() >= m_pResourceCache->GetSamplerCount(), "Dst cache is not large enough to contain all samplers" ) - VERIFY( DstCache.GetUAVCount() >= m_pResourceCache->GetUAVCount(), "Dst cache is not large enough to contain all UAVs" ) + VERIFY( DstCache.GetCBCount() >= m_pResourceCache->GetCBCount(), "Dst cache is not large enough to contain all CBs" ); + VERIFY( DstCache.GetSRVCount() >= m_pResourceCache->GetSRVCount(), "Dst cache is not large enough to contain all SRVs" ); + VERIFY( DstCache.GetSamplerCount() >= m_pResourceCache->GetSamplerCount(), "Dst cache is not large enough to contain all samplers" ); + VERIFY( DstCache.GetUAVCount() >= m_pResourceCache->GetUAVCount(), "Dst cache is not large enough to contain all UAVs" ); ShaderResourceCacheD3D11::CachedCB* CachedCBs = nullptr; ID3D11Buffer** d3d11CBs = nullptr; @@ -345,15 +345,15 @@ void ShaderResourceLayoutD3D11::InitVariablesHashMap() } #define LOG_RESOURCE_BINDING_ERROR(ResType, pResource, Attribs, ArrayInd, ShaderName, ...)\ -{ \ +do{ \ const auto &ResName = pResource->GetDesc().Name; \ if(Attribs.BindCount>1) \ LOG_ERROR_MESSAGE( "Failed to bind ", ResType, " \"", ResName, "\" to variable \"", Attribs.Name,\ - "[", ArrayInd, "]\" in shader \"", ShaderName, "\". ", __VA_ARGS__ ) \ + "[", ArrayInd, "]\" in shader \"", ShaderName, "\". ", __VA_ARGS__ ); \ else \ LOG_ERROR_MESSAGE( "Failed to bind ", ResType, " \"", ResName, "\" to variable \"", Attribs.Name,\ - "\" in shader \"", ShaderName, "\". ", __VA_ARGS__ ) \ -} + "\" in shader \"", ShaderName, "\". ", __VA_ARGS__ ); \ +}while(false) void ShaderResourceLayoutD3D11::ConstBuffBindInfo::BindResource(IDeviceObject *pBuffer, Uint32 ArrayIndex, const ShaderResourceLayoutD3D11 *dbgResLayout) { @@ -375,12 +375,12 @@ void ShaderResourceLayoutD3D11::ConstBuffBindInfo::BindResource(IDeviceObject *p if( !(pBuffD3D11Impl->GetDesc().BindFlags & BIND_UNIFORM_BUFFER) ) { pBuffD3D11Impl.Release(); - LOG_RESOURCE_BINDING_ERROR("buffer", pBuffer, Attribs, ArrayIndex, m_ParentResLayout.GetShaderName(), "Buffer was not created with BIND_UNIFORM_BUFFER flag.") + LOG_RESOURCE_BINDING_ERROR("buffer", pBuffer, Attribs, ArrayIndex, m_ParentResLayout.GetShaderName(), "Buffer was not created with BIND_UNIFORM_BUFFER flag."); } } else { - LOG_RESOURCE_BINDING_ERROR("buffer", pBuffer, Attribs, ArrayIndex, m_ParentResLayout.GetShaderName(), "Incorrect resource type: buffer is expected.") + LOG_RESOURCE_BINDING_ERROR("buffer", pBuffer, Attribs, ArrayIndex, m_ParentResLayout.GetShaderName(), "Incorrect resource type: buffer is expected."); } } @@ -450,7 +450,7 @@ void ShaderResourceLayoutD3D11::TexAndSamplerBindInfo::BindResource( IDeviceObje RefCntAutoPtr<TextureViewD3D11Impl> pViewD3D11(pView, IID_TextureViewD3D11); #ifdef VERIFY_SHADER_BINDINGS if(pView && !pViewD3D11) - LOG_RESOURCE_BINDING_ERROR("resource", pView, Attribs, ArrayIndex, "", "Incorect resource type: texture view is expected.") + LOG_RESOURCE_BINDING_ERROR("resource", pView, Attribs, ArrayIndex, "", "Incorect resource type: texture view is expected."); if(pViewD3D11 && !dbgVerifyViewType("texture view", pViewD3D11.RawPtr(), Attribs, ArrayIndex, TEXTURE_VIEW_SHADER_RESOURCE, m_ParentResLayout.GetShaderName())) pViewD3D11.Release(); @@ -479,9 +479,9 @@ void ShaderResourceLayoutD3D11::TexAndSamplerBindInfo::BindResource( IDeviceObje if(pSamplerD3D11Impl==nullptr) { if(SamplerAttribs.BindCount > 1) - LOG_ERROR_MESSAGE( "Failed to bind sampler to variable \"", SamplerAttribs.Name, "[", ArrayIndex,"]\". Sampler is not set in the texture view \"", pViewD3D11->GetDesc().Name, "\"" ) + LOG_ERROR_MESSAGE( "Failed to bind sampler to variable \"", SamplerAttribs.Name, "[", ArrayIndex,"]\". Sampler is not set in the texture view \"", pViewD3D11->GetDesc().Name, "\"" ); else - LOG_ERROR_MESSAGE( "Failed to bind sampler to variable \"", SamplerAttribs.Name, "\". Sampler is not set in the texture view \"", pViewD3D11->GetDesc().Name, "\"" ) + LOG_ERROR_MESSAGE( "Failed to bind sampler to variable \"", SamplerAttribs.Name, "\". Sampler is not set in the texture view \"", pViewD3D11->GetDesc().Name, "\"" ); } #endif } @@ -511,7 +511,7 @@ void ShaderResourceLayoutD3D11::BuffSRVBindInfo::BindResource( IDeviceObject *pV RefCntAutoPtr<BufferViewD3D11Impl> pViewD3D11(pView, IID_BufferViewD3D11); #ifdef VERIFY_SHADER_BINDINGS if(pView && !pViewD3D11) - LOG_RESOURCE_BINDING_ERROR("resource", pView, Attribs, ArrayIndex, "", "Incorect resource type: buffer view is expected.") + LOG_RESOURCE_BINDING_ERROR("resource", pView, Attribs, ArrayIndex, "", "Incorect resource type: buffer view is expected."); if(pViewD3D11 && !dbgVerifyViewType("buffer view", pViewD3D11.RawPtr(), Attribs, ArrayIndex, BUFFER_VIEW_SHADER_RESOURCE, m_ParentResLayout.GetShaderName())) pViewD3D11.Release(); @@ -542,7 +542,7 @@ void ShaderResourceLayoutD3D11::TexUAVBindInfo::BindResource( IDeviceObject *pVi RefCntAutoPtr<TextureViewD3D11Impl> pViewD3D11(pView, IID_TextureViewD3D11); #ifdef VERIFY_SHADER_BINDINGS if(pView && !pViewD3D11) - LOG_RESOURCE_BINDING_ERROR("resource", pView, Attribs, ArrayIndex, "", "Incorect resource type: texture view is expected.") + LOG_RESOURCE_BINDING_ERROR("resource", pView, Attribs, ArrayIndex, "", "Incorect resource type: texture view is expected."); if(pViewD3D11 && !dbgVerifyViewType("texture view", pViewD3D11.RawPtr(), Attribs, ArrayIndex, TEXTURE_VIEW_UNORDERED_ACCESS, m_ParentResLayout.GetShaderName())) pViewD3D11.Release(); @@ -573,7 +573,7 @@ void ShaderResourceLayoutD3D11::BuffUAVBindInfo::BindResource( IDeviceObject *pV RefCntAutoPtr<BufferViewD3D11Impl> pViewD3D11(pView, IID_BufferViewD3D11); #ifdef VERIFY_SHADER_BINDINGS if(pView && !pViewD3D11) - LOG_RESOURCE_BINDING_ERROR("resource", pView, Attribs, ArrayIndex, "", "Incorect resource type: buffer view is expected.") + LOG_RESOURCE_BINDING_ERROR("resource", pView, Attribs, ArrayIndex, "", "Incorect resource type: buffer view is expected."); if(pViewD3D11 && !dbgVerifyViewType("buffer view", pViewD3D11.RawPtr(), Attribs, ArrayIndex, BUFFER_VIEW_UNORDERED_ACCESS, m_ParentResLayout.GetShaderName()) ) pViewD3D11.Release(); @@ -667,7 +667,7 @@ public: else { if( (Flags & BIND_SHADER_RESOURCES_ALL_RESOLVED) && !Res.IsBound(elem) ) - LOG_ERROR_MESSAGE( "Cannot bind resource to shader variable \"", VarName, "\": resource view not found in the resource mapping" ) + LOG_ERROR_MESSAGE( "Cannot bind resource to shader variable \"", VarName, "\": resource view not found in the resource mapping" ); } } } @@ -760,12 +760,12 @@ void ShaderResourceLayoutD3D11::dbgVerifyBindings()const { #define LOG_MISSING_BINDING(VarType, Attrs, BindPt)\ -{ \ +do{ \ if(Attrs.BindCount == 1) \ - LOG_ERROR_MESSAGE( "No resource is bound to ", VarType, " variable \"", Attrs.Name, "\" in shader \"", GetShaderName(), "\"" ) \ + LOG_ERROR_MESSAGE( "No resource is bound to ", VarType, " variable \"", Attrs.Name, "\" in shader \"", GetShaderName(), "\"" ); \ else \ - LOG_ERROR_MESSAGE( "No resource is bound to ", VarType, " variable \"", Attrs.Name, "[", BindPt-Attrs.BindPoint, "]\" in shader \"", GetShaderName(), "\"" ) \ -} + LOG_ERROR_MESSAGE( "No resource is bound to ", VarType, " variable \"", Attrs.Name, "[", BindPt-Attrs.BindPoint, "]\" in shader \"", GetShaderName(), "\"" );\ +}while(false) m_pResourceCache->dbgVerifyCacheConsistency(); @@ -777,7 +777,7 @@ void ShaderResourceLayoutD3D11::dbgVerifyBindings()const for(auto BindPoint = cb.Attribs.BindPoint; BindPoint < cb.Attribs.BindPoint + cb.Attribs.BindCount; ++BindPoint) { if( !m_pResourceCache->IsCBBound(BindPoint) ) - LOG_MISSING_BINDING("constant buffer", cb.Attribs, BindPoint) + LOG_MISSING_BINDING("constant buffer", cb.Attribs, BindPoint); } }, @@ -786,14 +786,14 @@ void ShaderResourceLayoutD3D11::dbgVerifyBindings()const for(auto BindPoint = ts.Attribs.BindPoint; BindPoint < ts.Attribs.BindPoint + ts.Attribs.BindCount; ++BindPoint) { if( !m_pResourceCache->IsSRVBound(BindPoint, true) ) - LOG_MISSING_BINDING("texture", ts.Attribs, BindPoint) + LOG_MISSING_BINDING("texture", ts.Attribs, BindPoint); if( ts.SamplerAttribs.IsValidBindPoint() ) { VERIFY_EXPR(ts.SamplerAttribs.BindCount == ts.Attribs.BindCount || ts.SamplerAttribs.BindCount == 1); auto SamBindPoint = ts.SamplerAttribs.BindPoint + ((ts.SamplerAttribs.BindCount == 1) ? 0 : (BindPoint - ts.Attribs.BindPoint) ); if(!m_pResourceCache->IsSamplerBound(SamBindPoint) ) - LOG_MISSING_BINDING("sampler", ts.SamplerAttribs, SamBindPoint) + LOG_MISSING_BINDING("sampler", ts.SamplerAttribs, SamBindPoint); // Verify that if single sampler is used for all texture array elements, all samplers set in the resource views are consistent if (ts.Attribs.BindCount > 1 && ts.SamplerAttribs.BindCount == 1) @@ -814,7 +814,7 @@ void ShaderResourceLayoutD3D11::dbgVerifyBindings()const auto *pTexView = ValidatedCast<ITextureView>(CachedResource.pView.RawPtr()); auto *pSampler = pTexView->GetSampler(); if(pSampler != nullptr && pSampler != Sampler.pSampler.RawPtr()) - LOG_ERROR_MESSAGE( "All elements of texture array \"", ts.Attribs.Name, "\" in shader \"", GetShaderName(), "\" share the same sampler. However, the sampler set in view for element ", BindPoint - ts.Attribs.BindPoint, " does not match bound sampler. This may cause incorrect behavior on GL platform." ) + LOG_ERROR_MESSAGE( "All elements of texture array \"", ts.Attribs.Name, "\" in shader \"", GetShaderName(), "\" share the same sampler. However, the sampler set in view for element ", BindPoint - ts.Attribs.BindPoint, " does not match bound sampler. This may cause incorrect behavior on GL platform." ); } } } @@ -826,7 +826,7 @@ void ShaderResourceLayoutD3D11::dbgVerifyBindings()const for(auto BindPoint = uav.Attribs.BindPoint; BindPoint < uav.Attribs.BindPoint + uav.Attribs.BindCount; ++BindPoint) { if( !m_pResourceCache->IsUAVBound(BindPoint, true) ) - LOG_MISSING_BINDING("texture UAV", uav.Attribs, BindPoint) + LOG_MISSING_BINDING("texture UAV", uav.Attribs, BindPoint); } }, @@ -835,7 +835,7 @@ void ShaderResourceLayoutD3D11::dbgVerifyBindings()const for(auto BindPoint = buf.Attribs.BindPoint; BindPoint < buf.Attribs.BindPoint + buf.Attribs.BindCount; ++BindPoint) { if( !m_pResourceCache->IsSRVBound(BindPoint, false) ) - LOG_MISSING_BINDING("buffer", buf.Attribs, BindPoint) + LOG_MISSING_BINDING("buffer", buf.Attribs, BindPoint); } }, @@ -844,7 +844,7 @@ void ShaderResourceLayoutD3D11::dbgVerifyBindings()const for(auto BindPoint = uav.Attribs.BindPoint; BindPoint < uav.Attribs.BindPoint + uav.Attribs.BindCount; ++BindPoint) { if( !m_pResourceCache->IsUAVBound(BindPoint, false) ) - LOG_MISSING_BINDING("buffer UAV", uav.Attribs, BindPoint) + LOG_MISSING_BINDING("buffer UAV", uav.Attribs, BindPoint); } } ); diff --git a/Graphics/GraphicsEngineD3D11/src/ShaderResourcesD3D11.cpp b/Graphics/GraphicsEngineD3D11/src/ShaderResourcesD3D11.cpp index e759e78a..f593aa36 100644 --- a/Graphics/GraphicsEngineD3D11/src/ShaderResourcesD3D11.cpp +++ b/Graphics/GraphicsEngineD3D11/src/ShaderResourcesD3D11.cpp @@ -50,7 +50,7 @@ ShaderResourcesD3D11::ShaderResourcesD3D11(RenderDeviceD3D11Impl *pDeviceD3D11Im [&](D3DShaderResourceAttribs&& CBAttribs) { - VERIFY( CBAttribs.BindPoint + CBAttribs.BindCount-1 <= MaxAllowedBindPoint, "CB bind point exceeds supported range" ) + VERIFY( CBAttribs.BindPoint + CBAttribs.BindCount-1 <= MaxAllowedBindPoint, "CB bind point exceeds supported range" ); m_MaxCBBindPoint = std::max(m_MaxCBBindPoint, static_cast<MaxBindPointType>(CBAttribs.BindPoint + CBAttribs.BindCount-1)); new (&GetCB(CurrCB++)) D3DShaderResourceAttribs(std::move(CBAttribs)); @@ -58,7 +58,7 @@ ShaderResourcesD3D11::ShaderResourcesD3D11(RenderDeviceD3D11Impl *pDeviceD3D11Im [&](D3DShaderResourceAttribs &&TexUAV) { - VERIFY( TexUAV.BindPoint + TexUAV.BindCount-1 <= MaxAllowedBindPoint, "Tex UAV bind point exceeds supported range" ) + VERIFY( TexUAV.BindPoint + TexUAV.BindCount-1 <= MaxAllowedBindPoint, "Tex UAV bind point exceeds supported range" ); m_MaxUAVBindPoint = std::max(m_MaxUAVBindPoint, static_cast<MaxBindPointType>(TexUAV.BindPoint + TexUAV.BindCount-1)); new (&GetTexUAV(CurrTexUAV++)) D3DShaderResourceAttribs( std::move(TexUAV) ); @@ -66,7 +66,7 @@ ShaderResourcesD3D11::ShaderResourcesD3D11(RenderDeviceD3D11Impl *pDeviceD3D11Im [&](D3DShaderResourceAttribs &&BuffUAV) { - VERIFY( BuffUAV.BindPoint + BuffUAV.BindCount-1 <= MaxAllowedBindPoint, "Buff UAV bind point exceeds supported range" ) + VERIFY( BuffUAV.BindPoint + BuffUAV.BindCount-1 <= MaxAllowedBindPoint, "Buff UAV bind point exceeds supported range" ); m_MaxUAVBindPoint = std::max(m_MaxUAVBindPoint, static_cast<MaxBindPointType>(BuffUAV.BindPoint + BuffUAV.BindCount-1)); new (&GetBufUAV(CurrBufUAV++)) D3DShaderResourceAttribs( std::move(BuffUAV) ); @@ -74,7 +74,7 @@ ShaderResourcesD3D11::ShaderResourcesD3D11(RenderDeviceD3D11Impl *pDeviceD3D11Im [&](D3DShaderResourceAttribs &&BuffSRV) { - VERIFY( BuffSRV.BindPoint + BuffSRV.BindCount-1 <= MaxAllowedBindPoint, "Buff SRV bind point exceeds supported range" ) + VERIFY( BuffSRV.BindPoint + BuffSRV.BindCount-1 <= MaxAllowedBindPoint, "Buff SRV bind point exceeds supported range" ); m_MaxSRVBindPoint = std::max(m_MaxSRVBindPoint, static_cast<MaxBindPointType>(BuffSRV.BindPoint + BuffSRV.BindCount-1)); new (&GetBufSRV(CurrBufSRV++)) D3DShaderResourceAttribs( std::move(BuffSRV) ); @@ -82,7 +82,7 @@ ShaderResourcesD3D11::ShaderResourcesD3D11(RenderDeviceD3D11Impl *pDeviceD3D11Im [&](D3DShaderResourceAttribs &&SamplerAttribs) { - VERIFY( SamplerAttribs.BindPoint + SamplerAttribs.BindCount-1 <= MaxAllowedBindPoint, "Sampler bind point exceeds supported range" ) + 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; @@ -93,7 +93,7 @@ ShaderResourcesD3D11::ShaderResourcesD3D11(RenderDeviceD3D11Impl *pDeviceD3D11Im { VERIFY(CurrSampler == GetNumSamplers(), "All samplers must be initialized before texture SRVs" ); - VERIFY( TexAttribs.BindPoint + TexAttribs.BindCount-1 <= MaxAllowedBindPoint, "Tex SRV bind point exceeds supported range" ) + VERIFY( TexAttribs.BindPoint + TexAttribs.BindCount-1 <= MaxAllowedBindPoint, "Tex SRV bind point exceeds supported range" ); m_MaxSRVBindPoint = std::max(m_MaxSRVBindPoint, static_cast<MaxBindPointType>(TexAttribs.BindPoint + TexAttribs.BindCount-1)); auto SamplerId = FindAssignedSamplerId(TexAttribs); @@ -138,7 +138,7 @@ ShaderResourcesD3D11::ShaderResourcesD3D11(RenderDeviceD3D11Impl *pDeviceD3D11Im break; } } - VERIFY(ssd < ShdrDesc.NumStaticSamplers, "Static sampler was not found!") + VERIFY(ssd < ShdrDesc.NumStaticSamplers, "Static sampler was not found!"); } } VERIFY_EXPR(CurrStaticSam == m_NumStaticSamplers); @@ -167,7 +167,7 @@ void ShaderResourcesD3D11::InitStaticSamplers(ShaderResourceCacheD3D11 &Resource #ifdef VERIFY_SHADER_BINDINGS static String DbgMakeResourceName(const D3DShaderResourceAttribs &Attr, Uint32 BindPoint) { - VERIFY( BindPoint >= (Uint32)Attr.BindPoint && BindPoint < (Uint32)Attr.BindPoint + Attr.BindCount, "Bind point is out of allowed range") + VERIFY( BindPoint >= (Uint32)Attr.BindPoint && BindPoint < (Uint32)Attr.BindPoint + Attr.BindCount, "Bind point is out of allowed range"); if(Attr.BindCount == 1) return Attr.Name; else diff --git a/Graphics/GraphicsEngineD3D11/src/TextureBaseD3D11.cpp b/Graphics/GraphicsEngineD3D11/src/TextureBaseD3D11.cpp index 79706138..68a256a4 100644 --- a/Graphics/GraphicsEngineD3D11/src/TextureBaseD3D11.cpp +++ b/Graphics/GraphicsEngineD3D11/src/TextureBaseD3D11.cpp @@ -112,7 +112,7 @@ void TextureBaseD3D11::CreateViewInternal( const struct TextureViewDesc &ViewDes catch( const std::runtime_error & ) { const auto *ViewTypeName = GetTexViewTypeLiteralName(ViewDesc.ViewType); - LOG_ERROR("Failed to create view \"", ViewDesc.Name ? ViewDesc.Name : "", "\" (", ViewTypeName, ") for texture \"", m_Desc.Name ? m_Desc.Name : "", "\"" ) + LOG_ERROR("Failed to create view \"", ViewDesc.Name ? ViewDesc.Name : "", "\" (", ViewTypeName, ") for texture \"", m_Desc.Name ? m_Desc.Name : "", "\"" ); } } |
