summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorStenzek <stenzek@users.noreply.github.com>2017-08-02 20:10:34 +1000
committerGitHub <noreply@github.com>2017-08-02 20:10:34 +1000
commitd0bcdc7f89c0eb3b7c734d19fd150c9bc21aa4fc (patch)
treeeab29c7682f93383f01ef8a0b646eea8aed48737 /Source/Core
parenta8e4a3c9151ec4560b75211baecf8ed8899adea3 (diff)
parent852e30bb8ca71ae419cf5ed15c63ceba417c0f83 (diff)
Merge pull request #5858 from stenzek/ubershader-6-bit-color
Ubershaders: Fix 6-bit color truncation not being applied
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/VideoCommon/BPStructs.cpp16
-rw-r--r--Source/Core/VideoCommon/ConstantManager.h2
-rw-r--r--Source/Core/VideoCommon/PixelShaderGen.cpp2
-rw-r--r--Source/Core/VideoCommon/PixelShaderManager.cpp8
-rw-r--r--Source/Core/VideoCommon/PixelShaderManager.h2
-rw-r--r--Source/Core/VideoCommon/UberShaderPixel.cpp2
6 files changed, 17 insertions, 15 deletions
diff --git a/Source/Core/VideoCommon/BPStructs.cpp b/Source/Core/VideoCommon/BPStructs.cpp
index c686d4ff01..9706347618 100644
--- a/Source/Core/VideoCommon/BPStructs.cpp
+++ b/Source/Core/VideoCommon/BPStructs.cpp
@@ -134,18 +134,19 @@ static void BPWritten(const BPCmd& bp)
GeometryShaderManager::SetLinePtWidthChanged();
return;
case BPMEM_ZMODE: // Depth Control
- PRIM_LOG("zmode: test=%d, func=%d, upd=%d", (int)bpmem.zmode.testenable, (int)bpmem.zmode.func,
- (int)bpmem.zmode.updateenable);
+ PRIM_LOG("zmode: test=%u, func=%u, upd=%u", bpmem.zmode.testenable.Value(),
+ bpmem.zmode.func.Value(), bpmem.zmode.updateenable.Value());
SetDepthMode();
+ PixelShaderManager::SetZModeControl();
return;
case BPMEM_BLENDMODE: // Blending Control
if (bp.changes & 0xFFFF)
{
- PRIM_LOG("blendmode: en=%d, open=%d, colupd=%d, alphaupd=%d, dst=%d, src=%d, sub=%d, mode=%d",
- (int)bpmem.blendmode.blendenable, (int)bpmem.blendmode.logicopenable,
- (int)bpmem.blendmode.colorupdate, (int)bpmem.blendmode.alphaupdate,
- (int)bpmem.blendmode.dstfactor, (int)bpmem.blendmode.srcfactor,
- (int)bpmem.blendmode.subtract, (int)bpmem.blendmode.logicmode);
+ PRIM_LOG("blendmode: en=%u, open=%u, colupd=%u, alphaupd=%u, dst=%u, src=%u, sub=%u, mode=%u",
+ bpmem.blendmode.blendenable.Value(), bpmem.blendmode.logicopenable.Value(),
+ bpmem.blendmode.colorupdate.Value(), bpmem.blendmode.alphaupdate.Value(),
+ bpmem.blendmode.dstfactor.Value(), bpmem.blendmode.srcfactor.Value(),
+ bpmem.blendmode.subtract.Value(), bpmem.blendmode.logicmode.Value());
// Set Blending Mode
if (bp.changes)
@@ -424,6 +425,7 @@ static void BPWritten(const BPCmd& bp)
g_renderer->SetColorMask(); // alpha writing needs to be disabled if the new pixel format
// doesn't have an alpha channel
}
+ PixelShaderManager::SetZModeControl();
return;
case BPMEM_MIPMAP_STRIDE: // MipMap Stride Channel
diff --git a/Source/Core/VideoCommon/ConstantManager.h b/Source/Core/VideoCommon/ConstantManager.h
index 0630d015db..e1758d8f1a 100644
--- a/Source/Core/VideoCommon/ConstantManager.h
+++ b/Source/Core/VideoCommon/ConstantManager.h
@@ -33,7 +33,7 @@ struct PixelShaderConstants
u32 fogRangeBase; // .y
u32 dstalpha; // .z
u32 ztex_op; // .w
- u32 early_ztest; // .x (bool)
+ u32 late_ztest; // .x (bool)
u32 rgba6_format; // .y (bool)
u32 dither; // .z (bool)
u32 bounding_box; // .w (bool)
diff --git a/Source/Core/VideoCommon/PixelShaderGen.cpp b/Source/Core/VideoCommon/PixelShaderGen.cpp
index 308807e7c8..d503b21176 100644
--- a/Source/Core/VideoCommon/PixelShaderGen.cpp
+++ b/Source/Core/VideoCommon/PixelShaderGen.cpp
@@ -379,7 +379,7 @@ void WritePixelShaderCommonHeader(ShaderCode& out, APIType ApiType, u32 num_texg
"\tuint bpmem_fogRangeBase;\n"
"\tuint bpmem_dstalpha;\n"
"\tuint bpmem_ztex_op;\n"
- "\tbool bpmem_early_ztest;\n"
+ "\tbool bpmem_late_ztest;\n"
"\tbool bpmem_rgba6_format;\n"
"\tbool bpmem_dither;\n"
"\tbool bpmem_bounding_box;\n"
diff --git a/Source/Core/VideoCommon/PixelShaderManager.cpp b/Source/Core/VideoCommon/PixelShaderManager.cpp
index 98fba2f08f..0fa3614bdb 100644
--- a/Source/Core/VideoCommon/PixelShaderManager.cpp
+++ b/Source/Core/VideoCommon/PixelShaderManager.cpp
@@ -447,17 +447,17 @@ void PixelShaderManager::SetGenModeChanged()
dirty = true;
}
-void PixelShaderManager::SetZControlChanged()
+void PixelShaderManager::SetZModeControl()
{
- u32 early_ztest = bpmem.zcontrol.early_ztest ? 1 : 0;
+ u32 late_ztest = bpmem.UseLateDepthTest();
u32 rgba6_format =
(bpmem.zcontrol.pixel_format == PEControl::RGBA6_Z24 && !g_ActiveConfig.bForceTrueColor) ? 1 :
0;
u32 dither = rgba6_format && bpmem.blendmode.dither;
- if (constants.early_ztest != early_ztest || constants.rgba6_format != rgba6_format ||
+ if (constants.late_ztest != late_ztest || constants.rgba6_format != rgba6_format ||
constants.dither != dither)
{
- constants.early_ztest = early_ztest;
+ constants.late_ztest = late_ztest;
constants.rgba6_format = rgba6_format;
constants.dither = dither;
dirty = true;
diff --git a/Source/Core/VideoCommon/PixelShaderManager.h b/Source/Core/VideoCommon/PixelShaderManager.h
index dcb244bccb..9dd93e4068 100644
--- a/Source/Core/VideoCommon/PixelShaderManager.h
+++ b/Source/Core/VideoCommon/PixelShaderManager.h
@@ -45,7 +45,7 @@ public:
static void SetFogParamChanged();
static void SetFogRangeAdjustChanged();
static void SetGenModeChanged();
- static void SetZControlChanged();
+ static void SetZModeControl();
static void SetBlendModeChanged();
static void SetBoundingBoxActive(bool active);
diff --git a/Source/Core/VideoCommon/UberShaderPixel.cpp b/Source/Core/VideoCommon/UberShaderPixel.cpp
index 23d6725b3b..2c78d8e32f 100644
--- a/Source/Core/VideoCommon/UberShaderPixel.cpp
+++ b/Source/Core/VideoCommon/UberShaderPixel.cpp
@@ -894,7 +894,7 @@ ShaderCode GenPixelShader(APIType ApiType, const ShaderHostConfig& host_config,
{
out.Write(" // If early depth is enabled, write to zbuffer before depth textures\n");
out.Write(" // If early depth isn't enabled, we write to the zbuffer here\n");
- out.Write(" int zbuffer_zCoord = bpmem_early_ztest ? early_zCoord : zCoord;\n");
+ out.Write(" int zbuffer_zCoord = bpmem_late_ztest ? zCoord : early_zCoord;\n");
if (ApiType == APIType::D3D || ApiType == APIType::Vulkan)
out.Write(" depth = 1.0 - float(zbuffer_zCoord) / 16777216.0;\n");
else