From c11f7e3a5fcbd6c28c2d29309d92f08051d3fe28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Thu, 2 Feb 2023 16:12:28 +0100 Subject: [PATCH] Fix texture alpha when texturing from full-alpha textures. Fixes #16875 --- GPU/Common/ShaderUniforms.cpp | 6 +++++- GPU/GPUState.h | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/GPU/Common/ShaderUniforms.cpp b/GPU/Common/ShaderUniforms.cpp index 2d5211fc27..8cfa0c3c55 100644 --- a/GPU/Common/ShaderUniforms.cpp +++ b/GPU/Common/ShaderUniforms.cpp @@ -199,7 +199,11 @@ void BaseUpdateUniforms(UB_VS_FS_Base *ub, uint64_t dirtyUniforms, bool flipView } if (dirtyUniforms & DIRTY_TEX_ALPHA_MUL) { - ub->texNoAlpha = gstate.isTextureAlphaUsed() ? 0.0f : 1.0f; + bool doTextureAlpha = gstate.isTextureAlphaUsed(); + if (gstate_c.textureFullAlpha && gstate.getTextureFunction() != GE_TEXFUNC_REPLACE) { + doTextureAlpha = false; + } + ub->texNoAlpha = doTextureAlpha ? 0.0f : 1.0f; ub->texMul = gstate.isColorDoublingEnabled() ? 2.0f : 1.0f; } diff --git a/GPU/GPUState.h b/GPU/GPUState.h index 3c3002a337..839f52f181 100644 --- a/GPU/GPUState.h +++ b/GPU/GPUState.h @@ -549,7 +549,7 @@ struct GPUStateCache { void SetTextureFullAlpha(bool fullAlpha) { if (fullAlpha != textureFullAlpha) { textureFullAlpha = fullAlpha; - Dirty(DIRTY_FRAGMENTSHADER_STATE); + Dirty(DIRTY_FRAGMENTSHADER_STATE | DIRTY_TEX_ALPHA_MUL); } } void SetNeedShaderTexclamp(bool need) {