opengl32: Move the wgl functions to the main OpenGL function table.
This commit is contained in:
parent
782e96b910
commit
4c0779006e
|
@ -50,7 +50,6 @@ static struct list drivers = LIST_INIT( drivers );
|
|||
static struct graphics_driver *display_driver;
|
||||
|
||||
const struct gdi_dc_funcs *font_driver = NULL;
|
||||
static const struct wgl_funcs null_wgl_driver;
|
||||
|
||||
static CRITICAL_SECTION driver_section;
|
||||
static CRITICAL_SECTION_DEBUG critsect_debug =
|
||||
|
@ -387,11 +386,6 @@ static UINT nulldrv_GetOutlineTextMetrics( PHYSDEV dev, UINT size, LPOUTLINETEXT
|
|||
return 0;
|
||||
}
|
||||
|
||||
static INT nulldrv_GetPixelFormat( HDC hdc )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static UINT nulldrv_GetSystemPaletteEntries( PHYSDEV dev, UINT start, UINT count, PALETTEENTRY *entries )
|
||||
{
|
||||
return 0;
|
||||
|
@ -666,59 +660,9 @@ static BOOL nulldrv_UnrealizePalette( HPALETTE palette )
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
static BOOL nulldrv_wglCopyContext( struct wgl_context *src, struct wgl_context *dst, UINT mask )
|
||||
static struct opengl_funcs *nulldrv_wine_get_wgl_driver( PHYSDEV dev, UINT version )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static struct wgl_context *nulldrv_wglCreateContext( HDC hdc )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct wgl_context *nulldrv_wglCreateContextAttribsARB( HDC hdc, struct wgl_context *share_ctx,
|
||||
const int *attribs )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void nulldrv_wglDeleteContext( struct wgl_context *context )
|
||||
{
|
||||
}
|
||||
|
||||
static HDC nulldrv_wglGetCurrentDC( struct wgl_context *context )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static PROC nulldrv_wglGetProcAddress( LPCSTR name )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static BOOL nulldrv_wglMakeContextCurrentARB( HDC draw_hdc, HDC read_hdc, struct wgl_context *context )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static BOOL nulldrv_wglMakeCurrent( HDC hdc, struct wgl_context *context )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static BOOL nulldrv_wglShareLists( struct wgl_context *org, struct wgl_context *dst )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static const struct wgl_funcs *nulldrv_wine_get_wgl_driver( PHYSDEV dev, UINT version )
|
||||
{
|
||||
if (version != WINE_GDI_DRIVER_VERSION)
|
||||
{
|
||||
ERR( "version mismatch, opengl32 wants %u but driver has %u\n", version, WINE_GDI_DRIVER_VERSION );
|
||||
return NULL;
|
||||
}
|
||||
return &null_wgl_driver;
|
||||
return (void *)-1;
|
||||
}
|
||||
|
||||
const struct gdi_dc_funcs null_driver =
|
||||
|
@ -857,19 +801,6 @@ const struct gdi_dc_funcs null_driver =
|
|||
GDI_PRIORITY_NULL_DRV /* priority */
|
||||
};
|
||||
|
||||
static const struct wgl_funcs null_wgl_driver =
|
||||
{
|
||||
nulldrv_GetPixelFormat, /* p_GetPixelFormat */
|
||||
nulldrv_wglCopyContext, /* p_wglCopyContext */
|
||||
nulldrv_wglCreateContext, /* p_wglCreateContext */
|
||||
nulldrv_wglCreateContextAttribsARB, /* p_wglCreateContextAttribsARB */
|
||||
nulldrv_wglDeleteContext, /* p_wglDeleteContext */
|
||||
nulldrv_wglGetCurrentDC, /* p_wglGetCurrentDC */
|
||||
nulldrv_wglGetProcAddress, /* p_wglGetProcAddress */
|
||||
nulldrv_wglMakeContextCurrentARB, /* p_wglMakeContextCurrentARB */
|
||||
nulldrv_wglMakeCurrent, /* p_wglMakeCurrent */
|
||||
nulldrv_wglShareLists, /* p_wglShareLists */
|
||||
};
|
||||
|
||||
/*****************************************************************************
|
||||
* DRIVER_GetDriverName
|
||||
|
|
|
@ -47,9 +47,9 @@ static BOOL (WINAPI *wglSwapBuffers)(HDC);
|
|||
/***********************************************************************
|
||||
* __wine_get_wgl_driver (GDI32.@)
|
||||
*/
|
||||
const struct wgl_funcs * CDECL __wine_get_wgl_driver( HDC hdc, UINT version )
|
||||
struct opengl_funcs * CDECL __wine_get_wgl_driver( HDC hdc, UINT version )
|
||||
{
|
||||
const struct wgl_funcs *ret = NULL;
|
||||
struct opengl_funcs *ret = NULL;
|
||||
DC * dc = get_dc_ptr( hdc );
|
||||
|
||||
if (dc)
|
||||
|
|
|
@ -582,6 +582,29 @@ my %ext_functions =
|
|||
"glDeleteObjectBufferATI" => [ "void", [ [ "GLuint", "buffer" ] ], "GL_ATI_vertex_array_object" ]
|
||||
);
|
||||
|
||||
|
||||
my %wgl_functions =
|
||||
(
|
||||
"wglCopyContext" => [ "BOOL", [ [ "struct wgl_context *", "src" ],
|
||||
[ "struct wgl_context *", "dst" ],
|
||||
[ "UINT", "mask" ] ] ],
|
||||
"wglCreateContext" => [ "struct wgl_context *", [ [ "HDC", "hdc" ] ] ],
|
||||
"wglCreateContextAttribsARB" => [ "struct wgl_context *", [ [ "HDC", "hdc" ],
|
||||
[ "struct wgl_context *", "share_ctx" ],
|
||||
[ "const int *", "attribs" ] ] ],
|
||||
"wglDeleteContext" => [ "void", [ [ "struct wgl_context *", "context" ] ] ],
|
||||
"wglGetCurrentDC" => [ "HDC", [ [ "struct wgl_context *", "context" ] ] ],
|
||||
"wglGetPixelFormat" => [ "INT", [ [ "HDC", "hdc" ] ] ],
|
||||
"wglGetProcAddress" => [ "PROC", [ [ "LPCSTR", "name" ] ] ],
|
||||
"wglMakeContextCurrentARB" => [ "BOOL", [ [ "HDC", "draw_hdc" ],
|
||||
[ "HDC", "read_hdc" ],
|
||||
[ "struct wgl_context *", "context" ] ] ],
|
||||
"wglMakeCurrent" => [ "BOOL", [ [ "HDC", "hdc" ],
|
||||
[ "struct wgl_context *", "context" ] ] ],
|
||||
"wglShareLists" => [ "BOOL", [ [ "struct wgl_context *", "org" ],
|
||||
[ "struct wgl_context *", "dst" ] ] ],
|
||||
);
|
||||
|
||||
my @arg_names;
|
||||
my %arg_types;
|
||||
while (my $line = <REGISTRY>) {
|
||||
|
@ -707,7 +730,16 @@ print HEADER "#endif\n\n";
|
|||
|
||||
printf HEADER "#define WINE_WGL_DRIVER_VERSION %u\n\n", $wgl_version + 1;
|
||||
|
||||
print HEADER "struct wgl_context;\n\n";
|
||||
|
||||
print HEADER "struct opengl_funcs\n{\n";
|
||||
print HEADER " struct\n {\n";
|
||||
foreach (sort keys %wgl_functions)
|
||||
{
|
||||
printf HEADER " %s;\n", get_func_proto($_, $wgl_functions{$_});
|
||||
}
|
||||
print HEADER " } wgl;\n\n";
|
||||
|
||||
print HEADER " struct\n {\n";
|
||||
foreach (sort keys %norm_functions)
|
||||
{
|
||||
|
@ -732,6 +764,7 @@ foreach (sort keys %norm_functions)
|
|||
}
|
||||
print HEADER "\n\n";
|
||||
|
||||
print HEADER "extern struct opengl_funcs * CDECL __wine_get_wgl_driver( HDC hdc, UINT version );\n\n";
|
||||
print HEADER "#endif /* __WINE_WGL_DRIVER_H */\n";
|
||||
close HEADER;
|
||||
|
||||
|
@ -805,15 +838,20 @@ foreach (sort keys %norm_functions) {
|
|||
print NORM "\n$string" if $string;
|
||||
}
|
||||
|
||||
print NORM "\n";
|
||||
|
||||
foreach (sort keys %wgl_functions) {
|
||||
print NORM generate_null_func($_, $wgl_functions{$_});
|
||||
}
|
||||
foreach (sort keys %norm_functions) {
|
||||
print NORM generate_null_func($_, $norm_functions{$_});
|
||||
}
|
||||
|
||||
print NORM "\n#define USE_GL_FUNC(name) null_##name,\n";
|
||||
print NORM "struct opengl_funcs null_opengl_funcs = { { ALL_WGL_FUNCS } };\n";
|
||||
print NORM "\nstruct opengl_funcs null_opengl_funcs =\n{\n {\n";
|
||||
foreach (sort keys %wgl_functions) { print NORM " null_$_,\n"; }
|
||||
print NORM " },\n";
|
||||
print NORM "#define USE_GL_FUNC(name) null_##name,\n";
|
||||
print NORM " { ALL_WGL_FUNCS }\n";
|
||||
print NORM "#undef USE_GL_FUNC\n";
|
||||
print NORM "};\n";
|
||||
|
||||
close(NORM);
|
||||
|
||||
|
|
|
@ -3024,7 +3024,16 @@ void WINAPI wine_glViewport( GLint x, GLint y, GLsizei width, GLsizei height ) {
|
|||
TRACE("(%d, %d, %d, %d)\n", x, y, width, height );
|
||||
funcs->gl.p_glViewport( x, y, width, height );
|
||||
}
|
||||
|
||||
static BOOL null_wglCopyContext( struct wgl_context * src, struct wgl_context * dst, UINT mask ) { return 0; }
|
||||
static struct wgl_context * null_wglCreateContext( HDC hdc ) { return 0; }
|
||||
static struct wgl_context * null_wglCreateContextAttribsARB( HDC hdc, struct wgl_context * share_ctx, const int * attribs ) { return 0; }
|
||||
static void null_wglDeleteContext( struct wgl_context * context ) { }
|
||||
static HDC null_wglGetCurrentDC( struct wgl_context * context ) { return 0; }
|
||||
static INT null_wglGetPixelFormat( HDC hdc ) { return 0; }
|
||||
static PROC null_wglGetProcAddress( LPCSTR name ) { return 0; }
|
||||
static BOOL null_wglMakeContextCurrentARB( HDC draw_hdc, HDC read_hdc, struct wgl_context * context ) { return 0; }
|
||||
static BOOL null_wglMakeCurrent( HDC hdc, struct wgl_context * context ) { return 0; }
|
||||
static BOOL null_wglShareLists( struct wgl_context * org, struct wgl_context * dst ) { return 0; }
|
||||
static void null_glAccum( GLenum op, GLfloat value ) { }
|
||||
static void null_glAlphaFunc( GLenum func, GLfloat ref ) { }
|
||||
static GLboolean null_glAreTexturesResident( GLsizei n, const GLuint* textures, GLboolean* residences ) { return 0; }
|
||||
|
@ -3362,6 +3371,21 @@ static void null_glVertex4sv( const GLshort* v ) { }
|
|||
static void null_glVertexPointer( GLint size, GLenum type, GLsizei stride, const GLvoid* pointer ) { }
|
||||
static void null_glViewport( GLint x, GLint y, GLsizei width, GLsizei height ) { }
|
||||
|
||||
struct opengl_funcs null_opengl_funcs =
|
||||
{
|
||||
{
|
||||
null_wglCopyContext,
|
||||
null_wglCreateContext,
|
||||
null_wglCreateContextAttribsARB,
|
||||
null_wglDeleteContext,
|
||||
null_wglGetCurrentDC,
|
||||
null_wglGetPixelFormat,
|
||||
null_wglGetProcAddress,
|
||||
null_wglMakeContextCurrentARB,
|
||||
null_wglMakeCurrent,
|
||||
null_wglShareLists,
|
||||
},
|
||||
#define USE_GL_FUNC(name) null_##name,
|
||||
struct opengl_funcs null_opengl_funcs = { { ALL_WGL_FUNCS } };
|
||||
{ ALL_WGL_FUNCS }
|
||||
#undef USE_GL_FUNC
|
||||
};
|
||||
|
|
|
@ -78,10 +78,10 @@ extern BOOL WINAPI GdiSwapBuffers( HDC hdc );
|
|||
|
||||
struct wgl_handle
|
||||
{
|
||||
UINT handle;
|
||||
DWORD tid;
|
||||
struct wgl_context * context;
|
||||
const struct wgl_funcs *funcs;
|
||||
UINT handle;
|
||||
DWORD tid;
|
||||
struct wgl_context *context;
|
||||
struct opengl_funcs *funcs;
|
||||
};
|
||||
|
||||
static struct wgl_handle wgl_handles[MAX_WGL_HANDLES];
|
||||
|
@ -97,9 +97,11 @@ static CRITICAL_SECTION_DEBUG critsect_debug =
|
|||
};
|
||||
static CRITICAL_SECTION wgl_section = { &critsect_debug, -1, 0, 0, 0, 0 };
|
||||
|
||||
static inline const struct wgl_funcs *get_dc_funcs( HDC hdc )
|
||||
static inline struct opengl_funcs *get_dc_funcs( HDC hdc )
|
||||
{
|
||||
return __wine_get_wgl_driver( hdc, WINE_GDI_DRIVER_VERSION );
|
||||
struct opengl_funcs *funcs = __wine_get_wgl_driver( hdc, WINE_WGL_DRIVER_VERSION );
|
||||
if (funcs == (void *)-1) funcs = &null_opengl_funcs;
|
||||
return funcs;
|
||||
}
|
||||
|
||||
static inline HGLRC next_handle( struct wgl_handle *ptr )
|
||||
|
@ -135,7 +137,7 @@ static void release_handle_ptr( struct wgl_handle *ptr )
|
|||
if (ptr) LeaveCriticalSection( &wgl_section );
|
||||
}
|
||||
|
||||
static HGLRC alloc_handle( struct wgl_context *context, const struct wgl_funcs *funcs )
|
||||
static HGLRC alloc_handle( struct wgl_context *context, struct opengl_funcs *funcs )
|
||||
{
|
||||
HGLRC handle = 0;
|
||||
struct wgl_handle *ptr = NULL;
|
||||
|
@ -187,7 +189,7 @@ BOOL WINAPI wglCopyContext(HGLRC hglrcSrc, HGLRC hglrcDst, UINT mask)
|
|||
if ((dst = get_handle_ptr( hglrcDst )))
|
||||
{
|
||||
if (src->funcs != dst->funcs) SetLastError( ERROR_INVALID_HANDLE );
|
||||
else ret = src->funcs->p_wglCopyContext( src->context, dst->context, mask );
|
||||
else ret = src->funcs->wgl.p_wglCopyContext( src->context, dst->context, mask );
|
||||
}
|
||||
release_handle_ptr( dst );
|
||||
release_handle_ptr( src );
|
||||
|
@ -210,7 +212,7 @@ BOOL WINAPI wglDeleteContext(HGLRC hglrc)
|
|||
return FALSE;
|
||||
}
|
||||
if (hglrc == NtCurrentTeb()->glCurrentRC) wglMakeCurrent( 0, 0 );
|
||||
ptr->funcs->p_wglDeleteContext( ptr->context );
|
||||
ptr->funcs->wgl.p_wglDeleteContext( ptr->context );
|
||||
free_handle_ptr( ptr );
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -228,12 +230,13 @@ BOOL WINAPI wglMakeCurrent(HDC hdc, HGLRC hglrc)
|
|||
if (!(ptr = get_handle_ptr( hglrc ))) return FALSE;
|
||||
if (!ptr->tid || ptr->tid == GetCurrentThreadId())
|
||||
{
|
||||
ret = ptr->funcs->p_wglMakeCurrent( hdc, ptr->context );
|
||||
ret = ptr->funcs->wgl.p_wglMakeCurrent( hdc, ptr->context );
|
||||
if (ret)
|
||||
{
|
||||
if (prev) prev->tid = 0;
|
||||
ptr->tid = GetCurrentThreadId();
|
||||
NtCurrentTeb()->glCurrentRC = hglrc;
|
||||
NtCurrentTeb()->glTable = ptr->funcs;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -245,7 +248,7 @@ BOOL WINAPI wglMakeCurrent(HDC hdc, HGLRC hglrc)
|
|||
}
|
||||
else if (prev)
|
||||
{
|
||||
if (!prev->funcs->p_wglMakeCurrent( 0, NULL )) return FALSE;
|
||||
if (!prev->funcs->wgl.p_wglMakeCurrent( 0, NULL )) return FALSE;
|
||||
prev->tid = 0;
|
||||
NtCurrentTeb()->glCurrentRC = 0;
|
||||
NtCurrentTeb()->glTable = &null_opengl_funcs;
|
||||
|
@ -266,15 +269,15 @@ static HGLRC WINAPI wglCreateContextAttribsARB( HDC hdc, HGLRC share, const int
|
|||
HGLRC ret = 0;
|
||||
struct wgl_context *context;
|
||||
struct wgl_handle *share_ptr = NULL;
|
||||
const struct wgl_funcs *funcs = get_dc_funcs( hdc );
|
||||
struct opengl_funcs *funcs = get_dc_funcs( hdc );
|
||||
|
||||
if (!funcs) return 0;
|
||||
if (share && !(share_ptr = get_handle_ptr( share ))) return 0;
|
||||
if ((context = funcs->p_wglCreateContextAttribsARB( hdc, share_ptr ? share_ptr->context : NULL,
|
||||
attribs )))
|
||||
if ((context = funcs->wgl.p_wglCreateContextAttribsARB( hdc, share_ptr ? share_ptr->context : NULL,
|
||||
attribs )))
|
||||
{
|
||||
ret = alloc_handle( context, funcs );
|
||||
if (!ret) funcs->p_wglDeleteContext( context );
|
||||
if (!ret) funcs->wgl.p_wglDeleteContext( context );
|
||||
}
|
||||
release_handle_ptr( share_ptr );
|
||||
return ret;
|
||||
|
@ -294,12 +297,13 @@ static BOOL WINAPI wglMakeContextCurrentARB( HDC draw_hdc, HDC read_hdc, HGLRC h
|
|||
if (!(ptr = get_handle_ptr( hglrc ))) return FALSE;
|
||||
if (!ptr->tid || ptr->tid == GetCurrentThreadId())
|
||||
{
|
||||
ret = ptr->funcs->p_wglMakeContextCurrentARB( draw_hdc, read_hdc, ptr->context );
|
||||
ret = ptr->funcs->wgl.p_wglMakeContextCurrentARB( draw_hdc, read_hdc, ptr->context );
|
||||
if (ret)
|
||||
{
|
||||
if (prev) prev->tid = 0;
|
||||
ptr->tid = GetCurrentThreadId();
|
||||
NtCurrentTeb()->glCurrentRC = hglrc;
|
||||
NtCurrentTeb()->glTable = ptr->funcs;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -311,7 +315,7 @@ static BOOL WINAPI wglMakeContextCurrentARB( HDC draw_hdc, HDC read_hdc, HGLRC h
|
|||
}
|
||||
else if (prev)
|
||||
{
|
||||
if (!prev->funcs->p_wglMakeCurrent( 0, NULL )) return FALSE;
|
||||
if (!prev->funcs->wgl.p_wglMakeCurrent( 0, NULL )) return FALSE;
|
||||
prev->tid = 0;
|
||||
NtCurrentTeb()->glCurrentRC = 0;
|
||||
NtCurrentTeb()->glTable = &null_opengl_funcs;
|
||||
|
@ -331,7 +335,7 @@ BOOL WINAPI wglShareLists(HGLRC hglrcSrc, HGLRC hglrcDst)
|
|||
if ((dst = get_handle_ptr( hglrcDst )))
|
||||
{
|
||||
if (src->funcs != dst->funcs) SetLastError( ERROR_INVALID_HANDLE );
|
||||
else ret = src->funcs->p_wglShareLists( src->context, dst->context );
|
||||
else ret = src->funcs->wgl.p_wglShareLists( src->context, dst->context );
|
||||
}
|
||||
release_handle_ptr( dst );
|
||||
release_handle_ptr( src );
|
||||
|
@ -345,7 +349,7 @@ HDC WINAPI wglGetCurrentDC(void)
|
|||
{
|
||||
struct wgl_handle *context = get_current_handle_ptr();
|
||||
if (!context) return 0;
|
||||
return context->funcs->p_wglGetCurrentDC( context->context );
|
||||
return context->funcs->wgl.p_wglGetCurrentDC( context->context );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -355,12 +359,12 @@ HGLRC WINAPI wglCreateContext(HDC hdc)
|
|||
{
|
||||
HGLRC ret = 0;
|
||||
struct wgl_context *context;
|
||||
const struct wgl_funcs *funcs = get_dc_funcs( hdc );
|
||||
struct opengl_funcs *funcs = get_dc_funcs( hdc );
|
||||
|
||||
if (!funcs) return 0;
|
||||
if (!(context = funcs->p_wglCreateContext( hdc ))) return 0;
|
||||
if (!(context = funcs->wgl.p_wglCreateContext( hdc ))) return 0;
|
||||
ret = alloc_handle( context, funcs );
|
||||
if (!ret) funcs->p_wglDeleteContext( context );
|
||||
if (!ret) funcs->wgl.p_wglDeleteContext( context );
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -549,9 +553,9 @@ INT WINAPI wglDescribePixelFormat(HDC hdc, INT iPixelFormat, UINT nBytes,
|
|||
*/
|
||||
INT WINAPI wglGetPixelFormat(HDC hdc)
|
||||
{
|
||||
const struct wgl_funcs *funcs = get_dc_funcs( hdc );
|
||||
struct opengl_funcs *funcs = get_dc_funcs( hdc );
|
||||
if (!funcs) return 0;
|
||||
return funcs->p_GetPixelFormat( hdc );
|
||||
return funcs->wgl.p_wglGetPixelFormat( hdc );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -701,7 +705,7 @@ PROC WINAPI wglGetProcAddress(LPCSTR lpszProc) {
|
|||
/* If the function name starts with a 'w', it is a WGL extension */
|
||||
if(lpszProc[0] == 'w')
|
||||
{
|
||||
local_func = context->funcs->p_wglGetProcAddress( lpszProc );
|
||||
local_func = context->funcs->wgl.p_wglGetProcAddress( lpszProc );
|
||||
if (local_func == (void *)1) /* special function that needs a wrapper */
|
||||
{
|
||||
ext_ret = bsearch( &ext, wgl_extensions, sizeof(wgl_extensions)/sizeof(wgl_extensions[0]),
|
||||
|
@ -724,7 +728,7 @@ PROC WINAPI wglGetProcAddress(LPCSTR lpszProc) {
|
|||
WARN("Extension '%s' required by function '%s' not supported!\n", ext_ret->extension, lpszProc);
|
||||
}
|
||||
|
||||
local_func = context->funcs->p_wglGetProcAddress( ext_ret->name );
|
||||
local_func = context->funcs->wgl.p_wglGetProcAddress( ext_ret->name );
|
||||
|
||||
/* After that, look at the extensions defined in the Linux OpenGL library */
|
||||
if (local_func == NULL) {
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
#include "wined3d_private.h"
|
||||
#ifndef USE_WIN32_OPENGL
|
||||
#include "wine/gdi_driver.h"
|
||||
#include "wine/wgl_driver.h"
|
||||
#endif
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(d3d);
|
||||
|
@ -5415,9 +5415,13 @@ static BOOL InitAdapters(struct wined3d *wined3d)
|
|||
/* To bypass the opengl32 thunks load wglGetProcAddress from gdi32 instead of opengl32 */
|
||||
{
|
||||
HDC hdc = GetDC( 0 );
|
||||
const struct wgl_funcs *wgl_driver = __wine_get_wgl_driver( hdc, WINE_GDI_DRIVER_VERSION );
|
||||
pwglGetProcAddress = wgl_driver->p_wglGetProcAddress;
|
||||
const struct opengl_funcs *wgl_driver = __wine_get_wgl_driver( hdc, WINE_WGL_DRIVER_VERSION );
|
||||
|
||||
if (wgl_driver && wgl_driver != (void *)-1)
|
||||
pwglGetProcAddress = wgl_driver->wgl.p_wglGetProcAddress;
|
||||
|
||||
ReleaseDC( 0, hdc );
|
||||
if (!pwglGetProcAddress) goto nogl_adapter;
|
||||
}
|
||||
#define USE_GL_FUNC(pfn) pfn = (void*)pwglGetProcAddress(#pfn);
|
||||
#endif
|
||||
|
|
|
@ -197,7 +197,6 @@ struct glx_physdev
|
|||
Pixmap pixmap; /* pixmap for a DL_GL_PIXMAP_WIN drawable */
|
||||
};
|
||||
|
||||
static const struct wgl_funcs glxdrv_wgl_funcs;
|
||||
static const struct gdi_dc_funcs glxdrv_funcs;
|
||||
|
||||
static inline struct glx_physdev *get_glxdrv_dev( PHYSDEV dev )
|
||||
|
@ -1309,9 +1308,9 @@ static int glxdrv_DescribePixelFormat(PHYSDEV dev, int iPixelFormat,
|
|||
}
|
||||
|
||||
/***********************************************************************
|
||||
* glxdrv_GetPixelFormat
|
||||
* glxdrv_wglGetPixelFormat
|
||||
*/
|
||||
static int glxdrv_GetPixelFormat( HDC hdc )
|
||||
static int glxdrv_wglGetPixelFormat( HDC hdc )
|
||||
{
|
||||
struct x11drv_escape_get_drawable escape;
|
||||
WineGLPixelFormat *fmt;
|
||||
|
@ -1625,7 +1624,6 @@ static BOOL glxdrv_wglMakeCurrent(HDC hdc, struct wgl_context *ctx)
|
|||
|
||||
if (ret)
|
||||
{
|
||||
NtCurrentTeb()->glTable = &opengl_funcs;
|
||||
NtCurrentTeb()->glContext = ctx;
|
||||
|
||||
ctx->has_been_current = TRUE;
|
||||
|
@ -1697,7 +1695,6 @@ static BOOL glxdrv_wglMakeContextCurrentARB( HDC draw_hdc, HDC read_hdc, struct
|
|||
ctx->drawables[0] = escape_draw.gl_drawable;
|
||||
ctx->drawables[1] = escape_read.gl_drawable;
|
||||
ctx->refresh_drawables = FALSE;
|
||||
NtCurrentTeb()->glTable = &opengl_funcs;
|
||||
NtCurrentTeb()->glContext = ctx;
|
||||
}
|
||||
else
|
||||
|
@ -3404,15 +3401,15 @@ static INT glxdrv_ExtEscape( PHYSDEV dev, INT escape, INT in_count, LPCVOID in_d
|
|||
/**********************************************************************
|
||||
* glxdrv_wine_get_wgl_driver
|
||||
*/
|
||||
static const struct wgl_funcs * glxdrv_wine_get_wgl_driver( PHYSDEV dev, UINT version )
|
||||
static struct opengl_funcs * glxdrv_wine_get_wgl_driver( PHYSDEV dev, UINT version )
|
||||
{
|
||||
if (version != WINE_GDI_DRIVER_VERSION)
|
||||
if (version != WINE_WGL_DRIVER_VERSION)
|
||||
{
|
||||
ERR( "version mismatch, opengl32 wants %u but driver has %u\n", version, WINE_GDI_DRIVER_VERSION );
|
||||
ERR( "version mismatch, opengl32 wants %u but driver has %u\n", version, WINE_WGL_DRIVER_VERSION );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (has_opengl()) return &glxdrv_wgl_funcs;
|
||||
if (has_opengl()) return &opengl_funcs;
|
||||
|
||||
dev = GET_NEXT_PHYSDEV( dev, wine_get_wgl_driver );
|
||||
return dev->funcs->wine_get_wgl_driver( dev, version );
|
||||
|
@ -3553,18 +3550,20 @@ static const struct gdi_dc_funcs glxdrv_funcs =
|
|||
GDI_PRIORITY_GRAPHICS_DRV + 20 /* priority */
|
||||
};
|
||||
|
||||
static const struct wgl_funcs glxdrv_wgl_funcs =
|
||||
static struct opengl_funcs opengl_funcs =
|
||||
{
|
||||
glxdrv_GetPixelFormat, /* p_GetPixelFormat */
|
||||
glxdrv_wglCopyContext, /* p_wglCopyContext */
|
||||
glxdrv_wglCreateContext, /* p_wglCreateContext */
|
||||
glxdrv_wglCreateContextAttribsARB, /* p_wglCreateContextAttribsARB */
|
||||
glxdrv_wglDeleteContext, /* p_wglDeleteContext */
|
||||
glxdrv_wglGetCurrentDC, /* p_wglGetCurrentDC */
|
||||
glxdrv_wglGetProcAddress, /* p_wglGetProcAddress */
|
||||
glxdrv_wglMakeContextCurrentARB, /* p_wglMakeContextCurrentARB */
|
||||
glxdrv_wglMakeCurrent, /* p_wglMakeCurrent */
|
||||
glxdrv_wglShareLists, /* p_wglShareLists */
|
||||
{
|
||||
glxdrv_wglCopyContext, /* p_wglCopyContext */
|
||||
glxdrv_wglCreateContext, /* p_wglCreateContext */
|
||||
glxdrv_wglCreateContextAttribsARB, /* p_wglCreateContextAttribsARB */
|
||||
glxdrv_wglDeleteContext, /* p_wglDeleteContext */
|
||||
glxdrv_wglGetCurrentDC, /* p_wglGetCurrentDC */
|
||||
glxdrv_wglGetPixelFormat, /* p_wglGetPixelFormat */
|
||||
glxdrv_wglGetProcAddress, /* p_wglGetProcAddress */
|
||||
glxdrv_wglMakeContextCurrentARB, /* p_wglMakeContextCurrentARB */
|
||||
glxdrv_wglMakeCurrent, /* p_wglMakeCurrent */
|
||||
glxdrv_wglShareLists, /* p_wglShareLists */
|
||||
}
|
||||
};
|
||||
|
||||
const struct gdi_dc_funcs *get_glx_driver(void)
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#define __WINE_WINE_GDI_DRIVER_H
|
||||
|
||||
struct gdi_dc_funcs;
|
||||
struct wgl_funcs;
|
||||
struct opengl_funcs;
|
||||
|
||||
typedef struct gdi_physdev
|
||||
{
|
||||
|
@ -191,14 +191,14 @@ struct gdi_dc_funcs
|
|||
BOOL (*pSwapBuffers)(PHYSDEV);
|
||||
BOOL (*pUnrealizePalette)(HPALETTE);
|
||||
BOOL (*pWidenPath)(PHYSDEV);
|
||||
const struct wgl_funcs * (*wine_get_wgl_driver)(PHYSDEV,UINT);
|
||||
struct opengl_funcs * (*wine_get_wgl_driver)(PHYSDEV,UINT);
|
||||
|
||||
/* priority order for the driver on the stack */
|
||||
UINT priority;
|
||||
};
|
||||
|
||||
/* increment this when you change the DC function table */
|
||||
#define WINE_GDI_DRIVER_VERSION 41
|
||||
#define WINE_GDI_DRIVER_VERSION 42
|
||||
|
||||
#define GDI_PRIORITY_NULL_DRV 0 /* null driver */
|
||||
#define GDI_PRIORITY_FONT_DRV 100 /* any font driver */
|
||||
|
@ -224,24 +224,6 @@ static inline void push_dc_driver( PHYSDEV *dev, PHYSDEV physdev, const struct g
|
|||
*dev = physdev;
|
||||
}
|
||||
|
||||
/* OpenGL support */
|
||||
|
||||
struct wgl_context;
|
||||
|
||||
struct wgl_funcs
|
||||
{
|
||||
INT (*p_GetPixelFormat)(HDC);
|
||||
BOOL (*p_wglCopyContext)(struct wgl_context*,struct wgl_context*,UINT);
|
||||
struct wgl_context* (*p_wglCreateContext)(HDC);
|
||||
struct wgl_context* (*p_wglCreateContextAttribsARB)(HDC,struct wgl_context*,const int*);
|
||||
void (*p_wglDeleteContext)(struct wgl_context*);
|
||||
HDC (*p_wglGetCurrentDC)(struct wgl_context*);
|
||||
PROC (*p_wglGetProcAddress)(LPCSTR);
|
||||
BOOL (*p_wglMakeContextCurrentARB)(HDC,HDC,struct wgl_context*);
|
||||
BOOL (*p_wglMakeCurrent)(HDC,struct wgl_context*);
|
||||
BOOL (*p_wglShareLists)(struct wgl_context*,struct wgl_context*);
|
||||
};
|
||||
|
||||
/* the DC hook support is only exported on Win16, the 32-bit version is a Wine extension */
|
||||
|
||||
#define DCHC_INVALIDVISRGN 0x0001
|
||||
|
@ -257,6 +239,6 @@ WINGDIAPI WORD WINAPI SetHookFlags(HDC,WORD);
|
|||
|
||||
extern void CDECL __wine_make_gdi_object_system( HGDIOBJ handle, BOOL set );
|
||||
extern void CDECL __wine_set_visible_region( HDC hdc, HRGN hrgn, const RECT *vis_rect );
|
||||
extern const struct wgl_funcs * CDECL __wine_get_wgl_driver( HDC hdc, UINT version );
|
||||
extern struct opengl_funcs * CDECL __wine_get_wgl_driver( HDC hdc, UINT version );
|
||||
|
||||
#endif /* __WINE_WINE_GDI_DRIVER_H */
|
||||
|
|
|
@ -7,10 +7,26 @@
|
|||
#define WINE_GLAPI
|
||||
#endif
|
||||
|
||||
#define WINE_WGL_DRIVER_VERSION 1
|
||||
#define WINE_WGL_DRIVER_VERSION 2
|
||||
|
||||
struct wgl_context;
|
||||
|
||||
struct opengl_funcs
|
||||
{
|
||||
struct
|
||||
{
|
||||
BOOL (WINE_GLAPI *p_wglCopyContext)(struct wgl_context *,struct wgl_context *,UINT);
|
||||
struct wgl_context * (WINE_GLAPI *p_wglCreateContext)(HDC);
|
||||
struct wgl_context * (WINE_GLAPI *p_wglCreateContextAttribsARB)(HDC,struct wgl_context *,const int *);
|
||||
void (WINE_GLAPI *p_wglDeleteContext)(struct wgl_context *);
|
||||
HDC (WINE_GLAPI *p_wglGetCurrentDC)(struct wgl_context *);
|
||||
INT (WINE_GLAPI *p_wglGetPixelFormat)(HDC);
|
||||
PROC (WINE_GLAPI *p_wglGetProcAddress)(LPCSTR);
|
||||
BOOL (WINE_GLAPI *p_wglMakeContextCurrentARB)(HDC,HDC,struct wgl_context *);
|
||||
BOOL (WINE_GLAPI *p_wglMakeCurrent)(HDC,struct wgl_context *);
|
||||
BOOL (WINE_GLAPI *p_wglShareLists)(struct wgl_context *,struct wgl_context *);
|
||||
} wgl;
|
||||
|
||||
struct
|
||||
{
|
||||
void (WINE_GLAPI *p_glAccum)(GLenum,GLfloat);
|
||||
|
@ -2758,4 +2774,6 @@ struct opengl_funcs
|
|||
USE_GL_FUNC(glVertexPointer) \
|
||||
USE_GL_FUNC(glViewport)
|
||||
|
||||
extern struct opengl_funcs * CDECL __wine_get_wgl_driver( HDC hdc, UINT version );
|
||||
|
||||
#endif /* __WINE_WGL_DRIVER_H */
|
||||
|
|
Loading…
Reference in New Issue