mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-20 20:20:18 +01:00
wgl: Make overridden entrypoints local to stw_ext_context
Reviewed By: Bill Kristiansen <billkris@microsoft.com> Reviewed-by: Charmaine Lee >charmainel@vmware.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12677>
This commit is contained in:
parent
739fb1057d
commit
e2bb111e02
3 changed files with 20 additions and 23 deletions
|
|
@ -38,8 +38,22 @@
|
||||||
#include "util/u_debug.h"
|
#include "util/u_debug.h"
|
||||||
|
|
||||||
|
|
||||||
wglCreateContext_t wglCreateContext_func = 0;
|
static wglCreateContext_t wglCreateContext_func = 0;
|
||||||
wglDeleteContext_t wglDeleteContext_func = 0;
|
static wglDeleteContext_t wglDeleteContext_func = 0;
|
||||||
|
|
||||||
|
/* When this library is used as a opengl32.dll drop-in replacement, ensure we
|
||||||
|
* use the wglCreate/Destroy entrypoints above, and not the true opengl32.dll,
|
||||||
|
* which could happen if this library's name is not opengl32.dll exactly.
|
||||||
|
*
|
||||||
|
* For example, Qt 5.4 bundles this as opengl32sw.dll:
|
||||||
|
* https://blog.qt.io/blog/2014/11/27/qt-weekly-21-dynamic-opengl-implementation-loading-in-qt-5-4/
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
stw_override_opengl32_entry_points(wglCreateContext_t create, wglDeleteContext_t delete)
|
||||||
|
{
|
||||||
|
wglCreateContext_func = create;
|
||||||
|
wglDeleteContext_func = delete;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@
|
||||||
typedef HGLRC (WINAPI *wglCreateContext_t)(HDC hdc);
|
typedef HGLRC (WINAPI *wglCreateContext_t)(HDC hdc);
|
||||||
typedef BOOL (WINAPI *wglDeleteContext_t)(HGLRC hglrc);
|
typedef BOOL (WINAPI *wglDeleteContext_t)(HGLRC hglrc);
|
||||||
|
|
||||||
extern wglCreateContext_t wglCreateContext_func;
|
extern void
|
||||||
extern wglDeleteContext_t wglDeleteContext_func;
|
stw_override_opengl32_entry_points(wglCreateContext_t create, wglDeleteContext_t delete);
|
||||||
|
|
||||||
#endif /* STW_EXT_CONTEXT_H */
|
#endif /* STW_EXT_CONTEXT_H */
|
||||||
|
|
|
||||||
|
|
@ -48,10 +48,6 @@
|
||||||
#include "stw_wgl.h"
|
#include "stw_wgl.h"
|
||||||
#include "stw_ext_context.h"
|
#include "stw_ext_context.h"
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
overrideOpenGL32EntryPoints(void);
|
|
||||||
|
|
||||||
WINGDIAPI BOOL APIENTRY
|
WINGDIAPI BOOL APIENTRY
|
||||||
wglCopyContext(
|
wglCopyContext(
|
||||||
HGLRC hglrcSrc,
|
HGLRC hglrcSrc,
|
||||||
|
|
@ -67,7 +63,7 @@ WINGDIAPI HGLRC APIENTRY
|
||||||
wglCreateContext(
|
wglCreateContext(
|
||||||
HDC hdc )
|
HDC hdc )
|
||||||
{
|
{
|
||||||
overrideOpenGL32EntryPoints();
|
stw_override_opengl32_entry_points(&wglCreateContext, &wglDeleteContext);
|
||||||
return (HGLRC)(UINT_PTR)DrvCreateContext(hdc);
|
return (HGLRC)(UINT_PTR)DrvCreateContext(hdc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -76,7 +72,7 @@ wglCreateLayerContext(
|
||||||
HDC hdc,
|
HDC hdc,
|
||||||
int iLayerPlane )
|
int iLayerPlane )
|
||||||
{
|
{
|
||||||
overrideOpenGL32EntryPoints();
|
stw_override_opengl32_entry_points(&wglCreateContext, &wglDeleteContext);
|
||||||
return (HGLRC)(UINT_PTR)DrvCreateLayerContext( hdc, iLayerPlane );
|
return (HGLRC)(UINT_PTR)DrvCreateLayerContext( hdc, iLayerPlane );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -377,16 +373,3 @@ wglRealizeLayerPalette(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* When this library is used as a opengl32.dll drop-in replacement, ensure we
|
|
||||||
* use the wglCreate/Destroy entrypoints above, and not the true opengl32.dll,
|
|
||||||
* which could happen if this library's name is not opengl32.dll exactly.
|
|
||||||
*
|
|
||||||
* For example, Qt 5.4 bundles this as opengl32sw.dll:
|
|
||||||
* https://blog.qt.io/blog/2014/11/27/qt-weekly-21-dynamic-opengl-implementation-loading-in-qt-5-4/
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
overrideOpenGL32EntryPoints(void)
|
|
||||||
{
|
|
||||||
wglCreateContext_func = &wglCreateContext;
|
|
||||||
wglDeleteContext_func = &wglDeleteContext;
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue