Bug 711226: separate desktop and ES 2.0 symbol loading r=bjacob

Symbols were amalgamated into a single table which worked up until recently.
This patch separates them so that there is a common list, then two separate ones
for desktop and OpenGL ES 2.0.
This commit is contained in:
Doug Sherk 2011-12-16 13:12:00 -08:00
parent 573bfdbe9c
commit 4efd23d3cd

View File

@ -344,26 +344,43 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
{ (PRFuncPtr*) &mSymbols.fDeleteFramebuffers, { "DeleteFramebuffers", "DeleteFramebuffersEXT", NULL } },
{ (PRFuncPtr*) &mSymbols.fDeleteRenderbuffers, { "DeleteRenderbuffers", "DeleteRenderbuffersEXT", NULL } },
{ mIsGLES2 ? (PRFuncPtr*) &mSymbols.fClearDepthf : (PRFuncPtr*) &mSymbols.fClearDepth,
{ mIsGLES2 ? "ClearDepthf" : "ClearDepth", NULL } },
{ mIsGLES2 ? (PRFuncPtr*) &mSymbols.fDepthRangef : (PRFuncPtr*) &mSymbols.fDepthRange,
{ mIsGLES2 ? "DepthRangef" : "DepthRange", NULL } },
// XXX FIXME -- we shouldn't be using glReadBuffer!
{ mIsGLES2 ? (PRFuncPtr*) NULL : (PRFuncPtr*) &mSymbols.fReadBuffer,
{ mIsGLES2 ? NULL : "ReadBuffer", NULL } },
{ mIsGLES2 ? (PRFuncPtr*) NULL : (PRFuncPtr*) &mSymbols.fMapBuffer,
{ mIsGLES2 ? NULL : "MapBuffer", NULL } },
{ mIsGLES2 ? (PRFuncPtr*) NULL : (PRFuncPtr*) &mSymbols.fUnmapBuffer,
{ mIsGLES2 ? NULL : "UnmapBuffer", NULL } },
{ NULL, { NULL } },
};
mInitialized = LoadSymbols(&symbols[0], trygl, prefix);
// Load OpenGL ES 2.0 symbols, or desktop if we aren't using ES 2.
if (mInitialized) {
if (mIsGLES2) {
SymLoadStruct symbols_ES2[] = {
{ (PRFuncPtr*) &mSymbols.fGetShaderPrecisionFormat, { "GetShaderPrecisionFormat", NULL } },
{ (PRFuncPtr*) &mSymbols.fClearDepthf, { "ClearDepthf", NULL } },
{ (PRFuncPtr*) &mSymbols.fDepthRangef, { "DepthRangef", NULL } },
{ NULL, { NULL } },
};
if (!LoadSymbols(&symbols_ES2[0], trygl, prefix)) {
NS_RUNTIMEABORT("OpenGL ES 2.0 supported, but symbols could not be loaded.");
mInitialized = false;
}
} else {
SymLoadStruct symbols_desktop[] = {
{ (PRFuncPtr*) &mSymbols.fClearDepth, { "ClearDepth", NULL } },
{ (PRFuncPtr*) &mSymbols.fDepthRange, { "DepthRange", NULL } },
{ (PRFuncPtr*) &mSymbols.fReadBuffer, { "ReadBuffer", NULL } },
{ (PRFuncPtr*) &mSymbols.fMapBuffer, { "MapBuffer", NULL } },
{ (PRFuncPtr*) &mSymbols.fUnmapBuffer, { "UnmapBuffer", NULL } },
{ NULL, { NULL } },
};
if (!LoadSymbols(&symbols_desktop[0], trygl, prefix)) {
NS_RUNTIMEABORT("Desktop symbols failed to load.");
mInitialized = false;
}
}
}
const char *glVendorString;
if (mInitialized) {
@ -404,18 +421,6 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
}
#endif
// Specially load this in because it's placed in a bizarre position in
// the ES2 symbol table (between shaderInfoLog and shaderSource).
SymLoadStruct symbols_shaderPrecisionFormat[] = {
{ (PRFuncPtr*) &mSymbols.fGetShaderPrecisionFormat, { "GetShaderPrecisionFormat", NULL } },
{ NULL, { NULL } },
};
if (mIsGLES2 && !LoadSymbols(&symbols_shaderPrecisionFormat[0], trygl, prefix)) {
NS_RUNTIMEABORT("OpenGL ES 2.0 supported, but has no GetShaderPrecisionFormat symbol.");
mInitialized = false;
}
InitExtensions();
NS_ASSERTION(!IsExtensionSupported(GLContext::ARB_pixel_buffer_object) ||