summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorYuriy O'Donnell <yuriyo@gmail.com>2014-10-25 02:59:02 +0200
committerYuriy O'Donnell <yuriyo@gmail.com>2014-11-29 11:42:52 +0100
commita886d8a8ee97ced9b8d4868d604d08b54886b06a (patch)
tree6524f979ade565ec413bb4304297a315df86874c /Source
parent1fe3d07cbdeda459527199bb9837f5f6ce9a2f5b (diff)
Renamed DEPTHPARAMS to PIXELCENTERCORRECTION
This shader constant was previously used for depth remapping in D3D and for pixel center correction. Now it only serves one purpose and the new name makes it clear.
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/VideoCommon/ConstantManager.h2
-rw-r--r--Source/Core/VideoCommon/ShaderGenCommon.h4
-rw-r--r--Source/Core/VideoCommon/VertexShaderGen.cpp2
-rw-r--r--Source/Core/VideoCommon/VertexShaderManager.cpp6
4 files changed, 6 insertions, 8 deletions
diff --git a/Source/Core/VideoCommon/ConstantManager.h b/Source/Core/VideoCommon/ConstantManager.h
index 116088d76e..93c228bc98 100644
--- a/Source/Core/VideoCommon/ConstantManager.h
+++ b/Source/Core/VideoCommon/ConstantManager.h
@@ -42,7 +42,7 @@ struct VertexShaderConstants
float4 transformmatrices[64];
float4 normalmatrices[32];
float4 posttransformmatrices[64];
- float4 depthparams;
+ float4 pixelcentercorrection;
float4 stereoparams;
};
diff --git a/Source/Core/VideoCommon/ShaderGenCommon.h b/Source/Core/VideoCommon/ShaderGenCommon.h
index 330b9f8ced..4d22048ee6 100644
--- a/Source/Core/VideoCommon/ShaderGenCommon.h
+++ b/Source/Core/VideoCommon/ShaderGenCommon.h
@@ -238,7 +238,7 @@ private:
#define I_TRANSFORMMATRICES "ctrmtx"
#define I_NORMALMATRICES "cnmtx"
#define I_POSTTRANSFORMMATRICES "cpostmtx"
-#define I_DEPTHPARAMS "cDepth" // farZ, zRange
+#define I_PIXELCENTERCORRECTION "cpixelcenter"
#define I_STEREOPARAMS "cstereo"
static const char s_shader_uniforms[] =
@@ -250,5 +250,5 @@ static const char s_shader_uniforms[] =
"\tfloat4 " I_TRANSFORMMATRICES"[64];\n"
"\tfloat4 " I_NORMALMATRICES"[32];\n"
"\tfloat4 " I_POSTTRANSFORMMATRICES"[64];\n"
- "\tfloat4 " I_DEPTHPARAMS";\n"
+ "\tfloat4 " I_PIXELCENTERCORRECTION";\n"
"\tfloat4 " I_STEREOPARAMS";\n";
diff --git a/Source/Core/VideoCommon/VertexShaderGen.cpp b/Source/Core/VideoCommon/VertexShaderGen.cpp
index c0faf21000..26d6942372 100644
--- a/Source/Core/VideoCommon/VertexShaderGen.cpp
+++ b/Source/Core/VideoCommon/VertexShaderGen.cpp
@@ -430,7 +430,7 @@ static inline void GenerateVertexShader(T& out, u32 components, API_TYPE api_typ
// which in turn can be critical if it happens for clear quads.
// Hence, we compensate for this pixel center difference so that primitives
// get rasterized correctly.
- out.Write("o.pos.xy = o.pos.xy - " I_DEPTHPARAMS".zw;\n");
+ out.Write("o.pos.xy = o.pos.xy - " I_PIXELCENTERCORRECTION".xy;\n");
if (api_type == API_OPENGL)
{
diff --git a/Source/Core/VideoCommon/VertexShaderManager.cpp b/Source/Core/VideoCommon/VertexShaderManager.cpp
index 8de50c5436..2d496cb50c 100644
--- a/Source/Core/VideoCommon/VertexShaderManager.cpp
+++ b/Source/Core/VideoCommon/VertexShaderManager.cpp
@@ -359,8 +359,6 @@ void VertexShaderManager::SetConstants()
if (bViewportChanged)
{
bViewportChanged = false;
- constants.depthparams[0] = xfmem.viewport.farZ / 16777216.0f;
- constants.depthparams[1] = xfmem.viewport.zRange / 16777216.0f;
// The console GPU places the pixel center at 7/12 unless antialiasing
// is enabled, while D3D and OpenGL place it at 0.5. See the comment
@@ -370,8 +368,8 @@ void VertexShaderManager::SetConstants()
const float pixel_center_correction = 7.0f / 12.0f - 0.5f;
const float pixel_size_x = 2.f / Renderer::EFBToScaledXf(2.f * xfmem.viewport.wd);
const float pixel_size_y = 2.f / Renderer::EFBToScaledXf(2.f * xfmem.viewport.ht);
- constants.depthparams[2] = pixel_center_correction * pixel_size_x;
- constants.depthparams[3] = pixel_center_correction * pixel_size_y;
+ constants.pixelcentercorrection[0] = pixel_center_correction * pixel_size_x;
+ constants.pixelcentercorrection[1] = pixel_center_correction * pixel_size_y;
dirty = true;
// This is so implementation-dependent that we can't have it here.
g_renderer->SetViewport();