Bug 596544 - These WebGL samples are slow on Firefox, fast on Chrome - r=vladimir, a=joe

This commit is contained in:
Benoit Jacob 2010-09-20 13:19:30 -04:00
Родитель e003bfb674
Коммит 131b175130
2 изменённых файлов: 16 добавлений и 2 удалений

Просмотреть файл

@ -98,6 +98,7 @@ GLXLibrary::EnsureInitialized()
{ (PRFuncPtr*) &xDestroyPixmap, { "glXDestroyPixmap", NULL } },
{ (PRFuncPtr*) &xGetClientString, { "glXGetClientString", NULL } },
{ (PRFuncPtr*) &xCreateContext, { "glXCreateContext", NULL } },
{ (PRFuncPtr*) &xGetCurrentContext, { "glXGetCurrentContext", NULL } },
{ NULL, { NULL } }
};
@ -254,8 +255,19 @@ TRY_AGAIN_NO_SHARING:
PRBool MakeCurrent(PRBool aForce = PR_FALSE)
{
Bool succeeded = sGLXLibrary.xMakeCurrent(mDisplay, mDrawable, mContext);
NS_ASSERTION(succeeded, "Failed to make GL context current!");
PRBool succeeded = PR_TRUE;
// With the ATI FGLRX driver, glxMakeCurrent is very slow even when the context doesn't change.
// (This is not the case with other drivers such as NVIDIA).
// So avoid calling it more than necessary. Since GLX documentation says that:
// "glXGetCurrentContext returns client-side information.
// It does not make a round trip to the server."
// I assume that it's not worth using our own TLS slot here.
if (aForce || sGLXLibrary.xGetCurrentContext() != mContext) {
succeeded = sGLXLibrary.xMakeCurrent(mDisplay, mDrawable, mContext);
NS_ASSERTION(succeeded, "Failed to make GL context current!");
}
return succeeded;
}

Просмотреть файл

@ -54,6 +54,8 @@ public:
GLXDrawable,
GLXContext);
PFNGLXMAKECURRENTPROC xMakeCurrent;
typedef GLXContext (GLAPIENTRY * PFNGLXGETCURRENTCONTEXT) ();
PFNGLXGETCURRENTCONTEXT xGetCurrentContext;
typedef void* (GLAPIENTRY * PFNGLXGETPROCADDRESSPROC) (const char *);
PFNGLXGETPROCADDRESSPROC xGetProcAddress;
typedef XVisualInfo* (GLAPIENTRY * PFNGLXCHOOSEVISUALPROC) (Display*,