[Piglit] [PATCH] glsl-version-define-130: New test for glsl 1.30 existence and __VERSION__ reflecting glsl 1.30.

Ian Romanick idr at freedesktop.org
Mon Nov 28 15:33:34 PST 2011


On 11/28/2011 12:45 AM, jian.j.zhao at intel.com wrote:
> From: Jian Zhao<jian.j.zhao at intel.com>
>
> ---
>   tests/shaders/glsl-version-define-130.shader_test |   20 ++++++++++++++++++++
>   1 files changed, 20 insertions(+), 0 deletions(-)
>   create mode 100644 tests/shaders/glsl-version-define-130.shader_test
>
> diff --git a/tests/shaders/glsl-version-define-130.shader_test b/tests/shaders/glsl-version-define-130.shader_test
> new file mode 100644
> index 0000000..7dcfdd0
> --- /dev/null
> +++ b/tests/shaders/glsl-version-define-130.shader_test
> @@ -0,0 +1,20 @@
> +[require]
> +GLSL>= 1.30
> +
> +[vertex shader]
> +#version 130
> +void main()
> +{
> +	gl_Position = gl_Vertex;
> +}
> +
> +[fragment shader]
> +#version 130
> +void main()
> +{
> +	gl_FragColor = vec4(0.0, float(__VERSION__) / 130.0, 0.0, 0.0);
> +}
> +
> +[test]
> +draw rect -1 -1 2 2
> +probe rgba 1 1 0.0 1.0 0.0 0.0

There should also be a comment explaining why this test *should* pass 
even if __VERSION__ is greater than 130.  __VERSION__ is the highest 
language version that the compiler can support.  It's not necessarily 
the version used in the shader.

Page 7 of the GLSL 1.30 spec says:

     "This document specifies only version 1.30 of the OpenGL
     Shading Language. It requires __VERSION__ to substitute
     130, and requires #version to accept only 130. If #version
     is declared with 110 or 120, the language accepted is a
     previous version of the shading language, which will be
     supported depending on the version and type of context in
     the OpenGL API."

I think this might be a candidate for a C test.  The test should 
generate shaders that, regardless of the version declared by the 
#version statement, set __VERSION__ to the value specified by the 
glGetString(GL_SHADING_LANGUAGE_VERSION) query.

Also, both vertex shaders and fragment shaders should be tested.


More information about the Piglit mailing list