Re: [Mesa-dev] [PATCH 2/2] i965: fix the wrong min/max_index for nr_prims 1

2011-12-30 Thread Yuanhan Liu
On Thu, Dec 29, 2011 at 09:10:03AM +0100, Michel Dänzer wrote:
 On Don, 2011-12-29 at 10:03 +0800, Yuanhan Liu wrote: 
  On Wed, Dec 28, 2011 at 12:07:08PM -0800, Eric Anholt wrote:
   On Wed, 28 Dec 2011 13:54:43 +0800, Yuanhan Liu 
   yuanhan@linux.intel.com wrote:
The current code would just calculate min/max_index for the first prim
unconditionally, which is wrong if nr_prims  1.

This would some cases like that the index is stored in element array
buffer object and drawing by glMultiDrawEelements. Thus it fixes some
intel oglc primbuff test cases.

Signed-off-by: Yuanhan Liu yuanhan@linux.intel.com
   
   It does look like gallium has the same bug --
  
  i965g?  I just found that the whole i965g is deleted by commit
  2c27f204f1ca6f09f9520712be1da9a13ed5c01d.
  
   this should probably be a
   vbo helper function.
  
  If you were talking about i965g and now it was deleted, should I make
  this be a vbo helper function?
 
 i965g was just one Gallium driver. Presumably, Eric was referring to the
 Gallium Mesa state tracker (src/mesa/state_tracker/), which translates
 between the Mesa and Gallium driver interfaces.

Hi Michel,

Thanks for the information. Will make some new patches.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/2] i965: fix the wrong min/max_index for nr_prims 1

2011-12-29 Thread Michel Dänzer
On Don, 2011-12-29 at 10:03 +0800, Yuanhan Liu wrote: 
 On Wed, Dec 28, 2011 at 12:07:08PM -0800, Eric Anholt wrote:
  On Wed, 28 Dec 2011 13:54:43 +0800, Yuanhan Liu 
  yuanhan@linux.intel.com wrote:
   The current code would just calculate min/max_index for the first prim
   unconditionally, which is wrong if nr_prims  1.
   
   This would some cases like that the index is stored in element array
   buffer object and drawing by glMultiDrawEelements. Thus it fixes some
   intel oglc primbuff test cases.
   
   Signed-off-by: Yuanhan Liu yuanhan@linux.intel.com
  
  It does look like gallium has the same bug --
 
 i965g?  I just found that the whole i965g is deleted by commit
 2c27f204f1ca6f09f9520712be1da9a13ed5c01d.
 
  this should probably be a
  vbo helper function.
 
 If you were talking about i965g and now it was deleted, should I make
 this be a vbo helper function?

i965g was just one Gallium driver. Presumably, Eric was referring to the
Gallium Mesa state tracker (src/mesa/state_tracker/), which translates
between the Mesa and Gallium driver interfaces.


-- 
Earthling Michel Dänzer   |   http://www.amd.com
Libre software enthusiast |  Debian, X and DRI developer
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/2] i965: fix the wrong min/max_index for nr_prims 1

2011-12-28 Thread Yuanhan Liu
On Wed, Dec 28, 2011 at 12:07:08PM -0800, Eric Anholt wrote:
 On Wed, 28 Dec 2011 13:54:43 +0800, Yuanhan Liu yuanhan@linux.intel.com 
 wrote:
  The current code would just calculate min/max_index for the first prim
  unconditionally, which is wrong if nr_prims  1.
  
  This would some cases like that the index is stored in element array
  buffer object and drawing by glMultiDrawEelements. Thus it fixes some
  intel oglc primbuff test cases.
  
  Signed-off-by: Yuanhan Liu yuanhan@linux.intel.com
 
 It does look like gallium has the same bug --

i965g?  I just found that the whole i965g is deleted by commit
2c27f204f1ca6f09f9520712be1da9a13ed5c01d.

 this should probably be a
 vbo helper function.

If you were talking about i965g and now it was deleted, should I make
this be a vbo helper function?

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


[Mesa-dev] [PATCH 2/2] i965: fix the wrong min/max_index for nr_prims 1

2011-12-27 Thread Yuanhan Liu
The current code would just calculate min/max_index for the first prim
unconditionally, which is wrong if nr_prims  1.

This would some cases like that the index is stored in element array
buffer object and drawing by glMultiDrawEelements. Thus it fixes some
intel oglc primbuff test cases.

Signed-off-by: Yuanhan Liu yuanhan@linux.intel.com
---
 src/mesa/drivers/dri/i965/brw_draw.c |   18 --
 1 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_draw.c 
b/src/mesa/drivers/dri/i965/brw_draw.c
index 621195d..3d0cc7c 100644
--- a/src/mesa/drivers/dri/i965/brw_draw.c
+++ b/src/mesa/drivers/dri/i965/brw_draw.c
@@ -585,8 +585,22 @@ void brw_draw_prims( struct gl_context *ctx,
   return;
 
if (!vbo_all_varyings_in_vbos(arrays)) {
-  if (!index_bounds_valid)
-vbo_get_minmax_index(ctx, prim, ib, min_index, max_index);
+  if (!index_bounds_valid) {
+ struct _mesa_index_buffer tmp_ib;
+ GLuint tmp_min, tmp_max;
+ int i;
+
+ min_index = ~0;
+ max_index = 0;
+ tmp_ib = *ib;
+
+ for (i = 0; i  nr_prims; i++) {
+ tmp_ib.ptr = ib-ptr + prim[i].start * 
vbo_sizeof_ib_type(ib-type);
+ vbo_get_minmax_index(ctx, prim[i], tmp_ib, tmp_min, tmp_max);
+ min_index = MIN2(min_index, tmp_min);
+ max_index = MAX2(max_index, tmp_max);
+ }
+  }
 
   /* Decide if we want to rebase.  If so we end up recursing once
* only into this function.
-- 
1.7.4.4

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