<div dir="ltr">On 16 August 2013 12:08, Ian Romanick <span dir="ltr"><<a href="mailto:idr@freedesktop.org" target="_blank">idr@freedesktop.org</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">On 08/07/2013 12:09 PM, Paul Berry wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Previously, these tests used ARB_geometry_shader4. However, the<br>
initial implementation of geometry shaders in Mesa isn't going to<br>
support ARB_geometry_shader4. So test this functionality using GLSL<br>
1.50 geometry shaders instead.<br>
<br>
v2: Use a generic vertex attribute instead of gl_PositionIn.<br>
---<br>
tests/all.tests | 37 ++++++++++---<br>
tests/texturing/shaders/<u></u>common.c | 3 --<br>
tests/texturing/shaders/<u></u>texelFetch.c | 98 +++++++++++++++++++++---------<u></u>-----<br>
tests/texturing/shaders/<u></u>textureSize.c | 50 ++++++++++++------<br>
4 files changed, 123 insertions(+), 65 deletions(-)<br>
<br>
diff --git a/tests/all.tests b/tests/all.tests<br>
index 2f32120..cf24db6 100644<br>
--- a/tests/all.tests<br>
+++ b/tests/all.tests<br>
@@ -838,16 +838,29 @@ spec['glsl-1.30']['execution'] = Group()<br>
<br>
textureSize_samplers_130 = ['sampler1D', 'sampler2D', 'sampler3D', 'samplerCube', 'sampler1DShadow', 'sampler2DShadow', 'samplerCubeShadow', 'sampler1DArray', 'sampler2DArray', 'sampler1DArrayShadow', 'sampler2DArrayShadow', 'isampler1D', 'isampler2D', 'isampler3D', 'isamplerCube', 'isampler1DArray', 'isampler2DArray', 'usampler1D', 'usampler2D', 'usampler3D', 'usamplerCube', 'usampler1DArray', 'usampler2DArray']<br>
for stage in ['vs', 'gs', 'fs']:<br>
+ if stage == 'gs':<br>
+ version = '1.50'<br>
+ else:<br>
+ version = '1.30'<br>
# textureSize():<br>
for sampler in textureSize_samplers_130:<br>
- spec['glsl-1.30/execution/<u></u>textureSize/' + stage + '-textureSize-' + sampler] = concurrent_test('textureSize ' + stage + ' ' + sampler)<br>
+ spec['glsl-{0}/execution/<u></u>textureSize/{1}-textureSize-{<u></u>2}'.format(<br>
+ version, stage, sampler)] = concurrent_test(<br>
+ 'textureSize {0} {1}'.format(stage, sampler))<br>
# texelFetch():<br>
for sampler in ['sampler1D', 'sampler2D', 'sampler3D', 'sampler1DArray', 'sampler2DArray', 'isampler1D', 'isampler2D', 'isampler3D', 'isampler1DArray', 'isampler2DArray', 'usampler1D', 'usampler2D', 'usampler3D', 'usampler1DArray', 'usampler2DArray']:<br>
- spec['glsl-1.30/execution/<u></u>texelFetch/' + stage + '-texelFetch-' + sampler] = concurrent_test('texelFetch ' + stage + ' ' + sampler)<br>
- spec['glsl-1.30/execution/<u></u>texelFetchOffset/' + stage + '-' + sampler] = concurrent_test('texelFetch offset ' + stage + ' ' + sampler)<br>
+ spec['glsl-{0}/execution/<u></u>texelFetch/{1}-texelFetch-{2}'<u></u>.format(<br>
+ version, stage, sampler)] = concurrent_test(<br>
+ 'texelFetch {0} {1}'.format(stage, sampler))<br>
+ spec['glsl-{0}/execution/<u></u>texelFetchOffset/{1}-<u></u>texelFetch-{2}'.format(<br>
+ version, stage, sampler)] = concurrent_test(<br>
+ 'texelFetch offset {0} {1}'.format(stage, sampler))<br>
# texelFetch() with EXT_texture_swizzle mode "b0r1":<br>
for type in ['i', 'u', '']:<br>
- spec['glsl-1.30/execution/<u></u>texelFetch/' + stage + '-texelFetch-' + type + 'sampler2DArray-swizzle'] = concurrent_test('texelFetch ' + stage + ' ' + type + 'sampler2DArray b0r1')<br>
+ spec['glsl-{0}/execution/<u></u>texelFetch/{1}-texelFetch-{2}<u></u>sampler2Darray-swizzle'.<u></u>format(<br>
+ version, stage, type)] = concurrent_test(<br>
+ 'texelFetch {0} {1}sampler2DArray b0r1'.format(<br>
+ stage, type))<br>
<br>
</blockquote>
<br></div></div>
A bunch of the indentation in this hunk looks different. Is it actually different? Does that make Python angry?</blockquote><div><br></div><div>Oh, argh. It looks like all.tests doesn't follow PEP8 python indentation standards. I thought we took care of this a while ago, but I guess we just did it to the *.py files and forgot that all.tests is a python file in disguise.<br>
<br></div><div>Python 2 won't care about the differences. Python 3 will complain vociferously.<br><br></div><div>I'll do a follow-up patch that fixes the indentation in all.tests.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div class="h5"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
add_plain_test(spec['glsl-1.<u></u>30']['execution'], 'fs-texelFetch-2D')<br>
add_plain_test(spec['glsl-1.<u></u>30']['execution'], 'fs-texelFetchOffset-2D')<br>
@@ -885,13 +898,23 @@ spec['glsl-1.40']['execution']<u></u>['tf-no-position'] = concurrent_test('glsl-1.40-tf<br>
<br>
textureSize_samplers_140 = textureSize_samplers_130 + ['sampler2DRect', 'isampler2DRect', 'sampler2DRectShadow', 'samplerBuffer', 'isamplerBuffer', 'usamplerBuffer']<br>
for stage in ['vs', 'gs', 'fs']:<br>
+ if stage == 'gs':<br>
+ version = '1.50'<br>
+ else:<br>
+ version = '1.40'<br>
# textureSize():<br>
for sampler in textureSize_samplers_140:<br>
- spec['glsl-1.40/execution/<u></u>textureSize/' + stage + '-textureSize-' + sampler] = concurrent_test('textureSize 140 ' + stage + ' ' + sampler)<br>
+ spec['glsl-{0}/execution/<u></u>textureSize/{1}-textureSize-{<u></u>2}'.format(<br>
+ version, stage, sampler)] = concurrent_test(<br>
+ 'textureSize 140 {0} {1}'.format(stage, sampler))<br>
# texelFetch():<br>
for sampler in ['sampler2DRect', 'usampler2DRect', 'isampler2DRect']:<br>
- spec['glsl-1.40/execution/<u></u>texelFetch/' + stage + '-texelFetch-' + sampler] = concurrent_test('texelFetch 140 ' + stage + ' ' + sampler)<br>
- spec['glsl-1.40/execution/<u></u>texelFetchOffset/' + stage + '-' + sampler] = concurrent_test('texelFetch offset 140 ' + stage + ' ' + sampler)<br>
+ spec['glsl-{0}/execution/<u></u>texelFetch/{1}-texelFetch-{2}'<u></u>.format(<br>
+ version, stage, sampler)] = concurrent_test(<br>
+ 'texelFetch 140 {0} {1}'.format(stage, sampler))<br>
+ spec['glsl-{0}/execution/<u></u>texelFetchOffset/{1}-{2}'.<u></u>format(<br>
+ version, stage, sampler)] = concurrent_test(<br>
+ 'texelFetch offset 140 {0} {1}'.format(stage, sampler))<br>
<br>
spec['glsl-1.50'] = Group()<br>
import_glsl_parser_tests(spec[<u></u>'glsl-1.50'],<br>
diff --git a/tests/texturing/shaders/<u></u>common.c b/tests/texturing/shaders/<u></u>common.c<br>
index d374c62..ac85e7a 100644<br>
--- a/tests/texturing/shaders/<u></u>common.c<br>
+++ b/tests/texturing/shaders/<u></u>common.c<br>
@@ -333,9 +333,6 @@ require_GL_features(enum shader_target test_stage)<br>
<br>
piglit_require_GLSL_version(<u></u>shader_version);<br>
<br>
- if (test_stage == GS)<br>
- piglit_require_extension("GL_<u></u>ARB_geometry_shader4");<br>
-<br>
</blockquote>
<br></div></div>
Shouldn't this be replaced with a 3.2 requirement?</blockquote><div><br></div><div>This is already covered by the config blocks in texelFetch.c and textureSize.c (see below), which set config.supports_gl_compat_version = config.supports_gl_core_version = 32 when testing geometry shaders.<br>
</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
if (swizzling)<br>
piglit_require_extension("GL_<u></u>EXT_texture_swizzle");<br>
<br>
diff --git a/tests/texturing/shaders/<u></u>texelFetch.c b/tests/texturing/shaders/<u></u>texelFetch.c<br>
index 549c105..badaac7 100644<br>
--- a/tests/texturing/shaders/<u></u>texelFetch.c<br>
+++ b/tests/texturing/shaders/<u></u>texelFetch.c<br>
@@ -78,10 +78,20 @@<br>
*/<br>
#include "common.h"<br>
<br>
+void<br>
+parse_args(int argc, char **argv);<br>
+static enum shader_target test_stage = UNKNOWN;<br>
+<br>
PIGLIT_GL_TEST_CONFIG_BEGIN<br>
<br>
- config.supports_gl_compat_<u></u>version = 10;<br>
- config.supports_gl_core_<u></u>version = 31;<br>
+ parse_args(argc, argv);<br>
+ if (test_stage == GS) {<br>
+ config.supports_gl_compat_<u></u>version = 32;<br>
+ config.supports_gl_core_<u></u>version = 32;<br>
+ } else {<br>
+ config.supports_gl_compat_<u></u>version = 10;<br>
+ config.supports_gl_core_<u></u>version = 31;<br>
+ }<br>
<br>
config.window_width = 355;<br>
config.window_height = 350;<br>
@@ -628,25 +638,28 @@ generate_GLSL(enum shader_target test_stage)<br>
"in vec4 pos;\n"<br>
"in ivec4 texcoord;\n"<br>
"flat out ivec4 texcoord_to_gs;\n"<br>
+ "out vec4 pos_to_gs;\n"<br>
"void main()\n"<br>
"{\n"<br>
" texcoord_to_gs = texcoord;\n"<br>
- " gl_Position = pos;\n"<br>
+ " pos_to_gs = pos;\n"<br>
"}\n",<br>
shader_version);<br>
asprintf(&gs_code,<br>
"#version %d\n"<br>
- "#extension GL_ARB_geometry_shader4: require\n"<br>
"%s\n"<br>
"#define ivec1 int\n"<br>
+ "layout(points) in;\n"<br>
+ "layout(points, max_vertices = 1) out;\n"<br>
"flat out %s color;\n"<br>
"flat in ivec4 texcoord_to_gs[1];\n"<br>
+ "in vec4 pos_to_gs[1];\n"<br>
"uniform %s tex;\n"<br>
"void main()\n"<br>
"{\n"<br>
" ivec4 texcoord = texcoord_to_gs[0];\n"<br>
" color = texelFetch%s(tex, ivec%d(texcoord)%s%s);\n"<br>
- " gl_Position = gl_PositionIn[0];\n"<br>
+ " gl_Position = pos_to_gs[0];\n"<br>
" EmitVertex();\n"<br>
"}\n",<br>
shader_version,<br>
@@ -726,12 +739,8 @@ generate_GLSL(enum shader_target test_stage)<br>
}<br>
prog = glCreateProgram();<br>
glAttachShader(prog, vs);<br>
- if (gs_code) {<br>
+ if (gs_code)<br>
glAttachShader(prog, gs);<br>
- glProgramParameteri(prog, GL_GEOMETRY_INPUT_TYPE_ARB, GL_POINTS);<br>
- glProgramParameteri(prog, GL_GEOMETRY_OUTPUT_TYPE_ARB, GL_POINTS);<br>
- glProgramParameteri(prog, GL_GEOMETRY_VERTICES_OUT_ARB, 1);<br>
- }<br>
glAttachShader(prog, fs);<br>
<br>
glBindAttribLocation(prog, pos_loc, "pos");<br>
@@ -783,15 +792,15 @@ fail_and_show_usage()<br>
piglit_report_result(PIGLIT_<u></u>FAIL);<br>
}<br>
<br>
+<br>
void<br>
-piglit_init(int argc, char **argv)<br>
+parse_args(int argc, char **argv)<br>
{<br>
- int prog;<br>
- int tex_location;<br>
int i;<br>
- enum shader_target test_stage = UNKNOWN;<br>
bool sampler_found = false;<br>
<br>
+ sample_count = 0;<br>
+<br>
for (i = 1; i < argc; i++) {<br>
if (test_stage == UNKNOWN) {<br>
/* Maybe it's the shader stage? */<br>
@@ -823,30 +832,8 @@ piglit_init(int argc, char **argv)<br>
<br>
/* Maybe it's the sample count? */<br>
if (sampler_found && has_samples() && !sample_count) {<br>
- if ((sample_count = atoi(argv[i]))) {<br>
- /* check it */<br>
- GLint max_samples;<br>
-<br>
- if (sampler.data_type == GL_INT ||<br>
- sampler.data_type == GL_UNSIGNED_INT) {<br>
- glGetIntegerv(GL_MAX_INTEGER_<u></u>SAMPLES, &max_samples);<br>
- if (sample_count > max_samples) {<br>
- printf("Sample count of %d not supported,"<br>
- " >MAX_INTEGER_SAMPLES\n",<br>
- sample_count);<br>
- piglit_report_result(PIGLIT_<u></u>SKIP);<br>
- }<br>
- }<br>
- else {<br>
- glGetIntegerv(GL_MAX_SAMPLES, &max_samples);<br>
- if (sample_count > max_samples) {<br>
- printf("Sample count of %d not supported,"<br>
- " >MAX_SAMPLES\n",<br>
- sample_count);<br>
- piglit_report_result(PIGLIT_<u></u>SKIP);<br>
- }<br>
- }<br>
- }<br>
+ sample_count = atoi(argv[i]);<br>
+<br>
</blockquote>
<br></div></div>
This is deleting all the sample count validation. That seems unrelated. Was that intentional?<br>
<br>
Oh... wait. git diff just produced really ugly output. Never mind.<div class="HOEnZb"><div class="h5"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
continue;<br>
}<br>
<br>
@@ -859,6 +846,17 @@ piglit_init(int argc, char **argv)<br>
if (test_stage == UNKNOWN || !sampler_found)<br>
fail_and_show_usage();<br>
<br>
+ if (test_stage == GS && shader_version < 150)<br>
+ shader_version = 150;<br>
+}<br>
+<br>
+<br>
+void<br>
+piglit_init(int argc, char **argv)<br>
+{<br>
+ int prog;<br>
+ int tex_location;<br>
+<br>
if (!supported_sampler()) {<br>
printf("%s unsupported\n", <a href="http://sampler.name" target="_blank">sampler.name</a>);<br>
piglit_report_result(PIGLIT_<u></u>FAIL);<br>
@@ -866,6 +864,30 @@ piglit_init(int argc, char **argv)<br>
<br>
require_GL_features(test_<u></u>stage);<br>
<br>
+ if (sample_count) {<br>
+ /* check it */<br>
+ GLint max_samples;<br>
+<br>
+ if (sampler.data_type == GL_INT ||<br>
+ sampler.data_type == GL_UNSIGNED_INT) {<br>
+ glGetIntegerv(GL_MAX_INTEGER_<u></u>SAMPLES, &max_samples);<br>
+ if (sample_count > max_samples) {<br>
+ printf("Sample count of %d not supported,"<br>
+ " >MAX_INTEGER_SAMPLES\n",<br>
+ sample_count);<br>
+ piglit_report_result(PIGLIT_<u></u>SKIP);<br>
+ }<br>
+ } else {<br>
+ glGetIntegerv(GL_MAX_SAMPLES, &max_samples);<br>
+ if (sample_count > max_samples) {<br>
+ printf("Sample count of %d not supported,"<br>
+ " >MAX_SAMPLES\n",<br>
+ sample_count);<br>
+ piglit_report_result(PIGLIT_<u></u>SKIP);<br>
+ }<br>
+ }<br>
+ }<br>
+<br>
prog = generate_GLSL(test_stage);<br>
<br>
tex_location = glGetUniformLocation(prog, "tex");<br>
diff --git a/tests/texturing/shaders/<u></u>textureSize.c b/tests/texturing/shaders/<u></u>textureSize.c<br>
index 05187a3..f010d9c 100644<br>
--- a/tests/texturing/shaders/<u></u>textureSize.c<br>
+++ b/tests/texturing/shaders/<u></u>textureSize.c<br>
@@ -46,10 +46,20 @@<br>
*/<br>
#include "common.h"<br>
<br>
+void<br>
+parse_args(int argc, char **argv);<br>
+static enum shader_target test_stage = UNKNOWN;<br>
+<br>
PIGLIT_GL_TEST_CONFIG_BEGIN<br>
<br>
- config.supports_gl_compat_<u></u>version = 10;<br>
- config.supports_gl_core_<u></u>version = 31;<br>
+ parse_args(argc, argv);<br>
+ if (test_stage == GS) {<br>
+ config.supports_gl_compat_<u></u>version = 32;<br>
+ config.supports_gl_core_<u></u>version = 32;<br>
+ } else {<br>
+ config.supports_gl_compat_<u></u>version = 10;<br>
+ config.supports_gl_core_<u></u>version = 31;<br>
+ }<br>
<br>
config.window_width = 150;<br>
config.window_height = 30;<br>
@@ -282,24 +292,27 @@ generate_GLSL(enum shader_target test_stage)<br>
asprintf(&vs_code,<br>
"#version %d\n"<br>
"in vec4 vertex;\n"<br>
+ "out vec4 pos_to_gs;\n"<br>
"void main()\n"<br>
"{\n"<br>
- " gl_Position = vertex;\n"<br>
+ " pos_to_gs = vertex;\n"<br>
"}\n",<br>
shader_version);<br>
asprintf(&gs_code,<br>
"#version %d\n"<br>
- "#extension GL_ARB_geometry_shader4: require\n"<br>
"%s\n"<br>
"#define ivec1 int\n"<br>
+ "layout(triangles) in;\n"<br>
+ "layout(triangle_strip, max_vertices = 3) out;\n"<br>
"uniform int lod;\n"<br>
"uniform %s tex;\n"<br>
+ "in vec4 pos_to_gs[3];\n"<br>
"flat out ivec%d size;\n"<br>
"void main()\n"<br>
"{\n"<br>
" for (int i = 0; i < 3; i++) {\n"<br>
" size = textureSize(tex%s);\n"<br>
- " gl_Position = gl_PositionIn[i];\n"<br>
+ " gl_Position = pos_to_gs[i];\n"<br>
" EmitVertex();\n"<br>
" }\n"<br>
"}\n",<br>
@@ -354,14 +367,8 @@ generate_GLSL(enum shader_target test_stage)<br>
<br>
prog = glCreateProgram();<br>
glAttachShader(prog, vs);<br>
- if (gs_code) {<br>
+ if (gs_code)<br>
glAttachShader(prog, gs);<br>
- glProgramParameteri(prog, GL_GEOMETRY_INPUT_TYPE_ARB,<br>
- GL_TRIANGLES);<br>
- glProgramParameteri(prog, GL_GEOMETRY_OUTPUT_TYPE_ARB,<br>
- GL_TRIANGLE_STRIP);<br>
- glProgramParameteri(prog, GL_GEOMETRY_VERTICES_OUT_ARB, 3);<br>
- }<br>
glAttachShader(prog, fs);<br>
glLinkProgram(prog);<br>
if (!piglit_link_check_status(<u></u>prog))<br>
@@ -377,13 +384,11 @@ fail_and_show_usage()<br>
piglit_report_result(PIGLIT_<u></u>SKIP);<br>
}<br>
<br>
+<br>
void<br>
-piglit_init(int argc, char **argv)<br>
+parse_args(int argc, char **argv)<br>
{<br>
- int prog;<br>
- int tex_location;<br>
int i;<br>
- enum shader_target test_stage = UNKNOWN;<br>
bool sampler_found = false;<br>
<br>
for (i = 1; i < argc; i++) {<br>
@@ -415,7 +420,18 @@ piglit_init(int argc, char **argv)<br>
<br>
if (test_stage == UNKNOWN || !sampler_found)<br>
fail_and_show_usage();<br>
- <br>
+<br>
+ if (test_stage == GS && shader_version < 150)<br>
+ shader_version = 150;<br>
+}<br>
+<br>
+<br>
+void<br>
+piglit_init(int argc, char **argv)<br>
+{<br>
+ int prog;<br>
+ int tex_location;<br>
+<br>
require_GL_features(test_<u></u>stage);<br>
<br>
if (sampler.target == GL_TEXTURE_CUBE_MAP_ARRAY)<br>
<br>
</blockquote>
<br>
</div></div></blockquote></div><br></div></div>