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.
This commit is contained in:
parent
1fe3d07cbd
commit
a886d8a8ee
|
@ -42,7 +42,7 @@ struct VertexShaderConstants
|
||||||
float4 transformmatrices[64];
|
float4 transformmatrices[64];
|
||||||
float4 normalmatrices[32];
|
float4 normalmatrices[32];
|
||||||
float4 posttransformmatrices[64];
|
float4 posttransformmatrices[64];
|
||||||
float4 depthparams;
|
float4 pixelcentercorrection;
|
||||||
float4 stereoparams;
|
float4 stereoparams;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -238,7 +238,7 @@ private:
|
||||||
#define I_TRANSFORMMATRICES "ctrmtx"
|
#define I_TRANSFORMMATRICES "ctrmtx"
|
||||||
#define I_NORMALMATRICES "cnmtx"
|
#define I_NORMALMATRICES "cnmtx"
|
||||||
#define I_POSTTRANSFORMMATRICES "cpostmtx"
|
#define I_POSTTRANSFORMMATRICES "cpostmtx"
|
||||||
#define I_DEPTHPARAMS "cDepth" // farZ, zRange
|
#define I_PIXELCENTERCORRECTION "cpixelcenter"
|
||||||
#define I_STEREOPARAMS "cstereo"
|
#define I_STEREOPARAMS "cstereo"
|
||||||
|
|
||||||
static const char s_shader_uniforms[] =
|
static const char s_shader_uniforms[] =
|
||||||
|
@ -250,5 +250,5 @@ static const char s_shader_uniforms[] =
|
||||||
"\tfloat4 " I_TRANSFORMMATRICES"[64];\n"
|
"\tfloat4 " I_TRANSFORMMATRICES"[64];\n"
|
||||||
"\tfloat4 " I_NORMALMATRICES"[32];\n"
|
"\tfloat4 " I_NORMALMATRICES"[32];\n"
|
||||||
"\tfloat4 " I_POSTTRANSFORMMATRICES"[64];\n"
|
"\tfloat4 " I_POSTTRANSFORMMATRICES"[64];\n"
|
||||||
"\tfloat4 " I_DEPTHPARAMS";\n"
|
"\tfloat4 " I_PIXELCENTERCORRECTION";\n"
|
||||||
"\tfloat4 " I_STEREOPARAMS";\n";
|
"\tfloat4 " I_STEREOPARAMS";\n";
|
||||||
|
|
|
@ -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.
|
// which in turn can be critical if it happens for clear quads.
|
||||||
// Hence, we compensate for this pixel center difference so that primitives
|
// Hence, we compensate for this pixel center difference so that primitives
|
||||||
// get rasterized correctly.
|
// 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)
|
if (api_type == API_OPENGL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -359,8 +359,6 @@ void VertexShaderManager::SetConstants()
|
||||||
if (bViewportChanged)
|
if (bViewportChanged)
|
||||||
{
|
{
|
||||||
bViewportChanged = false;
|
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
|
// 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
|
// 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_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_x = 2.f / Renderer::EFBToScaledXf(2.f * xfmem.viewport.wd);
|
||||||
const float pixel_size_y = 2.f / Renderer::EFBToScaledXf(2.f * xfmem.viewport.ht);
|
const float pixel_size_y = 2.f / Renderer::EFBToScaledXf(2.f * xfmem.viewport.ht);
|
||||||
constants.depthparams[2] = pixel_center_correction * pixel_size_x;
|
constants.pixelcentercorrection[0] = pixel_center_correction * pixel_size_x;
|
||||||
constants.depthparams[3] = pixel_center_correction * pixel_size_y;
|
constants.pixelcentercorrection[1] = pixel_center_correction * pixel_size_y;
|
||||||
dirty = true;
|
dirty = true;
|
||||||
// This is so implementation-dependent that we can't have it here.
|
// This is so implementation-dependent that we can't have it here.
|
||||||
g_renderer->SetViewport();
|
g_renderer->SetViewport();
|
||||||
|
|
Loading…
Reference in New Issue