diff --git a/Source/Core/VideoBackends/D3D/Render.cpp b/Source/Core/VideoBackends/D3D/Render.cpp index 6551cadf60..1bf929caa5 100644 --- a/Source/Core/VideoBackends/D3D/Render.cpp +++ b/Source/Core/VideoBackends/D3D/Render.cpp @@ -640,11 +640,9 @@ void Renderer::ReinterpretPixelData(unsigned int convtype) FramebufferManager::GetEFBDepthTexture()->GetDSV()); } -void Renderer::SetBlendMode(bool forceUpdate) +void Renderer::SetBlendingState(const BlendingState& state) { - BlendingState state; - state.Generate(bpmem); - gx_state.blend.hex = state.hex; + s_gx_state.blend.hex = state.hex; } // This function has the final picture. We adjust the aspect ratio here. diff --git a/Source/Core/VideoBackends/D3D/Render.h b/Source/Core/VideoBackends/D3D/Render.h index f7e9e08b64..907c9e2b18 100644 --- a/Source/Core/VideoBackends/D3D/Render.h +++ b/Source/Core/VideoBackends/D3D/Render.h @@ -19,7 +19,7 @@ public: Renderer(); ~Renderer() override; - void SetBlendMode(bool forceUpdate) override; + void SetBlendingState(const BlendingState& state) override; void SetScissorRect(const EFBRectangle& rc) override; void SetGenerationMode() override; void SetDepthMode() override; diff --git a/Source/Core/VideoBackends/OGL/Render.cpp b/Source/Core/VideoBackends/OGL/Render.cpp index 7e36f0be22..8953b10831 100644 --- a/Source/Core/VideoBackends/OGL/Render.cpp +++ b/Source/Core/VideoBackends/OGL/Render.cpp @@ -1264,11 +1264,8 @@ void Renderer::ReinterpretPixelData(unsigned int convtype) } } -void Renderer::SetBlendMode(bool forceUpdate) +void Renderer::SetBlendingState(const BlendingState& state) { - BlendingState state; - state.Generate(bpmem); - bool useDualSource = state.usedualsrc && g_ActiveConfig.backend_info.bSupportsDualSourceBlend && (!DriverDetails::HasBug(DriverDetails::BUG_BROKEN_DUAL_SOURCE_BLENDING) || state.dstalpha); @@ -1791,7 +1788,7 @@ void Renderer::RestoreAPIState() SetGenerationMode(); BPFunctions::SetScissor(); SetDepthMode(); - SetBlendMode(true); + BPFunctions::SetBlendMode(); SetViewport(); ProgramShaderCache::BindLastVertexFormat(); diff --git a/Source/Core/VideoBackends/OGL/Render.h b/Source/Core/VideoBackends/OGL/Render.h index e8df3d4301..668b15c51f 100644 --- a/Source/Core/VideoBackends/OGL/Render.h +++ b/Source/Core/VideoBackends/OGL/Render.h @@ -77,7 +77,7 @@ public: void Init(); void Shutdown(); - void SetBlendMode(bool forceUpdate) override; + void SetBlendingState(const BlendingState& state) override; void SetScissorRect(const EFBRectangle& rc) override; void SetGenerationMode() override; void SetDepthMode() override; diff --git a/Source/Core/VideoBackends/Vulkan/Renderer.cpp b/Source/Core/VideoBackends/Vulkan/Renderer.cpp index 88a9157b24..bb8b36481a 100644 --- a/Source/Core/VideoBackends/Vulkan/Renderer.cpp +++ b/Source/Core/VideoBackends/Vulkan/Renderer.cpp @@ -1340,11 +1340,8 @@ void Renderer::SetDepthMode() StateTracker::GetInstance()->SetDepthStencilState(new_ds_state); } -void Renderer::SetBlendMode(bool force_update) +void Renderer::SetBlendingState(const BlendingState& state) { - BlendingState state; - state.Generate(bpmem); - StateTracker::GetInstance()->SetBlendState(state); } diff --git a/Source/Core/VideoBackends/Vulkan/Renderer.h b/Source/Core/VideoBackends/Vulkan/Renderer.h index 3ca278acbb..5ec1be8277 100644 --- a/Source/Core/VideoBackends/Vulkan/Renderer.h +++ b/Source/Core/VideoBackends/Vulkan/Renderer.h @@ -56,7 +56,7 @@ public: void ResetAPIState() override; void RestoreAPIState() override; - void SetBlendMode(bool force_update) override; + void SetBlendingState(const BlendingState& state) override; void SetScissorRect(const EFBRectangle& rc) override; void SetGenerationMode() override; void SetDepthMode() override; diff --git a/Source/Core/VideoCommon/BPFunctions.cpp b/Source/Core/VideoCommon/BPFunctions.cpp index 6120ca7778..b74b6f84d4 100644 --- a/Source/Core/VideoCommon/BPFunctions.cpp +++ b/Source/Core/VideoCommon/BPFunctions.cpp @@ -8,6 +8,7 @@ #include "VideoCommon/BPFunctions.h" #include "VideoCommon/BPMemory.h" #include "VideoCommon/RenderBase.h" +#include "VideoCommon/RenderState.h" #include "VideoCommon/VertexManagerBase.h" #include "VideoCommon/VideoCommon.h" #include "VideoCommon/VideoConfig.h" @@ -72,7 +73,9 @@ void SetDepthMode() void SetBlendMode() { - g_renderer->SetBlendMode(false); + BlendingState state; + state.Generate(bpmem); + g_renderer->SetBlendingState(state); } /* Explanation of the magic behind ClearScreen: diff --git a/Source/Core/VideoCommon/RenderBase.h b/Source/Core/VideoCommon/RenderBase.h index 9dcd685510..7b7f43b7f6 100644 --- a/Source/Core/VideoCommon/RenderBase.h +++ b/Source/Core/VideoCommon/RenderBase.h @@ -29,6 +29,7 @@ #include "VideoCommon/AVIDump.h" #include "VideoCommon/BPMemory.h" #include "VideoCommon/FPSCounter.h" +#include "VideoCommon/RenderState.h" #include "VideoCommon/VideoCommon.h" class PostProcessingShaderImplementation; @@ -63,7 +64,7 @@ public: PP_EFB_COPY_CLOCKS }; - virtual void SetBlendMode(bool forceUpdate) {} + virtual void SetBlendingState(const BlendingState& state) {} virtual void SetScissorRect(const EFBRectangle& rc) {} virtual void SetGenerationMode() {} virtual void SetDepthMode() {}