Opened 17 years ago

Closed 11 years ago

Last modified 11 years ago

#171 closed defect (fixed)

GL extension loading slightly incorrect on Linux

Reported by: Philip Taylor Owned by: ben
Priority: Nice to Have Milestone: Alpha 14
Component: Core engine Keywords: glext simple linux
Cc: Patch:

Description

ogl.cpp does:

	p##nameARB = NULL;
	if(oglHaveVersion(version))
		*(void**)&p##nameARB = SDL_GL_GetProcAddress(#nameCore);
	if(!p##nameARB) /* use the ARB name if the driver lied about what version it supports */
		*(void**)&p##nameARB = SDL_GL_GetProcAddress(#nameARB);

But glXGetProcAddress never returns NULL. In the case where "the driver lied about what version it supports", it will still return a non-NULL function pointer, which will crash when it is called, even if there would have been a valid function pointer when we used the ARB name.

(NVIDIA's OpenGL implementation is different, and does (when I test it) return NULL for functions that it doesn't have. But the xorg-x11 implementation only returns NULL for non-existent glX* functions or for names not starting with "gl", and it returns non-NULL for any arbitrary gl[^X]* name.)

Hopefully it doesn't actually matter for us, since ogl.cpp seems to be the only place where we're testing the NULLness of the function pointers, and since ogl.cpp should still work correctly as long as the driver reports its GL version correctly (which it should). So I don't think there's anything we should actually do, except be aware of the issue.

Change History (9)

comment:1 by Jan Wassenberg, 15 years ago

Keywords: glext simple added

comment:2 by Philip Taylor, 14 years ago

Milestone: ReleaseUnclassified

Milestone Release deleted

comment:3 by (none), 14 years ago

Milestone: Unclassified

Milestone Unclassified deleted

comment:4 by Andrew, 14 years ago

Milestone: Backlog

comment:5 by Adrián Chaves, 12 years ago

“So I don't think there's anything we should actually do, except be aware of the issue.”

Does that mean this issue can be closed?

comment:6 by Markus, 11 years ago

We could add a comment that for xorg/x11 it will never return NULL. So we can't catch the "lied about what version it supports". But this should not happen at all.

The game would then just crash at execution of the returned function. We should get a backtrace to something graphic related... if we get those, we should investigate ;)

Just looked into other games and they do it the same way...

comment:7 by Markus, 11 years ago

Keywords: linux added

comment:8 by ben, 11 years ago

Owner: set to ben
Resolution: fixed
Status: newclosed

In 13480:

Adds comment about xorg-x11's glXGetProcAddress not returning NULL for unsupported functions, closes #171

comment:9 by leper, 11 years ago

Milestone: BacklogAlpha 14
Note: See TracTickets for help on using tickets.