Bug 5001

Summary: Indirect rendering of glInterleavedArrays() broke
Product: Mesa Reporter: tom <flynnt>
Component: Mesa coreAssignee: Ian Romanick <idr>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: high    
Version: unspecified   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 1690    
Attachments: Fix typeo in __indirect_glInterleavedArrays
Major re-work of __indirect_glInterleavedArrays
Major re-work of __indirect_glInterleavedArrays, take 2

Description tom 2005-11-09 16:49:10 UTC
The data format we're using is GL_C4UB_V3F.  There seems to be a typo in the
code in vertarr.c.

    vOffset = __glXTypeSize(vType) * cSize;

in the case statement for GL_C4UB_V3F, looks like it should be:

    vOffset = __glXTypeSize(cType) * cSize;
Comment 1 Ian Romanick 2005-11-10 08:51:06 UTC
Created attachment 3766 [details] [review]
Fix typeo in __indirect_glInterleavedArrays

That appears to be the only case in __indirect_glInterleavedArrays that has
this copy-and-paste type bug.  Good catch.  Assuming this actually fixes the
problem for you, I'll commit to Mesa CVS and X.org 6.8.x CVS.
Comment 2 Ian Romanick 2005-11-10 10:11:36 UTC
Created attachment 3768 [details] [review]
Major re-work of __indirect_glInterleavedArrays

This is a major re-work of the __indirect_glInterleavedArrays routine.	The
big, ugly, error prone switch-statement is replaced with a compact table.  This
change cuts the lines of code by more than half (from 156 to 76).

This is the patch I intend to commit to Mesa CVS and Xorg 6.7 / 7.0.  I will
leave attachment #3766 [details] [review] for X.org 6.8.3.
Comment 3 tom 2005-11-10 16:18:03 UTC
I've tested the patch, glInterleavedArrays() now works for me.  Thanks.
Comment 4 Brian Paul 2005-11-11 13:47:48 UTC
There are actually two bugs in your table-driven code:
1. The <format> parameter is never check for legallity, if it's not, <idx> will
be invalid.
2. The call to glNormalPointer passes <count> instead of <type> as the first
parameter.

I'd also like to see a comment before the code where you initialize the
offsets[] array because it's not immediately obvious what it does.
Comment 5 Ian Romanick 2005-11-15 13:01:21 UTC
Created attachment 3807 [details] [review]
Major re-work of __indirect_glInterleavedArrays, take 2

Changes from attachment #3768 [details] [review]:

Added numerous comments, including a comment explaining how the format
parameter is validated.

Explicitly pass GL_FLOAT as the type in the cases where that is the only
possible value (e.g., everywhere except the call to glColorPointer).

Fixed the error in the glNormalPointer call.

Validate that stride is >= 0 (bug #5058).

Tested with all modes (including the two error modes) of
progs/tests/interleave.c.
Comment 6 Ian Romanick 2005-11-30 11:07:33 UTC
I have committed attachment #3807 [details] [review] to both Mesa HEAD and the 6.4 branch. 
Resolving bug as FIXED.

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.