From b3fec8bd40e80115086281bce74774617aa95e23 Mon Sep 17 00:00:00 2001 From: assiduous Date: Wed, 14 Oct 2020 01:04:05 -0700 Subject: Added buffer mode validation when binding buffer views --- Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Graphics/GraphicsEngineD3D11') diff --git a/Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp b/Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp index fd6c7299..63b34f44 100755 --- a/Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp +++ b/Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp @@ -553,6 +553,7 @@ void ShaderResourceLayoutD3D11::BuffSRVBindInfo::BindResource(IDeviceObject* pVi { auto& CachedSRV = ResourceCache.GetSRV(m_Attribs.BindPoint + ArrayIndex); VerifyResourceViewBinding(m_Attribs, GetType(), ArrayIndex, pView, pViewD3D11.RawPtr(), {BUFFER_VIEW_SHADER_RESOURCE}, CachedSRV.pView.RawPtr(), m_ParentResLayout.GetShaderName()); + VerifyBufferViewModeD3D(pViewD3D11.RawPtr(), m_Attribs, m_ParentResLayout.GetShaderName()); } #endif ResourceCache.SetBufSRV(m_Attribs.BindPoint + ArrayIndex, std::move(pViewD3D11)); @@ -593,6 +594,7 @@ void ShaderResourceLayoutD3D11::BuffUAVBindInfo::BindResource(IDeviceObject* pVi { auto& CachedUAV = ResourceCache.GetUAV(m_Attribs.BindPoint + ArrayIndex); VerifyResourceViewBinding(m_Attribs, GetType(), ArrayIndex, pView, pViewD3D11.RawPtr(), {BUFFER_VIEW_UNORDERED_ACCESS}, CachedUAV.pView.RawPtr(), m_ParentResLayout.GetShaderName()); + VerifyBufferViewModeD3D(pViewD3D11.RawPtr(), m_Attribs, m_ParentResLayout.GetShaderName()); } #endif ResourceCache.SetBufUAV(m_Attribs.BindPoint + ArrayIndex, std::move(pViewD3D11)); -- cgit v1.2.3 From e7b18160a758b30dd6b701b4aa6f43c9c2061ccf Mon Sep 17 00:00:00 2001 From: assiduous Date: Sat, 17 Oct 2020 09:56:34 -0700 Subject: All backends: added resource dimension validation when setting shader variables --- .../src/ShaderResourceLayoutD3D11.cpp | 24 +++++++++++++--------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'Graphics/GraphicsEngineD3D11') diff --git a/Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp b/Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp index 63b34f44..723e190a 100755 --- a/Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp +++ b/Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp @@ -429,7 +429,7 @@ void ShaderResourceLayoutD3D11::ConstBuffBindInfo::BindResource(IDeviceObject* p // We cannot use ValidatedCast<> here as the resource retrieved from the // resource mapping can be of wrong type - RefCntAutoPtr pBuffD3D11Impl(pBuffer, IID_BufferD3D11); + RefCntAutoPtr pBuffD3D11Impl{pBuffer, IID_BufferD3D11}; #ifdef DILIGENT_DEVELOPMENT { auto& CachedCB = m_ParentResLayout.m_ResourceCache.GetCB(m_Attribs.BindPoint + ArrayIndex); @@ -448,11 +448,12 @@ void ShaderResourceLayoutD3D11::TexSRVBindInfo::BindResource(IDeviceObject* pVie // We cannot use ValidatedCast<> here as the resource retrieved from the // resource mapping can be of wrong type - RefCntAutoPtr pViewD3D11(pView, IID_TextureViewD3D11); + RefCntAutoPtr pViewD3D11{pView, IID_TextureViewD3D11}; #ifdef DILIGENT_DEVELOPMENT { auto& CachedSRV = ResourceCache.GetSRV(m_Attribs.BindPoint + ArrayIndex); - VerifyResourceViewBinding(m_Attribs, GetType(), ArrayIndex, pView, pViewD3D11.RawPtr(), {TEXTURE_VIEW_SHADER_RESOURCE}, CachedSRV.pView.RawPtr(), m_ParentResLayout.GetShaderName()); + VerifyResourceViewBinding(m_Attribs, GetType(), ArrayIndex, pView, pViewD3D11.RawPtr(), {TEXTURE_VIEW_SHADER_RESOURCE}, + CachedSRV.pView.RawPtr(), m_ParentResLayout.GetShaderName()); } #endif @@ -505,7 +506,7 @@ void ShaderResourceLayoutD3D11::SamplerBindInfo::BindResource(IDeviceObject* pSa // We cannot use ValidatedCast<> here as the resource retrieved from the // resource mapping can be of wrong type - RefCntAutoPtr pSamplerD3D11(pSampler, IID_SamplerD3D11); + RefCntAutoPtr pSamplerD3D11{pSampler, IID_SamplerD3D11}; #ifdef DILIGENT_DEVELOPMENT if (pSampler && !pSamplerD3D11) @@ -548,11 +549,12 @@ void ShaderResourceLayoutD3D11::BuffSRVBindInfo::BindResource(IDeviceObject* pVi // We cannot use ValidatedCast<> here as the resource retrieved from the // resource mapping can be of wrong type - RefCntAutoPtr pViewD3D11(pView, IID_BufferViewD3D11); + RefCntAutoPtr pViewD3D11{pView, IID_BufferViewD3D11}; #ifdef DILIGENT_DEVELOPMENT { auto& CachedSRV = ResourceCache.GetSRV(m_Attribs.BindPoint + ArrayIndex); - VerifyResourceViewBinding(m_Attribs, GetType(), ArrayIndex, pView, pViewD3D11.RawPtr(), {BUFFER_VIEW_SHADER_RESOURCE}, CachedSRV.pView.RawPtr(), m_ParentResLayout.GetShaderName()); + VerifyResourceViewBinding(m_Attribs, GetType(), ArrayIndex, pView, pViewD3D11.RawPtr(), {BUFFER_VIEW_SHADER_RESOURCE}, + CachedSRV.pView.RawPtr(), m_ParentResLayout.GetShaderName()); VerifyBufferViewModeD3D(pViewD3D11.RawPtr(), m_Attribs, m_ParentResLayout.GetShaderName()); } #endif @@ -569,11 +571,12 @@ void ShaderResourceLayoutD3D11::TexUAVBindInfo::BindResource(IDeviceObject* pVie // We cannot use ValidatedCast<> here as the resource retrieved from the // resource mapping can be of wrong type - RefCntAutoPtr pViewD3D11(pView, IID_TextureViewD3D11); + RefCntAutoPtr pViewD3D11{pView, IID_TextureViewD3D11}; #ifdef DILIGENT_DEVELOPMENT { auto& CachedUAV = ResourceCache.GetUAV(m_Attribs.BindPoint + ArrayIndex); - VerifyResourceViewBinding(m_Attribs, GetType(), ArrayIndex, pView, pViewD3D11.RawPtr(), {TEXTURE_VIEW_UNORDERED_ACCESS}, CachedUAV.pView.RawPtr(), m_ParentResLayout.GetShaderName()); + VerifyResourceViewBinding(m_Attribs, GetType(), ArrayIndex, pView, pViewD3D11.RawPtr(), {TEXTURE_VIEW_UNORDERED_ACCESS}, + CachedUAV.pView.RawPtr(), m_ParentResLayout.GetShaderName()); } #endif ResourceCache.SetTexUAV(m_Attribs.BindPoint + ArrayIndex, std::move(pViewD3D11)); @@ -589,11 +592,12 @@ void ShaderResourceLayoutD3D11::BuffUAVBindInfo::BindResource(IDeviceObject* pVi // We cannot use ValidatedCast<> here as the resource retrieved from the // resource mapping can be of wrong type - RefCntAutoPtr pViewD3D11(pView, IID_BufferViewD3D11); + RefCntAutoPtr pViewD3D11{pView, IID_BufferViewD3D11}; #ifdef DILIGENT_DEVELOPMENT { auto& CachedUAV = ResourceCache.GetUAV(m_Attribs.BindPoint + ArrayIndex); - VerifyResourceViewBinding(m_Attribs, GetType(), ArrayIndex, pView, pViewD3D11.RawPtr(), {BUFFER_VIEW_UNORDERED_ACCESS}, CachedUAV.pView.RawPtr(), m_ParentResLayout.GetShaderName()); + VerifyResourceViewBinding(m_Attribs, GetType(), ArrayIndex, pView, pViewD3D11.RawPtr(), {BUFFER_VIEW_UNORDERED_ACCESS}, + CachedUAV.pView.RawPtr(), m_ParentResLayout.GetShaderName()); VerifyBufferViewModeD3D(pViewD3D11.RawPtr(), m_Attribs, m_ParentResLayout.GetShaderName()); } #endif -- cgit v1.2.3