diff --git a/src/dxvk/dxvk_constant_state.h b/src/dxvk/dxvk_constant_state.h index 70e76e1e5..8ca573d0d 100644 --- a/src/dxvk/dxvk_constant_state.h +++ b/src/dxvk/dxvk_constant_state.h @@ -16,6 +16,16 @@ namespace dxvk { */ struct DxvkBlendConstants { float r, g, b, a; + + bool operator == (const DxvkBlendConstants& other) const { + return this->r == other.r && this->g == other.g + && this->b == other.b && this->a == other.a; + } + + bool operator != (const DxvkBlendConstants& other) const { + return this->r != other.r || this->g != other.g + || this->b != other.b || this->a != other.a; + } }; diff --git a/src/dxvk/dxvk_context.cpp b/src/dxvk/dxvk_context.cpp index 86b74fa74..4b4dc9c66 100644 --- a/src/dxvk/dxvk_context.cpp +++ b/src/dxvk/dxvk_context.cpp @@ -1406,15 +1406,19 @@ namespace dxvk { void DxvkContext::setBlendConstants( const DxvkBlendConstants& blendConstants) { - m_state.om.blendConstants = blendConstants; - m_flags.set(DxvkContextFlag::GpDirtyBlendConstants); + if (m_state.om.blendConstants != blendConstants) { + m_state.om.blendConstants = blendConstants; + m_flags.set(DxvkContextFlag::GpDirtyBlendConstants); + } } void DxvkContext::setStencilReference( const uint32_t reference) { - m_state.om.stencilReference = reference; - m_flags.set(DxvkContextFlag::GpDirtyStencilRef); + if (m_state.om.stencilReference != reference) { + m_state.om.stencilReference = reference; + m_flags.set(DxvkContextFlag::GpDirtyStencilRef); + } }