mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-09-23 22:25:55 +00:00
Ensure context pair is set up before creating per-context objects
* Without this, client-memory IBs/VBs will not have the correct context sharegroup set.
This commit is contained in:
@@ -919,7 +919,7 @@ void WrappedOpenGL::ContextData::AssociateWindow(WrappedOpenGL *gl, void *wndHan
|
||||
|
||||
void WrappedOpenGL::ContextData::CreateResourceRecord(WrappedOpenGL *gl, void *suppliedCtx)
|
||||
{
|
||||
if(m_ContextDataResourceID == ResourceId::Null() ||
|
||||
if(m_ContextDataResourceID == ResourceId() ||
|
||||
!gl->GetResourceManager()->HasResourceRecord(m_ContextDataResourceID))
|
||||
{
|
||||
m_ContextDataResourceID = gl->GetResourceManager()->RegisterResource(
|
||||
@@ -1070,6 +1070,27 @@ void WrappedOpenGL::ActivateContext(GLWindowingData winData)
|
||||
|
||||
ContextData &ctxdata = m_ContextData[winData.ctx];
|
||||
|
||||
ctxdata.CreateResourceRecord(this, winData.ctx);
|
||||
|
||||
// update thread-local context pair
|
||||
{
|
||||
GLContextTLSData *tlsData = (GLContextTLSData *)Threading::GetTLSValue(m_CurCtxDataTLS);
|
||||
|
||||
if(tlsData)
|
||||
{
|
||||
tlsData->ctxPair = {winData.ctx, ShareCtx(winData.ctx)};
|
||||
tlsData->ctxRecord = ctxdata.m_ContextDataRecord;
|
||||
}
|
||||
else
|
||||
{
|
||||
tlsData = new GLContextTLSData(ContextPair({winData.ctx, ShareCtx(winData.ctx)}),
|
||||
ctxdata.m_ContextDataRecord);
|
||||
m_CtxDataVector.push_back(tlsData);
|
||||
|
||||
Threading::SetTLSValue(m_CurCtxDataTLS, tlsData);
|
||||
}
|
||||
}
|
||||
|
||||
if(!ctxdata.built)
|
||||
{
|
||||
ctxdata.built = true;
|
||||
@@ -1258,27 +1279,6 @@ void WrappedOpenGL::ActivateContext(GLWindowingData winData)
|
||||
}
|
||||
}
|
||||
|
||||
ctxdata.CreateResourceRecord(this, winData.ctx);
|
||||
|
||||
// update thread-local context pair
|
||||
{
|
||||
GLContextTLSData *tlsData = (GLContextTLSData *)Threading::GetTLSValue(m_CurCtxDataTLS);
|
||||
|
||||
if(tlsData)
|
||||
{
|
||||
tlsData->ctxPair = {winData.ctx, ShareCtx(winData.ctx)};
|
||||
tlsData->ctxRecord = ctxdata.m_ContextDataRecord;
|
||||
}
|
||||
else
|
||||
{
|
||||
tlsData = new GLContextTLSData(ContextPair({winData.ctx, ShareCtx(winData.ctx)}),
|
||||
ctxdata.m_ContextDataRecord);
|
||||
m_CtxDataVector.push_back(tlsData);
|
||||
|
||||
Threading::SetTLSValue(m_CurCtxDataTLS, tlsData);
|
||||
}
|
||||
}
|
||||
|
||||
// this is hack but GL context creation is an *utter mess*. For first-frame captures, only
|
||||
// consider an attribs created context, to avoid starting capturing when the user is creating
|
||||
// dummy contexts to be able to create the real one.
|
||||
|
||||
Reference in New Issue
Block a user