Yes, that's cleaner.

(Hi Gareth!)

Keith

Gareth Hughes wrote:
Perhaps:

    switch (nr) {
    case 0:  return 0;
    case 1:  ovf = 1;             break;
    case 2:  ovf = 2;             break;
    default: ovf = MIN2(nr-1, 2); break;
    }

(or similar) would be better, if the code below does indeed fix the problem?

-- Gareth

Andreas Stenglein wrote:

unfortunately it was only a partial fix
(but was enough for that particular program)

heres a new one: (and maybe it should be handeld this way
with GL_QUAD_STRIP, too)
--- radeon_vtxfmt.c_orig    Fri Mar 21 17:22:23 2003
+++ radeon_vtxfmt.c    Tue Mar 25 07:45:52 2003
@@ -312,7 +312,14 @@
      return 2;
       }
    case GL_TRIANGLE_STRIP:
-      ovf = MIN2( nr-1, 2 );
+      if (nr == 0) /* dont let verts go negative! */
+         return 0;
+      if (nr == 1) /* copy the right one ? */
+         ovf = 1;
+      else if (nr == 2) /* copy 2 verts, not only one */
+         ovf = 2;
+      else
+         ovf = MIN2( nr-1, 2 );
       for (i = 0 ; i < ovf ; i++)
      copy_vertex( rmesa, nr-ovf+i, tmp[i] );
       return i;

could that be a bit faster in the hole thing?

--- radeon_vtxfmt.c    Tue Mar 25 07:57:34 2003
+++ radeon_vtxfmt.c_orig    Fri Mar 21 17:22:23 2003
@@ -312,17 +312,7 @@
      return 2;
       }
    case GL_TRIANGLE_STRIP:
-      if (nr < 3)
-      {
-         if (nr == 2)       /* copy 2 verts, not only one */
-            ovf = 2;
-         else if (nr == 1)  /* copy the right one ? */
-            ovf = 1;
-         else               /* nr==0: dont let verts go negative! */
-            return 0;
-      }
-      else
-         ovf = MIN2( nr-1, 2 );
+      ovf = MIN2( nr-1, 2 );
       for (i = 0 ; i < ovf ; i++)
      copy_vertex( rmesa, nr-ovf+i, tmp[i] );
       return i;


Am 2003.03.24 22:13:12 +0100 schrieb(en) Keith Whitwell:


Andreas Stenglein wrote:

this patch helps for the demo.
but someone more familiar with radeon_vtxfmt should
check if it really fixes all cases...

I think in case of GL_QUAD_STRIP we should check
for 0, too.
(and maybe for 1?)

--- radeon_vtxfmt.c_orig    Fri Mar 21 17:22:23 2003
+++ radeon_vtxfmt.c    Mon Mar 24 21:52:58 2003
@@ -312,6 +312,8 @@
      return 2;
       }
    case GL_TRIANGLE_STRIP:
+      if (nr == 0) /* dont let verts go negative! */
+         return 0;
       ovf = MIN2( nr-1, 2 );
       for (i = 0 ; i < ovf ; i++)
      copy_vertex( rmesa, nr-ovf+i, tmp[i] );



Good catch!


I'll commit fixes for this.

Keith




-------------------------------------------------------
This SF.net email is sponsored by:
The Definitive IT and Networking Event. Be There!
NetWorld+Interop Las Vegas 2003 -- Register today!
http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en
_______________________________________________
Dri-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dri-devel









------------------------------------------------------- This SF.net email is sponsored by: The Definitive IT and Networking Event. Be There! NetWorld+Interop Las Vegas 2003 -- Register today! http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en _______________________________________________ Dri-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to