diff options
| author | assiduous <assiduous@diligentgraphics.com> | 2021-03-11 06:32:11 +0000 |
|---|---|---|
| committer | assiduous <assiduous@diligentgraphics.com> | 2021-03-19 00:38:20 +0000 |
| commit | 38f83aa2cd042316751717cadda1f490b3e25e09 (patch) | |
| tree | bf641a4bd98329470cc7685680e5afdb69f95329 /Graphics/GraphicsEngineD3D12 | |
| parent | Moved duplicate shader variable functionality to ShaderVariableBase (diff) | |
| download | DiligentCore-38f83aa2cd042316751717cadda1f490b3e25e09.tar.gz DiligentCore-38f83aa2cd042316751717cadda1f490b3e25e09.zip | |
Moved duplicate buffer mode validation logic to ShaderResourceVariableBase.hpp
Diffstat (limited to 'Graphics/GraphicsEngineD3D12')
| -rw-r--r-- | Graphics/GraphicsEngineD3D12/src/ShaderVariableManagerD3D12.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/Graphics/GraphicsEngineD3D12/src/ShaderVariableManagerD3D12.cpp b/Graphics/GraphicsEngineD3D12/src/ShaderVariableManagerD3D12.cpp index 2d335863..a9fc128c 100644 --- a/Graphics/GraphicsEngineD3D12/src/ShaderVariableManagerD3D12.cpp +++ b/Graphics/GraphicsEngineD3D12/src/ShaderVariableManagerD3D12.cpp @@ -328,8 +328,7 @@ void BindResourceHelper::CacheCB(IDeviceObject* pBuffer) const // resource mapping can be of wrong type RefCntAutoPtr<BufferD3D12Impl> pBuffD3D12{pBuffer, IID_BufferD3D12}; #ifdef DILIGENT_DEVELOPMENT - VerifyConstantBufferBinding(m_ResDesc.Name, m_ResDesc.ArraySize, m_ResDesc.VarType, m_ResDesc.Flags, m_ArrayIndex, - pBuffer, pBuffD3D12.RawPtr(), m_DstRes.pObject.RawPtr()); + VerifyConstantBufferBinding(m_ResDesc, m_ArrayIndex, pBuffer, pBuffD3D12.RawPtr(), m_DstRes.pObject.RawPtr()); if (m_ResDesc.ArraySize != 1 && pBuffD3D12 && pBuffD3D12->GetDesc().Usage == USAGE_DYNAMIC && pBuffD3D12->GetD3D12Resource() == nullptr) { LOG_ERROR_MESSAGE("Attempting to bind dynamic buffer '", pBuffD3D12->GetDesc().Name, "' that doesn't have backing d3d12 resource to array variable '", m_ResDesc.Name, @@ -420,7 +419,9 @@ struct ResourceViewTraits<TextureViewD3D12Impl> { static const INTERFACE_ID& IID; - static bool VerifyView(const TextureViewD3D12Impl* pViewD3D12, const PipelineResourceDesc& ResDesc) + static constexpr RESOURCE_DIMENSION ExpectedResDimension = RESOURCE_DIM_UNDEFINED; + + static bool VerifyView(const TextureViewD3D12Impl* pViewD3D12, const PipelineResourceDesc& ResDesc, Uint32 ArrayIndex) { return true; } @@ -432,7 +433,9 @@ struct ResourceViewTraits<BufferViewD3D12Impl> { static const INTERFACE_ID& IID; - static bool VerifyView(const BufferViewD3D12Impl* pViewD3D12, const PipelineResourceDesc& ResDesc) + static constexpr RESOURCE_DIMENSION ExpectedResDimension = RESOURCE_DIM_BUFFER; + + static bool VerifyView(const BufferViewD3D12Impl* pViewD3D12, const PipelineResourceDesc& ResDesc, Uint32 ArrayIndex) { if (pViewD3D12 != nullptr) { @@ -443,6 +446,8 @@ struct ResourceViewTraits<BufferViewD3D12Impl> "[", ResDesc.ArraySize, "]', which is currently not supported in Direct3D12 backend. Either use non-array variable, or bind non-dynamic buffer."); return false; } + + ValidateBufferMode(ResDesc, ArrayIndex, pViewD3D12); } return true; @@ -450,7 +455,6 @@ struct ResourceViewTraits<BufferViewD3D12Impl> }; const INTERFACE_ID& ResourceViewTraits<BufferViewD3D12Impl>::IID = IID_BufferViewD3D12; - template <typename TResourceViewType, typename TViewTypeEnum> void BindResourceHelper::CacheResourceView(IDeviceObject* pView, @@ -460,12 +464,13 @@ void BindResourceHelper::CacheResourceView(IDeviceObject* pView, // resource mapping can be of wrong type RefCntAutoPtr<TResourceViewType> pViewD3D12{pView, ResourceViewTraits<TResourceViewType>::IID}; #ifdef DILIGENT_DEVELOPMENT - VerifyResourceViewBinding(m_ResDesc.Name, m_ResDesc.ArraySize, m_ResDesc.VarType, m_ArrayIndex, + VerifyResourceViewBinding(m_ResDesc, m_ArrayIndex, pView, pViewD3D12.RawPtr(), - {dbgExpectedViewType}, RESOURCE_DIM_UNDEFINED, + {dbgExpectedViewType}, + ResourceViewTraits<TResourceViewType>::ExpectedResDimension, false, // IsMultisample m_DstRes.pObject.RawPtr()); - ResourceViewTraits<TResourceViewType>::VerifyView(pViewD3D12, m_ResDesc); + ResourceViewTraits<TResourceViewType>::VerifyView(pViewD3D12, m_ResDesc, m_ArrayIndex); #endif if (pViewD3D12) { |
