mirror of https://github.com/PCSX2/pcsx2.git
zzogl: restore the opengl3 method for fill extension, fallback to the old method if not supported
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4194 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
bdc4e2caf4
commit
b9948d67c7
|
@ -374,60 +374,60 @@ inline bool CreateOpenShadersFile()
|
|||
// Read all extensions name and fill mapGLExtensions
|
||||
inline bool CreateFillExtensionsMap()
|
||||
{
|
||||
int max_ext = 0;
|
||||
string all_ext("");
|
||||
|
||||
// This seems to cause crashes on some systems, so I'm temporarily reverting to the old version.
|
||||
#if 0
|
||||
string temp("");
|
||||
int max_ext = 0;
|
||||
glGetIntegerv(GL_NUM_EXTENSIONS, &max_ext);
|
||||
|
||||
PFNGLGETSTRINGIPROC glGetStringi = 0;
|
||||
glGetStringi = (PFNGLGETSTRINGIPROC)wglGetProcAddress("glGetStringi");
|
||||
for (GLint i = 0; i < max_ext; i++)
|
||||
{
|
||||
string extension((const char*)glGetStringi(GL_EXTENSIONS, i));
|
||||
mapGLExtensions[extension];
|
||||
|
||||
temp = temp + extension;
|
||||
if (i != (max_ext - 1)) temp += ", ";
|
||||
}
|
||||
|
||||
// Write the extension list to the log, but only write it to the screen on a debug build.
|
||||
|
||||
if (glGetStringi) {
|
||||
// Get opengl extension (opengl3)
|
||||
glGetIntegerv(GL_NUM_EXTENSIONS, &max_ext);
|
||||
for (GLint i = 0; i < max_ext; i++)
|
||||
{
|
||||
string extension((const char*)glGetStringi(GL_EXTENSIONS, i));
|
||||
mapGLExtensions[extension];
|
||||
|
||||
all_ext += extension;
|
||||
if (i != (max_ext - 1)) all_ext += ", ";
|
||||
}
|
||||
} else {
|
||||
// fallback to old method (pre opengl3, intel gma ...)
|
||||
ZZLog::Error_Log("glGetStringi opengl 3 interface not supported, fallback to opengl 2");
|
||||
|
||||
const char* ptoken = (const char*)glGetString(GL_EXTENSIONS);
|
||||
|
||||
if (ptoken == NULL) return false;
|
||||
|
||||
const char* pend = NULL;
|
||||
while (ptoken != NULL)
|
||||
{
|
||||
pend = strchr(ptoken, ' ');
|
||||
|
||||
if (pend != NULL)
|
||||
{
|
||||
max_ext++;
|
||||
mapGLExtensions[string(ptoken, pend-ptoken)];
|
||||
}
|
||||
else
|
||||
{
|
||||
max_ext++;
|
||||
mapGLExtensions[string(ptoken)];
|
||||
break;
|
||||
}
|
||||
|
||||
ptoken = pend;
|
||||
while (*ptoken == ' ') ++ptoken;
|
||||
}
|
||||
all_ext = string(ptoken);
|
||||
}
|
||||
|
||||
|
||||
#ifndef _DEBUG
|
||||
ZZLog::Log("%d supported OpenGL Extensions: %s\n", max_ext, temp.c_str());
|
||||
ZZLog::Log("%d supported OpenGL Extensions: %s\n", max_ext, all_ext.c_str());
|
||||
#endif
|
||||
ZZLog::Debug_Log("%d supported OpenGL Extensions: %s\n", max_ext, temp.c_str());
|
||||
ZZLog::Debug_Log("%d supported OpenGL Extensions: %s\n", max_ext, all_ext.c_str());
|
||||
|
||||
#else
|
||||
const char* ptoken = (const char*)glGetString(GL_EXTENSIONS);
|
||||
|
||||
#ifndef _DEBUG
|
||||
ZZLog::Log("Supported OpenGL Extensions: %s\n", ptoken);
|
||||
#endif
|
||||
ZZLog::Debug_Log("Supported OpenGL Extensions:\n%s\n", ptoken);
|
||||
|
||||
if (ptoken == NULL) return false;
|
||||
|
||||
const char* pend = NULL;
|
||||
while (ptoken != NULL)
|
||||
{
|
||||
pend = strchr(ptoken, ' ');
|
||||
|
||||
if (pend != NULL)
|
||||
{
|
||||
mapGLExtensions[string(ptoken, pend-ptoken)];
|
||||
}
|
||||
else
|
||||
{
|
||||
mapGLExtensions[string(ptoken)];
|
||||
break;
|
||||
}
|
||||
|
||||
ptoken = pend;
|
||||
while (*ptoken == ' ') ++ptoken;
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue