Commit c48a3bd3 authored by Alexandre Julliard's avatar Alexandre Julliard

opengl32: Make the GL driver function table const.

parent f27ac1bb
...@@ -920,7 +920,7 @@ foreach (sort keys %norm_functions) ...@@ -920,7 +920,7 @@ foreach (sort keys %norm_functions)
} }
print HEADER "\n\n"; print HEADER "\n\n";
print HEADER "extern struct opengl_funcs *__wine_get_wgl_driver( HDC hdc, UINT version );\n\n"; print HEADER "extern const struct opengl_funcs *__wine_get_wgl_driver( HDC hdc, UINT version );\n\n";
print HEADER "#endif /* __WINE_WGL_DRIVER_H */\n"; print HEADER "#endif /* __WINE_WGL_DRIVER_H */\n";
close HEADER; close HEADER;
......
...@@ -43,9 +43,9 @@ extern const int extension_registry_size DECLSPEC_HIDDEN; ...@@ -43,9 +43,9 @@ extern const int extension_registry_size DECLSPEC_HIDDEN;
extern struct opengl_funcs null_opengl_funcs DECLSPEC_HIDDEN; extern struct opengl_funcs null_opengl_funcs DECLSPEC_HIDDEN;
static inline struct opengl_funcs *get_dc_funcs( HDC hdc ) static inline const struct opengl_funcs *get_dc_funcs( HDC hdc )
{ {
struct opengl_funcs *funcs = __wine_get_wgl_driver( hdc, WINE_WGL_DRIVER_VERSION ); const struct opengl_funcs *funcs = __wine_get_wgl_driver( hdc, WINE_WGL_DRIVER_VERSION );
if (!funcs) RtlSetLastWin32Error( ERROR_INVALID_HANDLE ); if (!funcs) RtlSetLastWin32Error( ERROR_INVALID_HANDLE );
else if (funcs == (void *)-1) funcs = &null_opengl_funcs; else if (funcs == (void *)-1) funcs = &null_opengl_funcs;
return funcs; return funcs;
......
...@@ -77,7 +77,7 @@ struct opengl_context ...@@ -77,7 +77,7 @@ struct opengl_context
struct wgl_handle struct wgl_handle
{ {
UINT handle; UINT handle;
struct opengl_funcs *funcs; const struct opengl_funcs *funcs;
union union
{ {
struct opengl_context *context; /* for HANDLE_CONTEXT */ struct opengl_context *context; /* for HANDLE_CONTEXT */
...@@ -117,7 +117,7 @@ static struct wgl_handle *get_handle_ptr( HANDLE handle, enum wgl_handle_type ty ...@@ -117,7 +117,7 @@ static struct wgl_handle *get_handle_ptr( HANDLE handle, enum wgl_handle_type ty
return NULL; return NULL;
} }
static HANDLE alloc_handle( enum wgl_handle_type type, struct opengl_funcs *funcs, void *user_ptr ) static HANDLE alloc_handle( enum wgl_handle_type type, const struct opengl_funcs *funcs, void *user_ptr )
{ {
HANDLE handle = 0; HANDLE handle = 0;
struct wgl_handle *ptr = NULL; struct wgl_handle *ptr = NULL;
...@@ -647,7 +647,7 @@ static HGLRC wrap_wglCreateContext( HDC hdc ) ...@@ -647,7 +647,7 @@ static HGLRC wrap_wglCreateContext( HDC hdc )
HGLRC ret = 0; HGLRC ret = 0;
struct wgl_context *drv_ctx; struct wgl_context *drv_ctx;
struct opengl_context *context; struct opengl_context *context;
struct opengl_funcs *funcs = get_dc_funcs( hdc ); const struct opengl_funcs *funcs = get_dc_funcs( hdc );
if (!funcs) return 0; if (!funcs) return 0;
if (!(drv_ctx = funcs->wgl.p_wglCreateContext( hdc ))) return 0; if (!(drv_ctx = funcs->wgl.p_wglCreateContext( hdc ))) return 0;
...@@ -679,7 +679,7 @@ static BOOL wrap_wglMakeCurrent( TEB *teb, HDC hdc, HGLRC hglrc ) ...@@ -679,7 +679,7 @@ static BOOL wrap_wglMakeCurrent( TEB *teb, HDC hdc, HGLRC hglrc )
teb->glReserved1[0] = hdc; teb->glReserved1[0] = hdc;
teb->glReserved1[1] = hdc; teb->glReserved1[1] = hdc;
teb->glCurrentRC = hglrc; teb->glCurrentRC = hglrc;
teb->glTable = ptr->funcs; teb->glTable = (void *)ptr->funcs;
} }
} }
else else
...@@ -751,7 +751,7 @@ static HGLRC wrap_wglCreateContextAttribsARB( HDC hdc, HGLRC share, const int *a ...@@ -751,7 +751,7 @@ static HGLRC wrap_wglCreateContextAttribsARB( HDC hdc, HGLRC share, const int *a
struct wgl_context *drv_ctx; struct wgl_context *drv_ctx;
struct wgl_handle *share_ptr = NULL; struct wgl_handle *share_ptr = NULL;
struct opengl_context *context; struct opengl_context *context;
struct opengl_funcs *funcs = get_dc_funcs( hdc ); const struct opengl_funcs *funcs = get_dc_funcs( hdc );
if (!funcs) if (!funcs)
{ {
...@@ -796,7 +796,7 @@ static HPBUFFERARB wrap_wglCreatePbufferARB( HDC hdc, int format, int width, int ...@@ -796,7 +796,7 @@ static HPBUFFERARB wrap_wglCreatePbufferARB( HDC hdc, int format, int width, int
{ {
HPBUFFERARB ret; HPBUFFERARB ret;
struct wgl_pbuffer *pbuffer; struct wgl_pbuffer *pbuffer;
struct opengl_funcs *funcs = get_dc_funcs( hdc ); const struct opengl_funcs *funcs = get_dc_funcs( hdc );
if (!funcs || !funcs->ext.p_wglCreatePbufferARB) return 0; if (!funcs || !funcs->ext.p_wglCreatePbufferARB) return 0;
if (!(pbuffer = funcs->ext.p_wglCreatePbufferARB( hdc, format, width, height, attribs ))) return 0; if (!(pbuffer = funcs->ext.p_wglCreatePbufferARB( hdc, format, width, height, attribs ))) return 0;
...@@ -842,7 +842,7 @@ static BOOL wrap_wglMakeContextCurrentARB( TEB *teb, HDC draw_hdc, HDC read_hdc, ...@@ -842,7 +842,7 @@ static BOOL wrap_wglMakeContextCurrentARB( TEB *teb, HDC draw_hdc, HDC read_hdc,
teb->glReserved1[0] = draw_hdc; teb->glReserved1[0] = draw_hdc;
teb->glReserved1[1] = read_hdc; teb->glReserved1[1] = read_hdc;
teb->glCurrentRC = hglrc; teb->glCurrentRC = hglrc;
teb->glTable = ptr->funcs; teb->glTable = (void *)ptr->funcs;
} }
} }
else else
......
...@@ -1490,7 +1490,7 @@ BOOL WINAPI __wine_get_icm_profile( HDC hdc, BOOL allow_default, DWORD *size, WC ...@@ -1490,7 +1490,7 @@ BOOL WINAPI __wine_get_icm_profile( HDC hdc, BOOL allow_default, DWORD *size, WC
/*********************************************************************** /***********************************************************************
* __wine_get_wgl_driver (win32u.@) * __wine_get_wgl_driver (win32u.@)
*/ */
struct opengl_funcs *__wine_get_wgl_driver( HDC hdc, UINT version ) const struct opengl_funcs *__wine_get_wgl_driver( HDC hdc, UINT version )
{ {
BOOL is_display, is_memdc; BOOL is_display, is_memdc;
DC *dc; DC *dc;
......
...@@ -3405,6 +3405,6 @@ struct opengl_funcs ...@@ -3405,6 +3405,6 @@ struct opengl_funcs
USE_GL_FUNC(glVertexPointer) \ USE_GL_FUNC(glVertexPointer) \
USE_GL_FUNC(glViewport) USE_GL_FUNC(glViewport)
extern struct opengl_funcs *__wine_get_wgl_driver( HDC hdc, UINT version ); extern const struct opengl_funcs *__wine_get_wgl_driver( HDC hdc, UINT version );
#endif /* __WINE_WGL_DRIVER_H */ #endif /* __WINE_WGL_DRIVER_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment