Re: [Piglit] [PATCH 2/2] polygon-mode: also test polygon culling

2018-07-20 Thread Charmaine Lee

For the series, Reviewed-by: Charmaine Lee 


From: Brian Paul 
Sent: Friday, July 20, 2018 8:48:12 AM
To: piglit@lists.freedesktop.org
Cc: Neha Bhende; Charmaine Lee; Brian Paul
Subject: [PATCH 2/2] polygon-mode: also test polygon culling

Test polygon culling with glPolygonMode for better coverage.
---
 tests/general/polygon-mode.c | 87 +++-
 1 file changed, 54 insertions(+), 33 deletions(-)

diff --git a/tests/general/polygon-mode.c b/tests/general/polygon-mode.c
index c41c392..709c6db 100644
--- a/tests/general/polygon-mode.c
+++ b/tests/general/polygon-mode.c
@@ -217,7 +217,7 @@ identify_primitive(const GLfloat positions[4][2],


 static GLboolean
-test_combo(GLenum frontMode, GLenum backMode)
+test_combo(GLenum frontMode, GLenum backMode, GLenum cullMode)
 {
GLenum frontPrim = get_prim_mode(frontMode);
GLenum backPrim = get_prim_mode(backMode);
@@ -225,26 +225,49 @@ test_combo(GLenum frontMode, GLenum backMode)
GLenum expectedPrims[4];
int i;

+   glDisable(GL_CULL_FACE);
+
/* Draw reference image */
glClear(GL_COLOR_BUFFER_BIT);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
-   glDrawArrays(frontPrim, 0, 4);
-   glDrawArrays(backPrim, 4, 4);
-   glDrawArrays(frontPrim, 8, 4);
-   glDrawArrays(backPrim, 12, 4);
+   if (cullMode == GL_NONE || cullMode == GL_BACK) {
+  glDrawArrays(frontPrim, 0, 4);
+   }
+   if (cullMode == GL_NONE || cullMode == GL_FRONT) {
+  glDrawArrays(backPrim, 4, 4);
+   }
+   if (cullMode == GL_NONE || cullMode == GL_BACK) {
+  glDrawArrays(frontPrim, 8, 4);
+   }
+   if (cullMode == GL_NONE || cullMode == GL_FRONT) {
+  glDrawArrays(backPrim, 12, 4);
+   }

/* determine what kind of primitives were drawn */
for (i = 0; i < 4; i++) {
-  GLenum testMode = (i & 1) ? backMode : frontMode;
+  GLenum testMode = GL_NONE;
+
+  if (i & 1) {
+/* back-facing quad */
+if (cullMode == GL_NONE || cullMode == GL_FRONT) {
+   testMode = backMode;
+}
+  } else {
+/* front-facing quad */
+if (cullMode == GL_NONE || cullMode == GL_BACK) {
+   testMode = frontMode;
+}
+  }

   expectedPrims[i] = identify_primitive([4 * i], Colors[4 * i]);

   if (expectedPrims[i] != testMode) {
  /* we didn't get the expected reference primitive */
  fprintf(stderr,
- "%s: reference drawing failed for frontPrim=%s, 
backPrim=%s\n",
+ "%s: reference drawing failed for frontPrim=%s, backPrim=%s, 
cull=%s\n",
  TestName, piglit_get_gl_enum_name(frontMode),
-piglit_get_gl_enum_name(backMode));
+piglit_get_gl_enum_name(backMode),
+piglit_get_gl_enum_name(cullMode));
 fprintf(stderr, "At position %d, found prim %s instead of %s\n",
 i, piglit_get_gl_enum_name(expectedPrims[i]),
 piglit_get_gl_enum_name(testMode));
@@ -256,15 +279,22 @@ test_combo(GLenum frontMode, GLenum backMode)
glClear(GL_COLOR_BUFFER_BIT);
glPolygonMode(GL_FRONT, frontMode);
glPolygonMode(GL_BACK, backMode);
+   if (cullMode == GL_NONE) {
+  glDisable(GL_CULL_FACE);
+   } else {
+  glEnable(GL_CULL_FACE);
+  glCullFace(cullMode);
+   }
glDrawArrays(GL_QUADS, 0, 16);

/* check that these prims match the reference prims */
for (i = 0; i < 4; i++) {
   GLenum prim = identify_primitive([4 * i], Colors[4 * i]);
   if (prim != expectedPrims[i]) {
- fprintf(stderr, "%s: glPolygonMode(front=%s, back=%s) failed\n",
+ fprintf(stderr, "%s: glPolygonMode(front=%s, back=%s), glCullMode(%s) 
failed\n",
  TestName, piglit_get_gl_enum_name(frontMode),
-piglit_get_gl_enum_name(backMode));
+piglit_get_gl_enum_name(backMode),
+piglit_get_gl_enum_name(cullMode));
 fprintf(stderr, "At position %d, found prim %s instead of %s\n",
 i, piglit_get_gl_enum_name(prim),
 piglit_get_gl_enum_name(expectedPrims[i]));
@@ -281,7 +311,12 @@ test_combo(GLenum frontMode, GLenum backMode)
 static GLboolean
 test_polygonmode(void)
 {
+   static const GLenum cullModes[] =
+  { GL_NONE, GL_FRONT, GL_BACK, GL_FRONT_AND_BACK };
+   static const GLenum fillModes[] =
+  { GL_FILL, GL_LINE, GL_POINT };
GLenum pass = GL_TRUE;
+   int i, j, k;

glVertexPointer(2, GL_FLOAT, 0, Positions);
glColorPointer(4, GL_FLOAT, 0, Colors);
@@ -289,29 +324,15 @@ test_polygonmode(void)
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);

-   if (!test_combo(GL_FILL, GL_LINE))
-  pass = GL_FALSE;
-
-   if (!test_combo(GL_FILL, GL_POINT))
-  pass = GL_FALSE;
-
-   if (!test_combo(GL_POINT, GL_LINE))
-  pass = GL_FALSE;
-
-   if (!test_combo

Re: [Piglit] [PATCH] gl-1.5-get-array-attribs: exercise glGetIntegerv, etc. with vertex arrays

2018-05-09 Thread Charmaine Lee

Reviewed-by: Charmaine Lee <charmai...@vmware.com>


From: Brian Paul <bri...@vmware.com>
Sent: Wednesday, May 9, 2018 8:30:05 AM
To: piglit@lists.freedesktop.org
Cc: xuelian@samsung.com; Neha Bhende; Charmaine Lee; Brian Paul
Subject: [PATCH] gl-1.5-get-array-attribs: exercise glGetIntegerv, etc. with 
vertex arrays

This new test checks that glGetInteger/Fload/Double/Booleanv() return the
right values when querying vertex array attributes.

Currently broken in Mesa.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106450
---
 tests/opengl.py   |   1 +
 tests/spec/gl-1.5/CMakeLists.gl.txt   |   1 +
 tests/spec/gl-1.5/get-array-attribs.c | 135 ++
 3 files changed, 137 insertions(+)
 create mode 100644 tests/spec/gl-1.5/get-array-attribs.c

diff --git a/tests/opengl.py b/tests/opengl.py
index 825e0bf..cbc4e39 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -801,6 +801,7 @@ with profile.test_list.group_manager(
 g(['draw-vertices', 'user'], 'draw-vertices-user')
 g(['isbufferobj'])
 g(['depth-tex-compare'])
+g(['gl-1.5-get-array-attribs'])
 g(['gl-1.5-normal3b3s-invariance', 'GL_BYTE'],
   'normal3b3s-invariance-byte')
 g(['gl-1.5-normal3b3s-invariance', 'GL_SHORT'],
diff --git a/tests/spec/gl-1.5/CMakeLists.gl.txt 
b/tests/spec/gl-1.5/CMakeLists.gl.txt
index e072757..6cc69f5 100644
--- a/tests/spec/gl-1.5/CMakeLists.gl.txt
+++ b/tests/spec/gl-1.5/CMakeLists.gl.txt
@@ -8,6 +8,7 @@ link_libraries (
${OPENGL_gl_LIBRARY}
 )

+piglit_add_executable (gl-1.5-get-array-attribs get-array-attribs.c)
 piglit_add_executable (gl-1.5-normal3b3s-invariance normal3b3s-invariance.c)
 piglit_add_executable (gl-1.5-vertex-buffer-offsets vertex-buffer-offsets.c)

diff --git a/tests/spec/gl-1.5/get-array-attribs.c 
b/tests/spec/gl-1.5/get-array-attribs.c
new file mode 100644
index 000..6aa3c78
--- /dev/null
+++ b/tests/spec/gl-1.5/get-array-attribs.c
@@ -0,0 +1,135 @@
+/*
+ * Copyright (C) 2018 VMware, 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 glGetInteger/Float/Double/Booleanv with vertex array attributes.
+ */
+
+#include "piglit-util-gl.h"
+
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+   config.supports_gl_compat_version = 15;
+   config.window_visual = PIGLIT_GL_VISUAL_RGBA;
+   config.khr_no_error_support = PIGLIT_NO_ERRORS;
+PIGLIT_GL_TEST_CONFIG_END
+
+
+static bool
+test_get(GLenum pname, GLint expectedValue)
+{
+   GLint i;
+   GLfloat f;
+   GLdouble d;
+   GLboolean b;
+   bool pass = true;
+
+   glGetIntegerv(pname, );
+   glGetFloatv(pname, );
+   glGetDoublev(pname, );
+   glGetBooleanv(pname, );
+
+   if (i != expectedValue) {
+   printf("glGetIntegerv(%s) failed: expected %d, got %d\n",
+  piglit_get_gl_enum_name(pname),
+  expectedValue, i);
+   pass = false;
+   }
+
+   if (f != (GLfloat) expectedValue) {
+   printf("glGetFloatv(%s) failed: expected %f, got %f\n",
+  piglit_get_gl_enum_name(pname),
+  (GLfloat) expectedValue, f);
+   pass = false;
+   }
+
+   if (d != (GLdouble) expectedValue) {
+   printf("glGetDoublev(%s) failed: expected %f, got %f\n",
+  piglit_get_gl_enum_name(pname),
+  (GLdouble) expectedValue, f);
+   pass = false;
+   }
+
+   if (b != (GLboolean) !!expectedValue) {
+   printf("glGetBooleanv(%s) failed: expected %d, got %d\n",
+  piglit_get_gl_enum_name(pname),
+  !!expectedValue, b);
+   pass = false;
+   }
+
+   return pass;
+}
+
+

Re: [Piglit] [PATCH] ext_transform_feedback-max-varyings: reduce output upon failures

2017-12-18 Thread Charmaine Lee

Reviewed-by: Charmaine Lee <charmai...@vmware.com>


From: Brian Paul <bri...@vmware.com>
Sent: Monday, December 18, 2017 2:28:14 PM
To: piglit@lists.freedesktop.org
Cc: Charmaine Lee; Neha Bhende; Brian Paul
Subject: [PATCH] ext_transform_feedback-max-varyings: reduce output upon 
failures

Stop running the test after 10 failures.  As it was, a failure could
lead to nearly 9MB of output.
---
 tests/spec/ext_transform_feedback/max-varyings.c | 19 +++
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/tests/spec/ext_transform_feedback/max-varyings.c 
b/tests/spec/ext_transform_feedback/max-varyings.c
index 4a5086c..1f83b60 100644
--- a/tests/spec/ext_transform_feedback/max-varyings.c
+++ b/tests/spec/ext_transform_feedback/max-varyings.c
@@ -249,6 +249,7 @@ check_xfb_output(int max_varyings, int num_xfb_varyings,
int vertex, varying, i;
float (*buffer)[4] = glMapBuffer(GL_TRANSFORM_FEEDBACK_BUFFER,
 GL_READ_ONLY);
+   int numFail = 0;

for (vertex = 0; vertex < 6; ++vertex) {
for (varying = 0; varying < num_xfb_varyings; ++varying) {
@@ -273,10 +274,14 @@ check_xfb_output(int max_varyings, int num_xfb_varyings,
   actual[0], actual[1], actual[2],
   actual[3]);
pass = GL_FALSE;
+   if (++numFail >= 10) {
+   goto end;
+   }
}
}
}

+end:
glUnmapBuffer(GL_TRANSFORM_FEEDBACK_BUFFER);

return pass;
@@ -322,9 +327,12 @@ draw(GLuint vs, GLuint fs, int num_xfb_varyings,

glEndTransformFeedback();
pass = check_xfb_output(max_varyings, num_xfb_varyings,
- offset, xfb_varyings) && pass;
+ offset, xfb_varyings);

glDeleteProgram(prog);
+   if (!pass) {
+   break;
+   }
}

return pass;
@@ -341,8 +349,10 @@ run_subtest(GLuint vs, GLuint fs, int max_xfb_varyings,
glClear(GL_COLOR_BUFFER_BIT);

for (row = 0; row < max_xfb_varyings; row++) {
-   pass = draw(vs, fs, row + 1, max_varyings, xfb_varyings) &&
-  pass;
+   pass = draw(vs, fs, row + 1, max_varyings, xfb_varyings);
+   if (!pass) {
+   goto end;
+   }
}

for (row = 0; row < max_xfb_varyings; row++) {
@@ -359,10 +369,11 @@ run_subtest(GLuint vs, GLuint fs, int max_xfb_varyings,
   " captured and offset %d\n",
   row + 1, col);
pass = GL_FALSE;
-   break;
+   goto end;
}
}
}
+end:
return pass;
 }

--
1.9.1

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


Re: [Piglit] [PATCH] generators: fix incorrect generated_tests/spec/glsl-110, etc. dir names

2017-11-17 Thread Charmaine Lee

Looks good.

Reviewed-by: Charmaine Lee <charmai...@vmware.com>


From: Brian Paul <bri...@vmware.com>
Sent: Friday, November 17, 2017 12:03:40 PM
To: piglit@lists.freedesktop.org
Cc: Charmaine Lee; Dylan Baker; Brian Paul
Subject: [PATCH] generators: fix incorrect generated_tests/spec/glsl-110, etc. 
dir names

We were generating tests both in spec/glsl-1.10/ and spec/glsl-110/.
This changes the later to match the former.
---
 generated_tests/gen_variable_index_write_tests.py | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/generated_tests/gen_variable_index_write_tests.py 
b/generated_tests/gen_variable_index_write_tests.py
index 0c06dcd..2615d9a 100644
--- a/generated_tests/gen_variable_index_write_tests.py
+++ b/generated_tests/gen_variable_index_write_tests.py
@@ -198,6 +198,11 @@ class TestParams(object):
 ret += ' '
 return ret

+@utils.lazy_property
+def formated_version(self):
+# Note: GLSLVersion::float() does the division by 100
+return '{:.2f}'.format(float(self.version))
+

 class ParamsFactory(object):  # pylint: disable=too-few-public-methods
 """A factory class that provides TestParam objects.
@@ -220,7 +225,7 @@ class ParamsFactory(object):  # pylint: 
disable=too-few-public-methods

 def make_vs(name, params):
 """Create a vertex shader test."""
-dirname = _DIRNAME.format(params.version)
+dirname = _DIRNAME.format(params.formated_version)
 utils.safe_makedirs(dirname)
 with open(os.path.join(dirname, name), 'w') as f:
 f.write(_VS_TEMPLATE.render_unicode(params=params))
@@ -229,7 +234,7 @@ def make_vs(name, params):

 def make_fs(name, params):
 """Create a fragment shader test."""
-dirname = _DIRNAME.format(params.version)
+dirname = _DIRNAME.format(params.formated_version)
 utils.safe_makedirs(dirname)
 with open(os.path.join(dirname, name), 'w') as f:
 f.write(_FS_TEMPLATE.render_unicode(params=params))
--
1.9.1

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


Re: [Piglit] [PATCH] gl-1.0-logicop: allow testing single mode on the command line

2017-11-10 Thread Charmaine Lee

>From: Brian Paul <bri...@vmware.com>
>Sent: Thursday, November 9, 2017 12:52 PM
>To: piglit@lists.freedesktop.org
>Cc: Charmaine Lee; Brian Paul
>Subject: [PATCH] gl-1.0-logicop: allow testing single mode on the command line

>And require GL 1.1 since that's when color logicops were introduced.
>Technically, we should move/rename the test, but it's hardly worth it.
>---
> tests/spec/gl-1.0/logicop.c | 90 +
> 1 file changed, 58 insertions(+), 32 deletions(-)

>diff --git a/tests/spec/gl-1.0/logicop.c b/tests/spec/gl-1.0/logicop.c
>index 9ff80be..d415335 100644
>--- a/tests/spec/gl-1.0/logicop.c
>+++ b/tests/spec/gl-1.0/logicop.c
>@@ -46,7 +46,7 @@

> PIGLIT_GL_TEST_CONFIG_BEGIN

>-   config.supports_gl_compat_version = 10;
>+   config.supports_gl_compat_version = 11;

>config.window_visual = PIGLIT_GL_VISUAL_RGBA |
>PIGLIT_GL_VISUAL_DOUBLE;
>@@ -54,12 +54,28 @@ PIGLIT_GL_TEST_CONFIG_BEGIN

> PIGLIT_GL_TEST_CONFIG_END

>-void
>-piglit_init(int argc, char **argv)
>-{
>-   srand(0);
>-   piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
>-}
>+
>+static const GLenum logicop_modes[] = {
>+   GL_CLEAR,
>+   GL_SET,
>+   GL_COPY,
>+   GL_COPY_INVERTED,
>+   GL_NOOP,
>+   GL_INVERT,
>+   GL_AND,
>+   GL_NAND,
>+   GL_OR,
>+   GL_NOR,
>+   GL_XOR,
>+   GL_EQUIV,
>+   GL_AND_REVERSE,
>+   GL_AND_INVERTED,
>+   GL_OR_REVERSE,
>+   GL_OR_INVERTED
>+};
>+
>+static GLenum test_single = 0;  /* 0 = test all logicop modes */
>+

> static GLubyte*
> random_image_data(void)
>@@ -67,7 +83,7 @@ random_image_data(void)
>int i;
>GLubyte *img = malloc(4 * img_width * img_height * sizeof(GLubyte));
>for (i = 0; i < 4 * img_width * img_height; ++i) {
>-   img[i] = rand() % 256;
>+   img[i] = /*rand()*/ (100+i) % 256;

Is this change intentional or just a left over from debugging?


Other than that,
Reviewed-by: Charmaine Lee <charmai...@vmware.com>
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] framework: specify GL_NEAREST filter for FBO textures

2017-11-10 Thread Charmaine Lee

Reviewed-by: Charmaine Lee <charmai...@vmware.com>


From: Brian Paul <bri...@vmware.com>
Sent: Thursday, November 9, 2017 12:52:42 PM
To: piglit@lists.freedesktop.org
Cc: Charmaine Lee; Brian Paul
Subject: [PATCH] framework: specify GL_NEAREST filter for FBO textures

By setting the min/mag filters, we give a hint to the OpenGL driver
that we probaby don't want mipmapped textures.  This results in the
Mesa state tracker allocating single-level textures here instead of
full mipmaps.
---
 tests/util/piglit-framework-gl/piglit_fbo_framework.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/tests/util/piglit-framework-gl/piglit_fbo_framework.c 
b/tests/util/piglit-framework-gl/piglit_fbo_framework.c
index 77e717b..7064753 100644
--- a/tests/util/piglit-framework-gl/piglit_fbo_framework.c
+++ b/tests/util/piglit-framework-gl/piglit_fbo_framework.c
@@ -77,6 +77,8 @@ init_gl(struct piglit_wfl_framework *wfl_fw)

glGenTextures(1, );
glBindTexture(GL_TEXTURE_2D, tex);
+   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
 piglit_width, piglit_height, 0,
 GL_RGBA, GL_UNSIGNED_BYTE, NULL);
@@ -93,6 +95,8 @@ init_gl(struct piglit_wfl_framework *wfl_fw)
 */
glGenTextures(1, );
glBindTexture(GL_TEXTURE_2D, depth);
+   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, 
GL_NEAREST);
+   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, 
GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_STENCIL,
 piglit_width, piglit_height, 0,
 GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, NULL);
--
1.9.1

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


Re: [Piglit] [PATCH] framework: decrement argc in delete_arg()

2017-11-10 Thread Charmaine Lee
Reviewed-by: Charmaine Lee <charmai...@vmware.com>


From: Brian Paul <bri...@vmware.com>
Sent: Thursday, November 9, 2017 8:18:31 PM
To: piglit@lists.freedesktop.org
Cc: Charmaine Lee; Brian Paul
Subject: [PATCH] framework: decrement argc in delete_arg()

So it doesn't have to be done after every call to delete_arg().
---
 tests/util/piglit-framework-gl.c | 23 +--
 1 file changed, 9 insertions(+), 14 deletions(-)

diff --git a/tests/util/piglit-framework-gl.c b/tests/util/piglit-framework-gl.c
index 22aadc5..1b2078d 100644
--- a/tests/util/piglit-framework-gl.c
+++ b/tests/util/piglit-framework-gl.c
@@ -87,13 +87,14 @@ piglit_gl_test_config_init(struct piglit_gl_test_config 
*config)
 }

 static void
-delete_arg(char *argv[], int argc, int arg)
+delete_arg(char *argv[], int *argc, int arg)
 {
int i;

-   for (i = arg + 1; i < argc; i++) {
+   for (i = arg + 1; i < *argc; i++) {
argv[i - 1] = argv[i];
}
+   (*argc)--;
 }

 /**
@@ -117,16 +118,13 @@ process_args(int *argc, char *argv[], unsigned 
*force_samples,
for (j = 1; j < *argc; j++) {
if (!strcmp(argv[j], "-auto")) {
piglit_automatic = 1;
-   delete_arg(argv, *argc, j--);
-   *argc -= 1;
+   delete_arg(argv, argc, j--);
} else if (!strcmp(argv[j], "-fbo")) {
piglit_use_fbo = true;
-   delete_arg(argv, *argc, j--);
-   *argc -= 1;
+   delete_arg(argv, argc, j--);
} else if (!strcmp(argv[j], "-png")) {
piglit_dump_png = true;
-   delete_arg(argv, *argc, j--);
-   *argc -= 1;
+   delete_arg(argv, argc, j--);
} else if (!strcmp(argv[j], "-rlimit")) {
char *ptr;
unsigned long lim;
@@ -158,12 +156,10 @@ process_args(int *argc, char *argv[], unsigned 
*force_samples,
j -= 2;
} else if (!strncmp(argv[j], "-samples=", 9)) {
*force_samples = atoi(argv[j]+9);
-   delete_arg(argv, *argc, j--);
-   *argc -= 1;
+   delete_arg(argv, argc, j--);
} else if (!strcmp(argv[j], "-khr_no_error")) {
piglit_khr_no_error = true;
-   delete_arg(argv, *argc, j--);
-   *argc -= 1;
+   delete_arg(argv, argc, j--);
if (config->khr_no_error_support ==
PIGLIT_UNKNOWN_ERROR_STATUS) {
fprintf(stderr,
@@ -186,8 +182,7 @@ process_args(int *argc, char *argv[], unsigned 
*force_samples,
config->supports_gl_compat_version = 10;
config->supports_gl_core_version = 0;
puts("The compatibility profile forced.");
-   delete_arg(argv, *argc, j--);
-   *argc -= 1;
+   delete_arg(argv, argc, j--);
}
}
 }
--
1.9.1

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


Re: [Piglit] [PATCH] cmake: create Win10 manifest files for particular executables

2017-10-27 Thread Charmaine Lee

Looks good to me.

Reviewed-by: Charmaine Lee <charmai...@vmware.com>

From: Brian Paul <bri...@vmware.com>
Sent: Friday, October 27, 2017 9:12:33 AM
To: piglit@lists.freedesktop.org
Cc: Charmaine Lee; Jose Fonseca; Brian Paul
Subject: [PATCH] cmake: create Win10 manifest files for particular executables

On Windows10 (and possibly older versions), UAC (User Account Control)
intervenes when starting an executables with "patch", "update" or "setup"
in their name.  This requires the user to approve execution by clicking
in a dialog window (and even then, causes test failures).  With Cygwin,
you simply get "Permission Denied".

Currently, there are four Piglit tests which need this special treatment:
bin/arb_compute_shader-zero-dispatch-size
bin/arb_tessellation_shader-invalid-patch-vertices-range
bin/glsl-uniform-update
bin/mipmap-setup

A work-around is to create a manifest file for each effected executable.
This patch creates a .exe.manifest file if "foo" contains any of
the above strings.  There's no effect on non-Windows platforms.

Note: this solution uses the cmake file(GENERATE ...) function.  I think
add_custom_command() is probably the proper approach, but I've been
unsuccessful in getting that to work.
---
 cmake/piglit_util.cmake  | 30 ++
 cmake/win10-manifest.txt | 12 
 2 files changed, 42 insertions(+)
 create mode 100644 cmake/win10-manifest.txt

diff --git a/cmake/piglit_util.cmake b/cmake/piglit_util.cmake
index 411fa54..9b85761 100644
--- a/cmake/piglit_util.cmake
+++ b/cmake/piglit_util.cmake
@@ -58,6 +58,8 @@ endfunction(piglit_include_target_api)
 #
 function(piglit_add_executable name)

+piglit_create_manifest_file(${name})
+
 list(REMOVE_AT ARGV 0)
 add_executable(${name} ${ARGV})
 add_dependencies(${name} piglit_dispatch_gen)
@@ -89,3 +91,31 @@ function(piglit_add_library name)
 endif()

 endfunction(piglit_add_library)
+
+
+# This is lame, but Windows 10 (and maybe Win8) asks for confirmation
+# before running .exe files containing the strings "patch", "setup",
+# "update", etc.  In Cygwin, we simply get "Permission Denied".
+# This causes the Piglit test to fail.
+# The work-around is to create a "manifest" file for such executables.
+# This function examines the target name and creates the manifest file
+# if needed.  The file will be named "${target}.exe.manifest".
+# See 
https://answers.microsoft.com/en-us/windows/forum/windows_7-security/uac-prompts-on-any-program-with-the-word-patch-or/c5359497-d16e-43c6-99f2-db3d8eecc9c0?auth=1
+function(piglit_create_manifest_file target)
+   if (WIN32)
+  # look for known strings
+  string(FIND ${target} "patch" r1)
+  string(FIND ${target} "setup" r2)
+  string(FIND ${target} "update" r3)
+
+  # if any of those strings is in the target filename
+  if((${r1} GREATER -1) OR (${r2} GREATER -1) OR (${r3} GREATER -1))
+   # XXX we should probably use add_custom_command() here to copy
+   # the manifest file, but I've been unsuccessful in getting
+   # that to work.
+   file(GENERATE
+OUTPUT bin/${target}.exe.manifest
+INPUT ${CMAKE_SOURCE_DIR}/cmake/win10-manifest.txt)
+   endif()
+   endif()
+endfunction(piglit_create_manifest_file)
diff --git a/cmake/win10-manifest.txt b/cmake/win10-manifest.txt
new file mode 100644
index 000..5abd234
--- /dev/null
+++ b/cmake/win10-manifest.txt
@@ -0,0 +1,12 @@
+
+
+  
+
+  
+
+
+  
+
+  
+
--
1.9.1

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


Re: [Piglit] [PATCH 2/2] framework: fix proces/process_isolation typo

2017-09-25 Thread Charmaine Lee

For both patches, Reviewed-by: Charmaine Lee <charmai...@vmware.com>

From: Brian Paul <bri...@vmware.com>
Sent: Monday, September 25, 2017 3:47:24 PM
To: piglit@lists.freedesktop.org
Cc: Charmaine Lee; Neha Bhende; Brian Paul
Subject: [PATCH 2/2] framework: fix proces/process_isolation typo

---
 framework/programs/run.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/framework/programs/run.py b/framework/programs/run.py
index 4524f17..5fe8419 100644
--- a/framework/programs/run.py
+++ b/framework/programs/run.py
@@ -397,7 +397,7 @@ def resume(input_):
 options.OPTIONS.valgrind = results.options['valgrind']
 options.OPTIONS.sync = results.options['sync']
 options.OPTIONS.deqp_mustpass = results.options['deqp_mustpass']
-options.OPTIONS.proces_isolation = results.options['process_isolation']
+options.OPTIONS.process_isolation = results.options['process_isolation']

 core.get_config(args.config_file)

--
1.9.1

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


Re: [Piglit] [PATCH 2/2] gl-2.0-vertex-attr-0: new test of glVertexAttrib(index=0)

2017-08-22 Thread Charmaine Lee

For the series: Reviewed-by: Charmaine Lee <charmai...@vmware.com>

From: Brian Paul <bri...@vmware.com>
Sent: Tuesday, August 22, 2017 1:21:40 PM
To: piglit@lists.freedesktop.org
Cc: Charmaine Lee; Neha Bhende; Brian Paul
Subject: [PATCH 2/2] gl-2.0-vertex-attr-0: new test of glVertexAttrib(index=0)

See bugzilla https://bugs.freedesktop.org/show_bug.cgi?id=101941
---
 tests/all.py|   1 +
 tests/spec/gl-2.0/CMakeLists.gl.txt |   1 +
 tests/spec/gl-2.0/vertex-attr-0.c   | 116 
 3 files changed, 118 insertions(+)
 create mode 100644 tests/spec/gl-2.0/vertex-attr-0.c

diff --git a/tests/all.py b/tests/all.py
index d8a17ba..ff2ff1f 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -1096,6 +1096,7 @@ with profile.test_list.group_manager(
 g(['gl-2.0-two-sided-stencil'])
 g(['gl-2.0-vertexattribpointer'])
 g(['gl-2.0-vertexattribpointer-size-3'])
+g(['gl-2.0-vertex-attr-0'])
 g(['gl-2.0-vertex-const-attr'])
 g(['gl-2.0-reuse_fragment_shader'])
 g(['attrib-assignments'], run_concurrent=False)
diff --git a/tests/spec/gl-2.0/CMakeLists.gl.txt 
b/tests/spec/gl-2.0/CMakeLists.gl.txt
index 50f3678..ce62799 100644
--- a/tests/spec/gl-2.0/CMakeLists.gl.txt
+++ b/tests/spec/gl-2.0/CMakeLists.gl.txt
@@ -17,5 +17,6 @@ piglit_add_executable (gl-2.0-link-empty-prog 
glsl-link-empty-prog.c)
 piglit_add_executable (gl-2.0-two-sided-stencil two-sided-stencil.c)
 piglit_add_executable (gl-2.0-vertexattribpointer vertexattribpointer.c)
 piglit_add_executable (gl-2.0-vertexattribpointer-size-3 
vertexattribpointer-size-3.c)
+piglit_add_executable (gl-2.0-vertex-attr-0 vertex-attr-0.c)
 piglit_add_executable (gl-2.0-vertex-const-attr vertex-const-attr.c)
 piglit_add_executable (gl-2.0-reuse_fragment_shader reuse_fragment_shader.c)
diff --git a/tests/spec/gl-2.0/vertex-attr-0.c 
b/tests/spec/gl-2.0/vertex-attr-0.c
new file mode 100644
index 000..ea050ec
--- /dev/null
+++ b/tests/spec/gl-2.0/vertex-attr-0.c
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2017 VMware, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and/or associated documentation files (the
+ * "Materials"), to deal in the Materials without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Materials, and to
+ * permit persons to whom the Materials are furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Materials.
+ *
+ * THE MATERIALS ARE 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
+ * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+ *
+ */
+
+/**
+ * Test glVertexAttrib(index=0).
+ * Brian Paul
+ * 22 Aug 2017
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+   config.supports_gl_compat_version = 20;
+   config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
+   config.khr_no_error_support = PIGLIT_NO_ERRORS;
+PIGLIT_GL_TEST_CONFIG_END
+
+static const char *vs =
+   "attribute vec4 color_in; \n"
+   "varying vec4 color; \n"
+   "void main() { \n"
+   "  gl_Position = gl_Vertex; \n"
+   "  color = color_in; \n"
+   "}\n";
+
+static const char *fs =
+   "varying vec4 color; \n"
+   "void main() \n"
+   "{ \n"
+   "   gl_FragColor = color;\n"
+   "} \n";
+
+static GLint prog;
+
+
+enum piglit_result
+piglit_display(void)
+{
+   static const float color[4][4] = {
+   {1, 0, 0, 1},
+   {0, 1, 0, 1},
+   {0, 0, 1, 1},
+   {1, 1, 1, 1},
+   };
+   static const float verts[4][2] = {
+   {-1, -1},
+   { 1, -1},
+   { 1,  1},
+   {-1,  1},
+   };
+   GLint i, color_in;
+   bool pass = true;
+
+   glViewport(0, 0, piglit_width, piglit_height);
+   glClear(GL_COLOR_BUFFER_BIT);
+
+   glUseProgram(prog);
+
+   color_in = glGetAttribLocation(prog, "color_in");
+   printf("color_in at locagion %d\n", color_in);
+
+   /* draw quad */
+   glBegin(GL_TRIANGLE_FAN);
+   for (i = 0; i < 4; i++) {
+   /* update generic attribute */
+   glVertexAttrib4fv(co

Re: [Piglit] [PATCH] arb_texture_multisample/sample-mask-execution: check GL_MAX_SAMPLES

2017-07-25 Thread Charmaine Lee

Reviewed-by: Charmaine Lee <charmai...@vmware.com>



From: Brian Paul <bri...@vmware.com>
Sent: Monday, July 24, 2017 9:37 PM
To: piglit@lists.freedesktop.org
Cc: Charmaine Lee; Neha Bhende; Brian Paul
Subject: [PATCH] arb_texture_multisample/sample-mask-execution: check 
GL_MAX_SAMPLES

Skip the test if GL_MAX_SAMPLES=0.  We basically do that test in most
of the other MSAA tests.

As is, we get a bunch of errors because we cannot create the MSAA FBO and
then an unexpected GL_INVALID_OPERATION error generates a piglit failure.
---
 tests/spec/arb_texture_multisample/sample-mask-execution.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/tests/spec/arb_texture_multisample/sample-mask-execution.c 
b/tests/spec/arb_texture_multisample/sample-mask-execution.c
index 4605465..3006abd 100644
--- a/tests/spec/arb_texture_multisample/sample-mask-execution.c
+++ b/tests/spec/arb_texture_multisample/sample-mask-execution.c
@@ -103,9 +103,16 @@ void
 piglit_init(int argc, char **argv)
 {
 bool use_multisample_texture = false;
+GLint max_samples;

 piglit_require_extension("GL_ARB_texture_multisample");

+glGetIntegerv(GL_MAX_SAMPLES, _samples);
+if (max_samples == 0) {
+   printf("GL_MAX_SAMPLES = 0\n");
+   piglit_report_result(PIGLIT_SKIP);
+}
+
 while (++argv,--argc) {
 if (!strcmp(*argv, "-tex"))
 use_multisample_texture = true;
--
1.9.1

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


Re: [Piglit] [PATCH] clipflat: refactor some code

2017-07-14 Thread Charmaine Lee

Reviewed-by: Charmaine Lee <charmai...@vmware.com>


From: Brian Paul <bri...@vmware.com>
Sent: Friday, July 14, 2017 9:06 AM
To: piglit@lists.freedesktop.org
Cc: Charmaine Lee; Neha Bhende; Brian Paul
Subject: [PATCH] clipflat: refactor some code

Pull the innermost code out of testPrim() into a new function.
This can make things a little easier for hacking/debugging.

Also, print whether PV control is supported and whether quads follow
the PV convention.
---
 tests/general/clipflat.c | 121 +++
 1 file changed, 71 insertions(+), 50 deletions(-)

diff --git a/tests/general/clipflat.c b/tests/general/clipflat.c
index 1820418..2608d28 100644
--- a/tests/general/clipflat.c
+++ b/tests/general/clipflat.c
@@ -209,10 +209,16 @@ piglit_init(int argc, char **argv)
provoking_vertex_first = true;
}

+   printf("Have GL_ARB/EXT_provoking_vertex: %s\n",
+  provoking_vertex_first ? "yes" : "no");
+
if (provoking_vertex_first) {
GLboolean k;
glGetBooleanv(GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT, 
);
quads_follows_pv_convention = k;
+
+   printf("Quads follow provoking vertex convention: %s\n",
+  k ? "yes" : "no");
}
 }

@@ -443,11 +449,72 @@ reportSubtest(GLenum mode, int drawMode, GLuint facing,
 }


-// Test a particular primitive mode
+// Test a particular primitive mode for one drawing mode, filled/unfilled
+// state and CW/CCW winding.
 static bool
-testPrim(GLenum mode, const GLfloat *verts, GLuint count)
+testPrimCombo(GLenum mode, const GLfloat *verts, GLuint count,
+ bool fill, enum draw_mode drawMode, GLuint facing)
 {
GLfloat x, y;
+   bool pass = true;
+
+   glPolygonMode(GL_FRONT_AND_BACK, fill ? GL_LINE : GL_FILL);
+
+   if (facing == 0) {
+   glFrontFace(GL_CCW);
+   glCullFace(GL_BACK);
+   }
+   else {
+   glFrontFace(GL_CW);
+   glCullFace(GL_FRONT);
+   }
+
+   // Position the geometry at 9 different locations to test
+   // clipping against the left, right, bottom and top edges of
+   // the window.
+   // Only the center location will be unclipped.
+   for (y = -1.0; y <= 1.0; y += 1.0) {
+   for (x = -1.0; x <= 1.0; x += 1.0) {
+   bool quad_pass;
+   GLfloat badColor[3];
+
+   glPushMatrix();
+   glTranslatef(x, y, 0.0);
+
+   glClear(GL_COLOR_BUFFER_BIT);
+
+   switch (drawMode) {
+   case BEGIN_END:
+   drawBeginEnd(mode, verts, count);
+   break;
+   case DRAW_ARRAYS:
+   drawArrays(mode, verts, count);
+   break;
+   case DRAW_ELEMENTS:
+   drawElements(mode, verts, count);
+   break;
+   default:
+   assert(0);
+   }
+
+   glPopMatrix();
+
+   quad_pass = checkResult(badColor);
+   pass = pass && quad_pass;
+   reportSubtest(mode, drawMode, facing, fill,
+ badColor, x, y, quad_pass);
+   }
+   }
+
+   return pass;
+}
+
+
+// Test a particular primitive mode for all drawing modes, filled/unfilled
+// and CW/CCW winding.
+static bool
+testPrim(GLenum mode, const GLfloat *verts, GLuint count)
+{
GLuint facing, fill;
int drawMode;
bool pass = true;
@@ -455,59 +522,13 @@ testPrim(GLenum mode, const GLfloat *verts, GLuint count)
// Loop over polygon mode: filled vs. outline
for (fill = 0; fill < 2; fill++) {

-   glPolygonMode(GL_FRONT_AND_BACK, fill ? GL_LINE : GL_FILL);
-
// Loop over drawing mode: glBegin/End vs glDrawArrays vs 
glDrawElements
for (drawMode = 0; drawMode < NUM_DRAW_MODES; drawMode++) {

// Loop over CW vs. CCW winding (should make no 
difference)
for (facing = 0; facing < 2; facing++) {
-
-   if (facing == 0) {
-   glFrontFace(GL_CCW);
-   glCullFace(GL_BACK);
-   }
-   else {
-   glFrontFace(GL_CW);
-   glCullFace(GL_FRONT);
-   }
-
-   // Position the geometry

Re: [Piglit] [PATCH 3/3] glx-multi-window-single-context: new GLX test

2017-07-11 Thread Charmaine Lee

>From: Brian Paul <bri...@vmware.com>
>Sent: Friday, July 7, 2017 11:02 AM
>To: piglit@lists.freedesktop.org
>Cc: Charmaine Lee; Brian Paul
>Subject: [PATCH 3/3] glx-multi-window-single-context: new GLX test

>To exercise rendering into multiple windows with one context.
>---
> tests/all.py|   1 +
> tests/glx/CMakeLists.gl.txt |   1 +
> tests/glx/glx-multi-window-single-context.c | 128 
> 3 files changed, 130 insertions(+)
> create mode 100644 tests/glx/glx-multi-window-single-context.c

>diff --git a/tests/all.py b/tests/all.py
>index 6941c65..f291b41 100644
>--- a/tests/all.py
>+++ b/tests/all.py
>@@ -664,6 +664,7 @@ with profile.test_list.group_manager(
> g(['glx-multi-context-front'], run_concurrent=False)
> g(['glx-multi-context-ib-1'], run_concurrent=False)
> g(['glx-multi-context-single-window'], run_concurrent=False)
>+g(['glx-multi-window-single-context'], run_concurrent=False)
> g(['glx-multithread'], run_concurrent=False)
> g(['glx-multithread-texture'], run_concurrent=False)
> g(['glx-multithread-makecurrent-1'], run_concurrent=False)
>diff --git a/tests/glx/CMakeLists.gl.txt b/tests/glx/CMakeLists.gl.txt
>index 4ffd74d..cf036f5 100644
>--- a/tests/glx/CMakeLists.gl.txt
>+++ b/tests/glx/CMakeLists.gl.txt
>@@ -33,6 +33,7 @@ IF(PIGLIT_BUILD_GLX_TESTS)
>piglit_add_executable (glx-multi-context-front 
> glx-multi-context-front.c)
>piglit_add_executable (glx-multi-context-ib-1 glx-multi-context-ib-1.c)
>piglit_add_executable (glx-multi-context-single-window 
> glx-multi-context-single-window.c)
>+   piglit_add_executable (glx-multi-window-single-context 
>glx-multi-window-single-context.c)
>piglit_add_executable (glx-multithread glx-multithread.c)
>target_link_libraries(glx-multithread pthread)
>piglit_add_executable (glx-context-flush-control 
> glx-context-flush-control.c)
>diff --git a/tests/glx/glx-multi-window-single-context.c 
>b/tests/glx/glx-multi-window-single-context.c
>new file mode 100644
>index 000..4ffac47
>--- /dev/null
>+++ b/tests/glx/glx-multi-window-single-context.c
>@@ -0,0 +1,128 @@
>+/*
>+ * Copyright 2017 VMware, 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.
>+ */
>+
>+/** @file glx-multi-context-single-window.c
>+ *
>+ * Exercise rendering to multiple windows with one context.
>+ */

Should be @file glx-multi-window-single-context.c

Reviewed-by: Charmaine Lee <charmai...@vmware.com>

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


Re: [Piglit] [PATCH] glx-multi-context-single-window: new GLX test

2017-07-11 Thread Charmaine Lee

>From: Brian Paul <bri...@vmware.com>
>Sent: Tuesday, July 11, 2017 10:28 AM
>To: piglit@lists.freedesktop.org
>Cc: Charmaine Lee; Brian Paul
>Subject: [PATCH] glx-multi-context-single-window: new GLX test

>Test rendering into one window with multiple contexts.

>Currently fails with llvmpipe, softpipe.  Passes with VMware DRI driver.

>v2: we only need to probe with context[0].  Fix comments.
>---
> tests/all.py|   1 +
> tests/glx/CMakeLists.gl.txt |   1 +
> tests/glx/glx-multi-context-single-window.c | 155 
> 3 files changed, 157 insertions(+)
> create mode 100644 tests/glx/glx-multi-context-single-window.c

>diff --git a/tests/all.py b/tests/all.py
>index d4d66b1..6941c65 100644
>--- a/tests/all.py
>+++ b/tests/all.py
>@@ -663,6 +663,7 @@ with profile.test_list.group_manager(
> g(['glx-fbo-binding'], run_concurrent=False)
> g(['glx-multi-context-front'], run_concurrent=False)
> g(['glx-multi-context-ib-1'], run_concurrent=False)
>+g(['glx-multi-context-single-window'], run_concurrent=False)
> g(['glx-multithread'], run_concurrent=False)
> g(['glx-multithread-texture'], run_concurrent=False)
> g(['glx-multithread-makecurrent-1'], run_concurrent=False)
>diff --git a/tests/glx/CMakeLists.gl.txt b/tests/glx/CMakeLists.gl.txt
>index 1e1c684..4ffd74d 100644
>--- a/tests/glx/CMakeLists.gl.txt
>+++ b/tests/glx/CMakeLists.gl.txt
>@@ -32,6 +32,7 @@ IF(PIGLIT_BUILD_GLX_TESTS)
>piglit_add_executable (glx-dont-care-mask glx-dont-care-mask.c)
>piglit_add_executable (glx-multi-context-front 
> glx-multi-context-front.c)
>   piglit_add_executable (glx-multi-context-ib-1 glx-multi-context-ib-1.c)
>+   piglit_add_executable (glx-multi-context-single-window 
>glx-multi-context-single-window.c)
>piglit_add_executable (glx-multithread glx-multithread.c)
>target_link_libraries(glx-multithread pthread)
>piglit_add_executable (glx-context-flush-control 
> glx-context-flush-control.c)
>diff --git a/tests/glx/glx-multi-context-single-window.c 
>b/tests/glx/glx-multi-context-single-window.c
>new file mode 100644
>index 000..726138c
>--- /dev/null
>+++ b/tests/glx/glx-multi-context-single-window.c
>@@ -0,0 +1,155 @@
>+/*
>+ * Copyright 2017 VMware, 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.
>+ */
>+
>+/** @file glx-multi-context-single-window.c
>+ *
>+ * Exercise rendering to multiple windows with one context.
>+ */

Should be "Exercise rendering to a single window with multiple contexts."

Reviewed-by: Charmaine Lee <charmai...@vmware.com>


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


Re: [Piglit] [PATCH] util: call fflush() after printf() calls

2017-06-07 Thread Charmaine Lee

Reviewed-by: Charmaine Lee <charmai...@vmware.com>

From: Brian Paul <bri...@vmware.com>
Sent: Wednesday, June 7, 2017 8:51:52 AM
To: piglit@lists.freedesktop.org
Cc: Charmaine Lee; Neha Bhende; Brian Paul
Subject: [PATCH] util: call fflush() after printf() calls

Otherwise, on Windows, we don't see the printf() output until the program
exits.  That's fine with the -auto option, but a problem w/out -auto.
---
 tests/util/piglit-util-gl.c | 21 +
 1 file changed, 21 insertions(+)

diff --git a/tests/util/piglit-util-gl.c b/tests/util/piglit-util-gl.c
index 5ff13fe..f5734d9 100644
--- a/tests/util/piglit-util-gl.c
+++ b/tests/util/piglit-util-gl.c
@@ -1169,6 +1169,7 @@ piglit_probe_pixel_rgb(int x, int y, const float* 
expected)
printf("Probe color at (%i,%i)\n", x, y);
printf("  Expected: %f %f %f\n", expected[0], expected[1], expected[2]);
printf("  Observed: %f %f %f\n", probe[0], probe[1], probe[2]);
+   fflush(stdout);

return 0;
 }
@@ -1199,6 +1200,7 @@ piglit_probe_pixel_rgba(int x, int y, const float* 
expected)
printf("Probe color at (%i,%i)\n", x, y);
printf("  Expected: %f %f %f %f\n", expected[0], expected[1], 
expected[2], expected[3]);
printf("  Observed: %f %f %f %f\n", probe[0], probe[1], probe[2], 
probe[3]);
+   fflush(stdout);

return 0;
 }
@@ -1259,6 +1261,7 @@ piglit_probe_rect_ubyte(int x, int y, int w, int h, int 
num_components,
printf("  Observed: %u 
%u %u\n",
   probe[0], 
probe[1], probe[2]);
}
+   fflush(stdout);
}
free(pixels);
return false;
@@ -1321,6 +1324,7 @@ piglit_probe_rect_r_ubyte(int x, int y, int w, int h, 
GLubyte expected)
printf("Probe color at (%i,%i)\n", x+i, y+j);
printf("  Expected: %u\n", expected);
printf("  Observed: %u\n", probe);
+   fflush(stdout);

free(pixels);
return 0;
@@ -1355,6 +1359,7 @@ piglit_probe_rect_rgb(int x, int y, int w, int h, const 
float *expected)
   expected[0], expected[1], 
expected[2]);
printf("  Observed: %f %f %f\n",
   probe[0], probe[1], probe[2]);
+   fflush(stdout);

free(pixels);
return 0;
@@ -1425,6 +1430,7 @@ piglit_probe_rect_rgba(int x, int y, int w, int h, const 
float *expected)
   expected[0], expected[1], 
expected[2], expected[3]);
printf("  Observed: %f %f %f %f\n",
   probe[0], probe[1], probe[2], 
probe[3]);
+   fflush(stdout);

free(pixels);
return 0;
@@ -1457,6 +1463,7 @@ piglit_probe_rect_rgba_int(int x, int y, int w, int h, 
const int *expected)
   expected[0], expected[1], 
expected[2], expected[3]);
printf("  Observed: %d %d %d %d\n",
   probe[0], probe[1], probe[2], 
probe[3]);
+   fflush(stdout);

free(pixels);
return 0;
@@ -1490,6 +1497,7 @@ piglit_probe_rect_rgba_uint(int x, int y, int w, int h,
   expected[0], expected[1], 
expected[2], expected[3]);
printf("  Observed: %u %u %u %u\n",
   probe[0], probe[1], probe[2], 
probe[3]);
+   fflush(stdout);

free(pixels);
return 0;
@@ -1685,6 +1693,7 @@ piglit_compare_images_ubyte(int x, int y, int w, int h,
printf("Probe at (%i,%i)\n", x+i, y+j);
printf("  Expected: %d\n", expected);
printf("  Observed: %d\n", probe);
+

Re: [Piglit] [PATCH] xor-copypixels: simple test of glCopyPixels in XOR mode

2016-05-16 Thread Charmaine Lee
Reviewed-by: Charmaine Lee <charmai...@vmware.com>

From: Brian Paul <bri...@vmware.com>
Sent: Monday, May 16, 2016 12:58 PM
To: piglit@lists.freedesktop.org
Cc: Charmaine Lee; Brian Paul
Subject: [PATCH] xor-copypixels: simple test of glCopyPixels in XOR mode

---
 tests/all.py|   1 +
 tests/spec/gl-1.1/CMakeLists.gl.txt |   1 +
 tests/spec/gl-1.1/xor-copypixels.c  | 132 
 3 files changed, 134 insertions(+)
 create mode 100644 tests/spec/gl-1.1/xor-copypixels.c

diff --git a/tests/all.py b/tests/all.py
index 97ce02a..e804891 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -886,6 +886,7 @@ with profile.group_manager(
 g(['geterror-inside-begin'], run_concurrent=False)
 g(['glinfo'])
 g(['gl-1.1-xor'])
+g(['gl-1.1-xor-copypixels'])
 g(['hiz'], run_concurrent=False)
 g(['infinite-spot-light'], run_concurrent=False)
 g(['line-aa-width'], run_concurrent=False)
diff --git a/tests/spec/gl-1.1/CMakeLists.gl.txt 
b/tests/spec/gl-1.1/CMakeLists.gl.txt
index 300e6fd..1fa0928 100644
--- a/tests/spec/gl-1.1/CMakeLists.gl.txt
+++ b/tests/spec/gl-1.1/CMakeLists.gl.txt
@@ -9,5 +9,6 @@ link_libraries (
 )

 piglit_add_executable (gl-1.1-xor xor.c)
+piglit_add_executable (gl-1.1-xor-copypixels xor-copypixels.c)

 # vim: ft=cmake:
diff --git a/tests/spec/gl-1.1/xor-copypixels.c 
b/tests/spec/gl-1.1/xor-copypixels.c
new file mode 100644
index 000..93a382a
--- /dev/null
+++ b/tests/spec/gl-1.1/xor-copypixels.c
@@ -0,0 +1,132 @@
+/*
+ * Copyright 2016 VMware, 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.
+ */
+
+
+/**
+ * Basic test glCopyPixels in XOR mode.
+ *
+ * Brian Paul
+ * May 2016
+ */
+
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+   config.supports_gl_compat_version = 11;
+   config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
+PIGLIT_GL_TEST_CONFIG_END
+
+
+static const float black[4] = {0, 0, 0, 0};
+
+
+static void
+draw_test_pattern(void)
+{
+   glPushMatrix();
+   glTranslatef(-0.5, 0, 0);
+   glScalef(0.5, 1, 1);
+
+   /* draw background colored quad */
+   glBegin(GL_TRIANGLE_FAN);
+   glColor3f(1, 0, 0);
+   glVertex2f(-1, -1);
+   glColor3f(0, 1, 0);
+   glVertex2f( 1, -1);
+   glColor3f(0, 0, 1);
+   glVertex2f( 1,  1);
+   glColor3f(1, 1, 0);
+   glVertex2f(-1,  1);
+   glEnd();
+
+   /* draw lines */
+   glColor3f(1, 1, 1);
+   glBegin(GL_LINE_STRIP);
+   glVertex2f(0, -0.9);
+   glVertex2f(0.9, 0);
+   glVertex2f(0, 0.9);
+   glVertex2f(-0.9, 0);
+   glVertex2f(0, -0.9);
+   glEnd();
+   glPopMatrix();
+}
+
+
+enum piglit_result
+piglit_display(void)
+{
+   bool pass = true;
+   int x2 = piglit_width / 2;
+   GLfloat pixel[4];
+
+   glMatrixMode(GL_PROJECTION);
+   glLoadIdentity();
+   glOrtho(-1, 1, -1, 1, -1, 1);
+
+   glViewport(0, 0, piglit_width, piglit_height);
+
+   glClear(GL_COLOR_BUFFER_BIT);
+
+   draw_test_pattern();
+
+   /* copy image from left to right side of window */
+   glWindowPos2i(x2, 0);
+   glCopyPixels(0, 0, x2, piglit_height, GL_COLOR);
+
+   /* Check that the copy did something */
+   glReadPixels(piglit_width * 3 / 4, piglit_height / 2, 1, 1,
+GL_RGBA, GL_FLOAT, pixel);
+   if (pixel[0] == 0.0 ||
+   pixel[1] == 0.0 ||
+   pixel[2] == 0.0) {
+   printf("glCopyPixels appeared to fail.\n");
+   pass = false;
+   }
+
+   /* copy the image again (left to right, but with XOR) */
+   glLogicOp(GL_XOR);
+   glEnable(GL_COLOR_LOGIC_OP);
+   glCopyPixels(0, 0, x2, piglit_height, GL_COLOR);
+
+   /* now the right half of the window show be black ag

Re: [Piglit] [PATCH] gl-2.0-large-point-fs: new test of large points with fragment shaders

2015-07-07 Thread Charmaine Lee

Thanks for adding the test, Brian.

Reviewed-by: Charmaine Lee charmai...@vmware.com

From: Brian Paul bri...@vmware.com
Sent: Tuesday, July 7, 2015 3:32 PM
To: piglit@lists.freedesktop.org
Cc: Charmaine Lee; Jose Fonseca; Brian Paul
Subject: [PATCH] gl-2.0-large-point-fs: new test of large points with fragment 
shaders

v2: if max point size is very small, report PIGLIT_SKIP.
---
 tests/all.py|   1 +
 tests/spec/gl-2.0/CMakeLists.gl.txt |   1 +
 tests/spec/gl-2.0/large-point-fs.c  | 151 
 3 files changed, 153 insertions(+)
 create mode 100644 tests/spec/gl-2.0/large-point-fs.c

diff --git a/tests/all.py b/tests/all.py
index 0b135b7..110a5a4 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -1057,6 +1057,7 @@ with profile.group_manager(
 g(['attribs'])
 g(['gl-2.0-edgeflag'])
 g(['gl-2.0-edgeflag-immediate'])
+g(['gl-2.0-large-point-fs'])
 g(['gl-2.0-vertexattribpointer'])
 g(['gl-2.0-vertex-const-attr'])
 g(['attrib-assignments'], run_concurrent=False)
diff --git a/tests/spec/gl-2.0/CMakeLists.gl.txt 
b/tests/spec/gl-2.0/CMakeLists.gl.txt
index 2ce99bd..030ca4a 100644
--- a/tests/spec/gl-2.0/CMakeLists.gl.txt
+++ b/tests/spec/gl-2.0/CMakeLists.gl.txt
@@ -13,5 +13,6 @@ link_libraries (
 piglit_add_executable (vertex-program-two-side vertex-program-two-side.c)
 piglit_add_executable (gl-2.0-edgeflag edgeflag.c)
 piglit_add_executable (gl-2.0-edgeflag-immediate edgeflag-immediate.c)
+piglit_add_executable (gl-2.0-large-point-fs large-point-fs.c)
 piglit_add_executable (gl-2.0-vertexattribpointer vertexattribpointer.c)
 piglit_add_executable (gl-2.0-vertex-const-attr vertex-const-attr.c)
diff --git a/tests/spec/gl-2.0/large-point-fs.c 
b/tests/spec/gl-2.0/large-point-fs.c
new file mode 100644
index 000..1470d04
--- /dev/null
+++ b/tests/spec/gl-2.0/large-point-fs.c
@@ -0,0 +1,151 @@
+/*
+ * Copyright 2015 VMware, 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 drawing large points with a fragment shader.
+ * Brian Paul
+ * July 2015
+ */
+
+#include piglit-util-gl.h
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+   config.supports_gl_compat_version = 20;
+   config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
+PIGLIT_GL_TEST_CONFIG_END
+
+
+static const char *vertShaderText =
+   #version 120 \n
+   uniform vec4 color_bias; \n
+   varying vec4 color_bias_varying; \n
+\n
+   void main() \n
+   { \n
+  gl_Position = ftransform(); \n
+  color_bias_varying = color_bias; \n
+  gl_FrontColor = gl_Color; \n
+   } \n;
+
+static const char *fragShaderText =
+   varying vec4 color_bias_varying; \n
+   uniform vec4 color_scale; \n
+   varying vec4 color;\n
+   void main()\n
+   { \n
+  gl_FragColor = gl_Color * color_scale + color_bias_varying; \n
+   } \n;
+
+
+static int color_scale_uniform, color_bias_uniform;
+
+
+enum piglit_result
+piglit_display(void)
+{
+   const float colors[4][4] = {
+   { 0.5, 0, 1, 1 },
+   { 0, .5, 1, 1 },
+   { 0.0, 0, 0.5, 0.5 },
+   { 0.25, 0, 0.25, 0.25 }
+   };
+   const float scale[4] = { 2.0, 3.0, 0.0, 0.0 };
+   const float bias[4] = { 0, 0, 0.5, 0.5 };
+   float expected[4][4];
+   bool pass = true;
+   GLfloat size, probeSize;
+   int i;
+
+   /* compute expected colors */
+   for (i = 0; i  4; i++) {
+   expected[i][0] = MIN2(1.0, colors[i][0] * scale[0] + bias[0]);
+   expected[i][1] = MIN2(1.0, colors[i][1] * scale[1] + bias[1]);
+   expected[i][2] = MIN2(1.0, colors[i][2] * scale[2] + bias[2]);
+   expected[i][3] = MIN2(1.0, colors[i][3] * scale[3] + bias[3]);
+   }
+
+   glGetFloatv(GL_POINT_SIZE_MAX, size

Re: [Piglit] [PATCH] ext_transform_feedback-points: a new, simple xfb test

2014-11-03 Thread Charmaine Lee
Looks good to me. 

Reviewed-by: Charmaine Lee charmai...@vmware.com

From: Piglit piglit-boun...@lists.freedesktop.org on behalf of Brian Paul 
bri...@vmware.com
Sent: Monday, November 3, 2014 4:07 PM
To: piglit@lists.freedesktop.org
Subject: [Piglit] [PATCH] ext_transform_feedback-points: a new, simple xfb test

If argv[1]=large, draw large points (which may get converted to quads).
---
 tests/all.py   |2 +
 .../spec/ext_transform_feedback/CMakeLists.gl.txt  |1 +
 tests/spec/ext_transform_feedback/points.c |  177 
 3 files changed, 180 insertions(+)
 create mode 100644 tests/spec/ext_transform_feedback/points.c

diff --git a/tests/all.py b/tests/all.py
index c71462e..3a2f4e2 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -3109,6 +3109,8 @@ ext_transform_feedback['max-varyings'] = 
PiglitGLTest('ext_transform_feedback-ma
 ext_transform_feedback['nonflat-integral'] = 
PiglitGLTest('ext_transform_feedback-nonflat-integral', run_concurrent=True)
 ext_transform_feedback['overflow-edge-cases'] = 
PiglitGLTest('ext_transform_feedback-overflow-edge-cases', run_concurrent=True)
 ext_transform_feedback['overflow-edge-cases use_gs'] = 
PiglitGLTest('ext_transform_feedback-overflow-edge-cases use_gs', 
run_concurrent=True)
+ext_transform_feedback['points'] = 
PiglitGLTest('ext_transform_feedback-points', run_concurrent=True)
+ext_transform_feedback['points-large'] = 
PiglitGLTest('ext_transform_feedback-points large', run_concurrent=True)
 ext_transform_feedback['position-readback-bufferbase'] = 
PiglitGLTest('ext_transform_feedback-position', run_concurrent=True)
 ext_transform_feedback['position-readback-bufferbase-discard'] = 
PiglitGLTest('ext_transform_feedback-position discard', run_concurrent=True)
 ext_transform_feedback['position-readback-bufferoffset'] = 
PiglitGLTest('ext_transform_feedback-position offset', run_concurrent=True)
diff --git a/tests/spec/ext_transform_feedback/CMakeLists.gl.txt 
b/tests/spec/ext_transform_feedback/CMakeLists.gl.txt
index 1d03abd..95af3a5 100644
--- a/tests/spec/ext_transform_feedback/CMakeLists.gl.txt
+++ b/tests/spec/ext_transform_feedback/CMakeLists.gl.txt
@@ -24,6 +24,7 @@ piglit_add_executable (ext_transform_feedback-generatemipmap 
generatemipmap.c)
 piglit_add_executable (ext_transform_feedback-geometry-shaders-basic 
geometry-shaders-basic.c)
 piglit_add_executable (ext_transform_feedback-get-buffer-state 
get-buffer-state.c)
 piglit_add_executable (ext_transform_feedback-position position.c)
+piglit_add_executable (ext_transform_feedback-points points.c)
 piglit_add_executable (ext_transform_feedback-immediate-reuse 
immediate-reuse.c)
 piglit_add_executable (ext_transform_feedback-interleaved interleaved.c)
 piglit_add_executable (ext_transform_feedback-intervening-read 
intervening-read.c)
diff --git a/tests/spec/ext_transform_feedback/points.c 
b/tests/spec/ext_transform_feedback/points.c
new file mode 100644
index 000..bd8f115
--- /dev/null
+++ b/tests/spec/ext_transform_feedback/points.c
@@ -0,0 +1,177 @@
+/*
+ * Copyright © 2014 VMware, 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.
+ */
+
+/**
+ * Simple transform feedback test drawing GL_POINTS.
+ * If argv[1] == large draw large points (which may hit a point-quad
+ * conversion path.)
+ */
+
+#include piglit-util-gl.h
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+   config.supports_gl_compat_version = 10;
+   config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
+PIGLIT_GL_TEST_CONFIG_END
+
+
+static GLuint prog;
+static GLuint xfb_buf, vert_buf;
+static const int xfb_buf_size = 500;
+
+static const char *vstext = {
+   void main() {
+  gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
+  gl_FrontColor = vec4(0.9, 0.8, 0.7, 0.6);
+   }
+};
+
+#define NUM_VERTS 3
+static const GLfloat

Re: [Piglit] [PATCH 3/3] ext_texture_array: add simple 1D/2D array rendering tests

2014-08-05 Thread Charmaine Lee
Series looks good to me.

Reviewed-by: Charmaine Lee charmai...@vmware.com


From: Piglit piglit-boun...@lists.freedesktop.org on behalf of Brian Paul 
bri...@vmware.com
Sent: Friday, August 1, 2014 8:07 AM
To: piglit@lists.freedesktop.org
Subject: [Piglit] [PATCH 3/3] ext_texture_array: add simple 1D/2D array 
rendering tests

Check that we're sampling from the expected array slices.
---
 .../render-1darray-1slice.shader_test  |   35 +++
 .../ext_texture_array/render-1darray.shader_test   |   45 
 .../render-2darray-1slice.shader_test  |   34 +++
 .../ext_texture_array/render-2darray.shader_test   |   44 +++
 4 files changed, 158 insertions(+)
 create mode 100644 
tests/spec/ext_texture_array/render-1darray-1slice.shader_test
 create mode 100644 tests/spec/ext_texture_array/render-1darray.shader_test
 create mode 100644 
tests/spec/ext_texture_array/render-2darray-1slice.shader_test
 create mode 100644 tests/spec/ext_texture_array/render-2darray.shader_test

diff --git a/tests/spec/ext_texture_array/render-1darray-1slice.shader_test 
b/tests/spec/ext_texture_array/render-1darray-1slice.shader_test
new file mode 100644
index 000..f524c06
--- /dev/null
+++ b/tests/spec/ext_texture_array/render-1darray-1slice.shader_test
@@ -0,0 +1,35 @@
+# Test GL_TEXTURE_1D_ARRAY texture with just one layer
+[require]
+GLSL = 1.10
+GL_EXT_texture_array
+
+[vertex shader]
+#version 110
+varying vec4 texcoords;
+void main() {
+   gl_Position = gl_Vertex;
+   texcoords = (gl_Vertex + 1.0) / 2.0;
+}
+
+[fragment shader]
+#version 110
+#extension GL_EXT_texture_array : enable
+varying vec4 texcoords;
+uniform sampler1DArray tex;
+uniform float layer;
+
+void main()
+{
+   vec2 p = vec2(texcoords.x, layer);
+   gl_FragColor = texture1DArray(tex, p);
+}
+
+[test]
+uniform int tex 0
+texture rgbw 1DArray 0 ( 64 , 1 )
+
+# layer=12 should get clamped to zero
+uniform float layer 12
+draw rect -1 -1 2 2
+relative probe rgba (0.5, 0.5) (1.0, 0.0, 0.0, 1.0)
+
diff --git a/tests/spec/ext_texture_array/render-1darray.shader_test 
b/tests/spec/ext_texture_array/render-1darray.shader_test
new file mode 100644
index 000..74b6154
--- /dev/null
+++ b/tests/spec/ext_texture_array/render-1darray.shader_test
@@ -0,0 +1,45 @@
+# Test GL_TEXTURE_1D_ARRAY texture with four layers
+[require]
+GLSL = 1.10
+GL_EXT_texture_array
+
+[vertex shader]
+#version 110
+varying vec4 texcoords;
+void main() {
+   gl_Position = gl_Vertex;
+   texcoords = (gl_Vertex + 1.0) / 2.0;
+}
+
+[fragment shader]
+#version 110
+#extension GL_EXT_texture_array : enable
+varying vec4 texcoords;
+uniform sampler1DArray tex;
+uniform float layer;
+
+void main()
+{
+   vec2 p = vec2(texcoords.x, layer);
+   gl_FragColor = texture1DArray(tex, p);
+}
+
+[test]
+uniform int tex 0
+texture rgbw 1DArray 0 ( 64 , 4 )
+
+uniform float layer 0
+draw rect -1 -1 2 2
+relative probe rgba (0.5, 0.5) (1.0, 0.0, 0.0, 1.0)
+
+uniform float layer 1
+draw rect -1 -1 2 2
+relative probe rgba (0.5, 0.5) (0.0, 1.0, 0.0, 1.0)
+
+uniform float layer 2
+draw rect -1 -1 2 2
+relative probe rgba (0.5, 0.5) (0.0, 0.0, 1.0, 1.0)
+
+uniform float layer 3
+draw rect -1 -1 2 2
+relative probe rgba (0.5, 0.5) (1.0, 1.0, 1.0, 1.0)
diff --git a/tests/spec/ext_texture_array/render-2darray-1slice.shader_test 
b/tests/spec/ext_texture_array/render-2darray-1slice.shader_test
new file mode 100644
index 000..335436d
--- /dev/null
+++ b/tests/spec/ext_texture_array/render-2darray-1slice.shader_test
@@ -0,0 +1,34 @@
+# Test GL_TEXTURE_2D_ARRAY with just one slice
+[require]
+GLSL = 1.10
+GL_EXT_texture_array
+
+[vertex shader]
+#version 110
+varying vec4 texcoords;
+void main() {
+   gl_Position = gl_Vertex;
+   texcoords = (gl_Vertex + 1.0) / 2.0;
+}
+
+[fragment shader]
+#version 110
+#extension GL_EXT_texture_array : enable
+varying vec4 texcoords;
+uniform sampler2DArray tex;
+uniform float layer;
+
+void main()
+{
+   vec3 p = vec3(texcoords.xy, layer);
+   gl_FragColor = texture2DArray(tex, p);
+}
+
+[test]
+uniform int tex 0
+texture rgbw 2DArray 0 (32, 32, 1)
+
+# layer=12 should get clamped to zero
+uniform float layer 12
+draw rect -1 -1 2 2
+relative probe rgba (0.5, 0.5) (1.0, 0.0, 0.0, 1.0)
diff --git a/tests/spec/ext_texture_array/render-2darray.shader_test 
b/tests/spec/ext_texture_array/render-2darray.shader_test
new file mode 100644
index 000..189bb13
--- /dev/null
+++ b/tests/spec/ext_texture_array/render-2darray.shader_test
@@ -0,0 +1,44 @@
+[require]
+GLSL = 1.10
+GL_EXT_texture_array
+
+[vertex shader]
+#version 110
+varying vec4 texcoords;
+void main() {
+   gl_Position = gl_Vertex;
+   texcoords = (gl_Vertex + 1.0) / 2.0;
+}
+
+[fragment shader]
+#version 110
+#extension GL_EXT_texture_array : enable
+varying vec4 texcoords;
+uniform sampler2DArray tex;
+uniform float layer;
+
+void main

Re: [Piglit] [PATCH 2/2] arb_provoking_vertex/xfb-before-flatshading: use default window size

2014-07-03 Thread Charmaine Lee
Reviewed-by: Charmaine Lee charmai...@vmware.com

From: Piglit piglit-boun...@lists.freedesktop.org on behalf of Brian Paul 
bri...@vmware.com
Sent: Thursday, July 3, 2014 10:41 AM
To: piglit@lists.freedesktop.org
Subject: [Piglit] [PATCH 2/2] arb_provoking_vertex/xfb-before-flatshading:  
use default window size

---
 tests/spec/arb_provoking_vertex/xfb-before-flatshading.c |2 --
 1 file changed, 2 deletions(-)

diff --git a/tests/spec/arb_provoking_vertex/xfb-before-flatshading.c 
b/tests/spec/arb_provoking_vertex/xfb-before-flatshading.c
index 67cc581..6d168ea 100644
--- a/tests/spec/arb_provoking_vertex/xfb-before-flatshading.c
+++ b/tests/spec/arb_provoking_vertex/xfb-before-flatshading.c
@@ -40,8 +40,6 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
config.supports_gl_compat_version = 32;
 config.supports_gl_core_version = 32;

-   config.window_width = 100;
-   config.window_height = 100;
config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;

 PIGLIT_GL_TEST_CONFIG_END
--
1.7.10.4

___
Piglit mailing list
Piglit@lists.freedesktop.org
https://urldefense.proofpoint.com/v1/url?u=http://lists.freedesktop.org/mailman/listinfo/piglitk=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0Ar=iVNYIcCaC9TDvyNBQU%2F5q5NVsC01tSgJb3oX27T14ck%3D%0Am=AOPJ5rlYmUW3z%2BoPP6k1Iavi6h20Rh4GM%2BXEnugnnhU%3D%0As=24aeec83ec2e4a9e812d6aede16bb71cfc071c27f120756154752a8cee7d3c63
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] arb_texture_buffer_object-get: use piglit_get_gl_enum_name() in error msg

2014-06-25 Thread Charmaine Lee
Reviewed-by: Charmaine Lee charmai...@vmware.com

From: Piglit piglit-boun...@lists.freedesktop.org on behalf of Brian Paul 
bri...@vmware.com
Sent: Wednesday, June 25, 2014 8:45 AM
To: piglit@lists.freedesktop.org
Subject: [Piglit] [PATCH] arb_texture_buffer_object-get: use
piglit_get_gl_enum_name() in error msg

---
 tests/spec/arb_texture_buffer_object/get.c |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tests/spec/arb_texture_buffer_object/get.c 
b/tests/spec/arb_texture_buffer_object/get.c
index 202a909..d96a3c1 100644
--- a/tests/spec/arb_texture_buffer_object/get.c
+++ b/tests/spec/arb_texture_buffer_object/get.c
@@ -53,9 +53,11 @@ _expect(int line, GLenum token, GLint val)
glGetIntegerv(token, ret);
if (ret != val) {
fprintf(stderr,
-   line %d: %s was %d, expected %d\n,
+   line %d: %s was %s, expected %s\n,
line,
-   piglit_get_gl_enum_name(token), ret, val);
+   piglit_get_gl_enum_name(token),
+   piglit_get_gl_enum_name(ret),
+   piglit_get_gl_enum_name(val));
return false;
}

--
1.7.10.4

___
Piglit mailing list
Piglit@lists.freedesktop.org
https://urldefense.proofpoint.com/v1/url?u=http://lists.freedesktop.org/mailman/listinfo/piglitk=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0Ar=iVNYIcCaC9TDvyNBQU%2F5q5NVsC01tSgJb3oX27T14ck%3D%0Am=5FJnHACCkMzFsLt9i%2F39IawY5XgXli0OMmRYVVzrQrM%3D%0As=521a7752e009e8f0cacbd799bb448862db4ac0608b8dc67e4b466911b38e93ce
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] util/framework/glut: check if we have a core profile

2014-06-25 Thread Charmaine Lee
Reviewed-by: Charmaine Lee charmai...@vmware.com

From: Piglit piglit-boun...@lists.freedesktop.org on behalf of Brian Paul 
bri...@vmware.com
Sent: Wednesday, June 25, 2014 8:45 AM
To: piglit@lists.freedesktop.org
Subject: [Piglit] [PATCH] util/framework/glut: check if we have a core  profile

For the GLUT framework, check the context version and whether
GL_ARB_compatibility is supported to determine if we should set
piglit_is_core_profile.  Fixes some issues when running GL 3.1 and
later on Windows.
---
 tests/util/piglit-framework-gl/piglit_glut_framework.c |8 
 1 file changed, 8 insertions(+)

diff --git a/tests/util/piglit-framework-gl/piglit_glut_framework.c 
b/tests/util/piglit-framework-gl/piglit_glut_framework.c
index 7c872fb..7530d8d 100644
--- a/tests/util/piglit-framework-gl/piglit_glut_framework.c
+++ b/tests/util/piglit-framework-gl/piglit_glut_framework.c
@@ -256,6 +256,14 @@ piglit_glut_framework_create(const struct 
piglit_gl_test_config *test_config)
if (!check_gl_version(test_config))
piglit_report_result(PIGLIT_SKIP);

+/* Check if we actually have a core profile */
+   {
+   int actual_version = piglit_get_gl_version();
+   if (actual_version = 31 
+   !piglit_is_extension_supported(GL_ARB_compatibility))
+   piglit_is_core_profile = true;
+   }
+
glut_fw.gl_fw.swap_buffers = swap_buffers;
glut_fw.gl_fw.run_test = run_test;
glut_fw.gl_fw.post_redisplay = post_redisplay;
--
1.7.10.4

___
Piglit mailing list
Piglit@lists.freedesktop.org
https://urldefense.proofpoint.com/v1/url?u=http://lists.freedesktop.org/mailman/listinfo/piglitk=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0Ar=iVNYIcCaC9TDvyNBQU%2F5q5NVsC01tSgJb3oX27T14ck%3D%0Am=q1wT4aOetVETQd5Kpg%2BrVDT1YOiCXlPN%2FKQSvxFlXvY%3D%0As=593c61f70c28e359fb1c33b631b6e9e06539eaa67d08ce9bbc2b8998bf6d
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 1/2] piglit-dispatch: fix get_core_proc_address() for Windows

2014-06-25 Thread Charmaine Lee
The series looks good to me.

Reviewed-by: Charmaine Lee charmai...@vmware.com


From: Piglit piglit-boun...@lists.freedesktop.org on behalf of Brian Paul 
bri...@vmware.com
Sent: Wednesday, June 25, 2014 10:50 AM
To: piglit@lists.freedesktop.org
Subject: [Piglit] [PATCH 1/2] piglit-dispatch: fix get_core_proc_address()  
for Windows

Even for functions such as glGetStringi() which are in OpenGL 3.0, we
call get_core_proc_address() with gl_10x_version = 10 (seems to be a
larger problem in the dispatch code generation).  That means we try
GetProcAddress(OPENGL32.DLL) and fail.  Now, if GetProcAddress()
fails, try get_ext_proc_address() too.
---
 tests/util/piglit-dispatch-init.c |   10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/tests/util/piglit-dispatch-init.c 
b/tests/util/piglit-dispatch-init.c
index 22318a3..456f75b 100644
--- a/tests/util/piglit-dispatch-init.c
+++ b/tests/util/piglit-dispatch-init.c
@@ -94,8 +94,16 @@ get_core_proc_address(const char *function_name, int 
gl_10x_version)
if (gl_10x_version  11) {
return get_ext_proc_address(function_name);
} else {
-   return (piglit_dispatch_function_ptr)
+   piglit_dispatch_function_ptr p;
+   /* Try GetProcAddress() first.
+* If that fails, try wglGetProcAddress().
+*/
+   p = (piglit_dispatch_function_ptr)
GetProcAddress(LoadLibraryA(OPENGL32), function_name);
+   if (!p)
+   p = get_ext_proc_address(function_name);
+   return p;
+
}
 }

--
1.7.10.4

___
Piglit mailing list
Piglit@lists.freedesktop.org
https://urldefense.proofpoint.com/v1/url?u=http://lists.freedesktop.org/mailman/listinfo/piglitk=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0Ar=iVNYIcCaC9TDvyNBQU%2F5q5NVsC01tSgJb3oX27T14ck%3D%0Am=WuH7te4OnJ33iLNMMaAsJqSOS%2B%2FtaszEa1loLlQjzSw%3D%0As=26be3d16253ff76835209a6c3dceb1f55a4d4e67b16e31ad1581651d80220bd0
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] arb_uniform_buffer_object-minmax: divide block size by 4 to get components

2014-06-25 Thread Charmaine Lee
Reviewed-by: Charmaine Lee charmai...@vmware.com

From: Piglit piglit-boun...@lists.freedesktop.org on behalf of Brian Paul 
bri...@vmware.com
Sent: Wednesday, June 25, 2014 12:27 PM
To: piglit@lists.freedesktop.org
Subject: [Piglit] [PATCH] arb_uniform_buffer_object-minmax: divide block
size by 4 to get components

GL_MAX_UNIFORM_BLOCK_SIZE is in bytes.  A component is regarded as being
four bytes in size.  So to compute the number of components, divide the
block size by 4.

With this change, nvidia's driver passes the test.

Found by Kai Ninomiya of VMware.
---
 tests/spec/arb_uniform_buffer_object/minmax.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/spec/arb_uniform_buffer_object/minmax.c 
b/tests/spec/arb_uniform_buffer_object/minmax.c
index 03b254c..e5cd81a 100644
--- a/tests/spec/arb_uniform_buffer_object/minmax.c
+++ b/tests/spec/arb_uniform_buffer_object/minmax.c
@@ -81,9 +81,9 @@ piglit_init(int argc, char **argv)
glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, funiforms);
glGetIntegerv(GL_MAX_UNIFORM_BLOCK_SIZE, blocksize);
piglit_test_min_int(GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS,
-vblocks * blocksize + vuniforms);
+vblocks * blocksize / 4 + vuniforms);
piglit_test_min_int(GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS,
-fblocks * blocksize + funiforms);
+fblocks * blocksize / 4 + funiforms);
if (gs) {
if (piglit_get_gl_version() = 31) {
glGetIntegerv(GL_MAX_GEOMETRY_UNIFORM_BLOCKS, gblocks);
@@ -91,7 +91,7 @@ piglit_init(int argc, char **argv)
glGetIntegerv(GL_MAX_GEOMETRY_UNIFORM_COMPONENTS, guniforms);

piglit_test_min_int(GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS,
-   gblocks * blocksize + guniforms);
+   gblocks * blocksize / 4 + guniforms);
}

piglit_test_min_int(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, 1);
--
1.7.10.4

___
Piglit mailing list
Piglit@lists.freedesktop.org
https://urldefense.proofpoint.com/v1/url?u=http://lists.freedesktop.org/mailman/listinfo/piglitk=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0Ar=iVNYIcCaC9TDvyNBQU%2F5q5NVsC01tSgJb3oX27T14ck%3D%0Am=lEYZ9459wIc6IgbAQD3%2FFYDbod4P7xug8QlynP41A9c%3D%0As=f939d37c249b2670247980424bb327077d489f7e46890c3b38e0fc00f4d35076
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit