summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngine
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2021-03-18 22:05:18 +0000
committerassiduous <assiduous@diligentgraphics.com>2021-03-19 00:38:25 +0000
commitef1e1c02e4f44b3a37c6bb683090b4f661aadcdc (patch)
treeab1bc97327e4596d9486fb42f3e96474edc90097 /Graphics/GraphicsEngine
parentFew updates to PipelineStateD3D11Impl (diff)
downloadDiligentCore-ef1e1c02e4f44b3a37c6bb683090b4f661aadcdc.tar.gz
DiligentCore-ef1e1c02e4f44b3a37c6bb683090b4f661aadcdc.zip
Removed duplicate code from unbinding incompatible signatures logic in D3D11, GL and Vk
Diffstat (limited to 'Graphics/GraphicsEngine')
-rw-r--r--Graphics/GraphicsEngine/include/DeviceContextBase.hpp55
1 files changed, 43 insertions, 12 deletions
diff --git a/Graphics/GraphicsEngine/include/DeviceContextBase.hpp b/Graphics/GraphicsEngine/include/DeviceContextBase.hpp
index 769f8f01..1e791845 100644
--- a/Graphics/GraphicsEngine/include/DeviceContextBase.hpp
+++ b/Graphics/GraphicsEngine/include/DeviceContextBase.hpp
@@ -105,18 +105,19 @@ template <typename EngineImplTraits>
class DeviceContextBase : public ObjectBase<typename EngineImplTraits::DeviceContextInterface>
{
public:
- using BaseInterface = typename EngineImplTraits::DeviceContextInterface;
- using TObjectBase = ObjectBase<BaseInterface>;
- using DeviceImplType = typename EngineImplTraits::RenderDeviceImplType;
- using BufferImplType = typename EngineImplTraits::BufferImplType;
- using TextureImplType = typename EngineImplTraits::TextureImplType;
- using PipelineStateImplType = typename EngineImplTraits::PipelineStateImplType;
- using TextureViewImplType = typename EngineImplTraits::TextureViewImplType;
- using QueryImplType = typename EngineImplTraits::QueryImplType;
- using FramebufferImplType = typename EngineImplTraits::FramebufferImplType;
- using RenderPassImplType = typename EngineImplTraits::RenderPassImplType;
- using BottomLevelASType = typename EngineImplTraits::BottomLevelASImplType;
- using TopLevelASType = typename EngineImplTraits::TopLevelASImplType;
+ using BaseInterface = typename EngineImplTraits::DeviceContextInterface;
+ using TObjectBase = ObjectBase<BaseInterface>;
+ using DeviceImplType = typename EngineImplTraits::RenderDeviceImplType;
+ using BufferImplType = typename EngineImplTraits::BufferImplType;
+ using TextureImplType = typename EngineImplTraits::TextureImplType;
+ using PipelineStateImplType = typename EngineImplTraits::PipelineStateImplType;
+ using ShaderResourceBindingImplType = typename EngineImplTraits::ShaderResourceBindingImplType;
+ using TextureViewImplType = typename EngineImplTraits::TextureViewImplType;
+ using QueryImplType = typename EngineImplTraits::QueryImplType;
+ using FramebufferImplType = typename EngineImplTraits::FramebufferImplType;
+ using RenderPassImplType = typename EngineImplTraits::RenderPassImplType;
+ using BottomLevelASType = typename EngineImplTraits::BottomLevelASImplType;
+ using TopLevelASType = typename EngineImplTraits::TopLevelASImplType;
/// \param pRefCounters - Reference counters object that controls the lifetime of this device context.
/// \param pRenderDevice - Render device.
@@ -311,6 +312,8 @@ protected:
bool DvpVerifyBufferState (const BufferImplType& Buffer, RESOURCE_STATE RequiredState, const char* OperationName) const;
bool DvpVerifyBLASState (const BottomLevelASType& BLAS, RESOURCE_STATE RequiredState, const char* OperationName) const;
bool DvpVerifyTLASState (const TopLevelASType& TLAS, RESOURCE_STATE RequiredState, const char* OperationName) const;
+
+ Uint32 DvpGetCompatibleSignatureCount(ShaderResourceBindingImplType* pBoundSRBs[])const;
#else
bool DvpVerifyDrawArguments (const DrawAttribs& Attribs)const {return true;}
bool DvpVerifyDrawIndexedArguments (const DrawIndexedAttribs& Attribs)const {return true;}
@@ -2121,6 +2124,34 @@ bool DeviceContextBase<ImplementationTraits>::DvpVerifyTLASState(
return true;
}
+template <typename ImplementationTraits>
+Uint32 DeviceContextBase<ImplementationTraits>::DvpGetCompatibleSignatureCount(ShaderResourceBindingImplType* pBoundSRBs[]) const
+{
+ VERIFY_EXPR(m_pPipelineState);
+ const auto SignCount = m_pPipelineState->GetResourceSignatureCount();
+
+ Uint32 sign = 0;
+ for (; sign < SignCount; ++sign)
+ {
+ const auto* pPSOSign = m_pPipelineState->GetResourceSignature(sign);
+ const auto* pSRBSign = pBoundSRBs[sign] != nullptr ? pBoundSRBs[sign]->GetSignature() : nullptr;
+
+ if ((pPSOSign == nullptr || pPSOSign->IsEmpty()) != (pSRBSign == nullptr || pSRBSign->IsEmpty()))
+ {
+ // One signature is null or empty while the other is not - SRB is not compatible with the PSO.
+ break;
+ }
+
+ if (pPSOSign != nullptr && pSRBSign != nullptr && pPSOSign->IsIncompatibleWith(*pSRBSign))
+ {
+ // Signatures are incompatible
+ break;
+ }
+ }
+
+ return sign;
+}
+
#endif // DILIGENT_DEVELOPMENT
} // namespace Diligent