Re: [Piglit] [PATCH 0/2] shader_runner: Add ARB_program_interface_query support

2015-09-17 Thread Tapani Pälli


On 09/16/2015 11:31 AM, Samuel Iglesias Gonsalvez wrote:

Hello,

Following my idea described here [0], I modified shader_runner to accept
other program interfaces.

The format of the command is:

  active program_interface GL_INTERFACE_TYPE_ENUM var_name GL_PROPS_ENUM integer

or, if we include the GL type enum:

  active program_interface GL_INTERFACE_TYPE_ENUM var_name GL_PROPS_ENUM 
GL_TYPE_ENUM

Some examples:

active program_interface GL_UNIFORM i1 GL_MATRIX_STRIDE 0
active program_interface GL_UNIFORM i1 GL_IS_ROW_MAJOR 0
active program_interface GL_PROGRAM_OUTPUT piglit_fragcolor GL_TYPE 
GL_FLOAT_VEC4
active program_interface GL_PROGRAM_INPUT piglit_vertex GL_TYPE GL_FLOAT_VEC4


From user/reader perspective it is not obvious what 'active 
program_interface' does. I think it should have something like 
'validate' or 'query' in it so that reader knows what is going on. These 
sounds more like setters now than queries? Also, why 'active', you can't 
query inactive ones?


Otherwise, I think it is fine addition if it helps in writing more tests.



What do you think?

Thanks,

Sam

[0] http://lists.freedesktop.org/archives/piglit/2015-September/017080.html

Samuel Iglesias Gonsalvez (2):
   shader_runner: make active_uniforms's all_types variable be global
   shader_runner: Add ARB_program_interface_query support

  tests/shaders/shader_runner.c | 322 --
  1 file changed, 244 insertions(+), 78 deletions(-)




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


Re: [Piglit] [PATCH v8] Port basic GL rendering test from Glean to Piglit

2015-09-17 Thread Emil Velikov
Hi Brian,

On 17 September 2015 at 18:12, Brian Paul  wrote:
> Just a few more minor things...
>
>
>
> On 09/16/2015 03:23 PM, Juliet Fru wrote:

>> --- /dev/null
>> +++ b/tests/spec/gl-1.0/no-op-paths.c
>> @@ -0,0 +1,305 @@

>> +enum path
>> +{
>> +   ALPHA,
>> +   BLEND,
>> +   COLOR_MASK,
>> +   DEPTH,
>> +   LOGIC,
>> +   SCISSOR,
>> +   STENCIL,
>> +   STIPPLE,
>> +   TEXTURE,
>> +   NUM_PATHS   /* end-of-list token */
>> +};
>> +

>> +const char *
>> +path_name(enum path paths)
>> +{
>> +   switch (paths) {
>> +   case ALPHA:
>> +   return "Alpha Test";
>> +   case BLEND:
>> +   return "Blending";
>> +   case COLOR_MASK:
>> +   return "Color Mask";
>> +   case DEPTH:
>> +   return "Depth Test";
>> +   case LOGIC:
>> +   return "LogicOp";
>> +   case SCISSOR:
>> +   return "Scissor Test";
>> +   case STENCIL:
>> +   return "Stencil Test";
>> +   case STIPPLE:
>> +   return "Polygon Stipple";
>> +   case TEXTURE:
>> +   return "Modulated Texture";
>> +   case NUM_PATHS:
>> +   return "paths";
>
>
> We need a default case here just to silence a compiler warning. Something
> like:
>
> default:
> return "BAD PATH VALUE!";
>
I believe I'm the one to blame for the missing default statement here.
Afaics every value of the enum is handled so if the compiler is
throwing a warning, it has gone bonkers :-)

Just throwing it out there.

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


[Piglit] [PATCH v9] Port basic GL rendering test from Glean to Piglit

2015-09-17 Thread Juliet Fru
This test replaces the original glean tpaths.cpp test.
---
 tests/all.py|   1 +
 tests/spec/gl-1.0/CMakeLists.gl.txt |   1 +
 tests/spec/gl-1.0/no-op-paths.c | 308 
 3 files changed, 310 insertions(+)
 create mode 100644 tests/spec/gl-1.0/no-op-paths.c

diff --git a/tests/all.py b/tests/all.py
index fcfc5cd..85973d6 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -1000,6 +1000,7 @@ with profile.group_manager(
 g(['gl-1.0-ortho-pos'])
 g(['gl-1.0-readpixsanity'])
 g(['gl-1.0-logicop'])
+g(['gl-1.0-no-op-paths'])
 
 with profile.group_manager(
 PiglitGLTest,
diff --git a/tests/spec/gl-1.0/CMakeLists.gl.txt 
b/tests/spec/gl-1.0/CMakeLists.gl.txt
index d04b835..7a7f508 100644
--- a/tests/spec/gl-1.0/CMakeLists.gl.txt
+++ b/tests/spec/gl-1.0/CMakeLists.gl.txt
@@ -22,6 +22,7 @@ piglit_add_executable (gl-1.0-front-invalidate-back 
front-invalidate-back.c)
 piglit_add_executable (gl-1.0-logicop logicop.c)
 piglit_add_executable (gl-1.0-long-dlist long-dlist.c)
 piglit_add_executable (gl-1.0-ortho-pos orthpos.c)
+piglit_add_executable (gl-1.0-no-op-paths no-op-paths.c)
 piglit_add_executable (gl-1.0-polygon-line-aa polygon-line-aa.c)
 piglit_add_executable (gl-1.0-push-no-attribs push-no-attribs.c)
 piglit_add_executable (gl-1.0-readpixsanity readpix.c)
diff --git a/tests/spec/gl-1.0/no-op-paths.c b/tests/spec/gl-1.0/no-op-paths.c
new file mode 100644
index 000..35f8c84
--- /dev/null
+++ b/tests/spec/gl-1.0/no-op-paths.c
@@ -0,0 +1,308 @@
+/*  BEGIN_COPYRIGHT -*- glean -*-
+ *
+ *  Copyright (C) 1999  Allen Akin   All Rights Reserved.
+ *  Copyright (C) 2015  Intel Corporation.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ *  END_COPYRIGHT
+ */
+/** @file paths.c
+ *
+ *  Test basic GL rendering paths.
+ *
+ *
+ * Based on the original Glean tpaths.cpp test, this test verifies
+ * that basic, trival OpenGL paths work as expected. For example,
+ * glAlphaFunc(GL_GEQUAL, 0.0) should always pass and
+ * glAlphaFunc(GL_LESS, 0.0) should always fail.  We setup trivial
+ * pass and fail conditions for each of alpha test, blending, color mask,
+ * depth test, logic ops, scissor, stencil, stipple, and texture and
+ * make sure they work as expected.  We also setup trival-pass for all
+ * these paths simultaneously and test that as well.
+ *
+ * To test for pass/fail we examine the color buffer for white or black,
+ * respectively.
+ *
+ * Authors:
+ * Brian Paul 
+ * Adapted to Piglit by Juliet Fru , August 2015.
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN config.supports_gl_compat_version = 10;
+
+config.window_visual = PIGLIT_GL_VISUAL_RGBA |
+   PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_DEPTH |
+   PIGLIT_GL_VISUAL_STENCIL;
+
+PIGLIT_GL_TEST_CONFIG_END enum path
+{
+   ALPHA,
+   BLEND,
+   COLOR_MASK,
+   DEPTH,
+   LOGIC,
+   SCISSOR,
+   STENCIL,
+   STIPPLE,
+   TEXTURE,
+   NUM_PATHS   /* end-of-list token */
+};
+
+enum state
+{
+   DISABLE,
+   ALWAYS_PASS,
+   ALWAYS_FAIL
+};
+
+const char *
+path_name(enum path paths)
+{
+   switch (paths) {
+   case ALPHA:
+   return "Alpha Test";
+   case BLEND:
+   return "Blending";
+   case COLOR_MASK:
+   return "Color Mask";
+   case DEPTH:
+   return "Depth Test";
+   case LOGIC:
+   return "LogicOp";
+   case SCISSOR:
+   return "Scissor Test";
+   case STENCIL:
+   return "Stencil Test";
+   case STIPPLE:
+   return "Polygon Stipple";
+   case TEXTURE:
+   return "Modulated Texture";
+   case NUM_PATHS:
+   return "paths";
+default:
+

[Piglit] [PATCH v6] Port arb occlusion query conformance tests from Glean to Piglit

2015-09-17 Thread Juliet Fru
This test replaces the original glean toccluqry.cpp test.
---
 tests/all.py   |   1 +
 tests/spec/arb_occlusion_query/CMakeLists.gl.txt   |   1 +
 .../arb_occlusion_query/occlusion_query_conform.c  | 558 +
 3 files changed, 560 insertions(+)
 create mode 100644 tests/spec/arb_occlusion_query/occlusion_query_conform.c

diff --git a/tests/all.py b/tests/all.py
index fe088f5..748165f 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -2115,6 +2115,7 @@ with profile.group_manager(
 PiglitGLTest,
 grouptools.join('spec', 'ARB_occlusion_query')) as g:
 g(['occlusion_query'])
+g(['occlusion_query_conformance'])
 g(['occlusion_query_lifetime'])
 g(['occlusion_query_meta_fragments'])
 g(['occlusion_query_meta_no_fragments'])
diff --git a/tests/spec/arb_occlusion_query/CMakeLists.gl.txt 
b/tests/spec/arb_occlusion_query/CMakeLists.gl.txt
index 01a499d..025c2cd 100644
--- a/tests/spec/arb_occlusion_query/CMakeLists.gl.txt
+++ b/tests/spec/arb_occlusion_query/CMakeLists.gl.txt
@@ -10,6 +10,7 @@ link_libraries (
 )
 
 piglit_add_executable (occlusion_query occlusion_query.c)
+piglit_add_executable (occlusion_query_conform occlusion_query_conform.c)
 piglit_add_executable (occlusion_query_lifetime occlusion_query_lifetime.c)
 piglit_add_executable (occlusion_query_meta_no_fragments 
occlusion_query_meta_no_fragments.c)
 piglit_add_executable (occlusion_query_meta_fragments 
occlusion_query_meta_fragments.c)
diff --git a/tests/spec/arb_occlusion_query/occlusion_query_conform.c 
b/tests/spec/arb_occlusion_query/occlusion_query_conform.c
new file mode 100644
index 000..76cb311
--- /dev/null
+++ b/tests/spec/arb_occlusion_query/occlusion_query_conform.c
@@ -0,0 +1,558 @@
+/*  BEGIN_COPYRIGHT -*- glean -*-
+ *
+ *  Copyright (C) 1999  Allen Akin   All Rights Reserved.
+ *  Copyright (C) 2015  Intel Corporation.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * END_COPYRIGHT
+ */
+
+/** @file occlusion_query_conform.c
+ *
+ * Conformance test on ARB_occlusion_query extension.
+ *
+ * Authors:
+ * Wei Wang 
+ * Adapted to Piglit by Juliet Fru , September 2015
+ */
+
+#include "piglit-util-gl.h"
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+PIGLIT_GL_TEST_CONFIG_BEGIN config.supports_gl_compat_version = 10;
+
+config.window_visual =
+   PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE |
+   PIGLIT_GL_VISUAL_DEPTH;
+
+PIGLIT_GL_TEST_CONFIG_END static GLuint
+find_unused_id(void)
+{
+   GLuint id;
+   glGenQueries(1, );
+   return id;
+
+}
+
+/* If multiple queries are issued on the same target and id prior to calling
+ * GetQueryObject[u]iVARB, the result returned will always be from the last
+ * query issued.  The results from any queries before the last one will be lost
+ * if the results are not retrieved before starting a new query on the same
+ * target and id.
+ */
+static bool
+conformOQ_GetObjivAval_multi1(GLuint id)
+{
+   GLint ready;
+   GLuint passed = 0;
+
+   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+   glMatrixMode(GL_PROJECTION);
+   glPushMatrix();
+   glLoadIdentity();
+   glOrtho(-1.0, 1.0, -1.0, 1.0, 0.0, 25.0);
+
+   glMatrixMode(GL_MODELVIEW);
+   glPushMatrix();
+   glLoadIdentity();
+   glTranslatef(0.0, 0.0, -10.0);
+
+   /* draw the occluder (red) */
+   glColorMask(1, 1, 1, 1);
+   glDepthMask(GL_TRUE);
+   glColor3f(1, 0, 0);
+   piglit_draw_rect(-0.5, 0.5, 0.5, -0.5);
+
+   glPushMatrix();
+   glTranslatef(0.0, 0.0, -5.0);
+   glColorMask(0, 0, 0, 0);
+   glDepthMask(GL_FALSE);
+
+   /* draw the 1st box (green) which is occluded by the occluder partly */
+   glBeginQueryARB(GL_SAMPLES_PASSED_ARB, id);
+   glColor3f(0, 1, 0);
+   

[Piglit] [PATCH] arb_arrays_of_arrays: add some simple ubo AoA tests

2015-09-17 Thread Timothy Arceri
---
 .../execution/ubo/fs-const.shader_test | 37 +++
 .../execution/ubo/fs-nonconst.shader_test  | 76 ++
 2 files changed, 113 insertions(+)
 create mode 100644 
tests/spec/arb_arrays_of_arrays/execution/ubo/fs-const.shader_test
 create mode 100644 
tests/spec/arb_arrays_of_arrays/execution/ubo/fs-nonconst.shader_test

diff --git a/tests/spec/arb_arrays_of_arrays/execution/ubo/fs-const.shader_test 
b/tests/spec/arb_arrays_of_arrays/execution/ubo/fs-const.shader_test
new file mode 100644
index 000..7757ad4
--- /dev/null
+++ b/tests/spec/arb_arrays_of_arrays/execution/ubo/fs-const.shader_test
@@ -0,0 +1,37 @@
+# This test verifies that uniform indexing of UBO arrays in the
+# fragment shader behaves correctly, when the block member is a
+# const-indexed array.
+
+[require]
+GLSL >= 1.50
+GL_ARB_arrays_of_arrays
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 150
+#extension GL_ARB_arrays_of_arrays: require
+
+uniform block {
+   vec4 color[2];
+} arr[4][2];
+
+uniform int n;
+
+out vec4 color;
+
+void main()
+{
+   color = arr[3][0].color[1];
+}
+
+[test]
+clear color 0.2 0.2 0.2 0.2
+clear
+
+ubo array index 0
+uniform vec4 block.color[0] 0.0 0.0 1.0 0.0
+uniform vec4 block.color[1] 1.0 0.0 0.0 0.0
+
+draw rect -1 -1 1 1
+relative probe rect rgb (0.0, 0.0, 0.5, 0.5) (1.0, 0.0, 0.0)
diff --git 
a/tests/spec/arb_arrays_of_arrays/execution/ubo/fs-nonconst.shader_test 
b/tests/spec/arb_arrays_of_arrays/execution/ubo/fs-nonconst.shader_test
new file mode 100644
index 000..be90ee7
--- /dev/null
+++ b/tests/spec/arb_arrays_of_arrays/execution/ubo/fs-nonconst.shader_test
@@ -0,0 +1,76 @@
+# This test verifies that dynamically uniform indexing of UBO arrays
+# in the fragment shader behaves correctly, when the block member is a
+# nonconst-indexed array.
+
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader5
+GL_ARB_arrays_of_arrays
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 150
+#extension GL_ARB_gpu_shader5: require
+#extension GL_ARB_arrays_of_arrays: require
+
+uniform block {
+   vec4 color[2];
+} arr[3][2];
+
+uniform int n;
+uniform int m;
+
+out vec4 color;
+
+void main()
+{
+   color = arr[n][m].color[m];
+}
+
+[test]
+clear color 0.2 0.2 0.2 0.2
+clear
+
+ubo array index 0
+uniform vec4 block.color[0] 1.0 0.0 0.0 0.0
+uniform vec4 block.color[1] 0.0 1.0 1.0 0.0
+ubo array index 1
+uniform vec4 block.color[0] 0.0 1.0 1.0 0.0
+uniform vec4 block.color[1] 0.0 1.0 0.0 0.0
+ubo array index 2
+uniform vec4 block.color[0] 0.0 0.0 1.0 0.0
+uniform vec4 block.color[1] 0.0 1.0 1.0 0.0
+ubo array index 3
+uniform vec4 block.color[0] 0.0 1.0 1.0 0.0
+uniform vec4 block.color[1] 0.0 1.0 1.0 0.0
+ubo array index 4
+uniform vec4 block.color[0] 0.0 1.0 1.0 0.0
+uniform vec4 block.color[1] 0.0 1.0 1.0 0.0
+ubo array index 5
+uniform vec4 block.color[0] 0.0 1.0 1.0 0.0
+uniform vec4 block.color[1] 1.0 1.0 1.0 0.0
+
+uniform int n 0
+uniform int m 0
+draw rect -1 -1 1 1
+
+relative probe rect rgb (0.0, 0.0, 0.5, 0.5) (1.0, 0.0, 0.0)
+
+uniform int n 0
+uniform int m 1
+draw rect 0 -1 1 1
+
+relative probe rect rgb (0.5, 0.0, 0.5, 0.5) (0.0, 1.0, 0.0)
+
+uniform int n 1
+uniform int m 0
+draw rect -1 0 1 1
+
+relative probe rect rgb (0.0, 0.5, 0.5, 0.5) (0.0, 0.0, 1.0)
+
+uniform int n 2
+uniform int m 1
+draw rect 0 0 1 1
+
+relative probe rect rgb (0.5, 0.5, 0.5, 0.5) (1.0, 1.0, 1.0)
-- 
2.4.3

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


Re: [Piglit] [PATCH v1] Porting the two sided stencil extension tests from Glean to Piglit.

2015-09-17 Thread Brian Paul

On 09/17/2015 05:18 PM, Juliet Fru wrote:

This test replaces the original glean tstencil2.cpp test.
---
  tests/spec/arb_texture_stencil8/CMakeLists.gl.txt  |   1 +
  .../spec/arb_texture_stencil8/stencil-extension.c  | 765 +
  2 files changed, 766 insertions(+)
  create mode 100644 tests/spec/arb_texture_stencil8/stencil-extension.c

diff --git a/tests/spec/arb_texture_stencil8/CMakeLists.gl.txt 
b/tests/spec/arb_texture_stencil8/CMakeLists.gl.txt
index a8d1693..9687f6a 100644
--- a/tests/spec/arb_texture_stencil8/CMakeLists.gl.txt
+++ b/tests/spec/arb_texture_stencil8/CMakeLists.gl.txt
@@ -13,5 +13,6 @@ piglit_add_executable (arb_texture_stencil8-stencil-texture 
stencil-texture.c)
  piglit_add_executable (arb_texture_stencil8-draw draw.c)
  piglit_add_executable (arb_texture_stencil8-fbo-stencil8 fbo-stencil8.c)
  piglit_add_executable (arb_texture_stencil8-getteximage getteximage.c)
+piglit_add_executable (arb_texture_stencil8-stencil-extension 
stencil-extension.c)


That's not the right place for this test.

It tests GL 2.0's two-sided stencil, GL_EXT_stencil_two_side and 
GL_ATI_separate_stencil so let's put it in the tests/spec/gl-2.0/ 
directory and call it two-sided-stencil.c




  # vim: ft=cmake:
diff --git a/tests/spec/arb_texture_stencil8/stencil-extension.c 
b/tests/spec/arb_texture_stencil8/stencil-extension.c
new file mode 100644
index 000..4872fe0
--- /dev/null
+++ b/tests/spec/arb_texture_stencil8/stencil-extension.c
@@ -0,0 +1,765 @@
+/*
+ * BEGIN_COPYRIGHT -*- glean -*-
+ *
+ * Copyright (C) 1999  Allen Akin   All Rights Reserved.
+ * Copyright (C) 2009  VMware, Inc.  All Rights Reserved.
+ * Copyright (C) 2015  Intel Corporation  All Rights Reserved.
+ *
+ * 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.
+ *
+ * END_COPYRIGHT
+ */
+
+/** @file stencil-extension.c
+ *
+ *  Test two-sided stencil extensions
+ *
+ * This test could be better:
+ * 1. Generate random state vectors, render and compare to expected values
+ * 2. Exercise separate front/back reference values and masks for the
+ * EXT and GL2 variations.WriteMask
+ *
+ * Note: Must check writeMask of set_stencil_state to make sure it's 
correct
+ *
+ * Authors:
+ * Brian Paul 
+ * Adapted to Piglit by Juliet Fru , 
September 2015.
+ */
+
+#include "piglit-util-gl.h"
+
+#include 
+#include 
+
+#define window_size 100
+
+/*  two-sided methods. */
+#define ATI 1
+#define EXT 2
+#define GL2 3
+
+GLint stencil_bits, stencil_max;
+
+
+static bool
+have_ATI_separate_stencil(void)
+{
+   return piglit_is_extension_supported("GL_ATI_separate_stencil");
+}
+
+
+static bool
+have_EXT_stencil_two_side(void)
+{
+   return piglit_is_extension_supported("GL_EXT_stencil_two_side");
+}
+
+
+static bool
+have_GL2_stencil_two_side(void)
+{
+   return piglit_get_gl_version() >= 2.0;
+}


Those functions don't really serve much of a purpose.  Instead of 
calling have_ATI_separate_stencil() below, just call 
piglit_is_extension_supported("GL_ATI_separate_stencil") instead.  Same 
thing for the other two.





+
+
+static bool
+have_stencil_wrap(void)
+{
+   if (piglit_get_gl_version() >= 2.0) {
+   return true;
+   } else if (piglit_is_extension_supported("GL_EXT_stencil_wrap")) {
+   return true;
+   }
+   return false;
+}
+
+
+/* Draw four quads:
+ * Bottom row uses GL_CCW
+ * Top row uses GL_CW
+ * Left column is front-facing
+ * Right column is back-facing
+ * Check the values in the stencil buffer to see if they match
+ * the expected values.
+ */
+static bool
+render_test(GLuint expectedFront, GLuint expectedBack)
+{
+   GLint x0 = 0;
+   GLint x1 = window_size / 2;
+   GLint x2 = window_size;
+   GLint y0 = 0;
+   GLint y1 = window_size / 2;
+   GLint y2 = window_size;
+
+   glFrontFace(GL_CCW);   

Re: [Piglit] [PATCH 2/2] cl: Change data types of char/short buffers in integer limits tests

2015-09-17 Thread Jan Vesely
On Thu, 2015-09-17 at 10:34 -0500, Aaron Watry wrote:
> On Wed, Sep 16, 2015 at 7:33 PM, Jan Vesely 
> wrote:
> 
> > On Wed, 2015-09-16 at 17:18 -0500, Aaron Watry wrote:
> > > On Tue, Sep 15, 2015 at 9:42 AM, Jan Vesely <
> > > jan.ves...@rutgers.edu>
> > > wrote:
> > > 
> > > > 
> > > > 
> > > > On Tue, Sep 15, 2015 at 7:28 AM, Jan Vesely <
> > > > jan.ves...@rutgers.edu
> > > > > 
> > > > wrote:
> > > > 
> > > > > On Thu, 2015-09-10 at 10:12 -0500, Aaron Watry wrote:
> > > > > > The char/short return buffers were declared as ints.
> > > > > > 
> > > > > > Signed-off-by: Aaron Watry 
> > > > > 
> > > > > Reviewed-by: Jan Vesely 
> > > > > For both patches.
> > > > > 
> > > > > though, I agree with Serge that a spec reference would be
> > > > > nice.
> > > > > 
> > > > 
> > > > PS: don't we need to test this for *_MAX too? I'd expect at
> > > > least
> > > > char and
> > > > short to have the same problem.
> > > > 
> > > 
> > > 
> > > Yes, it seems that the _MAX values are also broken because the
> > > values
> > > are
> > > upgraded to ints by llvm.
> > 
> > I checked the c99 specs, section 6.4.4.1 says that the type decimal
> > constants without suffix is the first of int, long int, long long
> > int,
> > in which the value can be represented.
> > So I guess llvm is doing the right thing here.
> > 
> > 
> Yeah, I believe it...  It's just sad that the CL spec doesn't take
> into
> account that the main usage of [CHAR|SHORT]_[MIN|MAX] will be for
> comparisons that possibly include values of those types (or something
> smaller than an int).
> 
> I'm updating the patches to send the _MAX values for each type
> through a
> vector/scalar round trip.
> 
> While I'm at it, do we have any consensus on how the CHAR_BIT macro
> should
> be defined?  The value of CHAR_BIT is the number of bits in a byte,
> but I'm
> not really sure if it makes sense to cast it to char as well
> (probably
> doesn't hurt anything), or if we should leave it as an int.

I did a bit more digging, and it turns out that both c99 and OpenCL
require that "The values shall all be constant expressions suitable for
use in #if preprocessing directives." (section 5.2.4.2.1 and 6.12.3).
type casts don't work with preprocessor, so I think adding them is
against the specs.


Jan



> 
> 
> > Jan
> > 
> > > 
> > > 
> > > > 
> > > > > Jan
> > > > > 
> > > > > > ---
> > > > > >  tests/cl/program/execute/int-definitions.cl | 8 
> > > > > >  1 file changed, 4 insertions(+), 4 deletions(-)
> > > > > > 
> > > > > > diff --git a/tests/cl/program/execute/int-definitions.cl
> > > > > > b/tests/cl/program/execute/int-definitions.cl
> > > > > > index 3d8ee63..a438fe4 100644
> > > > > > --- a/tests/cl/program/execute/int-definitions.cl
> > > > > > +++ b/tests/cl/program/execute/int-definitions.cl
> > > > > > @@ -12,12 +12,12 @@ global_size: 1 0 0
> > > > > >  [test]
> > > > > >  name: Char Definitions
> > > > > >  kernel_name: test_char
> > > > > > -arg_out: 0 buffer int[6] 8 127 -128 127 -128 255
> > > > > > +arg_out: 0 buffer char[6] 8 127 -128 127 -128 255
> > > > > > 
> > > > > >  [test]
> > > > > >  name: Short Definitions
> > > > > >  kernel_name: test_short
> > > > > > -arg_out: 0 buffer int[3] 32767 -32768 65535
> > > > > > +arg_out: 0 buffer short[3] 32767 -32768 65535
> > > > > > 
> > > > > >  [test]
> > > > > >  name: Int Definitions
> > > > > > @@ -32,7 +32,7 @@ arg_out: 0 buffer long[3]
> > > > > > 9223372036854775807
> > > > > > \
> > > > > >18446744073709551615
> > > > > >  !*/
> > > > > > 
> > > > > > -kernel void test_char(global int* out) {
> > > > > > +kernel void test_char(global char* out) {
> > > > > >int i = 0;
> > > > > >out[i++] = CHAR_BIT;
> > > > > >out[i++] = CHAR_MAX;
> > > > > > @@ -42,7 +42,7 @@ kernel void test_char(global int* out) {
> > > > > >out[i++] = UCHAR_MAX;
> > > > > >  }
> > > > > > 
> > > > > > -kernel void test_short(global int* out) {
> > > > > > +kernel void test_short(global short* out) {
> > > > > >int i = 0;
> > > > > >out[i++] = SHRT_MAX;
> > > > > >out[i++] = (SHRT_MIN - (short2)(0)).s0;
> > > > > 
> > > > 
> > > > 
> > 


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


Re: [Piglit] [PATCH v9] Port basic GL rendering test from Glean to Piglit

2015-09-17 Thread Juliet Fru
Thanks.

On Fri, Sep 18, 2015 at 12:23 AM, Brian Paul  wrote:

> On 09/17/2015 04:22 PM, Juliet Fru wrote:
>
>> This test replaces the original glean tpaths.cpp test.
>> ---
>>   tests/all.py|   1 +
>>   tests/spec/gl-1.0/CMakeLists.gl.txt |   1 +
>>   tests/spec/gl-1.0/no-op-paths.c | 308
>> 
>>   3 files changed, 310 insertions(+)
>>   create mode 100644 tests/spec/gl-1.0/no-op-paths.c
>>
>> diff --git a/tests/all.py b/tests/all.py
>> index fcfc5cd..85973d6 100644
>> --- a/tests/all.py
>> +++ b/tests/all.py
>> @@ -1000,6 +1000,7 @@ with profile.group_manager(
>>   g(['gl-1.0-ortho-pos'])
>>   g(['gl-1.0-readpixsanity'])
>>   g(['gl-1.0-logicop'])
>> +g(['gl-1.0-no-op-paths'])
>>
>>   with profile.group_manager(
>>   PiglitGLTest,
>> diff --git a/tests/spec/gl-1.0/CMakeLists.gl.txt
>> b/tests/spec/gl-1.0/CMakeLists.gl.txt
>> index d04b835..7a7f508 100644
>> --- a/tests/spec/gl-1.0/CMakeLists.gl.txt
>> +++ b/tests/spec/gl-1.0/CMakeLists.gl.txt
>> @@ -22,6 +22,7 @@ piglit_add_executable (gl-1.0-front-invalidate-back
>> front-invalidate-back.c)
>>   piglit_add_executable (gl-1.0-logicop logicop.c)
>>   piglit_add_executable (gl-1.0-long-dlist long-dlist.c)
>>   piglit_add_executable (gl-1.0-ortho-pos orthpos.c)
>> +piglit_add_executable (gl-1.0-no-op-paths no-op-paths.c)
>>   piglit_add_executable (gl-1.0-polygon-line-aa polygon-line-aa.c)
>>   piglit_add_executable (gl-1.0-push-no-attribs push-no-attribs.c)
>>   piglit_add_executable (gl-1.0-readpixsanity readpix.c)
>> diff --git a/tests/spec/gl-1.0/no-op-paths.c
>> b/tests/spec/gl-1.0/no-op-paths.c
>> new file mode 100644
>> index 000..35f8c84
>> --- /dev/null
>> +++ b/tests/spec/gl-1.0/no-op-paths.c
>> @@ -0,0 +1,308 @@
>> +/*  BEGIN_COPYRIGHT -*- glean -*-
>> + *
>> + *  Copyright (C) 1999  Allen Akin   All Rights Reserved.
>> + *  Copyright (C) 2015  Intel Corporation.
>> + *
>> + * Permission is hereby granted, free of charge, to any person obtaining
>> a
>> + * copy of this software and associated documentation files (the
>> "Software"),
>> + * to deal in the Software without restriction, including without
>> limitation
>> + * the rights to use, copy, modify, merge, publish, distribute,
>> sublicense,
>> + * and/or sell copies of the Software, and to permit persons to whom the
>> + * Software is furnished to do so, subject to the following conditions:
>> + *
>> + * The above copyright notice and this permission notice (including the
>> next
>> + * paragraph) shall be included in all copies or substantial portions of
>> the
>> + * Software.
>> + *
>> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
>> EXPRESS OR
>> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
>> MERCHANTABILITY,
>> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT
>> SHALL
>> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
>> OTHER
>> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
>> ARISING
>> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
>> + * DEALINGS IN THE SOFTWARE.
>> + *
>> + *  END_COPYRIGHT
>> + */
>> +/** @file paths.c
>> + *
>> + *  Test basic GL rendering paths.
>> + *
>> + *
>> + * Based on the original Glean tpaths.cpp test, this test verifies
>> + * that basic, trival OpenGL paths work as expected. For example,
>> + * glAlphaFunc(GL_GEQUAL, 0.0) should always pass and
>> + * glAlphaFunc(GL_LESS, 0.0) should always fail.  We setup trivial
>> + * pass and fail conditions for each of alpha test, blending, color
>> mask,
>> + * depth test, logic ops, scissor, stencil, stipple, and texture and
>> + * make sure they work as expected.  We also setup trival-pass for
>> all
>> + * these paths simultaneously and test that as well.
>> + *
>> + * To test for pass/fail we examine the color buffer for white or
>> black,
>> + * respectively.
>> + *
>> + * Authors:
>> + * Brian Paul 
>> + * Adapted to Piglit by Juliet Fru , August
>> 2015.
>> + */
>> +
>> +#include "piglit-util-gl.h"
>> +
>> +PIGLIT_GL_TEST_CONFIG_BEGIN config.supports_gl_compat_version = 10;
>> +
>> +config.window_visual = PIGLIT_GL_VISUAL_RGBA |
>> +   PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_DEPTH |
>> +   PIGLIT_GL_VISUAL_STENCIL;
>> +
>> +PIGLIT_GL_TEST_CONFIG_END enum path
>> +{
>> +   ALPHA,
>> +   BLEND,
>> +   COLOR_MASK,
>> +   DEPTH,
>> +   LOGIC,
>> +   SCISSOR,
>> +   STENCIL,
>> +   STIPPLE,
>> +   TEXTURE,
>> +   NUM_PATHS   /* end-of-list token */
>> +};
>> +
>> +enum state
>> +{
>> +   DISABLE,
>> +   ALWAYS_PASS,
>> +   ALWAYS_FAIL
>> +};
>> +
>> +const char *
>> +path_name(enum path paths)
>> +{
>> +   switch (paths) {
>> +   case ALPHA:
>> +   return "Alpha Test";
>> +   case 

[Piglit] [PATCH v7] Port arb occlusion query conformance tests from Glean to Piglit

2015-09-17 Thread Juliet Fru
This test replaces the original glean toccluqry.cpp test.
---
 tests/all.py   |   1 +
 tests/spec/arb_occlusion_query/CMakeLists.gl.txt   |   1 +
 .../arb_occlusion_query/occlusion_query_conform.c  | 556 +
 3 files changed, 558 insertions(+)
 create mode 100644 tests/spec/arb_occlusion_query/occlusion_query_conform.c

diff --git a/tests/all.py b/tests/all.py
index fe088f5..748165f 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -2115,6 +2115,7 @@ with profile.group_manager(
 PiglitGLTest,
 grouptools.join('spec', 'ARB_occlusion_query')) as g:
 g(['occlusion_query'])
+g(['occlusion_query_conformance'])
 g(['occlusion_query_lifetime'])
 g(['occlusion_query_meta_fragments'])
 g(['occlusion_query_meta_no_fragments'])
diff --git a/tests/spec/arb_occlusion_query/CMakeLists.gl.txt 
b/tests/spec/arb_occlusion_query/CMakeLists.gl.txt
index 01a499d..025c2cd 100644
--- a/tests/spec/arb_occlusion_query/CMakeLists.gl.txt
+++ b/tests/spec/arb_occlusion_query/CMakeLists.gl.txt
@@ -10,6 +10,7 @@ link_libraries (
 )
 
 piglit_add_executable (occlusion_query occlusion_query.c)
+piglit_add_executable (occlusion_query_conform occlusion_query_conform.c)
 piglit_add_executable (occlusion_query_lifetime occlusion_query_lifetime.c)
 piglit_add_executable (occlusion_query_meta_no_fragments 
occlusion_query_meta_no_fragments.c)
 piglit_add_executable (occlusion_query_meta_fragments 
occlusion_query_meta_fragments.c)
diff --git a/tests/spec/arb_occlusion_query/occlusion_query_conform.c 
b/tests/spec/arb_occlusion_query/occlusion_query_conform.c
new file mode 100644
index 000..917f6f1
--- /dev/null
+++ b/tests/spec/arb_occlusion_query/occlusion_query_conform.c
@@ -0,0 +1,556 @@
+/*  BEGIN_COPYRIGHT -*- glean -*-
+ *
+ *  Copyright (C) 1999  Allen Akin   All Rights Reserved.
+ *  Copyright (C) 2015  Intel Corporation.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * END_COPYRIGHT
+ */
+
+/** @file occlusion_query_conform.c
+ *
+ * Conformance test on ARB_occlusion_query extension.
+ *
+ * Authors:
+ * Wei Wang 
+ * Adapted to Piglit by Juliet Fru , September 2015
+ */
+
+#include "piglit-util-gl.h"
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+PIGLIT_GL_TEST_CONFIG_BEGIN config.supports_gl_compat_version = 10;
+
+config.window_visual =
+   PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE |
+   PIGLIT_GL_VISUAL_DEPTH;
+
+PIGLIT_GL_TEST_CONFIG_END static GLuint
+find_unused_id(void)
+{
+   GLuint id;
+   glGenQueries(1, );
+   return id;
+
+}
+
+/* If multiple queries are issued on the same target and id prior to calling
+ * GetQueryObject[u]iVARB, the result returned will always be from the last
+ * query issued.  The results from any queries before the last one will be lost
+ * if the results are not retrieved before starting a new query on the same
+ * target and id.
+ */
+static bool
+conformOQ_GetObjivAval_multi1(GLuint id)
+{
+   GLint ready;
+   GLuint passed = 0;
+
+   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+   glMatrixMode(GL_PROJECTION);
+   glPushMatrix();
+   glLoadIdentity();
+   glOrtho(-1.0, 1.0, -1.0, 1.0, 0.0, 25.0);
+
+   glMatrixMode(GL_MODELVIEW);
+   glPushMatrix();
+   glLoadIdentity();
+   glTranslatef(0.0, 0.0, -10.0);
+
+   /* draw the occluder (red) */
+   glColorMask(1, 1, 1, 1);
+   glDepthMask(GL_TRUE);
+   glColor3f(1, 0, 0);
+   piglit_draw_rect(-0.5, 0.5, 0.5, -0.5);
+
+   glPushMatrix();
+   glTranslatef(0.0, 0.0, -5.0);
+   glColorMask(0, 0, 0, 0);
+   glDepthMask(GL_FALSE);
+
+   /* draw the 1st box (green) which is occluded by the occluder partly */
+   glBeginQueryARB(GL_SAMPLES_PASSED_ARB, id);
+   glColor3f(0, 1, 0);
+   

[Piglit] [PATCH v1] Porting the two sided stencil extension tests from Glean to Piglit.

2015-09-17 Thread Juliet Fru
This test replaces the original glean tstencil2.cpp test.
---
 tests/spec/arb_texture_stencil8/CMakeLists.gl.txt  |   1 +
 .../spec/arb_texture_stencil8/stencil-extension.c  | 765 +
 2 files changed, 766 insertions(+)
 create mode 100644 tests/spec/arb_texture_stencil8/stencil-extension.c

diff --git a/tests/spec/arb_texture_stencil8/CMakeLists.gl.txt 
b/tests/spec/arb_texture_stencil8/CMakeLists.gl.txt
index a8d1693..9687f6a 100644
--- a/tests/spec/arb_texture_stencil8/CMakeLists.gl.txt
+++ b/tests/spec/arb_texture_stencil8/CMakeLists.gl.txt
@@ -13,5 +13,6 @@ piglit_add_executable (arb_texture_stencil8-stencil-texture 
stencil-texture.c)
 piglit_add_executable (arb_texture_stencil8-draw draw.c)
 piglit_add_executable (arb_texture_stencil8-fbo-stencil8 fbo-stencil8.c)
 piglit_add_executable (arb_texture_stencil8-getteximage getteximage.c)
+piglit_add_executable (arb_texture_stencil8-stencil-extension 
stencil-extension.c)
 
 # vim: ft=cmake:
diff --git a/tests/spec/arb_texture_stencil8/stencil-extension.c 
b/tests/spec/arb_texture_stencil8/stencil-extension.c
new file mode 100644
index 000..4872fe0
--- /dev/null
+++ b/tests/spec/arb_texture_stencil8/stencil-extension.c
@@ -0,0 +1,765 @@
+/*
+ * BEGIN_COPYRIGHT -*- glean -*-
+ *
+ * Copyright (C) 1999  Allen Akin   All Rights Reserved.
+ * Copyright (C) 2009  VMware, Inc.  All Rights Reserved.
+ * Copyright (C) 2015  Intel Corporation  All Rights Reserved.
+ *
+ * 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.
+ *
+ * END_COPYRIGHT
+ */
+
+/** @file stencil-extension.c
+ *
+ *  Test two-sided stencil extensions
+ *
+ * This test could be better:
+ * 1. Generate random state vectors, render and compare to expected values
+ * 2. Exercise separate front/back reference values and masks for the
+ * EXT and GL2 variations.WriteMask
+ *
+ * Note: Must check writeMask of set_stencil_state to make sure it's 
correct
+ *
+ * Authors:
+ * Brian Paul 
+ * Adapted to Piglit by Juliet Fru , 
September 2015.
+ */
+
+#include "piglit-util-gl.h"
+
+#include 
+#include 
+
+#define window_size 100
+
+/*  two-sided methods. */
+#define ATI 1
+#define EXT 2
+#define GL2 3
+
+GLint stencil_bits, stencil_max;
+
+
+static bool
+have_ATI_separate_stencil(void)
+{
+   return piglit_is_extension_supported("GL_ATI_separate_stencil");
+}
+
+
+static bool
+have_EXT_stencil_two_side(void)
+{
+   return piglit_is_extension_supported("GL_EXT_stencil_two_side");
+}
+
+
+static bool
+have_GL2_stencil_two_side(void)
+{
+   return piglit_get_gl_version() >= 2.0;
+}
+
+
+static bool
+have_stencil_wrap(void)
+{
+   if (piglit_get_gl_version() >= 2.0) {
+   return true;
+   } else if (piglit_is_extension_supported("GL_EXT_stencil_wrap")) {
+   return true;
+   }
+   return false;
+}
+
+
+/* Draw four quads:
+ * Bottom row uses GL_CCW
+ * Top row uses GL_CW
+ * Left column is front-facing
+ * Right column is back-facing
+ * Check the values in the stencil buffer to see if they match
+ * the expected values.
+ */
+static bool
+render_test(GLuint expectedFront, GLuint expectedBack)
+{
+   GLint x0 = 0;
+   GLint x1 = window_size / 2;
+   GLint x2 = window_size;
+   GLint y0 = 0;
+   GLint y1 = window_size / 2;
+   GLint y2 = window_size;
+
+   glFrontFace(GL_CCW);/* this the GL default */
+
+   /* lower left quad = front-facing */
+   glBegin(GL_TRIANGLE_FAN);
+   glVertex2f(x0, y0);
+   glVertex2f(x1, y0);
+   glVertex2f(x1, y1);
+   glVertex2f(x0, y1);
+   glEnd();
+
+   /* lower right quad = back-facing */
+   glBegin(GL_TRIANGLE_FAN);
+   glVertex2f(x1, y0);
+   glVertex2f(x1, y1);
+   glVertex2f(x2, y1);
+   glVertex2f(x2, y0);
+   glEnd();
+
+   glFrontFace(GL_CW);
+
+   /* upper 

Re: [Piglit] [PATCH v9] Port basic GL rendering test from Glean to Piglit

2015-09-17 Thread Brian Paul

On 09/17/2015 04:22 PM, Juliet Fru wrote:

This test replaces the original glean tpaths.cpp test.
---
  tests/all.py|   1 +
  tests/spec/gl-1.0/CMakeLists.gl.txt |   1 +
  tests/spec/gl-1.0/no-op-paths.c | 308 
  3 files changed, 310 insertions(+)
  create mode 100644 tests/spec/gl-1.0/no-op-paths.c

diff --git a/tests/all.py b/tests/all.py
index fcfc5cd..85973d6 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -1000,6 +1000,7 @@ with profile.group_manager(
  g(['gl-1.0-ortho-pos'])
  g(['gl-1.0-readpixsanity'])
  g(['gl-1.0-logicop'])
+g(['gl-1.0-no-op-paths'])

  with profile.group_manager(
  PiglitGLTest,
diff --git a/tests/spec/gl-1.0/CMakeLists.gl.txt 
b/tests/spec/gl-1.0/CMakeLists.gl.txt
index d04b835..7a7f508 100644
--- a/tests/spec/gl-1.0/CMakeLists.gl.txt
+++ b/tests/spec/gl-1.0/CMakeLists.gl.txt
@@ -22,6 +22,7 @@ piglit_add_executable (gl-1.0-front-invalidate-back 
front-invalidate-back.c)
  piglit_add_executable (gl-1.0-logicop logicop.c)
  piglit_add_executable (gl-1.0-long-dlist long-dlist.c)
  piglit_add_executable (gl-1.0-ortho-pos orthpos.c)
+piglit_add_executable (gl-1.0-no-op-paths no-op-paths.c)
  piglit_add_executable (gl-1.0-polygon-line-aa polygon-line-aa.c)
  piglit_add_executable (gl-1.0-push-no-attribs push-no-attribs.c)
  piglit_add_executable (gl-1.0-readpixsanity readpix.c)
diff --git a/tests/spec/gl-1.0/no-op-paths.c b/tests/spec/gl-1.0/no-op-paths.c
new file mode 100644
index 000..35f8c84
--- /dev/null
+++ b/tests/spec/gl-1.0/no-op-paths.c
@@ -0,0 +1,308 @@
+/*  BEGIN_COPYRIGHT -*- glean -*-
+ *
+ *  Copyright (C) 1999  Allen Akin   All Rights Reserved.
+ *  Copyright (C) 2015  Intel Corporation.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ *  END_COPYRIGHT
+ */
+/** @file paths.c
+ *
+ *  Test basic GL rendering paths.
+ *
+ *
+ * Based on the original Glean tpaths.cpp test, this test verifies
+ * that basic, trival OpenGL paths work as expected. For example,
+ * glAlphaFunc(GL_GEQUAL, 0.0) should always pass and
+ * glAlphaFunc(GL_LESS, 0.0) should always fail.  We setup trivial
+ * pass and fail conditions for each of alpha test, blending, color mask,
+ * depth test, logic ops, scissor, stencil, stipple, and texture and
+ * make sure they work as expected.  We also setup trival-pass for all
+ * these paths simultaneously and test that as well.
+ *
+ * To test for pass/fail we examine the color buffer for white or black,
+ * respectively.
+ *
+ * Authors:
+ * Brian Paul 
+ * Adapted to Piglit by Juliet Fru , August 2015.
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN config.supports_gl_compat_version = 10;
+
+config.window_visual = PIGLIT_GL_VISUAL_RGBA |
+   PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_DEPTH |
+   PIGLIT_GL_VISUAL_STENCIL;
+
+PIGLIT_GL_TEST_CONFIG_END enum path
+{
+   ALPHA,
+   BLEND,
+   COLOR_MASK,
+   DEPTH,
+   LOGIC,
+   SCISSOR,
+   STENCIL,
+   STIPPLE,
+   TEXTURE,
+   NUM_PATHS   /* end-of-list token */
+};
+
+enum state
+{
+   DISABLE,
+   ALWAYS_PASS,
+   ALWAYS_FAIL
+};
+
+const char *
+path_name(enum path paths)
+{
+   switch (paths) {
+   case ALPHA:
+   return "Alpha Test";
+   case BLEND:
+   return "Blending";
+   case COLOR_MASK:
+   return "Color Mask";
+   case DEPTH:
+   return "Depth Test";
+   case LOGIC:
+   return "LogicOp";
+   case SCISSOR:
+   return "Scissor Test";
+   case STENCIL:
+   return "Stencil Test";
+   case STIPPLE:
+   return "Polygon Stipple";
+   case TEXTURE:
+   return "Modulated Texture";
+   case NUM_PATHS:
+ 

Re: [Piglit] [PATCH v6] Port arb occlusion query conformance tests from Glean to Piglit

2015-09-17 Thread Brian Paul

On 09/17/2015 04:08 PM, Juliet Fru wrote:

This test replaces the original glean toccluqry.cpp test.
---
  tests/all.py   |   1 +
  tests/spec/arb_occlusion_query/CMakeLists.gl.txt   |   1 +
  .../arb_occlusion_query/occlusion_query_conform.c  | 558 +
  3 files changed, 560 insertions(+)
  create mode 100644 tests/spec/arb_occlusion_query/occlusion_query_conform.c

diff --git a/tests/all.py b/tests/all.py
index fe088f5..748165f 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -2115,6 +2115,7 @@ with profile.group_manager(
  PiglitGLTest,
  grouptools.join('spec', 'ARB_occlusion_query')) as g:
  g(['occlusion_query'])
+g(['occlusion_query_conformance'])
  g(['occlusion_query_lifetime'])
  g(['occlusion_query_meta_fragments'])
  g(['occlusion_query_meta_no_fragments'])
diff --git a/tests/spec/arb_occlusion_query/CMakeLists.gl.txt 
b/tests/spec/arb_occlusion_query/CMakeLists.gl.txt
index 01a499d..025c2cd 100644
--- a/tests/spec/arb_occlusion_query/CMakeLists.gl.txt
+++ b/tests/spec/arb_occlusion_query/CMakeLists.gl.txt
@@ -10,6 +10,7 @@ link_libraries (
  )

  piglit_add_executable (occlusion_query occlusion_query.c)
+piglit_add_executable (occlusion_query_conform occlusion_query_conform.c)
  piglit_add_executable (occlusion_query_lifetime occlusion_query_lifetime.c)
  piglit_add_executable (occlusion_query_meta_no_fragments 
occlusion_query_meta_no_fragments.c)
  piglit_add_executable (occlusion_query_meta_fragments 
occlusion_query_meta_fragments.c)
diff --git a/tests/spec/arb_occlusion_query/occlusion_query_conform.c 
b/tests/spec/arb_occlusion_query/occlusion_query_conform.c
new file mode 100644
index 000..76cb311
--- /dev/null
+++ b/tests/spec/arb_occlusion_query/occlusion_query_conform.c
@@ -0,0 +1,558 @@
+/*  BEGIN_COPYRIGHT -*- glean -*-
+ *
+ *  Copyright (C) 1999  Allen Akin   All Rights Reserved.
+ *  Copyright (C) 2015  Intel Corporation.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * END_COPYRIGHT
+ */
+
+/** @file occlusion_query_conform.c
+ *
+ * Conformance test on ARB_occlusion_query extension.
+ *
+ * Authors:
+ * Wei Wang 
+ * Adapted to Piglit by Juliet Fru , September 2015
+ */
+
+#include "piglit-util-gl.h"
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+PIGLIT_GL_TEST_CONFIG_BEGIN config.supports_gl_compat_version = 10;
+
+config.window_visual =
+   PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE |
+   PIGLIT_GL_VISUAL_DEPTH;
+
+PIGLIT_GL_TEST_CONFIG_END static GLuint
+find_unused_id(void)
+{
+   GLuint id;
+   glGenQueries(1, );
+   return id;
+
+}
+
+/* If multiple queries are issued on the same target and id prior to calling
+ * GetQueryObject[u]iVARB, the result returned will always be from the last
+ * query issued.  The results from any queries before the last one will be lost
+ * if the results are not retrieved before starting a new query on the same
+ * target and id.
+ */
+static bool
+conformOQ_GetObjivAval_multi1(GLuint id)
+{
+   GLint ready;
+   GLuint passed = 0;
+
+   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+   glMatrixMode(GL_PROJECTION);
+   glPushMatrix();
+   glLoadIdentity();
+   glOrtho(-1.0, 1.0, -1.0, 1.0, 0.0, 25.0);
+
+   glMatrixMode(GL_MODELVIEW);
+   glPushMatrix();
+   glLoadIdentity();
+   glTranslatef(0.0, 0.0, -10.0);
+
+   /* draw the occluder (red) */
+   glColorMask(1, 1, 1, 1);
+   glDepthMask(GL_TRUE);
+   glColor3f(1, 0, 0);
+   piglit_draw_rect(-0.5, 0.5, 0.5, -0.5);
+
+   glPushMatrix();
+   glTranslatef(0.0, 0.0, -5.0);
+   glColorMask(0, 0, 0, 0);
+   glDepthMask(GL_FALSE);
+
+   /* draw the 1st box (green) which is occluded by the occluder partly */
+