mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-09-27 16:15:49 +00:00
Don't switch to GL context to fetch VAO/FBO if it's NULL!
* If the 'context shared' VAOs/FBOs hack is on, their context is set to NULL (so any context will match the resource), but this also means we shouldn't try and bind that context to fetch data.
This commit is contained in:
@@ -427,7 +427,10 @@ bool GLResourceManager::Prepare_InitialState(GLResource res)
|
||||
else if(res.Namespace == eResFramebuffer)
|
||||
{
|
||||
// need to be on the right context, as feedback objects are never shared
|
||||
void *oldctx = m_GL->SwitchToContext(res.Context);
|
||||
void *oldctx = NULL;
|
||||
|
||||
if(!VendorCheck[VendorCheck_EXT_fbo_shared])
|
||||
oldctx = m_GL->SwitchToContext(res.Context);
|
||||
|
||||
GLuint prevread = 0, prevdraw = 0;
|
||||
gl.glGetIntegerv(eGL_DRAW_FRAMEBUFFER_BINDING, (GLint *)&prevdraw);
|
||||
@@ -450,7 +453,8 @@ bool GLResourceManager::Prepare_InitialState(GLResource res)
|
||||
gl.glBindFramebuffer(eGL_READ_FRAMEBUFFER, prevread);
|
||||
|
||||
// restore the previous context
|
||||
m_GL->SwitchToContext(oldctx);
|
||||
if(!VendorCheck[VendorCheck_EXT_fbo_shared])
|
||||
m_GL->SwitchToContext(oldctx);
|
||||
}
|
||||
else if(res.Namespace == eResFeedback)
|
||||
{
|
||||
@@ -486,7 +490,10 @@ bool GLResourceManager::Prepare_InitialState(GLResource res)
|
||||
else if(res.Namespace == eResVertexArray)
|
||||
{
|
||||
// need to be on the right context, as VAOs are never shared
|
||||
void *oldctx = m_GL->SwitchToContext(res.Context);
|
||||
void *oldctx = NULL;
|
||||
|
||||
if(!VendorCheck[VendorCheck_EXT_vao_shared])
|
||||
oldctx = m_GL->SwitchToContext(res.Context);
|
||||
|
||||
GLuint prevVAO = 0;
|
||||
gl.glGetIntegerv(eGL_VERTEX_ARRAY_BINDING, (GLint *)&prevVAO);
|
||||
@@ -524,7 +531,8 @@ bool GLResourceManager::Prepare_InitialState(GLResource res)
|
||||
gl.glBindVertexArray(prevVAO);
|
||||
|
||||
// restore the previous context
|
||||
m_GL->SwitchToContext(oldctx);
|
||||
if(!VendorCheck[VendorCheck_EXT_vao_shared])
|
||||
m_GL->SwitchToContext(oldctx);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user