VertexShaderManager: Break up the conditions to make it readable.
This commit is contained in:
parent
f866748006
commit
271a9fe7a9
|
@ -387,42 +387,45 @@ void VertexShaderManager::SetConstants()
|
||||||
constants.pixelcentercorrection[0] = pixel_center_correction * pixel_size_x;
|
constants.pixelcentercorrection[0] = pixel_center_correction * pixel_size_x;
|
||||||
constants.pixelcentercorrection[1] = pixel_center_correction * pixel_size_y;
|
constants.pixelcentercorrection[1] = pixel_center_correction * pixel_size_y;
|
||||||
|
|
||||||
if (g_ActiveConfig.backend_info.bSupportsDepthClamp &&
|
// By default we don't change the depth value at all in the vertex shader.
|
||||||
((fabs(xfmem.viewport.zRange) > 16777215.0f || fabs(xfmem.viewport.farZ) > 16777215.0f) ||
|
constants.pixelcentercorrection[2] = 1.0f;
|
||||||
(xfmem.viewport.zRange < 0.0f &&
|
constants.pixelcentercorrection[3] = 0.0f;
|
||||||
!g_ActiveConfig.backend_info.bSupportsReversedDepthRange)))
|
|
||||||
|
if (g_ActiveConfig.backend_info.bSupportsDepthClamp)
|
||||||
{
|
{
|
||||||
// The depth range is handled in the vertex shader. We need to reverse
|
// Oversized depth ranges are handled in the vertex shader. We need to reverse
|
||||||
// the far value to get a reversed depth range mapping. This is necessary
|
// the far value to get a reversed depth range mapping. This is necessary
|
||||||
// because the standard depth range equation pushes all depth values towards
|
// because the standard depth range equation pushes all depth values towards
|
||||||
// the back of the depth buffer where conventionally depth buffers have the
|
// the back of the depth buffer where conventionally depth buffers have the
|
||||||
// least precision.
|
// least precision.
|
||||||
if (g_ActiveConfig.backend_info.bSupportsReversedDepthRange)
|
if (g_ActiveConfig.backend_info.bSupportsReversedDepthRange)
|
||||||
{
|
{
|
||||||
// For backends that support reversing the depth range we also support cases
|
if (fabs(xfmem.viewport.zRange) > 16777215.0f || fabs(xfmem.viewport.farZ) > 16777215.0f)
|
||||||
// where the console also uses reversed depth with the same accuracy. We need
|
{
|
||||||
// to make sure the depth range is positive here and then reverse the depth in
|
// For backends that support reversing the depth range we also support cases
|
||||||
// the backend viewport.
|
// where the console also uses reversed depth with the same accuracy. We need
|
||||||
constants.pixelcentercorrection[2] = fabs(xfmem.viewport.zRange) / 16777215.0f;
|
// to make sure the depth range is positive here and then reverse the depth in
|
||||||
if (xfmem.viewport.zRange < 0.0f)
|
// the backend viewport.
|
||||||
constants.pixelcentercorrection[3] = xfmem.viewport.farZ / 16777215.0f;
|
constants.pixelcentercorrection[2] = fabs(xfmem.viewport.zRange) / 16777215.0f;
|
||||||
else
|
if (xfmem.viewport.zRange < 0.0f)
|
||||||
constants.pixelcentercorrection[3] = 1.0f - xfmem.viewport.farZ / 16777215.0f;
|
constants.pixelcentercorrection[3] = xfmem.viewport.farZ / 16777215.0f;
|
||||||
|
else
|
||||||
|
constants.pixelcentercorrection[3] = 1.0f - xfmem.viewport.farZ / 16777215.0f;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// For backends that don't support reversing the depth range we can still render
|
if (xfmem.viewport.zRange < 0.0f || xfmem.viewport.zRange > 16777215.0f ||
|
||||||
// cases where the console uses reversed depth correctly. But we simply can't
|
fabs(xfmem.viewport.farZ) > 16777215.0f)
|
||||||
// provide the same accuracy as the console.
|
{
|
||||||
constants.pixelcentercorrection[2] = xfmem.viewport.zRange / 16777215.0f;
|
// For backends that don't support reversing the depth range we can still render
|
||||||
constants.pixelcentercorrection[3] = 1.0f - xfmem.viewport.farZ / 16777215.0f;
|
// cases where the console uses reversed depth correctly. But we simply can't
|
||||||
|
// provide the same accuracy as the console.
|
||||||
|
constants.pixelcentercorrection[2] = xfmem.viewport.zRange / 16777215.0f;
|
||||||
|
constants.pixelcentercorrection[3] = 1.0f - xfmem.viewport.farZ / 16777215.0f;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
constants.pixelcentercorrection[2] = 1.0f;
|
|
||||||
constants.pixelcentercorrection[3] = 0.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
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.
|
||||||
|
|
Loading…
Reference in New Issue