[Piglit] [PATCH] fbo-drawbuffers-maxtargets: use different colors for different buffers

2013-11-07 Thread Brian Paul
Before, the test always drew green rects for all the target buffers.
Now we draw a different color into each buffer to be more thorough.

Plus, replace 16 with MAX_TARGETS, add some comments, etc.

Note: the test now fails with Mesa's swrast because swrast errantly
writes the same color to all render targets.
---
 tests/fbo/fbo-drawbuffers-maxtargets.c |   63 ++--
 1 file changed, 51 insertions(+), 12 deletions(-)

diff --git a/tests/fbo/fbo-drawbuffers-maxtargets.c 
b/tests/fbo/fbo-drawbuffers-maxtargets.c
index c7a8f7d..1efe819 100644
--- a/tests/fbo/fbo-drawbuffers-maxtargets.c
+++ b/tests/fbo/fbo-drawbuffers-maxtargets.c
@@ -44,6 +44,8 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
 
 PIGLIT_GL_TEST_CONFIG_END
 
+#define MAX_TARGETS 16
+
 static GLint max_targets;
 
 static char *vs_source =
@@ -53,13 +55,37 @@ static char *vs_source =
}\n;
 
 static char *fs_source =
+   uniform vec4 colors[16]; \n
void main()\n
{\n
   for (int i = 0; i  %d; i++) {\n
-  gl_FragData[i] = vec4(0.0, 1.0, 0.0, 0.0);\n
+  gl_FragData[i] = colors[i];\n
   }\n
}\n;
 
+static const float colors[][4] = {
+   { 1.0, 0.0, 0.0, 0.0 },  /* red */
+   { 0.0, 1.0, 0.0, 0.0 },  /* green */
+   { 0.0, 0.0, 1.0, 0.0 },  /* blue */
+   { 0.0, 1.0, 1.0, 0.0 },  /* cyan */
+
+   { 1.0, 0.0, 1.0, 0.0 },  /* purple */
+   { 1.0, 1.0, 0.0, 0.0 },  /* green */
+   { 0.5, 0.0, 0.0, 0.0 },  /* half red */
+   { 0.0, 0.5, 0.0, 0.0 },  /* half green */
+
+   { 0.0, 0.0, 0.5, 0.0 },  /* half blue */
+   { 0.0, 0.5, 0.5, 0.0 },  /* half cyan */
+   { 0.5, 0.0, 0.5, 0.0 },  /* half purple */
+   { 0.5, 0.5, 0.0, 0.0 },  /* half green */
+
+   { 1.0, 1.0, 1.0, 0.0 },/* white */
+   { 0.75, 0.75, 0.75, 0.0 }, /* 75% gray */
+   { 0.5, 0.5, 0.5, 0.0 },/* 50% gray */
+   { 0.25, 0.25, 0.25, 0.0 }  /* 25% gray */
+};
+
+
 static GLuint
 attach_texture(int i)
 {
@@ -87,10 +113,11 @@ attach_texture(int i)
 static void
 generate_and_display_drawbuffers(int count)
 {
-   GLuint tex[16], fb, fs, vs, prog;
-   GLenum attachments[16], status;
+   GLuint tex[MAX_TARGETS], fb, fs, vs, prog;
+   GLenum attachments[MAX_TARGETS], status;
char *fs_count_source;
int i;
+   int colors_uniform;
 
glGenFramebuffersEXT(1, fb);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
@@ -112,7 +139,7 @@ generate_and_display_drawbuffers(int count)
glClearColor(1.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
 
-   /* Build the shader that spams green to all outputs. */
+   /* Build the shader that writes different color to each buffer. */
vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_source);
 
fs_count_source = malloc(strlen(fs_source) + 5);
@@ -126,6 +153,9 @@ generate_and_display_drawbuffers(int count)
if (!piglit_check_gl_error(GL_NO_ERROR))
piglit_report_result(PIGLIT_FAIL);
 
+   colors_uniform = glGetUniformLocation(prog, colors);
+   glUniform4fv(colors_uniform, MAX_TARGETS, (GLfloat *) colors);
+
/* Now render to all the color buffers. */
piglit_draw_rect(-1, -1, 2, 2);
 
@@ -135,6 +165,7 @@ generate_and_display_drawbuffers(int count)
piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glEnable(GL_TEXTURE_2D);
+   /* draw row of boxes, each with the color from texture/target[i] */
for (i = 0; i  count; i++) {
glBindTexture(GL_TEXTURE_2D, tex[i]);
piglit_draw_rect_tex(16 * i, 16 * (count - 1),
@@ -154,22 +185,24 @@ enum piglit_result
 piglit_display(void)
 {
GLboolean pass = GL_TRUE;
-   float green[] = {0, 1, 0, 0};
int count, i;
 
glClearColor(0.5, 0.5, 0.5, 0.5);
glClear(GL_COLOR_BUFFER_BIT);
 
+   
for (count = 1; count = max_targets; count++) {
generate_and_display_drawbuffers(count);
}
 
+   /* walk over rows */
for (count = 1; count = max_targets; count++) {
+   /* walk over columns */
for (i = 0; i  count; i++) {
pass = pass 
piglit_probe_pixel_rgb(16 * i + 8,
   16 * (count - 1) + 8,
-  green);
+  colors[i]);
}
}
 
@@ -183,9 +216,10 @@ piglit_init(int argc, char **argv)
 {
GLint max_attachments;
 
-   printf(The result should be increasing lengths of rows of green\n
-  boxes as the test increases the number of drawbuffers \n
-  targets used.\n);
+   assert(ARRAY_SIZE(colors) == MAX_TARGETS);
+
+   printf(Each row tests 

Re: [Piglit] [PATCH 2/4] ARB_viewport_array: Validity test for depth range index/first/count params

2013-11-07 Thread Brian Paul

Just some formatting issues on this one and the same for patch 3/4.

On 11/01/2013 04:51 PM, Jon Ashburn wrote:

Tests GL_ARB_viewport_array  validity for indices. Use both valid and
invalid parameters (index, first, count) for all these new API entry points:
  glDepthRangeArrayv, glDepthRangeIndexed, glGetDoublei_v.

Tested on Nvidia Quadro 600 all tests pass.

Signed-off-by: Jon Ashburn j...@lunarg.com
---
  tests/all.tests|   1 +
  tests/spec/arb_viewport_array/CMakeLists.gl.txt|   1 +
  .../spec/arb_viewport_array/depth_range_indices.c  | 151 +
  3 files changed, 153 insertions(+)
  create mode 100644 tests/spec/arb_viewport_array/depth_range_indices.c

diff --git a/tests/all.tests b/tests/all.tests
index ea92448..de7a8bc 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1743,6 +1743,7 @@ add_plain_test(arb_vertex_program, 'vp-max-array')
  arb_viewport_array = Group()
  spec['ARB_viewport_array'] = arb_viewport_array
  arb_viewport_array['viewport-indices'] = 
concurrent_test('arb_viewport_array-viewport-indices')
+arb_viewport_array['depthrange-indices'] = 
concurrent_test('arb_viewport_array-depthrange-indices')

  nv_vertex_program = Group()
  spec['NV_vertex_program'] = nv_vertex_program
diff --git a/tests/spec/arb_viewport_array/CMakeLists.gl.txt 
b/tests/spec/arb_viewport_array/CMakeLists.gl.txt
index 56ec330..1a443a5 100644
--- a/tests/spec/arb_viewport_array/CMakeLists.gl.txt
+++ b/tests/spec/arb_viewport_array/CMakeLists.gl.txt
@@ -10,5 +10,6 @@ link_libraries(
)

  piglit_add_executable(arb_viewport_array-viewport-indices viewport_indices.c)
+piglit_add_executable(arb_viewport_array-depthrange-indices 
depth_range_indices.c)

  # vim: ft=cmake:
diff --git a/tests/spec/arb_viewport_array/depth_range_indices.c 
b/tests/spec/arb_viewport_array/depth_range_indices.c
new file mode 100644
index 000..fe2eb79
--- /dev/null
+++ b/tests/spec/arb_viewport_array/depth_range_indices.c
@@ -0,0 +1,151 @@
+/*
+ * Copyright © 2013 LunarG, 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.
+ *
+ * Author: Jon Ashburn j...@lunarg.com
+ */
+
+/**
+ * Tests GL_ARB_viewport_array  validity for indices.
+ * Use both valid and invalid parameters (index, first, count)
+ * for all these new API entry points:
+ * glDepthRangeArrayv, glDepthRangeIndexed, glGetDoublei_v
+ *
+ */
+
+#include piglit-util-gl-common.h
+#include stdarg.h
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 32;
+   config.supports_gl_core_version = 32;
+
+   config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+/**
+ * Test that DepthRangeArrayv, DepthRangeIndexed, GetDoublei_v give the
+ * expected_error gl error.  Given the values for first and count
+ * or index in range [first, first+count).
+ */
+static bool
+check_dr_index(GLuint first, GLsizei count, GLenum expected_error)
+{
+   static const GLclampd dv[] = {0.213, 1.0};
+   GLclampd *mv, dvGet[2];
+   unsigned int i;
+   bool pass = true;
+   const unsigned int numIterate = (expected_error == GL_NO_ERROR) ? count 
: 1;
+
+   mv = malloc(sizeof(GLclampd) * 2 * count);
+   if (mv == NULL)
+   return false;
+   for (i =0; i  count; i++) {


i = 0


+   mv[i * 2] = dv[0];
+   mv[i * 2 + 1] = dv[1];
+   }
+   glDepthRangeArrayv(first, count, mv);
+   free( mv);


free(mv);



+   pass = piglit_check_gl_error(expected_error)  pass;
+
+   /* only iterate multiple indices for no error case */
+   for (i = count; i  count - numIterate; i--) {
+   glDepthRangeIndexed(first + i - 1, dv[0], dv[1]);
+   pass = piglit_check_gl_error(expected_error)  pass;
+   glGetDoublei_v(GL_DEPTH_RANGE, first + i - 1, dvGet);
+   pass = 

Re: [Piglit] [PATCH 4/4] ARB_viewport_array: Test validity of bounds for viewport, depthRange, scissor

2013-11-07 Thread Brian Paul

Minor formatting nits at the end.


On 11/01/2013 04:51 PM, Jon Ashburn wrote:

Tests for the validity  of Viewport bounds, Depth Range bounds  and
Scissor Box bounds  with viewport arrays (0 to GL_MAX_VIEWPORTS-1).
Bounds refer to the bounding rectangle or range (eg x, y, width, height).

Tested with Nvidia Quadro 600.  All tests pass except  Scissor Box  with a
negative height fails to return a gl error.

Reviewed-by: Brian Paul bri...@vmware.com
Signed-off-by: Jon Ashburn j...@lunarg.com
---
  tests/all.tests |   1 +
  tests/spec/arb_viewport_array/CMakeLists.gl.txt |   1 +
  tests/spec/arb_viewport_array/bounds.c  | 270 
  3 files changed, 272 insertions(+)
  create mode 100644 tests/spec/arb_viewport_array/bounds.c

diff --git a/tests/all.tests b/tests/all.tests
index 78e1563..c40447c 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1745,6 +1745,7 @@ spec['ARB_viewport_array'] = arb_viewport_array
  arb_viewport_array['viewport-indices'] = 
concurrent_test('arb_viewport_array-viewport-indices')
  arb_viewport_array['depthrange-indices'] = 
concurrent_test('arb_viewport_array-depthrange-indices')
  arb_viewport_array['scissor-indices'] = 
concurrent_test('arb_viewport_array-scissor-indices')
+arb_viewport_array['bounds'] = concurrent_test('arb_viewport_array-bounds')

  nv_vertex_program = Group()
  spec['NV_vertex_program'] = nv_vertex_program
diff --git a/tests/spec/arb_viewport_array/CMakeLists.gl.txt 
b/tests/spec/arb_viewport_array/CMakeLists.gl.txt
index 35df5ea..e508102 100644
--- a/tests/spec/arb_viewport_array/CMakeLists.gl.txt
+++ b/tests/spec/arb_viewport_array/CMakeLists.gl.txt
@@ -12,5 +12,6 @@ link_libraries(
  piglit_add_executable(arb_viewport_array-viewport-indices viewport_indices.c)
  piglit_add_executable(arb_viewport_array-depthrange-indices 
depth_range_indices.c)
  piglit_add_executable(arb_viewport_array-scissor-indices scissor_indices.c)
+piglit_add_executable(arb_viewport_array-bounds bounds.c)

  # vim: ft=cmake:
diff --git a/tests/spec/arb_viewport_array/bounds.c 
b/tests/spec/arb_viewport_array/bounds.c
new file mode 100644
index 000..3a58b92
--- /dev/null
+++ b/tests/spec/arb_viewport_array/bounds.c
@@ -0,0 +1,270 @@
+/*
+ * Copyright © 2013 LunarG, 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.
+ *
+ * Author: Jon Ashburn j...@lunarg.com
+ */
+
+/**
+ * Tests for the validity  of Viewport bounds, Depth Range bounds  and
+ * Scissor Box bounds with viewport arrays (0 to GL_MAX_VIEWPORTS-1).
+ * Bounds are the rectangle or range (eg x, y, width, height).
+ */
+#include piglit-util-gl-common.h
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 32;
+   config.supports_gl_core_version = 32;
+
+   config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+/**
+ * Test clamping for viewport x,y, width, height. They should be clamped
+ * to VIEWPORT_BOUNDS_RANGE and MAX_VIEWPORT_DIMS.  INVALID_VALUE for
+ * negative w,h. Test default values of x,y,w,h.
+ * OpenGL 4.3 Core section 13.6.1 ref:
+ *The location of the viewport’s bottom-left corner, given by (x, y),
+ *are clamped to be within the implementation-dependent viewport bounds
+ *range. The viewport bounds range [min, max] tuple may be determined by
+ *calling GetFloatv with the symbolic constant VIEWPORT_BOUNDS_RANGE (see
+ *section 22).
+ *
+ *Viewport width and height are clamped to implementation-dependent
+ *maximums when specified. The maximum width and height may be found by
+ *calling GetFloatv with the symbolic constant MAX_VIEWPORT_DIMS.
+ *
+ *An INVALID_VALUE error is generated if either w or h is negative.
+ *
+ *In the initial state, w and h for each viewport are set to the width
+ *and height, respectively, of the window into which the GL is to do its

Re: [Piglit] [PATCH 9/9 v2] ARB_viewport_array: Rendering test with multiple scissor rectangles/enables

2013-11-07 Thread Brian Paul

Typos below.

On 11/04/2013 08:15 AM, Jon Ashburn wrote:

Tests rendering into a single framebuffer surface with multiple viewports
via a geometry shader.  Scissoring is used to restrict quads to a smaller
area on the surface.  Confirm that each area of the surface delineated by
a scissor rectangle for viewport index renders the correct color. Both
indexed scissor tests and indexed scissor enables  are used. Geometry
shader is used to expand a single rectangle primitve to N rectangles.

Tested on Nvidia Quadro 600, test passes.

Signed-off-by: Jon Ashburn j...@lunarg.com
---
  tests/all.tests |   1 +
  tests/spec/arb_viewport_array/CMakeLists.gl.txt |   1 +
  tests/spec/arb_viewport_array/render_scissor.c  | 249 
  3 files changed, 251 insertions(+)
  create mode 100644 tests/spec/arb_viewport_array/render_scissor.c

diff --git a/tests/all.tests b/tests/all.tests
index f20a58b..928bf33 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1750,6 +1750,7 @@ arb_viewport_array['queries'] = 
concurrent_test('arb_viewport_array-queries')
  arb_viewport_array['minmax'] = concurrent_test('arb_viewport_array-minmax')
  arb_viewport_array['render-viewport'] = 
concurrent_test('arb_viewport_array-render-viewport')
  arb_viewport_array['render-depthrange'] = 
concurrent_test('arb_viewport_array-render-depthrange')
+arb_viewport_array['render-scissor'] = 
concurrent_test('arb_viewport_array-render-scissor')

  nv_vertex_program = Group()
  spec['NV_vertex_program'] = nv_vertex_program
diff --git a/tests/spec/arb_viewport_array/CMakeLists.gl.txt 
b/tests/spec/arb_viewport_array/CMakeLists.gl.txt
index 418c1d1..3c217ad 100644
--- a/tests/spec/arb_viewport_array/CMakeLists.gl.txt
+++ b/tests/spec/arb_viewport_array/CMakeLists.gl.txt
@@ -17,5 +17,6 @@ piglit_add_executable(arb_viewport_array-queries queries.c)
  piglit_add_executable(arb_viewport_array-minmax minmax.c)
  piglit_add_executable(arb_viewport_array-render-viewport render_viewport.c)
  piglit_add_executable(arb_viewport_array-render-depthrange 
render_depthrange.c)
+piglit_add_executable(arb_viewport_array-render-scissor render_scissor.c)

  # vim: ft=cmake:
diff --git a/tests/spec/arb_viewport_array/render_scissor.c 
b/tests/spec/arb_viewport_array/render_scissor.c
new file mode 100644
index 000..0f7e373
--- /dev/null
+++ b/tests/spec/arb_viewport_array/render_scissor.c
@@ -0,0 +1,249 @@
+/*
+ * Copyright © 2013 LunarG, 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.
+ *
+ * Author: Jon Ashburn j...@lunarg.com
+ */
+
+/**
+ * Tests rendering into a single framebuffer surface with multiple viewports
+ * via a geometry shader.  Scissoring is used to restrict quads to a smaller
+ * area on the surface.  Confirm that each area of the surface delineated by
+ * a scissor rectangle for viewport index renders the correct color. Both
+ * indexed scissor tests and indexed scissor enables  are used. Geometry
+ * shader is used to expand a single rectangle to N rectangles.
+ * OpenGL 4.3 Core Profile spec section 13.7.2 covers this test:
+ *The scissor test determines if (xw , yw ) lies within the scissor
+ *rectangle defined by four values for each viewport.
+ *If left ≤ xw  left + width and bottom ≤ yw  bottom + height for the
+ *selected scissor rectangle, then the scissor test passes. Otherwise, the
+ *test fails and the fragment is discarded. For points, lines, and
+ *polygons, the scissor rectangle for a primitive is selected in the same
+ *manner as the viewport (see section 13.6.1).
+ */
+#include piglit-util-gl-common.h
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 32;
+   config.supports_gl_core_version = 32;
+
+   config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+/* number of viewport/scissor rectangle divisons in x 

[Piglit] [PATCH] glsl-1.10: test that redeclaring a variable with a different type is illegal

2013-11-06 Thread Brian Paul
This passes w/ Mesa but crashes NVIDIA's driver.
---
 .../declarations/bad-variable-redeclaration.frag   |   29 
 1 file changed, 29 insertions(+)
 create mode 100644 
tests/spec/glsl-1.10/compiler/declarations/bad-variable-redeclaration.frag

diff --git 
a/tests/spec/glsl-1.10/compiler/declarations/bad-variable-redeclaration.frag 
b/tests/spec/glsl-1.10/compiler/declarations/bad-variable-redeclaration.frag
new file mode 100644
index 000..1354f14
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/declarations/bad-variable-redeclaration.frag
@@ -0,0 +1,29 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.10
+ * [end config]
+ */
+
+
+// This test checks that the compiler generates an error if we try
+// declare two variables and a function with the same name.
+// NVIDIA's 325.15 driver crashes on this.
+
+varying float color;
+
+float foo;
+
+// Redeclaring foo here should generate an error
+int foo;
+
+// This causes NVIDIA's driver to crash:
+vec4 foo(float v)
+{
+   return vec4(v);
+}
+
+void main()
+{
+   gl_FragColor = color;
+}
+
-- 
1.7.10.4

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


Re: [Piglit] [PATCH] update the HACKING file's Coding style section

2013-11-04 Thread Brian Paul

On 11/02/2013 09:02 PM, Dylan Baker wrote:

Could you add a note about python code?

Just something like: All python code should conform to python's PEP8
standard, using only spaces and no tabs would be great.


Go for it!

-Brian


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


[Piglit] [PATCH] update the HACKING file's Coding style section

2013-11-01 Thread Brian Paul
I've tried to describe Piglit's coding style and conventions in more
detail.  Hopefully, new contributors will read this and it'll save
some some time and effort for the reviewers.

Please feel free to add/update this info.
---
 HACKING |   57 -
 1 file changed, 44 insertions(+), 13 deletions(-)

diff --git a/HACKING b/HACKING
index a227fc6..03519e5 100644
--- a/HACKING
+++ b/HACKING
@@ -63,25 +63,56 @@ entirely new project. The most important reasons are:
 
 
 
+\ Coding style
+ -
 
-\ Ugly Things (or: Coding style)
- ---
+Basic formatting:
 
-As a rule of thumb, coding style should be preserved in test code taken from
-other projects, as long as that code is self-contained.
+* Indent with 8-column tabs
+* Limit lines to 78 characters or less
+* Function return type and name go on successive lines
+* Opening function brace goes on line by itself
+* Opening statement braces go on same line as the 'for' or 'else'
 
-Apart from that, the following rules are cast in stone:
+The following indent command will generally format your code for piglit's
+style:
 
-1. Use tabulators for indentation
-2. Use spaces for alignment
-3. No whitespace at the end of a line
+  indent -br -i8 -npcs -ce input.c -o output.c
 
-See http://electroly.com/mt/archives/02.html for a well-written rationale.
+Though, that doesn't give perfect results.  It messes up the
+PIGLIT_GL_TEST_CONFIG_BEGIN/END section.  And array initializers sometimes
+come out funny.
 
-Use whatever tabulator size you want:
-If you adhere to the rules above, the tab size does not matter. Tab size 4
-is recommended because it keeps the line lengths reasonable, but in the end,
-that's purely a matter of personal taste.
+When in doubt see other recently added piglit tests for coding style.
+
+
+Code conventions:
+
+* Use const qualifiers whenever possible on array declarations, pointers
+  and global variables.
+* Use static const for initialized arrays whenever possible.
+* Preprocessor macros should be UPPER_CASE
+* Enumeration tokens should be UPPER_CASE
+* Most other identifiers are lower_case_with_underscores
+* Use int, float, bool except when GL types (GLint, GLfloat) are really needed
+* Don't put declarations after code.  For example:
+  if (x  3)
+ x = 0;
+  int y = x * x;
+  This will not compile with MSVC.  The 'int y' declaration must be at the
+  top of the brace-block.
+* Don't use named/designated initializers.  They don't compile with MSVC.
+* Write tests that are easily read, understood and debugged.  Long, complicated
+  functions are frowned upon.
+* Don't try to test too much in a single test program.  Most piglit programs
+  are less than 300 lines long.
+
+
+Utility code:
+
+Piglit has a rich set of utility functions for basic drawing, setting
+up shaders, probing pixels, error checking, etc.  Try to use them before
+rolling your own.
 
 
 
-- 
1.7.10.4

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


Re: [Piglit] [PATCH] Fix occlusion query test to expect succesful Gen/DeleteQueries while active

2013-10-31 Thread Brian Paul

On 10/30/2013 06:23 PM, Carl Worth wrote:

A recent inspection of the latest OpenGL specification revealed that
there is no requirement for errors to be generated if GenQueries or
DeleteQueries are called while a query is active.

Specifically, in Section 4.2 of OpenGL 4.4 (Core Profile) the only
errors specified for GenQueries and DeleteQueries is INVALID_VALUE if
the ID is negative.

Additionally, the same section specifies what to do in case the active
query is deleted:

If an active query object is deleted its name immediately
becomes unused,...

Implementing this requires that DeleteQueries be able to succeed when
a query is active.
---

Sorry I missed this test update when I submitted and pushed the recent
patches to Mesa implementing this behavior.

  tests/glean/toccluqry.cpp | 24 +---
  1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/tests/glean/toccluqry.cpp b/tests/glean/toccluqry.cpp
index 580c346..0ea2d37 100644
--- a/tests/glean/toccluqry.cpp
+++ b/tests/glean/toccluqry.cpp
@@ -377,8 +377,8 @@ bool OccluQryTest::conformOQ_EndAfter(GLuint id)
  }


-/* Calling either GenQueriesARB while any query of any target is active causes
- * an INVALID_OPERATION error to be generated. */
+/* Calling either GenQueriesARB while any query of any target is active
+ * should not cause any error to be generated. */
  bool OccluQryTest::conformOQ_GenIn(GLuint id)
  {
int pass = true;
@@ -386,9 +386,9 @@ bool OccluQryTest::conformOQ_GenIn(GLuint id)
START_QUERY(id);

glGenQueriesARB_func(1, id);
-   if (glGetError() != GL_INVALID_OPERATION) {
-   reportError(No GL_INVALID_OPERATION generated if 
-   GenQueries in the progress of another.);
+   if (glGetError() != GL_NO_ERROR) {
+   reportError(Error generated when GenQueries called 
+   in the progress of another.);
pass = false;
}

@@ -398,20 +398,22 @@ bool OccluQryTest::conformOQ_GenIn(GLuint id)
  }


-/* Calling either DeleteQueriesARB while any query of any target is active 
causes
- * an INVALID_OPERATION error to be generated. */
+/* Calling either DeleteQueriesARB while any query of any target is active
+ * should not cause any error to be generated. */
  bool OccluQryTest::conformOQ_DeleteIn(GLuint id)
  {
int pass = true;
+   unsigned int another_id;

START_QUERY(id);

if (id  0) {
-   glDeleteQueriesARB_func(1, id);
+   glGenQueriesARB_func(1, another_id);
+   glDeleteQueriesARB_func(1, another_id);

-   if (glGetError() != GL_INVALID_OPERATION) {
-   reportError(No GL_INVALID_OPERATION generated if 
-   DeleteQueries in the progress of another.);
+   if (glGetError() != GL_NO_ERROR) {
+   reportError(Error generated when DeleteQueries called 
+   in the progress of another.);
pass = false;
}
}



Reviewed-by: Brian Paul bri...@vmware.com
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 1/2] cubemap-getteximage-pbo: Tests reading cube faces into a PBO

2013-10-31 Thread Brian Paul
Exercises an NVIDIA driver bug.
---
 tests/all.tests   |1 +
 tests/texturing/CMakeLists.gl.txt |1 +
 tests/texturing/cubemap-getteximage-pbo.c |  157 +
 3 files changed, 159 insertions(+)
 create mode 100644 tests/texturing/cubemap-getteximage-pbo.c

diff --git a/tests/all.tests b/tests/all.tests
index 2447065..1e632e7 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -2098,6 +2098,7 @@ spec['ARB_texture_cube_map'] = arb_texture_cube_map
 add_msaa_visual_plain_tests(arb_texture_cube_map, 'copyteximage CUBE')
 add_plain_test(arb_texture_cube_map, 'crash-cubemap-order')
 add_plain_test(arb_texture_cube_map, 'cubemap')
+add_concurrent_test(arb_texture_cube_map, 'cubemap-getteximage-pbo')
 arb_texture_cube_map['cubemap npot'] = PlainExecTest(['cubemap', '-auto', 
'npot'])
 add_plain_test(arb_texture_cube_map, 'cubemap-shader')
 arb_texture_cube_map['cubemap-shader lod'] = PlainExecTest(['cubemap-shader', 
'-auto', 'lod'])
diff --git a/tests/texturing/CMakeLists.gl.txt 
b/tests/texturing/CMakeLists.gl.txt
index 0534c88..cf8e3c5 100644
--- a/tests/texturing/CMakeLists.gl.txt
+++ b/tests/texturing/CMakeLists.gl.txt
@@ -20,6 +20,7 @@ piglit_add_executable (copyteximage-border 
copyteximage-border.c)
 piglit_add_executable (copyteximage-clipping copyteximage-clipping.c)
 piglit_add_executable (crossbar crossbar.c)
 piglit_add_executable (cubemap cubemap.c)
+piglit_add_executable (cubemap-getteximage-pbo cubemap-getteximage-pbo.c)
 piglit_add_executable (cubemap-shader cubemap-shader.c)
 piglit_add_executable (depth-level-clamp depth-level-clamp.c)
 piglit_add_executable (depthstencil-render-miplevels 
depthstencil-render-miplevels.cpp)
diff --git a/tests/texturing/cubemap-getteximage-pbo.c 
b/tests/texturing/cubemap-getteximage-pbo.c
new file mode 100644
index 000..85e8c52
--- /dev/null
+++ b/tests/texturing/cubemap-getteximage-pbo.c
@@ -0,0 +1,157 @@
+/*
+ * Copyright (c) 2013 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
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, 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
+ * NON-INFRINGEMENT.  IN NO EVENT SHALL VMWARE AND/OR THEIR SUPPLIERS
+ * 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.
+ */
+
+
+/**
+ * This test exercises an NVIDIA driver bug where using glGetTexImage
+ * to read a cubemap face into a PBO fails.  It appears that glGetTexImage
+ * always reads from the +X face.
+ */
+
+
+#include piglit-util-gl-common.h
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+   config.supports_gl_compat_version = 15;
+   config.window_visual = PIGLIT_GL_VISUAL_RGBA;
+PIGLIT_GL_TEST_CONFIG_END
+
+
+#define NUMCOLORS7
+#define TEX_WIDTH32
+#define TEX_HEIGHT   32
+#define TEX_NUMPIXELS(TEX_WIDTH * TEX_HEIGHT)
+
+
+static const GLuint Colors[NUMCOLORS] = {
+   0xFFFF,  /* red */
+   0x00FF00FF,  /* green */
+   0x,  /* blue */
+   0x00FF,  /* cyan */
+   0xFF00,  /* magenta */
+   0x00FF,  /* yellow */
+   0x7F7F7FFF,  /* gray */
+};
+
+
+/**
+ * Test one cube map face to see if glGetTexImage from a cube face into
+ * a PBO works correctly.
+ */
+static bool
+test_face(GLuint face)
+{
+   const GLenum cubeFaceTarget = GL_TEXTURE_CUBE_MAP_POSITIVE_X + face;
+   const GLuint expectedColor = Colors[face];
+   GLuint texData[TEX_NUMPIXELS];
+   GLuint cubeTex, fbo, packPBO;
+   GLuint f, i;
+   void *ptr;
+
+   /* Create the cubemap texture. */
+   glGenTextures(1, cubeTex);
+   glActiveTextureARB(GL_TEXTURE0);
+   glBindTexture(GL_TEXTURE_CUBE_MAP, cubeTex);
+   glPixelStorei(GL_UNPACK_ROW_LENGTH, TEX_WIDTH);
+   glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+   for (f = 0; f  6; ++f) {
+   for (i = 0; i  TEX_NUMPIXELS; ++i) {
+   texData[i] = Colors[f];
+   }
+   glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + f, 0,
+GL_SRGB8_ALPHA8, TEX_WIDTH, TEX_HEIGHT, 0, GL_BGRA,
+

[Piglit] [PATCH 2/2] arb_texture_view-getteximage-srgb: test sRGB texture views

2013-10-31 Thread Brian Paul
Exercises an NVIDIA driver bug related to glGetTexImage and sRGB
texture views.
---
 tests/all.tests|1 +
 tests/spec/arb_texture_view/CMakeLists.gl.txt  |1 +
 tests/spec/arb_texture_view/getteximage-srgb.c |  119 
 3 files changed, 121 insertions(+)
 create mode 100644 tests/spec/arb_texture_view/getteximage-srgb.c

diff --git a/tests/all.tests b/tests/all.tests
index 1e632e7..2e88de4 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1559,6 +1559,7 @@ arb_texture_view['queries'] = 
concurrent_test('arb_texture_view-queries')
 arb_texture_view['rendering-target'] = 
concurrent_test('arb_texture_view-rendering-target')
 arb_texture_view['rendering-levels'] = 
concurrent_test('arb_texture_view-rendering-levels')
 arb_texture_view['lifetime-format'] = 
concurrent_test('arb_texture_view-lifetime-format')
+arb_texture_view['getteximage-srgb'] = 
concurrent_test('arb_texture_view-getteximage-srgb')
 
 tdfx_texture_compression_fxt1 = Group()
 spec['3DFX_texture_compression_FXT1'] = tdfx_texture_compression_fxt1
diff --git a/tests/spec/arb_texture_view/CMakeLists.gl.txt 
b/tests/spec/arb_texture_view/CMakeLists.gl.txt
index bce50c3..cad7500 100644
--- a/tests/spec/arb_texture_view/CMakeLists.gl.txt
+++ b/tests/spec/arb_texture_view/CMakeLists.gl.txt
@@ -9,6 +9,7 @@ link_libraries(
${OPENGL_glu_LIBRARY}
)
 
+piglit_add_executable(arb_texture_view-getteximage-srgb getteximage-srgb.c)
 piglit_add_executable(arb_texture_view-texture-immutable-levels 
texture-immutable-levels.c)
 piglit_add_executable(arb_texture_view-params params.c)
 piglit_add_executable(arb_texture_view-formats formats.c common.c)
diff --git a/tests/spec/arb_texture_view/getteximage-srgb.c 
b/tests/spec/arb_texture_view/getteximage-srgb.c
new file mode 100644
index 000..9086a42
--- /dev/null
+++ b/tests/spec/arb_texture_view/getteximage-srgb.c
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 2013 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
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, 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
+ * NON-INFRINGEMENT.  IN NO EVENT SHALL VMWARE AND/OR THEIR SUPPLIERS
+ * 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.
+ */
+
+
+/**
+ * This test exercises an NVIDIA driver bug where reading back
+ * a texture image via an sRGBA view returns invalid texel data.
+ */
+
+
+#include piglit-util-gl-common.h
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+   config.supports_gl_compat_version = 15;
+   config.window_visual = PIGLIT_GL_VISUAL_RGBA;
+PIGLIT_GL_TEST_CONFIG_END
+
+
+#define TEX_WIDTH32
+#define TEX_HEIGHT   32
+#define TEX_NUMPIXELS(TEX_WIDTH * TEX_HEIGHT)
+
+#define RED 0xFFFF
+#define GRAY 0x7F7F7FFF
+
+
+static bool
+test_srgb_view(GLenum view_format)
+{
+   GLenum target = GL_TEXTURE_2D;
+   GLuint texData[TEX_NUMPIXELS];
+   GLuint tex, view, i;
+
+   /* init tex data */
+   for (i = 0; i  TEX_NUMPIXELS; ++i) {
+   texData[i] = RED;
+   }
+
+   /* Create RGBA texture */
+   glGenTextures(1, tex);
+   glActiveTextureARB(GL_TEXTURE0);
+   glBindTexture(target, tex);
+   glTexStorage2D(target, 1, GL_RGBA8, TEX_WIDTH, TEX_HEIGHT);
+   glTexSubImage2D(target, 0, 0, 0, TEX_WIDTH, TEX_HEIGHT,
+   GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, texData);
+
+   /* Create sRGB texture view */
+   glGenTextures(1, view);
+   glTextureView(view, target, tex, view_format, 0, 1, 0, 1);
+   glBindTexture(target, view);
+   glTexParameteri(target, GL_TEXTURE_BASE_LEVEL, 0);
+
+   /* reset texData to gray */
+   for (i = 0; i  TEX_NUMPIXELS; ++i) {
+   texData[i] = GRAY;
+   }
+
+   /* Get tex image data from the view */
+   glGetTexImage(target, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, texData);
+
+   if (texData[0] != RED) {
+   printf(Wrong color for %s texture view.\n,
+  piglit_get_gl_enum_name(view_format));
+   printf(Expected 0x%08x but found 0x%08x \n,
+  RED, texData[0]);
+

Re: [Piglit] [PATCH] triangle-rasterization: increase the precision of the test

2013-10-29 Thread Brian Paul

On 10/28/2013 05:53 PM, Zack Rusin wrote:

Increase the subpixel precision to 8 bits. This requires
changing some of the code to 64 bits to avoid overflows.

Signed-off-by: Zack Rusin za...@vmware.com
---



Reviewed-by: Brian Paul bri...@vmware.com

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


Re: [Piglit] [PATCH 5/7] ARB_texture_view: Test for rendering various targets in texture view

2013-10-29 Thread Brian Paul

On 10/28/2013 12:16 PM, Jon Ashburn wrote:

Tests GL_ARB_texture_view rendering with various texture targets.
Creates texture maps with different solid colors for each level or layer
reads the framebuffer to ensure the rendered color is correct.

Tested on Nvidia  Quadro 600, all subtests pass.

Signed-off-by: Jon Ashburn j...@lunarg.com
---
  tests/all.tests|   1 +
  tests/spec/arb_texture_view/CMakeLists.gl.txt  |   1 +
  tests/spec/arb_texture_view/common.c   |  78 ++-
  tests/spec/arb_texture_view/common.h   |  16 +-
  tests/spec/arb_texture_view/rendering_target.c | 270 +
  5 files changed, 364 insertions(+), 2 deletions(-)
  create mode 100644 tests/spec/arb_texture_view/rendering_target.c

diff --git a/tests/all.tests b/tests/all.tests
index 8784e24..5941eb2 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1476,6 +1476,7 @@ arb_texture_view['params'] = 
concurrent_test('arb_texture_view-params')
  arb_texture_view['formats'] = concurrent_test('arb_texture_view-formats')
  arb_texture_view['targets'] = concurrent_test('arb_texture_view-targets')
  arb_texture_view['queries'] = concurrent_test('arb_texture_view-queries')
+arb_texture_view['rendering-target'] = 
concurrent_test('arb_texture_view-rendering-target')

  tdfx_texture_compression_fxt1 = Group()
  spec['3DFX_texture_compression_FXT1'] = tdfx_texture_compression_fxt1
diff --git a/tests/spec/arb_texture_view/CMakeLists.gl.txt 
b/tests/spec/arb_texture_view/CMakeLists.gl.txt
index 6945a05..6b69bb1 100644
--- a/tests/spec/arb_texture_view/CMakeLists.gl.txt
+++ b/tests/spec/arb_texture_view/CMakeLists.gl.txt
@@ -14,5 +14,6 @@ piglit_add_executable(arb_texture_view-params params.c)
  piglit_add_executable(arb_texture_view-formats formats.c common.c)
  piglit_add_executable(arb_texture_view-targets targets.c common.c)
  piglit_add_executable(arb_texture_view-queries queries.c)
+piglit_add_executable(arb_texture_view-rendering-target rendering_target.c 
common.c)

  # vim: ft=cmake:
diff --git a/tests/spec/arb_texture_view/common.c 
b/tests/spec/arb_texture_view/common.c
index 5d7b6b9..2453847 100644
--- a/tests/spec/arb_texture_view/common.c
+++ b/tests/spec/arb_texture_view/common.c
@@ -26,6 +26,44 @@
  #include piglit-util-gl-common.h
  #include stdarg.h

+GLubyte Colors[][8] = {


const qualifier?



+   {127,   0,   0, 255,  0, 10, 20,  0},
+   {  0, 127,   0, 255,  0,  0, 80, 90},
+   {  0,   0, 127, 255, 25,  0,  0, 60},
+   {  0, 127, 127, 255, 15, 15,  0,  0},
+   {127,   0, 127, 255,  0,  2, 50,  0},
+   {127, 127,   0, 255, 80, 10, 70, 20},
+   {255,   0,   0, 255, 60,  0, 40, 30},
+   {  0, 255,   0, 255, 50, 20,  2, 40},
+   {  0,   0, 255, 255, 40,  0,  1,  0},
+   {  0, 255, 255, 255, 30,  5,  3,  8},
+   {255,   0, 255, 255, 20, 18,  4,  7},
+   {255, 255,   0, 255,  10, 24, 77, 67},
+   {255, 255, 255, 255,  5,  33, 88, 44}
+};
+


-Brian


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


Re: [Piglit] [PATCH 1/9] ARB_viewport_array: Validity test for viewport index/first/count params

2013-10-29 Thread Brian Paul

On 10/29/2013 03:55 PM, Jon Ashburn wrote:

Tests GL_ARB_viewport_array regarding the validity for the indices.
Use both valid and invalid parameters (index, first, count) for these new
API entry points:
   glViewportArrayv, glViewportIndexedf, glViewportIndexedfv, glGetFloati_v.

Also test that writing to an invalid viewport index for Viewport, DepthRange,
Scissor Box, Scissor Test does not modify any of the state for the valid
range of indices.

Tested on Nvidia Quadro 600 all tests pass.
---
  tests/all.tests  |   4 +
  tests/spec/CMakeLists.txt|   1 +
  tests/spec/arb_viewport_array/CMakeLists.gl.txt  |  14 ++
  tests/spec/arb_viewport_array/CMakeLists.txt |   1 +
  tests/spec/arb_viewport_array/viewport_indices.c | 252 +++
  5 files changed, 272 insertions(+)
  create mode 100644 tests/spec/arb_viewport_array/CMakeLists.gl.txt
  create mode 100644 tests/spec/arb_viewport_array/CMakeLists.txt
  create mode 100644 tests/spec/arb_viewport_array/viewport_indices.c

diff --git a/tests/all.tests b/tests/all.tests
index 550729d..e3d64ff 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1729,6 +1729,10 @@ add_plain_test(arb_vertex_program, 'vp-address-04')
  add_plain_test(arb_vertex_program, 'vp-bad-program')
  add_plain_test(arb_vertex_program, 'vp-max-array')

+arb_viewport_array = Group()
+spec['ARB_viewport_array'] = arb_viewport_array
+arb_viewport_array['viewport-indices'] = 
concurrent_test('arb_viewport_array-viewport-indices')
+
  nv_vertex_program = Group()
  spec['NV_vertex_program'] = nv_vertex_program
  add_vpfpgeneric(nv_vertex_program, 'nv-mov')
diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt
index 18b846d..d22d8a4 100644
--- a/tests/spec/CMakeLists.txt
+++ b/tests/spec/CMakeLists.txt
@@ -41,6 +41,7 @@ add_subdirectory (arb_texture_storage_multisample)
  add_subdirectory (arb_texture_view)
  add_subdirectory (arb_timer_query)
  add_subdirectory (arb_transform_feedback2)
+add_subdirectory (arb_viewport_array)
  add_subdirectory (ati_envmap_bumpmap)
  add_subdirectory (ext_fog_coord)
  add_subdirectory (ext_framebuffer_multisample)
diff --git a/tests/spec/arb_viewport_array/CMakeLists.gl.txt 
b/tests/spec/arb_viewport_array/CMakeLists.gl.txt
new file mode 100644
index 000..56ec330
--- /dev/null
+++ b/tests/spec/arb_viewport_array/CMakeLists.gl.txt
@@ -0,0 +1,14 @@
+include_directories(
+   ${GLEXT_INCLUDE_DIR}
+   ${OPENGL_INCLUDE_PATH}
+   )
+
+link_libraries(
+   piglitutil_${piglit_target_api}
+   ${OPENGL_gl_LIBRARY}
+   ${OPENGL_glu_LIBRARY}
+   )
+
+piglit_add_executable(arb_viewport_array-viewport-indices viewport_indices.c)
+
+# vim: ft=cmake:
diff --git a/tests/spec/arb_viewport_array/CMakeLists.txt 
b/tests/spec/arb_viewport_array/CMakeLists.txt
new file mode 100644
index 000..144a306
--- /dev/null
+++ b/tests/spec/arb_viewport_array/CMakeLists.txt
@@ -0,0 +1 @@
+piglit_include_target_api()
diff --git a/tests/spec/arb_viewport_array/viewport_indices.c 
b/tests/spec/arb_viewport_array/viewport_indices.c
new file mode 100644
index 000..986925b
--- /dev/null
+++ b/tests/spec/arb_viewport_array/viewport_indices.c
@@ -0,0 +1,252 @@
+/*
+ * Copyright © 2013 LunarG, 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.
+ *
+ * Author: Jon Ashburn j...@lunarg.com
+ */
+
+/**
+ * Tests GL_ARB_viewport_array regarding the validity for the indices.
+ * Use both valid and invalid parameters (index, first, count)
+ * for these new API entry points:
+ * glViewportArrayv, glViewportIndexedf, glViewportIndexedfv, glGetFloati_v.
+ *
+ * Also test that writing to an invalid viewport index for Viewport, 
DepthRange,
+ * Scissor Box, Scissor Test does not modify any of the state for the valid
+ * range of indices.
+ *
+ */
+
+#include piglit-util-gl-common.h
+#include stdarg.h
+
+PIGLIT_GL_TEST_CONFIG_BEGIN

Re: [Piglit] [PATCH 9/9] ARB_viewport_array: Rendering test with multiple scissor rectangles/enables

2013-10-29 Thread Brian Paul

On 10/29/2013 03:55 PM, Jon Ashburn wrote:

Tests rendering into a single framebuffer surface with multiple viewports
via a geometry shader.  Scissoring is used to restrict quads to a smaller
area on the surface.  Confirm that each area of the surface delineated by
a scissor rectangle for viewport index renders the correct color. Both
indexed scissor tests and indexed scissor enables  are used. Geometry
shader is used to expand a single rectangle primitve to N rectangles.

Tested on Nvidia Quadro 600, test passes.
---
  tests/all.tests |   1 +
  tests/spec/arb_viewport_array/CMakeLists.gl.txt |   1 +
  tests/spec/arb_viewport_array/render_scissor.c  | 240 
  3 files changed, 242 insertions(+)
  create mode 100644 tests/spec/arb_viewport_array/render_scissor.c

diff --git a/tests/all.tests b/tests/all.tests
index 15ab94c..ec4b231 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1739,6 +1739,7 @@ arb_viewport_array['queries'] = 
concurrent_test('arb_viewport_array-queries')
  arb_viewport_array['minmax'] = concurrent_test('arb_viewport_array-minmax')
  arb_viewport_array['render-viewport'] = 
concurrent_test('arb_viewport_array-render-viewport')
  arb_viewport_array['render-depthrange'] = 
concurrent_test('arb_viewport_array-render-depthrange')
+arb_viewport_array['render-scissor'] = 
concurrent_test('arb_viewport_array-render-scissor')

  nv_vertex_program = Group()
  spec['NV_vertex_program'] = nv_vertex_program
diff --git a/tests/spec/arb_viewport_array/CMakeLists.gl.txt 
b/tests/spec/arb_viewport_array/CMakeLists.gl.txt
index 418c1d1..3c217ad 100644
--- a/tests/spec/arb_viewport_array/CMakeLists.gl.txt
+++ b/tests/spec/arb_viewport_array/CMakeLists.gl.txt
@@ -17,5 +17,6 @@ piglit_add_executable(arb_viewport_array-queries queries.c)
  piglit_add_executable(arb_viewport_array-minmax minmax.c)
  piglit_add_executable(arb_viewport_array-render-viewport render_viewport.c)
  piglit_add_executable(arb_viewport_array-render-depthrange 
render_depthrange.c)
+piglit_add_executable(arb_viewport_array-render-scissor render_scissor.c)

  # vim: ft=cmake:
diff --git a/tests/spec/arb_viewport_array/render_scissor.c 
b/tests/spec/arb_viewport_array/render_scissor.c
new file mode 100644
index 000..514313a
--- /dev/null
+++ b/tests/spec/arb_viewport_array/render_scissor.c
@@ -0,0 +1,240 @@
+/*
+ * Copyright © 2013 LunarG, 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.
+ *
+ * Author: Jon Ashburn j...@lunarg.com
+ */
+
+/**
+ * Tests rendering into a single framebuffer surface with multiple viewports
+ * via a geometry shader.  Scissoring is used to restrict quads to a smaller
+ * area on the surface.  Confirm that each area of the surface delineated by
+ * a scissor rectangle for viewport index renders the correct color. Both
+ * indexed scissor tests and indexed scissor enables  are used. Geometry
+ * shader is used to expand a single rectangle to N rectangles.
+ * OpenGL 4.3 Core Profile spec section 13.7.2 covers this test:
+ *The scissor test determines if (xw , yw ) lies within the scissor
+ *rectangle defined by four values for each viewport.
+ *If left ≤ xw  left + width and bottom ≤ yw  bottom + height for the
+ *selected scissor rectangle, then the scissor test passes. Otherwise, the
+ *test fails and the fragment is discarded. For points, lines, and
+ *polygons, the scissor rectangle for a primitive is selected in the same
+ *manner as the viewport (see section 13.6.1).
+ */
+#include piglit-util-gl-common.h
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 32;
+   config.supports_gl_core_version = 32;
+
+   config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+/* number of viewport/scissor rectangle divisons in x and y */
+static const int divX=2, divY=3;
+
+/**
+ * 

Re: [Piglit] [PATCH 6/9] ARB_viewport_array: Test min/max values for new implementation constants

2013-10-29 Thread Brian Paul

On 10/29/2013 03:55 PM, Jon Ashburn wrote:

Tested GLenums are GL_MAX_VIEWPORT_DIMS, GL_MAX_VIEWPORTS,
GL_VIEWPORT_SUBPIXEL_BITS, GL_VIEWPORT_BOUNDS_RANGE, GL_LAYER_PROVOKING_VERTEX,
GL_VIEWPORT_INDEX_PROVOKING_VERTEX.

Tested on Nvidia Quadro 600, test passes.
---
  tests/all.tests |   1 +
  tests/spec/arb_viewport_array/CMakeLists.gl.txt |   1 +
  tests/spec/arb_viewport_array/minmax.c  | 112 
  3 files changed, 114 insertions(+)
  create mode 100644 tests/spec/arb_viewport_array/minmax.c

diff --git a/tests/all.tests b/tests/all.tests
index 06c9d8c..0ed93b6 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1736,6 +1736,7 @@ arb_viewport_array['depthrange-indices'] = 
concurrent_test('arb_viewport_array-d
  arb_viewport_array['scissor-indices'] = 
concurrent_test('arb_viewport_array-scissor-indices')
  arb_viewport_array['bounds'] = concurrent_test('arb_viewport_array-bounds')
  arb_viewport_array['queries'] = concurrent_test('arb_viewport_array-queries')
+arb_viewport_array['minmax'] = concurrent_test('arb_viewport_array-minmax')

  nv_vertex_program = Group()
  spec['NV_vertex_program'] = nv_vertex_program
diff --git a/tests/spec/arb_viewport_array/CMakeLists.gl.txt 
b/tests/spec/arb_viewport_array/CMakeLists.gl.txt
index ab149f8..155b62a 100644
--- a/tests/spec/arb_viewport_array/CMakeLists.gl.txt
+++ b/tests/spec/arb_viewport_array/CMakeLists.gl.txt
@@ -14,5 +14,6 @@ piglit_add_executable(arb_viewport_array-depthrange-indices 
depth_range_indices.
  piglit_add_executable(arb_viewport_array-scissor-indices scissor_indices.c)
  piglit_add_executable(arb_viewport_array-bounds bounds.c)
  piglit_add_executable(arb_viewport_array-queries queries.c)
+piglit_add_executable(arb_viewport_array-minmax minmax.c)

  # vim: ft=cmake:
diff --git a/tests/spec/arb_viewport_array/minmax.c 
b/tests/spec/arb_viewport_array/minmax.c
new file mode 100644
index 000..54e5a55
--- /dev/null
+++ b/tests/spec/arb_viewport_array/minmax.c
@@ -0,0 +1,112 @@
+/*
+ * Copyright © 2013 LunarG, 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.
+ *
+ * Author: Jon Ashburn j...@lunarg.com
+ */
+
+/** @file minmax.c
+ *
+ * Test for the minimum maximum values listed in section 23 State Tables
+ * (23.54) of the GL Core profile 4.3 spec relating to ARB_viewport_array.
+ * Tested GLenums are GL_MAX_VIEWPORT_DIMS, GL_MAX_VIEWPORTS,
+ * GL_VIEWPORT_SUBPIXEL_BITS, GL_VIEWPORT_BOUNDS_RANGE,
+ * GL_LAYER_PROVOKING_VERTEX, GL_VIEWPORT_INDEX_PROVOKING_VERTEX.
+ */
+
+#include piglit-util-gl-common.h
+#include minmax-test.h
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_core_version = 32;
+   config.supports_gl_compat_version = 32;
+
+   config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+enum piglit_result
+piglit_display(void)
+{
+   /* UNREACHED */
+   return PIGLIT_FAIL;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+   GLint layer, index;
+
+   piglit_print_minmax_header();
+
+   piglit_test_min_viewport_dimensions(); /* GL_MAX_VIEWPORT_DIMS */
+   piglit_test_min_int(GL_MAX_VIEWPORTS, 16);
+   piglit_test_min_int(GL_VIEWPORT_SUBPIXEL_BITS, 0);
+
+   /* ARB_viewport_array extension spec says:
+*NOTE 2: range for viewport bounds:
+*On GL3-capable hardware the VIEWPORT_BOUNDS_RANGE should be at
+*least [-16384, 16383].
+*On GL4-capable hardware the VIEWPORT_BOUNDS_RANGE should be at
+*least [-32768, 32767].
+*/
+   /* Since no known way to determine GL3 versus GL4 capable hardware use
+  GL version instead */
+   if (piglit_get_gl_version()  40)
+   piglit_test_range_float(GL_VIEWPORT_BOUNDS_RANGE, -16384, 
16383);
+   else
+   piglit_test_range_float(GL_VIEWPORT_BOUNDS_RANGE, -32768, 
32767);
+

Re: [Piglit] [PATCH 8/9] ARB_viewport_array: Rendering test with multiple depthranges

2013-10-29 Thread Brian Paul
()\n
+   {\n
+ gl_ViewportIndex = idx;\n
+ for(int i = 0; i  gl_in.length(); i++) {\n
+ gl_Position = gl_in[i].gl_Position;\n
+ EmitVertex();\n
+ }\n
+ EndPrimitive();\n
+   }\n
+};
+
+const char *fsSource = {
+   #version 430\n
+   uniform vec3 color;\n
+   in int gl_ViewportIndex;\n
+   void main() {\n
+ float idx = gl_ViewportIndex / 10.0;\n
+ gl_FragColor = vec4(gl_FragCoord.z, gl_DepthRange.far, idx, 1.0);\n
+   }\n
+};
+
+static GLuint colorLoc;
+static GLuint vpIndexLoc;
+
+/**
+ * Draws a single quad into multiple viewport each with a different
+ * depthRange and fixed Z plane.  Reads back the expected color (which is a
+ * a function (funcOf(Z, depthRange, viewportIndex)) to test if the drawing
+ * with different depthRanges per viewport index is correct.
+ * From GLSL 4.30.6 Spec section 7.4:
+ * Depth range in window coordinates,
+ *  section 13.6.1 “Controlling the Viewport” in the
+ *  OpenGL Graphics System Specification.
+ *  Note: Depth-range state is only for viewport 0.
+ *
+ */
+static bool
+draw_multi_viewport(void)
+{
+   bool pass = true;
+   int i, j;
+   const int divX=2, divY=4;
+   GLfloat w = (GLfloat) piglit_width / (GLfloat) divX;
+   GLfloat h = (GLfloat) piglit_height / (GLfloat) divY;
+   GLfloat zVal = 0.25;
+   GLfloat drFar = 0.6;
+   GLfloat colors[divX*divY][3];
+   GLdouble depthRange[][2] = {{0.5, 1.0},
+   {0.0, 0.8},
+   {1.0, 0.75},
+   {0.3, 0.8},
+   {0.7, 0.6},
+   {0.9, 0.1},
+   {0.1, 0.9},
+   {0.2, 0.4}};


Const qualify?



+
+   assert(ARRAY_SIZE(depthRange) == divX*divY);
+
+
+   glClearDepthf(1.0);
+   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+   glEnable(GL_DEPTH_TEST);
+   glDepthRangeIndexed(0, 0.4, drFar);
+   glDepthFunc(GL_ALWAYS);
+
+   /* initialize expected colors */
+   /* Frag shader uses FragCoord.z for the Red, DepthRange[0].far for
+  Green color, and Blue is viewportIndex / 10.0 */


For multi-line comments we use a style like this:

/* Frag shader uses FragCoord.z for the Red, DepthRange[0].far for
 * Green color, and Blue is viewportIndex / 10.0
 */



+   for (i = 0; i  divX * divY; i++) {
+   GLfloat near = depthRange[i][0];
+   GLfloat far = depthRange[i][1];
+   colors[i][0] = (((far - near) * zVal)  + near + far) / 2.0;
+   colors[i][1] = drFar;
+   colors[i][2] = (GLfloat) (i + 1) / 10.0;
+   }
+
+   /* draw with varying viewports and depth ranges */
+   for (i = 0; i  divX; i++) {
+   for (j = 0; j  divY; j++) {
+   int p, idx;
+   /* start at index 1 instead of zero, since index 0
+  contains the Frag Shader gl_DepthRange value */
+   idx = j + 1 + i*divY;
+   glUniform3fv(colorLoc, 1, colors[idx-1][0]);
+   glUniform1i(vpIndexLoc, idx);
+   glViewportIndexedf(idx, i * w, j * h, w, h);
+   glDepthRangeIndexed(idx, depthRange[idx-1][0],
+   depthRange[idx-1][1]);
+   piglit_draw_rect_z(zVal, -1.0, -1.0, 2.0, 2.0);
+   pass = piglit_check_gl_error(GL_NO_ERROR)  pass;
+   p = piglit_probe_pixel_rgb(i * w + w/2, j * h + h/2,
+  colors[idx-1][0]);
+   piglit_present_results();
+   if (!p) {
+   printf(Wrong color for viewport i,j %d %d\n,
+  i, j);
+   pass = false;
+   }
+   }
+   }
+   return pass;
+}
+
+enum piglit_result
+piglit_display(void)
+{
+   bool pass= true;
+
+   pass = draw_multi_viewport();
+   pass = piglit_check_gl_error(GL_NO_ERROR)  pass;
+   return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+   GLuint program;
+
+   piglit_require_extension(GL_ARB_viewport_array);
+
+   program = piglit_build_simple_program_multiple_shaders(
+   GL_VERTEX_SHADER, vsSource,
+   GL_GEOMETRY_SHADER, gsSource,
+   GL_FRAGMENT_SHADER, fsSource,
+   0);
+   glUseProgram(program);
+   colorLoc = glGetUniformLocation(program, color);
+   vpIndexLoc = glGetUniformLocation(program, idx);
+}



With above fixes:  Reviewed-by: Brian Paul

Re: [Piglit] [PATCH 5/9] ARB_viewport_array: Test validity for glGetFloati_v and glGetDoublei_v

2013-10-29 Thread Brian Paul
 4.3 Core section 22.1 ref:
+* An INVALID_ENUM error is generated if target is not indexed
+* state queriable with these commands.
+*/
+
+   for (i = 0; i  ARRAY_SIZE(tokens); i++) {
+   glGetFloati_v(tokens[i], 1, valf);
+   pass = piglit_check_gl_error(GL_INVALID_ENUM)  pass;
+   glGetDoublei_v(tokens[i], 1, vald);
+   pass = piglit_check_gl_error(GL_INVALID_ENUM)  pass;
+   }
+
+   /**
+* Test default value for SCISSOR_TEST via query.
+* OpenGL 4.3 Core section 13.6.1 ref:
+*Initially, the scissor test is disabled for all viewports.
+*/
+   for (i = 0; i  maxVP; i++) {
+   scEnabled = glIsEnabledi(GL_SCISSOR_TEST, i);
+   if (scEnabled == GL_TRUE) {
+   printf(scissor test default value wrong for idx %d\n,
+  i);
+   pass = false;
+   }
+   }
+   pass = piglit_check_gl_error(GL_NO_ERROR)  pass;
+
+   /**
+* Test settable value for SCISSOR_TEST can be queried
+*/
+   /* first setup initial values */
+   for (i = 0; i  maxVP; i++) {
+   scEnabled = i  0x1;
+   if (scEnabled)
+   glEnablei(GL_SCISSOR_TEST, i);
+   else
+   glDisablei(GL_SCISSOR_TEST, i);
+   }
+   /* test can query these values */
+   for (i = 0; i  maxVP; i++) {
+   scEnabled = i  0x1;
+   if (scEnabled != glIsEnabledi(GL_SCISSOR_TEST, i)) {
+   pass = false;
+   printf(Wrong queried value for GL_SCISSOR_TEST, idx=%d\n,
+  i);
+   }
+   }
+
+   /**
+* Test for valid pname parameter used with various forms of glGet.
+* return the same data.
+*/
+   glViewport(1, 2, 30, 40);
+   glDepthRange(0.25, 0.75);
+   glScissor(3, 4, 50, 60);
+   for (i =0; i  ARRAY_SIZE(indexedTokens); i++) {
+   glGetFloati_v(indexedTokens[i], 1, valf);
+   glGetDoublei_v(indexedTokens[i], 1, vald);
+   glGetIntegeri_v(indexedTokens[i], 1, vali);
+   if (valf[0] != vald[0] || valf[1] != vald[1] ||
+   valf[2] != vald[2] || valf[3] != vald[3]) {
+   pass = false;
+   printf(mismatched valf and vald for %s\n,
+  piglit_get_gl_enum_name(indexedTokens[i]));
+   printf(valf[0-3]= %f %f %f %f\n, valf[0], valf[1],
+  valf[2], valf[3]);
+   printf(vald[0-3] = %f %f %f %f\n, vald[0], vald[1],
+  vald[2], vald[3]);
+   }
+   if ((int) (valf[0] + 0.5) != vali[0] ||
+   (int) (valf[1] + 0.5) != vali[1] ||
+   (int) (valf[2] + 0.5) != vali[2] ||
+   (int) (valf[3] + 0.5) != vali[3]) {
+   pass = false;
+   printf(mismatched valf and vali for %s\n,
+  piglit_get_gl_enum_name(indexedTokens[i]));
+   printf(valf[0-3]= %f %f %f %f\n, valf[0], valf[1],
+  valf[2], valf[3]);
+   printf(vali[0-3] = %d %d %d %d\n, vali[0], vali[1],
+  vali[2], vali[3]);
+   }
+   }
+   pass = piglit_check_gl_error(GL_NO_ERROR)  pass;
+
+   piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
+}




Reviewed-by: Brian Paul bri...@vmware.com

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


Re: [Piglit] [PATCH] Add new test for calling glGenQueries/glDeleteQueries with an active query

2013-10-28 Thread Brian Paul

On 10/28/2013 11:59 AM, Carl Worth wrote:

It is legal to gen and delete a query while another query is active.

It is also legal to delete the currently active object.

Ensure that both of these operations can be performed without any error,
(as well as ensuring that glEndQuery on a deleted query does generate
an error).


Reviewed-by: Brian Paul bri...@vmware.com
Tested-by: Brian Paul bri...@vmware.com

NVIDIA's 325.15 driver fails on the error check on line 96, but that 
looks like their bug.


Thanks for making all the changes, Carl.

-Brian

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


Re: [Piglit] [PATCH 5/7] ARB_texture_view: Test for rendering various targets in texture view

2013-10-25 Thread Brian Paul

On 10/25/2013 10:41 AM, Jon Ashburn wrote:

RE your comment:

+config.window_width = 128;
+config.window_height = 128;


Is 128 special?  Can you just go with the defaults?  In the past we've
had trouble on Windows when the width is  130 or so pixels.  Long story. 


128 isn't special  and I could use a larger number (130). However,
since a line is drawn diagonally across the full screen and sampled in
its middle by this test, certain width and height combinations  fail.
The default values  work but I am worried about the user overiding  the
default value (not sure how that behaves). Other option is to make the
test  more robust to varying  window width and heights rather than
fixing the window width and height to a value that samples correctly.


OK, if you pick a size like 200x200 or 256x256 we should be OK.  People 
seldom resize piglit windows.


-Brian


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


Re: [Piglit] [PATCH 7/7] ARB_texture_view: Test texture view format changes and lifetimes

2013-10-24 Thread Brian Paul

On 10/24/2013 03:49 PM, Jon Ashburn wrote:

Tests texture views with data format changes. 1D textures only.
Uses multiple simultaneous views with different lifetimes and
check results via glGetTexImage().

Tested on Nvidia  Quadro 600, all subtests pass.
---
  tests/all.tests   |   1 +
  tests/spec/arb_texture_view/CMakeLists.gl.txt |   1 +
  tests/spec/arb_texture_view/lifetime_format.c | 235 ++
  3 files changed, 237 insertions(+)
  create mode 100644 tests/spec/arb_texture_view/lifetime_format.c

diff --git a/tests/all.tests b/tests/all.tests
index a329156..0856467 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1478,6 +1478,7 @@ arb_texture_view['targets'] = 
concurrent_test('arb_texture_view-targets')
  arb_texture_view['queries'] = concurrent_test('arb_texture_view-queries')
  arb_texture_view['rendering-target'] = 
concurrent_test('arb_texture_view-rendering-target')
  arb_texture_view['rendering-levels'] = 
concurrent_test('arb_texture_view-rendering-levels')
+arb_texture_view['lifetime-format'] = 
concurrent_test('arb_texture_view-lifetime-format')

  tdfx_texture_compression_fxt1 = Group()
  spec['3DFX_texture_compression_FXT1'] = tdfx_texture_compression_fxt1
diff --git a/tests/spec/arb_texture_view/CMakeLists.gl.txt 
b/tests/spec/arb_texture_view/CMakeLists.gl.txt
index a39c7dd..bce50c3 100644
--- a/tests/spec/arb_texture_view/CMakeLists.gl.txt
+++ b/tests/spec/arb_texture_view/CMakeLists.gl.txt
@@ -16,5 +16,6 @@ piglit_add_executable(arb_texture_view-targets targets.c 
common.c)
  piglit_add_executable(arb_texture_view-queries queries.c)
  piglit_add_executable(arb_texture_view-rendering-target rendering_target.c 
common.c)
  piglit_add_executable(arb_texture_view-rendering-levels rendering_levels.c 
common.c)
+piglit_add_executable(arb_texture_view-lifetime-format lifetime_format.c 
common.c)

  # vim: ft=cmake:
diff --git a/tests/spec/arb_texture_view/lifetime_format.c 
b/tests/spec/arb_texture_view/lifetime_format.c
new file mode 100644
index 000..c1939c8
--- /dev/null
+++ b/tests/spec/arb_texture_view/lifetime_format.c
@@ -0,0 +1,235 @@
+/*
+ * Copyright © 2013 LunarG, 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.
+ *
+ * Author: Jon Ashburn j...@lunarg.com
+ */
+
+/**
+ * Tests texture views with data format changes. 1D textures only.
+ * Uses multiple simultaneous views with different lifetimes and
+ * check results via glGetTexImage().
+ */
+
+#include piglit-util-gl-common.h
+#include common.h
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 10;
+   config.supports_gl_core_version = 31;
+
+   config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+/* Texture formats. The format_list variable has these fields: */
+struct format_desc {
+   const char  *name;
+   GLenum  internalfmt;
+   GLenum  storagefmt;
+   GLenum  imagefmt;
+   GLenum  imagetype;
+   GLenum  getfmt;
+   GLenum  gettype;
+   int red, green, blue, alpha;
+};
+
+#define FORMAT(f) #f, f
+static const struct format_desc format_list[] = {
+   {FORMAT(GL_RGBA8UI), GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE,
+   GL_RGBA_INTEGER, GL_UNSIGNED_BYTE, 8, 8, 8, 8},
+   {FORMAT(GL_RGBA8I), GL_RGBA8I, GL_RGBA, GL_UNSIGNED_BYTE,
+   GL_RGBA_INTEGER, GL_BYTE, 8, 8, 8, 8},
+   {FORMAT(GL_RGB16F), GL_RGB16F, GL_RGB, GL_UNSIGNED_BYTE, GL_RGB,
+   GL_HALF_FLOAT, 16, 16, 16, 0},
+   {FORMAT(GL_RGB16I), GL_RGB16, GL_RGB, GL_UNSIGNED_BYTE,
+   GL_RGB_INTEGER, GL_SHORT, 16, 16, 16, 0},
+   {FORMAT(GL_R16UI), GL_R16, GL_RED, GL_UNSIGNED_BYTE,
+   GL_RED_INTEGER, GL_UNSIGNED_SHORT, 16, 0, 0, 0},
+   {FORMAT(GL_R16F), GL_R16, GL_RED, GL_UNSIGNED_BYTE,
+   GL_RED, GL_HALF_FLOAT, 16, 0, 

Re: [Piglit] [PATCH 6/7] ARB_texture_view: Test for rendering various levels and layers in texture view

2013-10-24 Thread Brian Paul

Another quick review.  Minor things below.


On 10/24/2013 03:49 PM, Jon Ashburn wrote:

Tests GL_ARB_texture_view  rendering with various layers  and levels.
Creates texture maps with different  solid colors for each level or layer,
reads the framebuffer to ensure the rendered color is correct.

Tested on Nvidia  Quadro 600, all subtests pass.
---
  tests/all.tests|   1 +
  tests/spec/arb_texture_view/CMakeLists.gl.txt  |   1 +
  tests/spec/arb_texture_view/rendering_levels.c | 289 +
  3 files changed, 291 insertions(+)
  create mode 100644 tests/spec/arb_texture_view/rendering_levels.c

diff --git a/tests/all.tests b/tests/all.tests
index 5941eb2..a329156 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1477,6 +1477,7 @@ arb_texture_view['formats'] = 
concurrent_test('arb_texture_view-formats')
  arb_texture_view['targets'] = concurrent_test('arb_texture_view-targets')
  arb_texture_view['queries'] = concurrent_test('arb_texture_view-queries')
  arb_texture_view['rendering-target'] = 
concurrent_test('arb_texture_view-rendering-target')
+arb_texture_view['rendering-levels'] = 
concurrent_test('arb_texture_view-rendering-levels')

  tdfx_texture_compression_fxt1 = Group()
  spec['3DFX_texture_compression_FXT1'] = tdfx_texture_compression_fxt1
diff --git a/tests/spec/arb_texture_view/CMakeLists.gl.txt 
b/tests/spec/arb_texture_view/CMakeLists.gl.txt
index 6b69bb1..a39c7dd 100644
--- a/tests/spec/arb_texture_view/CMakeLists.gl.txt
+++ b/tests/spec/arb_texture_view/CMakeLists.gl.txt
@@ -15,5 +15,6 @@ piglit_add_executable(arb_texture_view-formats formats.c 
common.c)
  piglit_add_executable(arb_texture_view-targets targets.c common.c)
  piglit_add_executable(arb_texture_view-queries queries.c)
  piglit_add_executable(arb_texture_view-rendering-target rendering_target.c 
common.c)
+piglit_add_executable(arb_texture_view-rendering-levels rendering_levels.c 
common.c)

  # vim: ft=cmake:
diff --git a/tests/spec/arb_texture_view/rendering_levels.c 
b/tests/spec/arb_texture_view/rendering_levels.c
new file mode 100644
index 000..9748aa9
--- /dev/null
+++ b/tests/spec/arb_texture_view/rendering_levels.c
@@ -0,0 +1,289 @@
+/*
+ * Copyright © 2013 LunarG, 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.
+ *
+ * Author: Jon Ashburn j...@lunarg.com
+ */
+
+/**
+ * Tests GL_ARB_texture_view  rendering with various layers  and levels.
+ * Creates texture maps with different  solid colors for each level or layer,
+ * reads the framebuffer to ensure the rendered color is correct.
+ */
+
+#include piglit-util-gl-common.h
+#include common.h
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 20;
+   config.supports_gl_core_version = 31;
+   config.window_width = 128;
+   config.window_height = 128;


Can you omit width/height and go with the defaults?



+
+   config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+static const char *TestName = arb_texture_view-rendering-levels;
+static int tex_loc_2Darray;
+static int prog2Darray;
+
+/**
+ * Texture views with varying minimum and number of levels, 2D only
+ */
+static bool
+test_render_levels()


(void)



+{
+   GLuint tex, new_tex;
+   GLint width = 4096, height = 4096, levels =13;
+   GLuint numLevels[] = {3,2,2,1};
+   GLint l;
+   int expectedLevel;
+   GLfloat expected[3];
+   int p;
+   bool pass = true;
+
+   glUseProgram(0);
+
+   glGenTextures(1, tex);
+   glBindTexture(GL_TEXTURE_2D, tex);
+
+   glTexStorage2D(GL_TEXTURE_2D, levels, GL_RGBA8, width, height);
+   glEnable(GL_TEXTURE_2D);
+   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+
+   /* load each mipmap with a different color texture */

Re: [Piglit] [PATCH 3/7] ARB_texture_view:Test valid and invalid targets for TextureView

2013-10-24 Thread Brian Paul

In the subject, space after colon.

Reviewed-by: Brian Paul bri...@vmware.com
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 1/7] ARB_texture_view: Test for API coverage of subset of input params

2013-10-24 Thread Brian Paul
   \
+? PIGLIT_PASS : PIGLIT_FAIL, \
+(desc));   \
+   pass = pass  subtest_pass;\
+   } while (0)
+
+
+void
+piglit_init(int argc, char **argv)
+{
+   bool pass = true;
+
+   piglit_require_extension(GL_ARB_texture_storage);
+   piglit_require_extension(GL_ARB_texture_view);
+   piglit_require_extension(GL_EXT_texture_integer);
+   piglit_require_extension(GL_ARB_texture_float);
+   piglit_require_extension(GL_EXT_texture_array);
+
+   X(invalid_texture_param(), Invalid texture or origtexture);
+   X(invalid_layer_param(GL_TEXTURE_1D_ARRAY), Invalid layer param 1D);
+   X(invalid_layer_param(GL_TEXTURE_2D_ARRAY), Invalid layer param 2D);
+   X(invalid_level_param(), Invalid level param);
+   X(levels_clamping(), Minlevel range and numlevel clamp);
+   X(layers_clamping(), Minlayer range and numlayer clamp);
+
+   pass = piglit_check_gl_error(GL_NO_ERROR)  pass;
+   piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
+}



With those changes,
Reviewed-by: Brian Paul bri...@vmware.com

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


Re: [Piglit] [PATCH 5/7] ARB_texture_view: Test for rendering various targets in texture view

2013-10-24 Thread Brian Paul

I didn't really study this test, but some things jumped out...


On 10/24/2013 03:49 PM, Jon Ashburn wrote:

Tests GL_ARB_texture_view rendering with various texture targets.
Creates texture maps with different solid colors for each level or layer
reads the framebuffer to ensure the rendered color is correct.

Tested on Nvidia  Quadro 600, all subtests pass.
---
  tests/all.tests|   1 +
  tests/spec/arb_texture_view/CMakeLists.gl.txt  |   1 +
  tests/spec/arb_texture_view/common.c   | 109 +-
  tests/spec/arb_texture_view/common.h   |  19 +-
  tests/spec/arb_texture_view/rendering_target.c | 269 +
  5 files changed, 396 insertions(+), 3 deletions(-)
  create mode 100644 tests/spec/arb_texture_view/rendering_target.c

diff --git a/tests/all.tests b/tests/all.tests
index 8784e24..5941eb2 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1476,6 +1476,7 @@ arb_texture_view['params'] = 
concurrent_test('arb_texture_view-params')
  arb_texture_view['formats'] = concurrent_test('arb_texture_view-formats')
  arb_texture_view['targets'] = concurrent_test('arb_texture_view-targets')
  arb_texture_view['queries'] = concurrent_test('arb_texture_view-queries')
+arb_texture_view['rendering-target'] = 
concurrent_test('arb_texture_view-rendering-target')

  tdfx_texture_compression_fxt1 = Group()
  spec['3DFX_texture_compression_FXT1'] = tdfx_texture_compression_fxt1
diff --git a/tests/spec/arb_texture_view/CMakeLists.gl.txt 
b/tests/spec/arb_texture_view/CMakeLists.gl.txt
index 6945a05..6b69bb1 100644
--- a/tests/spec/arb_texture_view/CMakeLists.gl.txt
+++ b/tests/spec/arb_texture_view/CMakeLists.gl.txt
@@ -14,5 +14,6 @@ piglit_add_executable(arb_texture_view-params params.c)
  piglit_add_executable(arb_texture_view-formats formats.c common.c)
  piglit_add_executable(arb_texture_view-targets targets.c common.c)
  piglit_add_executable(arb_texture_view-queries queries.c)
+piglit_add_executable(arb_texture_view-rendering-target rendering_target.c 
common.c)

  # vim: ft=cmake:
diff --git a/tests/spec/arb_texture_view/common.c 
b/tests/spec/arb_texture_view/common.c
index f8ecb9e..acbcfad 100644
--- a/tests/spec/arb_texture_view/common.c
+++ b/tests/spec/arb_texture_view/common.c
@@ -36,7 +36,46 @@
   * the variable parameters.
   */

-unsigned int update_valid_arrays(GLenum *valid, GLenum *invalid,
+GLubyte Colors[][8] = {
+   {127,   0,   0, 255,  0, 10, 20,  0},
+   {  0, 127,   0, 255,  0,  0, 80, 90},
+   {  0,   0, 127, 255, 25,  0,  0, 60},
+   {  0, 127, 127, 255, 15, 15,  0,  0},
+   {127,   0, 127, 255,  0,  2, 50,  0},
+   {127, 127,   0, 255, 80, 10, 70, 20},
+   {255,   0,   0, 255, 60,  0, 40, 30},
+   {  0, 255,   0, 255, 50, 20,  2, 40},
+   {  0,   0, 255, 255, 40,  0,  1,  0},
+   {  0, 255, 255, 255, 30,  5,  3,  8},
+   {255,   0, 255, 255, 20, 18,  4,  7},
+   {255, 255,   0, 255,  10, 24, 77, 67},
+   {255, 255, 255, 255,  5,  33, 88, 44}
+};
+
+/**
+ * Create a single-color image. Up to 64 bits per pixel depending upon bytes
+ */
+GLubyte *
+create_solid_image(GLint w, GLint h, GLint d, const unsigned int bytes,
+  const unsigned int idx)
+{
+   GLubyte *buf = (GLubyte *) malloc(w * h * d * bytes);
+   int i,j;
+
+   if (buf == NULL || idx  (sizeof(Colors) / bytes - 1)) {
+   free(buf);
+   return NULL;
+   }
+   for (i = 0; i  w * h * d; i++) {
+   for (j = 0; j  bytes; j++) {
+   buf[i*bytes+j] = Colors[idx][j];
+   }
+   }
+   return buf;
+}
+
+unsigned int
+update_valid_arrays(GLenum *valid, GLenum *invalid,
 unsigned int numInvalid, ... )
  {
va_list args;
@@ -58,3 +97,71 @@ unsigned int update_valid_arrays(GLenum *valid, GLenum 
*invalid,
va_end(args);
return num;
  }
+
+/**
+ * Draw a textured line  from x, y to x+w, y+h. Use tex coordinates 0.0 to 1.0
+ */
+void
+draw_line(float x, float y, float w, float h)
+{
+   GLfloat vertices[6] =  {x, y, 0.0, x+w, y+h, 0.0};
+   GLuint elements[4] = {0, 1};
+   GLfloat texcoords[2] = {0.0, 1.0};
+
+   glVertexPointer(3, GL_FLOAT, 0, vertices);
+   glEnableClientState(GL_VERTEX_ARRAY);
+   glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+   glTexCoordPointer(1, GL_FLOAT, 0, texcoords);
+   glDrawElements(GL_LINES, 2, GL_UNSIGNED_INT, elements);


You could use glDrawArrays and omit the elements array.



+}
+
+/**
+ *  Draw a textured quad, sampling only the given depth  of the 3D texture.
+ *  Use fixed function pipeline.
+ */
+void
+draw_3d_depth_fixed(float x, float y, float w, float h, float depth)
+{
+   glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
+
+   glBegin(GL_QUADS);
+
+   glTexCoord3f(0, 0, 

Re: [Piglit] [PATCH 1/4] ARB_texture_view: Test for API coverage of subset of input params

2013-10-18 Thread Brian Paul

On 10/18/2013 05:06 PM, Jon Ashburn wrote:

Tests GL_ARB_texture_view  and validity of input parameters.
Use both valid and invalid parameters, although mostly invalid
parameters are tested  since other tests will use valid parameters.
Only the parameters  texture, origtexture, minlevel, numlevels,
minlayer, numlayers  are tested for validity  as per section 8.18 of
OpenGL 4.3 Core spec.

Tested on Nvidia Quadro 600 and it passes.
---
  tests/all.tests   |   5 +
  tests/spec/arb_texture_view/CMakeLists.gl.txt |   1 +
  tests/spec/arb_texture_view/params.c  | 341 ++
  3 files changed, 347 insertions(+)
  create mode 100644 tests/spec/arb_texture_view/params.c

diff --git a/tests/all.tests b/tests/all.tests
index c919f19..2bb6aed 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1469,6 +1469,11 @@ spec['ARB_texture_storage_multisample'] = 
arb_texture_storage_multisample
  arb_texture_storage_multisample['tex-storage'] = 
concurrent_test('arb_texture_storage_multisample-tex-storage')
  arb_texture_storage_multisample['tex-param'] = 
concurrent_test('arb_texture_storage_multisample-tex-param')

+arb_texture_view = Group()
+spec['ARB_texture_view'] = arb_texture_view
+arb_texture_view['immutable_levels'] = 
concurrent_test('arb_texture_view-texture-immutable-levels')
+arb_texture_view['params'] = concurrent_test('arb_texture_view-params')
+
  tdfx_texture_compression_fxt1 = Group()
  spec['3DFX_texture_compression_FXT1'] = tdfx_texture_compression_fxt1
  add_concurrent_test(tdfx_texture_compression_fxt1, 'compressedteximage 
GL_COMPRESSED_RGB_FXT1_3DFX')
diff --git a/tests/spec/arb_texture_view/CMakeLists.gl.txt 
b/tests/spec/arb_texture_view/CMakeLists.gl.txt
index c400759..4f2b1ef 100644
--- a/tests/spec/arb_texture_view/CMakeLists.gl.txt
+++ b/tests/spec/arb_texture_view/CMakeLists.gl.txt
@@ -10,5 +10,6 @@ link_libraries(
)

  piglit_add_executable(arb_texture_view-texture-immutable-levels 
texture-immutable-levels.c)
+piglit_add_executable(arb_texture_view-params params.c)

  # vim: ft=cmake:
diff --git a/tests/spec/arb_texture_view/params.c 
b/tests/spec/arb_texture_view/params.c
new file mode 100644
index 000..35de9b2
--- /dev/null
+++ b/tests/spec/arb_texture_view/params.c
@@ -0,0 +1,341 @@
+/*
+ * Copyright © 2013 LunarG, 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.
+ *
+ * Author: Jon Ashburn j...@lunarg.com
+ */
+
+/**
+ * Tests GL_ARB_texture_view  and validity of input parameters.
+ * Use both valid and invalid parameters, although mostly invalid
+ * parameters are tested  since other tests use valid parameters.
+ * Only the parameters  texture, origtexture, minlevel, numlevels,
+ * minlayer, numlayers  are tested for validity  as per section 8.18 of
+ * OpenGL 4.3 Core spec.
+ * Tests formats.c and targets.c test the valid and invalid format  and
+ * target input parameters respectively.
+ *
+ */
+
+#include piglit-util-gl-common.h
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 10;
+   config.supports_gl_core_version = 31;
+
+   config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+static const char *TestName = arb_texture_view-params;
+
+/**
+ * Test TextureView with various invalid arguments for texture
+ * and origtexture.
+ * Errors as per OpenGL core 4.3 spec section 8.18:
+ * An INVALID_VALUE error is generated if origtexture is not the
+ * name of a texture.
+ * An INVALID_OPERATION error is generated if the value of
+ * TEXTURE_IMMUTABLE_FORMAT for origtexture is not TRUE.
+ * An INVALID_VALUE error is generated if texture is zero.
+ * An INVALID_OPERATION error is generated if texture is not a valid name
+ * returned by GenTextures, or if texture has already been bound and
+ * given a target.
+ */
+static bool

Re: [Piglit] [PATCH 2/4] arb_texture_view: Test valid and invalid formats

2013-10-18 Thread Brian Paul

The same formatting nitpicks from patch 1 apply to this patch and #3.

More below.

On 10/18/2013 05:06 PM, Jon Ashburn wrote:

When calling glTextureView() only certain formats are valid based on the format
of the original texture. This tests valid/invalid combinations.

Tested on Nvidia Quadro 600, all tests pass.
---
  tests/all.tests   |   1 +
  tests/spec/arb_texture_view/CMakeLists.gl.txt |   1 +
  tests/spec/arb_texture_view/common.c  |  60 +
  tests/spec/arb_texture_view/common.h  |  28 +++
  tests/spec/arb_texture_view/formats.c | 318 ++
  5 files changed, 408 insertions(+)
  create mode 100644 tests/spec/arb_texture_view/common.c
  create mode 100644 tests/spec/arb_texture_view/common.h
  create mode 100644 tests/spec/arb_texture_view/formats.c

diff --git a/tests/all.tests b/tests/all.tests
index 2bb6aed..4d089b4 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1473,6 +1473,7 @@ arb_texture_view = Group()
  spec['ARB_texture_view'] = arb_texture_view
  arb_texture_view['immutable_levels'] = 
concurrent_test('arb_texture_view-texture-immutable-levels')
  arb_texture_view['params'] = concurrent_test('arb_texture_view-params')
+arb_texture_view['formats'] = concurrent_test('arb_texture_view-formats')

  tdfx_texture_compression_fxt1 = Group()
  spec['3DFX_texture_compression_FXT1'] = tdfx_texture_compression_fxt1
diff --git a/tests/spec/arb_texture_view/CMakeLists.gl.txt 
b/tests/spec/arb_texture_view/CMakeLists.gl.txt
index 4f2b1ef..44b6a64 100644
--- a/tests/spec/arb_texture_view/CMakeLists.gl.txt
+++ b/tests/spec/arb_texture_view/CMakeLists.gl.txt
@@ -11,5 +11,6 @@ link_libraries(

  piglit_add_executable(arb_texture_view-texture-immutable-levels 
texture-immutable-levels.c)
  piglit_add_executable(arb_texture_view-params params.c)
+piglit_add_executable(arb_texture_view-formats formats.c common.c)

  # vim: ft=cmake:
diff --git a/tests/spec/arb_texture_view/common.c 
b/tests/spec/arb_texture_view/common.c
new file mode 100644
index 000..d45295a
--- /dev/null
+++ b/tests/spec/arb_texture_view/common.c
@@ -0,0 +1,60 @@
+/*
+ * Copyright © 2013 LunarG, 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.
+ *
+ * Author: Jon Ashburn j...@lunarg.com
+ */
+
+#include GL/gl.h
+#include stdarg.h
+
+/**
+ * This function takes an array of valid and invalid GLenums.  The invalid
+ * enums array starts fully populated and the valid  array is empty.
+ * It adds the varargs GLenum values to the valid array and removes  them
+ * from the invalid array.
+ * @param numInvalid  the size of array invalid
+ * An variable argument equal to zero will signal the end of
+ * the variable parameters.
+ */
+
+unsigned int update_valid_arrays(GLenum *valid, GLenum *invalid,
+unsigned int numInvalid, ... )
+{
+   va_list args;
+   GLenum val;
+   unsigned int j, num;
+
+   va_start(args, numInvalid);
+   val = va_arg(args, GLenum);
+   num = 0;
+   while (val) {
+   valid[num++] = val;
+   /* remove the valid enum from the invalid array */
+   for (j= 0; j  numInvalid; j++) {
+   if (invalid[j] == val)
+   invalid[j] = 0;
+   }
+   val = va_arg(args, GLenum);
+   }
+   va_end(args);
+   return num;
+}
diff --git a/tests/spec/arb_texture_view/common.h 
b/tests/spec/arb_texture_view/common.h
new file mode 100644
index 000..1ffcaea
--- /dev/null
+++ b/tests/spec/arb_texture_view/common.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright © 2013 LunarG, 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, 

Re: [Piglit] [PATCH 2/3] arb_texture_view: Test valid and invalid formats

2013-10-17 Thread Brian Paul

On 10/16/2013 05:37 PM, Jon Ashburn wrote:

When calling glTextureView() only certain formats are valid based on the format
of the original texture. This tests valid/invalid combinations.

Tested on Nvidia Quadro 600, all tests pass.
---
  tests/all.tests   |   1 +
  tests/spec/arb_texture_view/CMakeLists.gl.txt |   1 +
  tests/spec/arb_texture_view/common.c  |  48 
  tests/spec/arb_texture_view/formats.c | 309 ++
  4 files changed, 359 insertions(+)
  create mode 100644 tests/spec/arb_texture_view/common.c
  create mode 100644 tests/spec/arb_texture_view/formats.c

diff --git a/tests/all.tests b/tests/all.tests
index 2bb6aed..4d089b4 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1473,6 +1473,7 @@ arb_texture_view = Group()
  spec['ARB_texture_view'] = arb_texture_view
  arb_texture_view['immutable_levels'] = 
concurrent_test('arb_texture_view-texture-immutable-levels')
  arb_texture_view['params'] = concurrent_test('arb_texture_view-params')
+arb_texture_view['formats'] = concurrent_test('arb_texture_view-formats')

  tdfx_texture_compression_fxt1 = Group()
  spec['3DFX_texture_compression_FXT1'] = tdfx_texture_compression_fxt1
diff --git a/tests/spec/arb_texture_view/CMakeLists.gl.txt 
b/tests/spec/arb_texture_view/CMakeLists.gl.txt
index 4f2b1ef..44b6a64 100644
--- a/tests/spec/arb_texture_view/CMakeLists.gl.txt
+++ b/tests/spec/arb_texture_view/CMakeLists.gl.txt
@@ -11,5 +11,6 @@ link_libraries(

  piglit_add_executable(arb_texture_view-texture-immutable-levels 
texture-immutable-levels.c)
  piglit_add_executable(arb_texture_view-params params.c)
+piglit_add_executable(arb_texture_view-formats formats.c common.c)

  # vim: ft=cmake:
diff --git a/tests/spec/arb_texture_view/common.c 
b/tests/spec/arb_texture_view/common.c
new file mode 100644
index 000..c5f5a23
--- /dev/null
+++ b/tests/spec/arb_texture_view/common.c
@@ -0,0 +1,48 @@
+/*
+ * Copyright © 2013 LunarG, 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.
+ *
+ * Author: Jon Ashburn j...@lunarg.com
+ */
+
+#include GL/gl.h
+#include stdarg.h
+
+


I think this function could use a comment to indicate what it does.


+void update_valid_arrays(GLenum *valid, GLenum *invalid,
+unsigned int numInvalid, 
unsigned int numValid, ... )


Too much indentation for the second line there.


+{
+   va_list args;
+   GLenum val;
+   unsigned int i,j;
+
+   va_start(args, numValid);
+   for (i = 0; i  numValid; i++) {
+   val = va_arg(args, GLenum);
+   valid[i] = val;
+   /* remove the valid enum from the invalid array */
+   for (j= 0; j  numInvalid; j++) {
+   if (invalid[j] == val)
+   invalid[j] = 0;
+   }
+   }
+   va_end(args);
+}
diff --git a/tests/spec/arb_texture_view/formats.c 
b/tests/spec/arb_texture_view/formats.c
new file mode 100644
index 000..96c3a3e
--- /dev/null
+++ b/tests/spec/arb_texture_view/formats.c
@@ -0,0 +1,309 @@
+/*
+ * Copyright © 2013 LunarG, 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 

Re: [Piglit] [PATCH 3/3] ARB_texture_view:Test valid and invalid targets for TextureView

2013-10-17 Thread Brian Paul

On 10/16/2013 05:37 PM, Jon Ashburn wrote:

The new target supplied with textureView must be compatible with the
original textures target. This tests  valid and invalid combinations.

Tested on Nvidia Quadro 600, all tests pass.
---
  tests/all.tests   |   1 +
  tests/spec/arb_texture_view/CMakeLists.gl.txt |   1 +
  tests/spec/arb_texture_view/targets.c | 234 ++
  3 files changed, 236 insertions(+)
  create mode 100644 tests/spec/arb_texture_view/targets.c

diff --git a/tests/all.tests b/tests/all.tests
index 4d089b4..83d53c6 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1474,6 +1474,7 @@ spec['ARB_texture_view'] = arb_texture_view
  arb_texture_view['immutable_levels'] = 
concurrent_test('arb_texture_view-texture-immutable-levels')
  arb_texture_view['params'] = concurrent_test('arb_texture_view-params')
  arb_texture_view['formats'] = concurrent_test('arb_texture_view-formats')
+arb_texture_view['targets'] = concurrent_test('arb_texture_view-targets')

  tdfx_texture_compression_fxt1 = Group()
  spec['3DFX_texture_compression_FXT1'] = tdfx_texture_compression_fxt1
diff --git a/tests/spec/arb_texture_view/CMakeLists.gl.txt 
b/tests/spec/arb_texture_view/CMakeLists.gl.txt
index 44b6a64..193aff9 100644
--- a/tests/spec/arb_texture_view/CMakeLists.gl.txt
+++ b/tests/spec/arb_texture_view/CMakeLists.gl.txt
@@ -12,5 +12,6 @@ link_libraries(
  piglit_add_executable(arb_texture_view-texture-immutable-levels 
texture-immutable-levels.c)
  piglit_add_executable(arb_texture_view-params params.c)
  piglit_add_executable(arb_texture_view-formats formats.c common.c)
+piglit_add_executable(arb_texture_view-targets targets.c common.c)

  # vim: ft=cmake:
diff --git a/tests/spec/arb_texture_view/targets.c 
b/tests/spec/arb_texture_view/targets.c
new file mode 100644
index 000..d2c0c19
--- /dev/null
+++ b/tests/spec/arb_texture_view/targets.c
@@ -0,0 +1,234 @@
+/*
+ * Copyright © 2013 LunarG, 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.
+ *
+ * Author: Jon Ashburn j...@lunarg.com
+ */
+
+/**
+ * \file
+ * This (arb_texture_view-targets) tests valid and invalid new TextureView
+ * targets based on the original textures target.
+ *
+ * Section 8.18 (Texture Views) of OpenGL 4.3 Core says:
+ *The new texture’s target must be compatible with the target of
+ * origtexture, as defined by table 8.20.
+ *
+ */
+
+#include piglit-util-gl-common.h
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 12;
+   config.supports_gl_core_version = 31;
+
+   config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+static const char *TestName = arb_texture_view-targets;
+
+



You're calling update_valid_arrays() below but I don't see a declaration 
for it like in the format test.  I think common.h would be good.




+/**
+ * Do error-check tests for texture targets
+ */
+static bool
+test_target_errors(GLenum target)
+{
+   GLint width = 64, height = 14, depth = 8;
+   const GLsizei levels = 1;
+   GLuint tex;
+   enum piglit_result pass = true;


bool pass = true;



+   GLenum legalTargets[4];


Magic number 4?



+   unsigned int numTargets, i;
+   GLenum illegalTargets[] = {


static const?



+   /* skip multisample */
+   GL_TEXTURE_1D,
+   GL_TEXTURE_2D,
+   GL_TEXTURE_3D,
+   GL_TEXTURE_CUBE_MAP,
+   GL_TEXTURE_RECTANGLE,
+   GL_TEXTURE_1D_ARRAY,
+   GL_TEXTURE_2D_ARRAY,
+   GL_TEXTURE_CUBE_MAP_ARRAY,
+   };
+
+   /* skip 2d_multisample  targets for now */
+   assert(target == GL_TEXTURE_1D ||
+  target == GL_TEXTURE_2D ||
+  target == GL_TEXTURE_3D ||
+  target == GL_TEXTURE_CUBE_MAP ||
+  target == 

Re: [Piglit] [PATCH] Add new test for calling glGenQueries/glDeleteQueries with an active query

2013-10-17 Thread Brian Paul

On 10/17/2013 12:14 PM, Carl Worth wrote:

It is legal to gen and delete a new object while another object is active.

It is also legal to delete the currently active object.

Ensure that both of these operations can be performed without any error.
---
  tests/all.tests|  1 +
  tests/spec/ext_timer_query/CMakeLists.gl.txt   |  1 +
  .../spec/ext_timer_query/gen-delete-while-active.c | 92 ++
  3 files changed, 94 insertions(+)
  create mode 100644 tests/spec/ext_timer_query/gen-delete-while-active.c

diff --git a/tests/all.tests b/tests/all.tests
index c919f19..c8b2b31 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -2176,6 +2176,7 @@ arb_timer_query = Group()
  spec['ARB_timer_query'] = arb_timer_query
  arb_timer_query['query GL_TIMESTAMP'] = 
concurrent_test('ext_timer_query-time-elapsed timestamp')
  arb_timer_query['query-lifetime'] = 
concurrent_test('ext_timer_query-lifetime')
+arb_timer_query['gen-delete-while-active'] = 
concurrent_test('ext_timer_query-gen-delete-while-active')
  arb_timer_query['timestamp-get'] = 
concurrent_test('arb_timer_query-timestamp-get')

  ext_transform_feedback = Group()
diff --git a/tests/spec/ext_timer_query/CMakeLists.gl.txt 
b/tests/spec/ext_timer_query/CMakeLists.gl.txt
index f7019ad..8d4a452 100644
--- a/tests/spec/ext_timer_query/CMakeLists.gl.txt
+++ b/tests/spec/ext_timer_query/CMakeLists.gl.txt
@@ -14,3 +14,4 @@ IF (UNIX)
  ENDIF (UNIX)

   piglit_add_executable (ext_timer_query-lifetime lifetime.c)
+ piglit_add_executable (ext_timer_query-gen-delete-while-active 
gen-delete-while-active.c)
diff --git a/tests/spec/ext_timer_query/gen-delete-while-active.c 
b/tests/spec/ext_timer_query/gen-delete-while-active.c
new file mode 100644
index 000..7a87f90
--- /dev/null
+++ b/tests/spec/ext_timer_query/gen-delete-while-active.c
@@ -0,0 +1,92 @@
+/*
+ * Copyright © 2009,2012,2013 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.
+ *
+ * Authors:
+ *Ian Romanick ian.d.roman...@intel.com
+ *Carl Worth cwo...@cworth.org
+ */
+
+/**
+ * \file gen-delete-while-active.c
+ *
+ * Ensure that both glGenQueries and glDeleteQuery can be called on a
+ * new object while another query object is active. Also, that
+ * glDeleteQuery can be called on an active query object.
+ */
+
+#include piglit-util-gl-common.h
+
+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
+
+enum piglit_result
+piglit_display(void)
+{
+   GLuint active, inactive;
+   GLint elapsed, done;
+
+   piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
+   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+   /* Generate and start a query. */
+   glGenQueries(1, active);
+
+   glBeginQuery(GL_TIME_ELAPSED, active);
+
+   /* While first query is active, gen a new one. */
+   glGenQueries(1, inactive);
+
+   /* Delete the inactive query. */
+   glDeleteQueries(1, inactive);
+   
+   /* Finish and get result from active query. */
+   glEndQuery(GL_TIME_ELAPSED);
+
+   do {
+   glGetQueryObjectiv(active, GL_QUERY_RESULT_AVAILABLE, done);
+   } while (! done);
+
+   glGetQueryObjectiv(active, GL_QUERY_RESULT, elapsed);
+
+   /* Finally, ensure that an active query can be deleted. */
+   glGenQueries(1, active);
+
+   glBeginQuery(GL_TIME_ELAPSED, active);
+
+   glDeleteQueries(1, active);
+
+   if (piglit_check_gl_error(GL_NO_ERROR))
+   return PIGLIT_PASS;
+   else
+   return PIGLIT_FAIL;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+   piglit_require_extension(GL_ARB_timer_query);
+}



If we decide that removing the Mesa error checks is correct, this 

[Piglit] [PATCH] arb_texture_storage: add some cube map error tests

2013-10-14 Thread Brian Paul
Test error checking for width != height and depth % 6 != 0 for cube arrays.
---
 tests/spec/arb_texture_storage/texture-storage.c |   66 ++
 1 file changed, 66 insertions(+)

diff --git a/tests/spec/arb_texture_storage/texture-storage.c 
b/tests/spec/arb_texture_storage/texture-storage.c
index 201929d..a9db70e 100644
--- a/tests/spec/arb_texture_storage/texture-storage.c
+++ b/tests/spec/arb_texture_storage/texture-storage.c
@@ -221,6 +221,68 @@ test_mipmap_errors(GLenum target)
 }
 
 
+static enum piglit_result
+test_cube_texture(void)
+{
+   const GLint width = 16, height = 16;
+   const GLenum target = GL_TEXTURE_CUBE_MAP;
+   GLuint tex;
+
+   /* Test valid cube dimensions */
+   glGenTextures(1, tex);
+   glBindTexture(target, tex);
+   glTexStorage2D(target, 1, GL_RGBA8, width, height);
+   if (!piglit_check_gl_error(GL_NO_ERROR))
+   return PIGLIT_FAIL;
+   glDeleteTextures(1, tex);
+
+   /* Test invalid cube dimensions */
+   glGenTextures(1, tex);
+   glBindTexture(target, tex);
+   glTexStorage2D(target, 1, GL_RGBA8, width, height+2);
+   if (!piglit_check_gl_error(GL_INVALID_VALUE))
+   return PIGLIT_FAIL;
+   glDeleteTextures(1, tex);
+
+   return PIGLIT_PASS;
+}
+
+
+static enum piglit_result
+test_cube_array_texture(void)
+{
+   const GLint width = 16, height = 16;
+   const GLenum target = GL_TEXTURE_CUBE_MAP_ARRAY;
+   GLuint tex;
+
+   /* Test valid cube array dimensions */
+   glGenTextures(1, tex);
+   glBindTexture(target, tex);
+   glTexStorage3D(target, 1, GL_RGBA8, width, height, 12);
+   if (!piglit_check_gl_error(GL_NO_ERROR))
+   return PIGLIT_FAIL;
+   glDeleteTextures(1, tex);
+
+   /* Test invalid cube array width, height dimensions */
+   glGenTextures(1, tex);
+   glBindTexture(target, tex);
+   glTexStorage3D(target, 1, GL_RGBA8, width, height+3, 12);
+   if (!piglit_check_gl_error(GL_INVALID_VALUE))
+   return PIGLIT_FAIL;
+   glDeleteTextures(1, tex);
+
+   /* Test invalid cube array depth */
+   glGenTextures(1, tex);
+   glBindTexture(target, tex);
+   glTexStorage3D(target, 1, GL_RGBA8, width, height, 12+2);
+   if (!piglit_check_gl_error(GL_INVALID_VALUE))
+   return PIGLIT_FAIL;
+   glDeleteTextures(1, tex);
+
+   return PIGLIT_PASS;
+}
+
+
 /**
  * Create a single-color image.
  */
@@ -484,6 +546,10 @@ piglit_display(void)
X(test_2d_mipmap_rendering(), 2D mipmap rendering);
X(test_internal_formats(), internal formats);
X(test_immutablity(GL_TEXTURE_2D), immutability);
+   X(test_cube_texture(), cube texture);
+   if (piglit_is_extension_supported(GL_ARB_texture_cube_map_array)) {
+   X(test_cube_array_texture(), cube array texture);
+   }
 #undef X
return pass;
 }
-- 
1.7.10.4

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


[Piglit] [PATCH] fbo-alphatest-formats: silence piglit_report_subtest_result() format warnings

2013-09-27 Thread Brian Paul
silences tests/fbo/fbo-alphatest-formats.c:184:3: warning: format not
a string literal and no format arguments [-Wformat-security]

---

A number of tests are generating this warning.  If there's no objection,
I'll clean up the other tests too.
---
 tests/fbo/fbo-alphatest-formats.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/fbo/fbo-alphatest-formats.c 
b/tests/fbo/fbo-alphatest-formats.c
index e3c3827..59881c2 100644
--- a/tests/fbo/fbo-alphatest-formats.c
+++ b/tests/fbo/fbo-alphatest-formats.c
@@ -181,7 +181,7 @@ static enum piglit_result test_format(const struct 
format_desc *format)
if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
printf(- fbo incomplete (status = %s)\n,
   piglit_get_gl_enum_name(status));
-   piglit_report_subtest_result(PIGLIT_SKIP, format-name);
+   piglit_report_subtest_result(PIGLIT_SKIP, %s, format-name);
return PIGLIT_SKIP;
}
 printf(\n);
@@ -254,7 +254,7 @@ static enum piglit_result test_format(const struct 
format_desc *format)
 
if (!pass) {
piglit_present_results();
-   piglit_report_subtest_result(PIGLIT_FAIL, format-name);
+   piglit_report_subtest_result(PIGLIT_FAIL, %s, format-name);
return PIGLIT_FAIL;
}
 
@@ -316,7 +316,7 @@ static enum piglit_result test_format(const struct 
format_desc *format)
piglit_present_results();
 
piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL,
-format-name);
+%s, format-name);
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
 
-- 
1.7.10.4

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


[Piglit] [PATCH 1/5] piglit: silence piglit_report_subtest_result() format warnings

2013-09-27 Thread Brian Paul
silences a bunch of warnings such as:
tests/fbo/fbo-alphatest-formats.c:184:3: warning: format not
a string literal and no format arguments [-Wformat-security]
---
 tests/fbo/fbo-alphatest-formats.c|6 +++---
 tests/fbo/fbo-blending-formats.c |6 +++---
 tests/fbo/fbo-clear-formats.c|2 +-
 tests/fbo/fbo-colormask-formats.c|2 +-
 tests/fbo/fbo-incomplete.cpp |2 +-
 tests/fbo/fbo-readpixels-depth-formats.c |2 +-
 tests/fbo/fbo-storage-formats.c  |6 +++---
 tests/general/linestipple.c  |4 ++--
 tests/spec/amd_performance_monitor/measure.c |   14 +++---
 tests/spec/arb_texture_buffer_object/formats.c   |2 +-
 tests/spec/arb_texture_multisample/fb-completeness.c |2 +-
 .../spec/arb_texture_multisample/negative-max-samples.c  |2 +-
 tests/spec/arb_texture_storage_multisample/tex-param.c   |   10 +-
 tests/spec/gl-1.0/beginend-coverage.c|2 +-
 tests/spec/gl-1.0/rendermode-feedback.c  |4 ++--
 15 files changed, 33 insertions(+), 33 deletions(-)

diff --git a/tests/fbo/fbo-alphatest-formats.c 
b/tests/fbo/fbo-alphatest-formats.c
index e3c3827..59881c2 100644
--- a/tests/fbo/fbo-alphatest-formats.c
+++ b/tests/fbo/fbo-alphatest-formats.c
@@ -181,7 +181,7 @@ static enum piglit_result test_format(const struct 
format_desc *format)
if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
printf(- fbo incomplete (status = %s)\n,
   piglit_get_gl_enum_name(status));
-   piglit_report_subtest_result(PIGLIT_SKIP, format-name);
+   piglit_report_subtest_result(PIGLIT_SKIP, %s, format-name);
return PIGLIT_SKIP;
}
 printf(\n);
@@ -254,7 +254,7 @@ static enum piglit_result test_format(const struct 
format_desc *format)
 
if (!pass) {
piglit_present_results();
-   piglit_report_subtest_result(PIGLIT_FAIL, format-name);
+   piglit_report_subtest_result(PIGLIT_FAIL, %s, format-name);
return PIGLIT_FAIL;
}
 
@@ -316,7 +316,7 @@ static enum piglit_result test_format(const struct 
format_desc *format)
piglit_present_results();
 
piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL,
-format-name);
+%s, format-name);
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
 
diff --git a/tests/fbo/fbo-blending-formats.c b/tests/fbo/fbo-blending-formats.c
index 37c32ef..50b2d0a 100644
--- a/tests/fbo/fbo-blending-formats.c
+++ b/tests/fbo/fbo-blending-formats.c
@@ -289,7 +289,7 @@ static enum piglit_result test_format(const struct 
format_desc *format)
if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
printf( - fbo incomplete (status = %s)\n,
   piglit_get_gl_enum_name(status));
-   piglit_report_subtest_result(PIGLIT_SKIP, format-name);
+   piglit_report_subtest_result(PIGLIT_SKIP, %s, format-name);
return PIGLIT_SKIP;
}
 printf(\n);
@@ -350,7 +350,7 @@ static enum piglit_result test_format(const struct 
format_desc *format)
 
if (!pass) {
piglit_present_results();
-   piglit_report_subtest_result(PIGLIT_FAIL, format-name);
+   piglit_report_subtest_result(PIGLIT_FAIL, %s, format-name);
return PIGLIT_FAIL;
}
 
@@ -403,7 +403,7 @@ static enum piglit_result test_format(const struct 
format_desc *format)
piglit_present_results();
 
piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL,
-format-name);
+%s, format-name);
 
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
diff --git a/tests/fbo/fbo-clear-formats.c b/tests/fbo/fbo-clear-formats.c
index 8ee8e97..7a68f23 100644
--- a/tests/fbo/fbo-clear-formats.c
+++ b/tests/fbo/fbo-clear-formats.c
@@ -565,7 +565,7 @@ test_format(const struct format_desc *format)
glDeleteTextures(1, tex);
 
piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL,
-format-name);
+%s, format-name);
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
 
diff --git a/tests/fbo/fbo-colormask-formats.c 
b/tests/fbo/fbo-colormask-formats.c
index d842e4f..f6a951d 100644
--- a/tests/fbo/fbo-colormask-formats.c
+++ b/tests/fbo/fbo-colormask-formats.c
@@ -218,7 +218,7 @@ static enum piglit_result test_format(const struct 
format_desc *format)
piglit_present_results();
 
piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL,
-format-name);
+   

[Piglit] [PATCH 3/5] glean: silence unused var compiler warning

2013-09-27 Thread Brian Paul
---
 tests/glean/tshaderapi.cpp |1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/glean/tshaderapi.cpp b/tests/glean/tshaderapi.cpp
index 5111c30..fcd6547 100644
--- a/tests/glean/tshaderapi.cpp
+++ b/tests/glean/tshaderapi.cpp
@@ -440,6 +440,7 @@ ShaderAPITest::test_uniform_neg_location(void)
GLfloat data[4];
 
program = make_program(#version 110\nvoid main() { gl_Position = 
vec4(1.0, 1.0, 1.0, 1.0); }\n, NULL);
+   (void) program;
assert_no_error();
glUniform1i_func(-1, 1);
assert_no_error();
-- 
1.7.10.4

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


[Piglit] [PATCH 4/5] layered-2d-texture-render: add const qualifiers to silence warnings

2013-09-27 Thread Brian Paul
---
 tests/spec/amd_vertex_shader_layer/layered-2d-texture-render.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/spec/amd_vertex_shader_layer/layered-2d-texture-render.c 
b/tests/spec/amd_vertex_shader_layer/layered-2d-texture-render.c
index 88a2bfa..71fc249 100644
--- a/tests/spec/amd_vertex_shader_layer/layered-2d-texture-render.c
+++ b/tests/spec/amd_vertex_shader_layer/layered-2d-texture-render.c
@@ -123,7 +123,7 @@ static int get_y(int layer, int lod)
return PAD + (((1  lod) - 1) * 2 * size);
 }
 
-static GLfloat *get_color(int num)
+static const GLfloat *get_color(int num)
 {
int color_index;
 
@@ -234,7 +234,7 @@ test_results(int layer, int lod)
 {
int x = get_x(layer);
int y = get_y(layer, lod);
-   GLfloat *expected_color3f = get_color((lod * LAYERS) + layer);
+   const GLfloat *expected_color3f = get_color((lod * LAYERS) + layer);
GLboolean pass;
int size = SIZE  lod;
 
-- 
1.7.10.4

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


[Piglit] genmipmap-errors test

2013-09-13 Thread Brian Paul


Anuj,

Your genmipmap-errors test checks if glGenerateMipmaps raises 
GL_INVALID_OPERATION for integer and depth/stencil texture formats.


Can you tell me which version of the GL spec or extension describes this?

genmipmap-errors fails with NVIDIA's OpenGL 4.2 since it does not raise 
any errors for glGenerateMipmaps(integer texture).


I'm wondering if that error check was lifted in some version of GL.

The man page at 
http://www.opengl.org/sdk/docs/man/xhtml/glGenerateMipmap.xml doesn't 
say that integer textures should raise an error.


I seem to remember some ARB discussion about the validity of integer 
mipmap generation but I don't remember the outcome.


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


[Piglit] [PATCH] arb_internalformat_query-minmax: add more version/ext checking

2013-09-13 Thread Brian Paul
The valid_formats[] list includes formats supported either by
GL 3.0 or GL_EXT_texture_float and GL_EXT_texture_rg.
---
 tests/spec/arb_internalformat_query/minmax.c |6 ++
 1 file changed, 6 insertions(+)

diff --git a/tests/spec/arb_internalformat_query/minmax.c 
b/tests/spec/arb_internalformat_query/minmax.c
index c15b954..0266451 100644
--- a/tests/spec/arb_internalformat_query/minmax.c
+++ b/tests/spec/arb_internalformat_query/minmax.c
@@ -243,6 +243,12 @@ piglit_init(int argc, char **argv)
piglit_require_extension(GL_ARB_framebuffer_object);
piglit_require_extension(GL_ARB_internalformat_query);
 
+   /* Need GL 3 or extensions to support the valid_formats[] above */
+if (piglit_get_gl_version()  30) {
+   piglit_require_extension(GL_ARB_texture_rg);
+   piglit_require_extension(GL_ARB_texture_float);
+   }
+
glGetIntegerv(GL_MAX_SAMPLES, max_samples);
for (i = 0; i  ARRAY_SIZE(valid_formats); i++) {
pass = try(GL_RENDERBUFFER,
-- 
1.7.10.4

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


[Piglit] [PATCH] ext_texture_array/compressed: check for GL_EXT_texture_array

2013-09-13 Thread Brian Paul
We obviously should require this extension.
---
 tests/spec/ext_texture_array/compressed.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/spec/ext_texture_array/compressed.c 
b/tests/spec/ext_texture_array/compressed.c
index c964fd7..7f87b62 100644
--- a/tests/spec/ext_texture_array/compressed.c
+++ b/tests/spec/ext_texture_array/compressed.c
@@ -185,6 +185,7 @@ piglit_init(int argc, char **argv)
piglit_require_gl_version(21);
piglit_require_extension(GL_ARB_texture_compression);
piglit_require_extension(GL_EXT_texture_compression_s3tc);
+   piglit_require_extension(GL_EXT_texture_array);
 #endif
 
/* We're using texture unit 0 for this entire test */
-- 
1.7.10.4

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


Re: [Piglit] [PATCH v2] KHR_debug: test ObjectLabel(), GetObjectLabel(), ObjectPtrLabel() and GetObjectPtrLabel()

2013-08-26 Thread Brian Paul
-terminated. The actual number of
+* characters written into label,
+* excluding the null terminator, is returned in length.
+*/
+   glBindBuffer(GL_ARRAY_BUFFER, buffers[4]);
+   glObjectLabel(GL_BUFFER, buffers[4], -1, Test Label);
+   glGetObjectLabel(GL_BUFFER, buffers[4], 12, length, label);
+
+   if (length != 10 || (strcmp(Test Label, label) != 0)) {
+  puts(Label or length does not match);
+  printf(  actual label: %s actual length: %i\n, label, length);
+  puts(  expected label: Test Label expected length: 10);
+  pass = false;
+   }
+
+   /* An INVALID_ENUM error is generated by GetObjectLabel if identifier is not
+* one of the valid object types
+*/
+   glGetObjectLabel(GL_ARRAY_BUFFER, buffers[4], 11, length, label);
+
+   if (!piglit_check_gl_error(GL_INVALID_ENUM)) {
+  puts(  GL_INVALID_ENUM should be genereated when GetObjectLabel identifier 
is invalid);
+  pass = false;
+   }
+
+   /* An INVALID_VALUE error is generated by GetObjectLabel if name is not
+* the name of a valid object of the type specified by identifier.
+*/
+   invalidBufferName = buffers[4];
+   glDeleteBuffers(numBuffers, buffers);
+   glGetObjectLabel(GL_BUFFER, invalidBufferName, 11, length, label);
+
+   if (!piglit_check_gl_error(GL_INVALID_VALUE)) {
+  puts(  GL_INVALID_VALUE should be genereated when GetObjectLabel name is 
invalid);
+  pass = false;
+   }
+
+   return pass;
+}
+
+void piglit_init(int argc, char **argv)
+{
+   bool pass = true;
+
+   piglit_automatic = GL_TRUE;


Is that necessary?



+   piglit_require_extension(GL_KHR_debug);
+
+   if (!piglit_check_gl_error(GL_NO_ERROR))
+  pass = false;
+
+   pass = test_object_label()  pass;
+   pass = test_get_object_label()  pass;
+   if (piglit_is_extension_supported(GL_ARB_sync))
+  pass = test_object_ptr_label()  pass;
+
+   piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
+}



One other things, we try to use tabs (set to 8 columns) for indentation 
in piglit.


Reviewed-by: Brian Paul bri...@vmware.com

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


Re: [Piglit] [PATCH] glsl-1.10 / glsl-1.20: Relax precision requirements of variable indexing tests

2013-08-22 Thread Brian Paul

On 08/21/2013 09:44 PM, Ian Romanick wrote:

From: Ian Romanick ian.d.roman...@intel.com

Many of these tests fail on older GPU such as Intel i915 due to the
precision requirement.  This is because many GPUs in this class only use
24-bit floats.  Many also implement many instructions cheaply (with poor
precision).

Do a couple things to relax the precision requirement.  First, use the
distance squared instead of the distance.  This saves an
inverse-square-root and a multiple.  The inverse-square-root has
notoriously poor precision on old GPUs.  Second, pick a precision that
passes on at least one 24-bit float GPU.  I picked 4e-9 because that was
the smallest bound that would pass on i915.

Signed-off-by: Ian Romanick ian.d.roman...@intel.com
---
I suspect that r300 GPUs also fail these tests, but I don't have any of
that hardware around.  Could someone test before and after for me? :)

This is also not the full patch.  The full patch is ~300kb, so the list
server would have rejected it.  This is just a handful of representitive
tests and the generator script.

  .../fs-temp-array-mat2-col-row-wr.shader_test |  4 +++-
  .../fs-temp-array-mat2-col-wr.shader_test |  4 +++-
  .../fs-temp-array-mat2-index-col-row-wr.shader_test   |  4 +++-
  .../fs-temp-array-mat2-index-col-wr.shader_test   |  4 +++-
  .../fs-temp-array-mat2-index-row-wr.shader_test   |  4 +++-
  .../fs-temp-array-mat2-index-wr.shader_test   |  4 +++-
  .../vs-temp-array-mat2-col-row-wr.shader_test |  6 +++---
  .../vs-temp-array-mat2-col-wr.shader_test |  6 +++---
  .../vs-temp-array-mat2-index-col-row-wr.shader_test   |  6 +++---
  .../vs-temp-array-mat2-index-col-wr.shader_test   |  6 +++---
  .../vs-temp-array-mat2-index-row-wr.shader_test   |  6 +++---
  .../vs-temp-array-mat2-index-wr.shader_test   |  6 +++---
  tests/spec/glsl-1.10/variable-index-write.sh  | 15 +--
  13 files changed, 49 insertions(+), 26 deletions(-)

diff --git 
a/tests/spec/glsl-1.10/execution/variable-indexing/fs-temp-array-mat2-col-row-wr.shader_test
 
b/tests/spec/glsl-1.10/execution/variable-indexing/fs-temp-array-mat2-col-row-wr.shader_test
index 647cc02..ee9e77f 100644
--- 
a/tests/spec/glsl-1.10/execution/variable-indexing/fs-temp-array-mat2-col-row-wr.shader_test
+++ 
b/tests/spec/glsl-1.10/execution/variable-indexing/fs-temp-array-mat2-col-row-wr.shader_test
@@ -16,6 +16,8 @@ uniform int row;
  uniform int col;
  uniform float value;

+float distanceSqr(vec a, vec b) { vec diff = a - b; return abs(dot(diff, 
diff)); }


I believe you can omit the abs().  dot(x,x) will always be = 0.

-Brian

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


Re: [Piglit] [PATCH 12/18] arb_geometry_shader4: Test that adjacent vertices are ignored when no geometry shader is active.

2013-06-11 Thread Brian Paul
 */
+   glGenVertexArrays(1, array);
+   glBindVertexArray(array);
+   glGenBuffers(1, array_buf);
+   glBindBuffer(GL_ARRAY_BUFFER, array_buf);
+   glBufferData(GL_ARRAY_BUFFER, sizeof(vertex_data),
+vertex_data, GL_STREAM_DRAW);
+   glVertexPointer(2, GL_FLOAT, 0, NULL);
+   glEnableClientState(GL_VERTEX_ARRAY);
+   glBindBuffer(GL_ARRAY_BUFFER, 0);
+
+   /* Create shader. */
+   prog = glCreateProgram();
+   vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_text);
+   fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_text);
+   glAttachShader(prog, vs);
+   glAttachShader(prog, fs);
+   glDeleteShader(vs);
+   glDeleteShader(fs);
+   glLinkProgram(prog);
+   if (!piglit_link_check_status(prog) ||
+   !piglit_check_gl_error(GL_NO_ERROR)) {
+   piglit_report_result(PIGLIT_FAIL);
+   }


You could consolidate this shader setup code with 
piglit_build_simple_program().




+   color_uniform = glGetUniformLocation(prog, color);
+   glUseProgram(prog);
+
+   piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
+
+   /* Enable blending. */
+   glEnable(GL_BLEND);
+   glBlendEquation(GL_FUNC_ADD);
+   glBlendFunc(GL_ONE, GL_ONE);
+}
+
+static bool
+run_test(const struct primitives test, int *first)
+{
+   const float red[] = {1, 0, 0, 1};
+   const float green[] = {0, 1, 0, 1};
+   bool pass = true;
+
+   printf(Testing %s and %s.\n, 
piglit_get_prim_name(test.type_adjacency),
+  piglit_get_prim_name(test.type_base));
+
+   glClear(GL_COLOR_BUFFER_BIT);
+
+   /* Draw adjacency primitive red. */
+   glUniform4fv(color_uniform, 1, red);
+   glDrawArrays(test.type_adjacency, *first, test.count_adjacency);
+   *first += test.count_adjacency;
+
+   /* Draw normal primitive green. */
+   glUniform4fv(color_uniform, 1, green);
+   glDrawArrays(test.type_base, *first, test.count_base);
+   *first += test.count_base;
+
+   pass = check_framebuffer()  pass;
+   pass = piglit_check_gl_error(GL_NO_ERROR)  pass;
+
+   return pass;
+}
+
+enum piglit_result
+piglit_display(void)
+{
+   bool pass = true;
+   int first = 0;
+   int i = 0;
+   const struct primitives tests[] = {
+   {GL_LINES_ADJACENCY, 8, GL_LINES, 4},
+   {GL_LINE_STRIP_ADJACENCY, 6, GL_LINE_STRIP, 4},
+   {GL_TRIANGLES_ADJACENCY, 12, GL_TRIANGLES, 6},
+   {GL_TRIANGLE_STRIP_ADJACENCY, 8, GL_TRIANGLE_STRIP, 4},
+   };
+
+   for (i = 0; i  ARRAY_SIZE(tests); i++) {
+   pass = run_test(tests[i], first)  pass;
+
+   if (!piglit_automatic  !pass) {
+   piglit_present_results();
+   return PIGLIT_FAIL;
+   }
+   }
+
+   if (!piglit_automatic)
+   piglit_present_results();
+
+   return (pass ? PIGLIT_PASS : PIGLIT_FAIL);
+}


One other thing, but not a big deal- this code is a bit fragile with 
respect to window resizing.  You have window size-related code in the 
init function.  Usually, the window size would be accounted for in the 
piglit_display() function.  But window resizing is not too common in piglit.


Reviewed-by: Brian Paul bri...@vmware.com


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


Re: [Piglit] [PATCH 04/18] shader_runner: Draw instanced rectangles using triangle strips instead of quads.

2013-06-11 Thread Brian Paul

On 06/03/2013 06:42 AM, Fabian Bieler wrote:

This is usefull for core profile OpenGL contexts and geometry shaders.
---
  tests/shaders/shader_runner.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index e022b90..874e76b 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -1454,11 +1454,11 @@ draw_instanced_rect(int primcount, float x, float y, 
float w, float h)
verts[1][1] = y;
verts[1][2] = 0.0;
verts[1][3] = 1.0;
-   verts[2][0] = x + w;
+   verts[2][0] = x;
verts[2][1] = y + h;
verts[2][2] = 0.0;
verts[2][3] = 1.0;
-   verts[3][0] = x;
+   verts[3][0] = x + w;
verts[3][1] = y + h;
verts[3][2] = 0.0;
verts[3][3] = 1.0;
@@ -1466,7 +1466,7 @@ draw_instanced_rect(int primcount, float x, float y, 
float w, float h)
glVertexPointer(4, GL_FLOAT, 0, verts);
glEnableClientState(GL_VERTEX_ARRAY);

-   glDrawArraysInstanced(GL_QUADS, 0, 4, primcount);
+   glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, primcount);

glDisableClientState(GL_VERTEX_ARRAY);
  }


Reviewed-by: Brian Paul bri...@vmware.com
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 07/18] arb_geometry_shader4: Test valid vertices out count.

2013-06-11 Thread Brian Paul

On 06/07/2013 12:30 PM, Fabian Bieler wrote:

Test that glProgramParameter() triggers the required errors.

The value of GEOMETRY_VERTICES_OUT is limited by the implementation
dependend constants MAX_GEOMETRY_OUTPUT_VERTICES and
MAX_VERTEX_VARYING_COMPONENTS.


From the ARB_geometry_shader4 spec (section Errors):

The error INVALID_VALUE is generated by ProgramParameteriARB if pname is
GEOMETRY_VERTICES_OUT_ARB and value is negative.

The error INVALID_VALUE is generated by ProgramParameteriARB if pname is
GEOMETRY_VERTICES_OUT_ARB and value exceeds
MAX_GEOMETRY_OUTPUT_VERTICES_ARB.

The error INVALID_VALUE is generated by ProgramParameteriARB if pname is
set to GEOMETRY_VERTICES_OUT_ARB and the product of value and the sum of
all components of all active varying variables exceeds
MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB.
---
  tests/all.tests|   2 +
  .../execution/program-parameter/CMakeLists.gl.txt  |   1 +
  .../execution/program-parameter/vertices-out.c | 209 +
  3 files changed, 212 insertions(+)
  create mode 100644 
tests/spec/arb_geometry_shader4/execution/program-parameter/vertices-out.c

diff --git a/tests/all.tests b/tests/all.tests
index f21666a..b6d7cd1 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -2299,6 +2299,8 @@ add_plain_test(arb_map_buffer_alignment, 
'arb_map_buffer_alignment-sanity_test')
  arb_geometry_shader4 = Group()
  add_concurrent_test(arb_geometry_shader4, 'program-parameter-input-type')
  add_concurrent_test(arb_geometry_shader4, 'program-parameter-output-type')
+for mode in ['4', 'tf 1', '32', 'tf 32']:
+   add_concurrent_test(arb_geometry_shader4, 
'program-parameter-vertices-out {0}'.format(mode))
  spec['ARB_geometry_shader4'] = arb_geometry_shader4
  add_shader_test_dir(spec['ARB_geometry_shader4'],
  os.path.join(testsDir, 'spec', 'arb_geometry_shader4'),
diff --git 
a/tests/spec/arb_geometry_shader4/execution/program-parameter/CMakeLists.gl.txt 
b/tests/spec/arb_geometry_shader4/execution/program-parameter/CMakeLists.gl.txt
index aee7a98..5768ead 100644
--- 
a/tests/spec/arb_geometry_shader4/execution/program-parameter/CMakeLists.gl.txt
+++ 
b/tests/spec/arb_geometry_shader4/execution/program-parameter/CMakeLists.gl.txt
@@ -12,3 +12,4 @@ link_libraries (

  piglit_add_executable (program-parameter-input-type input-type.c)
  piglit_add_executable (program-parameter-output-type output-type.c)
+piglit_add_executable (program-parameter-vertices-out vertices-out.c)
diff --git 
a/tests/spec/arb_geometry_shader4/execution/program-parameter/vertices-out.c 
b/tests/spec/arb_geometry_shader4/execution/program-parameter/vertices-out.c
new file mode 100644
index 000..5ffbfae
--- /dev/null
+++ b/tests/spec/arb_geometry_shader4/execution/program-parameter/vertices-out.c
@@ -0,0 +1,209 @@
+/*
+ * Copyright © 2013 The Piglit project
+ *
+ * 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 vertices-out.c
+ *
+ * Test required errors for wrong GL_GEOMETRY_VERTICES_OUT parameters with
+ * variable number of output components.
+ */
+
+#include common.h
+
+
+static const char gs_textn[] =
+   uniform int vertex_count;\n
+   varying out float var[n];\n
+   void main()\n
+   {\n
+ for (int i = 0; i  vertex_count; i++) {\n
+ gl_Position = vec4(0.0);\n
+ for (int j = 0; j  n; j++)\n
+ var[j] = 1.0 / exp2(float(j + 1));\n
+ EmitVertex();\n
+ }\n
+   }\n;
+
+static const char fs_textn[] =
+   varying float var[n];\n
+   void main()\n
+   {\n
+ gl_FragColor = vec4(0.0);\n
+ for (int j = 0; j  n; j++)\n
+ gl_FragColor += vec4(var[j]);\n
+   }\n;
+
+static bool transform_feedback = false;
+static int components = -1;
+
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+   

Re: [Piglit] [PATCH 4/7] gl-3.2: Add testing for the minimum maximums.

2013-05-17 Thread Brian Paul


On May 16, 2013, at 9:28 AM, Eric Anholt e...@anholt.net wrote:

 ---
 tests/all.tests |   2 +
 tests/spec/CMakeLists.txt   |   1 +
 tests/spec/gl-3.2/CMakeLists.gl.txt |  14 +++
 tests/spec/gl-3.2/CMakeLists.txt|   1 +
 tests/spec/gl-3.2/minmax.c  | 177 
 5 files changed, 195 insertions(+)
 create mode 100644 tests/spec/gl-3.2/CMakeLists.gl.txt
 create mode 100644 tests/spec/gl-3.2/CMakeLists.txt
 create mode 100644 tests/spec/gl-3.2/minmax.c
 
 diff --git a/tests/all.tests b/tests/all.tests
 index f53c991..26cfc75 100644
 --- a/tests/all.tests
 +++ b/tests/all.tests
 @@ -714,6 +714,8 @@ for subtest in ['generated', 'written', 'flush']:
 gl31[cmdline] = concurrent_test('gl-3.1-' + cmdline)
 gl31['required-sized-texture-formats'] = 
 concurrent_test('gl-3.0-required-sized-texture-formats 31')
 
 +spec['!OpenGL 3.2/minmax'] = concurrent_test('gl-3.2-minmax')
 +
 spec['!OpenGL 3.3/required-sized-texture-formats'] = 
 concurrent_test('gl-3.0-required-sized-texture-formats 33')
 
 spec['!OpenGL 4.2/required-sized-texture-formats'] = 
 concurrent_test('gl-3.0-required-sized-texture-formats 42')
 diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt
 index a1492cc..1b6a0c4 100644
 --- a/tests/spec/CMakeLists.txt
 +++ b/tests/spec/CMakeLists.txt
 @@ -58,6 +58,7 @@ add_subdirectory (gl-2.0)
 add_subdirectory (gl-2.1)
 add_subdirectory (gl-3.0)
 add_subdirectory (gl-3.1)
 +add_subdirectory (gl-3.2)
 add_subdirectory (gles-2.0)
 add_subdirectory (gles-3.0)
 add_subdirectory (glx_arb_create_context)
 diff --git a/tests/spec/gl-3.2/CMakeLists.gl.txt 
 b/tests/spec/gl-3.2/CMakeLists.gl.txt
 new file mode 100644
 index 000..c6c99b8
 --- /dev/null
 +++ b/tests/spec/gl-3.2/CMakeLists.gl.txt
 @@ -0,0 +1,14 @@
 +include_directories(
 +${GLEXT_INCLUDE_DIR}
 +${OPENGL_INCLUDE_PATH}
 +)
 +
 +link_libraries (
 +piglitutil_${piglit_target_api}
 +${OPENGL_gl_LIBRARY}
 +${OPENGL_glu_LIBRARY}
 +)
 +
 +piglit_add_executable (gl-3.2-minmax minmax.c)
 +
 +# vim: ft=cmake:
 diff --git a/tests/spec/gl-3.2/CMakeLists.txt 
 b/tests/spec/gl-3.2/CMakeLists.txt
 new file mode 100644
 index 000..4a012b9
 --- /dev/null
 +++ b/tests/spec/gl-3.2/CMakeLists.txt
 @@ -0,0 +1 @@
 +piglit_include_target_api()
 \ No newline at end of file
 diff --git a/tests/spec/gl-3.2/minmax.c b/tests/spec/gl-3.2/minmax.c
 new file mode 100644
 index 000..bb906bc
 --- /dev/null
 +++ b/tests/spec/gl-3.2/minmax.c
 @@ -0,0 +1,177 @@
 +/* Copyright © 2012 Intel Corporation
 + *
 + * Permission is hereby granted, free of charge, to any person obtaining a
 + * copy of this software and associated documentation files (the Software),
 + * to deal in the Software without restriction, including without limitation
 + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 + * and/or sell copies of the Software, and to permit persons to whom the
 + * Software is furnished to do so, subject to the following conditions:
 + *
 + * The above copyright notice and this permission notice (including the next
 + * paragraph) shall be included in all copies or substantial portions of the
 + * Software.
 + *
 + * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
 DEALINGS
 + * IN THE SOFTWARE.
 + */
 +
 +/** @file minmax.c
 + *
 + * Test for the minimum maximum values in section 6.2 State Tables
 + * of the GL 3.2 spec.
 + */
 +
 +#include piglit-util-gl-common.h
 +#include minmax-test.h
 +
 +PIGLIT_GL_TEST_CONFIG_BEGIN
 +
 +config.supports_gl_core_version = 32;
 +config.supports_gl_compat_version = 10;
 +
 +config.window_width = 32;
 +config.window_height = 32;

I think you can omit the window size. 


 +config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
 +
 +PIGLIT_GL_TEST_CONFIG_END
 +
 +enum piglit_result
 +piglit_display(void)
 +{
 +/* UNREACHED */
 +return PIGLIT_FAIL;
 +}
 +
 +void
 +piglit_init(int argc, char **argv)
 +{
 +int vuniforms = 0, vblocks = 0;
 +int guniforms = 0, gblocks = 0;
 +int funiforms = 0, fblocks = 0;
 +int blocksize = 0;
 +
 +piglit_require_gl_version(31);

Is that needed if you specified version info in the config block above? I guess 
I'm not clear on this in general. 

-Brian


 +
 +piglit_print_minmax_header();
 +
 +/* These should be in the section with Minimum Value but
 + * appear in the section with Initial Value.
 + */
 +piglit_test_min_int(GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS, 
 64);
 +

Re: [Piglit] [PATCH] max-samplers: use the maximum number of textures in every shader

2013-05-09 Thread Brian Paul

On 05/08/2013 07:27 PM, Marek Olšák wrote:

On Thu, May 9, 2013 at 1:16 AM, Brian Paulbri...@vmware.com  wrote:




BTW, I tried to test this with NVIDIA's driver but it appears that piglit
can't create a GL 3.1 context:

$ bin/gl-3.1-max-samplers -auto
piglit: info: Failed to create GL 3.1 core context
piglit: info: Failed to create any GL context
PIGLIT: {'result': 'skip' }


The issue with NVIDIA's driver is that it advertises
ARB_compatibility, so it's not a 3.1 core profile. Piglit sees that
and assumes the context creation failed and skips the test.


It also doesn't run if I try to request a GL 3.1 compatibility context.

Does this test really need GL 3.1?  I changed the test to use 
config.supports_gl_compat_version = 20 (AFAICT only GL 2.0 features 
are used).  Plus, I had to increase the window size to 300x300 because 
32 vertex/fragment image units are reported on my system.  Now the 
test passes with my NVIDIA driver.


A patch with my changes is attached.

-Brian


max-samplers.patch
Description: application/pgp-keys
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 2/4] util: Make an even simpler interface for building simple shaders.

2013-05-08 Thread Brian Paul

On 05/08/2013 03:02 PM, Eric Anholt wrote:

The previous piglit_link_simple_program() interface required you to
compile your shaders up front, and tests routinely have issues with
either not checking that the component shaders compiled, or not
checking that the program linked, and then confusingly fail later in
the test.  This one enforces that the program actually compiled and
linked before continuing, so you don't need to worry about error
checking.
---
  tests/util/piglit-shader.c | 35 +++
  tests/util/piglit-shader.h |  1 +
  2 files changed, 36 insertions(+)

diff --git a/tests/util/piglit-shader.c b/tests/util/piglit-shader.c
index ca48f41..d715bab 100644
--- a/tests/util/piglit-shader.c
+++ b/tests/util/piglit-shader.c
@@ -263,3 +263,38 @@ GLint piglit_link_simple_program(GLint vs, GLint fs)

return prog;
  }
+
+/**
+ * Builds and links a program from optional VS and FS sources,
+ * throwing PIGLIT_FAIL on error.
+ */
+GLint
+piglit_build_simple_program(const char *vs_source, const char *fs_source)


How would you feel about adding a gs_source for geometry shaders too?

Otherwise,
Reviewed-by: Brian Paul bri...@vmware.com



+{
+   GLuint vs = 0, fs = 0, prog;
+
+   if (vs_source) {
+   vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_source);
+   if (!vs) {
+   piglit_report_result(PIGLIT_FAIL);
+   }
+   }
+
+   if (fs_source) {
+   fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_source);
+   if (!fs) {
+   piglit_report_result(PIGLIT_FAIL);
+   }
+   }
+
+   prog = piglit_link_simple_program(vs, fs);
+   if (!prog)
+   piglit_report_result(PIGLIT_FAIL);
+
+   if (fs)
+   glDeleteShader(fs);
+   if (vs)
+   glDeleteShader(vs);
+
+   return prog;
+}
diff --git a/tests/util/piglit-shader.h b/tests/util/piglit-shader.h
index 12cf731..425eab3 100644
--- a/tests/util/piglit-shader.h
+++ b/tests/util/piglit-shader.h
@@ -35,6 +35,7 @@ GLuint piglit_compile_shader_text(GLenum target, const char 
*text);
  GLboolean piglit_link_check_status(GLint prog);
  GLboolean piglit_link_check_status_quiet(GLint prog);
  GLint piglit_link_simple_program(GLint vs, GLint fs);
+GLint piglit_build_simple_program(const char *vs_source, const char 
*fs_source);

  #if defined(PIGLIT_USE_OPENGL_ES1)
  #define glAttachShader assert(!glAttachShader does not exist in ES1)


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


Re: [Piglit] [PATCH v2] amd_performance_monitor: Fix multi-statement macro 'report'.

2013-05-07 Thread Brian Paul

On 05/07/2013 03:06 PM, Vinson Lee wrote:

Fixes Nesting level does not match indentation defect reported by
Coverity.

Signed-off-by: Vinson Leev...@freedesktop.org
---
  tests/spec/amd_performance_monitor/api.c | 6 --
  1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tests/spec/amd_performance_monitor/api.c 
b/tests/spec/amd_performance_monitor/api.c
index 7b321cf..3205fc0 100644
--- a/tests/spec/amd_performance_monitor/api.c
+++ b/tests/spec/amd_performance_monitor/api.c
@@ -113,8 +113,10 @@ find_invalid_counter(unsigned *counters, int num_counters)
  }

  #define report(pass) \
-piglit_report_subtest_result((pass) ? PIGLIT_PASS : PIGLIT_FAIL, 
__FUNCTION__); \
-return
+   do { \
+   piglit_report_subtest_result((pass) ? PIGLIT_PASS : 
PIGLIT_FAIL, __FUNCTION__); \
+   return; \
+   } while (0)

  
/**/



Reviewed-by: Brian Paul bri...@vmware.com
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] amd_performance_monitor: Add braces around report macro.

2013-05-06 Thread Brian Paul

On 05/05/2013 12:11 AM, Vinson Lee wrote:

The macro 'report' expands to multiple statements. Add braces to nest
all statements in expanded macro within if-statement.

Fixes Nesting level does not match indentation defect reported by
Coverity.

Signed-off-by: Vinson Leev...@freedesktop.org
---
  tests/spec/amd_performance_monitor/api.c | 6 --
  1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tests/spec/amd_performance_monitor/api.c 
b/tests/spec/amd_performance_monitor/api.c
index 7b321cf..a7edf47 100644
--- a/tests/spec/amd_performance_monitor/api.c
+++ b/tests/spec/amd_performance_monitor/api.c
@@ -436,8 +436,9 @@ test_group_string_normal_buffer(unsigned valid_group)
/* Get the length; bail if unwritten to avoid huge allocations. */
glGetPerfMonitorGroupStringAMD(valid_group, 0,length, NULL);
pass = pass  piglit_check_gl_error(GL_NO_ERROR);
-   if (length == 0xd0d0d0d0)
+   if (length == 0xd0d0d0d0) {
report(false);
+   }

name = malloc(length + 1);
assert(name != NULL);
@@ -580,8 +581,9 @@ test_counter_string_normal_buffer(unsigned group, unsigned 
counter)
/* Get the length; bail if unwritten to avoid huge allocations. */
glGetPerfMonitorCounterStringAMD(group, counter, 0,length, NULL);
pass = pass  piglit_check_gl_error(GL_NO_ERROR);
-   if (length == 0xd0d0d0d0)
+   if (length == 0xd0d0d0d0) {
report(false);
+   }

name = malloc(length + 1);
assert(name != NULL);


Since the report) macro is used in many places, it would probably be 
safer to fix the macro itself to future-proof it a bit:


#define report(pass) \
   do { \
   piglit_report_subtest_result((pass) ? PIGLIT_PASS : 
PIGLIT_FAIL, __FUNCTION__); \

   return; \
   } while (0)

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


[Piglit] [PATCH] framework: improve the TestProfile::remove_test() method

2013-05-02 Thread Brian Paul
The previous implementation didn't really work too well.

If you tried something like
profile.remove_test(spec/!OpenGL 3.1/primitive-restart-xfb generated)
you'd just get a Python exception and die.

Also, it was painful to remove whole categories of tests, such as
spec/!OpenGL 3.1/.

The new version allows you to specify a full test name with arguments
as seen above.

Also, it supports *-style wildcards so that and entire category of tests
can be easily removed with something like remove_test(spec/!OpenGL 3.1/*)
---
 framework/core.py |   33 ++---
 1 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/framework/core.py b/framework/core.py
index 6a3b97a..6e8a8c2 100644
--- a/framework/core.py
+++ b/framework/core.py
@@ -518,6 +518,7 @@ class TestProfile:
def __init__(self):
self.tests = Group()
self.test_list = {}
+   self.remove_list = []
 
def flatten_group_hierarchy(self):
'''
@@ -541,6 +542,14 @@ class TestProfile:
# Clear out the old Group()
self.tests = Group()
 
+   def in_remove_list(self, test):
+   Is the given test in the list previously specified by calls 
to
+   remove_test()?
+   for t in self.remove_list:
+   if t.match(test):
+   return True
+   return False
+
def prepare_test_list(self, env):
self.flatten_group_hierarchy()
 
@@ -551,6 +560,7 @@ class TestProfile:
path, test = item
return ((not env.filter or matches_any_regexp(path, 
env.filter)) and
not path in env.exclude_tests and
+   not self.in_remove_list(path) and
not matches_any_regexp(path, 
env.exclude_filter))
 
# Filter out unwanted tests
@@ -578,19 +588,20 @@ class TestProfile:
test.doRun(env, path, json_writer)
ConcurrentTestPool().join()
 
-   def remove_test(self, test_path):
-   Remove a fully qualified test from the profile.
-
-   ``test_path`` is a string with slash ('/') separated
-   components. It has no leading slash. For example::
-   test_path = 'spec/glsl-1.30/linker/do-stuff'
+   def remove_test(self, test_pattern):
+   Remove a test from the profile.
+   ``test_path`` may be a fully-qualified test name (with 
arguemnts)
+   or a pattern containing '*' wildcard characters.  Example:
+   'spec/glsl-1.30/linker/do-stuff'
+   'spec/EXT_framebuffer_multisample/polygon-smooth 4'
+   'spec/!OpenGL 3.1/*'

+   test_pattern = string.replace(test_pattern, ., \.)
+   test_pattern = string.replace(test_pattern, *, .*)
+   t = re.compile(test_pattern)
+   self.remove_list.append(t)
+
 
-   l = test_path.split('/')
-   group = self.tests[l[0]]
-   for group_name in l[1:-2]:
-   group = group[group_name]
-   del group[l[-1]]
 
 #
 # Loaders
-- 
1.7.3.4

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


[Piglit] RFC: rename test/all.tests to tests/all_tests.py

2013-05-02 Thread Brian Paul


I'd like to rename tests/all.tests (and the others) to something like 
tests/all_tests.py.


The contents of all.tests is Python code so putting the .py suffix on 
it makes sense.  Then, I'd like to be able to import that code into 
another test spec file where I do blacklisting.


For example, I want to create a test spec file vmware_tests.py that 
executes everything in all.tests except for stuff we don't want to 
test.  An example vmware_tests.py file might be something like:


import sys
sys.path.append(tests)
from all_tests import *

black_list= [
   spec/!OpenGL 3.1/*,
   *glean*
]

# Remove the blacklisted tests from the test profile
for t in black_list:
   profile.remove_test(t)



As it is now we can't do import all.tests in Python.  Renaming to 
all_tests.py fixes that problem.


-Brian

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


[Piglit] [PATCH] s3tc-errors: add more glTex[Sub]Image2D() error checking tests

2013-04-26 Thread Brian Paul
Two new things:
1. Test small mipmap level sizes (width,height=1,2,4)
2. Test NPOT textures

Passes with NVIDIA's driver.  Checks for a Mesa bug.
---
 tests/texturing/s3tc-errors.c |  104 -
 1 files changed, 103 insertions(+), 1 deletions(-)

diff --git a/tests/texturing/s3tc-errors.c b/tests/texturing/s3tc-errors.c
index c159445..e0746da 100644
--- a/tests/texturing/s3tc-errors.c
+++ b/tests/texturing/s3tc-errors.c
@@ -343,6 +343,104 @@ test_format(int width, int height, GLfloat *image, GLenum 
format)
 
 
 static bool
+test_small_mipmap_level(void)
+{
+   bool pass;
+   GLuint tex;
+   GLubyte buf[100];
+   int width, height;
+   int format = GL_COMPRESSED_RGB_S3TC_DXT1_EXT;
+
+   memset(buf, 0, sizeof(buf));
+
+   glGenTextures(1, tex);
+   glBindTexture(GL_TEXTURE_2D, tex);
+
+   /* test sizes 1x1, 1x2, 2x1, .. 2x4, 4x4 */
+   for (width = 1; width = 4; width *= 2) {
+   for (height = 1; height = 4; height *= 2) {
+   /* Initial image */
+   glTexImage2D(GL_TEXTURE_2D, 0, format, width, height,
+0, GL_RGBA, GL_UNSIGNED_BYTE, buf);
+
+   pass = piglit_check_gl_error(GL_NO_ERROR);
+
+   /* Try TexSubImage of whole texture */
+   glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height,
+   GL_RGBA, GL_UNSIGNED_BYTE, buf);
+
+   pass = piglit_check_gl_error(GL_NO_ERROR);
+   }
+   }
+
+   glDeleteTextures(1, tex);
+
+   return pass;
+}
+
+
+static bool
+test_non_power_of_two(void)
+{
+   bool pass = true;
+
+   if (piglit_is_extension_supported(GL_ARB_texture_non_power_of_two)) {
+   GLuint tex;
+   GLubyte buf[800];
+   int width = 11, height = 14;
+   int format = GL_COMPRESSED_RGB_S3TC_DXT1_EXT;
+
+   memset(buf, 0, sizeof(buf));
+
+   /* Setup initial texture */
+   glGenTextures(1, tex);
+   glBindTexture(GL_TEXTURE_2D, tex);
+   glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0,
+GL_RGBA, GL_UNSIGNED_BYTE, buf);
+
+   pass = piglit_check_gl_error(GL_NO_ERROR)  pass;
+
+   /* Try TexSubImage of partial block on right edge */
+   glTexSubImage2D(GL_TEXTURE_2D, 0,
+   width-3, 0,  /* position */
+   3, 4,/* size */
+   GL_RGBA, GL_UNSIGNED_BYTE, buf);
+
+   pass = piglit_check_gl_error(GL_NO_ERROR)  pass;
+
+   /* Try TexSubImage of partial block on top edge */
+   glTexSubImage2D(GL_TEXTURE_2D, 0,
+   0, height-2,  /* position */
+   4, 2, /* size */
+   GL_RGBA, GL_UNSIGNED_BYTE, buf);
+
+   pass = piglit_check_gl_error(GL_NO_ERROR)  pass;
+
+   /* Try TexSubImage of larger partial block on right edge */
+   glTexSubImage2D(GL_TEXTURE_2D, 0,
+   width-3-4, 0,  /* position */
+   3+4, 4,/* size */
+   GL_RGBA, GL_UNSIGNED_BYTE, buf);
+
+   pass = piglit_check_gl_error(GL_NO_ERROR)  pass;
+
+   /* Try TexSubImage of largeer partial block on top edge */
+   glTexSubImage2D(GL_TEXTURE_2D, 0,
+   0, height-2-4,  /* position */
+   4, 2+4, /* size */
+   GL_RGBA, GL_UNSIGNED_BYTE, buf);
+
+   pass = piglit_check_gl_error(GL_NO_ERROR)  pass;
+
+   glDeleteTextures(1, tex);
+
+   }
+
+   return pass;
+}
+
+
+static bool
 test_formats(void)
 {
const int num_formats = ARRAY_SIZE(s3tc_formats);
@@ -371,7 +469,11 @@ test_formats(void)
 enum piglit_result
 piglit_display(void)
 {
-   return test_formats() ? PIGLIT_PASS : PIGLIT_FAIL;
+   bool pass = test_formats();
+   pass = test_small_mipmap_level()  pass;
+   pass = test_non_power_of_two()  pass;
+
+   return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
 
 
-- 
1.7.3.4

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


[Piglit] [PATCH] gl-1.0-dlist-shademodel: test glShadeModel() inside a display list

2013-04-25 Thread Brian Paul
This is pretty trivial, but it's useful for debugging a Mesa display
list optimization.
---
 tests/all.tests  |1 +
 tests/spec/gl-1.0/CMakeLists.gl.txt  |1 +
 tests/spec/gl-1.0/dlist-shademodel.c |  101 ++
 3 files changed, 103 insertions(+), 0 deletions(-)
 create mode 100644 tests/spec/gl-1.0/dlist-shademodel.c

diff --git a/tests/all.tests b/tests/all.tests
index 7e5bd03..0c13e65 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -570,6 +570,7 @@ add_concurrent_test(gl11, 'getteximage-targets 2D')
 gl10 = Group()
 spec['!OpenGL 1.0'] = gl10
 add_concurrent_test(gl10, 'gl-1.0-beginend-coverage')
+add_concurrent_test(gl10, 'gl-1.0-dlist-shademodel')
 add_concurrent_test(gl10, 'gl-1.0-edgeflag')
 add_concurrent_test(gl10, 'gl-1.0-edgeflag-quads')
 
diff --git a/tests/spec/gl-1.0/CMakeLists.gl.txt 
b/tests/spec/gl-1.0/CMakeLists.gl.txt
index 2f819fa..559fabc 100644
--- a/tests/spec/gl-1.0/CMakeLists.gl.txt
+++ b/tests/spec/gl-1.0/CMakeLists.gl.txt
@@ -12,5 +12,6 @@ link_libraries (
 piglit_add_executable (gl-1.0-beginend-coverage beginend-coverage.c)
 piglit_add_executable (gl-1.0-edgeflag edgeflag.c)
 piglit_add_executable (gl-1.0-edgeflag-quads edgeflag-quads.c)
+piglit_add_executable (gl-1.0-dlist-shademodel dlist-shademodel.c)
 
 # vim: ft=cmake:
diff --git a/tests/spec/gl-1.0/dlist-shademodel.c 
b/tests/spec/gl-1.0/dlist-shademodel.c
new file mode 100644
index 000..0b7752e
--- /dev/null
+++ b/tests/spec/gl-1.0/dlist-shademodel.c
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2013 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 glShadeModel in a display list.
+ * This is pretty trivial and shouldn't fail with any decent OpenGL,
+ * but it's useful for checking an optimization in Mesa's display list
+ * compiler.
+ */
+
+#include piglit-util-gl-common.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 const GLfloat red[] = {1.0, 0.0, 0.0};
+static const GLfloat green[] = {0.0, 1.0, 0.0};
+
+
+enum piglit_result
+piglit_display(void)
+{
+   GLuint list;
+   bool pass;
+
+   list = glGenLists(1);
+   glNewList(list, GL_COMPILE);
+   glShadeModel(GL_FLAT);
+
+   glBegin(GL_QUADS);
+   glColor3fv(red);
+   glVertex2f(-1, -1);
+   glColor3fv(green);
+   glVertex2f( 0, -1);
+   glColor3fv(red);
+   glVertex2f( 0, 1);
+   glColor3fv(green);
+   glVertex2f(-1, 1);
+   glEnd();
+
+   /* Mesa should be able to optimize this away so that
+* the two GL_QUADS primitives get combined into one batch.
+*/
+   glShadeModel(GL_FLAT);
+
+   glBegin(GL_QUADS);
+   glColor3fv(red);
+   glVertex2f(0, -1);
+   glColor3fv(green);
+   glVertex2f(1, -1);
+   glColor3fv(red);
+   glVertex2f(1, 1);
+   glColor3fv(green);
+   glVertex2f(0, 1);
+   glEnd();
+
+   glEndList();
+
+   glShadeModel(GL_SMOOTH);
+   glClear(GL_COLOR_BUFFER_BIT);
+   glCallList(list);
+
+   glDeleteLists(list, 1);
+
+   pass = piglit_probe_pixel_rgb(20, 20, green);
+
+   piglit_present_results();
+
+   return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+}
+
+
+void
+piglit_init(int argc, char **argv)
+{
+   /* nothing */
+}
-- 
1.7.3.4

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


[Piglit] [PATCH] dlist-beginend: test some tricky glBegin/glEnd display list corner cases

2013-04-25 Thread Brian Paul
These are some special cases not covered by the beginend-coverage test.
In particular, we do some drawing/probing.
---
 tests/all.tests |1 +
 tests/spec/gl-1.0/CMakeLists.gl.txt |1 +
 tests/spec/gl-1.0/dlist-beginend.c  |  358 +++
 3 files changed, 360 insertions(+), 0 deletions(-)
 create mode 100644 tests/spec/gl-1.0/dlist-beginend.c

diff --git a/tests/all.tests b/tests/all.tests
index 0c13e65..e7c3d04 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -570,6 +570,7 @@ add_concurrent_test(gl11, 'getteximage-targets 2D')
 gl10 = Group()
 spec['!OpenGL 1.0'] = gl10
 add_concurrent_test(gl10, 'gl-1.0-beginend-coverage')
+add_concurrent_test(gl10, 'gl-1.0-dlist-beginend')
 add_concurrent_test(gl10, 'gl-1.0-dlist-shademodel')
 add_concurrent_test(gl10, 'gl-1.0-edgeflag')
 add_concurrent_test(gl10, 'gl-1.0-edgeflag-quads')
diff --git a/tests/spec/gl-1.0/CMakeLists.gl.txt 
b/tests/spec/gl-1.0/CMakeLists.gl.txt
index 559fabc..bdb212a 100644
--- a/tests/spec/gl-1.0/CMakeLists.gl.txt
+++ b/tests/spec/gl-1.0/CMakeLists.gl.txt
@@ -12,6 +12,7 @@ link_libraries (
 piglit_add_executable (gl-1.0-beginend-coverage beginend-coverage.c)
 piglit_add_executable (gl-1.0-edgeflag edgeflag.c)
 piglit_add_executable (gl-1.0-edgeflag-quads edgeflag-quads.c)
+piglit_add_executable (gl-1.0-dlist-beginend dlist-beginend.c)
 piglit_add_executable (gl-1.0-dlist-shademodel dlist-shademodel.c)
 
 # vim: ft=cmake:
diff --git a/tests/spec/gl-1.0/dlist-beginend.c 
b/tests/spec/gl-1.0/dlist-beginend.c
new file mode 100644
index 000..bb2f3ac
--- /dev/null
+++ b/tests/spec/gl-1.0/dlist-beginend.c
@@ -0,0 +1,358 @@
+/*
+ * Copyright (C) 2013 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 some tricky cases of display lists and glBegin/End.
+ */
+
+#include piglit-util-gl-common.h
+
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+   config.supports_gl_compat_version = 11;
+   config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
+PIGLIT_GL_TEST_CONFIG_END
+
+
+static const GLfloat red[] = {1.0, 0.0, 0.0, 1.0};
+static const GLfloat green[] = {0.0, 1.0, 0.0, 1.0};
+static const GLfloat black[] = {0.0, 0.0, 0.0, 0.0};
+
+
+static bool
+test_call_list_inside_begin_end(void)
+{
+   GLuint list;
+   bool pass;
+
+   list = glGenLists(1);
+   glNewList(list, GL_COMPILE);
+   glColor4fv(green);
+   glVertex2f(-1, -1);
+   glVertex2f( 1, -1);
+   glVertex2f( 1, 1);
+   glVertex2f(-1, 1);
+   glEndList();
+
+   glClear(GL_COLOR_BUFFER_BIT);
+   glBegin(GL_QUADS);
+   glCallList(list);
+   glEnd();
+
+   pass = piglit_check_gl_error(GL_NO_ERROR);
+
+   glDeleteLists(list, 1);
+
+   pass = piglit_probe_pixel_rgba(piglit_width/2, piglit_height/2, green)
+pass;
+
+   piglit_present_results();
+   piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL,
+glCallList inside glBegin/glEnd);
+
+   return pass;
+}
+
+
+static bool
+test_call_list_inside_nested_begin_end(void)
+{
+   GLuint inner, outer;
+   bool pass;
+
+   glClear(GL_COLOR_BUFFER_BIT);
+
+   inner = glGenLists(1);
+   glNewList(inner, GL_COMPILE);
+   glColor4fv(green);
+   glVertex2f(-1, -1);
+   glVertex2f( 1, -1);
+   glVertex2f( 1, 1);
+   glVertex2f(-1, 1);
+   glEndList();
+
+   outer = glGenLists(1);
+   glNewList(outer, GL_COMPILE_AND_EXECUTE);
+   glBegin(GL_QUADS);
+   glCallList(inner);
+   glEnd();
+   glEndList();
+
+   pass = piglit_check_gl_error(GL_NO_ERROR);
+
+   pass = piglit_probe_pixel_rgba(piglit_width/2, piglit_height/2, green)
+pass;
+
+   glClear(GL_COLOR_BUFFER_BIT);
+   glCallList(outer);
+
+   pass = piglit_probe_pixel_rgba(piglit_width/2, piglit_height/2, green)

[Piglit] [PATCH 1/2] gl-1.0-begend-coverage: remove unneeded #include minmax-test.h

2013-04-25 Thread Brian Paul
---
 tests/spec/gl-1.0/beginend-coverage.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/tests/spec/gl-1.0/beginend-coverage.c 
b/tests/spec/gl-1.0/beginend-coverage.c
index 22d0034..1e8dd7d 100644
--- a/tests/spec/gl-1.0/beginend-coverage.c
+++ b/tests/spec/gl-1.0/beginend-coverage.c
@@ -45,7 +45,6 @@
  */
 
 #include piglit-util-gl-common.h
-#include minmax-test.h
 
 PIGLIT_GL_TEST_CONFIG_BEGIN
 
-- 
1.7.3.4

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


[Piglit] [PATCH 2/2] gl-1.0-beginend-coverage: fix FBO-related failures when using GLUT

2013-04-25 Thread Brian Paul
When Piglit's configured to use GLUT instead of Waffle we don't have
full support for the -fbo option.  So in beginend-coverage we now
check if we really have a FBO bound in order to compute the right
fbo_attachment value.
---
 tests/spec/gl-1.0/beginend-coverage.c |9 +++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/tests/spec/gl-1.0/beginend-coverage.c 
b/tests/spec/gl-1.0/beginend-coverage.c
index 1e8dd7d..29044ef 100644
--- a/tests/spec/gl-1.0/beginend-coverage.c
+++ b/tests/spec/gl-1.0/beginend-coverage.c
@@ -59,7 +59,6 @@ struct test {
void (*func)(void);
 };
 
-extern bool piglit_use_fbo;
 static uint32_t junk_storage[1024];
 static void *junk = junk_storage;
 static const int onei = 1;
@@ -68,6 +67,7 @@ static GLuint some_dlist;
 static GLuint newlist_dlist;
 static GLuint deletelists_dlist;
 static GLuint fbo_attachment;
+static GLint fbo_binding;
 
 #define TEST_FUNC(name, args)  \
static void test_##name(void)   \
@@ -909,7 +909,12 @@ piglit_init(int argc, char **argv)
glNewList(some_dlist, GL_COMPILE);
glEndList();
 
-   if (piglit_use_fbo)
+   if (piglit_is_extension_supported(GL_ARB_framebuffer_object))
+   glGetIntegerv(GL_FRAMEBUFFER_BINDING, fbo_binding);
+   else
+   fbo_binding = 0;
+
+   if (fbo_binding)
fbo_attachment = GL_COLOR_ATTACHMENT0;
else
fbo_attachment = GL_FRONT;
-- 
1.7.3.4

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


Re: [Piglit] [PATCH] Primitive restart: Test in every possible draw mode.

2013-04-25 Thread Brian Paul
);
+   }
+   glDrawElements(test-prim_type, ARRAY_SIZE(index_buffer),
+  GL_UNSIGNED_BYTE, index_buffer);
+   if (piglit_get_gl_version()= 31)
+   glDisable(GL_PRIMITIVE_RESTART);
+   else
+   glDisableClientState(GL_PRIMITIVE_RESTART_NV);
+   } else {
+   glDrawArrays(test-prim_type, 0, restart_pos);
+   glDrawArrays(test-prim_type, restart_pos,
+NUM_VERTICES - restart_pos);
+   }
+
+   if (test-prim_type != GL_POINTS) {
+   /* Draw vertices in white */
+   glUniform4f(color_loc, 1.0, 1.0, 1.0, 1.0);
+   glDrawArrays(GL_POINTS, 0, NUM_VERTICES);
+   }
+}
+
+
+enum piglit_result
+piglit_display(void)
+{
+   int row, col;
+   bool pass = true;
+
+   glClear(GL_COLOR_BUFFER_BIT);
+   glUseProgram(prog);
+   glUniform2f(window_size_loc, piglit_width, piglit_height);
+   glVertexAttribPointer(VERTEX_ATTR, 2, GL_FLOAT, GL_FALSE,
+ sizeof(vertex_patterns[test-pattern][0]),
+ vertex_patterns[test-pattern]);
+   glEnableVertexAttribArray(VERTEX_ATTR);
+
+   for (col = 0; col  NUM_COLS; col++) {
+   for (row = 0; row  NUM_ROWS; row++) {
+   glUniform2f(offset_loc, col * PATTERN_SIZE,
+   (NUM_ROWS - 1 - row) * PATTERN_SIZE);
+   draw_pattern(row + 1, col == 0);
+   }
+   }
+
+   pass = piglit_probe_rect_halves_equal_rgba(0, 0, piglit_width,
+  piglit_height)  pass;
+   pass = piglit_check_gl_error(GL_NO_ERROR)  pass;
+   piglit_present_results();
+   return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+}


Otherwise LGTM.

Reviewed-by: Brian Paul bri...@vmware.com

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


Re: [Piglit] [PATCH] add new piglit-summary.py script for printing summaries of results file(s)

2013-04-20 Thread Brian Paul

On 04/19/2013 09:54 PM, Dylan Baker wrote:

I have some concerns with this patch:
1) It has two imports that are not being used: cgi, os (not os.path)


I'll fix that.



2) getopt: I've been trying to get rid of getopt and replace it with
argparse (I have a patch set ready to go to replace the rest of
optparse and getopt with argparse)


I just copied the other scripts.  Feel free to fix it.



3) using the name piglit-summary.py: If the project ever wanted to
have a unified summary program that could output different summary
formats (which seems like a good idea as the project gets more and
more summary output types) the logical name would be
piglit-summary.py. This creates friction since that kind of feature
would be changing the functionality of an existing tool in the project.


We can easily rename the script when that day comes.

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


Re: [Piglit] [PATCH] add new --ignoreStderr option to piglit-run.py

2013-04-19 Thread Brian Paul

On 04/19/2013 04:33 AM, Jose Fonseca wrote:

Yes, assuming stderr messages are driver warnings seems a bit pedantic.

We could do the other way around -- have a whitelist of warning regular 
expressions that we do known that are worrisome.


Yeah, that's an idea.  But I think the only ones that comes to mind 
are Mesa implementation error from _mesa_problem() and Mesa 
warning from _mesa_warning().


Mesa: User error from _mesa_error() should be ignored since quite a 
few piglit tests probe for GL errors and the message is always printed 
for debug builds.


I guess I'd like to get some more opinions on this patch vs. just 
removing the stderr=warn detection code entirely.


-Brian



- Original Message -

Normally, if anything unexpected is printed to stderr we report 'warn'
for the test result.  The list of expected/allowed stderr message is
found at the end of core.py.  It's a PITA to update this list and if
you've temporarily inserted extra debug code in Mesa/gallium it causes
piglit to just report 'warn' instead of the more useful 'pass/fail'.

I wonder if anybody depends on stderr output for generating 'warn'
results.  If not, maybe we should just remove that feature entirely.
---
  framework/core.py |5 +++--
  framework/exectest.py |5 +++--
  piglit-run.py |7 ++-
  3 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/framework/core.py b/framework/core.py
index 08f442f..8d0d0a6 100644
--- a/framework/core.py
+++ b/framework/core.py
@@ -372,13 +372,14 @@ class TestrunResult:

  class Environment:
def __init__(self, concurrent=True, execute=True, include_filter=[],
-   exclude_filter=[], valgrind=False):
+   exclude_filter=[], valgrind=False, ignoreStderr=False):
self.concurrent = concurrent
self.execute= execute
self.filter = []
self.exclude_filter = []
self.exclude_tests  = set()
self.valgrind   = valgrind
+   self.ignoreStderr   = ignoreStderr


The filter lists that are read in should be a list of string 
objects,
@@ -455,7 +456,7 @@ class Test:
try:
status(running)
time_start = time.time()
-   result = self.run(env.valgrind)
+   result = self.run(env.valgrind, 
env.ignoreStderr)
time_end = time.time()
if 'time' not in result:
result['time'] = time_end - time_start
diff --git a/framework/exectest.py b/framework/exectest.py
index b8d97b8..007cf49 100644
--- a/framework/exectest.py
+++ b/framework/exectest.py
@@ -55,7 +55,7 @@ class ExecTest(Test):
raise NotImplementedError
return out

-   def run(self, valgrind):
+   def run(self, valgrind, ignoreStderr):

Run a test.  The return value will be a dictionary with keys
including 'result', 'info', 'returncode' and 'command'.
@@ -161,7 +161,8 @@ class ExecTest(Test):
results['returncode'] = returncode
results['command'] = ' '.join(self.command)

-   self.handleErr(results, err)
+   if not ignoreStderr:
+   self.handleErr(results, err)

else:
results = TestResult()
diff --git a/piglit-run.py b/piglit-run.py
index 6d6ec77..d6aadf0 100755
--- a/piglit-run.py
+++ b/piglit-run.py
@@ -94,6 +94,10 @@ def main():
parser.add_argument(--valgrind,
action  =  store_true,
help= Run tests in valgrind's memcheck)
+   parser.add_argument(--ignoreStderr,
+   action  = store_true,
+   help= Ignore messages printed to stderr (don't report 
'warn'
+  for unexpected stderr messages))
parser.add_argument(testProfile,
metavar = Path to test profile,
help= Path to testfile to run)
@@ -155,7 +159,8 @@ def main():
exclude_filter=args.exclude_tests,
include_filter=args.include_tests,
execute=args.execute,
-   valgrind=args.valgrind)
+   valgrind=args.valgrind,
+   ignoreStderr=args.ignoreStderr)

# Change working directory to the root of the piglit directory
piglit_dir = path.dirname(path.realpath(sys.argv[0]))
--
1.7.3.4

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




[Piglit] [PATCH] add new --ignoreStderr option to piglit-run.py

2013-04-18 Thread Brian Paul
Normally, if anything unexpected is printed to stderr we report 'warn'
for the test result.  The list of expected/allowed stderr message is
found at the end of core.py.  It's a PITA to update this list and if
you've temporarily inserted extra debug code in Mesa/gallium it causes
piglit to just report 'warn' instead of the more useful 'pass/fail'.

I wonder if anybody depends on stderr output for generating 'warn'
results.  If not, maybe we should just remove that feature entirely.
---
 framework/core.py |5 +++--
 framework/exectest.py |5 +++--
 piglit-run.py |7 ++-
 3 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/framework/core.py b/framework/core.py
index 08f442f..8d0d0a6 100644
--- a/framework/core.py
+++ b/framework/core.py
@@ -372,13 +372,14 @@ class TestrunResult:
 
 class Environment:
def __init__(self, concurrent=True, execute=True, include_filter=[],
-   exclude_filter=[], valgrind=False):
+   exclude_filter=[], valgrind=False, ignoreStderr=False):
self.concurrent = concurrent
self.execute= execute
self.filter = []
self.exclude_filter = []
self.exclude_tests  = set()
self.valgrind   = valgrind
+   self.ignoreStderr   = ignoreStderr
 

The filter lists that are read in should be a list of string 
objects,
@@ -455,7 +456,7 @@ class Test:
try:
status(running)
time_start = time.time()
-   result = self.run(env.valgrind)
+   result = self.run(env.valgrind, 
env.ignoreStderr)
time_end = time.time()
if 'time' not in result:
result['time'] = time_end - time_start
diff --git a/framework/exectest.py b/framework/exectest.py
index b8d97b8..007cf49 100644
--- a/framework/exectest.py
+++ b/framework/exectest.py
@@ -55,7 +55,7 @@ class ExecTest(Test):
raise NotImplementedError
return out
 
-   def run(self, valgrind):
+   def run(self, valgrind, ignoreStderr):

Run a test.  The return value will be a dictionary with keys
including 'result', 'info', 'returncode' and 'command'.
@@ -161,7 +161,8 @@ class ExecTest(Test):
results['returncode'] = returncode
results['command'] = ' '.join(self.command)
 
-   self.handleErr(results, err)
+   if not ignoreStderr:
+   self.handleErr(results, err)
 
else:
results = TestResult()
diff --git a/piglit-run.py b/piglit-run.py
index 6d6ec77..d6aadf0 100755
--- a/piglit-run.py
+++ b/piglit-run.py
@@ -94,6 +94,10 @@ def main():
parser.add_argument(--valgrind,
action  =  store_true,
help= Run tests in valgrind's memcheck)
+   parser.add_argument(--ignoreStderr,
+   action  = store_true,
+   help= Ignore messages printed to stderr (don't 
report 'warn'
+  for unexpected stderr messages))
parser.add_argument(testProfile,
metavar = Path to test profile,
help= Path to testfile to run)
@@ -155,7 +159,8 @@ def main():
exclude_filter=args.exclude_tests,
include_filter=args.include_tests,
execute=args.execute,
-   valgrind=args.valgrind)
+   valgrind=args.valgrind,
+   ignoreStderr=args.ignoreStderr)
 
# Change working directory to the root of the piglit directory
piglit_dir = path.dirname(path.realpath(sys.argv[0]))
-- 
1.7.3.4

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


[Piglit] [PATCH] add a simple glinfo test program

2013-04-18 Thread Brian Paul
When doing a full piglit run it's helpful to have all the OpenGL
driver version/vendor/extension info.  The piglit framework tries
to run glxinfo/wglinfo and include the output in the results file,
but sometimes those programs aren't installed.
---
 tests/all.tests |1 +
 tests/general/CMakeLists.gl.txt |1 +
 tests/general/glinfo.c  |   92 +++
 3 files changed, 94 insertions(+), 0 deletions(-)
 create mode 100644 tests/general/glinfo.c

diff --git a/tests/all.tests b/tests/all.tests
index daebbd3..4e85a34 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -512,6 +512,7 @@ add_plain_test(gl11, 'fragment-center')
 add_fbo_depthstencil_tests(gl11, 'default_fb')
 add_plain_test(gl11, 'geterror-invalid-enum')
 add_plain_test(gl11, 'geterror-inside-begin')
+add_concurrent_test(gl11, 'glinfo')
 add_plain_test(gl11, 'hiz')
 add_plain_test(gl11, 'infinite-spot-light')
 add_plain_test(gl11, 'line-aa-width')
diff --git a/tests/general/CMakeLists.gl.txt b/tests/general/CMakeLists.gl.txt
index e1eb3e3..0e87baa 100644
--- a/tests/general/CMakeLists.gl.txt
+++ b/tests/general/CMakeLists.gl.txt
@@ -67,6 +67,7 @@ ENDIF (UNIX)
 piglit_add_executable (getactiveattrib getactiveattrib.c)
 piglit_add_executable (geterror-inside-begin geterror-inside-begin.c)
 piglit_add_executable (geterror-invalid-enum geterror-invalid-enum.c)
+piglit_add_executable (glinfo glinfo.c)
 piglit_add_executable (gl30basic gl30basic.c)
 piglit_add_executable (hiz hiz.c)
 if (UNIX)
diff --git a/tests/general/glinfo.c b/tests/general/glinfo.c
new file mode 100644
index 000..b60ae6d
--- /dev/null
+++ b/tests/general/glinfo.c
@@ -0,0 +1,92 @@
+/*
+ * Copyright © 2013 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.
+ */
+
+/**
+ * Simply query and print various glGetString() values.
+ * This is helpful when running a complete piglit run since the
+ * results file will have all the pertinant info for the GL driver
+ * that was tested.
+ *
+ * Note that the piglit framework tries to run glxinfo/wglinfo and
+ * put the output in the results file, but sometimes those programs
+ * aren't installed.
+ *
+ * Brian Paul
+ * April 2013
+ */
+
+
+#include piglit-util-gl-common.h
+
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+   config.supports_gl_compat_version = 10;
+   config.window_visual = PIGLIT_GL_VISUAL_RGB;
+PIGLIT_GL_TEST_CONFIG_END
+
+
+enum piglit_result
+piglit_display(void)
+{
+   return PIGLIT_PASS;
+}
+
+
+void
+piglit_init(int argc, char **argv)
+{
+   const char *renderer = (const char *) glGetString(GL_RENDERER);
+   const char *version = (const char *) glGetString(GL_VERSION);
+   const char *vendor = (const char *) glGetString(GL_VENDOR);
+
+   printf(GL_RENDERER = %s\n, renderer);
+   printf(GL_VERSION = %s\n, version);
+   printf(GL_VENDOR = %s\n, vendor);
+
+   if (version[0] = '2') {
+   printf(GL_SHADING_LANGUAGE_VERSION = %s\n, (const char *)
+  glGetString(GL_SHADING_LANGUAGE_VERSION));
+   }
+
+   printf(Extensions:\n);
+   if (version[0] = '3') {
+   GLint numExt, i;
+   glGetIntegerv(GL_NUM_EXTENSIONS, numExt);
+   for (i = 0; i  numExt; i++) {
+   printf(%s\n, (const char *)
+  glGetStringi(GL_EXTENSIONS, i));
+   }
+   }
+   else {
+   const char *ext = (const char *) glGetString(GL_EXTENSIONS);
+   const char *c = ext;
+   for (c = ext; *c; c++) {
+   if (*c == ' ')
+   putchar('\n');
+   else
+   putchar(*c);
+   }
+   }
+
+   piglit_report_result(PIGLIT_PASS);
+}
-- 
1.7.3.4

___
Piglit mailing list
Piglit

[Piglit] [PATCH] add new piglit-summary.py script for printing summaries of results file(s)

2013-04-18 Thread Brian Paul
If only one result file is specified, just print all the tests
followed by the outcome.  For example:

fbo/FBO blit from missing attachment: pass
fbo/FBO blit to missing attachment: fail
fbo/fbo-1d: pass
fbo/fbo-3d: crash
[...]

If multiple result files are specified, we'll print pass/fail/etc
for each file.  Example:

fbo/FBO blit from missing attachment: pass pass
fbo/FBO blit to missing attachment: fail pass
[...]

If -s (--summary) is specified, only print a summary of the number of
passes, fails, crashes, etc.

if -d (-diff) is specified with multipe result files, only print the
tests which had different outcomes.  Good for spotting regressions.
---
 piglit-summary.py |  158 +
 1 files changed, 158 insertions(+), 0 deletions(-)
 create mode 100755 piglit-summary.py

diff --git a/piglit-summary.py b/piglit-summary.py
new file mode 100755
index 000..ae1e5ca
--- /dev/null
+++ b/piglit-summary.py
@@ -0,0 +1,158 @@
+#!/usr/bin/env python
+#
+# 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:
+#
+# This permission notice 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 AUTHOR(S) 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.
+
+# Print a very simple summary of piglit results file(s).
+# When multiple result files are specified, compare the results
+# of each test run to look for differences/regressions.
+#
+# Brian Paul
+# April 2013
+
+
+from getopt import getopt, GetoptError
+import cgi
+import os, os.path
+import sys
+import string
+
+sys.path.append(os.path.dirname(os.path.realpath(sys.argv[0])))
+import framework.core as core
+import framework.summary
+
+
+#
+# Main program
+#
+def usage():
+   USAGE = \
+Usage: %(progName)s [options] resultsfile [...]
+
+Print path/name of each test and the result.
+When multiple files are specified, count the number of differences in results.
+Tests are sorted by name.
+
+Options:
+  -h, --helpShow this message
+  -s, --summary Only display pass/fail summary
+  -d, --diffOnly display the differences between multiple result 
files
+  -l, --list=listfile   Use test results from a list file
+
+   print USAGE % {'progName': sys.argv[0]}
+   sys.exit(1)
+
+
+def parse_listfile(filename):
+   file = open(filename, r)
+   code = .join([s for s in file])
+   file.close()
+   return eval(code)
+
+def loadresult(descr):
+   result = core.loadTestResults(descr[0])
+   if len(descr)  1:
+   result.__dict__.update(descr[1])
+   return result
+
+def main():
+   try:
+   options, args = getopt(sys.argv[1:], hsdl:, [ help, 
summary, diff, list ])
+   except GetoptError:
+   usage()
+
+   OptionList = []
+   CountsOnly = False
+   DiffOnly = False
+   for name, value in options:
+   if name == -h or name == --help:
+   usage()
+   elif name == -s or name == --summary:
+   CountsOnly = True
+   elif name == -d or name == --diff:
+   DiffOnly = True
+   elif name == -l or name == --list:
+   OptionList += parse_listfile(value)
+
+   OptionList += [[name] for name in args[0:]]
+
+   if len(args)  1 or len(OptionList) == 0:
+   usage()
+
+   # make list of results
+   results = []
+   for result_dir in OptionList:
+   results.append(loadresult(result_dir))
+
+   summary = framework.summary.Summary(results)
+
+   # possible test outcomes
+   possible_results = [ pass, fail, crash, skip, warn ]
+   if len(OptionList)  1:
+   possible_results.append(changes)
+
+   # init the summary counters
+   counts = {}
+   for result in possible_results:
+   counts[result] = 0
+
+   # get all results
+   all = summary.allTests()
+
+   # sort the results list by path
+   all = sorted(all

Re: [Piglit] Requiring Python 3.x for Piglit?

2013-04-17 Thread Brian Paul

On 04/17/2013 03:48 AM, Kenneth Graunke wrote:

Does anyone object to porting to Python 3.x (and dropping 2.x support)?

Some useful data points:
- Debian stable has 3.1, testing/unstable have 3.2
- Fedora 18 and Arch Linux have 3.3
- Windows installers for 3.3 are available on python.org
- Mac OS X support for 3.3 is also available on python.org

- numpy and mako are both available for Python 3 now. numpy is
packaged on Arch and Debian testing/unstable. Not sure how much of a
pain it is to get on Windows/OSX.

- intel-gpu-tools now requires Python 3.x to build.

Jon Severinsson did a great job in making a hybrid solution that works
with both Python 2 and 3, but I'm a bit nervous about some of it. For
example, unicode stuff has bitten us in the past, and supporting only
one major language version seems a lot easier to get right. It'd also
be a lot cleaner to just transition to Python 3.x.


We have an environment here that uses Python 2.6.  I've had to hack a 
few things to make piglit work there but it's not bad.  Going to 
Python 3.x might be pretty painful, but I'd have to do some research 
to know for sure, and I don't have time right now.


Can we please hold off on this for a while?

-Brian

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


Re: [Piglit] [PATCH 5/5] gl-1.0: use default window size to fix Windows run

2013-04-06 Thread Brian Paul

On 04/06/2013 03:21 AM, Jose Fonseca wrote:

Brian,

Series looks alright, but it looks to me this is a pervasive issue, and not 
just a few isolated cases:

  piglit $ git grep config.window_width | wc -l
  461

So I wonder if there isn't a more definite solution. For example, could we 
simply modify tests/util/... helper code to sanitize window_width/height on 
Windows before the window is created?


In some cases, we can't just change the window size without breaking 
things.  Ex: draw-pixels.c needed a glPixelStore() change to work with 
different sizes.  Others which probe hard-coded pixel positions can 
fail with different sizes.




Also, I think this is probably just a glut limitation, not a Windows intrinsic 
limitation. If we switched to waffle we could force the window to be any size 
by mimicking what mesa/src/gallium/state_trackers/wgl/stw_ext_pbuffer.c does.


Unfortunately, I don't think waffle has any WGL support yet.

-Brian




Jose

- Original Message -

---
  tests/spec/gl-1.0/edgeflag-quads.c |2 --
  tests/spec/gl-1.0/edgeflag.c   |2 --
  2 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/tests/spec/gl-1.0/edgeflag-quads.c
b/tests/spec/gl-1.0/edgeflag-quads.c
index 12ad289..702513d 100644
--- a/tests/spec/gl-1.0/edgeflag-quads.c
+++ b/tests/spec/gl-1.0/edgeflag-quads.c
@@ -36,8 +36,6 @@ PIGLIT_GL_TEST_CONFIG_BEGIN

config.supports_gl_compat_version = 10;

-   config.window_width = 32;
-   config.window_height = 32;
config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGB |
PIGLIT_GL_VISUAL_ALPHA;

  PIGLIT_GL_TEST_CONFIG_END
diff --git a/tests/spec/gl-1.0/edgeflag.c b/tests/spec/gl-1.0/edgeflag.c
index aa1cb6a..15b0aff 100644
--- a/tests/spec/gl-1.0/edgeflag.c
+++ b/tests/spec/gl-1.0/edgeflag.c
@@ -32,8 +32,6 @@ PIGLIT_GL_TEST_CONFIG_BEGIN

config.supports_gl_compat_version = 10;

-   config.window_width = 32;
-   config.window_height = 32;
config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGB |
PIGLIT_GL_VISUAL_ALPHA;

  PIGLIT_GL_TEST_CONFIG_END
--
1.7.3.4

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



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


[Piglit] [PATCH 1/5] arb_sampler_objects: use default window size to fix Windows run

2013-04-05 Thread Brian Paul
---
 tests/spec/arb_sampler_objects/framebufferblit.c |2 --
 tests/spec/arb_sampler_objects/srgb-decode.c |2 --
 2 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/tests/spec/arb_sampler_objects/framebufferblit.c 
b/tests/spec/arb_sampler_objects/framebufferblit.c
index ca3bc1d..01ef552 100644
--- a/tests/spec/arb_sampler_objects/framebufferblit.c
+++ b/tests/spec/arb_sampler_objects/framebufferblit.c
@@ -40,8 +40,6 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
 
config.supports_gl_compat_version = 10;
 
-   config.window_width = 16;
-   config.window_height = 16;
config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGB | 
PIGLIT_GL_VISUAL_ALPHA;
 
 PIGLIT_GL_TEST_CONFIG_END
diff --git a/tests/spec/arb_sampler_objects/srgb-decode.c 
b/tests/spec/arb_sampler_objects/srgb-decode.c
index 4f616ae..7c89bb1 100644
--- a/tests/spec/arb_sampler_objects/srgb-decode.c
+++ b/tests/spec/arb_sampler_objects/srgb-decode.c
@@ -45,8 +45,6 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
 
config.supports_gl_compat_version = 10;
 
-   config.window_width = 16;
-   config.window_height = 16;
config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGB | 
PIGLIT_GL_VISUAL_ALPHA;
 
 PIGLIT_GL_TEST_CONFIG_END
-- 
1.7.3.4

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


[Piglit] [PATCH 2/5] arb_shader_objects: use default window size to fix Windows run

2013-04-05 Thread Brian Paul
---
 .../bindattriblocation-scratch-name.c  |2 --
 tests/spec/arb_shader_objects/clear-with-deleted.c |2 --
 tests/spec/arb_shader_objects/delete-repeat.c  |2 --
 .../arb_shader_objects/getactiveuniform-beginend.c |2 --
 tests/spec/arb_shader_objects/getuniform.c |2 --
 5 files changed, 0 insertions(+), 10 deletions(-)

diff --git a/tests/spec/arb_shader_objects/bindattriblocation-scratch-name.c 
b/tests/spec/arb_shader_objects/bindattriblocation-scratch-name.c
index ec09800..8d3d232 100644
--- a/tests/spec/arb_shader_objects/bindattriblocation-scratch-name.c
+++ b/tests/spec/arb_shader_objects/bindattriblocation-scratch-name.c
@@ -37,8 +37,6 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
 
config.supports_gl_compat_version = 10;
 
-   config.window_width = 10;
-   config.window_height = 10;
config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
 
 PIGLIT_GL_TEST_CONFIG_END
diff --git a/tests/spec/arb_shader_objects/clear-with-deleted.c 
b/tests/spec/arb_shader_objects/clear-with-deleted.c
index 59d5ed4..02fa7f0 100644
--- a/tests/spec/arb_shader_objects/clear-with-deleted.c
+++ b/tests/spec/arb_shader_objects/clear-with-deleted.c
@@ -36,8 +36,6 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
 
config.supports_gl_compat_version = 10;
 
-   config.window_width = 32;
-   config.window_height = 32;
config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGB | 
PIGLIT_GL_VISUAL_ALPHA;
 
 PIGLIT_GL_TEST_CONFIG_END
diff --git a/tests/spec/arb_shader_objects/delete-repeat.c 
b/tests/spec/arb_shader_objects/delete-repeat.c
index 135db63..9a27eb0 100644
--- a/tests/spec/arb_shader_objects/delete-repeat.c
+++ b/tests/spec/arb_shader_objects/delete-repeat.c
@@ -33,8 +33,6 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
 
config.supports_gl_compat_version = 10;
 
-   config.window_width = 32;
-   config.window_height = 32;
config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGB | 
PIGLIT_GL_VISUAL_ALPHA;
 
 PIGLIT_GL_TEST_CONFIG_END
diff --git a/tests/spec/arb_shader_objects/getactiveuniform-beginend.c 
b/tests/spec/arb_shader_objects/getactiveuniform-beginend.c
index d275b36..0f11a6a 100644
--- a/tests/spec/arb_shader_objects/getactiveuniform-beginend.c
+++ b/tests/spec/arb_shader_objects/getactiveuniform-beginend.c
@@ -36,8 +36,6 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
 
config.supports_gl_compat_version = 10;
 
-   config.window_width = 32;
-   config.window_height = 32;
config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGB | 
PIGLIT_GL_VISUAL_ALPHA;
 
 PIGLIT_GL_TEST_CONFIG_END
diff --git a/tests/spec/arb_shader_objects/getuniform.c 
b/tests/spec/arb_shader_objects/getuniform.c
index d18b39c..acb35ae 100644
--- a/tests/spec/arb_shader_objects/getuniform.c
+++ b/tests/spec/arb_shader_objects/getuniform.c
@@ -32,8 +32,6 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
 
config.supports_gl_compat_version = 10;
 
-   config.window_width = 32;
-   config.window_height = 32;
config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGB | 
PIGLIT_GL_VISUAL_ALPHA;
 
 PIGLIT_GL_TEST_CONFIG_END
-- 
1.7.3.4

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


[Piglit] [PATCH 3/5] arb_framebuffer_object: use default window size to fix Windows run

2013-04-05 Thread Brian Paul
---
 .../framebuffer-blit-levels.c  |2 --
 .../get-renderbuffer-internalformat.c  |2 --
 2 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/tests/spec/arb_framebuffer_object/framebuffer-blit-levels.c 
b/tests/spec/arb_framebuffer_object/framebuffer-blit-levels.c
index 37fdbcf..fef3718 100644
--- a/tests/spec/arb_framebuffer_object/framebuffer-blit-levels.c
+++ b/tests/spec/arb_framebuffer_object/framebuffer-blit-levels.c
@@ -58,8 +58,6 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
 
config.supports_gl_compat_version = 10;
 
-   config.window_width = 32;
-   config.window_height = 32;
config.window_visual = PIGLIT_GL_VISUAL_RGBA;
 
 PIGLIT_GL_TEST_CONFIG_END
diff --git 
a/tests/spec/arb_framebuffer_object/get-renderbuffer-internalformat.c 
b/tests/spec/arb_framebuffer_object/get-renderbuffer-internalformat.c
index 5dca392..f6f6e82 100644
--- a/tests/spec/arb_framebuffer_object/get-renderbuffer-internalformat.c
+++ b/tests/spec/arb_framebuffer_object/get-renderbuffer-internalformat.c
@@ -36,8 +36,6 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
 
config.supports_gl_compat_version = 10;
 
-   config.window_width = 10;
-   config.window_height = 10;
config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGB;
 
 PIGLIT_GL_TEST_CONFIG_END
-- 
1.7.3.4

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


[Piglit] [PATCH 4/5] arb_vertex_buffer_object: use default window size to fix Windows run

2013-04-05 Thread Brian Paul
---
 .../elements-negative-offset.c |2 --
 .../mixed-immediate-and-vbo.c  |2 --
 2 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/tests/spec/arb_vertex_buffer_object/elements-negative-offset.c 
b/tests/spec/arb_vertex_buffer_object/elements-negative-offset.c
index b18da73..343d7fd 100644
--- a/tests/spec/arb_vertex_buffer_object/elements-negative-offset.c
+++ b/tests/spec/arb_vertex_buffer_object/elements-negative-offset.c
@@ -34,8 +34,6 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
 
config.supports_gl_compat_version = 10;
 
-   config.window_width = 64;
-   config.window_height = 64;
config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE | 
PIGLIT_GL_VISUAL_ALPHA;
 
 PIGLIT_GL_TEST_CONFIG_END
diff --git a/tests/spec/arb_vertex_buffer_object/mixed-immediate-and-vbo.c 
b/tests/spec/arb_vertex_buffer_object/mixed-immediate-and-vbo.c
index 72d7ea7..f0450d0 100644
--- a/tests/spec/arb_vertex_buffer_object/mixed-immediate-and-vbo.c
+++ b/tests/spec/arb_vertex_buffer_object/mixed-immediate-and-vbo.c
@@ -36,8 +36,6 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
 
config.supports_gl_compat_version = 10;
 
-   config.window_width = 64;
-   config.window_height = 64;
config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE | 
PIGLIT_GL_VISUAL_ALPHA;
 
 PIGLIT_GL_TEST_CONFIG_END
-- 
1.7.3.4

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


[Piglit] [PATCH 5/5] gl-1.0: use default window size to fix Windows run

2013-04-05 Thread Brian Paul
---
 tests/spec/gl-1.0/edgeflag-quads.c |2 --
 tests/spec/gl-1.0/edgeflag.c   |2 --
 2 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/tests/spec/gl-1.0/edgeflag-quads.c 
b/tests/spec/gl-1.0/edgeflag-quads.c
index 12ad289..702513d 100644
--- a/tests/spec/gl-1.0/edgeflag-quads.c
+++ b/tests/spec/gl-1.0/edgeflag-quads.c
@@ -36,8 +36,6 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
 
config.supports_gl_compat_version = 10;
 
-   config.window_width = 32;
-   config.window_height = 32;
config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGB | 
PIGLIT_GL_VISUAL_ALPHA;
 
 PIGLIT_GL_TEST_CONFIG_END
diff --git a/tests/spec/gl-1.0/edgeflag.c b/tests/spec/gl-1.0/edgeflag.c
index aa1cb6a..15b0aff 100644
--- a/tests/spec/gl-1.0/edgeflag.c
+++ b/tests/spec/gl-1.0/edgeflag.c
@@ -32,8 +32,6 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
 
config.supports_gl_compat_version = 10;
 
-   config.window_width = 32;
-   config.window_height = 32;
config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGB | 
PIGLIT_GL_VISUAL_ALPHA;
 
 PIGLIT_GL_TEST_CONFIG_END
-- 
1.7.3.4

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


[Piglit] [PATCH 1/3] draw-pixels: display results when there's a failure

2013-04-05 Thread Brian Paul
---
 tests/general/draw-pixels.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/tests/general/draw-pixels.c b/tests/general/draw-pixels.c
index 383f335..0506ead 100644
--- a/tests/general/draw-pixels.c
+++ b/tests/general/draw-pixels.c
@@ -871,6 +871,10 @@ piglit_display(void)
}
free(pixels);
pixels = NULL;
+
+   if (!pass) {
+   piglit_present_results();
+   }
}
}
}
-- 
1.7.3.4

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


[Piglit] [PATCH 2/3] draw-pixels: use better test values

2013-04-05 Thread Brian Paul
As it was, many of the generated / expected pixel values were all
zeros.  Use better values that actually fit in the given datatype.

For example, we were trying to store 0x23  (6 - j) in a GLbyte.
---
 tests/general/draw-pixels.c |   36 +++-
 1 files changed, 7 insertions(+), 29 deletions(-)

diff --git a/tests/general/draw-pixels.c b/tests/general/draw-pixels.c
index 0506ead..26fd121 100644
--- a/tests/general/draw-pixels.c
+++ b/tests/general/draw-pixels.c
@@ -167,8 +167,7 @@ allocPixels(GLenum format, GLenum type, GLuint components)
pixels = calloc(npixels * components, sizeof(GLbyte));
for (i = 0; i  npixels; i++) {
for (j = 0; j  components; j++)
-   ((GLbyte *)pixels)[i * components + j] =
-   0x23  (6 - j);
+   ((GLbyte *)pixels)[i * components + j] = 50 + j 
* 4;
}
break;
 
@@ -176,8 +175,7 @@ allocPixels(GLenum format, GLenum type, GLuint components)
pixels = calloc(npixels * components, sizeof(GLubyte));
for (i = 0; i  npixels; i++) {
for (j = 0; j  components; j++)
-   ((GLubyte *)pixels)[i * components + j] =
-   0x53  (6 - j);
+   ((GLubyte *)pixels)[i * components + j] = 100 + 
j * 4;
}
break;
 
@@ -193,12 +191,7 @@ allocPixels(GLenum format, GLenum type, GLuint components)
pixels = calloc(npixels * components, sizeof(GLshort));
for (i = 0; i  npixels; i++) {
for (j = 0; j  components; j++) {
-   if (format == GL_STENCIL_INDEX)
-   ((GLshort *)pixels)[i * components + j] 
=
-   0x1  3;
-   else
-   ((GLshort *)pixels)[i * components + j] 
=
-   0x1  (14 - j);
+   ((GLshort *)pixels)[i * components + j] = 
0x1234;
}
}
break;
@@ -207,12 +200,7 @@ allocPixels(GLenum format, GLenum type, GLuint components)
pixels = calloc(npixels * components, sizeof(GLushort));
for (i = 0; i  npixels; i++) {
for (j = 0; j  components; j++) {
-   if (format == GL_STENCIL_INDEX)
-   ((GLushort *)pixels)[i * components + 
j] =
-   0x37  7;
-   else
-   ((GLushort *)pixels)[i * components + 
j] =
-   0x1a37  (14 - j);
+   ((GLushort *)pixels)[i * components + j] = 
0x43212;
}
}
break;
@@ -232,12 +220,7 @@ allocPixels(GLenum format, GLenum type, GLuint components)
pixels = calloc(npixels * components, sizeof(GLint));
for (i = 0; i  npixels; i++) {
for (j = 0; j  components; j++) {
-   if (format == GL_STENCIL_INDEX)
-   ((GLint *)pixels)[i * components + j] =
-   0x1  4;
-   else
-   ((GLint *)pixels)[i * components + j] =
-   0x1  (30 - j);
+   ((GLint *)pixels)[i * components + j] = 
0x12345678;
}
}
break;
@@ -246,12 +229,7 @@ allocPixels(GLenum format, GLenum type, GLuint components)
pixels = calloc(npixels * components, sizeof(GLuint));
for (i = 0; i  npixels; i++) {
for (j = 0; j  components; j++) {
-   if (format == GL_STENCIL_INDEX)
-   ((GLuint *)pixels)[i * components + j] =
-   0x1a324b11  5;
-   else
-   ((GLuint *)pixels)[i * components + j] =
-   0x1a4b5a4b  (4 - j);
+   ((GLuint *)pixels)[i * components + j] = 
0x87654321;
}
}
break;
@@ -271,7 +249,7 @@ allocPixels(GLenum format, GLenum type, GLuint components)
for (j = 0; j  components; j++) {
if (format == GL_STENCIL_INDEX)
((GLfloat *)pixels)[i * components + j] 
=
-   0x1  3;
+

[Piglit] [PATCH 3/3] draw-pixels: use default window size, for Windows

2013-04-05 Thread Brian Paul
And set the pixel unpack alignment to 1 so that we don't fail if
the window width isn't a multiple of four.
---
 tests/general/draw-pixels.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/general/draw-pixels.c b/tests/general/draw-pixels.c
index 26fd121..33a1eb0 100644
--- a/tests/general/draw-pixels.c
+++ b/tests/general/draw-pixels.c
@@ -55,8 +55,6 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
 
config.supports_gl_compat_version = 10;
 
-   config.window_width = 16;
-   config.window_height = 16;
config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA 
| PIGLIT_GL_VISUAL_ALPHA | PIGLIT_GL_VISUAL_DEPTH | PIGLIT_GL_VISUAL_STENCIL;
 
 PIGLIT_GL_TEST_CONFIG_END
@@ -720,6 +718,8 @@ piglit_display(void)
GLfloat black[4] = {0.0, 0.0, 0.0, 1.0};
GLfloat red[4] = {1.0, 0.0, 0.0, 1.0};
 
+   glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+
for (i = 0; i  ARRAY_SIZE(data_types); i++) {
for (k = 0; k  ARRAY_SIZE(pixel_ops); k++) {
for (j = 0; j  ARRAY_SIZE(pixel_formats); j++) {
-- 
1.7.3.4

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


Re: [Piglit] [PATCH] arb_shader_texture_lod-texgradcube: Test explicit derivatives for cube maps

2013-04-03 Thread Brian Paul
 = piglit_link_simple_program(0, fs_tex);
+   prog_texgrad = piglit_link_simple_program(0, fs_texgrad);
+
+   glGenTextures(1,tex);
+   glBindTexture(GL_TEXTURE_CUBE_MAP, tex);
+
+   glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, 
GL_LINEAR_MIPMAP_LINEAR);
+   glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+
+   for (j = GL_TEXTURE_CUBE_MAP_POSITIVE_X; j= 
GL_TEXTURE_CUBE_MAP_NEGATIVE_Z; j++) {
+   for (i = 0, dim = TEX_WIDTH; dim0; i++, dim /= 2) {
+   glTexImage2D(j, i, GL_RGBA,
+dim, dim,
+0,
+GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+   }
+   }
+   assert(glGetError() == 0);
+
+   glBindTexture(GL_TEXTURE_CUBE_MAP, 0);
+   glDisable(GL_TEXTURE_CUBE_MAP);
+
+   glGenFramebuffersEXT(1,fb);
+   glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
+
+   for (j = GL_TEXTURE_CUBE_MAP_POSITIVE_X; j= 
GL_TEXTURE_CUBE_MAP_NEGATIVE_Z; j++) {
+   for (i = 0, dim = TEX_WIDTH; dim0; i++, dim /= 2) {
+   glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,
+ GL_COLOR_ATTACHMENT0_EXT,
+ j,
+ tex,
+ i);
+
+   status = glCheckFramebufferStatusEXT 
(GL_FRAMEBUFFER_EXT);
+   if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
+   fprintf(stderr, FBO incomplete\n);
+   piglit_report_result(PIGLIT_SKIP);
+   }
+
+   glClearColor(colors[i][0],
+colors[i][1],
+colors[i][2],
+0.0);
+   glClear(GL_COLOR_BUFFER_BIT);
+
+   assert(glGetError() == 0);
+   }
+   }
+
+   glDeleteFramebuffersEXT(1,fb);
+   glBindTexture(GL_TEXTURE_CUBE_MAP, tex);
+
+   glMatrixMode(GL_PROJECTION);
+   glLoadIdentity();
+   glFrustum(-0.1, 0.1, -0.1, 0.1, 0.1, 1000.0);
+
+   glMatrixMode(GL_MODELVIEW);
+   glLoadIdentity();
+   glTranslatef(-0.5, -0.5, -1.2);
+   glRotatef(68, 0, 1, 0);
+   glScalef(2000, 1, 1);
+
+   glEnable(GL_TEXTURE_CUBE_MAP);
+   glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
+
+   piglit_set_tolerance_for_bits(7, 7, 7, 7);
+
+   printf(Left: textureCube, Right: textureCubeGradARB\n);
+}
+
+static void draw_quad()
+{
+   glBegin(GL_QUADS);
+   glTexCoord3f(-0.5, -0.5, 1);
+   glVertex2f(0, 0);
+   glTexCoord3f(0.5, -0.5, 1);
+   glVertex2f(1, 0);
+   glTexCoord3f(0.5, 0.5, 1);
+   glVertex2f(1, 1);
+   glTexCoord3f(-0.5, 0.5, 1);
+   glVertex2f(0, 1);
+   glEnd();
+}
+
+enum piglit_result piglit_display(void)
+{
+   GLboolean pass = GL_TRUE;
+
+   glViewport(0, 0, piglit_width, piglit_height);
+   glClearColor(0.5, 0.5, 0.5, 0.5);
+   glClear(GL_COLOR_BUFFER_BIT);
+
+   glViewport(0, 0, piglit_width/2, piglit_height);
+   glUseProgram(prog_tex);
+   draw_quad();
+
+   glViewport(piglit_width/2, 0, piglit_width/2, piglit_height);
+   glUseProgram(prog_texgrad);
+   draw_quad();
+
+   if (!piglit_probe_rect_halves_equal_rgba(0, 0, piglit_width, 
piglit_height))
+   pass = GL_FALSE;
+
+   piglit_present_results();
+
+   return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+}


It looks like you're building a complete mipmap but only testing the 
0th mipmap level.  Could you hit those other levels by drawing some 
smaller quads?


Otherwise looks good.  Reviewed-by: Brian Paul bri...@vmware.com
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] provoking-vertex: also test clockwise triangles

2013-03-29 Thread Brian Paul
in addition to the counter-clockwise triangles.
Plus minor clean-ups.
---
 tests/general/provoking-vertex.c |   58 +++--
 1 files changed, 42 insertions(+), 16 deletions(-)

diff --git a/tests/general/provoking-vertex.c b/tests/general/provoking-vertex.c
index 55dc4c0..6227f2d 100644
--- a/tests/general/provoking-vertex.c
+++ b/tests/general/provoking-vertex.c
@@ -58,33 +58,59 @@ piglit_init(int argc, char **argv)
 enum piglit_result
 piglit_display(void)
 {
-   float red[3] = {1.0, 0.0, 0.0};
-   float blue[3] = {0.0, 0.0, 1.0};
+   static const float red[3] = {0.9, 0.0, 0.0};
+   static const float blue[3] = {0.0, 0.0, 0.9};
+   static const float green[3] = {0.0, 1.0, 0.0};
GLboolean pass = GL_TRUE;
 
glClear(GL_COLOR_BUFFER_BIT);
glProvokingVertexEXT(GL_FIRST_VERTEX_CONVENTION_EXT);
+/* lower triangle: counter-clockwise */
glBegin(GL_TRIANGLES);
-   glColor3f(1.0, 0.0, 0.0);
-   glVertex3i(125, 125, 0);
-   glColor3f(0.0, 1.0, 0.0);
-   glVertex3i(175, 125, 0);
-   glColor3f(0.0, 0.0, 1.0);
-   glVertex3i(150, 150, 0);
+   glColor3fv(red);
+   glVertex3i(125, 85, 0);
+   glColor3fv(green);
+   glVertex3i(175, 85, 0);
+   glColor3fv(blue);
+   glVertex3i(150, 110, 0);
+   glEnd();
+
+/* upper triangle: clockwise */
+   glBegin(GL_TRIANGLES);
+   glColor3fv(red);
+   glVertex3i(125, 165, 0);
+   glColor3fv(blue);
+   glVertex3i(150, 190, 0);
+   glColor3fv(green);
+   glVertex3i(175, 165, 0);
glEnd();
 
glProvokingVertexEXT(GL_LAST_VERTEX_CONVENTION_EXT);
+/* lower triangle: counter-clockwise */
glBegin(GL_TRIANGLES);
-   glColor3f(1.0, 0.0, 0.0);
-   glVertex3i(200, 125, 0);
-   glColor3f(0.0, 1.0, 0.0);
-   glVertex3i(250, 125, 0);
-   glColor3f(0.0, 0.0, 1.0);
-   glVertex3i(225, 150, 0);
+   glColor3fv(red);
+   glVertex3i(200, 85, 0);
+   glColor3fv(green);
+   glVertex3i(250, 85, 0);
+   glColor3fv(blue);
+   glVertex3i(225, 110, 0);
glEnd();
 
-   pass = pass  piglit_probe_pixel_rgb(150, 130, red);
-   pass = pass  piglit_probe_pixel_rgb(225, 130, blue);
+/* upper triangle: clockwise */
+   glBegin(GL_TRIANGLES);
+   glColor3fv(green);
+   glVertex3i(250, 165, 0);
+   glColor3fv(red);
+   glVertex3i(200, 165, 0);
+   glColor3fv(blue);
+   glVertex3i(225, 190, 0);
+   glEnd();
+
+   pass = pass  piglit_probe_pixel_rgb(150, 90, red);
+   pass = pass  piglit_probe_pixel_rgb(150, 170, red);
+
+   pass = pass  piglit_probe_pixel_rgb(225, 90, blue);
+   pass = pass  piglit_probe_pixel_rgb(225, 170, blue);
 
glFinish();
piglit_present_results();
-- 
1.7.3.4

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


[Piglit] Feature request: indirect rendering

2013-03-28 Thread Brian Paul

I happened to find a bug in NVIDIA's driver with indirect GLX rendering.

I was going to write a piglit test for it but found that we have no 
way to request an indirect GLX context in piglit.


We could either:

1. add a PIGLIT_GL_VISUAL_INDIRECT bit/flag
2. add a bol piglit_gl_test_config::indirect field (my preference)

If we can't create an indirect rendering context for a test, report 
PIGLIT_SKIP.


This would have to be plumbed down through waffle also.

I'll go ahead and write some patches if there's no concerns.

-Brian

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


Re: [Piglit] [PATCH] Rework the PIGLIT_GL_VISUAL flags, fix RGB vs RGBA vs ALPHA confusion

2013-03-27 Thread Brian Paul

On 03/26/2013 11:13 AM, Marek Olšák wrote:

Hi,

would anyone like to comment on this? Or is it still stuck in the
moderation queue?


I can't find the patch you're referring to.  Repost?

-Brian

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


[Piglit] [PATCH] st/wgl: fix handling of minimized windows

2013-03-27 Thread Brian Paul
If a window is redrawn while minimized we were emitting an invalid
size when doing SwapBuffers.  With the VMware SVGA driver it meant we
were emitting invalid dimensions for the SurfaceCopy command.

--

I've been running with this patch for a few days and haven't seen
any regressions.  Tested in WinXP and Win7.

Fixes http://bugzilla.eng.vmware.com/show_bug.cgi?id=996695
---
 src/gallium/state_trackers/wgl/stw_framebuffer.c |   26 +++
 src/gallium/state_trackers/wgl/stw_st.c  |   86 +++---
 2 files changed, 54 insertions(+), 58 deletions(-)

diff --git a/src/gallium/state_trackers/wgl/stw_framebuffer.c 
b/src/gallium/state_trackers/wgl/stw_framebuffer.c
index 32d3a2c..7d9c6c9 100644
--- a/src/gallium/state_trackers/wgl/stw_framebuffer.c
+++ b/src/gallium/state_trackers/wgl/stw_framebuffer.c
@@ -122,33 +122,29 @@ stw_framebuffer_get_size( struct stw_framebuffer *fb )
 */
 
assert(fb-hWnd);
-   assert(fb-width  fb-height);
assert(fb-client_rect.right  == fb-client_rect.left + fb-width);
assert(fb-client_rect.bottom == fb-client_rect.top  + fb-height);
 
/*
-* Get the client area size.
+* Get the client area size.  Note: we might get a size of 0 x 0 if
+* the window is minimized.
 */
-
if (!GetClientRect(fb-hWnd, client_rect)) {
   return;
}
 
+   if (0)
+  debug_printf(GetClientRect l %u  r %u  t %u  b %u\n,
+   (unsigned) client_rect.left,
+   (unsigned) client_rect.right,
+   (unsigned) client_rect.top,
+   (unsigned) client_rect.bottom);
+
assert(client_rect.left == 0);
assert(client_rect.top == 0);
width  = client_rect.right  - client_rect.left;
height = client_rect.bottom - client_rect.top;
 
-   if (width = 0 || height = 0) {
-  /*
-   * When the window is minimized GetClientRect will return zeros.  Simply
-   * preserve the current window size, until the window is restored or
-   * maximized again.
-   */
-
-  return;
-   }
-
if (width != fb-width || height != fb-height) {
   fb-must_resize = TRUE;
   fb-width = width; 
@@ -337,9 +333,7 @@ stw_framebuffer_update(
struct stw_framebuffer *fb)
 {
assert(fb-stfb);
-   assert(fb-height);
-   assert(fb-width);
-   
+
/* XXX: It would be nice to avoid checking the size again -- in theory  
 * stw_call_window_proc would have cought the resize and stored the right 
 * size already, but unfortunately threads created before the DllMain is 
diff --git a/src/gallium/state_trackers/wgl/stw_st.c 
b/src/gallium/state_trackers/wgl/stw_st.c
index dcf9587..96b322d 100644
--- a/src/gallium/state_trackers/wgl/stw_st.c
+++ b/src/gallium/state_trackers/wgl/stw_st.c
@@ -70,48 +70,50 @@ stw_st_framebuffer_validate_locked(struct 
st_framebuffer_iface *stfb,
  pipe_resource_reference(stwfb-textures[i], NULL);
}
 
-   memset(templ, 0, sizeof(templ));
-   templ.target = PIPE_TEXTURE_2D;
-   templ.width0 = width;
-   templ.height0 = height;
-   templ.depth0 = 1;
-   templ.array_size = 1;
-   templ.last_level = 0;
-
-   for (i = 0; i  ST_ATTACHMENT_COUNT; i++) {
-  enum pipe_format format;
-  unsigned bind;
-
-  /* the texture already exists or not requested */
-  if (stwfb-textures[i] || !(mask  (1  i))) {
- /* remember the texture */
- if (stwfb-textures[i])
-mask |= (1  i);
- continue;
-  }
-
-  switch (i) {
-  case ST_ATTACHMENT_FRONT_LEFT:
-  case ST_ATTACHMENT_BACK_LEFT:
- format = stwfb-stvis.color_format;
- bind = PIPE_BIND_DISPLAY_TARGET |
-PIPE_BIND_RENDER_TARGET;
- break;
-  case ST_ATTACHMENT_DEPTH_STENCIL:
- format = stwfb-stvis.depth_stencil_format;
- bind = PIPE_BIND_DEPTH_STENCIL;
- break;
-  default:
- format = PIPE_FORMAT_NONE;
- break;
-  }
-
-  if (format != PIPE_FORMAT_NONE) {
- templ.format = format;
- templ.bind = bind;
-
- stwfb-textures[i] =
-stw_dev-screen-resource_create(stw_dev-screen, templ);
+   if (width  0  height  0) {
+  memset(templ, 0, sizeof(templ));
+  templ.target = PIPE_TEXTURE_2D;
+  templ.width0 = width;
+  templ.height0 = height;
+  templ.depth0 = 1;
+  templ.array_size = 1;
+  templ.last_level = 0;
+
+  for (i = 0; i  ST_ATTACHMENT_COUNT; i++) {
+ enum pipe_format format;
+ unsigned bind;
+
+ /* the texture already exists or not requested */
+ if (stwfb-textures[i] || !(mask  (1  i))) {
+/* remember the texture */
+if (stwfb-textures[i])
+   mask |= (1  i);
+continue;
+ }
+
+ switch (i) {
+ case ST_ATTACHMENT_FRONT_LEFT:
+ case ST_ATTACHMENT_BACK_LEFT:
+format = stwfb-stvis.color_format;
+bind = PIPE_BIND_DISPLAY_TARGET |
+   

Re: [Piglit] [PATCH] Rework the PIGLIT_GL_VISUAL flags, fix RGB vs RGBA vs ALPHA confusion

2013-03-27 Thread Brian Paul

Looks OK to me but you might want to wait for other feedback.

Reviewed-by: Brian Paul bri...@vmware.com

On 03/27/2013 05:00 PM, Marek Olšák wrote:

The patch seems to be too large for a mailing list. It's here:

http://cgit.freedesktop.org/~mareko/piglit/commit/?id=8fa85790a3e5a3caba3a6eba912e7858c893363b

Marek

On Wed, Mar 27, 2013 at 11:39 PM, Brian Paulbri...@vmware.com  wrote:

On 03/26/2013 11:13 AM, Marek Olšák wrote:


Hi,

would anyone like to comment on this? Or is it still stuck in the
moderation queue?



I can't find the patch you're referring to.  Repost?

-Brian



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


[Piglit] [PATCH] util: move #define GLXBadProfileARB from .c file to .h file

2013-03-21 Thread Brian Paul
Some of the ES tests check for this error code.  If the installed
glxproto.h file isn't new enough this symbol may be missing and
compilation will fail.
---
 tests/util/piglit-glx-util.c |4 
 tests/util/piglit-glx-util.h |4 
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/util/piglit-glx-util.c b/tests/util/piglit-glx-util.c
index af26c19..016fa46 100644
--- a/tests/util/piglit-glx-util.c
+++ b/tests/util/piglit-glx-util.c
@@ -28,10 +28,6 @@
 #include piglit-util-gl-common.h
 #include piglit-glx-util.h
 
-#ifndef GLXBadProfileARB
-#define GLXBadProfileARB 13
-#endif
-
 int piglit_automatic;
 
 #ifndef _WIN32
diff --git a/tests/util/piglit-glx-util.h b/tests/util/piglit-glx-util.h
index 81bf432..e74ac29 100644
--- a/tests/util/piglit-glx-util.h
+++ b/tests/util/piglit-glx-util.h
@@ -31,6 +31,10 @@
 #include GL/glx.h
 #include GL/glxproto.h
 
+#ifndef GLXBadProfileARB
+#define GLXBadProfileARB 13
+#endif
+
 Display *piglit_get_glx_display();
 XVisualInfo * piglit_get_glx_visual(Display *dpy);
 GLXContext piglit_get_glx_context(Display *dpy, XVisualInfo *visinfo);
-- 
1.7.3.4

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


Re: [Piglit] [PATCH 1/2] glean: Disable unused print_float function.

2013-03-20 Thread Brian Paul

On 03/20/2013 02:11 AM, Rico Schüller wrote:

Hi,

this patch disables the print_float function, which is only used in
the already disabled main function.

Cheers
Rico

---


Thanks.  I'll push these patches soon, after cleaning up the commit 
messages a bit.


-Brian

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


Re: [Piglit] [PATCH 4/4] fbo-clear-formats: clean up error handling

2013-03-19 Thread Brian Paul

On 03/19/2013 05:14 AM, Jose Fonseca wrote:


Series looks good to me.

Reviewed-by: Jose Fonsecajfons...@vmware.com


Thanks.  BTW, I'm fixing my tabs vs. spaces indentation errors before 
committing.


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


Re: [Piglit] [PATCH 1/1] glx-query-drawable: Remove unused window variable.

2013-03-19 Thread Brian Paul

On 03/19/2013 03:04 AM, Rico Schüller wrote:

---
tests/glx/glx-query-drawable.c | 1 -
1 file changed, 1 deletion(-)



Pushed.  Thanks.

-Brian

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


[Piglit] [PATCH 1/4] texunits: increase size of arrays to fix crash

2013-03-18 Thread Brian Paul
NVIDIA's later GPUs/drivers report 192 combined texture units.
This causes us to read outside the too-small arrays and segfault.

Increase the array sizes and add a check for the future.
---
 tests/general/texunits.c |   13 ++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/tests/general/texunits.c b/tests/general/texunits.c
index 3140f80..e419bde 100644
--- a/tests/general/texunits.c
+++ b/tests/general/texunits.c
@@ -40,8 +40,10 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
 
 PIGLIT_GL_TEST_CONFIG_END
 
+#define MAX_UNITS 256
+
 /** random number for checking state */
-static GLfloat Random[128][4];
+static GLfloat Random[MAX_UNITS][4];
 
 static GLint MaxTextureCoordUnits;
 static GLint MaxTextureVertexUnits;
@@ -53,7 +55,7 @@ static void
 generate_random_numbers(void)
 {
int i, j;
-   for (i = 0; i  128; i++) {
+   for (i = 0; i  ARRAY_SIZE(Random); i++) {
   for (j = 0; j  4; j++) {
  /* values in [0, 1] */
  Random[i][j] = (rand() % 1000) * .001;
@@ -233,7 +235,7 @@ test_texture_matrix(void)
 static GLboolean
 test_texture_params(void)
 {
-   GLuint tex[100];
+   GLuint tex[MAX_UNITS];
GLenum err;
int i;
int maxUnit;
@@ -376,6 +378,11 @@ init(void)
 
report_info();
 
+   if (MaxTextureCombinedUnits  MAX_UNITS) {
+  /* Need to increase the MAX_UNITS limit */
+  piglit_report_result(PIGLIT_WARN);
+   }
+
generate_random_numbers();
 
glMatrixMode(GL_PROJECTION);
-- 
1.7.3.4

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


[Piglit] [PATCH 2/4] texunits: clean-up GL error checking code

2013-03-18 Thread Brian Paul
Use piglit_check_gl_error().
---
 tests/general/texunits.c |   46 ++
 1 files changed, 14 insertions(+), 32 deletions(-)

diff --git a/tests/general/texunits.c b/tests/general/texunits.c
index e419bde..6eca7b5 100644
--- a/tests/general/texunits.c
+++ b/tests/general/texunits.c
@@ -106,7 +106,6 @@ clear_errors()
 static GLboolean
 test_rasterpos(void)
 {
-   GLenum err;
int i;
 
clear_errors();
@@ -143,9 +142,8 @@ test_rasterpos(void)
}
 
/* there should be no errors at this point */
-   err = glGetError();
-   if (err != GL_NO_ERROR) {
-  printf(Unexpected GL error in %s(): 0x%x\n, __FUNCTION__, err);
+   if (!piglit_check_gl_error(GL_NO_ERROR)) {
+  return GL_FALSE;
}
 
/* this should generate an error */
@@ -154,17 +152,14 @@ test_rasterpos(void)
   glActiveTexture(GL_TEXTURE0 + MaxTextureCoordUnits);
   if (MaxTextureCoordUnits == MaxTextureCombinedUnits) {
  /* INVALID_ENUM is expected */
- err = glGetError();
- if (err != GL_INVALID_ENUM) {
-printf(GL failed to raise GL_INVALID_ENUM setting texture 
unit\n);
+ if (!piglit_check_gl_error(GL_INVALID_ENUM)) {
 return GL_FALSE;
  }
   }
   else {
  /* INVALID_OPERATION is expected */
  glGetFloatv(GL_CURRENT_RASTER_TEXTURE_COORDS, v);
- if (glGetError() != GL_INVALID_OPERATION) {
-printf(GL failed to raise GL_INVALID_OPERATION quering invalid 
raster tex coords\n);
+ if (!piglit_check_gl_error(GL_INVALID_OPERATION)) {
 return GL_FALSE;
  }
   }
@@ -177,7 +172,6 @@ test_rasterpos(void)
 static GLboolean
 test_texture_matrix(void)
 {
-   GLenum err;
int i;
 
clear_errors();
@@ -201,9 +195,8 @@ test_texture_matrix(void)
}
 
/* there should be no errors at this point */
-   err = glGetError();
-   if (err != GL_NO_ERROR) {
-  printf(Unexpected GL error in %s(): 0x%x\n, __FUNCTION__, err);
+   if (!piglit_check_gl_error(GL_NO_ERROR)) {
+  return GL_FALSE;
}
 
/* this should generate an error */
@@ -212,17 +205,14 @@ test_texture_matrix(void)
   glActiveTexture(GL_TEXTURE0 + MaxTextureCoordUnits);
   if (MaxTextureCoordUnits == MaxTextureCombinedUnits) {
  /* INVALID_ENUM is expected */
- err = glGetError();
- if (err != GL_INVALID_ENUM) {
-printf(GL failed to raise GL_INVALID_ENUM setting texture 
unit\n);
+ if (!piglit_check_gl_error(GL_INVALID_ENUM)) {
 return GL_FALSE;
  }
   }
   else {
  /* INVALID_OPERATION is expected */
  glGetFloatv(GL_TEXTURE_MATRIX, m);
- if (glGetError() != GL_INVALID_OPERATION) {
-printf(GL failed to raise GL_INVALID_OPERATION querying invalid 
texture matrix\n);
+ if (!piglit_check_gl_error(GL_INVALID_OPERATION)) {
 return GL_FALSE;
  }
   }
@@ -236,7 +226,6 @@ static GLboolean
 test_texture_params(void)
 {
GLuint tex[MAX_UNITS];
-   GLenum err;
int i;
int maxUnit;
 
@@ -266,9 +255,8 @@ test_texture_params(void)
}
 
/* there should be no errors at this point */
-   err = glGetError();
-   if (err != GL_NO_ERROR) {
-  printf(Unexpected GL error in %s(): 0x%x\n, __FUNCTION__, err);
+   if (!piglit_check_gl_error(GL_NO_ERROR)) {
+  return GL_FALSE;
}
 
maxUnit = MAX2(MaxTextureCombinedUnits, MaxTextureCoordUnits);
@@ -276,9 +264,7 @@ test_texture_params(void)
/* this should generate an error */
glActiveTexture(GL_TEXTURE0 + maxUnit);
/* INVALID_ENUM is expected */
-   err = glGetError();
-   if (err != GL_INVALID_ENUM) {
-  printf(GL failed to raise GL_INVALID_ENUM setting texture unit\n);
+   if (!piglit_check_gl_error(GL_INVALID_ENUM)) {
   return GL_FALSE;
}
 
@@ -290,7 +276,6 @@ static GLboolean
 test_texture_env(void)
 {
/* Texture Environment state is fixed-function; not used by shaders */
-   GLenum err;
int i;
 
clear_errors();
@@ -299,9 +284,7 @@ test_texture_env(void)
for (i = 0; i  MaxTextureCombinedUnits; i++) {
   glActiveTexture(GL_TEXTURE0 + i);
   glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, Random[i]);
-  err = glGetError();
-  if (err) {
- fprintf(stderr, unit %d glTexEnvfv error: 0x%x\n, i, err);
+  if (!piglit_check_gl_error(GL_NO_ERROR)) {
  return GL_FALSE;
   }
}
@@ -319,9 +302,8 @@ test_texture_env(void)
}
 
/* there should be no errors at this point */
-   err = glGetError();
-   if (err != GL_NO_ERROR) {
-  printf(Unexpected GL error in %s(): 0x%x\n, __FUNCTION__, err);
+   if (!piglit_check_gl_error(GL_NO_ERROR)) {
+  return GL_FALSE;
}
 
return GL_TRUE;
-- 
1.7.3.4

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


[Piglit] [PATCH 4/4] fbo-clear-formats: clean up error handling

2013-03-18 Thread Brian Paul
Use piglit_check_gl_error().  Note: we're getting an INVALID_OPERATION
error from glBlitFramebuffer() with NVIDIA's driver.  That'll be
investigated/fixed separately.  At least the test now reports FAIL
instead of dying on an assertion.
---
 tests/fbo/fbo-clear-formats.c |   19 +++
 1 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/tests/fbo/fbo-clear-formats.c b/tests/fbo/fbo-clear-formats.c
index f6b2a72..a78ad3d 100644
--- a/tests/fbo/fbo-clear-formats.c
+++ b/tests/fbo/fbo-clear-formats.c
@@ -218,7 +218,11 @@ do_stencil_clear(GLenum format, GLuint tex, int level, int 
size)
 
glDrawBuffer(draw_buffer);
glReadBuffer(read_buffer);
-   assert(glGetError() == 0);
+
+if (!piglit_check_gl_error(GL_NO_ERROR)) {
+   /* Should be no error at this point.  If there is, report failure */
+   piglit_report_result(PIGLIT_FAIL);
+}
 
return true;
 }
@@ -285,7 +289,11 @@ create_tex(GLenum internalformat, GLenum baseformat)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, level - 1);
 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
 
-   assert(glGetError() == 0);
+if (!piglit_check_gl_error(GL_NO_ERROR)) {
+   /* Should be no error at this point.  If there is, report failure */
+   piglit_report_result(PIGLIT_FAIL);
+}
+   
return tex;
 }
 
@@ -323,13 +331,16 @@ draw_stencil_mipmap(int x, int y, int dim, GLuint tex, 
GLuint level)
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
glBlitFramebuffer(0, 0, dim, dim, x, y, x+dim, y+dim,
  GL_STENCIL_BUFFER_BIT, GL_NEAREST);
+if (!piglit_check_gl_error(GL_NO_ERROR)) {
+   /* The blit shouldn't generate an error.  If it does, report 
failure */
+   piglit_report_result(PIGLIT_FAIL);
+}
+
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glDeleteFramebuffers(1, fbo);
 
glDrawBuffer(draw_buffer);
glReadBuffer(read_buffer);
-
-   assert(glGetError() == 0);
 }
 
 static void
-- 
1.7.3.4

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


Re: [Piglit] [PATCH] arb_texture_view/gles3: Test TEXTURE_IMMUTABLE_LEVELS parameter.

2013-03-12 Thread Brian Paul
()==GL_NO_ERROR on this query?



+   if (level != 0) {
+   printf(Expected 0 levels initially, but glGetTexParameteriv 
+  returned %d for GL_TEXTURE_1D.\n, level);
+   piglit_report_result(PIGLIT_FAIL);
+   }
+
+   glGenTextures(3, tex);
+#if defined(PIGLIT_USE_OPENGL)
+   glBindTexture(GL_TEXTURE_1D, tex[0]);
+   glTexStorage1D(GL_TEXTURE_1D, 3, GL_RGB32UI, 32);


How about using a non-integer internal format so that we don't depend 
on GL_EXT_texture_integer?




+   glGetTexParameteriv(GL_TEXTURE_1D, GL_TEXTURE_IMMUTABLE_LEVELS,level);
+   if (level != 3) {
+   printf(Expected 3 levels, but glGetTexParameteriv returned 
+  %d for GL_TEXTURE_1D.\n, level);
+   piglit_report_result(PIGLIT_FAIL);
+   }
+#endif
+
+   glBindTexture(GL_TEXTURE_2D, tex[1]);
+   glTexStorage2D(GL_TEXTURE_2D, 3, GL_RGB32UI, 32, 32);
+   glGetTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_IMMUTABLE_LEVELS,level);
+   if (level != 3) {
+   printf(Expected 3 levels, but glGetTexParameteriv returned 
+  %d for GL_TEXTURE_2D.\n, level);
+   piglit_report_result(PIGLIT_FAIL);
+   }
+
+   glBindTexture(GL_TEXTURE_3D, tex[2]);
+   glTexStorage3D(GL_TEXTURE_3D, 3, GL_RGB32UI, 32, 32, 32);
+   glGetTexParameteriv(GL_TEXTURE_3D, GL_TEXTURE_IMMUTABLE_LEVELS,level);


Maybe use glGetTexParameterfv() for one of these to exercise that 
function.




+   if (level != 3) {
+   printf(Expected 3 levels, but glGetTexParameteriv returned 
+  %d for GL_TEXTURE_3D.\n, level);
+   piglit_report_result(PIGLIT_FAIL);
+   }


Also, maybe try quering GL_TEXTURE_IMMUTABLE_LEVELS after creating a 
texture with regular glTexImage2D() to make sure the value is zero.



+
+   glDeleteTextures(3, tex);
+
+   piglit_report_result(PIGLIT_PASS);
+   return 0;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+#if defined(PIGLIT_USE_OPENGL)
+   piglit_require_extension(GL_ARB_texture_view);
+#endif
+}


Looks good otherwise.

Reviewed-by: Brian Paul bri...@vmware.com
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] glsl-1.30: add basic test for testing textureOffset functionality.

2013-03-05 Thread Brian Paul

On 03/05/2013 11:03 AM, Roland Scheidegger wrote:

Am 05.03.2013 17:05, schrieb Brian Paul:

On 03/05/2013 08:37 AM, srol...@vmware.com wrote:

From: Roland Scheideggersrol...@vmware.com

This is pretty rough and doesn't really test all that much (just
textureOffsetLod, but there's other texturing functions with offsets),
doesn't test different wrap modes, NPOT sizes etc., but there's no
other test using ordinary texture opcodes and texel offsets, so
it's a start (and in fact it exposed a bug in the mesa state tracker).
Tested with llvmpipe (pass) and softpipe (fail) which is as expected -
hopefully the math is ok...
Inspired from fs-texelFetchOffset.
---
   tests/spec/glsl-1.30/execution/CMakeLists.gl.txt   |1 +
   .../spec/glsl-1.30/execution/fs-textureOffset-2D.c |  158

   2 files changed, 159 insertions(+)
   create mode 100644 tests/spec/glsl-1.30/execution/fs-textureOffset-2D.c

diff --git a/tests/spec/glsl-1.30/execution/CMakeLists.gl.txt
b/tests/spec/glsl-1.30/execution/CMakeLists.gl.txt
index 6737bb1..3c0b2d5 100644
--- a/tests/spec/glsl-1.30/execution/CMakeLists.gl.txt
+++ b/tests/spec/glsl-1.30/execution/CMakeLists.gl.txt
@@ -13,6 +13,7 @@ link_libraries (
   piglit_add_executable (fs-discard-exit-2 fs-discard-exit-2.c)
   piglit_add_executable (fs-texelFetch-2D fs-texelFetch-2D.c)
   piglit_add_executable (fs-texelFetchOffset-2D fs-texelFetchOffset-2D.c)
+piglit_add_executable (fs-textureOffset-2D fs-textureOffset-2D.c)
   IF (NOT MSVC)
   piglit_add_executable (isinf-and-isnan isinf-and-isnan.c)
   ENDIF (NOT MSVC)
diff --git a/tests/spec/glsl-1.30/execution/fs-textureOffset-2D.c
b/tests/spec/glsl-1.30/execution/fs-textureOffset-2D.c
new file mode 100644
index 000..4c050fb
--- /dev/null
+++ b/tests/spec/glsl-1.30/execution/fs-textureOffset-2D.c
@@ -0,0 +1,158 @@
+/*
+ * Copyright 2013 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 fs-textureOffset-2D.c
+ *
+ * Tests the built-in function textureLodOffset() in the fragment
shader.
+ *
+ * Creates a mipmapped 64x32 2D texture and draws a series of squares
whose
+ * color contains a texel fetched from each quadrant of the rgbw
texture.
+ *
+ * Author: Roland Scheidegger
+ */
+#include piglit-util-gl-common.h
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+config.supports_gl_compat_version = 10;
+
+config.window_width = 90;
+config.window_height = 150;


width=90 might cause trouble on Windows.  Windows will bump up the size
to 120 pixels (IIRC).  This has caused other tests to fail in the past.

Ok, I'll bump it up to 120.


Or just omit them and use the defaults.

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


[Piglit] [PATCH] fbo-maxsize: minor test improvements

2013-03-04 Thread Brian Paul
Clear the large FBO to a non-black color and probe for it in the
final test.

This uncovers a bug in Mesa's llvmpipe driver where we ran out of
bin commmand memory and skipped some tiles, leaving them black.

Setting the clear color to white (and actually clearing the FBO)
helps to detect that.
---
 tests/fbo/fbo-maxsize.c |8 
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/tests/fbo/fbo-maxsize.c b/tests/fbo/fbo-maxsize.c
index ef88600..905afc0 100644
--- a/tests/fbo/fbo-maxsize.c
+++ b/tests/fbo/fbo-maxsize.c
@@ -140,6 +140,9 @@ static int create_fbo(void)
glViewport(0, 0, maxsize, maxsize);
piglit_ortho_projection(maxsize, maxsize, GL_FALSE);
 
+   glClearColor(1.0, 1.0, 1.0, 1.0);
+   glClear(GL_COLOR_BUFFER_BIT);
+
x0 = maxsize / 4;
x1 = maxsize * 3 / 4;
y0 = maxsize / 4;
@@ -188,10 +191,13 @@ piglit_display(void)
int x2 = (piglit_width / 4) * 3;
int y1 = piglit_height / 4;
int y2 = (piglit_height / 4) * 3;
+   int cx = piglit_width / 2;
+   int cy = piglit_height / 2;
float c1[3] = {0.25, 0.25, 0.25};
float c2[3] = {0.75, 0.25, 0.25};
float c3[3] = {0.25, 0.75, 0.75};
float c4[3] = {0.75, 0.75, 0.75};
+   float white[3] = {1.0, 1.0, 1.0};
 
glClearColor(0.5, 0.5, 0.5, 0.5);
glClear(GL_COLOR_BUFFER_BIT);
@@ -212,11 +218,13 @@ piglit_display(void)
draw_tex_sub_rect(x2, y1);
draw_tex_sub_rect(x1, y2);
draw_tex_sub_rect(x2, y2);
+   draw_tex_sub_rect(cx, cy);
 
pass = piglit_probe_pixel_rgb(x1, y1, c1);
pass = piglit_probe_pixel_rgb(x2, y1, c2);
pass = piglit_probe_pixel_rgb(x1, y2, c3);
pass = piglit_probe_pixel_rgb(x2, y2, c4);
+   pass = piglit_probe_pixel_rgb(cx, cy, white);
 
glDeleteTextures(1, tex);
glDisable(GL_TEXTURE_2D);
-- 
1.7.3.4

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


Re: [Piglit] [PATCH] Add missing piglit_get_prim_name() for gles3.

2013-02-25 Thread Brian Paul

On 02/25/2013 12:04 PM, Eric Anholt wrote:

Fixes piglit build since the shader_runner change to use this
function.
---
  tests/util/piglit-util-gles3-enum.c |   22 ++
  1 file changed, 22 insertions(+)

diff --git a/tests/util/piglit-util-gles3-enum.c 
b/tests/util/piglit-util-gles3-enum.c
index 530bd88..8b0fcdc 100644
--- a/tests/util/piglit-util-gles3-enum.c
+++ b/tests/util/piglit-util-gles3-enum.c
@@ -704,3 +704,25 @@ piglit_get_gl_enum_name(GLenum param)
  #undef CASE
  }

+const char *
+piglit_get_prim_name(GLenum prim)
+{
+   switch (prim) {
+   case GL_POINTS:
+   return GL_POINTS;
+   case GL_LINES:
+   return GL_LINES;
+   case GL_LINE_STRIP:
+   return GL_LINE_STRIP;
+   case GL_LINE_LOOP:
+   return GL_LINE_LOOP;
+   case GL_TRIANGLES:
+   return GL_TRIANGLES;
+   case GL_TRIANGLE_STRIP:
+   return GL_TRIANGLE_STRIP;
+   case GL_TRIANGLE_FAN:
+   return GL_TRIANGLE_FAN;
+   default:
+   return (unrecognized enum);
+   }
+}



Reviewed-by: Brian Paul bri...@vmware.com
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 1/3] piglit: add piglit_get_prim_name() helper

2013-02-21 Thread Brian Paul
---
 tests/util/piglit-util-gl-common.h |   12 ++
 tests/util/piglit-util-gl-enum.c   |   41 
 2 files changed, 53 insertions(+), 0 deletions(-)

diff --git a/tests/util/piglit-util-gl-common.h 
b/tests/util/piglit-util-gl-common.h
index 336953d..accf1f3 100644
--- a/tests/util/piglit-util-gl-common.h
+++ b/tests/util/piglit-util-gl-common.h
@@ -80,6 +80,18 @@ const char* piglit_get_gl_error_name(GLenum error);
 const char *piglit_get_gl_enum_name(GLenum param);
 
 /**
+ * \brief Convert a GL primitive type enum value to a string.
+ *
+ * For example, given GL_POLYGON, return GL_POLYGON.
+ * We don't use piglit_get_gl_enum_name() for this because there are
+ * other enums which alias the prim type enums (ex: GL_POINTS = GL_NONE);
+ *
+ * Return (unrecognized enum) if the enum is not recognized.
+ */
+const char *piglit_get_prim_name(GLenum prim);
+
+
+/**
  * \brief Check for unexpected GL errors.
  *
  * If glGetError() returns an error other than \c expected_error, then
diff --git a/tests/util/piglit-util-gl-enum.c b/tests/util/piglit-util-gl-enum.c
index bc48384..8769f4d 100644
--- a/tests/util/piglit-util-gl-enum.c
+++ b/tests/util/piglit-util-gl-enum.c
@@ -2986,3 +2986,44 @@ piglit_get_gl_enum_name(GLenum param)
 #undef CASE
 }
 
+
+const char *
+piglit_get_prim_name(GLenum prim)
+{
+   switch (prim) {
+   case GL_POINTS:
+   return GL_POINTS;
+   case GL_LINES:
+   return GL_LINES;
+   case GL_LINE_STRIP:
+   return GL_LINE_STRIP;
+   case GL_LINE_LOOP:
+   return GL_LINE_LOOP;
+   case GL_TRIANGLES:
+   return GL_TRIANGLES;
+   case GL_TRIANGLE_STRIP:
+   return GL_TRIANGLE_STRIP;
+   case GL_TRIANGLE_FAN:
+   return GL_TRIANGLE_FAN;
+   case GL_QUADS:
+   return GL_QUADS;
+   case GL_QUAD_STRIP:
+   return GL_QUAD_STRIP;
+   case GL_POLYGON:
+   return GL_POLYGON;
+   case GL_LINES_ADJACENCY:
+   return GL_LINES_ADJACENCY;
+   case GL_LINE_STRIP_ADJACENCY:
+   return GL_LINE_STRIP_ADJACENCY;
+   case GL_TRIANGLES_ADJACENCY:
+   return GL_TRIANGLES_ADJACENCY;
+   case GL_TRIANGLE_STRIP_ADJACENCY:
+   return GL_TRIANGLE_STRIP_ADJACENCY;
+   case GL_PATCHES:
+   return GL_PATCHES;
+   default:
+   return (unrecognized enum);
+   }
+}
+
+
-- 
1.7.3.4

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


[Piglit] [PATCH 2/3] longprim: use piglit_get_prim_name() function

2013-02-21 Thread Brian Paul
---
 tests/general/longprim.c |   16 ++--
 1 files changed, 2 insertions(+), 14 deletions(-)

diff --git a/tests/general/longprim.c b/tests/general/longprim.c
index f5a0bd7..b4344f2 100644
--- a/tests/general/longprim.c
+++ b/tests/general/longprim.c
@@ -54,19 +54,6 @@ static const GLenum primTypes[] = {
GL_POLYGON
 };
 
-static const char *primNames[] = {
-   GL_POINTS,
-   GL_LINES,
-   GL_LINE_LOOP,
-   GL_LINE_STRIP,
-   GL_TRIANGLES,
-   GL_TRIANGLE_STRIP,
-   GL_TRIANGLE_FAN,
-   GL_QUADS,
-   GL_QUAD_STRIP,
-   GL_POLYGON
-};
-
 
 static void
 draw(GLenum mode, GLuint numVerts)
@@ -90,7 +77,8 @@ test_prims(void)
for (len = 1000; len = 1000 * 1000; len *= 10) {
   for (prim = 0; prim  ARRAY_SIZE(primTypes); prim++) {
  if (!piglit_automatic)
-printf(%s: %s %u vertices\n, TestName, primNames[prim], len);
+printf(%s: %s %u vertices\n, TestName,
+   piglit_get_prim_name(prim), len);
  glClear(GL_COLOR_BUFFER_BIT);
  draw(primTypes[prim], len);
  piglit_present_results();
-- 
1.7.3.4

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


[Piglit] [PATCH 3/3] shader_runner: use piglit_get_prim_name()

2013-02-21 Thread Brian Paul
---
 tests/shaders/shader_runner.c |   22 --
 1 files changed, 4 insertions(+), 18 deletions(-)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 0ae9e0c..582c85c 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -1401,29 +1401,15 @@ struct string_to_enum {
GLenum token;
 };
 
-struct string_to_enum drawing_mode_table[] = {
-   { GL_POINTS, GL_POINTS },
-   { GL_LINE_STRIP, GL_LINE_STRIP },
-   { GL_LINE_LOOP,  GL_LINE_LOOP  },
-   { GL_LINES,  GL_LINES  },
-   { GL_POLYGON,GL_POLYGON},
-   { GL_TRIANGLE_STRIP, GL_TRIANGLE_STRIP },
-   { GL_TRIANGLE_FAN,   GL_TRIANGLE_FAN   },
-   { GL_TRIANGLES,  GL_TRIANGLES  },
-   { GL_QUAD_STRIP, GL_QUAD_STRIP },
-   { GL_QUADS,  GL_QUADS  },
-   { NULL, 0 }
-};
-
-
 GLenum
 decode_drawing_mode(const char *mode_str)
 {
int i;
 
-   for (i = 0; drawing_mode_table[i].name; ++i) {
-   if (0 == strcmp(mode_str, drawing_mode_table[i].name))
-   return drawing_mode_table[i].token;
+   for (i = GL_POINTS; i = GL_POLYGON; ++i) {
+   const char *name = piglit_get_prim_name(i);
+   if (0 == strcmp(mode_str, name))
+   return i;
}
 
printf(unknown drawing mode \%s\, mode_str);
-- 
1.7.3.4

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


[Piglit] [PATCH] degenerate-prims: test that prims with too few vertices don't draw anything

2013-02-21 Thread Brian Paul
v2: use new piglit_get_prim_name() function.
---
 tests/all.tests  |1 +
 tests/general/CMakeLists.gl.txt  |1 +
 tests/general/degenerate-prims.c |  108 ++
 3 files changed, 110 insertions(+), 0 deletions(-)
 create mode 100644 tests/general/degenerate-prims.c

diff --git a/tests/all.tests b/tests/all.tests
index c52c6cf..4b7e076 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -476,6 +476,7 @@ add_plain_test(gl11, 'clear-accum')
 add_concurrent_test(gl11, 'clipflat')
 add_plain_test(gl11, 'copypixels-draw-sync')
 add_plain_test(gl11, 'copypixels-sync')
+add_plain_test(gl11, 'degenerate-prims')
 add_plain_test(gl11, 'depthfunc')
 add_plain_test(gl11, 'depthrange-clear')
 add_plain_test(gl11, 'dlist-clear')
diff --git a/tests/general/CMakeLists.gl.txt b/tests/general/CMakeLists.gl.txt
index d356525..c3a0748 100644
--- a/tests/general/CMakeLists.gl.txt
+++ b/tests/general/CMakeLists.gl.txt
@@ -27,6 +27,7 @@ piglit_add_executable (copy-pixels copy-pixels.c)
 piglit_add_executable (copypixels-sync copypixels-sync.c)
 piglit_add_executable (copypixels-draw-sync copypixels-draw-sync.c)
 piglit_add_executable (depth-clamp-range depth-clamp-range.c)
+piglit_add_executable (degenerate-prims degenerate-prims.c)
 piglit_add_executable (dlist-clear dlist-clear.c)
 piglit_add_executable (dlist-color-material dlist-color-material.c)
 piglit_add_executable (dlist-fdo3129-01 dlist-fdo3129-01.c)
diff --git a/tests/general/degenerate-prims.c b/tests/general/degenerate-prims.c
new file mode 100644
index 000..53e8d5f
--- /dev/null
+++ b/tests/general/degenerate-prims.c
@@ -0,0 +1,108 @@
+/*
+ * Copyright © 2013 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 primitives with too few vertices.  In particular,
+ * GL_QUADS and GL_QUAD_STRIP with 3 verts seems to regress every
+ * once in a while in Mesa.
+ *
+ * Brian Paul
+ * Feb 2013
+ */
+
+
+#include piglit-util-gl-common.h
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+   config.supports_gl_compat_version = 10;
+   config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
+PIGLIT_GL_TEST_CONFIG_END
+
+
+/**
+ * Test a specific degenerate primitive.
+ * The expected outcome is that nothing will be drawn.
+ */
+static bool
+test_prim(GLenum prim, unsigned numVerts, const void *verts)
+{
+   static const float black[] = {0, 0, 0, 0};
+   bool pass;
+
+   glClear(GL_COLOR_BUFFER_BIT);
+
+   glVertexPointer(2, GL_FLOAT, 0, verts);
+   glEnable(GL_VERTEX_ARRAY);
+   glDrawArrays(prim, 0, numVerts);
+
+   /* Nothing should have been drawn / look for all black */
+   pass = piglit_probe_rect_rgb(0, 0, piglit_width, piglit_height, black);
+
+   piglit_present_results();
+
+   if (!pass) {
+   piglit_report_subtest_result(PIGLIT_FAIL, Primitive: %s,
+piglit_get_prim_name(prim));
+   }
+
+   return pass;
+}
+
+
+enum piglit_result
+piglit_display(void)
+{
+   static const float
+   verts2[2][2] = { {-1, -1}, {1, 1} },
+   verts3[3][2] = { {-1, -1}, {1, -1}, {0, 1} },
+   verts4[4][2] = { {-1, -1}, {1, -1}, {1, 1}, {-1, 1} };
+   static bool pass = true;
+
+   glMatrixMode(GL_PROJECTION);
+   glLoadIdentity();
+   glOrtho(-1, 1, -1, 1, -1, 1);
+
+   glColor3f(1, 1, 1);
+
+   pass = test_prim(GL_POINTS, 0, verts2)  pass;
+   pass = test_prim(GL_LINES, 1, verts2)  pass;
+   pass = test_prim(GL_LINE_STRIP, 1, verts2)  pass;
+   pass = test_prim(GL_LINE_LOOP, 1, verts2)  pass;
+   pass = test_prim(GL_TRIANGLES, 2, verts3)  pass;
+   pass = test_prim(GL_TRIANGLE_STRIP, 2, verts3)  pass;
+   pass = test_prim(GL_TRIANGLE_FAN, 2, verts3)  pass;
+   pass = test_prim(GL_QUADS, 3, verts4)  pass;
+   pass = test_prim

[Piglit] [PATCH] polygon-mode-offset: test glPolygonMode + glPolygonOffset

2013-02-21 Thread Brian Paul
---
 tests/all.tests |1 +
 tests/general/CMakeLists.gl.txt |1 +
 tests/general/polygon-mode-offset.c |  317 +++
 3 files changed, 319 insertions(+), 0 deletions(-)
 create mode 100644 tests/general/polygon-mode-offset.c

diff --git a/tests/all.tests b/tests/all.tests
index 4b7e076..77461fe 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -502,6 +502,7 @@ add_plain_test(gl11, 'longprim')
 add_concurrent_test(gl11, 'masked-clear')
 add_plain_test(gl11, 'point-line-no-cull')
 add_plain_test(gl11, 'polygon-mode')
+add_concurrent_test(gl11, 'polygon-mode-offset')
 add_concurrent_test(gl11, 'push-pop-texture-state')
 add_concurrent_test(gl11, 'quad-invariance')
 add_plain_test(gl11, 'read-front')
diff --git a/tests/general/CMakeLists.gl.txt b/tests/general/CMakeLists.gl.txt
index c3a0748..e1eb3e3 100644
--- a/tests/general/CMakeLists.gl.txt
+++ b/tests/general/CMakeLists.gl.txt
@@ -90,6 +90,7 @@ piglit_add_executable (pbo-teximage pbo-teximage.c)
 piglit_add_executable (pbo-teximage-tiling pbo-teximage-tiling.c)
 piglit_add_executable (pbo-teximage-tiling-2 pbo-teximage-tiling-2.c)
 piglit_add_executable (point-line-no-cull point-line-no-cull.c)
+piglit_add_executable (polygon-mode-offset polygon-mode-offset.c)
 piglit_add_executable (polygon-mode polygon-mode.c)
 piglit_add_executable (primitive-restart primitive-restart.c)
 piglit_add_executable (provoking-vertex provoking-vertex.c)
diff --git a/tests/general/polygon-mode-offset.c 
b/tests/general/polygon-mode-offset.c
new file mode 100644
index 000..3832df2
--- /dev/null
+++ b/tests/general/polygon-mode-offset.c
@@ -0,0 +1,317 @@
+/*
+ * Copyright ?? 2013 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 glPolygonMode + glPolygonOffset.
+ *
+ * Brian Paul
+ * Feb 2013
+ */
+
+
+#include piglit-util-gl-common.h
+
+
+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
+
+
+
+/**
+ * Check that we drew a white outline around the blue polygon
+ */
+static bool
+check_lines_visible(int number)
+{
+   static const float white[3] = {1, 1, 1};
+   static const float blue[3] = {0, 0, 1};
+   const int w = piglit_width, h = piglit_height;
+   const int mx = w / 2, my = h / 2;
+   float p[4];
+   bool pass = true;
+
+   /* probe bottom */
+   if (!piglit_probe_pixel_rgb_silent(mx, 1, white, p)) {
+   piglit_report_subtest_result(PIGLIT_FAIL,
+   config %d: Expected white pixel on bottom edge,
+   number);
+   pass = false;
+   }
+
+   /* probe top */
+   if (!piglit_probe_pixel_rgb_silent(mx, h-2, white, p)) {
+   piglit_report_subtest_result(PIGLIT_FAIL,
+   config %d: Expected white pixel on top edge,
+   number);
+   pass = false;
+   }
+
+   /* probe left */
+   if (!piglit_probe_pixel_rgb_silent(1, my, white, p)) {
+   piglit_report_subtest_result(PIGLIT_FAIL,
+   config %d: Expected white pixel on left edge,
+   number);
+   pass = false;
+   }
+
+   /* probe right */
+   if (!piglit_probe_pixel_rgb_silent(w-2, my, white, p)) {
+   piglit_report_subtest_result(PIGLIT_FAIL,
+   config %d: Expected white pixel on right edge,
+   number);
+   pass = false;
+   }
+
+   /* probe center */
+   if (!piglit_probe_pixel_rgb_silent(mx, my, blue, p)) {
+   piglit_report_subtest_result(PIGLIT_FAIL,
+   config %d: Expected blue pixel

Re: [Piglit] [PATCH 3/3] util/waffle: More wisely handle compat context versions 1.0

2013-02-20 Thread Brian Paul
+* for which supports_gl_compat_version  1.0 to run
+* on drivers that lack those extensions.
+*/
i = 0;
head_attrib_list[i++] = WAFFLE_CONTEXT_API;
head_attrib_list[i++] = WAFFLE_CONTEXT_OPENGL;
-
-   if (test_config-supports_gl_compat_version= 32) {
-   head_attrib_list[i++] = WAFFLE_CONTEXT_PROFILE;
-   head_attrib_list[i++] = 
WAFFLE_CONTEXT_COMPATIBILITY_PROFILE;
-   }
-
-   head_attrib_list[i++] = WAFFLE_CONTEXT_MAJOR_VERSION;
-   head_attrib_list[i++] = 
test_config-supports_gl_compat_version / 10;
-
-   head_attrib_list[i++] = WAFFLE_CONTEXT_MINOR_VERSION;
-   head_attrib_list[i++] = 
test_config-supports_gl_compat_version % 10;
-
head_attrib_list[i++] = 0;
break;

@@ -244,6 +245,45 @@ choose_config(struct piglit_wfl_framework *wfl_fw,
  }

  /**
+ * Check that the context's actual version no less than the requested
+ * version for \a flavor.
+ */
+static bool
+check_gl_version(const struct piglit_gl_test_config *test_config,
+ enum context_flavor flavor)
+{
+   switch (flavor) {
+   case CONTEXT_GL_CORE:
+   case CONTEXT_GL_ES:
+   /* There is no need to check the context version here, because
+* Piglit explicitly supplied the desired version to
+* waffle_config_choose().
+*/
+   return true;
+   case CONTEXT_GL_COMPAT: {
+   /* Piglit did not supply a version to
+* waffle_config_choose(). We must check the context's
+* actual version.
+*/
+   int actual_version = piglit_get_gl_version();
+   if (actual_version= test_config-supports_gl_compat_version)
+  return true;
+
+   printf(piglit: info: Requested a GL %d.%d compatibility 
+  context, but actual context version is %d.%d\n,
+  test_config-supports_gl_compat_version / 10,
+  test_config-supports_gl_compat_version % 10,
+  actual_version / 10,
+  actual_version % 10);
+   return false;
+ }
+   default:
+  assert(0);
+  return false;


The indentation looks funny there, but maybe that's just tabs vs. spaces.



+   }
+}
+
+/**
   * Handle the special case when a test requests GL 3.1.
   */
  static bool
@@ -316,6 +356,10 @@ make_context_current_singlepass(struct 
piglit_wfl_framework *wfl_fw,
piglit_dispatch_default_init();
  #endif

+   ok = check_gl_version(test_config, flavor);
+   if (!ok)
+  goto fail;
+
ok = special_case_gl_31(test_config, flavor);
if (!ok)
goto fail;


LGTM, but others should chime in too.

Reviewed-by: Brian Paul bri...@vmware.com
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] degenerate-prims: test that prims with too few vertices don't draw anything

2013-02-19 Thread Brian Paul
---
 tests/all.tests  |1 +
 tests/general/CMakeLists.gl.txt  |1 +
 tests/general/degenerate-prims.c |  143 ++
 3 files changed, 145 insertions(+), 0 deletions(-)
 create mode 100644 tests/general/degenerate-prims.c

diff --git a/tests/all.tests b/tests/all.tests
index c52c6cf..4b7e076 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -476,6 +476,7 @@ add_plain_test(gl11, 'clear-accum')
 add_concurrent_test(gl11, 'clipflat')
 add_plain_test(gl11, 'copypixels-draw-sync')
 add_plain_test(gl11, 'copypixels-sync')
+add_plain_test(gl11, 'degenerate-prims')
 add_plain_test(gl11, 'depthfunc')
 add_plain_test(gl11, 'depthrange-clear')
 add_plain_test(gl11, 'dlist-clear')
diff --git a/tests/general/CMakeLists.gl.txt b/tests/general/CMakeLists.gl.txt
index d356525..c3a0748 100644
--- a/tests/general/CMakeLists.gl.txt
+++ b/tests/general/CMakeLists.gl.txt
@@ -27,6 +27,7 @@ piglit_add_executable (copy-pixels copy-pixels.c)
 piglit_add_executable (copypixels-sync copypixels-sync.c)
 piglit_add_executable (copypixels-draw-sync copypixels-draw-sync.c)
 piglit_add_executable (depth-clamp-range depth-clamp-range.c)
+piglit_add_executable (degenerate-prims degenerate-prims.c)
 piglit_add_executable (dlist-clear dlist-clear.c)
 piglit_add_executable (dlist-color-material dlist-color-material.c)
 piglit_add_executable (dlist-fdo3129-01 dlist-fdo3129-01.c)
diff --git a/tests/general/degenerate-prims.c b/tests/general/degenerate-prims.c
new file mode 100644
index 000..6fef5ac
--- /dev/null
+++ b/tests/general/degenerate-prims.c
@@ -0,0 +1,143 @@
+/*
+ * Copyright ?? 2013 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 primitives with too few vertices.  In particular,
+ * GL_QUADS and GL_QUAD_STRIP with 3 verts seems to regress every
+ * once in a while in Mesa.
+ *
+ * Brian Paul
+ * Feb 2013
+ */
+
+
+#include piglit-util-gl-common.h
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+   config.supports_gl_compat_version = 10;
+   config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
+PIGLIT_GL_TEST_CONFIG_END
+
+
+/**
+ * Roll our own lookup function here since piglit_get_gl_enum_name() has
+ * trouble with these enums.
+ * XXX this could become a piglit utility function someday.
+ */
+static const char *
+prim_name(GLenum prim)
+{
+   switch (prim) {
+   case GL_POINTS:
+   return GL_POINTS;
+   case GL_LINES:
+   return GL_LINES;
+   case GL_LINE_STRIP:
+   return GL_LINE_STRIP;
+   case GL_LINE_LOOP:
+   return GL_LINE_LOOP;
+   case GL_TRIANGLES:
+   return GL_TRIANGLES;
+   case GL_TRIANGLE_STRIP:
+   return GL_TRIANGLE_STRIP;
+   case GL_TRIANGLE_FAN:
+   return GL_TRIANGLE_FAN;
+   case GL_QUADS:
+   return GL_QUADS;
+   case GL_QUAD_STRIP:
+   return GL_QUAD_STRIP;
+   case GL_POLYGON:
+   return GL_POLYGON;
+   default:
+   return unknonw;
+   }
+}
+
+
+/**
+ * Test a specific degenerate primitive.
+ * The expected outcome is that nothing will be drawn.
+ */
+static bool
+test_prim(GLenum prim, unsigned numVerts, const void *verts)
+{
+   static const float black[] = {0, 0, 0, 0};
+   bool pass;
+
+   glClear(GL_COLOR_BUFFER_BIT);
+
+   glVertexPointer(2, GL_FLOAT, 0, verts);
+   glEnable(GL_VERTEX_ARRAY);
+   glDrawArrays(prim, 0, numVerts);
+
+   /* Nothing should have been drawn / look for all black */
+   pass = piglit_probe_rect_rgb(0, 0, piglit_width, piglit_height, black);
+
+   piglit_present_results();
+
+   if (!pass) {
+   piglit_report_subtest_result(PIGLIT_FAIL, Primitive: %s,
+prim_name(prim));
+   }
+
+   return pass;
+}
+
+
+enum piglit_result

[Piglit] [PATCH] remove glean scissor test

2013-02-11 Thread Brian Paul
Replaced by new piglit scissor-polygon test.
---
 tests/all.tests   |1 -
 tests/glean/CMakeLists.gl.txt |1 -
 tests/glean/tscissor.cpp  |  180 -
 tests/glean/tscissor.h|   52 
 4 files changed, 0 insertions(+), 234 deletions(-)
 delete mode 100644 tests/glean/tscissor.cpp
 delete mode 100644 tests/glean/tscissor.h

diff --git a/tests/all.tests b/tests/all.tests
index 844eff9..a555639 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -112,7 +112,6 @@ glean['pointSprite'] = GleanTest('pointSprite')
 # exactRGBA is not included intentionally, because it's too strict and
 # the equivalent functionality is covered by other tests
 glean['readPixSanity'] = GleanTest('readPixSanity')
-glean['scissor'] = GleanTest('scissor')
 glean['shaderAPI'] = GleanTest('shaderAPI')
 glean['stencil2'] = GleanTest('stencil2')
 glean['texCombine'] = GleanTest('texCombine')
diff --git a/tests/glean/CMakeLists.gl.txt b/tests/glean/CMakeLists.gl.txt
index 62b9b4e..7f61fda 100644
--- a/tests/glean/CMakeLists.gl.txt
+++ b/tests/glean/CMakeLists.gl.txt
@@ -49,7 +49,6 @@ piglit_add_executable (glean
tpointatten.cpp
tpointsprite.cpp
treadpix.cpp
-   tscissor.cpp
tshaderapi.cpp
tstencil2.cpp
ttexcombine.cpp
diff --git a/tests/glean/tscissor.cpp b/tests/glean/tscissor.cpp
deleted file mode 100644
index e45e7a2..000
--- a/tests/glean/tscissor.cpp
+++ /dev/null
@@ -1,180 +0,0 @@
-// BEGIN_COPYRIGHT -*- glean -*-
-// 
-// Copyright (C) 1999  Allen Akin   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 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 ALLEN AKIN 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
-
-// tscissor.cpp:  Basic test of OpenGL scissor.
-//
-// This test verifies that the four corner pixels, and the four pixels
-// diagonally inside the corners, of a scissored region are filled
-// correctly.  It then tests up to two pixels in both the horizontal and
-// vertical directions of the scissor region to verify that they are
-// unfilled.
-//
-// To test for pass/fail, we examine the color buffer for white or black,
-// respectively.
-//
-// Author: Gareth Hughes gar...@valinux.com  December 2000
-
-#include tscissor.h
-
-namespace GLEAN {
-
-/* Verification helper macros:
- */
-#define BAD_PIXEL( X, Y, R, G, B ) ( image[X][Y][0] != (R) ||  \
- image[X][Y][1] != (G) ||  \
- image[X][Y][2] != (B) )
-
-#define TEST_PIXEL( X, Y, R, G, B, E ) \
-do {   \
-   if ( BAD_PIXEL( X, Y, R, G, B ) ) { \
-   FailMessage( r, E, X, Y,\
-i, i, 10-2*i, 10-2*i );\
-   passed = false; \
-   }   \
-} while (0)
-
-#define TEST_CORNER( X, Y, SX, SY )\
-do {   \
-   TEST_PIXEL( X,   Y,   1.0, 1.0, 1.0,  1 );  \
-   TEST_PIXEL( X SX 1,  Y SY 1,  1.0, 1.0, 1.0,  2 );  \
-   for ( j = 1 ; j = i ; j++ ) {  \
-   TEST_PIXEL( X - SX j,  Y, 0.0, 0.0, 0.0,  j );  \
-   TEST_PIXEL( X, Y - SY j,  0.0, 0.0, 0.0,  j );  \
-   }   \
-} while (0)
-
-
-void
-ScissorTest::FailMessage( BasicResult r, int error, int x, int y,
- int sx, int sy, int sw, int sh ) const
-{
-   env-log  name  : FAIL 
- r.config-conciseDescription()  \n;
-   env-log  \tOff by   error   error at
-  row   x   column   y;
-   env-log  

Re: [Piglit] [PATCH 1/2] port ttexrect.cpp to piglit from glean

2013-02-08 Thread Brian Paul

On 02/07/2013 10:45 PM, Tom Gall wrote:

This ported test goes into tests/spec/arb_texture_rectangle. It
tests the ARB_texture_rectangle extension.

Create a 255x127 texture of varying colors and bind it as a
GL_ARB_texture_recangle target.  Draw that rectangle to the window, and
check that the texture was drawn correctly.  The common failure to be
caught with this test is not adjusting the non-normalized coordinates on
hardware that expects normalized coordinates.

To all.tests, add new texrect_simple_arb_texrect

v2: add PIGLIT_GL_VISUAL_DOUBLE to the window_visual, move various
setup bits to piglit_init and add forgotten all.tests change.
v3: use piglit_present_results, and piglit_probe_image_rgb



I keep finding more little things to fix...



Signed-off-by: Tom Galltom.g...@linaro.org
---
  tests/all.tests|1 +
  tests/spec/CMakeLists.txt  |1 +
  tests/spec/arb_texture_rectangle/CMakeLists.gl.txt |   13 ++
  tests/spec/arb_texture_rectangle/CMakeLists.txt|1 +
  tests/spec/arb_texture_rectangle/texrect-simple.c  |  127 
  5 files changed, 143 insertions(+)
  create mode 100644 tests/spec/arb_texture_rectangle/CMakeLists.gl.txt
  create mode 100644 tests/spec/arb_texture_rectangle/CMakeLists.txt
  create mode 100644 tests/spec/arb_texture_rectangle/texrect-simple.c

diff --git a/tests/all.tests b/tests/all.tests
index 3e2d3f8..9b9be9f 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1128,6 +1128,7 @@ arb_texture_rectangle['copyteximage RECT'] = 
PlainExecTest(['copyteximage', '-au
  add_concurrent_test(arb_texture_rectangle, '1-1-linear-texture')
  add_plain_test(arb_texture_rectangle, 'texrect-many')
  add_concurrent_test(arb_texture_rectangle, 'getteximage-targets RECT')
+add_plain_test(arb_texture_rectangle, 'texrect_simple_arb_texrect')

  arb_texture_storage = Group()
  spec['ARB_texture_storage'] = arb_texture_storage
diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt
index df87181..1b72040 100644
--- a/tests/spec/CMakeLists.txt
+++ b/tests/spec/CMakeLists.txt
@@ -24,6 +24,7 @@ add_subdirectory (arb_texture_buffer_object)
  add_subdirectory (arb_texture_compression)
  add_subdirectory (arb_texture_cube_map_array)
  add_subdirectory (arb_texture_float)
+add_subdirectory (arb_texture_rectangle)
  add_subdirectory (arb_texture_storage)
  add_subdirectory (arb_timer_query)
  add_subdirectory (arb_transform_feedback2)
diff --git a/tests/spec/arb_texture_rectangle/CMakeLists.gl.txt 
b/tests/spec/arb_texture_rectangle/CMakeLists.gl.txt
new file mode 100644
index 000..d84a850
--- /dev/null
+++ b/tests/spec/arb_texture_rectangle/CMakeLists.gl.txt
@@ -0,0 +1,13 @@
+include_directories(
+   ${GLEXT_INCLUDE_DIR}
+   ${OPENGL_INCLUDE_PATH}
+   ${piglit_SOURCE_DIR}/tests/mesa/util
+)
+
+link_libraries (
+   piglitutil_${piglit_target_api}
+   ${OPENGL_gl_LIBRARY}
+   ${OPENGL_glu_LIBRARY}
+)
+
+piglit_add_executable (texrect_simple_arb_texrect texrect-simple.c)
diff --git a/tests/spec/arb_texture_rectangle/CMakeLists.txt 
b/tests/spec/arb_texture_rectangle/CMakeLists.txt
new file mode 100644
index 000..144a306
--- /dev/null
+++ b/tests/spec/arb_texture_rectangle/CMakeLists.txt
@@ -0,0 +1 @@
+piglit_include_target_api()
diff --git a/tests/spec/arb_texture_rectangle/texrect-simple.c 
b/tests/spec/arb_texture_rectangle/texrect-simple.c
new file mode 100644
index 000..1b6d66b
--- /dev/null
+++ b/tests/spec/arb_texture_rectangle/texrect-simple.c
@@ -0,0 +1,127 @@
+/* Copyright © 2013 Linaro 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.
+ */
+
+/**
+ * Ported from glean ttexrect.cpp into piglit.
+ * Test the ARB_texture_rectangle extension
+ *   Create a 255x127 texture of varying colors and bind it as a
+ *   GL_ARB_texture_recangle target.  Draw that rectangle to the window, and
+ *   check that the 

Re: [Piglit] Fwd: [PATCH 1/2] port ttexrect.cpp to piglit from glean

2013-02-07 Thread Brian Paul
LGTM.  Are you asking for another review or do you need someone to 
commit/push it for you?


-Brian

On 02/06/2013 03:38 PM, Tom Gall wrote:

It was a little over two weeks ago when v2 of these 2 patches to port
ttexrect to piglit and remove it from glean were posted.

It has a Reviewed-by: Brian Paulbri...@vmware.com

Any reason why this shouldn't go in?

Thanks.

-- Forwarded message --
From: Brian Paulbri...@vmware.com
Date: Mon, Jan 21, 2013 at 4:46 PM
Subject: Re: [Piglit] [PATCH 1/2] port ttexrect.cpp to piglit from glean
To: Tom Galltom.g...@linaro.org
Cc: piglit@lists.freedesktop.org, patc...@linaro.org


On 01/21/2013 01:43 PM, Tom Gall wrote:


This ported test goes into tests/spec/arb_texture_rectangle. It
tests the ARB_texture_rectangle extension.

Create a 255x127 texture of varying colors and bind it as a
GL_ARB_texture_recangle target.  Draw that rectangle to the window, and
check that the texture was drawn correctly.  The common failure to be
caught with this test is not adjusting the non-normalized coordinates on
hardware that expects normalized coordinates.

To all.tests, add new texrect_simple_arb_texrect

v2: add PIGLIT_GL_VISUAL_DOUBLE to the window_visual, move various
setup bits to piglit_init and add forgotten all.tests change.

Signed-off-by: Tom Galltom.g...@linaro.org



For both:
Reviewed-by: Brian Paulbri...@vmware.com


--
Regards,
Tom

Where's the kaboom!? There was supposed to be an earth-shattering
kaboom! Marvin Martian
Tech Lead, Graphics Working Group | Linaro.org │ Open source software
for ARM SoCs
w) tom.gall att linaro.org
h) tom_gall att mac.com
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


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


Re: [Piglit] [PATCH] getteximage-formats: test GetTexImage after rendering to textures

2013-02-07 Thread Brian Paul
 = 0;
while (w  0) {
@@ -485,21 +515,30 @@ piglit_display(void)
  void
  piglit_init(int argc, char **argv)
  {
-   GLuint t;
+   int i;

if ((piglit_get_gl_version()  14)  
!piglit_is_extension_supported(GL_ARB_window_pos)) {
printf(Requires GL 1.4 or GL_ARB_window_pos);
piglit_report_result(PIGLIT_SKIP);
}

-   fbo_formats_init(argc, argv, !piglit_automatic);
+   fbo_formats_init(1, argv, !piglit_automatic);


What's that change for?



(void) fbo_formats_display;

-   glGenTextures(1,t);
-   glBindTexture(GL_TEXTURE_2D, t);
+   for (i = 1; i  argc; i++) {
+   if (strcmp(argv[i], init-by-rendering) == 0) {
+   init_by_rendering = GL_TRUE;
+   puts(The textures will be initialized by rendering 
+to them using glDrawPixels.);
+   break;
+   }
+   }
+
+   glGenTextures(1,texture_id);
+   glBindTexture(GL_TEXTURE_2D, texture_id);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
-   glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
+   glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, !init_by_rendering);


Maybe move this call into the previously suggested else clause (and 
maybe use glGenerateMipmap(GL_TEXTURE_2D) instead).





glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);



Looks good otherwise.

Reviewed-by: Brian Paul bri...@vmware.com
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] Fwd: [PATCH 1/2] port ttexrect.cpp to piglit from glean

2013-02-07 Thread Brian Paul

OK, I thought you had git-write ability.  I'll commit/push soon.

-Brian

On 02/07/2013 08:23 AM, Tom Gall wrote:

Hi Brian,

It has your reviewed by.

Ideally I was looking for it to be committed unless of course there's
something egregious about it that we both missed.

On Thu, Feb 7, 2013 at 9:04 AM, Brian Paulbri...@vmware.com  wrote:

LGTM.  Are you asking for another review or do you need someone to
commit/push it for you?

-Brian


On 02/06/2013 03:38 PM, Tom Gall wrote:


It was a little over two weeks ago when v2 of these 2 patches to port
ttexrect to piglit and remove it from glean were posted.

It has a Reviewed-by: Brian Paulbri...@vmware.com

Any reason why this shouldn't go in?

Thanks.

-- Forwarded message --
From: Brian Paulbri...@vmware.com
Date: Mon, Jan 21, 2013 at 4:46 PM
Subject: Re: [Piglit] [PATCH 1/2] port ttexrect.cpp to piglit from glean
To: Tom Galltom.g...@linaro.org
Cc: piglit@lists.freedesktop.org, patc...@linaro.org


On 01/21/2013 01:43 PM, Tom Gall wrote:



This ported test goes into tests/spec/arb_texture_rectangle. It
tests the ARB_texture_rectangle extension.

Create a 255x127 texture of varying colors and bind it as a
GL_ARB_texture_recangle target.  Draw that rectangle to the window, and
check that the texture was drawn correctly.  The common failure to be
caught with this test is not adjusting the non-normalized coordinates on
hardware that expects normalized coordinates.

To all.tests, add new texrect_simple_arb_texrect

v2: add PIGLIT_GL_VISUAL_DOUBLE to the window_visual, move various
setup bits to piglit_init and add forgotten all.tests change.

Signed-off-by: Tom Galltom.g...@linaro.org




For both:
Reviewed-by: Brian Paulbri...@vmware.com


--
Regards,
Tom

Where's the kaboom!? There was supposed to be an earth-shattering
kaboom! Marvin Martian
Tech Lead, Graphics Working Group | Linaro.org │ Open source software
for ARM SoCs
w) tom.gall att linaro.org
h) tom_gall att mac.com
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit







--
Regards,
Tom

Where's the kaboom!? There was supposed to be an earth-shattering
kaboom! Marvin Martian
Tech Lead, Graphics Working Group | Linaro.org │ Open source software
for ARM SoCs
w) tom.gall att linaro.org
h) tom_gall att mac.com


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


Re: [Piglit] Fwd: [PATCH 1/2] port ttexrect.cpp to piglit from glean

2013-02-07 Thread Brian Paul

On 02/07/2013 08:35 AM, Brian Paul wrote:

OK, I thought you had git-write ability. I'll commit/push soon.


Actually, I found a few more issues with the code.

The piglit_swap_buffers() call should be moved after the probing code. 
 And you should use piglit_present_results() instead.  After a 
swapbuffers, the contents of the back buffer are undefined so you need 
to probe first.


I think that the probe loop can be replaced by a call to 
piglit_probe_image_rgb().


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


<    5   6   7   8   9   10   11   12   >