Bug 28585 - glVertexAttrib doesn't seem to work on the GLES 2 driver
Summary: glVertexAttrib doesn't seem to work on the GLES 2 driver
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Other (show other bugs)
Version: git
Hardware: Other All
: medium normal
Assignee: mesa-dev
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-17 10:11 UTC by Neil Roberts
Modified: 2010-12-08 06:39 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Test case (2.82 KB, text/x-csrc)
2010-06-17 10:11 UTC, Neil Roberts
Details
Fix GLES2 glVertexAttrib (14.86 KB, patch)
2010-12-07 06:24 UTC, Chia-I Wu
Details | Splinter Review

Description Neil Roberts 2010-06-17 10:11:59 UTC
Created attachment 36339 [details]
Test case

Using glVertexAttrib4f (or similar) to set a default vertex attrib value doesn't seem to work on the Mesa GLES 2 driver. Using glVertexAttribPointer to set an array value for the attribute for each vertex however seems to work fine.

The attached test case tries to draw a red rectangle using a simple shader. The color is specified using a vertex attribute. For me the rectangle comes out black instead. If you change the #if 0 to #if 1 it will use glVertexAttribPointer instead and it seems to work.

This is tested on my i965 with Mesa git 118a476. I can't test with any later commit because Mesa just gives an assert for all programs after that (but I guess that's a separate issue).

This causes Clutter to display text in black when the string is long enough to use a VBO instead of going through the journal (such as in text-text).
Comment 1 Neil Roberts 2010-11-24 05:20:35 UTC
This appears to be fixed in git master
Comment 2 Neil Roberts 2010-12-07 04:34:09 UTC
I just noticed that calling glVertexAttrib with attrib location zero doesn't work. I think on big GL there is no generic value for location zero and glVertexAttrib with 0 should only be called between glBegin and glEnd. As far as I can tell this restriction doesn't apply for GLES2 so it should work. This is a pain for Cogl because I want to be able to let the driver determine the attribute locations for itself and then later query them with glGetAttribLocation. We sometimes need to set the color attribute using the generic value but if the compiler happens to place the color in attribute 0 then it won't work.
Comment 3 Chia-I Wu 2010-12-07 06:24:15 UTC
Created attachment 40868 [details] [review]
Fix GLES2 glVertexAttrib

Does this patch help?  It fixes the test case when ATTRIB_COLOR is 0 and ATTRIB_POSITION is 1.

It would be great if someone more familiar with the vbo module can review it.
Comment 4 Brian Paul 2010-12-07 07:37:13 UTC
Why do the color/normal/texcoord functions need to be renamed?
Comment 5 Chia-I Wu 2010-12-07 07:45:11 UTC
(In reply to comment #4)
> Why do the color/normal/texcoord functions need to be renamed?
Just for consistency (s/_vbo_/_es_/).  If it looks good otherwise, I could separate the renames and the real fix into two commits.
Comment 6 Brian Paul 2010-12-07 08:02:20 UTC
(In reply to comment #5)
> (In reply to comment #4)
> > Why do the color/normal/texcoord functions need to be renamed?
> Just for consistency (s/_vbo_/_es_/).  If it looks good otherwise, I could
> separate the renames and the real fix into two commits.

OK, maybe just note in the commit message that the other renaming was done for consistency.
Comment 7 Neil Roberts 2010-12-07 13:07:32 UTC
Yup, the patch works here. Thanks for the quick response.
Comment 8 Chia-I Wu 2010-12-08 06:39:14 UTC
Committed as 98ee6739d97b5592a7dad0b453c78e180a51ad50, with more descriptive commit message.


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.