[Piglit] [PATCH] glsl-version-define-130: New test for glsl 1.30 existence and __VERSION__ reflecting glsl 1.30.
Zhao, Jian J
jian.j.zhao at intel.com
Tue Nov 29 00:43:22 PST 2011
> -----Original Message-----
> From: Ian Romanick [mailto:idr at freedesktop.org]
> Sent: Tuesday, November 29, 2011 7:34 AM
> To: Zhao, Jian J
> Cc: piglit at lists.freedesktop.org
> Subject: Re: [PATCH] glsl-version-define-130: New test for glsl 1.30 existence
> and __VERSION__ reflecting glsl 1.30.
>
> 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.
Hi Ian,
Thanks for your comment.
But I think the __VERSION__ should be the version we specified by #version xxx, and in my case it should always be 130 no matter the driver support glsl 130 or higher because it is set to 130 by #version 130. Am I misunderstood the spec?
>
> 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.
Yes. We can also add another test case to get the driver's capability whatever the #version statement is. Now I have an update on the previous test case that dropped some deprecated variables. And I will add another test case for the driver's capability in glsl later. Thanks.
Best regards
ZhaoJian
>
> Also, both vertex shaders and fragment shaders should be tested.
More information about the Piglit
mailing list