On 19 September 2011 10:49, Ian Romanick <span dir="ltr"><<a href="mailto:idr@freedesktop.org">idr@freedesktop.org</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
-----BEGIN PGP SIGNED MESSAGE-----<br>
Hash: SHA1<br>
<div class="im"><br>
On 09/13/2011 02:54 PM, Paul Berry wrote:<br>
> The clipping tests previously in Piglit only tested the first 6<br>
> clipping planes, since prior to GLSL 1.30, a conforming<br>
> implementation was allowed to only support 6 clipping planes.<br>
> However, in GLSL 1.30, the minimum value of gl_MaxClipDistances and<br>
> gl_MaxClipPlanes was increased to 8.<br>
><br>
> This patch adds tests to verify that if the implementation reports<br>
> a GLSL version of at least 1.30, gl_MaxClipDistances and<br>
> gl_MaxClipPlanes are both at least 8. It also modifies<br>
> vs-clip-distance-all-planes-enabled.shader_test to exercise all 8<br>
> clipping planes.<br>
><br>
> The previous implementation of<br>
> vs-clip-distance-all-planes-enabled.shader_test used to also<br>
> verify, as a side effect, that gl_ClipDistance could be implicitly<br>
> sized. The new version does not (it requires gl_ClipDistance to be<br>
> explicitly sized, since it indexes into it using a loop variable).<br>
> So I've added a new test,<br>
> vs-clip-distance-implicitly-sized.shader_test, to verify this.<br>
><br>
> Tested using the nVidia proprietary Linux driver.<br>
<br>
</div>I made some comments about max-clip-distances.shader_test (which also<br>
apply to max-clip-planes.shader_test) below.<br>
<br>
The changes to shader_runner and the other tests look fine. You can<br>
consider them<br>
<br>
Reviewed-by: Ian Romanick <<a href="mailto:ian.d.romanick@intel.com">ian.d.romanick@intel.com</a>><br>
<br>
if you want to split them out and push them sooner rather than later.<br>
<br>
> --- tests/shaders/shader_runner.c | 2 +<br>
<div><div></div><div class="h5">> .../clipping/max-clip-distances.shader_test | 54<br>
> ++++++++++++++ .../execution/clipping/max-clip-planes.shader_test |<br>
> 54 ++++++++++++++<br>
> ...vs-clip-distance-all-planes-enabled.shader_test | 76<br>
> ++++++++++----------<br>
> .../vs-clip-distance-implicitly-sized.shader_test | 67<br>
> +++++++++++++++++ tests/util/glew.h<br>
> | 2 + 6 files changed, 218 insertions(+), 37 deletions(-) create<br>
> mode 100644<br>
> tests/spec/glsl-1.30/execution/clipping/max-clip-distances.shader_test<br>
><br>
><br>
create mode 100644<br>
tests/spec/glsl-1.30/execution/clipping/max-clip-planes.shader_test<br>
> create mode 100644<br>
> tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-implicitly-sized.shader_test<br>
><br>
> diff --git a/tests/shaders/shader_runner.c<br>
> b/tests/shaders/shader_runner.c index cde5ae3..a46ea4d 100644 ---<br>
> a/tests/shaders/shader_runner.c +++<br>
> b/tests/shaders/shader_runner.c @@ -819,6 +819,8 @@ struct<br>
> enable_table { { "GL_CLIP_PLANE3", GL_CLIP_PLANE3 }, {<br>
> "GL_CLIP_PLANE4", GL_CLIP_PLANE4 }, { "GL_CLIP_PLANE5",<br>
> GL_CLIP_PLANE5 }, + { "GL_CLIP_PLANE6", GL_CLIP_PLANE6 }, + {<br>
> "GL_CLIP_PLANE7", GL_CLIP_PLANE7 }, { NULL, 0 } };<br>
><br>
> diff --git<br>
> a/tests/spec/glsl-1.30/execution/clipping/max-clip-distances.shader_test<br>
> b/tests/spec/glsl-1.30/execution/clipping/max-clip-distances.shader_test<br>
><br>
><br>
new file mode 100644<br>
> index 0000000..d593fbf --- /dev/null +++<br>
> b/tests/spec/glsl-1.30/execution/clipping/max-clip-distances.shader_test<br>
><br>
><br>
@@ -0,0 +1,54 @@<br>
> +# [description] +# Verify correct behavior of<br>
> gl_MaxClipDistances. +# +# From section the GLSL 1.30 spec, section<br>
> 7.4 (Built-In Constants): +# +# "The following built-in constants<br>
> are provided to vertex and +# fragment shaders. The actual values<br>
> used are implementation +# dependent, but must be at least the<br>
> value shown. +# +# ... +# +# const int gl_MaxClipDistances =<br>
> 8;" +# +# This test verifies that gl_MaxClipDistances has the same<br>
> value in +# both the vertex and fragment shader, and that this<br>
> value is at least +# 8. + +[require] +GLSL >= 1.30 + +[vertex<br>
> shader] +#version 130 + +out float maxClipDistances; + +void<br>
> main() +{ + gl_Position = gl_Vertex; + + maxClipDistances =<br>
> gl_MaxClipDistances; +} + +[fragment shader] +#version 130 + +in<br>
> float maxClipDistances; + +void main() +{ + if (maxClipDistances !=<br>
> gl_MaxClipDistances) {<br>
<br>
</div></div>This is valid, but probably not what we actually want. Shouldn't we<br>
pass maxClipDistances as an int? It means that the 'flat'<br>
interpolation qualifier will have to be used, and that may cause the<br>
test to fail on Mesa now even though we set gl_MaxClipDistances correctly.<br></blockquote><div><br>Hmm, yeah, using ints and the 'flat' qualifier would be a better way to do this. You're right that this causes the tests to fail right now on Mesa. I assume this is because passing 'int' data between VS and FS doesn't work properly yet?<br>
</div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br>
Also, this test is really checking that gl_MaxClipDistances is set the<br>
same in the VS and FS. I'm not sure how useful that is. It seems<br>
like we want to query GL_MAX_CLIP_DISTANCES from the API and pass that<br>
as a uniform. Maybe that's an additional test?<br></blockquote><div><br>You're right--this would be more useful. Ok, I'll commit the tests that got your Reviewed-by, and I'll submit a follow-up patch to test that GL_MAX_CLIP_DISTANCES matches the value of gl_MaxClipDistances in both the VS and FS.<br>
<br>Paul<br></div></div>