Fix scarily broken iteration of GL context creation attribs list.

This commit is contained in:
baldurk
2016-04-02 16:26:08 +02:00
parent ba70a31557
commit a3325fbcff
2 changed files with 8 additions and 22 deletions
+4 -11
View File
@@ -636,17 +636,15 @@ GLXContext glXCreateContextAttribsARB(Display *dpy, GLXFBConfig config, GLXConte
// modify attribs to our liking
{
bool flagsNext = false;
bool flagsFound = false;
const int *a = attribs;
while(*a)
{
int val = *a;
int name = *a++;
int val = *a++;
if(flagsNext)
if(name == GLX_CONTEXT_FLAGS_ARB)
{
flagsNext = false;
if(RenderDoc::Inst().GetCaptureOptions().DebugDeviceMode)
val |= GLX_CONTEXT_DEBUG_BIT_ARB;
else
@@ -654,17 +652,12 @@ GLXContext glXCreateContextAttribsARB(Display *dpy, GLXFBConfig config, GLXConte
// remove NO_ERROR bit
val &= ~GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR;
}
if(val == GLX_CONTEXT_FLAGS_ARB)
{
flagsNext = true;
flagsFound = true;
}
attribVec.push_back(name);
attribVec.push_back(val);
a++;
}
if(!flagsFound && RenderDoc::Inst().GetCaptureOptions().DebugDeviceMode)
+4 -11
View File
@@ -463,17 +463,15 @@ class OpenGLHook : LibraryHook
// modify attribs to our liking
{
bool flagsNext = false;
bool flagsFound = false;
const int *a = attribs;
while(*a)
{
int val = *a;
int name = *a++;
int val = *a++;
if(flagsNext)
if(name == WGL_CONTEXT_FLAGS_ARB)
{
flagsNext = false;
if(RenderDoc::Inst().GetCaptureOptions().DebugDeviceMode)
val |= WGL_CONTEXT_DEBUG_BIT_ARB;
else
@@ -481,17 +479,12 @@ class OpenGLHook : LibraryHook
// remove NO_ERROR bit
val &= ~GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR;
}
if(val == WGL_CONTEXT_FLAGS_ARB)
{
flagsNext = true;
flagsFound = true;
}
attribVec.push_back(name);
attribVec.push_back(val);
a++;
}
if(!flagsFound && RenderDoc::Inst().GetCaptureOptions().DebugDeviceMode)