зеркало из https://github.com/mozilla/gecko-dev.git
b=517559; remove runtime (startup) dependency on opengl32.dll, to fix Ts; r=mwsteele
This commit is contained in:
Родитель
d023bfc631
Коммит
c22b30a65c
|
@ -55,9 +55,20 @@ class WGLWrap
|
|||
public:
|
||||
WGLWrap() : fCreatePbuffer(0) { }
|
||||
|
||||
bool InitEarly();
|
||||
bool Init();
|
||||
|
||||
public:
|
||||
// early init
|
||||
typedef HANDLE (WINAPI * PFNWGLCREATECONTEXTPROC) (HDC hDC);
|
||||
PFNWGLCREATECONTEXTPROC fCreateContext;
|
||||
typedef BOOL (WINAPI * PFNWGLMAKECURRENTPROC) (HDC hDC, HANDLE hglrc);
|
||||
PFNWGLMAKECURRENTPROC fMakeCurrent;
|
||||
typedef PROC (WINAPI * PFNWGLGETPROCADDRESSPROC) (LPCSTR proc);
|
||||
PFNWGLGETPROCADDRESSPROC fGetProcAddress;
|
||||
typedef BOOL (WINAPI * PFNWGLDELETECONTEXTPROC) (HANDLE hglrc);
|
||||
PFNWGLDELETECONTEXTPROC fDeleteContext;
|
||||
|
||||
typedef HANDLE (WINAPI * PFNWGLCREATEPBUFFERPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int* piAttribList);
|
||||
PFNWGLCREATEPBUFFERPROC fCreatePbuffer;
|
||||
typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFERPROC) (HANDLE hPbuffer);
|
||||
|
@ -71,6 +82,23 @@ public:
|
|||
PFNWGLGETPIXELFORMATATTRIBIVPROC fGetPixelFormatAttribiv;
|
||||
};
|
||||
|
||||
bool
|
||||
WGLWrap::InitEarly()
|
||||
{
|
||||
if (fCreateContext)
|
||||
return true;
|
||||
|
||||
SymLoadStruct symbols[] = {
|
||||
{ (PRFuncPtr*) &fCreateContext, { "wglCreateContext", NULL } },
|
||||
{ (PRFuncPtr*) &fMakeCurrent, { "wglMakeCurrent", NULL } },
|
||||
{ (PRFuncPtr*) &fGetProcAddress, { "wglGetProcAddress", NULL } },
|
||||
{ (PRFuncPtr*) &fDeleteContext, { "wglDeleteContext", NULL } },
|
||||
{ NULL, { NULL } }
|
||||
};
|
||||
|
||||
return LoadSymbols(&symbols[0], false);
|
||||
}
|
||||
|
||||
bool
|
||||
WGLWrap::Init()
|
||||
{
|
||||
|
@ -108,7 +136,10 @@ nsGLPbufferWGL::Init(WebGLContext *priv)
|
|||
if (!gWGLWrap.OpenLibrary(opengl32))
|
||||
return PR_FALSE;
|
||||
|
||||
gWGLWrap.SetLookupFunc((LibrarySymbolLoader::PlatformLookupFunction) wglGetProcAddress);
|
||||
if (!gWGLWrap.InitEarly())
|
||||
return PR_FALSE;
|
||||
|
||||
gWGLWrap.SetLookupFunc((LibrarySymbolLoader::PlatformLookupFunction) gWGLWrap.fGetProcAddress);
|
||||
|
||||
mPriv = priv;
|
||||
|
||||
|
@ -156,13 +187,13 @@ nsGLPbufferWGL::Init(WebGLContext *priv)
|
|||
}
|
||||
|
||||
// create rendering context
|
||||
mGlewWglContext = wglCreateContext(mGlewDC);
|
||||
mGlewWglContext = gWGLWrap.fCreateContext(mGlewDC);
|
||||
if (!mGlewWglContext) {
|
||||
LogMessage("Canvas 3D: wglCreateContext failed");
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
if (!wglMakeCurrent(mGlewDC, (HGLRC) mGlewWglContext)) {
|
||||
if (!gWGLWrap.fMakeCurrent(mGlewDC, (HGLRC) mGlewWglContext)) {
|
||||
LogMessage("Canvas 3D: wglMakeCurrent failed");
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
@ -178,7 +209,7 @@ nsGLPbufferWGL::Init(WebGLContext *priv)
|
|||
return PR_FALSE;
|
||||
}
|
||||
|
||||
mGLWrap.SetLookupFunc((LibrarySymbolLoader::PlatformLookupFunction) wglGetProcAddress);
|
||||
mGLWrap.SetLookupFunc((LibrarySymbolLoader::PlatformLookupFunction) gWGLWrap.fGetProcAddress);
|
||||
|
||||
if (!mGLWrap.Init(GLES20Wrap::TRY_NATIVE_GL)) {
|
||||
LogMessage("Canvas 3D: GLWrap init failed");
|
||||
|
@ -224,7 +255,7 @@ nsGLPbufferWGL::Resize(PRInt32 width, PRInt32 height)
|
|||
0,
|
||||
height * mThebesSurface->Stride());
|
||||
|
||||
if (!wglMakeCurrent(mGlewDC, (HGLRC) mGlewWglContext)) {
|
||||
if (!gWGLWrap.fMakeCurrent(mGlewDC, (HGLRC) mGlewWglContext)) {
|
||||
fprintf (stderr, "Error: %d\n", GetLastError());
|
||||
LogMessage("Canvas 3D: wglMakeCurrent failed");
|
||||
return PR_FALSE;
|
||||
|
@ -350,7 +381,7 @@ TRY_FIND_AGAIN:
|
|||
}
|
||||
|
||||
mPbufferDC = gWGLWrap.fGetPbufferDC(mPbuffer);
|
||||
mPbufferContext = wglCreateContext(mPbufferDC);
|
||||
mPbufferContext = gWGLWrap.fCreateContext(mPbufferDC);
|
||||
|
||||
mWindowsSurface = new gfxWindowsSurface(gfxIntSize(width, height), gfxASurface::ImageFormatARGB32);
|
||||
if (mWindowsSurface && mWindowsSurface->CairoStatus() == 0)
|
||||
|
@ -370,7 +401,7 @@ nsGLPbufferWGL::Destroy()
|
|||
mThebesSurface = nsnull;
|
||||
|
||||
if (mPbuffer) {
|
||||
wglDeleteContext((HGLRC) mPbufferContext);
|
||||
gWGLWrap.fDeleteContext((HGLRC) mPbufferContext);
|
||||
gWGLWrap.fDestroyPbuffer(mPbuffer);
|
||||
mPbuffer = nsnull;
|
||||
}
|
||||
|
@ -381,7 +412,7 @@ nsGLPbufferWGL::~nsGLPbufferWGL()
|
|||
Destroy();
|
||||
|
||||
if (mGlewWglContext) {
|
||||
wglDeleteContext((HGLRC) mGlewWglContext);
|
||||
gWGLWrap.fDeleteContext((HGLRC) mGlewWglContext);
|
||||
mGlewWglContext = nsnull;
|
||||
}
|
||||
|
||||
|
@ -401,7 +432,7 @@ nsGLPbufferWGL::MakeContextCurrent()
|
|||
if (sCurrentContextToken == mPbufferContext)
|
||||
return;
|
||||
|
||||
wglMakeCurrent (mPbufferDC, (HGLRC) mPbufferContext);
|
||||
gWGLWrap.fMakeCurrent (mPbufferDC, (HGLRC) mPbufferContext);
|
||||
sCurrentContextToken = mPbufferContext;
|
||||
}
|
||||
|
||||
|
|
|
@ -229,10 +229,6 @@ EXTRA_DSO_LDOPTS += $(TK_LIBS)
|
|||
OS_LIBS += -framework OpenGL
|
||||
endif
|
||||
|
||||
ifneq (,$(filter windows,$(MOZ_WIDGET_TOOLKIT)))
|
||||
OS_LIBS += opengl32.lib
|
||||
endif
|
||||
|
||||
# Add explicit X11 dependency when building against X11 toolkits
|
||||
ifneq (,$(filter gtk2,$(MOZ_WIDGET_TOOLKIT)))
|
||||
EXTRA_DSO_LDOPTS += $(XLDFLAGS) $(XLIBS)
|
||||
|
|
|
@ -77,7 +77,6 @@ DEFINES += \
|
|||
ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
|
||||
ifneq ($(OS_ARCH),WINCE)
|
||||
OS_LIBS += $(call EXPAND_LIBNAME,usp10 oleaut32)
|
||||
OS_LIBS += $(call EXPAND_LIBNAME,opengl32)
|
||||
endif
|
||||
endif
|
||||
ifneq (,$(filter $(MOZ_WIDGET_TOOLKIT),mac cocoa))
|
||||
|
|
Загрузка…
Ссылка в новой задаче