GZDOOM GL init code cleanup (Linux testing needed)
Moderator: Graf Zahl
- Graf Zahl
- GZDoom Developer
- Posts: 7148
- Joined: Wed Jul 20, 2005 9:48
- Location: Germany
- Contact:
GZDOOM GL init code cleanup (Linux testing needed)
I cleaned up the GL init code today. The old version had the Win32 and SDL code completely mixed together so I cleanly separated everything into the Video interface classes where it belongs.
However, I can't test the SDL side myself and therefore cannot guarantee that it still compiles, so I'd appreciate if someone with access to a Linux system could check and fix it
However, I can't test the SDL side myself and therefore cannot guarantee that it still compiles, so I'd appreciate if someone with access to a Linux system could check and fix it
Last edited by Graf Zahl on Wed Aug 28, 2013 7:36, edited 1 time in total.
-
- Developer
- Posts: 197
- Joined: Sun Nov 29, 2009 16:36
Re: GZDOOM GL init code cleanup (Linux testing needed)
Now I saw this thread, I already posted a crash report here.
- Graf Zahl
- GZDoom Developer
- Posts: 7148
- Joined: Wed Jul 20, 2005 9:48
- Location: Germany
- Contact:
Re: GZDOOM GL init code cleanup (Linux testing needed)
I expected some issues, that's why I asked for help. I can't do anything with the crash log because I do not have a Linux machine.
-
- Developer
- Posts: 197
- Joined: Sun Nov 29, 2009 16:36
Re: GZDOOM GL init code cleanup (Linux testing needed)
Ok, we have two things:
1) in sdlglvideo.cpp, line 318: I suppose that after printing "R_OPENGL: Failed to initialize stencil buffer! Reverting to software mode...\n" it should return false.
2) from what could I see, in the SDLGLFB constructor, in the same file, line 340, you call:
before calling: "SDL_SetVideoMode". But inside the 'InitHardware', you inserted this in the last commit:
which was the one to crash.
I managed to fix the issue by moving "SDL_SetVideoMode" above the "InitHardware" call, but I believe this is even more wrong.
1) in sdlglvideo.cpp, line 318: I suppose that after printing "R_OPENGL: Failed to initialize stencil buffer! Reverting to software mode...\n" it should return false.
2) from what could I see, in the SDLGLFB constructor, in the same file, line 340, you call:
Code: Select all
if (!static_cast<SDLGLVideo*>(Video)->InitHardware(false, localmultisample))
Code: Select all
SDL_GL_GetAttribute( SDL_GL_STENCIL_SIZE, &value );
I managed to fix the issue by moving "SDL_SetVideoMode" above the "InitHardware" call, but I believe this is even more wrong.
- Graf Zahl
- GZDoom Developer
- Posts: 7148
- Joined: Wed Jul 20, 2005 9:48
- Location: Germany
- Contact:
Re: GZDOOM GL init code cleanup (Linux testing needed)
Ugh...
Is SDL stupid or what? I think in that case I just remove the SDL_GL_GetAttribute call that's the cause of the crash.
Is SDL stupid or what? I think in that case I just remove the SDL_GL_GetAttribute call that's the cause of the crash.
-
- Developer
- Posts: 197
- Joined: Sun Nov 29, 2009 16:36
Re: GZDOOM GL init code cleanup (Linux testing needed)
I cannot compile latest changes, because you removed this snippet:
Code: Select all
#ifndef PFNGLMULTITEXCOORD2FPROC
typedef void (APIENTRYP PFNGLMULTITEXCOORD2FPROC) (GLenum target, GLfloat s, GLfloat t);
#endif
#ifndef PFNGLMULTITEXCOORD2FVPROC
typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVPROC) (GLenum target, const GLfloat *v);
#endif
- Graf Zahl
- GZDoom Developer
- Posts: 7148
- Joined: Wed Jul 20, 2005 9:48
- Location: Germany
- Contact:
Re: GZDOOM GL init code cleanup (Linux testing needed)
I don't understand why it is needed. Those definitions are present in glext.h as available on www.opengl.org so there shouldn't be any need to redefine them. They were wrong anyway because you can't
#ifdef for a typedef.
#ifdef for a typedef.
-
- Developer
- Posts: 197
- Joined: Sun Nov 29, 2009 16:36
Re: GZDOOM GL init code cleanup (Linux testing needed)
Because Mesa 9.x (the version which comes from recent linux distros) messed up with the glext.h headers. See for details here.
- GuntherDW
- Posts: 117
- Joined: Sat Nov 12, 2005 1:53
- Location: Belgium, Antwerp
- Contact:
Re: GZDOOM GL init code cleanup (Linux testing needed)
I'm trying to see where it comes from, but on my Gentoo box it refuses to compile with these changes.
The mesa version on my box (which is used for GL.h ?) is 9.2.1.
[spoiler]
GL.h from MESA
GL.h (and declaration from gzdoom)
haha, after commenting out a bunch, and adding http://zandronum.com/forum/showthread.php?tid=237 i got a bit further, but now it just crashes on another file :p)
I'm not so sure about the "PFNGLMULTITEXCOORD2FPROC" and "PFNGLMULTITEXCOORD2FVPROC" error yet though...[/spoiler]
Gah, I've been doing high(er) level languages for the last couple of years. I'm way too rusty in C
.
The mesa version on my box (which is used for GL.h ?) is 9.2.1.
[spoiler]
Code: Select all
Scanning dependencies of target zdoom
[ 36%] Building CXX object src/CMakeFiles/zdoom.dir/autostart.o
[ 36%] Building C object src/CMakeFiles/zdoom.dir/sdl/crashcatcher.o
[ 36%] Building CXX object src/CMakeFiles/zdoom.dir/sdl/hardware.o
In file included from /GuntherDW/src/git/tmp/gzdoom/src/./gl/system/gl_system.h:77:0,
from /GuntherDW/src/git/tmp/gzdoom/src/sdl/sdlglvideo.h:7,
from /GuntherDW/src/git/tmp/gzdoom/src/sdl/hardware.cpp:50:
/GuntherDW/src/git/tmp/gzdoom/src/./gl/api/gl_api.h:10:33: error: ‘void (* glBlendEquation)(GLenum)’ redeclared as different kind of symbol
In file included from /GuntherDW/src/git/tmp/gzdoom/src/./gl/system/gl_system.h:73:0,
from /GuntherDW/src/git/tmp/gzdoom/src/sdl/sdlglvideo.h:7,
from /GuntherDW/src/git/tmp/gzdoom/src/sdl/hardware.cpp:50:
/usr/include/GL/gl.h:1661:23: error: previous declaration of ‘void glBlendEquation(GLenum)’
In file included from /GuntherDW/src/git/tmp/gzdoom/src/./gl/system/gl_system.h:77:0,
from /GuntherDW/src/git/tmp/gzdoom/src/sdl/sdlglvideo.h:7,
from /GuntherDW/src/git/tmp/gzdoom/src/sdl/hardware.cpp:50:
/GuntherDW/src/git/tmp/gzdoom/src/./gl/api/gl_api.h:70:33: error: ‘void (* glActiveTexture)(GLenum)’ redeclared as different kind of symbol
In file included from /GuntherDW/src/git/tmp/gzdoom/src/./gl/system/gl_system.h:73:0,
from /GuntherDW/src/git/tmp/gzdoom/src/sdl/sdlglvideo.h:7,
from /GuntherDW/src/git/tmp/gzdoom/src/sdl/hardware.cpp:50:
/usr/include/GL/gl.h:1853:23: error: previous declaration of ‘void glActiveTexture(GLenum)’
In file included from /GuntherDW/src/git/tmp/gzdoom/src/./gl/system/gl_system.h:77:0,
from /GuntherDW/src/git/tmp/gzdoom/src/sdl/sdlglvideo.h:7,
from /GuntherDW/src/git/tmp/gzdoom/src/sdl/hardware.cpp:50:
/GuntherDW/src/git/tmp/gzdoom/src/./gl/api/gl_api.h:71:10: error: ‘PFNGLMULTITEXCOORD2FPROC’ does not name a type
/GuntherDW/src/git/tmp/gzdoom/src/./gl/api/gl_api.h:72:10: error: ‘PFNGLMULTITEXCOORD2FVPROC’ does not name a type
make[2]: *** [src/CMakeFiles/zdoom.dir/sdl/hardware.o] Error 1
make[1]: *** [src/CMakeFiles/zdoom.dir/all] Error 2
make: *** [all] Error 2
Code: Select all
__EXTERN PFNGLBLENDEQUATIONPROC glBlendEquation;
GLAPI void GLAPIENTRY glBlendEquation( GLenum mode );
__EXTERN PFNGLACTIVETEXTUREPROC glActiveTexture;
GLAPI void GLAPIENTRY glActiveTexture( GLenum texture );
GL.h (and declaration from gzdoom)
Code: Select all
__EXTERN PFNGLBLENDEQUATIONPROC glBlendEquation;
GLAPI void APIENTRY glBlendEquation (GLenum mode); (APIENTRY -> GLAPIENTRY)
__EXTERN PFNGLACTIVETEXTUREPROC glActiveTexture;
GLAPI void APIENTRY glActiveTexture (GLenum texture); (again with the APIENTRY -> GLAPIENTRY)
Code: Select all
[ 35%] Building CXX object src/CMakeFiles/zdoom.dir/gl/system/gl_interface.o
/GuntherDW/src/git/gzdoom/src/gl/system/gl_interface.cpp: In function ‘void InitContext()’:
/GuntherDW/src/git/gzdoom/src/gl/system/gl_interface.cpp:121:20: error: assignment of function ‘void glBlendEquation(GLenum)’
/GuntherDW/src/git/gzdoom/src/gl/system/gl_interface.cpp:121:20: error: cannot convert ‘void(GLenum) {aka void(unsigned int)}’ to ‘void(GLenum) {aka void(unsigned int)}’ in assignment
/GuntherDW/src/git/gzdoom/src/gl/system/gl_interface.cpp: In function ‘void gl_LoadExtensions()’:
/GuntherDW/src/git/gzdoom/src/gl/system/gl_interface.cpp:156:44: error: assignment of function ‘void glBlendEquation(GLenum)’
/GuntherDW/src/git/gzdoom/src/gl/system/gl_interface.cpp:156:44: error: cannot convert ‘PFNGLBLENDEQUATIONPROC {aka void (*)(unsigned int)}’ to ‘void(GLenum) {aka void(unsigned int)}’ in assignment
/GuntherDW/src/git/gzdoom/src/gl/system/gl_interface.cpp:158:7: warning: the address of ‘void glBlendEquation(GLenum)’ will always evaluate as ‘true’ [-Waddress]
/GuntherDW/src/git/gzdoom/src/gl/system/gl_interface.cpp:158:66: error: assignment of function ‘void glBlendEquation(GLenum)’
/GuntherDW/src/git/gzdoom/src/gl/system/gl_interface.cpp:158:66: error: cannot convert ‘PFNGLBLENDEQUATIONPROC {aka void (*)(unsigned int)}’ to ‘void(GLenum) {aka void(unsigned int)}’ in assignment
/GuntherDW/src/git/gzdoom/src/gl/system/gl_interface.cpp:160:7: warning: the address of ‘void glBlendEquation(GLenum)’ will always evaluate as ‘true’ [-Waddress]
/GuntherDW/src/git/gzdoom/src/gl/system/gl_interface.cpp:160:42: error: assignment of function ‘void glBlendEquation(GLenum)’
/GuntherDW/src/git/gzdoom/src/gl/system/gl_interface.cpp:160:42: error: cannot convert ‘void(GLenum) {aka void(unsigned int)}’ to ‘void(GLenum) {aka void(unsigned int)}’ in assignment
/GuntherDW/src/git/gzdoom/src/gl/system/gl_interface.cpp:322:44: error: assignment of function ‘void glActiveTexture(GLenum)’
/GuntherDW/src/git/gzdoom/src/gl/system/gl_interface.cpp:322:44: error: cannot convert ‘PFNGLACTIVETEXTUREPROC {aka void (*)(unsigned int)}’ to ‘void(GLenum) {aka void(unsigned int)}’ in assignment
/GuntherDW/src/git/gzdoom/src/gl/system/gl_interface.cpp:323:49: error: assignment of function ‘void glMultiTexCoord2f(GLenum, GLfloat, GLfloat)’
/GuntherDW/src/git/gzdoom/src/gl/system/gl_interface.cpp:323:49: error: cannot convert ‘PFNGLMULTITEXCOORD2FPROC {aka void (*)(unsigned int, float, float)}’ to ‘void(GLenum, GLfloat, GLfloat) {aka void(unsigned int, float, float)}’ in assignment
/GuntherDW/src/git/gzdoom/src/gl/system/gl_interface.cpp:324:51: error: assignment of function ‘void glMultiTexCoord2fv(GLenum, const GLfloat*)’
/GuntherDW/src/git/gzdoom/src/gl/system/gl_interface.cpp:324:51: error: cannot convert ‘PFNGLMULTITEXCOORD2FVPROC {aka void (*)(unsigned int, const float*)}’ to ‘void(GLenum, const GLfloat*) {aka void(unsigned int, const float*)}’ in assignment
make[2]: *** [src/CMakeFiles/zdoom.dir/gl/system/gl_interface.o] Error 1
make[1]: *** [src/CMakeFiles/zdoom.dir/all] Error 2
make: *** [all] Error 2
Code: Select all
gcc --version
gcc (Gentoo 4.7.3-r1 p1.3, pie-0.5.5) 4.7.3
x11-drivers/nvidia-drivers version 331.13
kernel 3.11.6 (Linux lisa 3.11.6-gentoo #1 SMP PREEMPT Mon Oct 21 21:06:42 CEST 2013 x86_64 AMD Phenom(tm) II X4 955 Processor AuthenticAMD GNU/Linux)
GPU : Nvidia GTX 470 (from ASUS)
I'm not so sure about the "PFNGLMULTITEXCOORD2FPROC" and "PFNGLMULTITEXCOORD2FVPROC" error yet though...[/spoiler]
Gah, I've been doing high(er) level languages for the last couple of years. I'm way too rusty in C

- Graf Zahl
- GZDoom Developer
- Posts: 7148
- Joined: Wed Jul 20, 2005 9:48
- Location: Germany
- Contact:
Re: GZDOOM GL init code cleanup (Linux testing needed)
Yeah, someone needs to fix it. I can't do it because I can't test it.