Re: [Mesa-dev] [Piglit] [PATCH] Add a simple testcase to test that GL_ELEMENT_ARRAY_BUFFER is per vao

2011-11-27 Thread Yuanhan Liu
On Thu, Nov 24, 2011 at 11:25:23AM -0800, Eric Anholt wrote:
 On Wed, 23 Nov 2011 12:24:37 -0700, Brian Paul bri...@vmware.com wrote:
  On 11/23/2011 12:12 PM, Eric Anholt wrote:
   On Wed, 23 Nov 2011 17:34:30 +0800, Yuanhan 
   Liuyuanhan@linux.intel.com  wrote:
From 9a1da8748f0faa23f34398213ff7ee45fda6bf36 Mon Sep 17 00:00:00 2001
   From: Yuanhan Liuyuanhan@linux.intel.com
   Date: Wed, 23 Nov 2011 17:37:33 +0800
   Subject: [PATCH] Add a simple testcase to test that 
   GL_ELEMENT_ARRAY_BUFFER
 is per vao
  
   According opengl spec 4.2.pdf table 6.12 (Vertex Array Object State) at
   page 515: the element buffer object is listed in vertex array object.
  
   Add a testcase to test that.
  
   v2: fix n careless 'always-return-PIGLIT_PASS' fault.
  
   Signed-off-by: Yuanhan Liuyuanhan@linux.intel.com
  
   diff --git a/tests/general/vao-element-array-buffer.c 
   b/tests/general/vao-element-array-buffer.c
   new file mode 100644
   index 000..8803bff
   --- /dev/null
   +++ b/tests/general/vao-element-array-buffer.c
   @@ -0,0 +1,94 @@
   +/*
   + * Copyright (C) 2011 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:
   + *Yuanhan Liuyuanhan@linux.intel.com
   + */
  
   Generally, the style I advocate is to not include the Authors line in
   copyright messages.  git records who the author was already, and will
   provide a more accurate view of who wrote the current code if someone
   wants to know some time down the line.  I don't know how many times, 5
   years later, I've had emails from someone asking about some code I'd
   written that just had my name in the header and nothing else really of
   mine, from back when we were including Authors lines in the CVS days.
  
   +glutSwapBuffers();
  
   If you switched this to piglit_present_results, this test could be an
   add_concurrent_test() instead.
  
  Under what circumstances can't glutSwapBuffers() be replaced by 
  piglit_present_results()?
  
  I'm guessing many/most of the tests that use the former could be 
  changed to use the later.  That might be a good project for someone 
  who wants to contribute.
 
 I guess everything using the framework could be trivially converted to
 it.  Doesn't mean all of those are ready to be made concurrent (things
 explicitly using the window system framebuffer would still need work),
 but it might save a measurable amount of time to skip that many swaps.

Got it. Thanks.


___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [Piglit] [PATCH] Add a simple testcase to test that GL_ELEMENT_ARRAY_BUFFER is per vao

2011-11-24 Thread Eric Anholt
On Wed, 23 Nov 2011 12:24:37 -0700, Brian Paul bri...@vmware.com wrote:
 On 11/23/2011 12:12 PM, Eric Anholt wrote:
  On Wed, 23 Nov 2011 17:34:30 +0800, Yuanhan 
  Liuyuanhan@linux.intel.com  wrote:
   From 9a1da8748f0faa23f34398213ff7ee45fda6bf36 Mon Sep 17 00:00:00 2001
  From: Yuanhan Liuyuanhan@linux.intel.com
  Date: Wed, 23 Nov 2011 17:37:33 +0800
  Subject: [PATCH] Add a simple testcase to test that GL_ELEMENT_ARRAY_BUFFER
is per vao
 
  According opengl spec 4.2.pdf table 6.12 (Vertex Array Object State) at
  page 515: the element buffer object is listed in vertex array object.
 
  Add a testcase to test that.
 
  v2: fix n careless 'always-return-PIGLIT_PASS' fault.
 
  Signed-off-by: Yuanhan Liuyuanhan@linux.intel.com
 
  diff --git a/tests/general/vao-element-array-buffer.c 
  b/tests/general/vao-element-array-buffer.c
  new file mode 100644
  index 000..8803bff
  --- /dev/null
  +++ b/tests/general/vao-element-array-buffer.c
  @@ -0,0 +1,94 @@
  +/*
  + * Copyright (C) 2011 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:
  + *Yuanhan Liuyuanhan@linux.intel.com
  + */
 
  Generally, the style I advocate is to not include the Authors line in
  copyright messages.  git records who the author was already, and will
  provide a more accurate view of who wrote the current code if someone
  wants to know some time down the line.  I don't know how many times, 5
  years later, I've had emails from someone asking about some code I'd
  written that just had my name in the header and nothing else really of
  mine, from back when we were including Authors lines in the CVS days.
 
  +  glutSwapBuffers();
 
  If you switched this to piglit_present_results, this test could be an
  add_concurrent_test() instead.
 
 Under what circumstances can't glutSwapBuffers() be replaced by 
 piglit_present_results()?
 
 I'm guessing many/most of the tests that use the former could be 
 changed to use the later.  That might be a good project for someone 
 who wants to contribute.

I guess everything using the framework could be trivially converted to
it.  Doesn't mean all of those are ready to be made concurrent (things
explicitly using the window system framebuffer would still need work),
but it might save a measurable amount of time to skip that many swaps.


pgpaloZx1HOng.pgp
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [Piglit] [PATCH] Add a simple testcase to test that GL_ELEMENT_ARRAY_BUFFER is per vao

2011-11-23 Thread Brian Paul

On 11/23/2011 02:34 AM, Yuanhan Liu wrote:

On Wed, Nov 23, 2011 at 05:27:32PM +0800, Yuanhan Liu wrote:

According opengl spec 4.2.pdf table 6.12 (Vertex Array Object State) at
page 515: the element buffer object is listed in vertex array object.

Add a testcase to test that.

Signed-off-by: Yuanhan Liuyuanhan@linux.intel.com
---
  tests/all.tests  |1 +
  tests/general/CMakeLists.gl.txt  |1 +
  tests/general/vao-element-array-buffer.c |   94 ++
  3 files changed, 96 insertions(+), 0 deletions(-)
  create mode 100644 tests/general/vao-element-array-buffer.c

diff --git a/tests/all.tests b/tests/all.tests
index 851db11..ad68d71 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -305,6 +305,7 @@ add_plain_test(general, 
'two-sided-lighting-separate-specular')
  add_plain_test(general, 'user-clip')
  add_plain_test(general, 'vao-01')
  add_plain_test(general, 'vao-02')
+add_plain_test(general, 'vao-element-array-buffer')
  add_plain_test(general, 'varray-disabled')
  add_plain_test(general, 'vbo-bufferdata')
  add_plain_test(general, 'vbo-map-remap')
diff --git a/tests/general/CMakeLists.gl.txt b/tests/general/CMakeLists.gl.txt
index 58cbaa1..185f59d 100644
--- a/tests/general/CMakeLists.gl.txt
+++ b/tests/general/CMakeLists.gl.txt
@@ -111,6 +111,7 @@ add_executable (user-clip user-clip.c)
  add_executable (varray-disabled varray-disabled.c)
  add_executable (vao-01 vao-01.c)
  add_executable (vao-02 vao-02.c)
+add_executable (vao-element-array-buffer vao-element-array-buffer.c)
  add_executable (vbo-map-remap vbo-map-remap.c)
  add_executable (vbo-bufferdata vbo-bufferdata.c)
  add_executable (vbo-subdata-zero vbo-subdata-zero.c)
diff --git a/tests/general/vao-element-array-buffer.c 
b/tests/general/vao-element-array-buffer.c
new file mode 100644
index 000..32600b8
--- /dev/null
+++ b/tests/general/vao-element-array-buffer.c
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2011 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:
+ *Yuanhan Liuyuanhan@linux.intel.com
+ */
+
+/**
+ * @file vao-element-buffer.c
+ *
+ * A simple test case to test that GL_ELEMENT_ARRAY_BUFFER is part of vao
+ *
+ */
+
+#include piglit-util.h
+
+int piglit_width = 100;
+int piglit_height = 100;
+int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE;
+
+static GLuint vao;
+
+enum piglit_result
+piglit_display(void)
+{
+   GLboolean pass = GL_TRUE;
+   GLfloat expected[4] = {1, 0, 0, 1};
+
+   glClear(GL_COLOR_BUFFER_BIT);
+
+   glBindVertexArray(vao);
+
+   glColor3f(1, 0, 0);
+   glDrawElements(GL_QUADS, 4, GL_UNSIGNED_BYTE, NULL);
+   pass = piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height, 
expected);
+
+   glutSwapBuffers();
+
+   return PIGLIT_PASS;


Oops, my fault, here is the new one:

--
 From 9a1da8748f0faa23f34398213ff7ee45fda6bf36 Mon Sep 17 00:00:00 2001
From: Yuanhan Liuyuanhan@linux.intel.com
Date: Wed, 23 Nov 2011 17:37:33 +0800
Subject: [PATCH] Add a simple testcase to test that GL_ELEMENT_ARRAY_BUFFER
  is per vao

According opengl spec 4.2.pdf table 6.12 (Vertex Array Object State) at
page 515: the element buffer object is listed in vertex array object.

Add a testcase to test that.

v2: fix n careless 'always-return-PIGLIT_PASS' fault.

Signed-off-by: Yuanhan Liuyuanhan@linux.intel.com
---
  tests/all.tests  |1 +
  tests/general/CMakeLists.gl.txt  |1 +
  tests/general/vao-element-array-buffer.c |   94 ++
  3 files changed, 96 insertions(+), 0 deletions(-)
  create mode 100644 tests/general/vao-element-array-buffer.c

diff --git a/tests/all.tests b/tests/all.tests
index 851db11..ad68d71 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -305,6 +305,7 @@ add_plain_test(general, 
'two-sided-lighting-separate-specular')
  

Re: [Mesa-dev] [Piglit] [PATCH] Add a simple testcase to test that GL_ELEMENT_ARRAY_BUFFER is per vao

2011-11-23 Thread Yuanhan Liu
On Wed, Nov 23, 2011 at 11:12:19AM -0800, Eric Anholt wrote:
 On Wed, 23 Nov 2011 17:34:30 +0800, Yuanhan Liu yuanhan@linux.intel.com 
 wrote:
  From 9a1da8748f0faa23f34398213ff7ee45fda6bf36 Mon Sep 17 00:00:00 2001
  From: Yuanhan Liu yuanhan@linux.intel.com
  Date: Wed, 23 Nov 2011 17:37:33 +0800
  Subject: [PATCH] Add a simple testcase to test that GL_ELEMENT_ARRAY_BUFFER
   is per vao
  
  According opengl spec 4.2.pdf table 6.12 (Vertex Array Object State) at
  page 515: the element buffer object is listed in vertex array object.
  
  Add a testcase to test that.
  
  v2: fix n careless 'always-return-PIGLIT_PASS' fault.
  
  Signed-off-by: Yuanhan Liu yuanhan@linux.intel.com
 
  diff --git a/tests/general/vao-element-array-buffer.c 
  b/tests/general/vao-element-array-buffer.c
  new file mode 100644
  index 000..8803bff
  --- /dev/null
  +++ b/tests/general/vao-element-array-buffer.c
  @@ -0,0 +1,94 @@
  +/*
  + * Copyright (C) 2011 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:
  + *Yuanhan Liu yuanhan@linux.intel.com
  + */
 
 Generally, the style I advocate is to not include the Authors line in
 copyright messages.
It's OK to me.

 git records who the author was already, and will
 provide a more accurate view of who wrote the current code if someone
 wants to know some time down the line. 
Agreed.

 I don't know how many times, 5
 years later, I've had emails from someone asking about some code I'd
 written that just had my name in the header and nothing else really of
 mine, from back when we were including Authors lines in the CVS days.
Aha, interesting.

 
  +   glutSwapBuffers();
 
 If you switched this to piglit_present_results, this test could be an
 add_concurrent_test() instead.
  +   GLfloat vertics[] = {
  +   -1, -1, 0,
  +1, -1, 0,
  +1,  1, 0,
  +   -1,  1, 0,
  +   };
  +   GLubyte indics[] = {0, 1, 2, 3};
 
 vertices and indices

Oops, sorry for the typos. Will fix it in the next patch.

Thanks,
Yuanhan Liu

 
 Other than these silly nitpicks,
 
 Reviewed-by: Eric Anholt e...@anholt.net
 
 Thanks!


___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [Piglit] [PATCH] Add a simple testcase to test that GL_ELEMENT_ARRAY_BUFFER is per vao

2011-11-23 Thread Yuanhan Liu
On Wed, Nov 23, 2011 at 08:33:00AM -0700, Brian Paul wrote:
 On 11/23/2011 02:34 AM, Yuanhan Liu wrote:
 +GLuint element;
 +GLfloat vertics[] = {
 
 minor nit: s/vertics/vertices/
 
 
 +-1, -1, 0,
 + 1, -1, 0,
 + 1,  1, 0,
 +-1,  1, 0,
 +};
 +GLubyte indics[] = {0, 1, 2, 3};
 
 and s/indics/indices/

Sorry for the typos, will fix it in the next patch.

Thanks,
Yuanhan Liu
 
 
 +
 +piglit_require_extension(GL_ARB_vertex_array_object);
 +
 +glClearColor(0, 0, 0, 1);
 +
 +glGenBuffers(1,vbo);
 +glGenBuffers(1,element);
 +
 +glGenVertexArrays(1,vao);
 +glBindVertexArray(vao);
 +
 +glBindBuffer(GL_ARRAY_BUFFER, vbo);
 +glBufferData(GL_ARRAY_BUFFER, sizeof(vertics), vertics, GL_STATIC_DRAW);
 +glVertexPointer(3, GL_FLOAT, 0, NULL);
 +glEnableClientState(GL_VERTEX_ARRAY);
 +
 +glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, element);
 +glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indics), indics, 
 GL_STATIC_DRAW);
 +
 +glBindVertexArray(0);
 +glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
 +}
 
 Looks good otherwise.
 
 Reviewed-by: Brian Paul bri...@vmware.com
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev