[Piglit] [PATCH] shaders: Verify that -int(some_bool) & value is handled correctly

Jason Ekstrand jason at jlekstrand.net
Tue Dec 18 22:01:03 UTC 2018


On Tue, Dec 18, 2018 at 3:56 PM Ian Romanick <idr at freedesktop.org> wrote:

> From: Ian Romanick <ian.d.romanick at intel.com>
>
> This reproduces bug #109075.  In that bug, '-int(XYZ) & anything' was
> optimized as though it were '-int(XYZ) & floatBitsToInt(1.0)'.
>
> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109075
> ---
>  ...glsl-fs-bitwise-and-Boolean-and-1.0.shader_test | 32
> ++++++++++++++++++++++
>  1 file changed, 32 insertions(+)
>  create mode 100644
> tests/shaders/glsl-fs-bitwise-and-Boolean-and-1.0.shader_test
>
> diff --git a/tests/shaders/glsl-fs-bitwise-and-Boolean-and-1.0.shader_test
> b/tests/shaders/glsl-fs-bitwise-and-Boolean-and-1.0.shader_test
> new file mode 100644
> index 000000000..e59656326
> --- /dev/null
> +++ b/tests/shaders/glsl-fs-bitwise-and-Boolean-and-1.0.shader_test
> @@ -0,0 +1,32 @@
> +[require]
> +GLSL >= 1.30
> +GL_ARB_shader_bit_encoding
> +
> +[vertex shader passthrough]
> +
> +[fragment shader]
> +#extension GL_ARB_shader_bit_encoding: enable
> +
> +out vec4 piglit_fragcolor;
> +
> +uniform int x = 37;
> +uniform int y = 46;
>

Wow.  I think this may be the best use I've ever seen of uniform
initializers. :-)

Seems to do the thing in the bug.

Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>


> +
> +void main()
> +{
> +    bool a = x == 37;    // Must be true.
> +    bool b = y == 46;    // Must be true.
> +
> +    /* This reproduces bug #109075.  In that bug, '-int(XYZ) & anything'
> was
> +     * optimized as though it were '-int(XYZ) & floatBitsToInt(1.0)'.
> +     */
> +    piglit_fragcolor = vec4(intBitsToFloat(-int(a) & floatBitsToInt(0.5)),
> +                           intBitsToFloat(-int(b) & floatBitsToInt(0.5)),
> +                           0.0,
> +                           1.0);
> +}
> +
> +[test]
> +draw rect -1 -1 2 2
> +probe all rgba 0.5 0.5 0.0 1.0
> +
> --
> 2.14.5
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/piglit/attachments/20181218/a1f9e802/attachment.html>


More information about the Piglit mailing list