diff --git a/GPU/Common/TextureCacheCommon.cpp b/GPU/Common/TextureCacheCommon.cpp index c4620ce43c..2defddc876 100644 --- a/GPU/Common/TextureCacheCommon.cpp +++ b/GPU/Common/TextureCacheCommon.cpp @@ -1414,8 +1414,8 @@ void TextureCacheCommon::ApplyTexture() { ApplyTextureFramebuffer(entry, entry->framebuffer); } else { BindTexture(entry); - gstate_c.textureFullAlpha = entry->GetAlphaStatus() == TexCacheEntry::STATUS_ALPHA_FULL; - gstate_c.textureSimpleAlpha = entry->GetAlphaStatus() != TexCacheEntry::STATUS_ALPHA_UNKNOWN; + gstate_c.SetTextureFullAlpha(entry->GetAlphaStatus() == TexCacheEntry::STATUS_ALPHA_FULL); + gstate_c.SetTextureSimpleAlpha(entry->GetAlphaStatus() != TexCacheEntry::STATUS_ALPHA_UNKNOWN); } } diff --git a/GPU/D3D11/StateMappingD3D11.cpp b/GPU/D3D11/StateMappingD3D11.cpp index f525151951..679d8f0e03 100644 --- a/GPU/D3D11/StateMappingD3D11.cpp +++ b/GPU/D3D11/StateMappingD3D11.cpp @@ -139,7 +139,7 @@ void DrawEngineD3D11::ApplyDrawState(int prim) { // Blend { - gstate_c.allowShaderBlend = !g_Config.bDisableSlowFramebufEffects; + gstate_c.SetAllowShaderBlend(!g_Config.bDisableSlowFramebufEffects); if (gstate.isModeClear()) { keys_.blend.value = 0; // full wipe keys_.blend.blendEnable = false; @@ -159,7 +159,7 @@ void DrawEngineD3D11::ApplyDrawState(int prim) { } else { // Until next time, force it off. ResetShaderBlending(); - gstate_c.allowShaderBlend = false; + gstate_c.SetAllowShaderBlend(false); } } else if (blendState.resetShaderBlending) { ResetShaderBlending(); diff --git a/GPU/D3D11/TextureCacheD3D11.cpp b/GPU/D3D11/TextureCacheD3D11.cpp index 248d6abb96..bbde8dadb6 100644 --- a/GPU/D3D11/TextureCacheD3D11.cpp +++ b/GPU/D3D11/TextureCacheD3D11.cpp @@ -424,15 +424,15 @@ void TextureCacheD3D11::ApplyTextureFramebuffer(TexCacheEntry *entry, VirtualFra const u32 clutTotalColors = clutMaxBytes_ / bytesPerColor; TexCacheEntry::Status alphaStatus = CheckAlpha(clutBuf_, GetClutDestFormatD3D11(clutFormat), clutTotalColors, clutTotalColors, 1); - gstate_c.textureFullAlpha = alphaStatus == TexCacheEntry::STATUS_ALPHA_FULL; - gstate_c.textureSimpleAlpha = alphaStatus == TexCacheEntry::STATUS_ALPHA_SIMPLE; + gstate_c.SetTextureFullAlpha(alphaStatus == TexCacheEntry::STATUS_ALPHA_FULL); + gstate_c.SetTextureSimpleAlpha(alphaStatus == TexCacheEntry::STATUS_ALPHA_SIMPLE); } else { entry->status &= ~TexCacheEntry::STATUS_DEPALETTIZE; framebufferManagerD3D11_->BindFramebufferAsColorTexture(0, framebuffer, BINDFBCOLOR_MAY_COPY_WITH_UV | BINDFBCOLOR_APPLY_TEX_OFFSET); - gstate_c.textureFullAlpha = gstate.getTextureFormat() == GE_TFMT_5650; - gstate_c.textureSimpleAlpha = gstate_c.textureFullAlpha; + gstate_c.SetTextureFullAlpha(gstate.getTextureFormat() == GE_TFMT_5650); + gstate_c.SetTextureSimpleAlpha(gstate_c.textureFullAlpha); framebufferManagerD3D11_->RebindFramebuffer(); } SamplerCacheKey samplerKey; diff --git a/GPU/Directx9/StateMappingDX9.cpp b/GPU/Directx9/StateMappingDX9.cpp index 5130f3cf7d..8fbe20cc10 100644 --- a/GPU/Directx9/StateMappingDX9.cpp +++ b/GPU/Directx9/StateMappingDX9.cpp @@ -117,7 +117,7 @@ void DrawEngineDX9::ApplyDrawState(int prim) { { // Unfortunately, this isn't implemented yet. - gstate_c.allowShaderBlend = false; + gstate_c.SetAllowShaderBlend(false); if (gstate.isModeClear()) { dxstate.blend.disable(); @@ -137,7 +137,7 @@ void DrawEngineDX9::ApplyDrawState(int prim) { } else { // Until next time, force it off. ResetShaderBlending(); - gstate_c.allowShaderBlend = false; + gstate_c.SetAllowShaderBlend(false); } } else if (blendState.resetShaderBlending) { ResetShaderBlending(); diff --git a/GPU/Directx9/TextureCacheDX9.cpp b/GPU/Directx9/TextureCacheDX9.cpp index de76f9871b..2be99e4710 100644 --- a/GPU/Directx9/TextureCacheDX9.cpp +++ b/GPU/Directx9/TextureCacheDX9.cpp @@ -445,15 +445,15 @@ void TextureCacheDX9::ApplyTextureFramebuffer(TexCacheEntry *entry, VirtualFrame const u32 clutTotalColors = clutMaxBytes_ / bytesPerColor; TexCacheEntry::Status alphaStatus = CheckAlpha(clutBuf_, getClutDestFormat(clutFormat), clutTotalColors, clutTotalColors, 1); - gstate_c.textureFullAlpha = alphaStatus == TexCacheEntry::STATUS_ALPHA_FULL; - gstate_c.textureSimpleAlpha = alphaStatus == TexCacheEntry::STATUS_ALPHA_SIMPLE; + gstate_c.SetTextureFullAlpha(alphaStatus == TexCacheEntry::STATUS_ALPHA_FULL); + gstate_c.SetTextureSimpleAlpha(alphaStatus == TexCacheEntry::STATUS_ALPHA_SIMPLE); } else { entry->status &= ~TexCacheEntry::STATUS_DEPALETTIZE; framebufferManagerDX9_->BindFramebufferAsColorTexture(0, framebuffer, BINDFBCOLOR_MAY_COPY_WITH_UV | BINDFBCOLOR_APPLY_TEX_OFFSET); - gstate_c.textureFullAlpha = gstate.getTextureFormat() == GE_TFMT_5650; - gstate_c.textureSimpleAlpha = gstate_c.textureFullAlpha; + gstate_c.SetTextureFullAlpha(gstate.getTextureFormat() == GE_TFMT_5650); + gstate_c.SetTextureSimpleAlpha(gstate_c.textureFullAlpha); } framebufferManagerDX9_->RebindFramebuffer(); diff --git a/GPU/GLES/StateMappingGLES.cpp b/GPU/GLES/StateMappingGLES.cpp index c3929b4c87..36657bc6a9 100644 --- a/GPU/GLES/StateMappingGLES.cpp +++ b/GPU/GLES/StateMappingGLES.cpp @@ -159,7 +159,7 @@ void DrawEngineGLES::ApplyDrawState(int prim) { bool useBufferedRendering = g_Config.iRenderingMode != FB_NON_BUFFERED_MODE; { - gstate_c.allowShaderBlend = !g_Config.bDisableSlowFramebufEffects; + gstate_c.SetAllowShaderBlend(!g_Config.bDisableSlowFramebufEffects); if (gstate.isModeClear()) { glstate.blend.disable(); @@ -186,7 +186,7 @@ void DrawEngineGLES::ApplyDrawState(int prim) { } else { // Until next time, force it off. ResetShaderBlending(); - gstate_c.allowShaderBlend = false; + gstate_c.SetAllowShaderBlend(false); } } else if (blendState.resetShaderBlending) { ResetShaderBlending(); diff --git a/GPU/GLES/TextureCacheGLES.cpp b/GPU/GLES/TextureCacheGLES.cpp index 1133397b16..cf53cac32b 100644 --- a/GPU/GLES/TextureCacheGLES.cpp +++ b/GPU/GLES/TextureCacheGLES.cpp @@ -503,15 +503,15 @@ void TextureCacheGLES::ApplyTextureFramebuffer(TexCacheEntry *entry, VirtualFram const u32 clutTotalColors = clutMaxBytes_ / bytesPerColor; TexCacheEntry::Status alphaStatus = CheckAlpha(clutBuf_, getClutDestFormat(clutFormat), clutTotalColors, clutTotalColors, 1); - gstate_c.textureFullAlpha = alphaStatus == TexCacheEntry::STATUS_ALPHA_FULL; - gstate_c.textureSimpleAlpha = alphaStatus == TexCacheEntry::STATUS_ALPHA_SIMPLE; + gstate_c.SetTextureFullAlpha(alphaStatus == TexCacheEntry::STATUS_ALPHA_FULL); + gstate_c.SetTextureSimpleAlpha(alphaStatus == TexCacheEntry::STATUS_ALPHA_SIMPLE); } else { entry->status &= ~TexCacheEntry::STATUS_DEPALETTIZE; framebufferManagerGL_->BindFramebufferAsColorTexture(0, framebuffer, BINDFBCOLOR_MAY_COPY_WITH_UV | BINDFBCOLOR_APPLY_TEX_OFFSET); - gstate_c.textureFullAlpha = gstate.getTextureFormat() == GE_TFMT_5650; - gstate_c.textureSimpleAlpha = gstate_c.textureFullAlpha; + gstate_c.SetTextureFullAlpha(gstate.getTextureFormat() == GE_TFMT_5650); + gstate_c.SetTextureSimpleAlpha(gstate_c.textureFullAlpha); } framebufferManagerGL_->RebindFramebuffer(); diff --git a/GPU/GPUState.h b/GPU/GPUState.h index d695bb99dc..a64265674b 100644 --- a/GPU/GPUState.h +++ b/GPU/GPUState.h @@ -501,6 +501,18 @@ struct GPUStateCache { bool IsDirty(u64 what) const { return (dirty & what) != 0ULL; } + void SetTextureFullAlpha(bool fullAlpha) { + textureFullAlpha = fullAlpha; + } + void SetTextureSimpleAlpha(bool simpleAlpha) { + textureSimpleAlpha = simpleAlpha; + } + void SetNeedShaderTexclamp(bool need) { + needShaderTexClamp = need; + } + void SetAllowShaderBlend(bool allow) { + allowShaderBlend = allow; + } u32 featureFlags; diff --git a/GPU/Vulkan/StateMappingVulkan.cpp b/GPU/Vulkan/StateMappingVulkan.cpp index 3af2223cdc..848e8fa174 100644 --- a/GPU/Vulkan/StateMappingVulkan.cpp +++ b/GPU/Vulkan/StateMappingVulkan.cpp @@ -136,7 +136,7 @@ void DrawEngineVulkan::ConvertStateToVulkanKey(FramebufferManagerVulkan &fbManag { // Unfortunately, this isn't implemented yet. - gstate_c.allowShaderBlend = false; + gstate_c.SetAllowShaderBlend(false); if (gstate.isModeClear()) { key.logicOpEnable = false; key.blendEnable = false; @@ -159,7 +159,7 @@ void DrawEngineVulkan::ConvertStateToVulkanKey(FramebufferManagerVulkan &fbManag } else { // Until next time, force it off. ResetShaderBlending(); - gstate_c.allowShaderBlend = false; + gstate_c.SetAllowShaderBlend(false); } } else if (blendState.resetShaderBlending) { ResetShaderBlending(); diff --git a/GPU/Vulkan/TextureCacheVulkan.cpp b/GPU/Vulkan/TextureCacheVulkan.cpp index 05f2ff8050..a48480e779 100644 --- a/GPU/Vulkan/TextureCacheVulkan.cpp +++ b/GPU/Vulkan/TextureCacheVulkan.cpp @@ -429,13 +429,13 @@ void TextureCacheVulkan::ApplyTextureFramebuffer(TexCacheEntry *entry, VirtualFr const u32 clutTotalColors = clutMaxBytes_ / bytesPerColor; TexCacheEntry::Status alphaStatus = CheckAlpha(clutBuf_, getClutDestFormatVulkan(clutFormat), clutTotalColors, clutTotalColors, 1); - gstate_c.textureFullAlpha = alphaStatus == TexCacheEntry::STATUS_ALPHA_FULL; - gstate_c.textureSimpleAlpha = alphaStatus == TexCacheEntry::STATUS_ALPHA_SIMPLE; + gstate_c.SetTextureFullAlpha(alphaStatus == TexCacheEntry::STATUS_ALPHA_FULL); + gstate_c.SetTextureSimpleAlpha(alphaStatus == TexCacheEntry::STATUS_ALPHA_SIMPLE); } else { entry->status &= ~TexCacheEntry::STATUS_DEPALETTIZE; - gstate_c.textureFullAlpha = gstate.getTextureFormat() == GE_TFMT_5650; - gstate_c.textureSimpleAlpha = gstate_c.textureFullAlpha; + gstate_c.SetTextureFullAlpha(gstate.getTextureFormat() == GE_TFMT_5650); + gstate_c.SetTextureSimpleAlpha(gstate_c.textureFullAlpha); } /* @@ -683,8 +683,8 @@ void TextureCacheVulkan::BuildTexture(TexCacheEntry *const entry, bool replaceIm entry->vkTex->texture_->EndCreate(); - gstate_c.textureFullAlpha = entry->GetAlphaStatus() == TexCacheEntry::STATUS_ALPHA_FULL; - gstate_c.textureSimpleAlpha = entry->GetAlphaStatus() != TexCacheEntry::STATUS_ALPHA_UNKNOWN; + gstate_c.SetTextureFullAlpha(entry->GetAlphaStatus() == TexCacheEntry::STATUS_ALPHA_FULL); + gstate_c.SetTextureSimpleAlpha(entry->GetAlphaStatus() != TexCacheEntry::STATUS_ALPHA_UNKNOWN); } VkFormat TextureCacheVulkan::GetDestFormat(GETextureFormat format, GEPaletteFormat clutFormat) const {