Bug 13751 - glGetActiveUniform returns size in wrong units
glGetActiveUniform returns size in wrong units
Status: RESOLVED DUPLICATE of bug 13753
Product: Mesa
Classification: Unclassified
Component: Mesa core
x86-64 (AMD64) Linux (All)
: medium normal
Assigned To: mesa-dev
Depends on:
  Show dependency treegraph
Reported: 2007-12-20 03:28 UTC by Bruce Merry
Modified: 2007-12-21 13:33 UTC (History)
0 users

See Also:
i915 platform:
i915 features:

Demo; requires GLEW and GLUT (2.00 KB, text/x-csrc)
2007-12-20 03:33 UTC, Bruce Merry

Note You need to log in before you can comment on or make changes to this bug.
Description Bruce Merry 2007-12-20 03:28:58 UTC
Page 81 of the the OpenGL 2.1 spec states "the value in size is in units of the type returned in type". Mesa 7.0.2, however, returns a count of scalars. I will attach a test program which demonstrates this: it queries a 4x4 matrix and receives a size of 16 instead of 1.

I haven't written a test for it, but eye-balling the code for glGetActiveAttrib makes me suspect that the same bug is present there.
Comment 1 Bruce Merry 2007-12-20 03:33:17 UTC
Created attachment 13251 [details]
Demo; requires GLEW and GLUT

Compile with 
gcc -o glsl-size glsl-size.c -Wall -g -lGLEW -lglut -lGL
Comment 2 Bruce Merry 2007-12-20 03:36:35 UTC
The choice of versions in Bugzilla is quite out of date. I left the version as unspecified because 7.0.2 (or 7.x) wasn't on the list, but it's stock 7.0.2 rather than CVS.
Comment 3 Brian Paul 2007-12-20 08:06:57 UTC
Fixed in git. Thanks.
Comment 4 Bruce Merry 2007-12-21 06:07:11 UTC
sizeof_glsl_type returns the wrong value for GL_FLOAT_MAT4x3: it returns 12 but it should be 16.
Comment 5 Bruce Merry 2007-12-21 13:33:59 UTC
Labelled this a dupe of 13753, since the remaining work is incorporated into the patches I posted there (the 2x3 case was also wrong).

*** This bug has been marked as a duplicate of bug 13753 ***