[Mesa-dev] glClearColor is broken in a weird way if compiled with mangling enabled

Yuzhu Lu yuzhu at wolfram.com
Wed Aug 19 17:18:02 PDT 2015


Update: 

All function with GLclampf and GLfloat are messed up. But pointer are fine. Other datatype works fine as well. I never had such a weird issue before. The work around to replace it with GLdouble. 


Yuzhu 



----- Original Message -----

From: "Yuzhu Lu" <yuzhu at wolfram.com> 
To: mesa-dev at lists.freedesktop.org, mesa-users at lists.freedesktop.org 
Sent: Wednesday, August 19, 2015 5:15:46 PM 
Subject: Re: [Mesa-dev] glClearColor is broken in a weird way if compiled with mangling enabled 

It seems related to datatype GLclampf, which affects mglClearColor, mglBlendColor... If I replace it with double, everything works fine. Any ideas? 



Yuzhu 




----- Original Message -----

From: "Yuzhu Lu" <yuzhu at wolfram.com> 
To: mesa-dev at lists.freedesktop.org, mesa-users at lists.freedesktop.org 
Sent: Friday, August 14, 2015 1:22:05 PM 
Subject: [Mesa-dev] glClearColor is broken in a weird way if compiled with mangling enabled 


Hi All, 

Since I need to load osmesa and system GL api at the same time on Linux, I need to compile 10.5.9 osmesa in a mangled way. After a simple fix in glapi.h: 

/* Is this needed? It is incomplete anyway. */ 
/* 
#ifdef USE_MGL_NAMESPACE 
#define _glapi_set_dispatch _mglapi_set_dispatch 
#define _glapi_get_dispatch _mglapi_get_dispatch 
#define _glapi_set_context _mglapi_set_context 
#define _glapi_get_context _mglapi_get_context 
#define _glapi_Dispatch _mglapi_Dispatch 
#define _glapi_Context _mglapi_Context 
#endif 
*/ 

Now it compiles fine and here is my configuration: 

./configure CFLAGS="-O2" CXXFLAGS="-O2" --disable-xvmc --disable-glx --disable-dri --with-dri-drivers="" --with-gallium-drivers="swrast" --enable-texture-float --enable-shared-glapi --disable-egl --enable-mangling --with-egl-platforms="" --enable-gallium-osmesa --enable-gallium-llvm=yes --disable-llvm-shared-libs --with-osmesa-bits=32 --with-max-width=65536 --with-max-height=65536 

But glClearColor is broken in a weird way that the value passed in is revised internally. Here is my call: 
mglClearColor(0.5f, 0.3f, 0.3f, 0.3f); 

But if I print out the value in _mesa_ClearColor() method of Clear.c. It shows: 
ClearColor: 0.000000, 2.000000, 2.000000, 2.000000 

I totally have no idea why this is happening while everything works fine with mangling disabled. 

Also, the compiler complains that mglGetString returns int instead of const GLubyte*: 
osdemo32.c:441:1: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘int’ [-Wformat=] 
printf("Version: %s\n", mglGetString(GL_VERSION)); 

And mglGetString(GL_SHADING_LANGUAGE_VERSION) will crash the application while other string works fine. 

I also try to compile it with disable-shared-glapi flag, but I get errors. I am not sure this is because gl_mangle.h is dated. (If I manually add the following functions in gl_mangle.h, it compiles fine but some functions like glCreateShader will be totally messed up.) 

I would really appreciate it if someone have solutions because this is a very important project for us. 



CXXLD libMangledOSMesa32.la 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x5588): undefined reference to `glPointSizePointerOES' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x6ae8): undefined reference to `glPolygonOffsetClampEXT' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x6b78): undefined reference to `glAlphaFuncx' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x6b90): undefined reference to `glClearColorx' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x6ba8): undefined reference to `glClearDepthx' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x6bc0): undefined reference to `glColor4x' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x6bd8): undefined reference to `glDepthRangex' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x6bf0): undefined reference to `glFogx' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x6c08): undefined reference to `glFogxv' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x6c20): undefined reference to `glFrustumf' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x6c38): undefined reference to `glFrustumx' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x6c50): undefined reference to `glLightModelx' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x6c68): undefined reference to `glLightModelxv' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x6c80): undefined reference to `glLightx' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x6c98): undefined reference to `glLightxv' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x6cb0): undefined reference to `glLineWidthx' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x6cc8): undefined reference to `glLoadMatrixx' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x6ce0): undefined reference to `glMaterialx' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x6cf8): undefined reference to `glMaterialxv' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x6d10): undefined reference to `glMultMatrixx' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x6d28): undefined reference to `glMultiTexCoord4x' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x6d40): undefined reference to `glNormal3x' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x6d58): undefined reference to `glOrthof' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x6d70): undefined reference to `glOrthox' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x6d88): undefined reference to `glPointSizex' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x6da0): undefined reference to `glPolygonOffsetx' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x6db8): undefined reference to `glRotatex' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x6dd0): undefined reference to `glSampleCoveragex' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x6de8): undefined reference to `glScalex' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x6e00): undefined reference to `glTexEnvx' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x6e18): undefined reference to `glTexEnvxv' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x6e30): undefined reference to `glTexParameterx' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x6e48): undefined reference to `glTranslatex' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x6e60): undefined reference to `glClipPlanef' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x6e78): undefined reference to `glClipPlanex' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x6e90): undefined reference to `glGetClipPlanef' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x6ea8): undefined reference to `glGetClipPlanex' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x6ec0): undefined reference to `glGetFixedv' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x6ed8): undefined reference to `glGetLightxv' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x6ef0): undefined reference to `glGetMaterialxv' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x6f08): undefined reference to `glGetTexEnvxv' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x6f20): undefined reference to `glGetTexParameterxv' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x6f38): undefined reference to `glPointParameterx' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x6f50): undefined reference to `glPointParameterxv' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x6f68): undefined reference to `glTexParameterxv' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x9b78): undefined reference to `glAlphaFuncx' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x9b90): undefined reference to `glClearColorx' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x9ba8): undefined reference to `glClearDepthx' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x9bc0): undefined reference to `glColor4x' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x9bd8): undefined reference to `glDepthRangex' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x9bf0): undefined reference to `glFogx' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x9c08): undefined reference to `glFogxv' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x9c20): undefined reference to `glFrustumf' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x9c38): undefined reference to `glFrustumx' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x9c50): undefined reference to `glLightModelx' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x9c68): undefined reference to `glLightModelxv' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x9c80): undefined reference to `glLightx' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x9c98): undefined reference to `glLightxv' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x9cb0): undefined reference to `glLineWidthx' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x9cc8): undefined reference to `glLoadMatrixx' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x9ce0): undefined reference to `glMaterialx' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x9cf8): undefined reference to `glMaterialxv' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x9d10): undefined reference to `glMultMatrixx' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x9d28): undefined reference to `glMultiTexCoord4x' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x9d40): undefined reference to `glNormal3x' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x9d58): undefined reference to `glOrthof' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x9d70): undefined reference to `glOrthox' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x9d88): undefined reference to `glPointSizex' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x9da0): undefined reference to `glPolygonOffsetx' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x9db8): undefined reference to `glRotatex' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x9dd0): undefined reference to `glSampleCoveragex' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x9de8): undefined reference to `glScalex' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x9e00): undefined reference to `glTexEnvx' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x9e18): undefined reference to `glTexEnvxv' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x9e30): undefined reference to `glTexParameterx' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x9e48): undefined reference to `glTranslatex' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x9e60): undefined reference to `glClipPlanef' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x9e78): undefined reference to `glClipPlanex' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x9e90): undefined reference to `glGetClipPlanef' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x9ea8): undefined reference to `glGetClipPlanex' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x9ec0): undefined reference to `glGetFixedv' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x9ed8): undefined reference to `glGetLightxv' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x9ef0): undefined reference to `glGetMaterialxv' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x9f08): undefined reference to `glGetTexEnvxv' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x9f20): undefined reference to `glGetTexParameterxv' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x9f38): undefined reference to `glPointParameterx' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x9f50): undefined reference to `glPointParameterxv' 
../../../../src/mapi/glapi/.libs/libglapi.a(glapi_libglapi_la-glapi_getproc.o):(.data.rel.ro+0x9f68): undefined reference to `glTexParameterxv' 
collect2: error: ld returned 1 exit status 



Yuzhu Lu 
Senior User Interface Developer 
Wolfram Research Inc. 



_______________________________________________ 
mesa-dev mailing list 
mesa-dev at lists.freedesktop.org 
http://lists.freedesktop.org/mailman/listinfo/mesa-dev 


_______________________________________________ 
mesa-dev mailing list 
mesa-dev at lists.freedesktop.org 
http://lists.freedesktop.org/mailman/listinfo/mesa-dev 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150819/434710ad/attachment-0001.html>


More information about the mesa-dev mailing list