Commit 7bc079c2 by Nicolas Capens Committed by Nicolas Capens

Fix clamping depth output to [0, 1] range.

OpenGL ES 3.0 specifies that "For fixed-point depth buffers, the final fragment depth written by a fragment shader is first clamped to [0, 1] and then converted to fixed-point as if it were a window z value (see section 2.13.1). For floating-point depth buffers, conversion is not performed but clamping is." Change-Id: Ic7f22f7e47106aaa86c4916fbbbe23ad9c52e186 Reviewed-on: https://swiftshader-review.googlesource.com/15628Tested-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent e70208e4
......@@ -256,15 +256,15 @@ namespace sw
}
}
}
}
Bool PixelPipeline::alphaTest(Int cMask[4])
{
current.x = Min(current.x, Short4(0x0FFF)); current.x = Max(current.x, Short4(0x0000));
current.y = Min(current.y, Short4(0x0FFF)); current.y = Max(current.y, Short4(0x0000));
current.z = Min(current.z, Short4(0x0FFF)); current.z = Max(current.z, Short4(0x0000));
current.w = Min(current.w, Short4(0x0FFF)); current.w = Max(current.w, Short4(0x0000));
}
Bool PixelPipeline::alphaTest(Int cMask[4])
{
if(!state.alphaTestActive())
{
return true;
......
......@@ -525,12 +525,17 @@ namespace sw
c[i] = oC[i];
}
}
clampColor(c);
if(state.depthOverride)
{
oDepth = Min(Max(oDepth, Float4(0.0f)), Float4(1.0f));
}
}
Bool PixelProgram::alphaTest(Int cMask[4])
{
clampColor(c);
if(!state.alphaTestActive())
{
return true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment