glShaderSource crashes a program when under Wine

Questions about Wine on Linux
Locked
midn
Newbie
Newbie
Posts: 3
Joined: Fri Jun 21, 2019 5:15 am

glShaderSource crashes a program when under Wine

Post by midn »

When running my game under Wine, it crashes and produces this backtrace:

Code: Select all

Backtrace:
=>0 0xf7c80179 __deregister_frame_info_bases+0xbc89() in libc.so.6 (0x01b2fc60)
  1 0x79f5599b __driDriverGetExtensions_nouveau_vieux+0xb2c2a() in i965_dri.so (0x01b2fc60)
  2 0x7a885a4e glAccum+0xffffffff() in opengl32 (0x01b2fc48)
  3 0x004265d8 _ZN4game13create_shaderEjPKc+0x47(type=0x8b31, src="HIDDEN SHADER SOURCE") [src/engine/engine.cpp:327] in light (0x01b2fc78)
  4 0x00425be0 main+0x1d7(argc=0x1b2fec8, argv=0x401363) [src/engine/engine.cpp:94] in light (0x01b2fe28)
  5 0x00401363 _ZN11VideoPlayerC2Ev+0xffffffff() in light (0x01b2fec8)
  6 0x7b47f982 call_process_entry+0x11() in kernel32 (0x01b2fee8)
  7 0x7b482242 ExitProcess+0x28b1() in kernel32 (0x01b2ffd8)
  8 0x7b47f98e call_process_entry+0x1d() in kernel32 (0x01b2ffec)
There are a few weird things here. Firstly, `src/engine/engine.cpp:327` holds a function call to `glShaderSource`, while Wine says that `glAccum` was called. `glAccum` is not referenced anywhere in the game engine's source (as of now).

Secondly, Wine's backtrace also seems to say that `main` was called by the constructor of `VideoPlayer`, which is completely wrong. It doesn't even show the supposed line number.

Thirdly, here is the supposed culprit:

Code: Select all

GLint length = strlen(src);

GLuint shadr = glCreateShader(type);
glShaderSource(shadr, 1, &src, &length); // Here is line 327.
glCompileShader(shadr);
Replacing the fourth argument to `glShaderSource` with `nullptr` only causes another crash, in Wine *and* natively under Linux (my video driver is i965_dri.so, and it's buggier than the drivers for my 2008 laptop's 4500MHD chip). I can confidently say that `src` is not a dangling pointer, knowing as the Wine backtrace found it.

I got the address to glShaderSource via this function, which is a direct copy-paste of a code snippet on the Khronos wiki, so it should have no problems:

Code: Select all

void(*cif_gl_getproc(const char *proc))() {
	PROC ret = wglGetProcAddress(proc);
	if(ret <= ((PROC*) 3) || ret == ((PROC*) -1)) {
		ret = GetProcAddress(glModule, proc);
	}
	
	return ret;
}
I really hope it's a dumb mistake :? .
midn
Newbie
Newbie
Posts: 3
Joined: Fri Jun 21, 2019 5:15 am

Re: glShaderSource crashes a program when under Wine

Post by midn »

No information? This seems like a Wine bug. Has the MinGW cross compiler ever been shown to be buggy with Wine? I doubt that's it, though.
Locked