Merge pull request #5337 from stenzek/d3d-common-blending-state

D3D: Use blending state from VideoCommon
This commit is contained in:
Anthony 2017-09-03 19:25:46 -07:00 committed by GitHub
commit 26e777d80b
13 changed files with 51 additions and 280 deletions

View File

@ -306,9 +306,9 @@ HRESULT Create(HWND wnd)
swap_chain_desc.Height = yres;
swap_chain_desc.Stereo = g_ActiveConfig.iStereoMode == STEREO_QUADBUFFER;
#if defined(_DEBUG) || defined(DEBUGFAST)
// Creating debug devices can sometimes fail if the user doesn't have the correct
// version of the DirectX SDK. If it does, simply fallback to a non-debug device.
if (g_Config.bEnableValidationLayer)
{
hr = PD3D11CreateDevice(adapter, D3D_DRIVER_TYPE_UNKNOWN, nullptr, D3D11_CREATE_DEVICE_DEBUG,
supported_feature_levels, NUM_SUPPORTED_FEATURE_LEVELS,
@ -334,8 +334,7 @@ HRESULT Create(HWND wnd)
}
}
if (FAILED(hr))
#endif
if (!g_Config.bEnableValidationLayer || FAILED(hr))
{
hr = PD3D11CreateDevice(adapter, D3D_DRIVER_TYPE_UNKNOWN, nullptr, 0, supported_feature_levels,
NUM_SUPPORTED_FEATURE_LEVELS, D3D11_SDK_VERSION, &device, &featlevel,

View File

@ -3,6 +3,7 @@
// Refer to the license.txt file included.
#include <algorithm>
#include <array>
#include "Common/BitSet.h"
#include "Common/CommonTypes.h"
@ -351,72 +352,51 @@ ID3D11SamplerState* StateCache::Get(SamplerState state)
return res;
}
ID3D11BlendState* StateCache::Get(BlendState state)
ID3D11BlendState* StateCache::Get(BlendingState state)
{
if (!state.blend_enable)
{
state.src_blend = D3D11_BLEND_ONE;
state.dst_blend = D3D11_BLEND_ZERO;
state.blend_op = D3D11_BLEND_OP_ADD;
state.use_dst_alpha = false;
}
auto it = m_blend.find(state.packed);
auto it = m_blend.find(state.hex);
if (it != m_blend.end())
return it->second;
D3D11_BLEND_DESC blenddc = CD3D11_BLEND_DESC(CD3D11_DEFAULT());
D3D11_BLEND_DESC desc = {};
desc.AlphaToCoverageEnable = FALSE;
desc.IndependentBlendEnable = FALSE;
blenddc.AlphaToCoverageEnable = FALSE;
blenddc.IndependentBlendEnable = FALSE;
blenddc.RenderTarget[0].BlendEnable = state.blend_enable;
blenddc.RenderTarget[0].RenderTargetWriteMask = (u32)state.write_mask;
blenddc.RenderTarget[0].SrcBlend = state.src_blend;
blenddc.RenderTarget[0].DestBlend = state.dst_blend;
blenddc.RenderTarget[0].BlendOp = state.blend_op;
blenddc.RenderTarget[0].SrcBlendAlpha = state.src_blend;
blenddc.RenderTarget[0].DestBlendAlpha = state.dst_blend;
blenddc.RenderTarget[0].BlendOpAlpha = state.blend_op;
D3D11_RENDER_TARGET_BLEND_DESC& tdesc = desc.RenderTarget[0];
tdesc.BlendEnable = state.blendenable;
if (blenddc.RenderTarget[0].SrcBlend == D3D11_BLEND_SRC_COLOR)
blenddc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_SRC1_ALPHA;
else if (blenddc.RenderTarget[0].SrcBlend == D3D11_BLEND_INV_SRC_COLOR)
blenddc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_INV_SRC_ALPHA;
else if (blenddc.RenderTarget[0].SrcBlend == D3D11_BLEND_DEST_COLOR)
blenddc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_DEST_ALPHA;
else if (blenddc.RenderTarget[0].SrcBlend == D3D11_BLEND_INV_DEST_COLOR)
blenddc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_INV_DEST_ALPHA;
if (state.colorupdate)
tdesc.RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_RED | D3D11_COLOR_WRITE_ENABLE_GREEN |
D3D11_COLOR_WRITE_ENABLE_BLUE;
else
blenddc.RenderTarget[0].SrcBlendAlpha = blenddc.RenderTarget[0].SrcBlend;
tdesc.RenderTargetWriteMask = 0;
if (state.alphaupdate)
tdesc.RenderTargetWriteMask |= D3D11_COLOR_WRITE_ENABLE_ALPHA;
if (blenddc.RenderTarget[0].DestBlend == D3D11_BLEND_SRC_COLOR)
blenddc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_SRC1_ALPHA;
else if (blenddc.RenderTarget[0].DestBlend == D3D11_BLEND_INV_SRC_COLOR)
blenddc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_INV_SRC_ALPHA;
else if (blenddc.RenderTarget[0].DestBlend == D3D11_BLEND_DEST_COLOR)
blenddc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_DEST_ALPHA;
else if (blenddc.RenderTarget[0].DestBlend == D3D11_BLEND_INV_DEST_COLOR)
blenddc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_INV_DEST_ALPHA;
else
blenddc.RenderTarget[0].DestBlendAlpha = blenddc.RenderTarget[0].DestBlend;
static constexpr std::array<D3D11_BLEND, 8> src_factors = {
{D3D11_BLEND_ZERO, D3D11_BLEND_ONE, D3D11_BLEND_DEST_COLOR, D3D11_BLEND_INV_DEST_COLOR,
D3D11_BLEND_SRC1_ALPHA, D3D11_BLEND_INV_SRC1_ALPHA, D3D11_BLEND_DEST_ALPHA,
D3D11_BLEND_INV_DEST_ALPHA}};
static constexpr std::array<D3D11_BLEND, 8> dst_factors = {
{D3D11_BLEND_ZERO, D3D11_BLEND_ONE, D3D11_BLEND_SRC_COLOR, D3D11_BLEND_INV_SRC_COLOR,
D3D11_BLEND_SRC1_ALPHA, D3D11_BLEND_INV_SRC1_ALPHA, D3D11_BLEND_DEST_ALPHA,
D3D11_BLEND_INV_DEST_ALPHA}};
if (state.use_dst_alpha)
{
blenddc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ONE;
blenddc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ZERO;
blenddc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD;
}
tdesc.SrcBlend = src_factors[state.srcfactor];
tdesc.SrcBlendAlpha = src_factors[state.srcfactoralpha];
tdesc.DestBlend = dst_factors[state.dstfactor];
tdesc.DestBlendAlpha = dst_factors[state.dstfactoralpha];
tdesc.BlendOp = state.subtract ? D3D11_BLEND_OP_REV_SUBTRACT : D3D11_BLEND_OP_ADD;
tdesc.BlendOpAlpha = state.subtractAlpha ? D3D11_BLEND_OP_REV_SUBTRACT : D3D11_BLEND_OP_ADD;
ID3D11BlendState* res = nullptr;
HRESULT hr = D3D::device->CreateBlendState(&blenddc, &res);
HRESULT hr = D3D::device->CreateBlendState(&desc, &res);
if (FAILED(hr))
PanicAlert("Failed to create blend state at %s %d\n", __FILE__, __LINE__);
D3D::SetDebugObjectName(res, "blend state used to emulate the GX pipeline");
m_blend.emplace(state.packed, res);
m_blend.emplace(state.hex, res);
return res;
}

View File

@ -12,7 +12,7 @@
#include "Common/BitField.h"
#include "Common/CommonTypes.h"
#include "VideoBackends/D3D/D3DBase.h"
#include "VideoCommon/BPMemory.h"
#include "VideoCommon/RenderState.h"
struct ID3D11BlendState;
struct ID3D11DepthStencilState;
@ -27,18 +27,6 @@ union RasterizerState
u32 packed;
};
union BlendState
{
BitField<0, 1, u32> blend_enable;
BitField<1, 3, D3D11_BLEND_OP> blend_op;
BitField<4, 4, u32> write_mask;
BitField<8, 5, D3D11_BLEND> src_blend;
BitField<13, 5, D3D11_BLEND> dst_blend;
BitField<18, 1, u32> use_dst_alpha;
u32 packed;
};
union SamplerState
{
BitField<0, 3, u64> min_filter;
@ -59,7 +47,7 @@ public:
// Get existing or create new render state.
// Returned objects is owned by the cache and does not need to be released.
ID3D11SamplerState* Get(SamplerState state);
ID3D11BlendState* Get(BlendState state);
ID3D11BlendState* Get(BlendingState state);
ID3D11RasterizerState* Get(RasterizerState state);
ID3D11DepthStencilState* Get(ZMode state);

View File

@ -36,6 +36,7 @@
#include "VideoCommon/OnScreenDisplay.h"
#include "VideoCommon/PixelEngine.h"
#include "VideoCommon/PixelShaderManager.h"
#include "VideoCommon/RenderState.h"
#include "VideoCommon/SamplerCommon.h"
#include "VideoCommon/VideoBackendBase.h"
#include "VideoCommon/VideoConfig.h"
@ -58,7 +59,7 @@ typedef struct _Nv_Stereo_Image_Header
struct GXPipelineState
{
std::array<SamplerState, 8> samplers;
BlendState blend;
BlendingState blend;
ZMode zmode;
RasterizerState raster;
};
@ -247,17 +248,8 @@ Renderer::Renderer() : ::Renderer(D3D::GetBackBufferWidth(), D3D::GetBackBufferH
SetupDeviceObjects();
// Setup GX pipeline state
s_gx_state.blend.blend_enable = false;
s_gx_state.blend.write_mask = D3D11_COLOR_WRITE_ENABLE_ALL;
s_gx_state.blend.src_blend = D3D11_BLEND_ONE;
s_gx_state.blend.dst_blend = D3D11_BLEND_ZERO;
s_gx_state.blend.blend_op = D3D11_BLEND_OP_ADD;
s_gx_state.blend.use_dst_alpha = false;
for (auto& sampler : s_gx_state.samplers)
{
sampler.packed = 0;
}
s_gx_state.zmode.testenable = false;
s_gx_state.zmode.updateenable = false;
@ -329,21 +321,6 @@ void Renderer::SetScissorRect(const EFBRectangle& rc)
D3D::context->RSSetScissorRects(1, trc.AsRECT());
}
void Renderer::SetColorMask()
{
// Only enable alpha channel if it's supported by the current EFB format
UINT8 color_mask = 0;
if (bpmem.alpha_test.TestResult() != AlphaTest::FAIL)
{
if (bpmem.blendmode.alphaupdate && (bpmem.zcontrol.pixel_format == PEControl::RGBA6_Z24))
color_mask = D3D11_COLOR_WRITE_ENABLE_ALPHA;
if (bpmem.blendmode.colorupdate)
color_mask |= D3D11_COLOR_WRITE_ENABLE_RED | D3D11_COLOR_WRITE_ENABLE_GREEN |
D3D11_COLOR_WRITE_ENABLE_BLUE;
}
s_gx_state.blend.write_mask = color_mask;
}
// This function allows the CPU to directly access the EFB.
// There are EFB peeks (which will read the color or depth of a pixel)
// and EFB pokes (which will change the color or depth of a pixel).
@ -663,46 +640,9 @@ void Renderer::ReinterpretPixelData(unsigned int convtype)
FramebufferManager::GetEFBDepthTexture()->GetDSV());
}
void Renderer::SetBlendMode(bool forceUpdate)
void Renderer::SetBlendingState(const BlendingState& state)
{
// Our render target always uses an alpha channel, so we need to override the blend functions to
// assume a destination alpha of 1 if the render target isn't supposed to have an alpha channel
// Example: D3DBLEND_DESTALPHA needs to be D3DBLEND_ONE since the result without an alpha channel
// is assumed to always be 1.
bool target_has_alpha = bpmem.zcontrol.pixel_format == PEControl::RGBA6_Z24;
const std::array<D3D11_BLEND, 8> d3d_src_factors{{
D3D11_BLEND_ZERO, D3D11_BLEND_ONE, D3D11_BLEND_DEST_COLOR, D3D11_BLEND_INV_DEST_COLOR,
D3D11_BLEND_SRC1_ALPHA, D3D11_BLEND_INV_SRC1_ALPHA,
(target_has_alpha) ? D3D11_BLEND_DEST_ALPHA : D3D11_BLEND_ONE,
(target_has_alpha) ? D3D11_BLEND_INV_DEST_ALPHA : D3D11_BLEND_ZERO,
}};
const std::array<D3D11_BLEND, 8> d3d_dest_factors{{
D3D11_BLEND_ZERO, D3D11_BLEND_ONE, D3D11_BLEND_SRC_COLOR, D3D11_BLEND_INV_SRC_COLOR,
D3D11_BLEND_SRC1_ALPHA, D3D11_BLEND_INV_SRC1_ALPHA,
(target_has_alpha) ? D3D11_BLEND_DEST_ALPHA : D3D11_BLEND_ONE,
(target_has_alpha) ? D3D11_BLEND_INV_DEST_ALPHA : D3D11_BLEND_ZERO,
}};
if (bpmem.blendmode.logicopenable && !bpmem.blendmode.blendenable && !forceUpdate)
return;
if (bpmem.blendmode.subtract)
{
s_gx_state.blend.blend_enable = true;
s_gx_state.blend.blend_op = D3D11_BLEND_OP_REV_SUBTRACT;
s_gx_state.blend.src_blend = D3D11_BLEND_ONE;
s_gx_state.blend.dst_blend = D3D11_BLEND_ONE;
}
else
{
s_gx_state.blend.blend_enable = (u32)bpmem.blendmode.blendenable;
if (bpmem.blendmode.blendenable)
{
s_gx_state.blend.blend_op = D3D11_BLEND_OP_ADD;
s_gx_state.blend.src_blend = d3d_src_factors[bpmem.blendmode.srcfactor];
s_gx_state.blend.dst_blend = d3d_dest_factors[bpmem.blendmode.dstfactor];
}
}
s_gx_state.blend.hex = state.hex;
}
// This function has the final picture. We adjust the aspect ratio here.
@ -930,11 +870,6 @@ void Renderer::RestoreAPIState()
void Renderer::ApplyState()
{
// TODO: Refactor this logic here.
bool bUseDstAlpha = bpmem.dstalpha.enable && bpmem.blendmode.alphaupdate &&
bpmem.zcontrol.pixel_format == PEControl::RGBA6_Z24;
s_gx_state.blend.use_dst_alpha = bUseDstAlpha;
D3D::stateman->PushBlendState(s_gx_state_cache.Get(s_gx_state.blend));
D3D::stateman->PushDepthState(s_gx_state_cache.Get(s_gx_state.zmode));
D3D::stateman->PushRasterizerState(s_gx_state_cache.Get(s_gx_state.raster));
@ -946,13 +881,6 @@ void Renderer::ApplyState()
D3D::stateman->SetSampler(stage, s_gx_state_cache.Get(s_gx_state.samplers[stage]));
}
if (bUseDstAlpha)
{
// restore actual state
SetBlendMode(false);
SetLogicOpMode();
}
ID3D11Buffer* vertexConstants = VertexShaderCache::GetConstantBuffer();
D3D::stateman->SetPixelConstants(PixelShaderCache::GetConstantBuffer(),
@ -998,95 +926,6 @@ void Renderer::SetDepthMode()
s_gx_state.zmode.hex = bpmem.zmode.hex;
}
void Renderer::SetLogicOpMode()
{
// D3D11 doesn't support logic blending, so this is a huge hack
// TODO: Make use of D3D11.1's logic blending support
// 0 0x00
// 1 Source & destination
// 2 Source & ~destination
// 3 Source
// 4 ~Source & destination
// 5 Destination
// 6 Source ^ destination = Source & ~destination | ~Source & destination
// 7 Source | destination
// 8 ~(Source | destination)
// 9 ~(Source ^ destination) = ~Source & ~destination | Source & destination
// 10 ~Destination
// 11 Source | ~destination
// 12 ~Source
// 13 ~Source | destination
// 14 ~(Source & destination)
// 15 0xff
constexpr std::array<D3D11_BLEND_OP, 16> d3d_logic_ops{{
D3D11_BLEND_OP_ADD, // 0
D3D11_BLEND_OP_ADD, // 1
D3D11_BLEND_OP_SUBTRACT, // 2
D3D11_BLEND_OP_ADD, // 3
D3D11_BLEND_OP_REV_SUBTRACT, // 4
D3D11_BLEND_OP_ADD, // 5
D3D11_BLEND_OP_MAX, // 6
D3D11_BLEND_OP_ADD, // 7
D3D11_BLEND_OP_MAX, // 8
D3D11_BLEND_OP_MAX, // 9
D3D11_BLEND_OP_ADD, // 10
D3D11_BLEND_OP_ADD, // 11
D3D11_BLEND_OP_ADD, // 12
D3D11_BLEND_OP_ADD, // 13
D3D11_BLEND_OP_ADD, // 14
D3D11_BLEND_OP_ADD // 15
}};
constexpr std::array<D3D11_BLEND, 16> d3d_logic_op_src_factors{{
D3D11_BLEND_ZERO, // 0
D3D11_BLEND_DEST_COLOR, // 1
D3D11_BLEND_ONE, // 2
D3D11_BLEND_ONE, // 3
D3D11_BLEND_DEST_COLOR, // 4
D3D11_BLEND_ZERO, // 5
D3D11_BLEND_INV_DEST_COLOR, // 6
D3D11_BLEND_INV_DEST_COLOR, // 7
D3D11_BLEND_INV_SRC_COLOR, // 8
D3D11_BLEND_INV_SRC_COLOR, // 9
D3D11_BLEND_INV_DEST_COLOR, // 10
D3D11_BLEND_ONE, // 11
D3D11_BLEND_INV_SRC_COLOR, // 12
D3D11_BLEND_INV_SRC_COLOR, // 13
D3D11_BLEND_INV_DEST_COLOR, // 14
D3D11_BLEND_ONE // 15
}};
constexpr std::array<D3D11_BLEND, 16> d3d_logic_op_dest_factors{{
D3D11_BLEND_ZERO, // 0
D3D11_BLEND_ZERO, // 1
D3D11_BLEND_INV_SRC_COLOR, // 2
D3D11_BLEND_ZERO, // 3
D3D11_BLEND_ONE, // 4
D3D11_BLEND_ONE, // 5
D3D11_BLEND_INV_SRC_COLOR, // 6
D3D11_BLEND_ONE, // 7
D3D11_BLEND_INV_DEST_COLOR, // 8
D3D11_BLEND_SRC_COLOR, // 9
D3D11_BLEND_INV_DEST_COLOR, // 10
D3D11_BLEND_INV_DEST_COLOR, // 11
D3D11_BLEND_INV_SRC_COLOR, // 12
D3D11_BLEND_ONE, // 13
D3D11_BLEND_INV_SRC_COLOR, // 14
D3D11_BLEND_ONE // 15
}};
if (bpmem.blendmode.logicopenable && !bpmem.blendmode.blendenable)
{
s_gx_state.blend.blend_enable = true;
s_gx_state.blend.blend_op = d3d_logic_ops[bpmem.blendmode.logicmode];
s_gx_state.blend.src_blend = d3d_logic_op_src_factors[bpmem.blendmode.logicmode];
s_gx_state.blend.dst_blend = d3d_logic_op_dest_factors[bpmem.blendmode.logicmode];
}
else
{
SetBlendMode(true);
}
}
void Renderer::SetSamplerState(int stage, int texindex, bool custom_tex)
{
const FourTexUnits& tex = bpmem.tex[texindex];

View File

@ -19,12 +19,10 @@ public:
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;

View File

@ -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();

View File

@ -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;

View File

@ -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);
}

View File

@ -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;

View File

@ -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:

View File

@ -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);

View File

@ -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();
}

View File

@ -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 @@ public:
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() {}