Adam Wiggins <[EMAIL PROTECTED]> writes:
> I'm going to be tackling some (minor) Mesa development in order to flesh
> out some features that I need for my app, specifically in the FX driver.
> I went ahead and grabbed the latest version from CVS, but unfortunately
> egcs 1.1.2 gets internal compiler errors on fog_tmp.h (no big deal,
> I commented the function out) and shade_tmp.h (big deal! commenting the
> functions out makes polygons appear with random colors!).
I had the same problem with egcs. The problem goes away if you use a
union instead of *(int*)&f to read floats directly as ints in
FLOAT_COLOR_TO_UBYTE_COLOR (in src/mmath.h) -
#define FLOAT_COLOR_TO_UBYTE_COLOR(b, f) \
do { \
union { GLfloat r; GLuint i; } tmp; \
tmp.r = f; \
b = ((tmp.i >= IEEE_ONE) \
? ((GLint)tmp.i < 0) ? (GLubyte)0 : (GLubyte)255 \
: (tmp.r = tmp.r*(255.0F/256.0F) + 32768.0F, \
(GLubyte)tmp.i)); \
} while (0)
The egcs manual mentions that this is the only safe way to do this if
-fstrict-aliasing is enabled, so this change is probably a good idea
anyway. (The compiler still shouldn't fail like that though.)
BTW, for my P5, egcs 1.1.2 generates slower code for Mesa than gcc
2.7.2.
Josh
_______________________________________________
Mesa-dev maillist - [EMAIL PROTECTED]
http://lists.mesa3d.org/mailman/listinfo/mesa-dev