[Piglit] [PATCH] gles-3.0: test for vertex attribute aliasing

2018-09-24 Thread Tapani Pälli
Signed-off-by: Tapani Pälli 
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106833
---
 tests/opengl.py  |  1 +
 tests/spec/gles-3.0/CMakeLists.gles3.txt |  1 +
 tests/spec/gles-3.0/attribute-aliasing.c | 91 
 3 files changed, 93 insertions(+)
 create mode 100644 tests/spec/gles-3.0/attribute-aliasing.c

diff --git a/tests/opengl.py b/tests/opengl.py
index c599eb180..e1a5ef823 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -4637,6 +4637,7 @@ with profile.test_list.group_manager(
 g(['texture-immutable-levels_gles3'], 'texture-immutable-levels')
 g(['gles-3.0-drawarrays-vertexid'], 'gl_VertexID used with glDrawArrays')
 g(['gles-3.0-transform-feedback-uniform-buffer-object'])
+g(['gles-3.0-attribute-aliasing'], 'vertex attribute aliasing')
 
 for test_mode in ['teximage', 'texsubimage']:
 g(['ext_texture_array-compressed_gles3', test_mode, '-fbo'],
diff --git a/tests/spec/gles-3.0/CMakeLists.gles3.txt 
b/tests/spec/gles-3.0/CMakeLists.gles3.txt
index acaf64574..9f7ffe8ce 100644
--- a/tests/spec/gles-3.0/CMakeLists.gles3.txt
+++ b/tests/spec/gles-3.0/CMakeLists.gles3.txt
@@ -8,5 +8,6 @@ piglit_add_executable(oes_compressed_etc2_texture-miptree_gles3 
oes_compressed_e
 piglit_add_executable(texture-immutable-levels_gles3 
texture-immutable-levels.c)
 piglit_add_executable(read_depth_gles3 read-depth.c)
 piglit_add_executable(gles-3.0-transform-feedback-uniform-buffer-object 
transform-feedback-uniform-buffer-object.c)
+piglit_add_executable(gles-3.0-attribute-aliasing attribute-aliasing.c)
 
 # vim: ft=cmake:
diff --git a/tests/spec/gles-3.0/attribute-aliasing.c 
b/tests/spec/gles-3.0/attribute-aliasing.c
new file mode 100644
index 0..9a87dbf92
--- /dev/null
+++ b/tests/spec/gles-3.0/attribute-aliasing.c
@@ -0,0 +1,91 @@
+/*
+ * Copyright © 2018 Intel Corporation
+ *
+ * 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.
+ */
+
+/**
+ * @file
+ * Test that vertex attribute aliasing is disallowed.
+ *
+ * From OpenGL ES 3.0.5 spec "2.12.5 Vertex Attributes":
+ *
+ *"Binding more than one attribute name to the same location is referred
+ * to as aliasing, and is not permitted in OpenGL ES Shading Language 3.00
+ * vertex shaders. LinkProgram will fail when this condition exists."
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+   config.supports_gl_es_version = 30;
+PIGLIT_GL_TEST_CONFIG_END
+
+static const char vs_source[] =
+   "#version 300 es\n"
+   "in highp float a;\n"
+   "in highp float b;\n"
+   "void main()\n"
+   "{\n"
+   "   gl_Position = vec4(0.0);\n"
+   "}\n";
+
+static const char fs_source[] =
+   "#version 300 es\n"
+   "out highp vec4 color;\n"
+   "void main()\n"
+   "{\n"
+   "   color = vec4(0.0);\n"
+   "}\n";
+
+enum piglit_result
+piglit_display(void)
+{
+   return PIGLIT_FAIL;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+   GLuint vs, fs, prog;
+
+   prog = glCreateProgram();
+
+   /* Bind 2 attributes to the same location. */
+   glBindAttribLocation(prog, 0, "a");
+   glBindAttribLocation(prog, 0, "b");
+
+   vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_source);
+   fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_source);
+
+   glAttachShader(prog, vs);
+   glAttachShader(prog, fs);
+
+   glLinkProgram(prog);
+
+   if (piglit_link_check_status_quiet(prog))
+   piglit_report_result(PIGLIT_FAIL);
+
+   glDeleteShader(vs);
+   glDeleteShader(fs);
+   glDeleteProgram(prog);
+
+   piglit_report_result(PIGLIT_PASS);
+}
-- 
2.17.1

___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] Add tests for GL_EXTENSION_STRING vs. old idTech2 / idTech3 games

2018-09-24 Thread Roland Scheidegger
Am 24.09.2018 um 15:56 schrieb Ian Romanick:
> From: Ian Romanick 
> 
> As people dig up other games, we can (and should) easily add them.
> 
> Signed-off-by: Ian Romanick 
> Cc: Federico Dossena 
> Cc: Roland Scheidegger 
> ---
>  tests/general/CMakeLists.gl.txt  |   1 +
>  tests/general/idtech-extension-strings.c | 149 
> +++
>  2 files changed, 150 insertions(+)
>  create mode 100644 tests/general/idtech-extension-strings.c
> 
> diff --git a/tests/general/CMakeLists.gl.txt b/tests/general/CMakeLists.gl.txt
> index ceec9f0b6..83189fc42 100644
> --- a/tests/general/CMakeLists.gl.txt
> +++ b/tests/general/CMakeLists.gl.txt
> @@ -65,6 +65,7 @@ if (UNIX)
>   target_link_libraries (hiz m)
>  endif (UNIX)
>  piglit_add_executable (early-z early-z.c)
> +piglit_add_executable (idtech-extension-strings idtech-extension-strings.c)
>  piglit_add_executable (infinite-spot-light infinite-spot-light.c)
>  piglit_add_executable (isbufferobj isbufferobj.c)
>  piglit_add_executable (linestipple linestipple.c)
> diff --git a/tests/general/idtech-extension-strings.c 
> b/tests/general/idtech-extension-strings.c
> new file mode 100644
> index 0..cff54416b
> --- /dev/null
> +++ b/tests/general/idtech-extension-strings.c
> @@ -0,0 +1,149 @@
> +/*
> + * Copyright © 2018 Intel Corporation
> + *
> + * 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.
> + *
> + */
> +
> +/**
> + * \file idtech-extensoin-strings.c
extension


> + * Verify extensions used by idTech2 and idTech3 games occur in the first 4k
> + *
> + * For a long time idTech2- and idTech3-based games contained a bug in
> + * extension string handling.  The engine would copy the extension string
> + * returned by the driver into a 4k buffer.  The engine would not be able to
> + * detect the existence of any extensions that occured after the 4k boundry.
boundary



> + *
> + * For a variety of known games, this test verifies that extensions known to
> + * be used by each game occurs below the 4k boundry.
> + *
> + * A 2011 Wine bug
> + * 
> (https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.winehq.org%2Fpipermail%2Fwine-bugs%2F2011-June%2F280463.html&data=02%7C01%7Csroland%40vmware.com%7Cc108d7c276d7454160cb08d6222598df%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C1%7C0%7C636733942205163850&sdata=niqmepi%2BsBkOooa%2BefO3ZNI9z847n2SB4b88tbeNUsA%3D&reserved=0)
>  suggests
> + * that the limit for at least Return to Castle Wofenstein is 4k.  Some other
> + * evidence suggests that other games may have limits as low as 2k.
> + */
> +#include "piglit-util-gl.h"
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +
> + config.supports_gl_compat_version = 10;
> +
> + config.window_visual = PIGLIT_GL_VISUAL_RGB;
> +
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +enum piglit_result
> +piglit_display(void)
> +{
> + /* UNREACHABLE */
> + return PIGLIT_FAIL;
> +}
> +
> +/* List of extensions scraped from the Quake3 demo found in
> + * linuxq3ademo-1.11-6.x86.gz.sh.  The Return to Castle Wolfenstein demo 
> found
> + * in wolfspdemo-linux-1.1b.x86.run had the same list.
> + */
> +const char *const q3demo_list[] = {
> + "GL_S3_s3tc",
> + "GL_EXT_texture_env_add",
> + "GL_ARB_multitexture",
> + "GL_EXT_compiled_vertex_array",
> +};
> +
> +/* List of extensions used by the game "Star Trek Voyager" provided by
> + * Federico Dossena.
> + */
> +const char *const star_trek_voyager_list[] = {
> + "GL_S3_s3tc",
> + "GL_EXT_texture_compression_s3tc",
> + "GL_EXT_texture_env_add"
> + "GL_EXT_texture_filter_anisotropic",
> + "GL_EXT_texture_edge_clamp",
> + "GL_ARB_multitexture",
> + "GL_EXT_compiled_vertex_array",
> +
> + /* GL_ARB_texture_compression wasn't listed in the output of the
> +  * application, but since GL_EXT_texture_compression_s3tc is layered
> +  * on top of it, it really should check for 

Re: [Piglit] [PATCH] glsl-1.10: test some arithmetic on non-existing struct member

2018-09-24 Thread Eric Anholt
Tapani Pälli  writes:

> Signed-off-by: Tapani Pälli 
> https://bugs.freedesktop.org/show_bug.cgi?id=108012

Reviewed-by: Eric Anholt 


signature.asc
Description: PGP signature
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] Add tests for GL_EXTENSION_STRING vs. old idTech2 / idTech3 games

2018-09-24 Thread Ian Romanick
From: Ian Romanick 

As people dig up other games, we can (and should) easily add them.

Signed-off-by: Ian Romanick 
Cc: Federico Dossena 
Cc: Roland Scheidegger 
---
 tests/general/CMakeLists.gl.txt  |   1 +
 tests/general/idtech-extension-strings.c | 149 +++
 2 files changed, 150 insertions(+)
 create mode 100644 tests/general/idtech-extension-strings.c

diff --git a/tests/general/CMakeLists.gl.txt b/tests/general/CMakeLists.gl.txt
index ceec9f0b6..83189fc42 100644
--- a/tests/general/CMakeLists.gl.txt
+++ b/tests/general/CMakeLists.gl.txt
@@ -65,6 +65,7 @@ if (UNIX)
target_link_libraries (hiz m)
 endif (UNIX)
 piglit_add_executable (early-z early-z.c)
+piglit_add_executable (idtech-extension-strings idtech-extension-strings.c)
 piglit_add_executable (infinite-spot-light infinite-spot-light.c)
 piglit_add_executable (isbufferobj isbufferobj.c)
 piglit_add_executable (linestipple linestipple.c)
diff --git a/tests/general/idtech-extension-strings.c 
b/tests/general/idtech-extension-strings.c
new file mode 100644
index 0..cff54416b
--- /dev/null
+++ b/tests/general/idtech-extension-strings.c
@@ -0,0 +1,149 @@
+/*
+ * Copyright © 2018 Intel Corporation
+ *
+ * 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.
+ *
+ */
+
+/**
+ * \file idtech-extensoin-strings.c
+ * Verify extensions used by idTech2 and idTech3 games occur in the first 4k
+ *
+ * For a long time idTech2- and idTech3-based games contained a bug in
+ * extension string handling.  The engine would copy the extension string
+ * returned by the driver into a 4k buffer.  The engine would not be able to
+ * detect the existence of any extensions that occured after the 4k boundry.
+ *
+ * For a variety of known games, this test verifies that extensions known to
+ * be used by each game occurs below the 4k boundry.
+ *
+ * A 2011 Wine bug
+ * (https://www.winehq.org/pipermail/wine-bugs/2011-June/280463.html) suggests
+ * that the limit for at least Return to Castle Wofenstein is 4k.  Some other
+ * evidence suggests that other games may have limits as low as 2k.
+ */
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 10;
+
+   config.window_visual = PIGLIT_GL_VISUAL_RGB;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+enum piglit_result
+piglit_display(void)
+{
+   /* UNREACHABLE */
+   return PIGLIT_FAIL;
+}
+
+/* List of extensions scraped from the Quake3 demo found in
+ * linuxq3ademo-1.11-6.x86.gz.sh.  The Return to Castle Wolfenstein demo found
+ * in wolfspdemo-linux-1.1b.x86.run had the same list.
+ */
+const char *const q3demo_list[] = {
+   "GL_S3_s3tc",
+   "GL_EXT_texture_env_add",
+   "GL_ARB_multitexture",
+   "GL_EXT_compiled_vertex_array",
+};
+
+/* List of extensions used by the game "Star Trek Voyager" provided by
+ * Federico Dossena.
+ */
+const char *const star_trek_voyager_list[] = {
+   "GL_S3_s3tc",
+   "GL_EXT_texture_compression_s3tc",
+   "GL_EXT_texture_env_add"
+   "GL_EXT_texture_filter_anisotropic",
+   "GL_EXT_texture_edge_clamp",
+   "GL_ARB_multitexture",
+   "GL_EXT_compiled_vertex_array",
+
+   /* GL_ARB_texture_compression wasn't listed in the output of the
+* application, but since GL_EXT_texture_compression_s3tc is layered
+* on top of it, it really should check for it too...
+*/
+   "GL_ARB_texture_compression",
+};
+
+static bool
+check_extension_list(const char *application_name,
+const char *extension_string,
+const char *const list[],
+unsigned num_extensions)
+{
+   bool pass = true;
+
+   for (unsigned i = 0; i < num_extensions; i++) {
+   const unsigned len = strlen(list[i]);
+   const char *ptr = strstr(extension_string, list[i]);
+
+   while (ptr != NULL && ptr[len] != '\0' &

[Piglit] [PATCH] glsl-1.10: test some arithmetic on non-existing struct member

2018-09-24 Thread Tapani Pälli
Signed-off-by: Tapani Pälli 
https://bugs.freedesktop.org/show_bug.cgi?id=108012
---
 ...rithmetic-on-non-existing-struct-member.vert | 17 +
 1 file changed, 17 insertions(+)
 create mode 100644 
tests/spec/glsl-1.10/compiler/struct/arithmetic-on-non-existing-struct-member.vert

diff --git 
a/tests/spec/glsl-1.10/compiler/struct/arithmetic-on-non-existing-struct-member.vert
 
b/tests/spec/glsl-1.10/compiler/struct/arithmetic-on-non-existing-struct-member.vert
new file mode 100644
index 0..7e5ea93a9
--- /dev/null
+++ 
b/tests/spec/glsl-1.10/compiler/struct/arithmetic-on-non-existing-struct-member.vert
@@ -0,0 +1,17 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.10
+ * [end config]
+ */
+struct Foo
+{
+  float does_exist_member;
+};
+
+void
+main(void)
+{
+  Foo foo;
+  foo.does_not_exist_member /= 3.0;
+  gl_Position = vec4(1.0);
+}
-- 
2.17.1

___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit