[Piglit] [PATCH 5/5] texwrap: Allow compressed test to run with GL_EXT_texture_compression_dxt1 and friends

2015-12-02 Thread Ian Romanick
From: Ian Romanick 

All of the data is pre-compressed DXT[134] textures, so there is no need
for any of the more functional S3TC related extensions.

Signed-off-by: Ian Romanick 
---
 tests/texturing/texwrap.c | 31 ---
 1 file changed, 28 insertions(+), 3 deletions(-)

diff --git a/tests/texturing/texwrap.c b/tests/texturing/texwrap.c
index b88f410..ffe5e83 100644
--- a/tests/texturing/texwrap.c
+++ b/tests/texturing/texwrap.c
@@ -1712,6 +1712,15 @@ static const char *fp_offset =
"} \n";
 
 static bool
+s3tc_supported(void)
+{
+   return piglit_is_extension_supported("GL_EXT_texture_compression_s3tc") 
||
+  
(piglit_is_extension_supported("GL_EXT_texture_compression_dxt1") &&
+   
piglit_is_extension_supported("GL_ANGLE_texture_compression_dxt3") &&
+   
piglit_is_extension_supported("GL_ANGLE_texture_compression_dxt5"));
+}
+
+static bool
 get_test_by_name(const char *name, const struct test_desc **t)
 {
unsigned i;
@@ -1720,9 +1729,25 @@ get_test_by_name(const char *name, const struct 
test_desc **t)
if (strcmp(name, test_sets[i].name) == 0) {
int j;
for (j = 0; j < ARRAY_SIZE(test_sets[i].ext); j++) {
-   if (test_sets[i].ext[j]) {
-   
piglit_require_extension(test_sets[i].ext[j]);
-   }
+   const char *ext = test_sets[i].ext[j];
+
+   if (ext == NULL)
+   break;
+
+   if (piglit_is_extension_supported(ext))
+   continue;
+
+   /* The test doesn't use online compression, so
+* the full-featured S3TC extension or the
+* full set of extensions that only support
+* pre-compressed data will work.
+*/
+   if (strcmp("GL_EXT_texture_compression_s3tc", 
ext) == 0 &&
+   s3tc_supported())
+   continue;
+
+   printf("Test requires %s\n", ext);
+   piglit_report_result(PIGLIT_SKIP);
}
 
printf("Testing %s.\n", test_sets[i].name);
-- 
2.5.0

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


[Piglit] [PATCH 4/5] texwrap: Refactor getting the test vector for a name

2015-12-02 Thread Ian Romanick
From: Ian Romanick 

The indentation was getting a bit out of hand, and the next patch was
going to make it even worse.

Signed-off-by: Ian Romanick 
---
 tests/texturing/texwrap.c | 38 +-
 1 file changed, 25 insertions(+), 13 deletions(-)

diff --git a/tests/texturing/texwrap.c b/tests/texturing/texwrap.c
index 60ffa73..b88f410 100644
--- a/tests/texturing/texwrap.c
+++ b/tests/texturing/texwrap.c
@@ -1711,6 +1711,29 @@ static const char *fp_offset =
"   } \n"
"} \n";
 
+static bool
+get_test_by_name(const char *name, const struct test_desc **t)
+{
+   unsigned i;
+
+   for (i = 0; test_sets[i].name; i++) {
+   if (strcmp(name, test_sets[i].name) == 0) {
+   int j;
+   for (j = 0; j < ARRAY_SIZE(test_sets[i].ext); j++) {
+   if (test_sets[i].ext[j]) {
+   
piglit_require_extension(test_sets[i].ext[j]);
+   }
+   }
+
+   printf("Testing %s.\n", test_sets[i].name);
+   *t = _sets[i];
+   return true;
+   }
+   }
+
+   return false;
+}
+
 void piglit_init(int argc, char **argv)
 {
unsigned i, p, fp;
@@ -1780,19 +1803,8 @@ void piglit_init(int argc, char **argv)
continue;
}
 
-   for (i = 0; test_sets[i].name; i++) {
-   if (strcmp(argv[p], test_sets[i].name) == 0) {
-   int j;
-   for (j = 0; j < ARRAY_SIZE(test_sets[i].ext); 
j++) {
-   if (test_sets[i].ext[j]) {
-   
piglit_require_extension(test_sets[i].ext[j]);
-   }
-   }
-   test = _sets[i];
-   printf("Testing %s.\n", test->name);
-   goto outer_continue;
-   }
-   }
+   if (get_test_by_name(argv[p], ))
+   continue;
 
if (test) {
/* Formats. */
-- 
2.5.0

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


[Piglit] [PATCH 3/5] arb_get_texture_sub_image: Allow compressed test to run with GL_EXT_texture_compression_dxt1 and friends

2015-12-02 Thread Ian Romanick
From: Ian Romanick 

All of the data is pre-compressed DXT[134] textures, so there is no need
for any of the more functional S3TC related extensions.

Also... GL_ARB_texture_non_power_of_two is a required part of OpenGL
2.0.  Since the test already requires OpenGL 2.0, there is no reason to
also check for the extension.

At some point someone should modify this test to exercise the
extension with the full set of compressed texture formats supported by
the implementation...

Signed-off-by: Ian Romanick 
---
 tests/spec/arb_get_texture_sub_image/getcompressed.c | 13 +++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/tests/spec/arb_get_texture_sub_image/getcompressed.c 
b/tests/spec/arb_get_texture_sub_image/getcompressed.c
index 488cde9..1a65607 100644
--- a/tests/spec/arb_get_texture_sub_image/getcompressed.c
+++ b/tests/spec/arb_get_texture_sub_image/getcompressed.c
@@ -291,8 +291,17 @@ piglit_init(int argc, char **argv)
 
piglit_require_extension("GL_ARB_get_texture_sub_image");
piglit_require_extension("GL_ARB_compressed_texture_pixel_storage");
-   piglit_require_extension("GL_EXT_texture_compression_s3tc");
-   piglit_require_extension("GL_ARB_texture_non_power_of_two");
+
+   if (!piglit_is_extension_supported("GL_EXT_texture_compression_s3tc") &&
+   !(piglit_is_extension_supported("GL_EXT_texture_compression_dxt1") 
&&
+ 
piglit_is_extension_supported("GL_ANGLE_texture_compression_dxt3") &&
+ 
piglit_is_extension_supported("GL_ANGLE_texture_compression_dxt5"))) {
+printf("Test requires either GL_EXT_texture_compression_s3tc "
+  "or GL_EXT_texture_compression_dxt1, "
+  "GL_ANGLE_texture_compression_dxt3, and "
+  "GL_ANGLE_texture_compression_dxt5\n");
+piglit_report_result(PIGLIT_SKIP);
+}
 
pass = test_getsubimage(GL_TEXTURE_2D, 256, 128, 1,
GL_COMPRESSED_RGB_S3TC_DXT1_EXT) && pass;
-- 
2.5.0

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


[Piglit] [PATCH 1/4] primitive-restart: Remove comment about GLEW 1.5.2

2015-12-02 Thread Ian Romanick
From: Ian Romanick 

Piglit doesn't use GLEW, so the GLEW version doesn't matter.

Signed-off-by: Ian Romanick 
---
 tests/general/primitive-restart.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/tests/general/primitive-restart.c 
b/tests/general/primitive-restart.c
index ce3db8f..f6d705e 100644
--- a/tests/general/primitive-restart.c
+++ b/tests/general/primitive-restart.c
@@ -704,10 +704,6 @@ piglit_init(int argc, char **argv)
}
 
/* Debug */
-   /* NOTE!  glew 1.5.2's OpenGL 3.1 detection is broken.  You'll need
-* to upgrade to a newer version if you want to test the GL 3.1
-* primitive restart feature!
-*/
if (0) {
   printf("Have NV: %d\n", Have_NV);
   printf("Have 31: %d\n", Have_31);
-- 
2.5.0

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


[Piglit] [PATCH 2/4] primitive-restart: Remove compile-time tests for GL 3.1

2015-12-02 Thread Ian Romanick
From: Ian Romanick 

These were added in 28ca3c1, and they were a good idea in 2010.  I think
it's safe to count on glext.h with the proper functions today.

Signed-off-by: Ian Romanick 
Cc: Brian Paul 
---
 tests/general/primitive-restart.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/tests/general/primitive-restart.c 
b/tests/general/primitive-restart.c
index f6d705e..1bd8d27 100644
--- a/tests/general/primitive-restart.c
+++ b/tests/general/primitive-restart.c
@@ -190,10 +190,8 @@ static void
 enable_restart(GLuint restart_index)
 {
if (TestGL31) {
-#ifdef GL_VERSION_3_1
   glEnable(GL_PRIMITIVE_RESTART);
   glPrimitiveRestartIndex(restart_index);
-#endif
}
else {
   glEnableClientState(GL_PRIMITIVE_RESTART_NV);
@@ -206,9 +204,7 @@ static void
 disable_restart(void)
 {
if (TestGL31) {
-#ifdef GL_VERSION_3_1
   glDisable(GL_PRIMITIVE_RESTART);
-#endif
}
else {
   glDisableClientState(GL_PRIMITIVE_RESTART_NV);
-- 
2.5.0

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


[Piglit] [PATCH 4/4] primitive-restart: Replace assert(glGetError()==0)

2015-12-02 Thread Ian Romanick
From: Ian Romanick 

Signed-off-by: Ian Romanick 
---
 tests/general/primitive-restart.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tests/general/primitive-restart.c 
b/tests/general/primitive-restart.c
index 53f4349..5cd8be3 100644
--- a/tests/general/primitive-restart.c
+++ b/tests/general/primitive-restart.c
@@ -294,7 +294,7 @@ test_draw_by_index(VBO_CFG vbo_cfg, bool one_by_one, GLenum 
primMode, GLenum ind
GLfloat x, dx;
GLuint restart_index;
GLuint num_elems;
-   bool pass;
+   bool pass = true;
const char *typeStr = NULL, *primStr = NULL;
GLuint vbo1, vbo2;
bool create_vbo1 = false;
@@ -438,8 +438,8 @@ test_draw_by_index(VBO_CFG vbo_cfg, bool one_by_one, GLenum 
primMode, GLenum ind
}
 
glEnableClientState(GL_VERTEX_ARRAY);
+   pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
 
-   assert(glGetError()==0);
enable_restart(restart_index);
 
/* Draw */
@@ -466,13 +466,13 @@ test_draw_by_index(VBO_CFG vbo_cfg, bool one_by_one, 
GLenum primMode, GLenum ind
   glDeleteBuffers(1, );
}
 
-   pass = check_rendering();
-   if (!pass) {
+   if (!check_rendering()) {
   fprintf(stderr, "%s: failure drawing with %s(%s, %s), %s\n",
   TestName,
   one_by_one ? "glArrayElement" : "glDrawElements",
   primStr, typeStr,
   vbo_cfg_names[vbo_cfg]);
+  pass = false;
}
 
piglit_present_results();
@@ -550,8 +550,8 @@ test_draw_arrays(VBO_CFG vbo_cfg)
}
 
glEnableClientState(GL_VERTEX_ARRAY);
-
-   assert(glGetError()==0);
+   if (!piglit_check_gl_error(GL_NO_ERROR))
+  return false;
 
/*
 * Render and do checks.
-- 
2.5.0

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


[Piglit] [PATCH] glsl-es-3.00: Verify various UTF-8 clarifications from Khronos

2015-12-02 Thread Ian Romanick
From: Ian Romanick 

Further discussion in Khronos has determined that UTF-8 in unused
preprocessor defines as well.

See Khronos internal bug #14939.

Signed-off-by: Ian Romanick 
---
 .../glsl-es-3.00/compiler/utf8-unused-define.vert  | 26 +
 .../glsl-es-3.00/compiler/utf8-used-define.vert| 27 ++
 2 files changed, 53 insertions(+)
 create mode 100644 tests/spec/glsl-es-3.00/compiler/utf8-unused-define.vert
 create mode 100644 tests/spec/glsl-es-3.00/compiler/utf8-used-define.vert

diff --git a/tests/spec/glsl-es-3.00/compiler/utf8-unused-define.vert 
b/tests/spec/glsl-es-3.00/compiler/utf8-unused-define.vert
new file mode 100644
index 000..69cde74
--- /dev/null
+++ b/tests/spec/glsl-es-3.00/compiler/utf8-unused-define.vert
@@ -0,0 +1,26 @@
+#version 300 es
+
+/* [config]
+ * expect_result: pass
+ * glsl_version: 3.00
+ * [end config]
+ *
+ * Page 8 (page 14 of the PDF) of the OpenGL ES Shading Language 3.00 spec
+ * says:
+ *
+ * "Inside comments, the character set is extended to allow any byte
+ * values to be used but with the exception that a byte with the value
+ * zero is always interpreted as the end of the string. The character
+ * encoding is assumed to be UTF-8 but no checking is performed for
+ * invalid characters."
+ *
+ * Further discussion in Khronos has determined that UTF-8 in unused
+ * preprocessor defines as well.
+ */
+
+#define eat_sushi_using_chopsticks 寿司使用して箸を食べます。
+
+void main()
+{
+gl_Position = vec4(0);
+}
diff --git a/tests/spec/glsl-es-3.00/compiler/utf8-used-define.vert 
b/tests/spec/glsl-es-3.00/compiler/utf8-used-define.vert
new file mode 100644
index 000..7bc04e6
--- /dev/null
+++ b/tests/spec/glsl-es-3.00/compiler/utf8-used-define.vert
@@ -0,0 +1,27 @@
+#version 300 es
+
+/* [config]
+ * expect_result: fail
+ * glsl_version: 3.00
+ * [end config]
+ *
+ * Page 8 (page 14 of the PDF) of the OpenGL ES Shading Language 3.00 spec
+ * says:
+ *
+ * "Inside comments, the character set is extended to allow any byte
+ * values to be used but with the exception that a byte with the value
+ * zero is always interpreted as the end of the string. The character
+ * encoding is assumed to be UTF-8 but no checking is performed for
+ * invalid characters."
+ *
+ * Further discussion in Khronos has determined that UTF-8 in unused
+ * preprocessor defines as well.
+ */
+
+#define eat_sushi_using_chopsticks 寿司使用して箸を食べます
+
+void main()
+{
+float eat_sushi_using_chopsticks = 0;
+gl_Position = vec4(eat_sushi_using_chopsticks);
+}
-- 
2.5.0

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


[Piglit] [PATCH 3/4] primitive-restart: Use stdbool

2015-12-02 Thread Ian Romanick
From: Ian Romanick 

Signed-off-by: Ian Romanick 
---
 tests/general/primitive-restart.c | 60 +++
 1 file changed, 30 insertions(+), 30 deletions(-)

diff --git a/tests/general/primitive-restart.c 
b/tests/general/primitive-restart.c
index 1bd8d27..53f4349 100644
--- a/tests/general/primitive-restart.c
+++ b/tests/general/primitive-restart.c
@@ -69,25 +69,25 @@ static const GLfloat red[4] = {1.0, 0.0, 0.0, 1.0};
 static const GLfloat green[4] = {0.0, 1.0, 0.0, 0.0};
 static const GLfloat black[4] = {0.0, 0.0, 0.0, 0.0};
 
-static GLboolean Have_NV;
-static GLboolean Have_31;
-static GLboolean TestGL31;
+static bool Have_NV;
+static bool Have_31;
+static bool TestGL31;
 
 
-static GLboolean
+static bool
 check_rendering(void)
 {
const GLfloat x0 = 0.0, x1 = piglit_width - 10.0, dx = 20.0;
const GLint iy = piglit_height / 2;
-   GLboolean draw = GL_TRUE;
+   bool draw = true;
GLfloat x;
 
if (!piglit_probe_pixel_rgb(0, 0, black)) {
-  return GL_FALSE;
+  return false;
}
 
for (x = x0 + 0.5 * dx; x < x1; x += dx) {
-  GLboolean pass;
+  bool pass;
   const int ix = (int) x;
 
   if (draw) {
@@ -106,27 +106,27 @@ check_rendering(void)
   }
 
   if (!pass) {
- return GL_FALSE;
+ return false;
   }
 
   draw = !draw;
}
 
-   return GL_TRUE;
+   return true;
 }
 
 
 /**
  * Test glBegin(GL_TRIANGLE/LINE_STRIP), glPrimitiveRestartNV(), glEnd().
  */
-static GLboolean
+static bool
 test_begin_end(GLenum primMode)
 {
const GLfloat x0 = 0.0, x1 = piglit_width - 10.0, dx = 20.0;
const GLfloat y0 = 0.5 * piglit_height - 10.0, y1 = y0 + 20.0, dy = 20.0;
GLfloat x, y;
GLint vert;
-   GLboolean pass;
+   bool pass;
 
piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
 
@@ -284,8 +284,8 @@ static void do_ArrayElement(GLenum mode, GLsizei count,
 /**
  * Test glDrawElements() with glPrimitiveRestartIndexNV().
  */
-static GLboolean
-test_draw_by_index(VBO_CFG vbo_cfg, GLboolean one_by_one, GLenum primMode, 
GLenum indexType)
+static bool
+test_draw_by_index(VBO_CFG vbo_cfg, bool one_by_one, GLenum primMode, GLenum 
indexType)
 {
 #define NUM_VERTS 48
 #define NUM_ELEMS (NUM_VERTS * 5 / 4)
@@ -294,21 +294,21 @@ test_draw_by_index(VBO_CFG vbo_cfg, GLboolean one_by_one, 
GLenum primMode, GLenu
GLfloat x, dx;
GLuint restart_index;
GLuint num_elems;
-   GLboolean pass;
+   bool pass;
const char *typeStr = NULL, *primStr = NULL;
GLuint vbo1, vbo2;
-   GLboolean create_vbo1 = GL_FALSE;
-   GLboolean create_vbo2 = GL_FALSE;
+   bool create_vbo1 = false;
+   bool create_vbo2 = false;
uintptr_t index_offset = 0;
uintptr_t vbo_data_size = sizeof(verts) + sizeof(indices);
GLuint i, j;
 
if ((vbo_cfg != DISABLE_VBO) && (vbo_cfg != VBO_INDEX_ONLY)) {
-  create_vbo1 = GL_TRUE;
+  create_vbo1 = true;
}
 
if ((vbo_cfg == VBO_INDEX_ONLY) || (vbo_cfg == 
VBO_SEPARATE_VERTEX_AND_INDEX)) {
-  create_vbo2 = GL_TRUE;
+  create_vbo2 = true;
}
 
if ((vbo_cfg == DISABLE_VBO) || (vbo_cfg == VBO_VERTEX_ONLY)) {
@@ -485,20 +485,20 @@ test_draw_by_index(VBO_CFG vbo_cfg, GLboolean one_by_one, 
GLenum primMode, GLenu
 /**
  * Test glDrawElements() with glPrimitiveRestartIndexNV().
  */
-static GLboolean
+static bool
 test_draw_elements(VBO_CFG vbo_cfg, GLenum primMode, GLenum indexType)
 {
-   return test_draw_by_index(vbo_cfg, GL_FALSE, primMode, indexType);
+   return test_draw_by_index(vbo_cfg, false, primMode, indexType);
 }
 
 
 /**
  * Test glArrayElement() with glPrimitiveRestartIndexNV().
  */
-static GLboolean
+static bool
 test_array_element(VBO_CFG vbo_cfg, GLenum primMode, GLenum indexType)
 {
-   return test_draw_by_index(vbo_cfg, GL_TRUE, primMode, indexType);
+   return test_draw_by_index(vbo_cfg, true, primMode, indexType);
 }
 
 
@@ -506,7 +506,7 @@ test_array_element(VBO_CFG vbo_cfg, GLenum primMode, GLenum 
indexType)
  * Test glDrawArrayss() with glPrimitiveRestartIndexNV().
  * We only test a line strip.
  */
-static GLboolean
+static bool
 test_draw_arrays(VBO_CFG vbo_cfg)
 {
 #define NUM_VERTS 12
@@ -514,7 +514,7 @@ test_draw_arrays(VBO_CFG vbo_cfg)
const GLfloat dx = 20.0;
GLfloat x;
GLuint restart_index;
-   GLboolean pass = GL_TRUE;
+   bool pass = true;
const char *primStr = "GL_LINE_STRIP";
GLuint test;
const GLenum primMode = GL_LINE_STRIP;
@@ -590,7 +590,7 @@ test_draw_arrays(VBO_CFG vbo_cfg)
if (!piglit_probe_pixel_rgb(ix, iy, black)) {
   if (0)
  fprintf(stderr, "bad pixel drawn\n");
-  pass = GL_FALSE;
+  pass = false;
}
 }
 else {
@@ -598,7 +598,7 @@ test_draw_arrays(VBO_CFG vbo_cfg)
if (!piglit_probe_pixel_rgb(ix, iy, green)) {
   if (0)
  fprintf(stderr, 

[Piglit] [PATCH 0/4] Clean ups that were sitting in my tree

2015-12-02 Thread Ian Romanick
These are just some cleanups for the primitive restart tests.  I did
these while I was getting ready to do something else with the tests.
I got distracted and forgot about about whatever I was originally
going to do. :(

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


[Piglit] [PATCH 2/5] ext_texture_array: Use piglit_build_simple_program

2015-12-02 Thread Ian Romanick
From: Ian Romanick 

I don't think piglit_build_simple_program supported piglit_vertex and
piglit_texcoord when this test was written, but it does now.  Use it!

Signed-off-by: Ian Romanick 
---
 tests/spec/ext_texture_array/compressed.c | 17 +
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/tests/spec/ext_texture_array/compressed.c 
b/tests/spec/ext_texture_array/compressed.c
index cc45cc9..f8acc1d 100644
--- a/tests/spec/ext_texture_array/compressed.c
+++ b/tests/spec/ext_texture_array/compressed.c
@@ -86,24 +86,22 @@ PIGLIT_GL_TEST_CONFIG_END
 static const char vs_text[] =
 #ifdef PIGLIT_USE_OPENGL
"#version 120\n"
-   "#define piglit_Vertex gl_Vertex\n"
-   "#define piglit_MultiTexCoord0 gl_MultiTexCoord0\n"
"#define piglit_in attribute\n"
"#define piglit_out varying\n"
 #else // PIGLIT_USE_OPENGL_ES3
"#version 300 es\n"
"#define piglit_in in\n"
"#define piglit_out out\n"
-   "piglit_in vec4 piglit_Vertex;\n"
-   "piglit_in vec4 piglit_MultiTexCoord0;\n"
 #endif
+   "piglit_in vec4 piglit_vertex;\n"
+   "piglit_in vec4 piglit_texcoord;\n"
"piglit_out vec3 texcoord;\n"
"uniform mat4 proj;\n"
"uniform int layer;\n"
"void main()\n"
"{\n"
-   "  gl_Position = proj * piglit_Vertex;\n"
-   "  texcoord = vec3(piglit_MultiTexCoord0.xy, float(layer));\n"
+   "  gl_Position = proj * piglit_vertex;\n"
+   "  texcoord = vec3(piglit_texcoord.xy, float(layer));\n"
"}\n";
 
 static const char fs_text[] =
@@ -251,12 +249,7 @@ piglit_init(int argc, char **argv)
}
 
/* Create the shaders */
-   prog = piglit_build_simple_program_unlinked(vs_text, fs_text);
-   glBindAttribLocation(prog, PIGLIT_ATTRIB_POS, "piglit_Vertex");
-   glBindAttribLocation(prog, PIGLIT_ATTRIB_TEX, "piglit_MultiTexCoord0");
-   glLinkProgram(prog);
-   if (!piglit_link_check_status(prog))
-   piglit_report_result(PIGLIT_FAIL);
+   prog = piglit_build_simple_program(vs_text, fs_text);
proj_loc = glGetUniformLocation(prog, "proj");
layer_loc = glGetUniformLocation(prog, "layer");
if (!piglit_check_gl_error(GL_NO_ERROR))
-- 
2.5.0

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


[Piglit] [PATCH 1/5] ext_texture_array: Allow compressed test to run with GL_EXT_texture_compression_dxt1

2015-12-02 Thread Ian Romanick
From: Ian Romanick 

All of the data is pre-compressed DXT1 textures, so there is no need for
any of the more functional S3TC related extensions.

Also... GL_ARB_texture_compress is a required part of OpenGL 1.3.  Since
the test already requires OpenGL 2.1, there is no reason to also check
for the extension.

Signed-off-by: Ian Romanick 
---
 tests/spec/ext_texture_array/compressed.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/tests/spec/ext_texture_array/compressed.c 
b/tests/spec/ext_texture_array/compressed.c
index 65d495c..cc45cc9 100644
--- a/tests/spec/ext_texture_array/compressed.c
+++ b/tests/spec/ext_texture_array/compressed.c
@@ -184,9 +184,14 @@ piglit_init(int argc, char **argv)
/* Make sure required GL features are present */
 #ifdef PIGLIT_USE_OPENGL
piglit_require_gl_version(21);
-   piglit_require_extension("GL_ARB_texture_compression");
-   piglit_require_extension("GL_EXT_texture_compression_s3tc");
piglit_require_extension("GL_EXT_texture_array");
+
+   if (!piglit_is_extension_supported("GL_EXT_texture_compression_s3tc") &&
+   !piglit_is_extension_supported("GL_EXT_texture_compression_dxt1")) {
+printf("Test requires either GL_EXT_texture_compression_s3tc "
+  "or GL_EXT_texture_compression_dxt1.\n");
+piglit_report_result(PIGLIT_SKIP);
+}
 #endif
 
/* We're using texture unit 0 for this entire test */
-- 
2.5.0

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


Re: [Piglit] [PATCH 0/4] Clean ups that were sitting in my tree

2015-12-02 Thread Matt Turner
This series is also

Reviewed-by: Matt Turner 
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 1/5] ext_texture_array: Allow compressed test to run with GL_EXT_texture_compression_dxt1

2015-12-02 Thread Matt Turner
This series is

Reviewed-by: Matt Turner 
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] glsl-es-3.00: Verify various UTF-8 clarifications from Khronos

2015-12-02 Thread Matt Turner
On Wed, Dec 2, 2015 at 8:42 AM, Ian Romanick  wrote:
> From: Ian Romanick 
>
> Further discussion in Khronos has determined that UTF-8 in unused
> preprocessor defines as well.
>
> See Khronos internal bug #14939.
>
> Signed-off-by: Ian Romanick 
> ---
>  .../glsl-es-3.00/compiler/utf8-unused-define.vert  | 26 +
>  .../glsl-es-3.00/compiler/utf8-used-define.vert| 27 
> ++
>  2 files changed, 53 insertions(+)
>  create mode 100644 tests/spec/glsl-es-3.00/compiler/utf8-unused-define.vert
>  create mode 100644 tests/spec/glsl-es-3.00/compiler/utf8-used-define.vert
>
> diff --git a/tests/spec/glsl-es-3.00/compiler/utf8-unused-define.vert 
> b/tests/spec/glsl-es-3.00/compiler/utf8-unused-define.vert
> new file mode 100644
> index 000..69cde74
> --- /dev/null
> +++ b/tests/spec/glsl-es-3.00/compiler/utf8-unused-define.vert
> @@ -0,0 +1,26 @@
> +#version 300 es
> +
> +/* [config]

I was surprised to see #version before the [config] block, but we do
seem to do that some other places (but basically only in ES tests...)

Reviewed-by: Matt Turner 
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 2/3] tests/all.py: Make MSAA_SAMPLE_COUNTS contain str() instead of int()

2015-12-02 Thread baker . dylan . c
From: Dylan Baker 

In every case MSAA_SAMPLES_COUNTS are converted to str() anyway, (either
explicitly by calling str(), or implicitly by str.format(). This is
often done with a pattern like: (str(x) for x in MSAA_SAMPLE_COUNTS).

This is just a waste of time when the values could be strings from the
start.

Signed-off-by: Dylan Baker 
---
 tests/all.py | 61 ++--
 1 file changed, 30 insertions(+), 31 deletions(-)

diff --git a/tests/all.py b/tests/all.py
index 03da7cd..9f1d0e9 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -61,9 +61,9 @@ def add_fbo_depthstencil_tests(group, format, num_samples):
 prefix = 'fbo-'
 create_test = PiglitGLTest
 
-if num_samples > 1:
-suffix = ' samples=' + str(num_samples)
-psamples = '-samples=' + str(num_samples)
+if int(num_samples) > 1:
+suffix = ' samples=' + num_samples
+psamples = '-samples=' + num_samples
 else:
 suffix = ''
 psamples = ''
@@ -251,7 +251,7 @@ for dirpath, _, filenames in os.walk(_basedir):
 ['asmparsertest', type_, os.path.join(dirpath, filename)])
 
 # List of all of the MSAA sample counts we wish to test
-MSAA_SAMPLE_COUNTS = (2, 4, 6, 8, 16, 32)
+MSAA_SAMPLE_COUNTS = ('2', '4', '6', '8', '16', '32')
 
 with profile.group_manager(GleanTest, 'glean') as g:
 g('basic')
@@ -980,7 +980,7 @@ with profile.group_manager(
 for format in color_formats:
 g(['teximage-colors', format], run_concurrent=False)
 
-for num_samples in (0, ) + MSAA_SAMPLE_COUNTS:
+for num_samples in ('0',) + MSAA_SAMPLE_COUNTS:
 add_fbo_depthstencil_tests(
 grouptools.join('spec', '!opengl 1.1'), 'default_fb', num_samples)
 
@@ -1436,7 +1436,7 @@ for stage in ['vs', 'gs', 'fs']:
 
 for type in ('i', 'u', ''):
 for sampler in ('sampler2DMS', 'sampler2DMSArray'):
-for sample_count in (str(x) for x in MSAA_SAMPLE_COUNTS):
+for sample_count in MSAA_SAMPLE_COUNTS:
 stype = '{}{}'.format(type, sampler)
 profile.test_list[grouptools.join(
 'spec', 'arb_shader_texture_image_samples',
@@ -1750,7 +1750,7 @@ with profile.group_manager(
 g(['texelFetch', 'fs', 'sampler2DMSArray', '4', '98x129x1-98x129x9'])
 g(['arb_texture_multisample-texstate'])
 g(['arb_texture_multisample-errors'])
-for sample_count in (str(x) for x in MSAA_SAMPLE_COUNTS):
+for sample_count in MSAA_SAMPLE_COUNTS:
 g(['arb_texture_multisample-texelfetch', sample_count])
 g(['arb_texture_multisample-sample-mask'])
 g(['arb_texture_multisample-sample-mask-value'])
@@ -1769,7 +1769,7 @@ with profile.group_manager(
 grouptools.join('spec', 'ARB_texture_multisample',
 'fb-completeness')) as g:
 
-for sample_count in (str(x) for x in MSAA_SAMPLE_COUNTS):
+for sample_count in MSAA_SAMPLE_COUNTS:
 # fb-completeness
 g(['arb_texture_multisample-fb-completeness', sample_count],
   sample_count)
@@ -1780,7 +1780,7 @@ with profile.group_manager(
 
 stages = ['vs', 'gs', 'fs']
 for sampler, stage, sample_count in itertools.product(
-samplers_atm, stages, (str(x) for x in MSAA_SAMPLE_COUNTS)):
+samplers_atm, stages, MSAA_SAMPLE_COUNTS):
 g(['texelFetch', stage, sampler, sample_count],
   '{}-{}-{}'.format(sample_count, stage, sampler))
 
@@ -1789,7 +1789,7 @@ with profile.group_manager(
 grouptools.join('spec', 'ARB_texture_multisample',
 'sample-position')) as g:
 # sample positions
-for sample_count in (str(x) for x in MSAA_SAMPLE_COUNTS):
+for sample_count in MSAA_SAMPLE_COUNTS:
 g(['arb_texture_multisample-sample-position', sample_count],
   sample_count)
 
@@ -2209,20 +2209,20 @@ with profile.group_manager(
 grouptools.join('spec', 'ARB_sample_shading')) as g:
 g(['arb_sample_shading-api'], run_concurrent=False)
 
-for num_samples in (0,) + MSAA_SAMPLE_COUNTS:
-g(['arb_sample_shading-builtin-gl-num-samples', str(num_samples)],
+for num_samples in ('0',) + MSAA_SAMPLE_COUNTS:
+g(['arb_sample_shading-builtin-gl-num-samples', num_samples],
   'builtin-gl-num-samples {0}'.format(num_samples),
   run_concurrent=False)
-g(['arb_sample_shading-builtin-gl-sample-id', str(num_samples)],
+g(['arb_sample_shading-builtin-gl-sample-id', num_samples],
   'builtin-gl-sample-id {}'.format(num_samples), run_concurrent=False)
-g(['arb_sample_shading-builtin-gl-sample-mask', str(num_samples)],
+g(['arb_sample_shading-builtin-gl-sample-mask', num_samples],
   'builtin-gl-sample-mask {}'.format(num_samples),
   run_concurrent=False)
-g(['arb_sample_shading-builtin-gl-sample-position', str(num_samples)],
+

[Piglit] [PATCH 3/3] tests/all.py: Make MSAA_SAMPLE_COUNTS a list instead of a tuple

2015-12-02 Thread baker . dylan . c
From: Dylan Baker 

The problem with using MSAA_SAMPLE_COUNTS as a tuple is that it isn't a
tuple. It's a sequence of like values, and is combined with other
sequences of values, this is what a list is for.

Signed-off-by: Dylan Baker 
---
 tests/all.py | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tests/all.py b/tests/all.py
index 9f1d0e9..50cc2b7 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -251,7 +251,7 @@ for dirpath, _, filenames in os.walk(_basedir):
 ['asmparsertest', type_, os.path.join(dirpath, filename)])
 
 # List of all of the MSAA sample counts we wish to test
-MSAA_SAMPLE_COUNTS = ('2', '4', '6', '8', '16', '32')
+MSAA_SAMPLE_COUNTS = ['2', '4', '6', '8', '16', '32']
 
 with profile.group_manager(GleanTest, 'glean') as g:
 g('basic')
@@ -980,7 +980,7 @@ with profile.group_manager(
 for format in color_formats:
 g(['teximage-colors', format], run_concurrent=False)
 
-for num_samples in ('0',) + MSAA_SAMPLE_COUNTS:
+for num_samples in ['0'] + MSAA_SAMPLE_COUNTS:
 add_fbo_depthstencil_tests(
 grouptools.join('spec', '!opengl 1.1'), 'default_fb', num_samples)
 
@@ -2209,7 +2209,7 @@ with profile.group_manager(
 grouptools.join('spec', 'ARB_sample_shading')) as g:
 g(['arb_sample_shading-api'], run_concurrent=False)
 
-for num_samples in ('0',) + MSAA_SAMPLE_COUNTS:
+for num_samples in ['0'] + MSAA_SAMPLE_COUNTS:
 g(['arb_sample_shading-builtin-gl-num-samples', num_samples],
   'builtin-gl-num-samples {0}'.format(num_samples),
   run_concurrent=False)
@@ -2230,7 +2230,7 @@ with profile.group_manager(
   'ignore-centroid-qualifier {}'.format(sample_count),
   run_concurrent=False)
 
-for num_samples in ('0',) + MSAA_SAMPLE_COUNTS:
+for num_samples in ['0',] + MSAA_SAMPLE_COUNTS:
 g(['arb_sample_shading-builtin-gl-sample-mask-simple',
num_samples],
   'builtin-gl-sample-mask-simple {}'.format(num_samples))
@@ -2793,7 +2793,7 @@ with profile.group_manager(
sample_count],
   'alpha-blending-after-rendering {}'.format(sample_count))
 
-for num_samples in ('all_samples',) + MSAA_SAMPLE_COUNTS:
+for num_samples in ['all_samples'] + MSAA_SAMPLE_COUNTS:
 g(['ext_framebuffer_multisample-formats', num_samples],
   'formats {}'.format(num_samples))
 
@@ -2810,7 +2810,7 @@ with profile.group_manager(
 # Note: the interpolation tests also check for sensible behaviour with
 # non-multisampled framebuffers, so go ahead and test them with
 # num_samples==0 as well.
-for num_samples in ('0',) + MSAA_SAMPLE_COUNTS:
+for num_samples in ['0'] + MSAA_SAMPLE_COUNTS:
 g(['ext_framebuffer_multisample-blit-multiple-render-targets',
num_samples],
   'blit-multiple-render-targets {}'.format(num_samples))
-- 
2.6.2

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


[Piglit] [PATCH 1/3] tests/all.py: hide some pylint warnings that can't be (easily) fixed.

2015-12-02 Thread baker . dylan . c
From: Dylan Baker 

Signed-off-by: Dylan Baker 
---
 tests/all.py | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tests/all.py b/tests/all.py
index 9f1b4f3..03da7cd 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -20,6 +20,10 @@ __all__ = ['profile']
 # doesn't trigger an error)
 # pylint: disable=bad-continuation
 
+# Shadowing variables is a bad practice. It's just nearly impossible with the
+# format of this module to avoid it.
+# pylint: disable=redefined-outer-name
+
 
 def add_single_param_test_set(adder, name, *params):
 for param in params:
@@ -201,7 +205,7 @@ def power_set(s):
 
 ##
 # Collecting all tests
-profile = TestProfile()
+profile = TestProfile()  # pylint: disable=invalid-name
 
 # Find and add all shader tests.
 for basedir in [TESTS_DIR, GENERATED_TESTS_DIR]:
-- 
2.6.2

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


[Piglit] [PATCH 0/3] replace MSAA sample counts with strings

2015-12-02 Thread baker . dylan . c
From: Dylan Baker 

The current implementation is a tuple of ints, and this series changes
that to a list of strs.

In nearly every case the ints were being either explicitly converted to
str, or implicitly (using str.format). In the couple of cases that it
wasn't being converted it's easy to convert the str to an int (there are
only 1 or 2 cases where this is necessary).

Dylan Baker (3):
  tests/all.py: hide some pylint warnings that can't be (easily) fixed.
  tests/all.py: Make MSAA_SAMPLE_COUNTS contain str() instead of int()
  tests/all.py: Make MSAA_SAMPLE_COUNTS a list instead of a tuple

 tests/all.py | 67 +++-
 1 file changed, 35 insertions(+), 32 deletions(-)

-- 
2.6.2

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


Re: [Piglit] [PATCH 1/3] tests/all.py: hide some pylint warnings that can't be (easily) fixed.

2015-12-02 Thread Vinson Lee
On Wed, Dec 2, 2015 at 2:36 PM,   wrote:
> From: Dylan Baker 
>
> Signed-off-by: Dylan Baker 
> ---
>  tests/all.py | 6 +-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/tests/all.py b/tests/all.py
> index 9f1b4f3..03da7cd 100644
> --- a/tests/all.py
> +++ b/tests/all.py
> @@ -20,6 +20,10 @@ __all__ = ['profile']
>  # doesn't trigger an error)
>  # pylint: disable=bad-continuation
>
> +# Shadowing variables is a bad practice. It's just nearly impossible with the
> +# format of this module to avoid it.
> +# pylint: disable=redefined-outer-name
> +
>
>  def add_single_param_test_set(adder, name, *params):
>  for param in params:
> @@ -201,7 +205,7 @@ def power_set(s):
>
>  ##
>  # Collecting all tests
> -profile = TestProfile()
> +profile = TestProfile()  # pylint: disable=invalid-name
>
>  # Find and add all shader tests.
>  for basedir in [TESTS_DIR, GENERATED_TESTS_DIR]:
> --
> 2.6.2
>
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit

Reviewed-by: Vinson Lee 
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] shader_runner: Add basic SSO support to shader runner

2015-12-02 Thread Timothy Arceri
On Thu, 2015-12-03 at 17:41 +1100, Timothy Arceri wrote:
> This sets up the basics for using SSO with shader runner. This will
> only support vertex and fragment shaders but is easily extended.
> 
> Example shader:
> 
> [require]
> GLSL >= 1.50
> 
> [vertex sso]

Git commit ate the version and extensions

#version 150
#extension GL_ARB_explicit_attrib_location: require
#extension GL_ARB_separate_shader_objects: require

here and for frag shader below.


> 
> layout(location = 0) in vec4 piglit_vertex;
> 
> layout(location = 2) out vec3 a;
> layout(location = 3) out vec3 b;
> 
> void main()
> {
> gl_Position = piglit_vertex;
> a = vec3(0, 0, 1);
> b = vec3(1, 0, 0);
> }
> 
> [fragment sso]
> 
> layout(location = 0) out vec4 out_color;
> 
> layout(location = 2) in vec3 b; /* should get vec3(0, 0, 1) */
> layout(location = 3) in vec3 a; /* should get vec3(1, 0, 0) */
> 
> void main()
> {
> out_color = vec4(cross(b, a), 1);
> }
> 
> [test]
> draw rect -1 -1 2 2
> probe all rgb 0 1 0
> ---
>  tests/shaders/shader_runner.c | 78
> ++-
>  1 file changed, 77 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/shaders/shader_runner.c
> b/tests/shaders/shader_runner.c
> index eeb1aac..6010ae2 100644
> --- a/tests/shaders/shader_runner.c
> +++ b/tests/shaders/shader_runner.c
> @@ -123,10 +123,12 @@ GLint shader_string_size;
>  const char *vertex_data_start = NULL;
>  const char *vertex_data_end = NULL;
>  GLuint prog;
> +GLuint pipeline;
>  size_t num_vbo_rows = 0;
>  bool vbo_present = false;
>  bool link_ok = false;
>  bool prog_in_use = false;
> +bool sso_in_use = false;
>  GLchar *prog_err_info = NULL;
>  GLuint vao = 0;
>  GLuint fbo = 0;
> @@ -137,12 +139,14 @@ enum states {
>   requirements,
>   vertex_shader,
>   vertex_shader_passthrough,
> + vertex_sso,
>   vertex_program,
>   tess_ctrl_shader,
>   tess_eval_shader,
>   geometry_shader,
>   geometry_layout,
>   fragment_shader,
> + fragment_sso,
>   fragment_program,
>   compute_shader,
>   vertex_data,
> @@ -480,6 +484,48 @@ compile_and_bind_program(GLenum target, const
> char *start, int len)
>   prog_in_use = true;
>  }
>  
> +void
> +create_sso(GLenum target, const char *start, int len)
> +{
> + GLuint prog;
> + GLint ok;
> + char *source;
> +
> + piglit_require_extension("GL_ARB_separate_shader_objects");
> +
> + source = malloc(len + 1);
> + memcpy(source, start, len);
> + source[len] = 0;
> + prog = glCreateShaderProgramv(target, 1,
> + (const GLchar *const *)
> );
> +
> + glGetProgramiv(prog, GL_LINK_STATUS, );
> + if (ok) {
> + link_ok = true;
> + } else {
> + GLint size;
> +
> + glGetProgramiv(prog, GL_INFO_LOG_LENGTH, );
> + prog_err_info = malloc(size);
> +
> + glGetProgramInfoLog(prog, size, NULL,
> prog_err_info);
> +
> + return;
> + }
> +
> + switch (target) {
> + case GL_VERTEX_SHADER:
> + glUseProgramStages(pipeline, GL_VERTEX_SHADER_BIT,
> prog);
> + break;
> + case GL_FRAGMENT_SHADER:
> + glUseProgramStages(pipeline, GL_FRAGMENT_SHADER_BIT,
> prog);
> + break;
> + }
> +
> + sso_in_use = true;
> + prog_in_use = true;
> +}
> +
>  /**
>   * Compare two values given a specified comparison operator
>   */
> @@ -846,6 +892,13 @@ leave_state(enum states state, const char *line)
>   compile_glsl(GL_VERTEX_SHADER);
>   break;
>  
> + case vertex_sso:
> + shader_string_size = line - shader_string;
> + create_sso(GL_VERTEX_SHADER,
> +shader_string,
> +line - shader_string);
> + break;
> +
>   case vertex_program:
>   compile_and_bind_program(GL_VERTEX_PROGRAM_ARB,
>shader_string,
> @@ -875,6 +928,12 @@ leave_state(enum states state, const char *line)
>   compile_glsl(GL_FRAGMENT_SHADER);
>   break;
>  
> + case fragment_sso:
> + create_sso(GL_FRAGMENT_SHADER,
> +shader_string,
> +line - shader_string);
> + break;
> +
>   case fragment_program:
>   compile_and_bind_program(GL_FRAGMENT_PROGRAM_ARB,
>shader_string,
> @@ -1043,6 +1102,9 @@ process_test_script(const char *script_name)
>   } else if (string_match("[vertex program]",
> line)) {
>   state = vertex_program;
>   shader_string = NULL;
> + } else if (string_match("[vertex sso]",
> line)) {
> + state = vertex_sso;
> + shader_string = NULL;
>   } else if 

Re: [Piglit] [PATCH 4/4] primitive-restart: Replace assert(glGetError()==0)

2015-12-02 Thread Vinson Lee
On Wed, Dec 2, 2015 at 8:49 AM, Ian Romanick  wrote:
> From: Ian Romanick 
>
> Signed-off-by: Ian Romanick 
> ---
>  tests/general/primitive-restart.c | 12 ++--
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/tests/general/primitive-restart.c 
> b/tests/general/primitive-restart.c
> index 53f4349..5cd8be3 100644
> --- a/tests/general/primitive-restart.c
> +++ b/tests/general/primitive-restart.c
> @@ -294,7 +294,7 @@ test_draw_by_index(VBO_CFG vbo_cfg, bool one_by_one, 
> GLenum primMode, GLenum ind
> GLfloat x, dx;
> GLuint restart_index;
> GLuint num_elems;
> -   bool pass;
> +   bool pass = true;
> const char *typeStr = NULL, *primStr = NULL;
> GLuint vbo1, vbo2;
> bool create_vbo1 = false;
> @@ -438,8 +438,8 @@ test_draw_by_index(VBO_CFG vbo_cfg, bool one_by_one, 
> GLenum primMode, GLenum ind
> }
>
> glEnableClientState(GL_VERTEX_ARRAY);
> +   pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
>
> -   assert(glGetError()==0);
> enable_restart(restart_index);
>
> /* Draw */
> @@ -466,13 +466,13 @@ test_draw_by_index(VBO_CFG vbo_cfg, bool one_by_one, 
> GLenum primMode, GLenum ind
>glDeleteBuffers(1, );
> }
>
> -   pass = check_rendering();
> -   if (!pass) {
> +   if (!check_rendering()) {
>fprintf(stderr, "%s: failure drawing with %s(%s, %s), %s\n",
>TestName,
>one_by_one ? "glArrayElement" : "glDrawElements",
>primStr, typeStr,
>vbo_cfg_names[vbo_cfg]);
> +  pass = false;
> }
>
> piglit_present_results();
> @@ -550,8 +550,8 @@ test_draw_arrays(VBO_CFG vbo_cfg)
> }
>
> glEnableClientState(GL_VERTEX_ARRAY);
> -
> -   assert(glGetError()==0);
> +   if (!piglit_check_gl_error(GL_NO_ERROR))
> +  return false;
>
> /*
>  * Render and do checks.
> --
> 2.5.0
>
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit

Reviewed-by: Vinson Lee 
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] shader_runner: Add basic SSO support to shader runner

2015-12-02 Thread Timothy Arceri
This sets up the basics for using SSO with shader runner. This will
only support vertex and fragment shaders but is easily extended.

Example shader:

[require]
GLSL >= 1.50

[vertex sso]

layout(location = 0) in vec4 piglit_vertex;

layout(location = 2) out vec3 a;
layout(location = 3) out vec3 b;

void main()
{
gl_Position = piglit_vertex;
a = vec3(0, 0, 1);
b = vec3(1, 0, 0);
}

[fragment sso]

layout(location = 0) out vec4 out_color;

layout(location = 2) in vec3 b; /* should get vec3(0, 0, 1) */
layout(location = 3) in vec3 a; /* should get vec3(1, 0, 0) */

void main()
{
out_color = vec4(cross(b, a), 1);
}

[test]
draw rect -1 -1 2 2
probe all rgb 0 1 0
---
 tests/shaders/shader_runner.c | 78 ++-
 1 file changed, 77 insertions(+), 1 deletion(-)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index eeb1aac..6010ae2 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -123,10 +123,12 @@ GLint shader_string_size;
 const char *vertex_data_start = NULL;
 const char *vertex_data_end = NULL;
 GLuint prog;
+GLuint pipeline;
 size_t num_vbo_rows = 0;
 bool vbo_present = false;
 bool link_ok = false;
 bool prog_in_use = false;
+bool sso_in_use = false;
 GLchar *prog_err_info = NULL;
 GLuint vao = 0;
 GLuint fbo = 0;
@@ -137,12 +139,14 @@ enum states {
requirements,
vertex_shader,
vertex_shader_passthrough,
+   vertex_sso,
vertex_program,
tess_ctrl_shader,
tess_eval_shader,
geometry_shader,
geometry_layout,
fragment_shader,
+   fragment_sso,
fragment_program,
compute_shader,
vertex_data,
@@ -480,6 +484,48 @@ compile_and_bind_program(GLenum target, const char *start, 
int len)
prog_in_use = true;
 }
 
+void
+create_sso(GLenum target, const char *start, int len)
+{
+   GLuint prog;
+   GLint ok;
+   char *source;
+
+   piglit_require_extension("GL_ARB_separate_shader_objects");
+
+   source = malloc(len + 1);
+   memcpy(source, start, len);
+   source[len] = 0;
+   prog = glCreateShaderProgramv(target, 1,
+   (const GLchar *const *) );
+
+   glGetProgramiv(prog, GL_LINK_STATUS, );
+   if (ok) {
+   link_ok = true;
+   } else {
+   GLint size;
+
+   glGetProgramiv(prog, GL_INFO_LOG_LENGTH, );
+   prog_err_info = malloc(size);
+
+   glGetProgramInfoLog(prog, size, NULL, prog_err_info);
+
+   return;
+   }
+
+   switch (target) {
+   case GL_VERTEX_SHADER:
+   glUseProgramStages(pipeline, GL_VERTEX_SHADER_BIT, prog);
+   break;
+   case GL_FRAGMENT_SHADER:
+   glUseProgramStages(pipeline, GL_FRAGMENT_SHADER_BIT, prog);
+   break;
+   }
+
+   sso_in_use = true;
+   prog_in_use = true;
+}
+
 /**
  * Compare two values given a specified comparison operator
  */
@@ -846,6 +892,13 @@ leave_state(enum states state, const char *line)
compile_glsl(GL_VERTEX_SHADER);
break;
 
+   case vertex_sso:
+   shader_string_size = line - shader_string;
+   create_sso(GL_VERTEX_SHADER,
+  shader_string,
+  line - shader_string);
+   break;
+
case vertex_program:
compile_and_bind_program(GL_VERTEX_PROGRAM_ARB,
 shader_string,
@@ -875,6 +928,12 @@ leave_state(enum states state, const char *line)
compile_glsl(GL_FRAGMENT_SHADER);
break;
 
+   case fragment_sso:
+   create_sso(GL_FRAGMENT_SHADER,
+  shader_string,
+  line - shader_string);
+   break;
+
case fragment_program:
compile_and_bind_program(GL_FRAGMENT_PROGRAM_ARB,
 shader_string,
@@ -1043,6 +1102,9 @@ process_test_script(const char *script_name)
} else if (string_match("[vertex program]", line)) {
state = vertex_program;
shader_string = NULL;
+   } else if (string_match("[vertex sso]", line)) {
+   state = vertex_sso;
+   shader_string = NULL;
} else if (string_match("[vertex shader passthrough]", 
line)) {
state = vertex_shader_passthrough;
shader_string =
@@ -1063,6 +1125,9 @@ process_test_script(const char *script_name)
} else if (string_match("[fragment shader]", line)) {
state = fragment_shader;
shader_string = NULL;
+   } else 

Re: [Piglit] [PATCH] glsl-es-3.00: Verify various UTF-8 clarifications from Khronos

2015-12-02 Thread Michel Dänzer
On 03.12.2015 01:42, Ian Romanick wrote:
> 
> +#define eat_sushi_using_chopsticks 寿司使用して箸を食べます。

The nouns are reversed in the Japanese text, so it actually means "eat
chopsticks using sushi". :) There should also be an を particle for the
chopsticks, so it should be 箸を使用して寿司を食べます。


-- 
Earthling Michel Dänzer   |   http://www.amd.com
Libre software enthusiast | Mesa and X developer
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 2/3] tests/all.py: Make MSAA_SAMPLE_COUNTS contain str() instead of int()

2015-12-02 Thread Vinson Lee
On Wed, Dec 2, 2015 at 2:36 PM,   wrote:
> From: Dylan Baker 
>
> In every case MSAA_SAMPLES_COUNTS are converted to str() anyway, (either
> explicitly by calling str(), or implicitly by str.format(). This is
> often done with a pattern like: (str(x) for x in MSAA_SAMPLE_COUNTS).
>
> This is just a waste of time when the values could be strings from the
> start.
>
> Signed-off-by: Dylan Baker 
> ---
>  tests/all.py | 61 
> ++--
>  1 file changed, 30 insertions(+), 31 deletions(-)
>
> diff --git a/tests/all.py b/tests/all.py
> index 03da7cd..9f1d0e9 100644
> --- a/tests/all.py
> +++ b/tests/all.py
> @@ -61,9 +61,9 @@ def add_fbo_depthstencil_tests(group, format, num_samples):
>  prefix = 'fbo-'
>  create_test = PiglitGLTest
>
> -if num_samples > 1:
> -suffix = ' samples=' + str(num_samples)
> -psamples = '-samples=' + str(num_samples)
> +if int(num_samples) > 1:
> +suffix = ' samples=' + num_samples
> +psamples = '-samples=' + num_samples
>  else:
>  suffix = ''
>  psamples = ''
> @@ -251,7 +251,7 @@ for dirpath, _, filenames in os.walk(_basedir):
>  ['asmparsertest', type_, os.path.join(dirpath, filename)])
>
>  # List of all of the MSAA sample counts we wish to test
> -MSAA_SAMPLE_COUNTS = (2, 4, 6, 8, 16, 32)
> +MSAA_SAMPLE_COUNTS = ('2', '4', '6', '8', '16', '32')
>
>  with profile.group_manager(GleanTest, 'glean') as g:
>  g('basic')
> @@ -980,7 +980,7 @@ with profile.group_manager(
>  for format in color_formats:
>  g(['teximage-colors', format], run_concurrent=False)
>
> -for num_samples in (0, ) + MSAA_SAMPLE_COUNTS:
> +for num_samples in ('0',) + MSAA_SAMPLE_COUNTS:
>  add_fbo_depthstencil_tests(
>  grouptools.join('spec', '!opengl 1.1'), 'default_fb', 
> num_samples)
>
> @@ -1436,7 +1436,7 @@ for stage in ['vs', 'gs', 'fs']:
>
>  for type in ('i', 'u', ''):
>  for sampler in ('sampler2DMS', 'sampler2DMSArray'):
> -for sample_count in (str(x) for x in MSAA_SAMPLE_COUNTS):
> +for sample_count in MSAA_SAMPLE_COUNTS:
>  stype = '{}{}'.format(type, sampler)
>  profile.test_list[grouptools.join(
>  'spec', 'arb_shader_texture_image_samples',
> @@ -1750,7 +1750,7 @@ with profile.group_manager(
>  g(['texelFetch', 'fs', 'sampler2DMSArray', '4', '98x129x1-98x129x9'])
>  g(['arb_texture_multisample-texstate'])
>  g(['arb_texture_multisample-errors'])
> -for sample_count in (str(x) for x in MSAA_SAMPLE_COUNTS):
> +for sample_count in MSAA_SAMPLE_COUNTS:
>  g(['arb_texture_multisample-texelfetch', sample_count])
>  g(['arb_texture_multisample-sample-mask'])
>  g(['arb_texture_multisample-sample-mask-value'])
> @@ -1769,7 +1769,7 @@ with profile.group_manager(
>  grouptools.join('spec', 'ARB_texture_multisample',
>  'fb-completeness')) as g:
>
> -for sample_count in (str(x) for x in MSAA_SAMPLE_COUNTS):
> +for sample_count in MSAA_SAMPLE_COUNTS:
>  # fb-completeness
>  g(['arb_texture_multisample-fb-completeness', sample_count],
>sample_count)
> @@ -1780,7 +1780,7 @@ with profile.group_manager(
>
>  stages = ['vs', 'gs', 'fs']
>  for sampler, stage, sample_count in itertools.product(
> -samplers_atm, stages, (str(x) for x in MSAA_SAMPLE_COUNTS)):
> +samplers_atm, stages, MSAA_SAMPLE_COUNTS):
>  g(['texelFetch', stage, sampler, sample_count],
>'{}-{}-{}'.format(sample_count, stage, sampler))
>
> @@ -1789,7 +1789,7 @@ with profile.group_manager(
>  grouptools.join('spec', 'ARB_texture_multisample',
>  'sample-position')) as g:
>  # sample positions
> -for sample_count in (str(x) for x in MSAA_SAMPLE_COUNTS):
> +for sample_count in MSAA_SAMPLE_COUNTS:
>  g(['arb_texture_multisample-sample-position', sample_count],
>sample_count)
>
> @@ -2209,20 +2209,20 @@ with profile.group_manager(
>  grouptools.join('spec', 'ARB_sample_shading')) as g:
>  g(['arb_sample_shading-api'], run_concurrent=False)
>
> -for num_samples in (0,) + MSAA_SAMPLE_COUNTS:
> -g(['arb_sample_shading-builtin-gl-num-samples', str(num_samples)],
> +for num_samples in ('0',) + MSAA_SAMPLE_COUNTS:
> +g(['arb_sample_shading-builtin-gl-num-samples', num_samples],
>'builtin-gl-num-samples {0}'.format(num_samples),
>run_concurrent=False)
> -g(['arb_sample_shading-builtin-gl-sample-id', str(num_samples)],
> +g(['arb_sample_shading-builtin-gl-sample-id', num_samples],
>'builtin-gl-sample-id {}'.format(num_samples), 
> run_concurrent=False)
> -g(['arb_sample_shading-builtin-gl-sample-mask', 

Re: [Piglit] [PATCH] glsl-1.10: add a test that has an a while loop with unconditional return

2015-12-02 Thread Tapani Pälli

Reviewed-by: Tapani Pälli 

On 12/03/2015 01:44 AM, Ilia Mirkin wrote:

Signed-off-by: Ilia Mirkin 
---

This crashes on nouveau, passes on i965/hsw and llvmpipe.

  .../glsl-1.10/execution/fs-loop-return.shader_test   | 20 
  1 file changed, 20 insertions(+)
  create mode 100644 tests/spec/glsl-1.10/execution/fs-loop-return.shader_test

diff --git a/tests/spec/glsl-1.10/execution/fs-loop-return.shader_test 
b/tests/spec/glsl-1.10/execution/fs-loop-return.shader_test
new file mode 100644
index 000..701bf60
--- /dev/null
+++ b/tests/spec/glsl-1.10/execution/fs-loop-return.shader_test
@@ -0,0 +1,20 @@
+# This test verifies that loop unrolling properly interprets a variety
+# of ways of specifying loop bounds.
+
+[require]
+GLSL >= 1.10
+
+[vertex shader passthrough]
+
+[fragment shader]
+void main()
+{
+  gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
+  while (true) {
+return;
+  }
+}
+
+[test]
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0


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


Re: [Piglit] [PATCH 3/3] tests/all.py: Make MSAA_SAMPLE_COUNTS a list instead of a tuple

2015-12-02 Thread Ilia Mirkin
On Wed, Dec 2, 2015 at 9:04 PM, Dylan Baker  wrote:
> On Wed, Dec 02, 2015 at 06:13:48PM -0500, Ilia Mirkin wrote:
>> On Wed, Dec 2, 2015 at 5:36 PM,   wrote:
>> > From: Dylan Baker 
>> >
>> > The problem with using MSAA_SAMPLE_COUNTS as a tuple is that it isn't a
>> > tuple. It's a sequence of like values, and is combined with other
>> > sequences of values, this is what a list is for.
>>
>> Huh? List = mutable, tuple = immutable. This seems immutable, so it
>> should be a tuple. What am I missing?
>
> I had a very lengthy response trying to explain why this should be a
> list not a tuple, but I think this does a better job of explaining my
> position:
> http://news.e-scribe.com/397

So basically because you have some notion that some things should be
in lists and other things should be in tuples and the current
arrangement makes you feel icky? FWIW it makes me feel icky whenever I
see a list used for something that's immutable.

  -ilia
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 3/3] tests/all.py: Make MSAA_SAMPLE_COUNTS a list instead of a tuple

2015-12-02 Thread Ilia Mirkin
On Wed, Dec 2, 2015 at 5:36 PM,   wrote:
> From: Dylan Baker 
>
> The problem with using MSAA_SAMPLE_COUNTS as a tuple is that it isn't a
> tuple. It's a sequence of like values, and is combined with other
> sequences of values, this is what a list is for.

Huh? List = mutable, tuple = immutable. This seems immutable, so it
should be a tuple. What am I missing?

>
> Signed-off-by: Dylan Baker 
> ---
>  tests/all.py | 12 ++--
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/tests/all.py b/tests/all.py
> index 9f1d0e9..50cc2b7 100644
> --- a/tests/all.py
> +++ b/tests/all.py
> @@ -251,7 +251,7 @@ for dirpath, _, filenames in os.walk(_basedir):
>  ['asmparsertest', type_, os.path.join(dirpath, filename)])
>
>  # List of all of the MSAA sample counts we wish to test
> -MSAA_SAMPLE_COUNTS = ('2', '4', '6', '8', '16', '32')
> +MSAA_SAMPLE_COUNTS = ['2', '4', '6', '8', '16', '32']
>
>  with profile.group_manager(GleanTest, 'glean') as g:
>  g('basic')
> @@ -980,7 +980,7 @@ with profile.group_manager(
>  for format in color_formats:
>  g(['teximage-colors', format], run_concurrent=False)
>
> -for num_samples in ('0',) + MSAA_SAMPLE_COUNTS:
> +for num_samples in ['0'] + MSAA_SAMPLE_COUNTS:
>  add_fbo_depthstencil_tests(
>  grouptools.join('spec', '!opengl 1.1'), 'default_fb', 
> num_samples)
>
> @@ -2209,7 +2209,7 @@ with profile.group_manager(
>  grouptools.join('spec', 'ARB_sample_shading')) as g:
>  g(['arb_sample_shading-api'], run_concurrent=False)
>
> -for num_samples in ('0',) + MSAA_SAMPLE_COUNTS:
> +for num_samples in ['0'] + MSAA_SAMPLE_COUNTS:
>  g(['arb_sample_shading-builtin-gl-num-samples', num_samples],
>'builtin-gl-num-samples {0}'.format(num_samples),
>run_concurrent=False)
> @@ -2230,7 +2230,7 @@ with profile.group_manager(
>'ignore-centroid-qualifier {}'.format(sample_count),
>run_concurrent=False)
>
> -for num_samples in ('0',) + MSAA_SAMPLE_COUNTS:
> +for num_samples in ['0',] + MSAA_SAMPLE_COUNTS:
>  g(['arb_sample_shading-builtin-gl-sample-mask-simple',
> num_samples],
>'builtin-gl-sample-mask-simple {}'.format(num_samples))
> @@ -2793,7 +2793,7 @@ with profile.group_manager(
> sample_count],
>'alpha-blending-after-rendering {}'.format(sample_count))
>
> -for num_samples in ('all_samples',) + MSAA_SAMPLE_COUNTS:
> +for num_samples in ['all_samples'] + MSAA_SAMPLE_COUNTS:
>  g(['ext_framebuffer_multisample-formats', num_samples],
>'formats {}'.format(num_samples))
>
> @@ -2810,7 +2810,7 @@ with profile.group_manager(
>  # Note: the interpolation tests also check for sensible behaviour with
>  # non-multisampled framebuffers, so go ahead and test them with
>  # num_samples==0 as well.
> -for num_samples in ('0',) + MSAA_SAMPLE_COUNTS:
> +for num_samples in ['0'] + MSAA_SAMPLE_COUNTS:
>  g(['ext_framebuffer_multisample-blit-multiple-render-targets',
> num_samples],
>'blit-multiple-render-targets {}'.format(num_samples))
> --
> 2.6.2
>
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] glsl-1.10: add a test that has an a while loop with unconditional return

2015-12-02 Thread Ilia Mirkin
Signed-off-by: Ilia Mirkin 
---

This crashes on nouveau, passes on i965/hsw and llvmpipe.

 .../glsl-1.10/execution/fs-loop-return.shader_test   | 20 
 1 file changed, 20 insertions(+)
 create mode 100644 tests/spec/glsl-1.10/execution/fs-loop-return.shader_test

diff --git a/tests/spec/glsl-1.10/execution/fs-loop-return.shader_test 
b/tests/spec/glsl-1.10/execution/fs-loop-return.shader_test
new file mode 100644
index 000..701bf60
--- /dev/null
+++ b/tests/spec/glsl-1.10/execution/fs-loop-return.shader_test
@@ -0,0 +1,20 @@
+# This test verifies that loop unrolling properly interprets a variety
+# of ways of specifying loop bounds.
+
+[require]
+GLSL >= 1.10
+
+[vertex shader passthrough]
+
+[fragment shader]
+void main()
+{
+  gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
+  while (true) {
+return;
+  }
+}
+
+[test]
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
-- 
2.4.10

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


[Piglit] Piglit and Android (Was Re: [PATCH v3] khr_texture_compression_astc: Enable subtest reports)

2015-12-02 Thread Emil Velikov
On 1 December 2015 at 19:14, Ilia Mirkin  wrote:

> There's no easy way (currently) to run piglit tests against android
> userspace, and even if there were, their drivers tend to be pretty
> weak in terms of ... working.
>
While I cannot comment on the driver side there has been two attempts
at the android integration by Tom [1] and Adrian [2]. The former
received some criticism which was addressed in the latter with the
latter never reaching the ML :-\ One of the Android-x86 guys gave the
latter a (re)spin [3] although I'm not sure if (how well) it works.

Hmm I'm wondering if any of Tom's piglits [4] are still applicable...
would be nice to get those in as well.

Tom, Adrian,

What prevented you from sending your work upstream ? Do you have plans
on doing so in the near future ?

Thanks
Emil

[1] http://lists.freedesktop.org/archives/piglit/2013-February/004799.html
[2] https://github.com/groleo/piglit/commits/android
[3] https://github.com/maurossi/piglit/tree/android-x86_from_groleo
[4] https://git.linaro.org/people/tom.gall/piglit.git
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit