In case drawbuffers is set to GL_BACK, just set to COLOR_ATTACHMENT0

* This is invalid since we are talking about real FBOs, not the default
  FBO, but it might come up in compatibility context programs and it's
  harmless to correct to try and replay correctly.
This commit is contained in:
baldurk
2014-12-30 23:56:10 +00:00
parent 6c635e3157
commit d75b62c072
+6 -1
View File
@@ -1336,9 +1336,14 @@ void GLResourceManager::Apply_InitialState(GLResource live, InitialContentData i
FramebufferInitialData *data = (FramebufferInitialData *)initial.blob;
// set invalid caps to GL_COLOR_ATTACHMENT0
for(int i=0; i < (int)ARRAY_COUNT(data->DrawBuffers); i++)
gl.glDrawBuffers(ARRAY_COUNT(data->DrawBuffers), data->DrawBuffers);
if(data->DrawBuffers[i] == eGL_BACK || data->DrawBuffers[i] == eGL_FRONT)
data->DrawBuffers[i] = eGL_COLOR_ATTACHMENT0;
if(data->ReadBuffer == eGL_BACK || data->ReadBuffer == eGL_FRONT) data->ReadBuffer = eGL_COLOR_ATTACHMENT0;
gl.glDrawBuffers(ARRAY_COUNT(data->DrawBuffers), data->DrawBuffers);
gl.glReadBuffer(data->ReadBuffer);
gl.glBindFramebuffer(eGL_DRAW_FRAMEBUFFER, prevdraw);