mirror of
https://github.com/mpv-player/mpv
synced 2025-01-18 04:51:52 +00:00
Also parse glX extension string, makes -vo gl:swapinterval work again on linux
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@17020 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
54aacf3e9a
commit
a1d62bbb62
@ -249,9 +249,13 @@ static void *setNull(const GLubyte *s) {
|
||||
/**
|
||||
* \brief find the function pointers of some useful OpenGL extensions
|
||||
* \param getProcAddress function to resolve function names, may be NULL
|
||||
* \param ext2 an extra extension string
|
||||
*/
|
||||
static void getFunctions(void *(*getProcAddress)(const GLubyte *)) {
|
||||
static void getFunctions(void *(*getProcAddress)(const GLubyte *),
|
||||
const char *ext2) {
|
||||
const char *extensions = glGetString(GL_EXTENSIONS);
|
||||
if (!extensions) extensions = "";
|
||||
if (!ext2) ext2 = "";
|
||||
if (!getProcAddress)
|
||||
getProcAddress = setNull;
|
||||
GenBuffers = getProcAddress("glGenBuffers");
|
||||
@ -324,7 +328,7 @@ static void getFunctions(void *(*getProcAddress)(const GLubyte *)) {
|
||||
ProgramEnvParameter4f = getProcAddress("glProgramEnvParameter4fARB");
|
||||
if (!ProgramEnvParameter4f)
|
||||
ProgramEnvParameter4f = getProcAddress("glProgramEnvParameter4fNV");
|
||||
if (!extensions || !strstr(extensions, "_swap_control"))
|
||||
if (!strstr(extensions, "_swap_control") && !strstr(ext2, "_swap_control"))
|
||||
SwapInterval = NULL;
|
||||
else {
|
||||
SwapInterval = getProcAddress("glXSwapInterval");
|
||||
@ -1003,7 +1007,7 @@ int setGlWindow(int *vinfo, HGLRC *context, HWND win)
|
||||
wglDeleteContext(*context);
|
||||
*context = new_context;
|
||||
*vinfo = new_vinfo;
|
||||
getFunctions(w32gpa);
|
||||
getFunctions(w32gpa, NULL);
|
||||
|
||||
// and inform that reinit is neccessary
|
||||
return SET_WINDOW_REINIT;
|
||||
@ -1117,6 +1121,7 @@ int setGlWindow(XVisualInfo **vinfo, GLXContext *context, Window win)
|
||||
}
|
||||
if (!keep_context) {
|
||||
void *(*getProcAddress)(const GLubyte *);
|
||||
const char *(*glXExtStr)(Display *, int);
|
||||
if (*context)
|
||||
glXDestroyContext(mDisplay, *context);
|
||||
*context = new_context;
|
||||
@ -1128,7 +1133,9 @@ int setGlWindow(XVisualInfo **vinfo, GLXContext *context, Window win)
|
||||
getProcAddress = getdladdr("glXGetProcAddressARB");
|
||||
if (!getProcAddress)
|
||||
getProcAddress = getdladdr;
|
||||
getFunctions(getProcAddress);
|
||||
glXExtStr = getdladdr("glXQueryExtensionsString");
|
||||
getFunctions(getProcAddress, !glXExtStr ? NULL :
|
||||
glXExtStr(mDisplay, DefaultScreen(mDisplay)));
|
||||
|
||||
// and inform that reinit is neccessary
|
||||
return SET_WINDOW_REINIT;
|
||||
|
Loading…
Reference in New Issue
Block a user