Fail in a friendly way (ie. not crash) if EXT_dsa isn't present

* Eventually I'll add a wrapper layer so that if EXT_dsa isn't present then
  it just gets emulated, but for now we require it to be present even if
  the captured program didn't use it.
This commit is contained in:
baldurk
2014-12-26 12:35:27 +00:00
parent 4647eee9f2
commit 23fd72b6ef
2 changed files with 68 additions and 0 deletions
+34
View File
@@ -302,6 +302,40 @@ ReplayCreateStatus GL_CreateReplayDevice(const char *logfile, IReplayDriver **dr
return eReplayCreate_APIInitFailed;
}
PFNGLGETINTEGERVPROC getInt = (PFNGLGETINTEGERVPROC)glXGetFuncProc((const GLubyte *)"glGetIntegerv");
PFNGLGETSTRINGIPROC getStr = (PFNGLGETSTRINGIPROC)glXGetFuncProc((const GLubyte *)"glGetStringi");
if(getInt == NULL || getStr == NULL)
{
RDCERR("Couldn't get glGetIntegerv (%p) or glGetStringi (%p) entry points", getInt, getStr);
return eReplayCreate_APIInitFailed;
}
else
{
// eventually we want to emulate EXT_dsa on replay if it isn't present, but for
// now we just require it.
bool found = false;
GLint numExts = 0;
getInt(eGL_NUM_EXTENSIONS, &numExts);
for(GLint i=0; i < numExts; i++)
{
const char *ext = (const char *)getStr(eGL_EXTENSIONS, (GLuint)i);
if(!strcmp(ext, "GL_EXT_direct_state_access"))
{
found = true;
break;
}
}
if(!found)
{
RDCERR("RenderDoc requires EXT_direct_state_access availability, and it is not reported. Try updating your drivers.");
return eReplayCreate_APIHardwareUnsupported;
}
}
WrappedOpenGL *gl = new WrappedOpenGL(logfile, GetRealFunctions());
gl->Initialise(initParams);
+34
View File
@@ -395,6 +395,40 @@ ReplayCreateStatus GL_CreateReplayDevice(const char *logfile, IReplayDriver **dr
return eReplayCreate_APIInitFailed;
}
PFNGLGETINTEGERVPROC getInt = (PFNGLGETINTEGERVPROC)GetProcAddress(lib, "glGetIntegerv");
PFNGLGETSTRINGIPROC getStr = (PFNGLGETSTRINGIPROC)wglGetProc("glGetStringi");
if(getInt == NULL || getStr == NULL)
{
RDCERR("Couldn't get glGetIntegerv (%p) or glGetStringi (%p) entry points", getInt, getStr);
return eReplayCreate_APIInitFailed;
}
else
{
// eventually we want to emulate EXT_dsa on replay if it isn't present, but for
// now we just require it.
bool found = false;
GLint numExts = 0;
getInt(eGL_NUM_EXTENSIONS, &numExts);
for(GLint i=0; i < numExts; i++)
{
const char *ext = (const char *)getStr(eGL_EXTENSIONS, (GLuint)i);
if(!strcmp(ext, "GL_EXT_direct_state_access"))
{
found = true;
break;
}
}
if(!found)
{
RDCERR("RenderDoc requires EXT_direct_state_access availability, and it is not reported. Try updating your drivers.");
return eReplayCreate_APIHardwareUnsupported;
}
}
WrappedOpenGL *gl = new WrappedOpenGL(logfile, GetRealFunctions());
gl->Initialise(initParams);