Re: [Dri-devel] Fallback in radeon_Materialfv() doesnt work
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_origFri Mar 21 17:22:23 2003 +++ radeon_vtxfmt.cTue 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.cTue Mar 25 07:57:34 2003 +++ radeon_vtxfmt.c_origFri 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_origFri Mar 21 17:22:23 2003 +++ radeon_vtxfmt.cMon 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
Re: [Dri-devel] Fallback in radeon_Materialfv() doesnt work
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_origFri Mar 21 17:22:23 2003 +++ radeon_vtxfmt.cTue 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.cTue Mar 25 07:57:34 2003 +++ radeon_vtxfmt.c_origFri 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_origFri Mar 21 17:22:23 2003 +++ radeon_vtxfmt.cMon 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
Re: [Dri-devel] Fallback in radeon_Materialfv() doesnt work
Andreas, Does this work for you? Keith --- radeon_vtxfmt.c 4 Mar 2003 01:02:33 - 1.10 +++ radeon_vtxfmt.c 25 Mar 2003 09:56:06 - @@ -312,13 +312,20 @@ return 2; } case GL_TRIANGLE_STRIP: - ovf = MIN2( nr-1, 2 ); + switch (nr) { + case 0: ovf = 0; break; + case 1: ovf = 1; break; + default: ovf = 2; break; + } for (i = 0 ; i ovf ; i++) copy_vertex( rmesa, nr-ovf+i, tmp[i] ); return i; case GL_QUAD_STRIP: - ovf = MIN2( nr-1, 2 ); - if (nr 2) ovf += nr1; + switch (nr) { + case 0: ovf = 0; break; + case 1: ovf = 1; break; + default: ovf = 2 + (nr1); break; + } for (i = 0 ; i ovf ; i++) copy_vertex( rmesa, nr-ovf+i, tmp[i] ); return i; --- 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
Re: [Dri-devel] Fallback in radeon_Materialfv() doesnt work
Am 2003.03.25 10:58:15 +0100 schrieb(en) Keith Whitwell: Andreas, Does this work for you? Yes, at least the part with GL_TRIANGLE_STRIP. In case of 0 you can just return 0, no copying is needed. case 0: return 0; break; Keith --- radeon_vtxfmt.c 4 Mar 2003 01:02:33 - 1.10 +++ radeon_vtxfmt.c 25 Mar 2003 09:56:06 - @@ -312,13 +312,20 @@ return 2; } case GL_TRIANGLE_STRIP: - ovf = MIN2( nr-1, 2 ); + switch (nr) { + case 0: ovf = 0; break; + case 1: ovf = 1; break; + default: ovf = 2; break; + } for (i = 0 ; i ovf ; i++) copy_vertex( rmesa, nr-ovf+i, tmp[i] ); return i; case GL_QUAD_STRIP: - ovf = MIN2( nr-1, 2 ); - if (nr 2) ovf += nr1; + switch (nr) { + case 0: ovf = 0; break; + case 1: ovf = 1; break; + default: ovf = 2 + (nr1); break; + } for (i = 0 ; i ovf ; i++) copy_vertex( rmesa, nr-ovf+i, tmp[i] ); return i; --- 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
Re: [Dri-devel] Fallback in radeon_Materialfv() doesnt work
Andreas Stenglein wrote: Yes, at least the part with GL_TRIANGLE_STRIP. In case of 0 you can just return 0, no copying is needed. case 0: return 0; break; You're going to do that, just in a slightly different manner: switch (nr) { case 0: ovf = 0; break; case 1: ovf = 1; break; default: ovf = 2; break; } for (i = 0 ; i ovf ; i++) copy_vertex( rmesa, nr-ovf+i, tmp[i] ); return i; When nr == 0, ovf gets set to 0 and you do no iterations of the for loop. You'll then return i, which was initialized to 0. -- Gareth --- 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
Re: [Dri-devel] Fallback in radeon_Materialfv() doesnt work
On Tue, 25 Mar 2003 20:02:24 + Keith Whitwell [EMAIL PROTECTED] wrote: Gareth Hughes wrote: Andreas Stenglein wrote: Yes, at least the part with GL_TRIANGLE_STRIP. In case of 0 you can just return 0, no copying is needed. case 0: return 0; break; You're going to do that, just in a slightly different manner: switch (nr) { case 0: ovf = 0; break; case 1: ovf = 1; break; default: ovf = 2; break; } This is the same as ovf = MIN2( nr, 2 ); Nice to see in how many creative ways this can be obfuscated. ;-) So it was just an off-by-one error in the original version, which was ovf = MIN2( nr-1, 2 ); for (i = 0 ; i ovf ; i++) copy_vertex( rmesa, nr-ovf+i, tmp[i] ); return i; When nr == 0, ovf gets set to 0 and you do no iterations of the for loop. You'll then return i, which was initialized to 0. OK, this isn't perf critical code, so I'll just commit the clearest version. See above ;-) This is all queued up now pending the merge completion, which is also waiting on me... Keith __\|/_____ ___ - Felix ___\_e -_/___/ __\___/ __\_ You can do anything, Kühling (_\Ä// /_/ /) just not everything [EMAIL PROTECTED] \___/ \___/ Uat the same time. --- 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
Re: [Dri-devel] Fallback in radeon_Materialfv() doesnt work
On Tue, Mar 25, 2003 at 11:26:39PM +0100, Felix Kühling wrote: On Tue, 25 Mar 2003 20:02:24 + Keith Whitwell [EMAIL PROTECTED] wrote: Gareth Hughes wrote: Andreas Stenglein wrote: Yes, at least the part with GL_TRIANGLE_STRIP. In case of 0 you can just return 0, no copying is needed. case 0: return 0; break; You're going to do that, just in a slightly different manner: switch (nr) { case 0: ovf = 0; break; case 1: ovf = 1; break; default: ovf = 2; break; } This is the same as ovf = MIN2( nr, 2 ); Nice to see in how many creative ways this can be obfuscated. ;-) So it was just an off-by-one error in the original version, which was ovf = MIN2( nr-1, 2 ); Hmmm, this looks very much like it could be the reason for the problems I reported the other day: http://cpbotha.net/thingies/dri_scapula.png That scapula consists mostly out of triangle strips. :) -- charl p. botha http://cpbotha.net/ http://visualisation.tudelft.nl/ --- 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
Re: [Dri-devel] Fallback in radeon_Materialfv() doesnt work
Hmmm, this looks very much like it could be the reason for the problems I reported the other day: http://cpbotha.net/thingies/dri_scapula.png That scapula consists mostly out of triangle strips. :) Yep. This is the vertex copying code. It isn't explained then why turning off the VTXFMT code didn't make your problem go away, though. 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
Re: [Dri-devel] Fallback in radeon_Materialfv() doesnt work
Am 2003.03.25 21:02:24 +0100 schrieb(en) Keith Whitwell: Gareth Hughes wrote: Andreas Stenglein wrote: Yes, at least the part with GL_TRIANGLE_STRIP. In case of 0 you can just return 0, no copying is needed. case 0: return 0; break; You're going to do that, just in a slightly different manner: switch (nr) { case 0: ovf = 0; break; case 1: ovf = 1; break; default: ovf = 2; break; } for (i = 0 ; i ovf ; i++) copy_vertex( rmesa, nr-ovf+i, tmp[i] ); return i; When nr == 0, ovf gets set to 0 and you do no iterations of the for loop. You'll then return i, which was initialized to 0. so in the end for nr=0 ovf could be calculated almost as in the original version: ovf= MIN2(nr, 2); (for GL_TRIANGLE_STRIP) ovf= MIN2(nr, 2); if (nr 2) ovf += nr1; (for GL_QUAD_STRIP) OK, this isn't perf critical code, so I'll just commit the clearest version. This is all queued up now pending the merge completion, which is also waiting on me... 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
Re: [Dri-devel] Fallback in radeon_Materialfv() doesnt work
Gareth Hughes wrote: Andreas Stenglein wrote: Yes, at least the part with GL_TRIANGLE_STRIP. In case of 0 you can just return 0, no copying is needed. case 0: return 0; break; You're going to do that, just in a slightly different manner: switch (nr) { case 0: ovf = 0; break; case 1: ovf = 1; break; default: ovf = 2; break; } for (i = 0 ; i ovf ; i++) copy_vertex( rmesa, nr-ovf+i, tmp[i] ); return i; When nr == 0, ovf gets set to 0 and you do no iterations of the for loop. You'll then return i, which was initialized to 0. OK, this isn't perf critical code, so I'll just commit the clearest version. This is all queued up now pending the merge completion, which is also waiting on me... 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
Re: [Dri-devel] Fallback in radeon_Materialfv() doesnt work
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_origFri Mar 21 17:22:23 2003 +++ radeon_vtxfmt.cMon 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:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf ___ Dri-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dri-devel
Re: [Dri-devel] Fallback in radeon_Materialfv() doesnt work
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_origFri 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_origFri 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_origFri Mar 21 17:22:23 2003 +++ radeon_vtxfmt.cMon 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