From: Rémi Bernon rbernon@codeweavers.com
--- dlls/opengl32/unix_wgl.c | 12 ++++++------ dlls/opengl32/wgl.c | 15 ++++++--------- dlls/win32u/opengl.c | 9 +++++---- include/wine/opengl_driver.h | 7 +++++++ 4 files changed, 24 insertions(+), 19 deletions(-)
diff --git a/dlls/opengl32/unix_wgl.c b/dlls/opengl32/unix_wgl.c index 4156045db48..1e416ec4af9 100644 --- a/dlls/opengl32/unix_wgl.c +++ b/dlls/opengl32/unix_wgl.c @@ -739,8 +739,8 @@ BOOL wrap_wglMakeCurrent( TEB *teb, HDC hdc, HGLRC hglrc ) if (!funcs->p_wglMakeCurrent( hdc, ctx->drv_ctx )) return FALSE; if (prev) prev->tid = 0; ctx->tid = tid; - teb->glReserved1[0] = hdc; - teb->glReserved1[1] = hdc; + teb->glReserved1[WINE_GL_RESERVED_DRAW_HDC] = hdc; + teb->glReserved1[WINE_GL_RESERVED_READ_HDC] = hdc; teb->glCurrentRC = hglrc; teb->glTable = (void *)funcs; return TRUE; @@ -892,8 +892,8 @@ BOOL wrap_wglMakeContextCurrentARB( TEB *teb, HDC draw_hdc, HDC read_hdc, HGLRC if (!funcs->p_wglMakeContextCurrentARB( draw_hdc, read_hdc, ctx->drv_ctx )) return FALSE; if (prev) prev->tid = 0; ctx->tid = tid; - teb->glReserved1[0] = draw_hdc; - teb->glReserved1[1] = read_hdc; + teb->glReserved1[WINE_GL_RESERVED_DRAW_HDC] = draw_hdc; + teb->glReserved1[WINE_GL_RESERVED_READ_HDC] = read_hdc; teb->glCurrentRC = hglrc; teb->glTable = (void *)funcs; return TRUE; @@ -1116,8 +1116,8 @@ static inline void update_teb32_context( TEB *teb ) teb32 = (char *)teb + teb->WowTebOffset;
((TEB32 *)teb32)->glCurrentRC = (UINT_PTR)teb->glCurrentRC; - ((TEB32 *)teb32)->glReserved1[0] = (UINT_PTR)teb->glReserved1[0]; - ((TEB32 *)teb32)->glReserved1[1] = (UINT_PTR)teb->glReserved1[1]; + ((TEB32 *)teb32)->glReserved1[WINE_GL_RESERVED_DRAW_HDC] = (UINT_PTR)teb->glReserved1[WINE_GL_RESERVED_DRAW_HDC]; + ((TEB32 *)teb32)->glReserved1[WINE_GL_RESERVED_READ_HDC] = (UINT_PTR)teb->glReserved1[WINE_GL_RESERVED_READ_HDC]; }
NTSTATUS wow64_wgl_wglCreateContext( void *args ) diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c index 7de0d1b1dba..275da5020a9 100644 --- a/dlls/opengl32/wgl.c +++ b/dlls/opengl32/wgl.c @@ -43,11 +43,6 @@ WINE_DECLARE_DEBUG_CHANNEL(fps);
static const MAT2 identity = { {0,1},{0,0},{0,0},{0,1} };
-#define WINE_GL_RESERVED_FORMATS_HDC 2 -#define WINE_GL_RESERVED_FORMATS_PTR 3 -#define WINE_GL_RESERVED_FORMATS_NUM 4 -#define WINE_GL_RESERVED_FORMATS_ONSCREEN 5 - #ifndef _WIN64
static char **wow64_strings; @@ -95,8 +90,9 @@ static void cleanup_wow64_strings(void) */ HDC WINAPI wglGetCurrentReadDCARB(void) { - if (!NtCurrentTeb()->glCurrentRC) return 0; - return NtCurrentTeb()->glReserved1[1]; + TEB *teb = NtCurrentTeb(); + if (!teb->glCurrentRC) return 0; + return teb->glReserved1[WINE_GL_RESERVED_READ_HDC]; }
/*********************************************************************** @@ -104,8 +100,9 @@ HDC WINAPI wglGetCurrentReadDCARB(void) */ HDC WINAPI wglGetCurrentDC(void) { - if (!NtCurrentTeb()->glCurrentRC) return 0; - return NtCurrentTeb()->glReserved1[0]; + TEB *teb = NtCurrentTeb(); + if (!teb->glCurrentRC) return 0; + return teb->glReserved1[WINE_GL_RESERVED_DRAW_HDC]; }
/*********************************************************************** diff --git a/dlls/win32u/opengl.c b/dlls/win32u/opengl.c index e29fe97f4a7..fba5d4109b1 100644 --- a/dlls/win32u/opengl.c +++ b/dlls/win32u/opengl.c @@ -1444,9 +1444,10 @@ static GLenum binding_from_target( GLenum target )
static BOOL win32u_wglBindTexImageARB( struct wgl_pbuffer *pbuffer, int buffer ) { - HDC prev_draw = NtCurrentTeb()->glReserved1[0], prev_read = NtCurrentTeb()->glReserved1[1]; + TEB *teb = NtCurrentTeb(); + HDC prev_draw = teb->glReserved1[WINE_GL_RESERVED_DRAW_HDC], prev_read = teb->glReserved1[WINE_GL_RESERVED_READ_HDC]; int prev_texture = 0, format = win32u_wglGetPixelFormat( pbuffer->hdc ); - struct wgl_context *prev_context = NtCurrentTeb()->glContext; + struct wgl_context *prev_context = teb->glContext; struct wgl_pixel_format desc; GLenum source; UINT ret; @@ -1661,7 +1662,7 @@ static BOOL win32u_wglSwapBuffers( HDC hdc )
static BOOL win32u_wglSwapIntervalEXT( int interval ) { - HDC hdc = NtCurrentTeb()->glReserved1[0]; + HDC hdc = NtCurrentTeb()->glReserved1[WINE_GL_RESERVED_DRAW_HDC]; HWND hwnd; WND *win;
@@ -1684,7 +1685,7 @@ static BOOL win32u_wglSwapIntervalEXT( int interval )
static int win32u_wglGetSwapIntervalEXT(void) { - HDC hdc = NtCurrentTeb()->glReserved1[0]; + HDC hdc = NtCurrentTeb()->glReserved1[WINE_GL_RESERVED_DRAW_HDC]; int interval; HWND hwnd; WND *win; diff --git a/include/wine/opengl_driver.h b/include/wine/opengl_driver.h index 2de585d8ce5..c048796d179 100644 --- a/include/wine/opengl_driver.h +++ b/include/wine/opengl_driver.h @@ -58,6 +58,13 @@ struct wgl_pixel_format int float_components; };
+#define WINE_GL_RESERVED_DRAW_HDC 0 +#define WINE_GL_RESERVED_READ_HDC 1 +#define WINE_GL_RESERVED_FORMATS_HDC 2 +#define WINE_GL_RESERVED_FORMATS_PTR 3 +#define WINE_GL_RESERVED_FORMATS_NUM 4 +#define WINE_GL_RESERVED_FORMATS_ONSCREEN 5 + #ifdef WINE_UNIX_LIB
/* Wine internal opengl driver version, needs to be bumped upon opengl_funcs changes. */