[Piglit] [PATCH 1/8] arb_gpu_shader5: Add frexp fragment shader execution test.

Ian Romanick idr at freedesktop.org
Fri Aug 23 09:03:10 PDT 2013


On 08/22/2013 04:07 PM, Matt Turner wrote:
> ---
>   .../built-in-functions/fs-frexp.shader_test        | 64 ++++++++++++++++++++++
>   1 file changed, 64 insertions(+)
>   create mode 100644 tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-frexp.shader_test
>
> diff --git a/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-frexp.shader_test b/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-frexp.shader_test
> new file mode 100644
> index 0000000..2bef71d
> --- /dev/null
> +++ b/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-frexp.shader_test
> @@ -0,0 +1,64 @@
> +[require]
> +GLSL >= 1.50
> +GL_ARB_gpu_shader5
> +
> +[vertex shader]
> +in vec4 vertex;
> +
> +void main() {
> +	gl_Position = vertex;
> +}
> +
> +[fragment shader]
> +#extension GL_ARB_gpu_shader5 : enable
> +
> +out vec4 color;
> +
> +uniform vec4 given_float;
> +uniform vec4 expected_mantissa;
> +uniform ivec4 expected_exponent;
> +
> +void main()
> +{
> +	/* Green if both pass. */
> +	color = vec4(0.0, 1.0, 0.0, 1.0);
> +
> +	ivec4 exponent;
> +	vec4 mantissa;
> +
> +	mantissa = frexp(given_float, exponent);
> +
> +	if (mantissa != expected_mantissa) {
> +		color.r = 1.0;
> +	}
> +
> +	if (exponent != expected_exponent) {
> +		color.b = 1.0;
> +	}
> +}
> +
> +[vertex data]
> +vertex/float/2
> +-1.0 -1.0
> + 1.0 -1.0
> + 1.0  1.0
> +-1.0  1.0
> +
> +[test]
> +uniform vec4 given_float 0.0 -0.0 0.5 -0.5
> +uniform vec4 expected_mantissa 0.0 -0.0 0.5 -0.5
> +uniform ivec4 expected_exponent 0 0 0 0
> +draw arrays GL_TRIANGLE_FAN 0 4

draw rect -1 -1 2 2

... in all the tests.

> +probe all rgba 0.0 1.0 0.0 1.0
> +
> +uniform vec4 given_float 0.49 1.0 25.0 100
> +uniform vec4 expected_mantissa 0.98 0.5 0.78125 0.78125
> +uniform ivec4 expected_exponent -1 1 5 7
> +draw arrays GL_TRIANGLE_FAN 0 4
> +probe all rgba 0.0 1.0 0.0 1.0
> +
> +uniform vec4 given_float 1.1754944e-38 -1.1754944e-38 3.40282347e38 -3.40282347e38
> +uniform vec4 expected_mantissa 0.5 -0.5 0.999999940 -0.999999940
> +uniform ivec4 expected_exponent -125 -125 128 128
> +draw arrays GL_TRIANGLE_FAN 0 4
> +probe all rgba 0.0 1.0 0.0 1.0
>



More information about the Piglit mailing list