[Piglit] [PATCH 1/3] arb_es3_compatibility: add a test for PRIMITIVE_RESTART_FIXED_INDEX corner case

Jose Fonseca jfonseca at vmware.com
Thu Jan 15 08:50:27 PST 2015


On 04/01/15 15:48, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
>
> ---
>   tests/all.py                                       |   1 +
>   tests/spec/CMakeLists.txt                          |   1 +
>   tests/spec/arb_es3_compatibility/CMakeLists.gl.txt |  12 +++
>   tests/spec/arb_es3_compatibility/CMakeLists.txt    |   1 +
>   .../es3-drawarrays-primrestart-fixedindex.c        | 106 +++++++++++++++++++++
>   5 files changed, 121 insertions(+)
>   create mode 100644 tests/spec/arb_es3_compatibility/CMakeLists.gl.txt
>   create mode 100644 tests/spec/arb_es3_compatibility/CMakeLists.txt
>   create mode 100644 tests/spec/arb_es3_compatibility/es3-drawarrays-primrestart-fixedindex.c
>
> diff --git a/tests/all.py b/tests/all.py
> index 6b745e1..3e40fc4 100644
> --- a/tests/all.py
> +++ b/tests/all.py
> @@ -4278,6 +4278,7 @@ for tex_format in ('rgb8', 'srgb8', 'rgba8', 'srgb8-alpha8', 'r11', 'rg11', 'rgb
>           test_name = ' ' .join(['oes_compressed_etc2_texture-miptree', tex_format, context])
>           executable = '{0}'.format(test_name)
>           arb_es3_compatibility[test_name] = PiglitGLTest(executable, run_concurrent=True)
> +add_concurrent_test(arb_es3_compatibility, 'es3-drawarrays-primrestart-fixedindex')
>
>   add_shader_test_dir(spec, os.path.join(generatedTestDir, 'spec'),
>                       recursive=True)
> diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt
> index dfd822b..ee280fa 100644
> --- a/tests/spec/CMakeLists.txt
> +++ b/tests/spec/CMakeLists.txt
> @@ -12,6 +12,7 @@ add_subdirectory (arb_depth_clamp)
>   add_subdirectory (arb_draw_indirect)
>   add_subdirectory (arb_draw_instanced)
>   add_subdirectory (arb_es2_compatibility)
> +add_subdirectory (arb_es3_compatibility)
>   add_subdirectory (arb_explicit_attrib_location)
>   add_subdirectory (arb_explicit_uniform_location)
>   add_subdirectory (arb_framebuffer_object)
> diff --git a/tests/spec/arb_es3_compatibility/CMakeLists.gl.txt b/tests/spec/arb_es3_compatibility/CMakeLists.gl.txt
> new file mode 100644
> index 0000000..22df5af
> --- /dev/null
> +++ b/tests/spec/arb_es3_compatibility/CMakeLists.gl.txt
> @@ -0,0 +1,12 @@
> +include_directories(
> +	${GLEXT_INCLUDE_DIR}
> +	${OPENGL_INCLUDE_PATH}
> +)
> +
> +link_libraries (
> +	piglitutil_${piglit_target_api}
> +	${OPENGL_gl_LIBRARY}
> +	${OPENGL_glu_LIBRARY}
> +)
> +
> +piglit_add_executable (es3-drawarrays-primrestart-fixedindex es3-drawarrays-primrestart-fixedindex.c)
> diff --git a/tests/spec/arb_es3_compatibility/CMakeLists.txt b/tests/spec/arb_es3_compatibility/CMakeLists.txt
> new file mode 100644
> index 0000000..144a306
> --- /dev/null
> +++ b/tests/spec/arb_es3_compatibility/CMakeLists.txt
> @@ -0,0 +1 @@
> +piglit_include_target_api()
> diff --git a/tests/spec/arb_es3_compatibility/es3-drawarrays-primrestart-fixedindex.c b/tests/spec/arb_es3_compatibility/es3-drawarrays-primrestart-fixedindex.c
> new file mode 100644
> index 0000000..e967676
> --- /dev/null
> +++ b/tests/spec/arb_es3_compatibility/es3-drawarrays-primrestart-fixedindex.c
> @@ -0,0 +1,106 @@
> +/*
> + * Copyright © 2014 Advanced Micro Devices, Inc.
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
> + * DEALINGS IN THE SOFTWARE.
> + */
> +
> +/**
> + * Test if primitive restart is disabled for glDrawArrays while both
> + * PRIMITIVE_RESTART and PRIMITIVE_RESTART_FIXED_INDEX are enabled.
> + */
> +
> +#include "piglit-util-gl.h"
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +	config.supports_gl_compat_version = 33;
> +	config.supports_gl_core_version = 33;
> +	config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +static const GLchar *vstext =
> +	"#version 330\n"
> +	"attribute vec2 piglit_vertex;\n"
> +	"attribute int piglit_texcoord;\n"
> +	"out vec4 color;\n"
> +	"void main()\n"
> +	"{\n"
> +	"	gl_Position = vec4(piglit_vertex, 0.0, 1.0);\n"
> +	"	color = vec4(0.0, 1.0, 0.0, 1.0);\n"
> +	"} \n";
> +
> +static const char *fstext =
> +	"#version 330\n"
> +	"in vec4 color;\n"
> +	"void main() {\n"
> +	"	gl_FragColor = color;\n"
> +	"}\n";
> +
> +static GLint prog;
> +
> +enum piglit_result
> +piglit_display(void)
> +{
> +	static const float green[] = {0, 1, 0, 1};
> +	enum piglit_result result;
> +
> +	glClear(GL_COLOR_BUFFER_BIT);
> +	glDrawArrays(GL_TRIANGLES, 0, 7);
> +
> +	result = piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height,
> +					green)
> +		? PIGLIT_PASS : PIGLIT_FAIL;
> +
> +	piglit_present_results();
> +	return result;
> +}
> +
> +void
> +piglit_init(int argc, char **argv)
> +{
> +	static const float pos[] = {
> +		-1, -1,
> +		-1,  1,
> +		 1, -1,
> +		 1,  1,
> +		 1, -1,
> +		-1,  1,
> +		-1,  1 /* should be dropped */
> +	};
> +	GLuint vao, buf;
> +
> +	piglit_require_gl_version(33);
> +	piglit_require_extension("GL_ARB_ES3_compatibility");
> +	prog = piglit_build_simple_program(vstext, fstext);
> +	glUseProgram(prog);
> +
> +	glGenVertexArrays(1, &vao);
> +	glBindVertexArray(vao);
> +
> +	glGenBuffers(1, &buf);
> +	glBindBuffer(GL_ARRAY_BUFFER, buf);
> +	glBufferData(GL_ARRAY_BUFFER, sizeof(pos), pos, GL_STATIC_DRAW);
> +
> +	glEnableVertexAttribArray(PIGLIT_ATTRIB_POS);
> +	glVertexAttribPointer(PIGLIT_ATTRIB_POS, 2, GL_FLOAT, 0, 0, NULL);
> +
> +	glEnable(GL_PRIMITIVE_RESTART_FIXED_INDEX);
> +	glEnable(GL_PRIMITIVE_RESTART);
> +	glPrimitiveRestartIndex(3);
> +}
>


Marek,

I'm getting an assertion with this:

/var/lib/hudson/tools/lin64/piglit-ci/bin/piglit run -v -p glx -b junit 
tests/custom.py results/custom.results
Traceback (most recent call last):
   File "/var/lib/hudson/tools/lin64/piglit-ci/bin/piglit", line 148, in 
<module>
     main()
   File "/var/lib/hudson/tools/lin64/piglit-ci/bin/piglit", line 143, in 
main
     returncode = parsed.func(args)
   File 
"/var/lib/hudson/tools/lin64/piglit-ci/lib/piglit/framework/programs/run.py", 
line 284, in run
     profile = framework.profile.merge_test_profiles(args.test_profile)
   File 
"/var/lib/hudson/tools/lin64/piglit-ci/lib/piglit/framework/profile.py", 
line 305, in merge_test_profiles
     profile = load_test_profile(profiles.pop())
   File 
"/var/lib/hudson/tools/lin64/piglit-ci/lib/piglit/framework/profile.py", 
line 285, in load_test_profile
     os.path.splitext(os.path.basename(filename))[0]))
   File "/usr/lib/python2.7/importlib/__init__.py", line 37, in 
import_module
     __import__(name)
   File 
"/var/lib/hudson/tools/lin64/piglit-ci/lib/piglit/tests/custom.py", line 
7, in <module>
     execfile(os.path.dirname(__file__) + '/gpu.py')
   File "/var/lib/hudson/tools/lin64/piglit-ci/lib/piglit/tests/gpu.py", 
line 5, in <module>
     from tests.quick import profile
   File 
"/var/lib/hudson/tools/lin64/piglit-ci/lib/piglit/tests/quick.py", line 
4, in <module>
     from tests.all import profile
   File "/var/lib/hudson/tools/lin64/piglit-ci/lib/piglit/tests/all.py", 
line 4371, in <module>
     add_concurrent_test(arb_es3_compatibility, 
'es3-primrestart-fixedindex')
   File "/var/lib/hudson/tools/lin64/piglit-ci/lib/piglit/tests/all.py", 
line 46, in add_concurrent_test
     add_plain_test(group, args, run_concurrent=True)
   File "/var/lib/hudson/tools/lin64/piglit-ci/lib/piglit/tests/all.py", 
line 43, in add_plain_test
     group[gname] = PiglitGLTest(args, **kwargs)
   File 
"/var/lib/hudson/tools/lin64/piglit-ci/lib/piglit/framework/test/piglit_test.py", 
line 99, in __init__
     super(PiglitGLTest, self).__init__(command, **kwargs)
   File 
"/var/lib/hudson/tools/lin64/piglit-ci/lib/piglit/framework/test/piglit_test.py", 
line 57, in __init__
     super(PiglitBaseTest, self).__init__(*args, **kwargs)
   File 
"/var/lib/hudson/tools/lin64/piglit-ci/lib/piglit/framework/test/base.py", 
line 125, in __init__
     assert isinstance(command, list), command
AssertionError: es3-primrestart-fixedindex



I think you need to modify the  add_concurrent_test() calls to pass a 
list, or something like that.


Jose



More information about the Piglit mailing list