From d35749bfc8d56dcf5862ef8f18e66b93886e71ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sat, 3 Sep 2022 23:32:01 +0200 Subject: [PATCH] Move the computation of simulate-logic shader type earlier --- GPU/Common/GPUStateUtils.cpp | 2 ++ GPU/Common/GPUStateUtils.h | 1 + GPU/Common/ShaderId.cpp | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/GPU/Common/GPUStateUtils.cpp b/GPU/Common/GPUStateUtils.cpp index 33548c2f5d..4cce911b59 100644 --- a/GPU/Common/GPUStateUtils.cpp +++ b/GPU/Common/GPUStateUtils.cpp @@ -1063,6 +1063,8 @@ void ConvertBlendState(GenericBlendState &blendState, bool forceReplaceBlend) { } blendState.replaceBlend = replaceBlend; + blendState.simulateLogicOpType = SimulateLogicOpShaderTypeIfNeeded(); + ReplaceAlphaType replaceAlphaWithStencil = ReplaceAlphaWithStencil(replaceBlend); blendState.replaceAlphaWithStencil = replaceAlphaWithStencil; diff --git a/GPU/Common/GPUStateUtils.h b/GPU/Common/GPUStateUtils.h index cfa5fb33fb..2d9fa62fae 100644 --- a/GPU/Common/GPUStateUtils.h +++ b/GPU/Common/GPUStateUtils.h @@ -146,6 +146,7 @@ struct GenericBlendState { // Shader generation state ReplaceAlphaType replaceAlphaWithStencil; ReplaceBlendType replaceBlend; + SimulateLogicOpType simulateLogicOpType; // Resulting hardware blend state bool blendEnabled; diff --git a/GPU/Common/ShaderId.cpp b/GPU/Common/ShaderId.cpp index 0c5ffd2d52..53176ebcba 100644 --- a/GPU/Common/ShaderId.cpp +++ b/GPU/Common/ShaderId.cpp @@ -267,7 +267,7 @@ void ComputeFragmentShaderID(FShaderID *id_out, const ComputedPipelineState &pip ReplaceBlendType replaceBlend = pipelineState.blendState.replaceBlend; ReplaceAlphaType stencilToAlpha = pipelineState.blendState.replaceAlphaWithStencil; - SimulateLogicOpType simulateLogicOpType = SimulateLogicOpShaderTypeIfNeeded(); + SimulateLogicOpType simulateLogicOpType = pipelineState.blendState.simulateLogicOpType; // All texfuncs except replace are the same for RGB as for RGBA with full alpha. // Note that checking this means that we must dirty the fragment shader ID whenever textureFullAlpha changes.