Fix wrong API being used for cloned child GL contexts

This commit is contained in:
baldurk
2022-08-01 20:38:02 +01:00
parent b1b17efb9c
commit 50919f5cfa
7 changed files with 16 additions and 4 deletions
+1
View File
@@ -213,6 +213,7 @@ class CGLPlatform : public GLPlatform
return ret;
}
void SetDriverType(RDCDriver api) {}
RDResult InitialiseAPI(GLWindowingData &replayContext, RDCDriver api, bool debug)
{
RDCASSERT(api == RDCDriver::OpenGL);
+1
View File
@@ -371,6 +371,7 @@ class EGLPlatform : public GLPlatform
}
bool PopulateForReplay() { return EGL.PopulateForReplay(); }
void SetDriverType(RDCDriver api) { m_API = api; }
RDResult InitialiseAPI(GLWindowingData &replayContext, RDCDriver api, bool debug)
{
Display *xlibDisplay = RenderDoc::Inst().GetGlobalEnvironment().xlibDisplay;
+2
View File
@@ -324,6 +324,7 @@ struct GLPlatform
virtual bool CanCreateGLContext() = 0;
virtual bool CanCreateGLESContext() = 0;
virtual bool PopulateForReplay() = 0;
virtual void SetDriverType(RDCDriver api) = 0;
virtual RDResult InitialiseAPI(GLWindowingData &replayContext, RDCDriver api, bool debug) = 0;
virtual void *GetReplayFunction(const char *funcname) = 0;
};
@@ -349,6 +350,7 @@ class GLDummyPlatform : public GLPlatform
virtual bool CanCreateGLContext() { return true; }
virtual bool CanCreateGLESContext() { return true; }
virtual bool PopulateForReplay() { return true; }
virtual void SetDriverType(RDCDriver api) {}
virtual RDResult InitialiseAPI(GLWindowingData &replayContext, RDCDriver api, bool debug)
{
return ResultCode::Succeeded;
+7 -1
View File
@@ -613,7 +613,7 @@ WrappedOpenGL::WrappedOpenGL(GLPlatform &platform)
BuildGLExtensions();
BuildGLESExtensions();
// by default we assume OpenGL driver
SetDriverType(RDCDriver::OpenGL);
m_DriverType = RDCDriver::OpenGL;
m_Replay = new GLReplay(this);
@@ -978,6 +978,12 @@ WrappedOpenGL::~WrappedOpenGL()
delete m_Replay;
}
void WrappedOpenGL::SetDriverType(RDCDriver type)
{
m_DriverType = type;
m_Platform.SetDriverType(m_DriverType);
}
ContextPair &WrappedOpenGL::GetCtx()
{
GLContextTLSData *ret = (GLContextTLSData *)Threading::GetTLSValue(m_CurCtxDataTLS);
+1 -1
View File
@@ -623,7 +623,7 @@ public:
CaptureState GetState() { return m_State; }
GLReplay *GetReplay() { return m_Replay; }
WriteSerialiser &GetSerialiser() { return m_ScratchSerialiser; }
void SetDriverType(RDCDriver type) { m_DriverType = type; }
void SetDriverType(RDCDriver type);
bool isGLESMode() { return m_DriverType == RDCDriver::OpenGLES; }
RDCDriver GetDriverType() { return m_DriverType; }
ContextPair &GetCtx();
+2 -1
View File
@@ -50,7 +50,7 @@ void *GetGLHandle()
class GLXPlatform : public GLPlatform
{
RDCDriver m_API = RDCDriver::OpenGLES;
RDCDriver m_API = RDCDriver::OpenGL;
bool MakeContextCurrent(GLWindowingData data)
{
@@ -336,6 +336,7 @@ class GLXPlatform : public GLPlatform
}
bool PopulateForReplay() { return GLX.PopulateForReplay(); }
void SetDriverType(RDCDriver api) { m_API = api; }
RDResult InitialiseAPI(GLWindowingData &replayContext, RDCDriver api, bool debug)
{
// force debug in development builds
+2 -1
View File
@@ -29,7 +29,7 @@
class WGLPlatform : public GLPlatform
{
RDCDriver m_API = RDCDriver::OpenGLES;
RDCDriver m_API = RDCDriver::OpenGL;
bool MakeContextCurrent(GLWindowingData data)
{
@@ -371,6 +371,7 @@ class WGLPlatform : public GLPlatform
}
bool PopulateForReplay() { return WGL.PopulateForReplay(); }
void SetDriverType(RDCDriver api) { m_API = api; }
RDResult InitialiseAPI(GLWindowingData &replayContext, RDCDriver api, bool debug)
{
// force debug in development builds