@@ -19,12 +19,10 @@ class Renderer : public ::Renderer
Renderer();
~Renderer() override;

void SetColorMask() override;
void SetBlendMode(bool forceUpdate) override;
void SetBlendingState(const BlendingState& state) override;
void SetScissorRect(const EFBRectangle& rc) override;
void SetGenerationMode() override;
void SetDepthMode() override;
void SetLogicOpMode() override;
void SetSamplerState(int stage, int texindex, bool custom_tex) override;
void SetInterlacingMode() override;
void SetViewport() override;
@@ -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();
@@ -77,7 +77,7 @@ class Renderer : public ::Renderer
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;
@@ -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);
}

@@ -56,7 +56,7 @@ class Renderer : public ::Renderer
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;
@@ -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,17 +73,9 @@ void SetDepthMode()

void SetBlendMode()
{
g_renderer->SetBlendMode(false);
}

void SetLogicOpMode()
{
g_renderer->SetLogicOpMode();
}

void SetColorMask()
{
g_renderer->SetColorMask();
BlendingState state;
state.Generate(bpmem);
g_renderer->SetBlendingState(state);
}

/* Explanation of the magic behind ClearScreen:
@@ -19,8 +19,6 @@ void SetGenerationMode();
void SetScissor();
void SetDepthMode();
void SetBlendMode();
void SetLogicOpMode();
void SetColorMask();
void ClearScreen(const EFBRectangle& rc);
void OnPixelFormatChange();
void SetInterlacingMode(const BPCmd& bp);
@@ -148,17 +148,7 @@ static void BPWritten(const BPCmd& bp)
bpmem.blendmode.dstfactor.Value(), bpmem.blendmode.srcfactor.Value(),
bpmem.blendmode.subtract.Value(), bpmem.blendmode.logicmode.Value());

// Set Blending Mode
if (bp.changes)
SetBlendMode();

// Set LogicOp Blending Mode
if (bp.changes & 0xF002) // logicopenable | logicmode
SetLogicOpMode();

// Set Color Mask
if (bp.changes & 0x18) // colorupdate | alphaupdate
SetColorMask();
SetBlendMode();

// Dither
if (bp.changes & 0x04)
@@ -331,7 +321,6 @@ static void BPWritten(const BPCmd& bp)
if (bp.changes)
{
PixelShaderManager::SetAlphaTestChanged();
g_renderer->SetColorMask();
SetBlendMode();
}
return;
@@ -420,11 +409,7 @@ static void BPWritten(const BPCmd& bp)
case BPMEM_ZCOMPARE: // Set the Z-Compare and EFB pixel format
OnPixelFormatChange();
if (bp.changes & 7)
{
SetBlendMode(); // dual source could be activated by changing to PIXELFMT_RGBA6_Z24
g_renderer->SetColorMask(); // alpha writing needs to be disabled if the new pixel format
// doesn't have an alpha channel
}
PixelShaderManager::SetZModeControl();
return;

@@ -1414,8 +1399,6 @@ void BPReload()
SetGenerationMode();
SetScissor();
SetDepthMode();
SetLogicOpMode();
SetBlendMode();
SetColorMask();
OnPixelFormatChange();
}
@@ -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,12 +64,10 @@ class Renderer
PP_EFB_COPY_CLOCKS
};

virtual void SetColorMask() {}
virtual void SetBlendMode(bool forceUpdate) {}
virtual void SetBlendingState(const BlendingState& state) {}
virtual void SetScissorRect(const EFBRectangle& rc) {}
virtual void SetGenerationMode() {}
virtual void SetDepthMode() {}
virtual void SetLogicOpMode() {}
virtual void SetSamplerState(int stage, int texindex, bool custom_tex) {}
virtual void SetInterlacingMode() {}
virtual void SetViewport() {}