Re: [Piglit] [PATCH] primitive-restart: test primitive-restart with VBO

2012-05-11 Thread Brian Paul

On 05/10/2012 11:34 AM, Jordan Justen wrote:

On Thu, May 10, 2012 at 9:26 AM, Jordan Justenjljus...@gmail.com  wrote:

On Thu, May 10, 2012 at 8:58 AM, Jordan Justenjljus...@gmail.com  wrote:

On Thu, May 10, 2012 at 7:10 AM, Brian Paulbri...@vmware.com  wrote:

I'd like to have a separate test to check the case of one VBO containing
both vertex data and index data.  Would you be interested in writing such a
test?


Sure. Something like tests/spec/arb_vertex_buffer_object/combined-vbo.c?


Hmm, it looks like a combined VBO is used in:
tests/spec/arb_vertex_buffer_object/mixed-immediate-and-vbo.c

Yet llvmpipe passes arb_vertex_buffer_object-mixed-immediate-and-vbo.


I can't get llvmpipe to fail in
arb_vertex_buffer_object-mixed-immediate-and-vbo even after tweaking
the code. So, perhaps the restart is important here.


Sounds like it.



I'd like to leave the combined VBO for index/vertex data in the
primitive-restart test. Do you agree?


I'd rather have separate VBOs to keep the test focused on one thing 
(primitive restart).  I really don't have any time now to 
investigate/fix the single-vbo + restart bug (it might happen with all 
gallium drivers, btw) so the test would just keep failing for the 
foreseeable future.  I'd rather not leave it in that state.


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


Re: [Piglit] [PATCH] primitive-restart: test primitive-restart with VBO

2012-05-11 Thread Jordan Justen
On Fri, May 11, 2012 at 8:06 AM, Brian Paul bri...@vmware.com wrote:
 On 05/10/2012 11:34 AM, Jordan Justen wrote:
 I'd like to leave the combined VBO for index/vertex data in the
 primitive-restart test. Do you agree?

 I'd rather have separate VBOs to keep the test focused on one thing
 (primitive restart).  I really don't have any time now to investigate/fix
 the single-vbo + restart bug (it might happen with all gallium drivers, btw)
 so the test would just keep failing for the foreseeable future.  I'd rather
 not leave it in that state.

I could see creating a separate test for VBOs (say
primitive-restart-vbo) that has the single VBO case.

Or do you prefer that I add VBO support to primitive-restart (with 2
VBOs), and add a separate primitive-restart-single-vbo test?

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


[Piglit] [Review Request 1/2] Added triangle rasterisation test

2012-05-11 Thread jbenton
From: James Benton jben...@vmware.com

Ensures correct rasterisation by comparing with a software rasteriser

The software rasteriser complies with the GL spec and has been verified against 
nvidia drivers
---
 tests/general/CMakeLists.gl.txt  |1 +
 tests/general/triangle-rasterisation.cpp |  538 ++
 tests/util/mersenne.hpp  |  129 +++
 3 files changed, 668 insertions(+)
 create mode 100644 tests/general/triangle-rasterisation.cpp
 create mode 100644 tests/util/mersenne.hpp

diff --git a/tests/general/CMakeLists.gl.txt b/tests/general/CMakeLists.gl.txt
index f9f2b09..96841c6 100644
--- a/tests/general/CMakeLists.gl.txt
+++ b/tests/general/CMakeLists.gl.txt
@@ -106,6 +106,7 @@ piglit_add_executable (sync_api sync_api.c)
 piglit_add_executable (texgen texgen.c)
 piglit_add_executable (texunits texunits.c)
 piglit_add_executable (timer_query timer_query.c)
+piglit_add_executable (triangle-rasterisation triangle-rasterisation.cpp)
 piglit_add_executable (two-sided-lighting two-sided-lighting.c)
 piglit_add_executable (two-sided-lighting-separate-specular 
two-sided-lighting-separate-specular.c)
 piglit_add_executable (user-clip user-clip.c)
diff --git a/tests/general/triangle-rasterisation.cpp 
b/tests/general/triangle-rasterisation.cpp
new file mode 100644
index 000..9596a95
--- /dev/null
+++ b/tests/general/triangle-rasterisation.cpp
@@ -0,0 +1,538 @@
+/**
+ *
+ * Copyright 2012 VMware, Inc.
+ * 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, 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 ITS 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.
+ *
+ **/
+
+/**
+ * Triangle Rasterisation Test
+ *
+ * This tests OpenGL triangle rasterisation by comparing it with a software 
rasteriser
+ *
+ * There are 2 components to the test;
+ *   1. Predefined sanity tests ensuring bounding box calculations are correct
+ *   2. Randomised triangle drawing to attempt to test all possible triangles
+ */
+
+#include piglit-util.h
+#include mersenne.hpp
+
+#include time.h
+#include vector
+#include algorithm
+
+/* Data structures */
+struct Vector
+{
+   Vector()
+   {
+   }
+
+   Vector(float x, float y)
+  : x(x), y(y)
+   {
+   }
+
+   float x, y;
+};
+
+struct Triangle {
+   Triangle()
+   {
+   }
+
+   Triangle(const Vector v0, const Vector v1, const Vector v2)
+   {
+  v[0] = v0;
+  v[1] = v1;
+  v[2] = v2;
+   }
+
+   Vector operator[](int i)
+   {
+  return v[i];
+   }
+
+   const Vector operator[](int i) const
+   {
+  return v[i];
+   }
+
+   Vector v[3];
+};
+
+/* Command line arguments */
+bool use_fbo = false;
+bool break_on_fail = false;
+bool print_triangle = false;
+int random_test_count = 100;
+
+/* Compile time constants */
+const int fbo_size2 = 8;
+const int fbo_width = 1  fbo_size2;
+const int fbo_height = fbo_width;
+
+const int FIXED_SHIFT = 4;
+const int FIXED_ONE = 1  FIXED_SHIFT;
+
+/* Piglit variables */
+int piglit_width = fbo_width;
+int piglit_height = fbo_height;
+int piglit_window_mode = GLUT_RGB | GLUT_ALPHA | GLUT_DOUBLE;
+
+/* Globals */
+int test_id = 0;
+Mersenne mersenne;
+std::vectorTriangle fixed_tests;
+
+/* std::algorithm min/max with 3 arguments! :D */
+namespace std {
+   templatetypename T
+   T min(T a, T b, T c)
+   {
+  return (a  b) ? std::min(a, c) : std::min(b, c);
+   }
+
+   templatetypename T
+   T max(T a, T b, T c)
+   {
+  return (a  b) ? std::max(a, c) : std::max(b, c);
+   }
+}
+
+int iround(float v){
+   if (v  0.0f) v += 0.5f;
+   if (v  0.0f) v -= 0.5f;
+   return (int)v;
+}
+
+
+/* Based on http://devmaster.net/forums/topic/1145-advanced-rasterization */
+void rast_triangle(uint8_t* buffer, uint32_t stride, const Triangle tri)
+{
+   float center_offset = -0.5f;
+
+   /* 28.4 fixed point coordinates */
+   int x1 = iround(FIXED_ONE * (tri[0].x + 

Re: [Piglit] [PATCH] Accelerate running a bit more (for both piglit-print-commands.py and piglit-run.py:

2012-05-11 Thread Kenneth Graunke

On 05/11/2012 02:04 AM, Shuang He wrote:

Before:
time ./piglit-print-commands.py -t 
'asmparsertest/ARBfp1.0/size_specifier-31.txt' -x 
'asmparsertest/ARBfp1.0/size_specifier-31.txt'.+ -x valgrind/ tests/all.tests
asmparsertest/ARBfp1.0/size_specifier-31.txt ::: 
/GFX/Test/Piglit/piglit/framework/../bin/asmparsertest -auto ARBfp1.0 
tests/asmparsertest/shaders/ARBfp1.0/size_specifier-31.txt

real0m1.171s
user0m1.132s
sys 0m0.039s

After:
time ./piglit-print-commands.py -t 
'asmparsertest/ARBfp1.0/size_specifier-31.txt' -x 
'asmparsertest/ARBfp1.0/size_specifier-31.txt'.+ -x valgrind/ tests/all.tests
asmparsertest/ARBfp1.0/size_specifier-31.txt ::: 
/GFX/Test/Piglit/piglit/framework/../bin/asmparsertest -auto ARBfp1.0 
tests/asmparsertest/shaders/ARBfp1.0/size_specifier-31.txt

real0m0.331s
user0m0.299s
sys 0m0.031s


Nice :)

For what it's worth, you don't need to pass -x valgrind anymore.  I 
removed all the valgrind tests and just added a piglit-run.py 
--valgrind option.

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


Re: [Piglit] [PATCH] Accelerate running a bit more (for both piglit-print-commands.py and piglit-run.py:

2012-05-11 Thread Shuang He

On 2012/5/12 5:39, Kenneth Graunke wrote:

On 05/11/2012 02:04 AM, Shuang He wrote:

Before:
time ./piglit-print-commands.py -t 
'asmparsertest/ARBfp1.0/size_specifier-31.txt' -x 
'asmparsertest/ARBfp1.0/size_specifier-31.txt'.+ -x valgrind/ 
tests/all.tests
asmparsertest/ARBfp1.0/size_specifier-31.txt ::: 
/GFX/Test/Piglit/piglit/framework/../bin/asmparsertest -auto ARBfp1.0 
tests/asmparsertest/shaders/ARBfp1.0/size_specifier-31.txt


real0m1.171s
user0m1.132s
sys 0m0.039s

After:
time ./piglit-print-commands.py -t 
'asmparsertest/ARBfp1.0/size_specifier-31.txt' -x 
'asmparsertest/ARBfp1.0/size_specifier-31.txt'.+ -x valgrind/ 
tests/all.tests
asmparsertest/ARBfp1.0/size_specifier-31.txt ::: 
/GFX/Test/Piglit/piglit/framework/../bin/asmparsertest -auto ARBfp1.0 
tests/asmparsertest/shaders/ARBfp1.0/size_specifier-31.txt


real0m0.331s
user0m0.299s
sys 0m0.031s


Nice :)

For what it's worth, you don't need to pass -x valgrind anymore.  I 
removed all the valgrind tests and just added a piglit-run.py 
--valgrind option.


Great, hopefully we could run piglit tests in our infrastructure very 
fast now :)


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


[Piglit] [PATCH] ext_framebuffer_multisample: Add color, depth and stencil format variables in Fbo class

2012-05-11 Thread Anuj Phogat
These variables can be used to create an fbo with required formats.
Note: These changes don't affect any of the existing test cases in
directory ext_framebuffer_multisample

Signed-off-by: Anuj Phogat anuj.pho...@gmail.com
---
 tests/spec/ext_framebuffer_multisample/common.cpp |   16 ++--
 tests/spec/ext_framebuffer_multisample/common.h   |4 
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/tests/spec/ext_framebuffer_multisample/common.cpp 
b/tests/spec/ext_framebuffer_multisample/common.cpp
index d1e6bcd..09431a6 100644
--- a/tests/spec/ext_framebuffer_multisample/common.cpp
+++ b/tests/spec/ext_framebuffer_multisample/common.cpp
@@ -121,6 +121,10 @@ Fbo::init(int num_samples, int width, int height, bool 
combine_depth_stencil,
generate();
this-width = width;
this-height = height;
+   this-color_format = GL_RGBA;
+   this-depth_format = GL_DEPTH_COMPONENT24;
+   this-stencil_format = GL_STENCIL_INDEX8;
+   this-depth_stencil_format = GL_DEPTH_STENCIL;
this-combine_depth_stencil = combine_depth_stencil;
this-attach_texture = attach_texture;
set_samples(num_samples);
@@ -145,7 +149,7 @@ Fbo::set_samples(int num_samples)
glGenRenderbuffers(1, rb);
glBindRenderbuffer(GL_RENDERBUFFER, rb);
glRenderbufferStorageMultisample(GL_RENDERBUFFER, num_samples,
-GL_RGBA, width, height);
+color_format, width, height);
glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER,
  GL_COLOR_ATTACHMENT0,
  GL_RENDERBUFFER, rb);
@@ -158,11 +162,11 @@ Fbo::set_samples(int num_samples)
GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D,
 0 /* level */,
-GL_RGBA /* internalformat */,
+color_format /* internalformat */,
 width,
 height,
 0 /* border */,
-GL_RGBA /* format */,
+color_format /* format */,
 GL_BYTE /* type */,
 NULL /* data */);
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER,
@@ -178,7 +182,7 @@ Fbo::set_samples(int num_samples)
glGenRenderbuffers(1, depth_stencil);
glBindRenderbuffer(GL_RENDERBUFFER, depth_stencil);
glRenderbufferStorageMultisample(GL_RENDERBUFFER, num_samples,
-GL_DEPTH_STENCIL, width,
+depth_stencil_format, width,
 height);
glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER,
  GL_DEPTH_STENCIL_ATTACHMENT,
@@ -188,7 +192,7 @@ Fbo::set_samples(int num_samples)
glGenRenderbuffers(1, stencil);
glBindRenderbuffer(GL_RENDERBUFFER, stencil);
glRenderbufferStorageMultisample(GL_RENDERBUFFER, num_samples,
-GL_STENCIL_INDEX8,
+stencil_format,
 width, height);
glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER,
  GL_STENCIL_ATTACHMENT,
@@ -198,7 +202,7 @@ Fbo::set_samples(int num_samples)
glGenRenderbuffers(1, depth);
glBindRenderbuffer(GL_RENDERBUFFER, depth);
glRenderbufferStorageMultisample(GL_RENDERBUFFER, num_samples,
-GL_DEPTH_COMPONENT24,
+depth_format,
 width, height);
glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER,
  GL_DEPTH_ATTACHMENT,
diff --git a/tests/spec/ext_framebuffer_multisample/common.h 
b/tests/spec/ext_framebuffer_multisample/common.h
index d86cb95..f5cb7d1 100644
--- a/tests/spec/ext_framebuffer_multisample/common.h
+++ b/tests/spec/ext_framebuffer_multisample/common.h
@@ -59,6 +59,10 @@ public:
int height;
bool combine_depth_stencil;
bool attach_texture;
+   GLenum color_format;
+   GLenum depth_format;
+   GLenum stencil_format;
+   GLenum depth_stencil_format;
GLuint handle;
 
/**
-- 
1.7.7.6

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


[Piglit] [PATCH] Add test to verify glBlitFramebuffer with non matching parameters in multisample FBOs

2012-05-11 Thread Anuj Phogat
This test verifies if glBlitFramebuffer() throws expected GL errors with
multisample framebuffers.

V2: Test is rewritten to utilize the functionality defined in common.cpp
and to match the testing pattern of other blitting tests written by
Paul Berry. Command line options are provided to choose sample count
and color/depth/stencil buffers for testing.

With src, dst fbo depth_stencil formats: GL_DEPTH32F_STENCIL8 and
GL_DEPTH_STENCIL, test_blit_ms_ms_non_matching_formats fails with
stencil buffer on mesa master. But it passes for depth buffer.

test_blit_ms_ms_non_matching_formats fails for depth and stencil on AMD
catalyst.

Mesa's behavior for depth buffer looks correct to me as both formats are
 different. I'm not sure about stencil buffer.

Signed-off-by: Anuj Phogat anuj.pho...@gmail.com
---
Note: This patch require:
[Patch]: ext_framebuffer_multisample: Add color, depth and stencil format
variables in Fbo class

 tests/all.tests|7 +
 .../ext_framebuffer_multisample/CMakeLists.gl.txt  |1 +
 .../non-matching-blit.cpp  |  290 
 3 files changed, 298 insertions(+), 0 deletions(-)
 create mode 100644 tests/spec/ext_framebuffer_multisample/non-matching-blit.cpp

diff --git a/tests/all.tests b/tests/all.tests
index da50ee0..fbaf981 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1318,6 +1318,13 @@ for num_samples in (2, 4, 8, 16, 32):
 test_name)
 ext_framebuffer_multisample[test_name] = 
PlainExecTest(executable)
 
+for num_samples in (2, 4, 8, 16, 32):
+for buffer_type in ('color', 'depth', 'stencil'):
+test_name = ' ' .join(['non-matching-blit', str(num_samples), 
buffer_type])
+executable = 'ext_framebuffer_multisample-{0} -auto'.format(
+test_name)
+ext_framebuffer_multisample[test_name] = 
PlainExecTest(executable)
+
 ext_framebuffer_object = Group()
 spec['EXT_framebuffer_object'] = ext_framebuffer_object
 add_fbo_stencil_tests(ext_framebuffer_object, 'GL_STENCIL_INDEX1')
diff --git a/tests/spec/ext_framebuffer_multisample/CMakeLists.gl.txt 
b/tests/spec/ext_framebuffer_multisample/CMakeLists.gl.txt
index 475237c..a72a381 100644
--- a/tests/spec/ext_framebuffer_multisample/CMakeLists.gl.txt
+++ b/tests/spec/ext_framebuffer_multisample/CMakeLists.gl.txt
@@ -15,6 +15,7 @@ piglit_add_executable (ext_framebuffer_multisample-accuracy 
common.cpp accuracy.
 piglit_add_executable (ext_framebuffer_multisample-dlist dlist.c)
 piglit_add_executable (ext_framebuffer_multisample-minmax minmax.c)
 piglit_add_executable (ext_framebuffer_multisample-multisample-blit common.cpp 
multisample-blit.cpp)
+piglit_add_executable 
(ext_framebuffer_multisample-multisample-non-matching-blit common.cpp 
non-matching-blit.cpp)
 piglit_add_executable (ext_framebuffer_multisample-negative-copypixels 
negative-copypixels.c)
 piglit_add_executable (ext_framebuffer_multisample-negative-copyteximage 
negative-copyteximage.c)
 piglit_add_executable (ext_framebuffer_multisample-negative-max-samples 
negative-max-samples.c)
diff --git a/tests/spec/ext_framebuffer_multisample/non-matching-blit.cpp 
b/tests/spec/ext_framebuffer_multisample/non-matching-blit.cpp
new file mode 100644
index 000..51d0087
--- /dev/null
+++ b/tests/spec/ext_framebuffer_multisample/non-matching-blit.cpp
@@ -0,0 +1,290 @@
+/*
+ * 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 non-matching-blit.cpp
+ *
+ * This test verifies if glBlitFramebuffer() throws expected GL errors with
+ * multisample framebuffers.
+ *
+ * We generate FBOs with specified sample count, draw a pattern in to them,
+ * do blitting operation and then probe color buffer to verify against
+ * expected values.
+ *
+ * Tests following cases:
+ * - Blit