mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
Disable color writing when alpha test always fails.
This commit is contained in:
parent
d26bcb0847
commit
be706a3977
@ -712,7 +712,6 @@ const char *GeneratePixelShaderCode(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType
|
|||||||
if(RegisterStates[0].AlphaNeedOverflowControl || RegisterStates[0].ColorNeedOverflowControl)
|
if(RegisterStates[0].AlphaNeedOverflowControl || RegisterStates[0].ColorNeedOverflowControl)
|
||||||
WRITE(p, "prev = frac(prev * (255.0f/256.0f)) * (256.0f/255.0f);\n");
|
WRITE(p, "prev = frac(prev * (255.0f/256.0f)) * (256.0f/255.0f);\n");
|
||||||
|
|
||||||
// TODO: ALPHATEST_FAIL should be handled by disabling color writes in the render state
|
|
||||||
AlphaTest::TEST_RESULT Pretest = bpmem.alpha_test.TestResult();
|
AlphaTest::TEST_RESULT Pretest = bpmem.alpha_test.TestResult();
|
||||||
if (Pretest == AlphaTest::UNDETERMINED)
|
if (Pretest == AlphaTest::UNDETERMINED)
|
||||||
WriteAlphaTest(p, ApiType, dstAlphaMode);
|
WriteAlphaTest(p, ApiType, dstAlphaMode);
|
||||||
|
@ -471,10 +471,13 @@ void Renderer::SetColorMask()
|
|||||||
{
|
{
|
||||||
// Only enable alpha channel if it's supported by the current EFB format
|
// Only enable alpha channel if it's supported by the current EFB format
|
||||||
UINT8 color_mask = 0;
|
UINT8 color_mask = 0;
|
||||||
if (bpmem.blendmode.alphaupdate && (bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24))
|
if (bpmem.alpha_test.TestResult() != AlphaTest::FAIL)
|
||||||
color_mask = D3D11_COLOR_WRITE_ENABLE_ALPHA;
|
{
|
||||||
if (bpmem.blendmode.colorupdate)
|
if (bpmem.blendmode.alphaupdate && (bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24))
|
||||||
color_mask |= D3D11_COLOR_WRITE_ENABLE_RED | D3D11_COLOR_WRITE_ENABLE_GREEN | D3D11_COLOR_WRITE_ENABLE_BLUE;
|
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;
|
||||||
|
}
|
||||||
gx_state.blenddc.RenderTarget[0].RenderTargetWriteMask = color_mask;
|
gx_state.blenddc.RenderTarget[0].RenderTargetWriteMask = color_mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -428,10 +428,13 @@ void Renderer::SetColorMask()
|
|||||||
{
|
{
|
||||||
// Only enable alpha channel if it's supported by the current EFB format
|
// Only enable alpha channel if it's supported by the current EFB format
|
||||||
DWORD color_mask = 0;
|
DWORD color_mask = 0;
|
||||||
if (bpmem.blendmode.alphaupdate && (bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24))
|
if (bpmem.alpha_test.TestResult() != AlphaTest::FAIL)
|
||||||
color_mask = D3DCOLORWRITEENABLE_ALPHA;
|
{
|
||||||
if (bpmem.blendmode.colorupdate)
|
if (bpmem.blendmode.alphaupdate && (bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24))
|
||||||
color_mask |= D3DCOLORWRITEENABLE_RED | D3DCOLORWRITEENABLE_GREEN | D3DCOLORWRITEENABLE_BLUE;
|
color_mask = D3DCOLORWRITEENABLE_ALPHA;
|
||||||
|
if (bpmem.blendmode.colorupdate)
|
||||||
|
color_mask |= D3DCOLORWRITEENABLE_RED | D3DCOLORWRITEENABLE_GREEN | D3DCOLORWRITEENABLE_BLUE;
|
||||||
|
}
|
||||||
D3D::SetRenderState(D3DRS_COLORWRITEENABLE, color_mask);
|
D3D::SetRenderState(D3DRS_COLORWRITEENABLE, color_mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -646,10 +646,13 @@ void Renderer::SetColorMask()
|
|||||||
{
|
{
|
||||||
// Only enable alpha channel if it's supported by the current EFB format
|
// Only enable alpha channel if it's supported by the current EFB format
|
||||||
GLenum ColorMask = GL_FALSE, AlphaMask = GL_FALSE;
|
GLenum ColorMask = GL_FALSE, AlphaMask = GL_FALSE;
|
||||||
if (bpmem.blendmode.colorupdate)
|
if (bpmem.alpha_test.TestResult() != AlphaTest::FAIL)
|
||||||
ColorMask = GL_TRUE;
|
{
|
||||||
if (bpmem.blendmode.alphaupdate && (bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24))
|
if (bpmem.blendmode.colorupdate)
|
||||||
AlphaMask = GL_TRUE;
|
ColorMask = GL_TRUE;
|
||||||
|
if (bpmem.blendmode.alphaupdate && (bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24))
|
||||||
|
AlphaMask = GL_TRUE;
|
||||||
|
}
|
||||||
glColorMask(ColorMask, ColorMask, ColorMask, AlphaMask);
|
glColorMask(ColorMask, ColorMask, ColorMask, AlphaMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user