[Piglit] [PATCH 1/4] glsl-1.10: Add test for bug in i965 gl_FrontFacing optimization

Chris Forbes chrisf at ijw.co.nz
Tue Mar 17 17:25:03 PDT 2015


For the series:

Reviewed-by: Chris Forbes <chrisf at ijw.co.nz>

On Wed, Mar 18, 2015 at 10:51 AM, Ian Romanick <idr at freedesktop.org> wrote:
> From: Ian Romanick <ian.d.romanick at intel.com>
>
> These patterns
>
>     gl_FrontFacing ? -1.0 :  1.0
>     gl_FrontFacing ?  1.0 : -1.0
>     gl_FrontFacing ?  0.0 : -1.0
>
> are recognized and optimized by the i965 driver.  However, it
> incorrectly optimizes
>
>     int x = gl_FrontFacing ? 1 : -1;
>
> as
>
>     int x = gl_FrontFacing ? floatBitsToInt(1.0) : floatBitsToInt(-1.0);
>
> NOTE: This test currently fails on Mesa master and 10.5 branches.
>
> v2: Add missing ] on vertex passthrough line.  Noticed by Emil.
>
> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
> ---
>  .../fs-frontfacing-ternary-1-neg-1.shader_test     | 32 ++++++++++++++++++++++
>  1 file changed, 32 insertions(+)
>  create mode 100644 tests/spec/glsl-1.10/execution/fs-frontfacing-ternary-1-neg-1.shader_test
>
> diff --git a/tests/spec/glsl-1.10/execution/fs-frontfacing-ternary-1-neg-1.shader_test b/tests/spec/glsl-1.10/execution/fs-frontfacing-ternary-1-neg-1.shader_test
> new file mode 100644
> index 0000000..a6590c1
> --- /dev/null
> +++ b/tests/spec/glsl-1.10/execution/fs-frontfacing-ternary-1-neg-1.shader_test
> @@ -0,0 +1,32 @@
> +[require]
> +GLSL >= 1.10
> +
> +[vertex shader passthrough]
> +
> +[fragment shader]
> +uniform int front;
> +uniform int back;
> +
> +const vec4 c = vec4(1.0, 0.0, 0.0, 0.0);
> +void main()
> +{
> +       int f = gl_FrontFacing ? 1 : -1;
> +       if (f == front) {
> +               gl_FragColor = c.yxyx;
> +       } else if (f == back) {
> +               gl_FragColor = c.yyxx;
> +       } else {
> +               gl_FragColor = c.xyyx;
> +       }
> +}
> +
> +[test]
> +uniform int front 1
> +uniform int back -1
> +
> +draw rect -1 -1 2 1
> +draw rect 1 0 -2 1
> +relative probe rgba (0, 0) (0.0, 1.0, 0.0, 1.0)
> +relative probe rgba (1, 0) (0.0, 1.0, 0.0, 1.0)
> +relative probe rgba (0, 1) (0.0, 0.0, 1.0, 1.0)
> +relative probe rgba (1, 1) (0.0, 0.0, 1.0, 1.0)
> --
> 2.1.0
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit


More information about the Piglit mailing list