There are a bunch of generated tests for this extension (in
generated_tests/spec/AMD_shader_trinary_minmax/).  Since these are
specifically testing cases with constants, I'd rename these
mid3-with-constants.shader_test.

On 04/30/2014 02:28 AM, Petri Latvala wrote:
> Signed-off-by: Petri Latvala <petri.latv...@intel.com>
> ---
> 
> These three tests are very simple tests for
> GL_AMD_shader_trinary_minmax functions that I used for
> regression-testing Mesa optimizations when constants are involved in
> the calls.
> 
> Tested on Mesa/Haswell, the tests pass.

The above text should go in the commit message.

Other than that, I think these tests are fine.

Reviewed-by: Ian Romanick <ian.d.roman...@intel.com>

> I will need someone to push this if it's accepted.
> 
> 
>  tests/all.py                                       |  3 ++
>  .../execution/max3-basic.shader_test               | 50 
> ++++++++++++++++++++++
>  .../execution/mid3-basic.shader_test               | 50 
> ++++++++++++++++++++++
>  .../execution/min3-basic.shader_test               | 50 
> ++++++++++++++++++++++
>  4 files changed, 153 insertions(+)
>  create mode 100644 
> tests/spec/amd_shader_trinary_minmax/execution/max3-basic.shader_test
>  create mode 100644 
> tests/spec/amd_shader_trinary_minmax/execution/mid3-basic.shader_test
>  create mode 100644 
> tests/spec/amd_shader_trinary_minmax/execution/min3-basic.shader_test
> 
> diff --git a/tests/all.py b/tests/all.py
> index 553ae76..a67e725 100644
> --- a/tests/all.py
> +++ b/tests/all.py
> @@ -1434,6 +1434,9 @@ spec['AMD_shader_trinary_minmax'] = {}
>  import_glsl_parser_tests(spec['AMD_shader_trinary_minmax'],
>                        os.path.join(testsDir, 'spec', 
> 'amd_shader_trinary_minmax'),
>                        [''])
> +add_shader_test_dir(spec['AMD_shader_trinary_minmax'],
> +                    os.path.join(testsDir, 'spec', 
> 'amd_shader_trinary_minmax'),
> +                    recursive=True)
>  
>  # Group ARB_point_sprite
>  arb_point_sprite = {}
> diff --git 
> a/tests/spec/amd_shader_trinary_minmax/execution/max3-basic.shader_test 
> b/tests/spec/amd_shader_trinary_minmax/execution/max3-basic.shader_test
> new file mode 100644
> index 0000000..be28d7b
> --- /dev/null
> +++ b/tests/spec/amd_shader_trinary_minmax/execution/max3-basic.shader_test
> @@ -0,0 +1,50 @@
> +[require]
> +GLSL >= 1.10
> +GL_AMD_shader_trinary_minmax
> +
> +[vertex shader passthrough]
> +
> +[fragment shader]
> +
> +#extension GL_AMD_shader_trinary_minmax : require
> +
> +uniform float zero;
> +uniform float one;
> +uniform float middle;
> +
> +float test_all_constants()
> +{
> +     return max3(0.0, 1.0, 0.5);
> +}
> +
> +float test_two_constants()
> +{
> +     return max3(0.5, one, 0.0);
> +}
> +
> +float test_one_constant()
> +{
> +     return max3(one, zero, 0.5);
> +}
> +
> +float test_no_constants()
> +{
> +     return max3(middle, one, zero);
> +}
> +
> +void main()
> +{
> +     float r = test_all_constants();
> +     float g = test_two_constants();
> +     float b = test_one_constant();
> +     float a = test_no_constants();
> +
> +     gl_FragColor = vec4(r, g, b, a);
> +}
> +
> +[test]
> +uniform float zero 0.0
> +uniform float one 1.0
> +uniform float middle 0.5
> +draw rect -1 -1 2 2
> +probe all rgba 1.0 1.0 1.0 1.0
> diff --git 
> a/tests/spec/amd_shader_trinary_minmax/execution/mid3-basic.shader_test 
> b/tests/spec/amd_shader_trinary_minmax/execution/mid3-basic.shader_test
> new file mode 100644
> index 0000000..719f138
> --- /dev/null
> +++ b/tests/spec/amd_shader_trinary_minmax/execution/mid3-basic.shader_test
> @@ -0,0 +1,50 @@
> +[require]
> +GLSL >= 1.10
> +GL_AMD_shader_trinary_minmax
> +
> +[vertex shader passthrough]
> +
> +[fragment shader]
> +
> +#extension GL_AMD_shader_trinary_minmax : require
> +
> +uniform float zero;
> +uniform float one;
> +uniform float middle;
> +
> +float test_all_constants()
> +{
> +     return mid3(0.0, 1.0, 0.5);
> +}
> +
> +float test_two_constants()
> +{
> +     return mid3(0.5, one, 0.0);
> +}
> +
> +float test_one_constant()
> +{
> +     return mid3(one, zero, 0.5);
> +}
> +
> +float test_no_constants()
> +{
> +     return mid3(middle, one, zero);
> +}
> +
> +void main()
> +{
> +     float r = test_all_constants();
> +     float g = test_two_constants();
> +     float b = test_one_constant();
> +     float a = test_no_constants();
> +
> +     gl_FragColor = vec4(r, g, b, a);
> +}
> +
> +[test]
> +uniform float zero 0.0
> +uniform float one 1.0
> +uniform float middle 0.5
> +draw rect -1 -1 2 2
> +probe all rgba 0.5 0.5 0.5 0.5
> diff --git 
> a/tests/spec/amd_shader_trinary_minmax/execution/min3-basic.shader_test 
> b/tests/spec/amd_shader_trinary_minmax/execution/min3-basic.shader_test
> new file mode 100644
> index 0000000..3589b8e
> --- /dev/null
> +++ b/tests/spec/amd_shader_trinary_minmax/execution/min3-basic.shader_test
> @@ -0,0 +1,50 @@
> +[require]
> +GLSL >= 1.10
> +GL_AMD_shader_trinary_minmax
> +
> +[vertex shader passthrough]
> +
> +[fragment shader]
> +
> +#extension GL_AMD_shader_trinary_minmax : require
> +
> +uniform float zero;
> +uniform float one;
> +uniform float middle;
> +
> +float test_all_constants()
> +{
> +     return min3(0.0, 1.0, 0.5);
> +}
> +
> +float test_two_constants()
> +{
> +     return min3(0.5, one, 0.0);
> +}
> +
> +float test_one_constant()
> +{
> +     return min3(one, zero, 0.5);
> +}
> +
> +float test_no_constants()
> +{
> +     return min3(middle, one, zero);
> +}
> +
> +void main()
> +{
> +     float r = test_all_constants();
> +     float g = test_two_constants();
> +     float b = test_one_constant();
> +     float a = test_no_constants();
> +
> +     gl_FragColor = vec4(r, g, b, a);
> +}
> +
> +[test]
> +uniform float zero 0.0
> +uniform float one 1.0
> +uniform float middle 0.5
> +draw rect -1 -1 2 2
> +probe all rgba 0.0 0.0 0.0 0.0
> 

_______________________________________________
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to