Bug 9062

Summary: tnl - full vertex buffers may cause additional primitives to be introduced
Product: Mesa Reporter: Roland Scheidegger <sroland>
Component: Mesa coreAssignee: mesa-dev
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: high CC: glisse
Version: git   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: patch to fix the additional triangles generated upon _tnl_copy_vertices

Description Roland Scheidegger 2006-11-17 07:52:22 UTC
the hypertorus hack of xscreensaver (recent version may be needed - 4.24 should
be new enough, I've used 5.0.1) shows some seemingly random triangles when
started with the right options (-solid -transparent should do). I've looked a
bit at it and it seems whenever a buffer wrap happens due to the buffer being
full (so _tnl_wrap_filled_vertex is called, not sure if it's correct if
_tnl_wrap_buffers gets called due to other reasons) an additional tri will be
introduced (actually I think one is just drawn twice). This happens with both
software mesa and r200, though with r200 only when tcl_mode is either 1 or 0.
hypertorus uses GL_TRIANGLE_STRIP for all its rendering. I initially thought
there might be a bug because of the excessive glMaterial calls between
glBegin/glEnd, but removing them completely (by replacing with enabling
GL_COLOR_MATERIAL) didn't change much, except there were far fewer additional
triangles, apparently because much less buffer wraps happen. Not sure, but
_tnl_copy_vertices looked a bit strange to me for GL_TRIANGLE_STRIP, as it may
copy 3 instead of only the last 2 vertices - apparently to avoid problems with
the vertex order, but I'll wonder if that's related to this bug.

(this was originally reported here:
https://bugs.freedesktop.org/show_bug.cgi?id=8250)
Comment 1 Roland Scheidegger 2006-11-22 09:49:43 UTC
Created attachment 7862 [details] [review]
patch to fix the additional triangles generated upon _tnl_copy_vertices

This patch kills the additional triangle generated by _tnl_copy_vertices.
Verified with hypertorus, but I'm not sure it's quite the right thing to do,
might have unwanted side effects?
Comment 2 Keith Whitwell 2006-11-22 11:49:45 UTC
Roland,  the patch makes sense to me - thanks for tracking this down.
Comment 3 Roland Scheidegger 2006-11-22 14:07:50 UTC
commited.
Comment 4 Chris Rankin 2006-11-26 04:30:32 UTC
Yes, this fixes hypertorus and has no effect whatsoever on bug 8250 :-).
Comment 5 Roland Scheidegger 2007-01-25 03:53:15 UTC
It seems it's still wrong for the save_api code (display lists), though I'm not 100% confident the same fix will work there...
Comment 6 Adam Jackson 2009-08-24 12:25:01 UTC
Mass version move, cvs -> git
Comment 7 Michel Dänzer 2011-02-09 01:59:07 UTC
(In reply to comment #5)
> It seems it's still wrong for the save_api code (display lists), though I'm not
> 100% confident the same fix will work there...

Is this still an issue?
Comment 8 Roland Scheidegger 2011-02-09 06:03:21 UTC
Oh hmm that bug is very old...
Since the original bug was fixed let's close it. Even if the display list code was wrong too (which might not have even been the case) it didn't seem to have caused problems or might have got fixed in the interim.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.