[Piglit] [PATCH] arb_texture_view: convert sampling-2d-array-* to GLES compatibility

2016-09-17 Thread Ilia Mirkin
Signed-off-by: Ilia Mirkin 
---
 tests/all.py   |  6 ++
 tests/spec/arb_texture_view/CMakeLists.gles3.txt   |  3 +
 .../sampling-2d-array-as-2d-layer.c| 72 +-
 .../sampling-2d-array-as-cubemap-array.c   | 63 ---
 .../sampling-2d-array-as-cubemap.c | 59 +++---
 5 files changed, 129 insertions(+), 74 deletions(-)

diff --git a/tests/all.py b/tests/all.py
index 4a5b3e6..f57be72 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -2595,6 +2595,12 @@ with profile.group_manager(
 g(['arb_texture_view-rendering-layers_gles3'], 'rendering-layers')
 g(['arb_texture_view-rendering-levels_gles3'], 'rendering-levels')
 g(['arb_texture_view-rendering-target_gles3'], 'rendering-target')
+g(['arb_texture_view-sampling-2d-array-as-cubemap_gles3'],
+  'sampling-2d-array-as-cubemap')
+g(['arb_texture_view-sampling-2d-array-as-cubemap-array_gles3'],
+  'sampling-2d-array-as-cubemap-array')
+g(['arb_texture_view-sampling-2d-array-as-2d-layer_gles3'],
+  'sampling-2d-array-as-2d-layer')
 
 with profile.group_manager(
 PiglitGLTest,
diff --git a/tests/spec/arb_texture_view/CMakeLists.gles3.txt 
b/tests/spec/arb_texture_view/CMakeLists.gles3.txt
index 02ce468..2096f20 100644
--- a/tests/spec/arb_texture_view/CMakeLists.gles3.txt
+++ b/tests/spec/arb_texture_view/CMakeLists.gles3.txt
@@ -4,3 +4,6 @@ piglit_add_executable(arb_texture_view-rendering-formats_gles3 
rendering-formats
 piglit_add_executable(arb_texture_view-rendering-layers_gles3 
rendering_layers.c common.c)
 piglit_add_executable(arb_texture_view-rendering-levels_gles3 
rendering_levels.c common.c)
 piglit_add_executable(arb_texture_view-rendering-target_gles3 
rendering_target.c common.c)
+piglit_add_executable(arb_texture_view-sampling-2d-array-as-2d-layer_gles3 
sampling-2d-array-as-2d-layer.c)
+piglit_add_executable(arb_texture_view-sampling-2d-array-as-cubemap_gles3 
sampling-2d-array-as-cubemap.c)
+piglit_add_executable(arb_texture_view-sampling-2d-array-as-cubemap-array_gles3
 sampling-2d-array-as-cubemap-array.c)
diff --git a/tests/spec/arb_texture_view/sampling-2d-array-as-2d-layer.c 
b/tests/spec/arb_texture_view/sampling-2d-array-as-2d-layer.c
index 8189044..e6b49d1 100644
--- a/tests/spec/arb_texture_view/sampling-2d-array-as-2d-layer.c
+++ b/tests/spec/arb_texture_view/sampling-2d-array-as-2d-layer.c
@@ -33,13 +33,14 @@
 
 PIGLIT_GL_TEST_CONFIG_BEGIN
config.supports_gl_compat_version = 30;
-// config.supports_gl_core_version = 32;
+   config.supports_gl_es_version = 31;
config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
 
 PIGLIT_GL_TEST_CONFIG_END
 
-static const float green[] = {0, 1, 0, 1};
-static const float red[] = {1, 0, 0, 1};
+static const GLubyte green[] = {0, 255, 0, 255};
+static const float greenf[] = {0, 1.0f, 0, 1.0f};
+static const GLubyte red[] = {255, 0, 0, 255};
 
 typedef struct Params {
int num_layers;
@@ -62,9 +63,9 @@ static const Params testparams[] = {
{ 3, 35, 67, "35x67" }
 };
 
-static float *makesolidimage(int w, int h, const float color[4])
+static GLubyte *makesolidimage(int w, int h, const GLubyte color[4])
 {
-   float *p = malloc(w * h * 4 * sizeof(GLfloat));
+   GLubyte *p = malloc(w * h * 4 * sizeof(GLubyte));
size_t n;
assert(p);
for (n = 0; n < w * h; n++) {
@@ -82,7 +83,7 @@ test_single_layer(const Params* p, int layer)
int l;
GLuint tex_src, tex_view;
GLboolean pass;
-   GLfloat *image;
+   GLubyte *image;
 
assert(layer < p->num_layers);
 
@@ -95,14 +96,14 @@ test_single_layer(const Params* p, int layer)
image = makesolidimage(p->width, p->height, red);
for (l = 0; l < p->num_layers; l++) {
glTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, l,
-   p->width, p->height, 1, GL_RGBA, GL_FLOAT, 
image);
+   p->width, p->height, 1, GL_RGBA, 
GL_UNSIGNED_BYTE, image);
}
 
/* make layer to check red, but green for pixel at (0,0) which should 
be the only one sampled */
memcpy(image, green, sizeof(green));
 
glTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, layer,
-   p->width, p->height, 1, GL_RGBA, GL_FLOAT, image);
+   p->width, p->height, 1, GL_RGBA, GL_UNSIGNED_BYTE, 
image);
 
free(image);
 
@@ -120,7 +121,7 @@ test_single_layer(const Params* p, int layer)
/* draw it! */
piglit_draw_rect(-1, -1, 2, 2);
 
-   pass = piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height, green);
+   pass = piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height, 
greenf);
if (!pass) {
printf("layer %d failed\n", layer);
}
@@ -158,35 +159,48 @@ piglit_display(void)
return pass ? PIGLIT_PASS : 

[Piglit] [PATCH] arb_texture_view: convert remainder of rendering_* to work with GLES

2016-09-17 Thread Ilia Mirkin
These tests used a mix of GL 1.x and newer functionality. This switches
all of them up to require GL 3.0 to avoid annoyance. All hardware that
can support texture views is GL 3.0-capable.

Signed-off-by: Ilia Mirkin 
---
 tests/spec/arb_texture_view/CMakeLists.gles3.txt |   3 +
 tests/spec/arb_texture_view/common.c |  22 ++--
 tests/spec/arb_texture_view/rendering_layers.c   |  65 ++-
 tests/spec/arb_texture_view/rendering_levels.c   |  53 +++--
 tests/spec/arb_texture_view/rendering_target.c   | 137 ++-
 5 files changed, 184 insertions(+), 96 deletions(-)

diff --git a/tests/spec/arb_texture_view/CMakeLists.gles3.txt 
b/tests/spec/arb_texture_view/CMakeLists.gles3.txt
index c590925..02ce468 100644
--- a/tests/spec/arb_texture_view/CMakeLists.gles3.txt
+++ b/tests/spec/arb_texture_view/CMakeLists.gles3.txt
@@ -1,3 +1,6 @@
 link_libraries(piglitutil_${piglit_target_api})
 
 piglit_add_executable(arb_texture_view-rendering-formats_gles3 
rendering-formats.c)
+piglit_add_executable(arb_texture_view-rendering-layers_gles3 
rendering_layers.c common.c)
+piglit_add_executable(arb_texture_view-rendering-levels_gles3 
rendering_levels.c common.c)
+piglit_add_executable(arb_texture_view-rendering-target_gles3 
rendering_target.c common.c)
diff --git a/tests/spec/arb_texture_view/common.c 
b/tests/spec/arb_texture_view/common.c
index dedb411..10d3708 100644
--- a/tests/spec/arb_texture_view/common.c
+++ b/tests/spec/arb_texture_view/common.c
@@ -104,18 +104,14 @@ update_valid_arrays(GLenum *valid, GLenum *invalid, 
unsigned int numInvalid,
 void
 draw_3d_depth(float x, float y, float w, float h, int depth)
 {
-   const GLfloat vertices[12] =  {x, y, 0.0,
-x+w, y, 0.0,
-x+w, y+h, 0.0,
-x, y+h, 0.0};
-   const GLfloat texcoords[12] = {0.0, 0.0, depth,
-1.0, 0.0, depth,
-1.0, 1.0, depth,
-0.0, 1.0, depth};
+   const GLfloat vertices[16] =  {x, y, depth, 0.0,
+x+w, y, depth, 0.0,
+x+w, y+h, depth, 0.0,
+x, y+h, depth, 0.0};
+   const GLfloat texcoords[8] = {0.0, 0.0,
+1.0, 0.0,
+1.0, 1.0,
+0.0, 1.0};
 
-   glVertexPointer(3, GL_FLOAT, 0, vertices);
-   glEnableClientState(GL_VERTEX_ARRAY);
-   glEnableClientState(GL_TEXTURE_COORD_ARRAY);
-   glTexCoordPointer(3, GL_FLOAT, 0, texcoords);
-   glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
+   piglit_draw_rect_from_arrays(vertices, texcoords, false);
 }
diff --git a/tests/spec/arb_texture_view/rendering_layers.c 
b/tests/spec/arb_texture_view/rendering_layers.c
index a461b08..e122a3a 100644
--- a/tests/spec/arb_texture_view/rendering_layers.c
+++ b/tests/spec/arb_texture_view/rendering_layers.c
@@ -34,7 +34,8 @@
 
 PIGLIT_GL_TEST_CONFIG_BEGIN
 
-   config.supports_gl_compat_version = 20;
+   config.supports_gl_compat_version = 30;
+   config.supports_gl_es_version = 31;
 
config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
 
@@ -55,7 +56,7 @@ test_render_layers(void)
GLint l;
GLint numLayers[] = {7, 1, 2, 2};
int expectedLayer;
-   GLfloat expected[3];
+   GLfloat expected[4];
int p;
bool pass = true;
 
@@ -105,9 +106,10 @@ test_render_layers(void)
expected[0] = Colors[expectedLayer][0] / 255.0;
expected[1] = Colors[expectedLayer][1] / 255.0;
expected[2] = Colors[expectedLayer][2] / 255.0;
+   expected[3] = 1.0;
 
-   p = piglit_probe_pixel_rgb(piglit_width/2, piglit_height/2,
-  expected);
+   p = piglit_probe_pixel_rgba(piglit_width/2, piglit_height/2,
+   expected);
 
piglit_present_results();
 
@@ -148,34 +150,47 @@ piglit_display(void)
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
 
+#ifdef PIGLIT_USE_OPENGL
+#define GLSL_VERSION "130"
+#else
+#define GLSL_VERSION "310 es"
+#endif
+
+static const char *vs =
+   "#version " GLSL_VERSION "\n"
+   "in vec4 piglit_vertex;\n"
+   "in vec2 piglit_texcoord;\n"
+   "out vec3 texcoord;\n"
+   "void main() { \n"
+   "   gl_Position = vec4(piglit_vertex.xy, 0.0, 1.0);\n"
+   "   texcoord = vec3(piglit_texcoord, piglit_vertex.z);\n"
+   "}\n";
+
+static const char *fs =
+   "#version " GLSL_VERSION "\n"
+   "#ifdef GL_ES\n"
+   "precision highp float;\n"
+   "precision highp sampler2DArray;\n"
+   "#endif\n"
+   "in vec3 texcoord;\n"
+   "uniform sampler2DArray tex;\n"
+   "out vec4 color;\n"
+   "void main() { \n"

[Piglit] [PATCH] arb_texture_view: start converting for GL_OES_texture_view friendliness

2016-09-17 Thread Ilia Mirkin
Signed-off-by: Ilia Mirkin 
---
 tests/all.py |   5 +
 tests/spec/arb_texture_view/CMakeLists.gles3.txt |   3 +
 tests/spec/arb_texture_view/rendering-formats.c  | 621 +--
 3 files changed, 471 insertions(+), 158 deletions(-)
 create mode 100644 tests/spec/arb_texture_view/CMakeLists.gles3.txt

diff --git a/tests/all.py b/tests/all.py
index bc400e6..4229f2a 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -2590,6 +2590,11 @@ with profile.group_manager(
 
 with profile.group_manager(
 PiglitGLTest,
+grouptools.join('spec', 'OES_texture_view')) as g:
+g(['arb_texture_view-rendering-formats_gles3'], 'rendering-formats')
+
+with profile.group_manager(
+PiglitGLTest,
 grouptools.join('spec', '3DFX_texture_compression_FXT1')) as g:
 g(['compressedteximage', 'GL_COMPRESSED_RGB_FXT1_3DFX'])
 g(['compressedteximage', 'GL_COMPRESSED_RGBA_FXT1_3DFX'])
diff --git a/tests/spec/arb_texture_view/CMakeLists.gles3.txt 
b/tests/spec/arb_texture_view/CMakeLists.gles3.txt
new file mode 100644
index 000..c590925
--- /dev/null
+++ b/tests/spec/arb_texture_view/CMakeLists.gles3.txt
@@ -0,0 +1,3 @@
+link_libraries(piglitutil_${piglit_target_api})
+
+piglit_add_executable(arb_texture_view-rendering-formats_gles3 
rendering-formats.c)
diff --git a/tests/spec/arb_texture_view/rendering-formats.c 
b/tests/spec/arb_texture_view/rendering-formats.c
index fe996b8..a5333bb 100644
--- a/tests/spec/arb_texture_view/rendering-formats.c
+++ b/tests/spec/arb_texture_view/rendering-formats.c
@@ -39,228 +39,310 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
config.window_width = TEX_SIZE,
config.window_height = TEX_SIZE,
config.supports_gl_compat_version = 30;
+   config.supports_gl_es_version = 31;
config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
 
 PIGLIT_GL_TEST_CONFIG_END
 
+#ifdef PIGLIT_USE_OPENGL
+#define GLSL_VERSION "130"
+#else
+#define GLSL_VERSION "310 es"
+#endif
+
 static const char *vs =
-   "#version 130\n"
+   "#version " GLSL_VERSION "\n"
+   "in vec4 piglit_vertex;\n"
"void main() { \n"
-   "   gl_Position = gl_Vertex;\n"
+   "   gl_Position = piglit_vertex;\n"
"}\n";
 
 static const char *fs_render_float =
-   "#version 130\n"
+   "#version " GLSL_VERSION "\n"
+   "#ifdef GL_ES\n"
+   "precision highp float;\n"
+   "#endif\n"
"uniform vec4 v;\n"
-   "out vec4 color;"
+   "out vec4 color;\n"
"void main() { \n"
"   color = v;\n"
"}\n";
 
 static const char *fs_render_uint =
-   "#version 130\n"
+   "#version " GLSL_VERSION "\n"
+   "#ifdef GL_ES\n"
+   "precision highp int;\n"
+   "#endif\n"
"uniform uvec4 v;\n"
-   "out uvec4 color;"
+   "out uvec4 color;\n"
"void main() { \n"
"   color = v;\n"
"}\n";
 
 static const char *fs_render_sint =
-   "#version 130\n"
+   "#version " GLSL_VERSION "\n"
+   "#ifdef GL_ES\n"
+   "precision highp int;\n"
+   "#endif\n"
"uniform ivec4 v;\n"
-   "out ivec4 color;"
+   "out ivec4 color;\n"
"void main() { \n"
"   color = v;\n"
"}\n";
 
 static const char *fs128_uint32 =
-   "#version 130\n"
+   "#version " GLSL_VERSION "\n"
+   "#ifdef GL_ES\n"
+   "precision highp float;\n"
+   "precision highp usampler2D;\n"
+   "#endif\n"
"uniform usampler2D s;\n"
+   "out vec4 color;\n"
"void main() { \n"
"   if (texture(s, vec2(0.0)) == uvec4(\n"
"   0x3f80u,\n"
"   0x3e80u,\n"
"   0xbf80u,\n"
"   0xu)) {\n"
-   "   gl_FragColor = vec4(0,1,0,0);\n"
+   "   color = vec4(0,1,0,0);\n"
"   } else {\n"
-   "   gl_FragColor = vec4(1,0,0,0);\n"
+   "   color = vec4(1,0,0,0);\n"
"   }\n"
"}\n";
 
 static const char *fs128_sint32 =
-   "#version 130\n"
+   "#version " GLSL_VERSION "\n"
+   "#ifdef GL_ES\n"
+   "precision highp float;\n"
+   "precision highp isampler2D;\n"
+   "#endif\n"
"uniform isampler2D s;\n"
+   "out vec4 color;\n"
"void main() { \n"
"   if (texture(s, vec2(0.0)) == ivec4(\n"
"   0x3f80,\n"
"   0x3e80,\n"
"   0xbf80,\n"
"   0x)) {\n"
-   "   gl_FragColor = vec4(0,1,0,0);\n"
+   "   color = vec4(0,1,0,0);\n"
"   } else {\n"
-   "   gl_FragColor = vec4(1,0,0,0);\n"
+   "   color = vec4(1,0,0,0);\n"
"   }\n"
"}\n";
 
 static const char *fs128_float32 =
-   "#version 130\n"
+   "#version " 

Re: [Piglit] [PATCH] arb_viewport_array: rework tests to work with GL_OES_viewport_array

2016-09-17 Thread Kenneth Graunke
On Friday, September 16, 2016 3:38:49 PM PDT Ilia Mirkin wrote:
> This makes some fairly simple changes to the existing tests to also work
> with GL_OES_viewport_array, which presents largely identical
> functionality. All of the tests continue to pass with desktop GL, and
> also work with my soon-to-be-posted GL ES implementation for mesa.
> 
> Signed-off-by: Ilia Mirkin 

I skimmed through this and it looks fine to me

Reviewed-by: Kenneth Graunke 


signature.asc
Description: This is a digitally signed message part.
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 2/2] framework: Make driver_classifier convert to str (unicode)

2016-09-17 Thread Eric Anholt
Dylan Baker  writes:

> In python2 the code as is works, although there might be odd corners. In
> python 3 it fails because the code tries to match bytes and strs, which
> doesn't work at all.
>
> This patch fixes the issue by converting the output from bytes to str
> (unicode) immediately, so we don't have to think about it again.
>
> CC: Eric Anholt 
> Reported-by: Dan Kegel 
> Signed-off-by: Dylan Baker 

I see you've pushed, but I wanted to say thanks for taking care of this!


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