1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-31 14:52:11 +01:00

[dxvk] Update blend constants only when they have actually changed

Reduces number of redundant state changes in Resonance of Fate.
This commit is contained in:
Philip Rebohle 2018-10-22 15:35:56 +02:00
parent 035fe3e30b
commit db2880acfd
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
2 changed files with 18 additions and 4 deletions

View File

@ -16,6 +16,16 @@ namespace dxvk {
*/ */
struct DxvkBlendConstants { struct DxvkBlendConstants {
float r, g, b, a; 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;
}
}; };

View File

@ -1406,16 +1406,20 @@ namespace dxvk {
void DxvkContext::setBlendConstants( void DxvkContext::setBlendConstants(
const DxvkBlendConstants& blendConstants) { const DxvkBlendConstants& blendConstants) {
if (m_state.om.blendConstants != blendConstants) {
m_state.om.blendConstants = blendConstants; m_state.om.blendConstants = blendConstants;
m_flags.set(DxvkContextFlag::GpDirtyBlendConstants); m_flags.set(DxvkContextFlag::GpDirtyBlendConstants);
} }
}
void DxvkContext::setStencilReference( void DxvkContext::setStencilReference(
const uint32_t reference) { const uint32_t reference) {
if (m_state.om.stencilReference != reference) {
m_state.om.stencilReference = reference; m_state.om.stencilReference = reference;
m_flags.set(DxvkContextFlag::GpDirtyStencilRef); m_flags.set(DxvkContextFlag::GpDirtyStencilRef);
} }
}
void DxvkContext::setInputAssemblyState(const DxvkInputAssemblyState& ia) { void DxvkContext::setInputAssemblyState(const DxvkInputAssemblyState& ia) {