Bug 8355

Summary: glVertexAttrib1dARB (double) behaves correctly, but glVertexAttrib1fARB (float) does not.
Product: Mesa Reporter: Oliver McFadden <z3ro.geek>
Component: Mesa coreAssignee: mesa-dev
Status: RESOLVED NOTABUG QA Contact:
Severity: normal    
Priority: high CC: glisse
Version: git   
Hardware: x86 (IA32)   
OS: Linux (All)   
URL: http://z3ro.name/attribbug.c
Whiteboard:
i915 platform: i915 features:
Attachments: Vertex attribute bug test program.

Description Oliver McFadden 2006-09-19 08:51:07 UTC
I've encountered what I believe is a bug in Mesa3d when setting vertex
attributes, it seems that glVertexAttrib1dARB (double precision) works but
glVertexAttrib1fARB (float precision) doesn't. The same applies for
glVertexAttribPointerARB, but with GL_DOUBLE and GL_FLOAT.

This bug might only affect generic vertex attributes (greater than or equal to
8) since glNormalPointer seems to work fine.  I've attached a simple demo
program modified from a demo program in Mesa3d. See the main() function.  The
demo just tests vertex attributes, not glNormalPointer; I confirmed this works
in another program.

I am using Mesa3d, libdrm, and drm from the latest CVS/Git with the r300 driver.
Comment 1 Oliver McFadden 2006-09-19 08:52:55 UTC
Created attachment 7075 [details]
Vertex attribute bug test program.
Comment 2 Brian Paul 2006-09-19 09:17:32 UTC
Not a bug.

If you compile with warning flags (such as -Wall -Wmissing-prototypes -g -ansi
-pedantic) you'll see a bunch of warnings such as:

attribbug.c:136: warning: implicit declaration of function `glVertexAttrib1dARB'
attribbug.c:141: warning: implicit declaration of function `glVertexAttrib1fARB'

To fix that, add #define GL_GLEXT_PROTOTYPES before you #include GL/gl.h

Without prototypes, the compiler is passing an 8-byte double to
glVertexAttrib1fARB() which becomes an invalid value inside Mesa since it's
expecting a 4-byte float.

When using C/C++ you should always use as many compiler warning options as possible.
Comment 3 Oliver McFadden 2006-09-19 09:37:41 UTC
(In reply to comment #2)
> Not a bug.
> 
> If you compile with warning flags (such as -Wall -Wmissing-prototypes -g -ansi
> -pedantic) you'll see a bunch of warnings such as:
> 
> attribbug.c:136: warning: implicit declaration of function `glVertexAttrib1dARB'
> attribbug.c:141: warning: implicit declaration of function `glVertexAttrib1fARB'
> 
> To fix that, add #define GL_GLEXT_PROTOTYPES before you #include GL/gl.h
> 
> Without prototypes, the compiler is passing an 8-byte double to
> glVertexAttrib1fARB() which becomes an invalid value inside Mesa since it's
> expecting a 4-byte float.
> 
> When using C/C++ you should always use as many compiler warning options as
possible.
> 

Oh, I didn't realize that I'd forgotten -Wall. Thanks for pointing that out.
Comment 4 Simon 2006-09-23 11:51:32 UTC
(In reply to comment #3)
> (In reply to comment #2)
> > Not a bug.
> > 
> > If you compile with warning flags (such as -Wall -Wmissing-prototypes -g -ansi
> > -pedantic) you'll see a bunch of warnings such as:
> > 
> > attribbug.c:136: warning: implicit declaration of function `glVertexAttrib1dARB'
> > attribbug.c:141: warning: implicit declaration of function `glVertexAttrib1fARB'
> > 
> > To fix that, add #define GL_GLEXT_PROTOTYPES before you #include GL/gl.h
> > 
> > Without prototypes, the compiler is passing an 8-byte double to
> > glVertexAttrib1fARB() which becomes an invalid value inside Mesa since it's
> > expecting a 4-byte float.
> > 
> > When using C/C++ you should always use as many compiler warning options as
> possible.
> > 
> 
> Oh, I didn't realize that I'd forgotten -Wall. Thanks for pointing that out.
> 

(In reply to comment #2)
> Not a bug.
> 
> If you compile with warning flags (such as -Wall -Wmissing-prototypes -g -ansi
> -pedantic) you'll see a bunch of warnings such as:
> 
> attribbug.c:136: warning: implicit declaration of function `glVertexAttrib1dARB'
> attribbug.c:141: warning: implicit declaration of function `glVertexAttrib1fARB'
> 
> To fix that, add #define GL_GLEXT_PROTOTYPES before you #include GL/gl.h
> 
> Without prototypes, the compiler is passing an 8-byte double to
> glVertexAttrib1fARB() which becomes an invalid value inside Mesa since it's
> expecting a 4-byte float.
> 
> When using C/C++ you should always use as many compiler warning options as
possible.
> 

I had seen those messages, where is a programmer supposed to find this out from
other than this bug?
Comment 5 Adam Jackson 2009-08-24 12:24:31 UTC
Mass version move, cvs -> git

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.