Commit 1b9455e6 authored by Alexandre Julliard's avatar Alexandre Julliard

opengl32: Add supported wgl extension functions to the OpenGL function table.

parent 4c077900
......@@ -5,12 +5,12 @@ use strict;
#
# make_opengl [opengl_version]
#
# - It needs the gl.spec and gl.tm files in the current directory.
# These files are hosted in the OpenGL extension registry at
# opengl.org:
# - It needs files from the OpenGL extension registry:
#
# http://www.opengl.org/registry/api/gl.spec
# http://www.opengl.org/registry/api/gl.tm
# http://www.opengl.org/registry/api/wgl.tm
# http://www.opengl.org/registry/api/wglext.spec
#
# If they are not found in the current directory the script will
# attempt to download them from there.
......@@ -139,8 +139,19 @@ my %debug_conv =
"GLDEBUGPROCARB" => "%p",
"GLDEBUGPROCAMD" => "%p",
"GLvdpauSurfaceNV" => "%ld",
"int" => "%d",
"unsigned int" => "%u",
"UINT" => "%u",
"DWORD" => "%u",
"BOOL" => "%u",
"INT64" => "%s,wine_dbgstr_longlong(%s)",
"UINT64" => "%s,wine_dbgstr_longlong(%s)"
"UINT64" => "%s,wine_dbgstr_longlong(%s)",
"LPVOID" => "%p",
"HANDLE" => "%p",
"HDC" => "%p",
"HGLRC" => "%p",
"HPBUFFERARB" => "%p",
"HPBUFFEREXT" => "%p",
);
#
......@@ -191,8 +202,12 @@ sub ConvertType($)
"GLvdpauSurfaceNV" => "INT_PTR",
"struct _cl_context" => "void",
"struct _cl_event" => "void",
"HGLRC" => "struct wgl_context *",
"GLDEBUGPROCARB" => "void *",
"GLDEBUGPROCAMD" => "void *" );
"GLDEBUGPROCAMD" => "void *",
"HPBUFFERARB" => "HANDLE",
"HPBUFFEREXT" => "HANDLE",
);
foreach my $org (reverse sort keys %hash) {
if ($type =~ /$org/) {
......@@ -235,6 +250,7 @@ sub GenerateThunk($$$$)
return "" if $name eq "glDebugEntry";
return "" if $name eq "glGetString";
return "" if $func_ref->[2] && $func_ref->[2] =~ /WGL_/;
# If for opengl_norm.c, generate a nice heading otherwise Patrik won't be happy :-)
# Patrik says: Well I would be even happier if a (OPENGL32.@) was added as well. Done. :-)
......@@ -360,6 +376,13 @@ sub get_func_proto($$)
return $ret;
}
sub get_func_link_name($$)
{
my ($name, $func) = @_;
return $name if ($func->[2] =~ /^WGL_/);
return "wine_$name";
}
#
# Extract and checks the number of arguments
#
......@@ -390,24 +413,31 @@ if ($version eq "1.0") {
#
-f "gl.spec" || system "wget http://www.opengl.org/registry/api/gl.spec" || die "cannot download gl.spec";
-f "gl.tm" || system "wget http://www.opengl.org/registry/api/gl.tm" || die "cannot download gl.tm";
#
# Open the registry files
#
open(TYPES, "gl.tm") || die "Could not open gl.tm";
open(REGISTRY, "gl.spec") || die "Could not open gl.spec";
-f "wgl.tm" || system "wget http://www.opengl.org/registry/api/wgl.tm" || die "cannot download wgl.tm";
-f "wglext.spec" || system "wget http://www.opengl.org/registry/api/wglext.spec" || die "cannot download wglext.spec";
#
# First, create a mapping between the pseudo types used in the spec file
# and OpenGL types using the 'gl.tm' file.
#
my %pseudo_to_opengl = ();
while (my $line = <TYPES>) {
if ($line !~ /\w*\#/) {
my ($pseudo, $opengl) = ($line =~ /(\w*),\*,\*,\s*(.*),\*,\*/);
$pseudo_to_opengl{$pseudo} = $opengl;
sub load_types($)
{
my $file = shift;
open TYPES, "<$file" or die "Could not open $file";
while (my $line = <TYPES>) {
if ($line !~ /\w*\#/) {
my ($pseudo, $opengl) = ($line =~ /(\w*),\*,\*,\s*(.*),\*,\*/);
$pseudo_to_opengl{$pseudo} = $opengl;
}
}
close TYPES;
}
load_types( "wgl.tm" );
load_types( "gl.tm" );
# This is to override the 'void' -> '*' bogus conversion
$pseudo_to_opengl{"void"} = "void";
$pseudo_to_opengl{"sync"} = "GLvoid*";
......@@ -579,7 +609,9 @@ my %ext_functions =
[ "GLvoid *", "pointer" ] ], "GL_SGIS_multitexture" ],
"glSelectTextureSGIS" => [ "void", [ [ "GLenum", "target" ] ], "GL_SGIS_multitexture" ],
"glSelectTextureCoordSetSGIS" => [ "void", [ [ "GLenum", "target" ] ], "GL_SGIS_multitexture" ],
"glDeleteObjectBufferATI" => [ "void", [ [ "GLuint", "buffer" ] ], "GL_ATI_vertex_array_object" ]
"glDeleteObjectBufferATI" => [ "void", [ [ "GLuint", "buffer" ] ], "GL_ATI_vertex_array_object" ],
"wglSetPixelFormatWINE" => [ "BOOL", [ [ "HDC", "hdc" ],
[ "int", "format" ] ], "WGL_WINE_pixel_format_passthrough" ],
);
......@@ -589,26 +621,39 @@ my %wgl_functions =
[ "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>) {
if ($line =~ /^\w*\(.*\)/) {
my %supported_wgl_extensions =
(
"WGL_ARB_create_context" => 1,
"WGL_ARB_extensions_string" => 1,
"WGL_ARB_make_current_read" => 1,
"WGL_ARB_pbuffer" => 1,
"WGL_ARB_pixel_format" => 1,
"WGL_ARB_render_texture" => 1,
"WGL_EXT_extensions_string" => 1,
"WGL_EXT_swap_control" => 1,
"WGL_NV_vertex_array_range" => 1,
"WGL_WINE_pixel_format_passthrough" => 1,
);
sub parse_registry_file($)
{
my $file = shift;
my @arg_names;
my %arg_types;
open REGISTRY, "<$file" or die "cannot open $file";
while (my $line = <REGISTRY>) {
next unless ($line =~ /^\w*\(.*\)/);
# Get the function name (NOTE: the 'gl' prefix needs to be added later)
my ($funcname, $args) = ($line =~ /^(\w*)\((.*)\)/);
# and the argument names
......@@ -692,17 +737,19 @@ while (my $line = <REGISTRY>) {
# Now, put in one or the other hash table
if ($norm_categories{$category}) {
$norm_functions{"gl$funcname"} = [ $ret_type, $arg_ref ];
} elsif ($file =~ /^wgl/) {
if (defined $supported_wgl_extensions{"WGL_$category"}) {
$ext_functions{"wgl$funcname"} = [ $ret_type, $arg_ref, "WGL_$category" ];
}
} else {
$ext_functions{"gl$funcname"} = [ $ret_type, $arg_ref, "GL_$category" ];
}
}
close REGISTRY;
}
#
# Clean up the input files
#
close(TYPES);
close(REGISTRY);
parse_registry_file( "gl.spec" );
parse_registry_file( "wglext.spec" );
#
# Get the current wgl_driver.h version
......@@ -866,6 +913,8 @@ print EXT "
#include <stdarg.h>
#include \"opengl_ext.h\"
#include \"winternl.h\"
#define WGL_WGLEXT_PROTOTYPES
#include \"wine/wglext.h\"
#include \"wine/wgl_driver.h\"
#include \"wine/debug.h\"
......@@ -876,18 +925,18 @@ WINE_DEFAULT_DEBUG_CHANNEL(opengl);
# The thunks themselves....
my $count = keys %ext_functions;
print EXT "const int extension_registry_size = $count;\n";
print EXT "\n/* The thunks themselves....*/";
foreach (sort keys %ext_functions) {
print EXT "\nstatic ", GenerateThunk($_, $ext_functions{$_}, 0, "ext");
my $string = GenerateThunk($_, $ext_functions{$_}, 0, "ext");
print EXT "\nstatic $string" if $string;
}
# Then the table giving the string <-> function correspondence */
print EXT "\n\n/* The table giving the correspondence between names and functions */\n";
print EXT "const OpenGL_extension extension_registry[$count] = {\n";
print EXT "\nconst OpenGL_extension extension_registry[$count] = {\n";
my $i = 0;
foreach (sort keys %ext_functions) {
my $func_ref = $ext_functions{$_};
print EXT " { \"$_\", \"$func_ref->[2]\", wine_$_ }";
my $link_name = get_func_link_name( $_, $func_ref );
print EXT " { \"$_\", \"$func_ref->[2]\", $link_name }";
if ($i != $count-1) {
print EXT ",";
}
......
......@@ -5,14 +5,15 @@
#include <stdarg.h>
#include "opengl_ext.h"
#include "winternl.h"
#define WGL_WGLEXT_PROTOTYPES
#include "wine/wglext.h"
#include "wine/wgl_driver.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(opengl);
const int extension_registry_size = 2064;
const int extension_registry_size = 2085;
/* The thunks themselves....*/
static void WINAPI wine_glActiveProgramEXT( GLuint program ) {
const struct opengl_funcs *funcs = NtCurrentTeb()->glTable;
TRACE("(%d)\n", program );
......@@ -12397,9 +12398,7 @@ static void WINAPI wine_glWriteMaskEXT( GLuint res, GLuint in, GLenum outX, GLen
funcs->ext.p_glWriteMaskEXT( res, in, outX, outY, outZ, outW );
}
/* The table giving the correspondence between names and functions */
const OpenGL_extension extension_registry[2064] = {
const OpenGL_extension extension_registry[2085] = {
{ "glActiveProgramEXT", "GL_EXT_separate_shader_objects", wine_glActiveProgramEXT },
{ "glActiveShaderProgram", "GL_ARB_separate_shader_objects", wine_glActiveShaderProgram },
{ "glActiveStencilFaceEXT", "GL_EXT_stencil_two_side", wine_glActiveStencilFaceEXT },
......@@ -14463,5 +14462,26 @@ const OpenGL_extension extension_registry[2064] = {
{ "glWindowPos4ivMESA", "GL_MESA_window_pos", wine_glWindowPos4ivMESA },
{ "glWindowPos4sMESA", "GL_MESA_window_pos", wine_glWindowPos4sMESA },
{ "glWindowPos4svMESA", "GL_MESA_window_pos", wine_glWindowPos4svMESA },
{ "glWriteMaskEXT", "GL_EXT_vertex_shader", wine_glWriteMaskEXT }
{ "glWriteMaskEXT", "GL_EXT_vertex_shader", wine_glWriteMaskEXT },
{ "wglAllocateMemoryNV", "WGL_NV_vertex_array_range", wglAllocateMemoryNV },
{ "wglBindTexImageARB", "WGL_ARB_render_texture", wglBindTexImageARB },
{ "wglChoosePixelFormatARB", "WGL_ARB_pixel_format", wglChoosePixelFormatARB },
{ "wglCreateContextAttribsARB", "WGL_ARB_create_context", wglCreateContextAttribsARB },
{ "wglCreatePbufferARB", "WGL_ARB_pbuffer", wglCreatePbufferARB },
{ "wglDestroyPbufferARB", "WGL_ARB_pbuffer", wglDestroyPbufferARB },
{ "wglFreeMemoryNV", "WGL_NV_vertex_array_range", wglFreeMemoryNV },
{ "wglGetCurrentReadDCARB", "WGL_ARB_make_current_read", wglGetCurrentReadDCARB },
{ "wglGetExtensionsStringARB", "WGL_ARB_extensions_string", wglGetExtensionsStringARB },
{ "wglGetExtensionsStringEXT", "WGL_EXT_extensions_string", wglGetExtensionsStringEXT },
{ "wglGetPbufferDCARB", "WGL_ARB_pbuffer", wglGetPbufferDCARB },
{ "wglGetPixelFormatAttribfvARB", "WGL_ARB_pixel_format", wglGetPixelFormatAttribfvARB },
{ "wglGetPixelFormatAttribivARB", "WGL_ARB_pixel_format", wglGetPixelFormatAttribivARB },
{ "wglGetSwapIntervalEXT", "WGL_EXT_swap_control", wglGetSwapIntervalEXT },
{ "wglMakeContextCurrentARB", "WGL_ARB_make_current_read", wglMakeContextCurrentARB },
{ "wglQueryPbufferARB", "WGL_ARB_pbuffer", wglQueryPbufferARB },
{ "wglReleasePbufferDCARB", "WGL_ARB_pbuffer", wglReleasePbufferDCARB },
{ "wglReleaseTexImageARB", "WGL_ARB_render_texture", wglReleaseTexImageARB },
{ "wglSetPbufferAttribARB", "WGL_ARB_render_texture", wglSetPbufferAttribARB },
{ "wglSetPixelFormatWINE", "WGL_WINE_pixel_format_passthrough", wglSetPixelFormatWINE },
{ "wglSwapIntervalEXT", "WGL_EXT_swap_control", wglSwapIntervalEXT }
};
......@@ -36,6 +36,7 @@
#define WINAPI __stdcall
#define APIENTRY WINAPI
#include "windef.h"
typedef struct {
const char *name; /* name of the extension */
......@@ -46,4 +47,6 @@ typedef struct {
extern const OpenGL_extension extension_registry[];
extern const int extension_registry_size;
extern BOOL WINAPI wglSetPixelFormatWINE( HDC hdc, int format );
#endif /* __DLLS_OPENGL32_OPENGL_EXT_H */
......@@ -3026,12 +3026,10 @@ void WINAPI wine_glViewport( GLint x, GLint y, GLsizei width, GLsizei 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 ) { }
......@@ -3376,12 +3374,10 @@ 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,
},
......
......@@ -39,6 +39,8 @@
#undef near
#include <GL/glu.h>
#endif
#define WGL_WGLEXT_PROTOTYPES
#include "wine/wglext.h"
#include "wine/gdi_driver.h"
#include "wine/wgl_driver.h"
#include "wine/library.h"
......@@ -262,18 +264,20 @@ BOOL WINAPI wglMakeCurrent(HDC hdc, HGLRC hglrc)
}
/***********************************************************************
* wglCreateContextAttribsARB (wrapper for the extension function returned by the driver)
* wglCreateContextAttribsARB
*
* Provided by the WGL_ARB_create_context extension.
*/
static HGLRC WINAPI wglCreateContextAttribsARB( HDC hdc, HGLRC share, const int *attribs )
HGLRC WINAPI wglCreateContextAttribsARB( HDC hdc, HGLRC share, const int *attribs )
{
HGLRC ret = 0;
struct wgl_context *context;
struct wgl_handle *share_ptr = NULL;
struct opengl_funcs *funcs = get_dc_funcs( hdc );
if (!funcs) return 0;
if (!funcs || !funcs->ext.p_wglCreateContextAttribsARB) return 0;
if (share && !(share_ptr = get_handle_ptr( share ))) return 0;
if ((context = funcs->wgl.p_wglCreateContextAttribsARB( hdc, share_ptr ? share_ptr->context : NULL,
if ((context = funcs->ext.p_wglCreateContextAttribsARB( hdc, share_ptr ? share_ptr->context : NULL,
attribs )))
{
ret = alloc_handle( context, funcs );
......@@ -285,9 +289,11 @@ static HGLRC WINAPI wglCreateContextAttribsARB( HDC hdc, HGLRC share, const int
}
/***********************************************************************
* wglMakeContextCurrentARB (wrapper for the extension function returned by the driver)
* wglMakeContextCurrentARB
*
* Provided by the WGL_ARB_make_current_read extension.
*/
static BOOL WINAPI wglMakeContextCurrentARB( HDC draw_hdc, HDC read_hdc, HGLRC hglrc )
BOOL WINAPI wglMakeContextCurrentARB( HDC draw_hdc, HDC read_hdc, HGLRC hglrc )
{
BOOL ret = TRUE;
struct wgl_handle *ptr, *prev = get_current_handle_ptr();
......@@ -297,7 +303,8 @@ 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->wgl.p_wglMakeContextCurrentARB( draw_hdc, read_hdc, ptr->context );
ret = (ptr->funcs->ext.p_wglMakeContextCurrentARB &&
ptr->funcs->ext.p_wglMakeContextCurrentARB( draw_hdc, read_hdc, ptr->context ));
if (ret)
{
if (prev) prev->tid = 0;
......@@ -324,6 +331,19 @@ static BOOL WINAPI wglMakeContextCurrentARB( HDC draw_hdc, HDC read_hdc, HGLRC h
}
/***********************************************************************
* wglGetCurrentReadDCARB
*
* Provided by the WGL_ARB_make_current_read extension.
*/
HDC WINAPI wglGetCurrentReadDCARB(void)
{
const struct opengl_funcs *funcs = NtCurrentTeb()->glTable;
if (!funcs->ext.p_wglGetCurrentReadDCARB) return 0;
return funcs->ext.p_wglGetCurrentReadDCARB();
}
/***********************************************************************
* wglShareLists (OPENGL32.@)
*/
BOOL WINAPI wglShareLists(HGLRC hglrcSrc, HGLRC hglrcDst)
......@@ -666,16 +686,13 @@ static BOOL is_extension_supported(const char* extension)
return FALSE;
}
static const OpenGL_extension wgl_extensions[] =
{
{ "wglCreateContextAttribsARB", "WGL_ARB_create_context", wglCreateContextAttribsARB },
{ "wglMakeContextCurrentARB", "WGL_ARB_make_current_read", wglMakeContextCurrentARB },
};
/***********************************************************************
* wglGetProcAddress (OPENGL32.@)
*/
PROC WINAPI wglGetProcAddress(LPCSTR lpszProc) {
PROC WINAPI wglGetProcAddress(LPCSTR lpszProc)
{
struct opengl_funcs *funcs = NtCurrentTeb()->glTable;
void **func_ptr;
void *local_func;
OpenGL_extension ext;
const OpenGL_extension *ext_ret;
......@@ -699,30 +716,15 @@ PROC WINAPI wglGetProcAddress(LPCSTR lpszProc) {
ext.name = lpszProc;
ext_ret = bsearch(&ext, extension_registry, extension_registry_size,
sizeof(OpenGL_extension), compar);
if (!ext_ret)
{
WARN("Extension '%s' not defined in opengl32.dll's function table!\n", lpszProc);
return NULL;
}
/* If nothing was found, we are looking for a WGL extension or an unknown GL extension. */
if (ext_ret == NULL) {
/* If the function name starts with a 'w', it is a WGL extension */
if(lpszProc[0] == 'w')
{
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]),
sizeof(OpenGL_extension), compar );
if (ext_ret) return ext_ret->func;
FIXME( "wrapper missing for %s\n", lpszProc );
return NULL;
}
return local_func;
}
/* We are dealing with an unknown GL extension */
WARN("Extension '%s' not defined in opengl32.dll's function table!\n", lpszProc);
return NULL;
} else { /* We are looking for an OpenGL extension */
func_ptr = (void **)&funcs->ext + (ext_ret - extension_registry);
if (!*func_ptr)
{
/* Check if the GL extension required by the function is available */
if(!is_extension_supported(ext_ret->extension)) {
WARN("Extension '%s' required by function '%s' not supported!\n", ext_ret->extension, lpszProc);
......@@ -754,13 +756,12 @@ PROC WINAPI wglGetProcAddress(LPCSTR lpszProc) {
}
return ret;
} else {
struct opengl_funcs *funcs = NtCurrentTeb()->glTable;
*((void **)&funcs->ext + (ext_ret - extension_registry)) = local_func;
TRACE("returning function (%p)\n", ext_ret->func);
return ext_ret->func;
}
*func_ptr = local_func;
}
TRACE("returning function (%p)\n", ext_ret->func);
return ext_ret->func;
}
/***********************************************************************
......@@ -807,6 +808,249 @@ BOOL WINAPI wglSwapLayerBuffers(HDC hdc,
}
/***********************************************************************
* wglAllocateMemoryNV
*
* Provided by the WGL_NV_vertex_array_range extension.
*/
void * WINAPI wglAllocateMemoryNV( GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority )
{
const struct opengl_funcs *funcs = NtCurrentTeb()->glTable;
if (!funcs->ext.p_wglAllocateMemoryNV) return NULL;
return funcs->ext.p_wglAllocateMemoryNV( size, readfreq, writefreq, priority );
}
/***********************************************************************
* wglFreeMemoryNV
*
* Provided by the WGL_NV_vertex_array_range extension.
*/
void WINAPI wglFreeMemoryNV( void *pointer )
{
const struct opengl_funcs *funcs = NtCurrentTeb()->glTable;
if (funcs->ext.p_wglFreeMemoryNV) funcs->ext.p_wglFreeMemoryNV( pointer );
}
/***********************************************************************
* wglBindTexImageARB
*
* Provided by the WGL_ARB_render_texture extension.
*/
BOOL WINAPI wglBindTexImageARB( HPBUFFERARB handle, int buffer )
{
/* FIXME: get functions from pbuffer handle */
const struct opengl_funcs *funcs = NtCurrentTeb()->glTable;
if (!funcs->ext.p_wglBindTexImageARB) return FALSE;
return funcs->ext.p_wglBindTexImageARB( handle, buffer );
}
/***********************************************************************
* wglReleaseTexImageARB
*
* Provided by the WGL_ARB_render_texture extension.
*/
BOOL WINAPI wglReleaseTexImageARB( HPBUFFERARB handle, int buffer )
{
/* FIXME: get functions from pbuffer handle */
const struct opengl_funcs *funcs = NtCurrentTeb()->glTable;
if (!funcs->ext.p_wglReleaseTexImageARB) return FALSE;
return funcs->ext.p_wglReleaseTexImageARB( handle, buffer );
}
/***********************************************************************
* wglSetPbufferAttribARB
*
* Provided by the WGL_ARB_render_texture extension.
*/
BOOL WINAPI wglSetPbufferAttribARB( HPBUFFERARB handle, const int *attribs )
{
/* FIXME: get functions from pbuffer handle */
const struct opengl_funcs *funcs = NtCurrentTeb()->glTable;
if (!funcs->ext.p_wglSetPbufferAttribARB) return FALSE;
return funcs->ext.p_wglSetPbufferAttribARB( handle, attribs );
}
/***********************************************************************
* wglChoosePixelFormatARB
*
* Provided by the WGL_ARB_pixel_format extension.
*/
BOOL WINAPI wglChoosePixelFormatARB( HDC hdc, const int *iattribs, const FLOAT *fattribs,
UINT max, int *formats, UINT *count )
{
const struct opengl_funcs *funcs = get_dc_funcs( hdc );
if (!funcs || !funcs->ext.p_wglChoosePixelFormatARB) return FALSE;
return funcs->ext.p_wglChoosePixelFormatARB( hdc, iattribs, fattribs, max, formats, count );
}
/***********************************************************************
* wglGetPixelFormatAttribivARB
*
* Provided by the WGL_ARB_pixel_format extension.
*/
BOOL WINAPI wglGetPixelFormatAttribivARB( HDC hdc, int format, int layer, UINT count, const int *attribs,
int *values )
{
const struct opengl_funcs *funcs = get_dc_funcs( hdc );
if (!funcs || !funcs->ext.p_wglGetPixelFormatAttribivARB) return FALSE;
return funcs->ext.p_wglGetPixelFormatAttribivARB( hdc, format, layer, count, attribs, values );
}
/***********************************************************************
* wglGetPixelFormatAttribfvARB
*
* Provided by the WGL_ARB_pixel_format extension.
*/
BOOL WINAPI wglGetPixelFormatAttribfvARB( HDC hdc, int format, int layer, UINT count, const int *attribs,
FLOAT *values )
{
const struct opengl_funcs *funcs = get_dc_funcs( hdc );
if (!funcs || !funcs->ext.p_wglGetPixelFormatAttribfvARB) return FALSE;
return funcs->ext.p_wglGetPixelFormatAttribfvARB( hdc, format, layer, count, attribs, values );
}
/***********************************************************************
* wglCreatePbufferARB
*
* Provided by the WGL_ARB_pbuffer extension.
*/
HPBUFFERARB WINAPI wglCreatePbufferARB( HDC hdc, int format, int width, int height, const int *attribs )
{
const struct opengl_funcs *funcs = get_dc_funcs( hdc );
if (!funcs || !funcs->ext.p_wglCreatePbufferARB) return 0;
return funcs->ext.p_wglCreatePbufferARB( hdc, format, width, height, attribs );
}
/***********************************************************************
* wglGetPbufferDCARB
*
* Provided by the WGL_ARB_pbuffer extension.
*/
HDC WINAPI wglGetPbufferDCARB( HPBUFFERARB handle )
{
/* FIXME: get functions from pbuffer handle */
const struct opengl_funcs *funcs = NtCurrentTeb()->glTable;
if (!funcs->ext.p_wglGetPbufferDCARB) return 0;
return funcs->ext.p_wglGetPbufferDCARB( handle );
}
/***********************************************************************
* wglReleasePbufferDCARB
*
* Provided by the WGL_ARB_pbuffer extension.
*/
int WINAPI wglReleasePbufferDCARB( HPBUFFERARB handle, HDC hdc )
{
/* FIXME: get functions from pbuffer handle */
const struct opengl_funcs *funcs = get_dc_funcs( hdc );
if (!funcs || !funcs->ext.p_wglReleasePbufferDCARB) return 0;
return funcs->ext.p_wglReleasePbufferDCARB( handle, hdc );
}
/***********************************************************************
* wglDestroyPbufferARB
*
* Provided by the WGL_ARB_pbuffer extension.
*/
BOOL WINAPI wglDestroyPbufferARB( HPBUFFERARB handle )
{
/* FIXME: get functions from pbuffer handle */
const struct opengl_funcs *funcs = NtCurrentTeb()->glTable;
if (!funcs->ext.p_wglDestroyPbufferARB) return FALSE;
return funcs->ext.p_wglDestroyPbufferARB( handle );
}
/***********************************************************************
* wglQueryPbufferARB
*
* Provided by the WGL_ARB_pbuffer extension.
*/
BOOL WINAPI wglQueryPbufferARB( HPBUFFERARB handle, int attrib, int *value )
{
/* FIXME: get functions from pbuffer handle */
const struct opengl_funcs *funcs = NtCurrentTeb()->glTable;
if (!funcs->ext.p_wglQueryPbufferARB) return FALSE;
return funcs->ext.p_wglQueryPbufferARB( handle, attrib, value );
}
/***********************************************************************
* wglGetExtensionsStringARB
*
* Provided by the WGL_ARB_extensions_string extension.
*/
const char * WINAPI wglGetExtensionsStringARB( HDC hdc )
{
const struct opengl_funcs *funcs = get_dc_funcs( hdc );
if (!funcs || !funcs->ext.p_wglGetExtensionsStringARB) return NULL;
return (const char *)funcs->ext.p_wglGetExtensionsStringARB( hdc );
}
/***********************************************************************
* wglGetExtensionsStringEXT
*
* Provided by the WGL_EXT_extensions_string extension.
*/
const char * WINAPI wglGetExtensionsStringEXT(void)
{
const struct opengl_funcs *funcs = NtCurrentTeb()->glTable;
if (!funcs->ext.p_wglGetExtensionsStringEXT) return NULL;
return (const char *)funcs->ext.p_wglGetExtensionsStringEXT();
}
/***********************************************************************
* wglSwapIntervalEXT
*
* Provided by the WGL_EXT_swap_control extension.
*/
BOOL WINAPI wglSwapIntervalEXT( int interval )
{
const struct opengl_funcs *funcs = NtCurrentTeb()->glTable;
if (!funcs->ext.p_wglSwapIntervalEXT) return FALSE;
return funcs->ext.p_wglSwapIntervalEXT( interval );
}
/***********************************************************************
* wglGetSwapIntervalEXT
*
* Provided by the WGL_EXT_swap_control extension.
*/
int WINAPI wglGetSwapIntervalEXT(void)
{
const struct opengl_funcs *funcs = NtCurrentTeb()->glTable;
if (!funcs->ext.p_wglGetSwapIntervalEXT) return FALSE;
return funcs->ext.p_wglGetSwapIntervalEXT();
}
/***********************************************************************
* wglSetPixelFormatWINE
*
* Provided by the WGL_WINE_pixel_format_passthrough extension.
*/
BOOL WINAPI wglSetPixelFormatWINE( HDC hdc, int format )
{
const struct opengl_funcs *funcs = get_dc_funcs( hdc );
if (!funcs || !funcs->ext.p_wglSetPixelFormatWINE) return FALSE;
return funcs->ext.p_wglSetPixelFormatWINE( hdc, format );
}
/***********************************************************************
* wglUseFontBitmaps_common
*/
static BOOL wglUseFontBitmaps_common( HDC hdc, DWORD first, DWORD count, DWORD listBase, BOOL unicode )
......
......@@ -111,14 +111,6 @@ WINE_DECLARE_DEBUG_CHANNEL(fps);
#define GLX_FLOAT_COMPONENTS_NV 0x20B0
typedef struct wine_glextension {
const char *extName;
struct {
const char *funcName;
void *funcAddress;
} extEntryPoints[9];
} WineGLExtension;
struct WineGLInfo {
const char *glVersion;
char *glExtensions;
......@@ -216,10 +208,6 @@ static struct opengl_funcs opengl_funcs;
static const char *opengl_func_names[] = { ALL_WGL_FUNCS };
#undef USE_GL_FUNC
#define MAX_EXTENSIONS 16
static const WineGLExtension *WineGLExtensionList[MAX_EXTENSIONS];
static int WineGLExtensionListSize;
static void X11DRV_WineGL_LoadExtensions(void);
static WineGLPixelFormat* ConvertPixelFormatWGLtoGLX(Display *display, int iPixelFormat, BOOL AllowOffscreen, int *fmt_count);
static BOOL glxRequireVersion(int requiredVersion);
......@@ -1506,7 +1494,7 @@ static void glxdrv_wglDeleteContext(struct wgl_context *ctx)
*
* For OpenGL32 wglGetCurrentReadDCARB.
*/
static HDC WINAPI X11DRV_wglGetCurrentReadDCARB(void)
static HDC X11DRV_wglGetCurrentReadDCARB(void)
{
HDC ret = 0;
struct wgl_context *ctx = NtCurrentTeb()->glContext;
......@@ -1522,32 +1510,8 @@ static HDC WINAPI X11DRV_wglGetCurrentReadDCARB(void)
*/
static PROC glxdrv_wglGetProcAddress(LPCSTR lpszProc)
{
int i, j;
const WineGLExtension *ext;
int padding = 32 - strlen(lpszProc);
if (padding < 0)
padding = 0;
/* Check the table of WGL extensions to see if we need to return a WGL extension
* or a function pointer to a native OpenGL function. */
if(strncmp(lpszProc, "wgl", 3) != 0) {
return pglXGetProcAddressARB((const GLubyte*)lpszProc);
} else {
TRACE("('%s'):%*s", lpszProc, padding, " ");
for (i = 0; i < WineGLExtensionListSize; ++i) {
ext = WineGLExtensionList[i];
for (j = 0; ext->extEntryPoints[j].funcName; ++j) {
if (strcmp(ext->extEntryPoints[j].funcName, lpszProc) == 0) {
TRACE("(%p) - WineGL\n", ext->extEntryPoints[j].funcAddress);
return ext->extEntryPoints[j].funcAddress;
}
}
}
}
WARN("(%s) - not found\n", lpszProc);
return NULL;
if (!strncmp(lpszProc, "wgl", 3)) return NULL;
return pglXGetProcAddressARB((const GLubyte*)lpszProc);
}
static GLXPixmap get_context_pixmap( HDC hdc, struct wgl_context *ctx )
......@@ -1644,9 +1608,9 @@ static BOOL glxdrv_wglMakeCurrent(HDC hdc, struct wgl_context *ctx)
}
/***********************************************************************
* glxdrv_wglMakeContextCurrentARB
* X11DRV_wglMakeContextCurrentARB
*/
static BOOL glxdrv_wglMakeContextCurrentARB( HDC draw_hdc, HDC read_hdc, struct wgl_context *ctx )
static BOOL X11DRV_wglMakeContextCurrentARB( HDC draw_hdc, HDC read_hdc, struct wgl_context *ctx )
{
struct x11drv_escape_get_drawable escape_draw, escape_read;
BOOL ret;
......@@ -1883,9 +1847,9 @@ static void wglFlush(void)
}
/***********************************************************************
* glxdrv_wglCreateContextAttribsARB
* X11DRV_wglCreateContextAttribsARB
*/
static struct wgl_context *glxdrv_wglCreateContextAttribsARB( HDC hdc, struct wgl_context *hShareContext,
static struct wgl_context *X11DRV_wglCreateContextAttribsARB( HDC hdc, struct wgl_context *hShareContext,
const int* attribList )
{
struct x11drv_escape_get_drawable escape;
......@@ -1981,9 +1945,10 @@ static struct wgl_context *glxdrv_wglCreateContextAttribsARB( HDC hdc, struct wg
*
* WGL_ARB_extensions_string: wglGetExtensionsStringARB
*/
static const char * WINAPI X11DRV_wglGetExtensionsStringARB(HDC hdc) {
static const GLubyte *X11DRV_wglGetExtensionsStringARB(HDC hdc)
{
TRACE("() returning \"%s\"\n", WineGLInfo.wglExtensions);
return WineGLInfo.wglExtensions;
return (const GLubyte *)WineGLInfo.wglExtensions;
}
/**
......@@ -1991,7 +1956,8 @@ static const char * WINAPI X11DRV_wglGetExtensionsStringARB(HDC hdc) {
*
* WGL_ARB_pbuffer: wglCreatePbufferARB
*/
static HPBUFFERARB WINAPI X11DRV_wglCreatePbufferARB(HDC hdc, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList)
static HANDLE X11DRV_wglCreatePbufferARB( HDC hdc, int iPixelFormat, int iWidth, int iHeight,
const int *piAttribList )
{
Wine_GLPBuffer* object = NULL;
WineGLPixelFormat *fmt = NULL;
......@@ -2184,7 +2150,7 @@ create_failed:
*
* WGL_ARB_pbuffer: wglDestroyPbufferARB
*/
static GLboolean WINAPI X11DRV_wglDestroyPbufferARB(HPBUFFERARB hPbuffer)
static BOOL X11DRV_wglDestroyPbufferARB(HANDLE hPbuffer)
{
Wine_GLPBuffer* object = (Wine_GLPBuffer *)hPbuffer;
TRACE("(%p)\n", hPbuffer);
......@@ -2204,7 +2170,7 @@ static GLboolean WINAPI X11DRV_wglDestroyPbufferARB(HPBUFFERARB hPbuffer)
*
* WGL_ARB_pbuffer: wglGetPbufferDCARB
*/
static HDC WINAPI X11DRV_wglGetPbufferDCARB(HPBUFFERARB hPbuffer)
static HDC X11DRV_wglGetPbufferDCARB(HANDLE hPbuffer)
{
struct x11drv_escape_set_drawable escape;
Wine_GLPBuffer* object = (Wine_GLPBuffer *)hPbuffer;
......@@ -2237,7 +2203,7 @@ static HDC WINAPI X11DRV_wglGetPbufferDCARB(HPBUFFERARB hPbuffer)
*
* WGL_ARB_pbuffer: wglQueryPbufferARB
*/
static GLboolean WINAPI X11DRV_wglQueryPbufferARB(HPBUFFERARB hPbuffer, int iAttribute, int *piValue)
static BOOL X11DRV_wglQueryPbufferARB(HANDLE hPbuffer, int iAttribute, int *piValue)
{
Wine_GLPBuffer* object = (Wine_GLPBuffer *)hPbuffer;
TRACE("(%p, 0x%x, %p)\n", hPbuffer, iAttribute, piValue);
......@@ -2334,7 +2300,7 @@ static GLboolean WINAPI X11DRV_wglQueryPbufferARB(HPBUFFERARB hPbuffer, int iAtt
*
* WGL_ARB_pbuffer: wglReleasePbufferDCARB
*/
static int WINAPI X11DRV_wglReleasePbufferDCARB(HPBUFFERARB hPbuffer, HDC hdc)
static int X11DRV_wglReleasePbufferDCARB(HANDLE hPbuffer, HDC hdc)
{
TRACE("(%p, %p)\n", hPbuffer, hdc);
return DeleteDC(hdc);
......@@ -2345,7 +2311,7 @@ static int WINAPI X11DRV_wglReleasePbufferDCARB(HPBUFFERARB hPbuffer, HDC hdc)
*
* WGL_ARB_pbuffer: wglSetPbufferAttribARB
*/
static GLboolean WINAPI X11DRV_wglSetPbufferAttribARB(HPBUFFERARB hPbuffer, const int *piAttribList)
static BOOL X11DRV_wglSetPbufferAttribARB( HANDLE hPbuffer, const int *piAttribList )
{
Wine_GLPBuffer* object = (Wine_GLPBuffer *)hPbuffer;
GLboolean ret = GL_FALSE;
......@@ -2370,7 +2336,8 @@ static GLboolean WINAPI X11DRV_wglSetPbufferAttribARB(HPBUFFERARB hPbuffer, cons
*
* WGL_ARB_pixel_format: wglChoosePixelFormatARB
*/
static GLboolean WINAPI X11DRV_wglChoosePixelFormatARB(HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats)
static BOOL X11DRV_wglChoosePixelFormatARB( HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList,
UINT nMaxFormats, int *piFormats, UINT *nNumFormats )
{
int gl_test = 0;
int attribs[256];
......@@ -2477,7 +2444,8 @@ static GLboolean WINAPI X11DRV_wglChoosePixelFormatARB(HDC hdc, const int *piAtt
*
* WGL_ARB_pixel_format: wglGetPixelFormatAttribivARB
*/
static GLboolean WINAPI X11DRV_wglGetPixelFormatAttribivARB(HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues)
static BOOL X11DRV_wglGetPixelFormatAttribivARB( HDC hdc, int iPixelFormat, int iLayerPlane,
UINT nAttributes, const int *piAttributes, int *piValues )
{
UINT i;
WineGLPixelFormat *fmt = NULL;
......@@ -2726,7 +2694,8 @@ pix_error:
*
* WGL_ARB_pixel_format: wglGetPixelFormatAttribfvARB
*/
static GLboolean WINAPI X11DRV_wglGetPixelFormatAttribfvARB(HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues)
static BOOL X11DRV_wglGetPixelFormatAttribfvARB( HDC hdc, int iPixelFormat, int iLayerPlane,
UINT nAttributes, const int *piAttributes, FLOAT *pfValues )
{
int *attr;
int ret;
......@@ -2760,7 +2729,7 @@ static GLboolean WINAPI X11DRV_wglGetPixelFormatAttribfvARB(HDC hdc, int iPixelF
*
* WGL_ARB_render_texture: wglBindTexImageARB
*/
static GLboolean WINAPI X11DRV_wglBindTexImageARB(HPBUFFERARB hPbuffer, int iBuffer)
static BOOL X11DRV_wglBindTexImageARB(HANDLE hPbuffer, int iBuffer)
{
Wine_GLPBuffer* object = (Wine_GLPBuffer *)hPbuffer;
GLboolean ret = GL_FALSE;
......@@ -2823,7 +2792,7 @@ static GLboolean WINAPI X11DRV_wglBindTexImageARB(HPBUFFERARB hPbuffer, int iBuf
*
* WGL_ARB_render_texture: wglReleaseTexImageARB
*/
static GLboolean WINAPI X11DRV_wglReleaseTexImageARB(HPBUFFERARB hPbuffer, int iBuffer)
static BOOL X11DRV_wglReleaseTexImageARB(HANDLE hPbuffer, int iBuffer)
{
Wine_GLPBuffer* object = (Wine_GLPBuffer *)hPbuffer;
GLboolean ret = GL_FALSE;
......@@ -2848,9 +2817,10 @@ static GLboolean WINAPI X11DRV_wglReleaseTexImageARB(HPBUFFERARB hPbuffer, int i
*
* WGL_EXT_extensions_string: wglGetExtensionsStringEXT
*/
static const char * WINAPI X11DRV_wglGetExtensionsStringEXT(void) {
static const GLubyte *X11DRV_wglGetExtensionsStringEXT(void)
{
TRACE("() returning \"%s\"\n", WineGLInfo.wglExtensions);
return WineGLInfo.wglExtensions;
return (const GLubyte *)WineGLInfo.wglExtensions;
}
/**
......@@ -2858,7 +2828,8 @@ static const char * WINAPI X11DRV_wglGetExtensionsStringEXT(void) {
*
* WGL_EXT_swap_control: wglGetSwapIntervalEXT
*/
static int WINAPI X11DRV_wglGetSwapIntervalEXT(VOID) {
static int X11DRV_wglGetSwapIntervalEXT(void)
{
/* GLX_SGI_swap_control doesn't have any provisions for getting the swap
* interval, so the swap interval has to be tracked. */
TRACE("()\n");
......@@ -2870,7 +2841,8 @@ static int WINAPI X11DRV_wglGetSwapIntervalEXT(VOID) {
*
* WGL_EXT_swap_control: wglSwapIntervalEXT
*/
static BOOL WINAPI X11DRV_wglSwapIntervalEXT(int interval) {
static BOOL X11DRV_wglSwapIntervalEXT(int interval)
{
BOOL ret = TRUE;
TRACE("(%d)\n", interval);
......@@ -2909,45 +2881,12 @@ static BOOL WINAPI X11DRV_wglSwapIntervalEXT(int interval) {
}
/**
* X11DRV_wglAllocateMemoryNV
*
* WGL_NV_vertex_array_range: wglAllocateMemoryNV
*/
static void* WINAPI X11DRV_wglAllocateMemoryNV(GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority) {
void *ret = NULL;
TRACE("(%d, %f, %f, %f)\n", size, readfreq, writefreq, priority );
if (pglXAllocateMemoryNV)
{
wine_tsx11_lock();
ret = pglXAllocateMemoryNV(size, readfreq, writefreq, priority);
wine_tsx11_unlock();
}
return ret;
}
/**
* X11DRV_wglFreeMemoryNV
*
* WGL_NV_vertex_array_range: wglFreeMemoryNV
*/
static void WINAPI X11DRV_wglFreeMemoryNV(GLvoid* pointer) {
TRACE("(%p)\n", pointer);
if (pglXFreeMemoryNV == NULL)
return;
wine_tsx11_lock();
pglXFreeMemoryNV(pointer);
wine_tsx11_unlock();
}
/**
* X11DRV_wglSetPixelFormatWINE
*
* WGL_WINE_pixel_format_passthrough: wglSetPixelFormatWINE
* This is a WINE-specific wglSetPixelFormat which can set the pixel format multiple times.
*/
static BOOL WINAPI X11DRV_wglSetPixelFormatWINE(HDC hdc, int format)
static BOOL X11DRV_wglSetPixelFormatWINE(HDC hdc, int format)
{
WineGLPixelFormat *fmt;
int value;
......@@ -3006,7 +2945,7 @@ static BOOL glxRequireExtension(const char *requiredExtension)
return TRUE;
}
static void register_extension_string(const char *ext)
static void register_extension(const char *ext)
{
if (WineGLInfo.wglExtensions[0])
strcat(WineGLInfo.wglExtensions, " ");
......@@ -3015,117 +2954,6 @@ static void register_extension_string(const char *ext)
TRACE("'%s'\n", ext);
}
static BOOL register_extension(const WineGLExtension * ext)
{
int i;
assert( WineGLExtensionListSize < MAX_EXTENSIONS );
WineGLExtensionList[WineGLExtensionListSize++] = ext;
register_extension_string(ext->extName);
for (i = 0; ext->extEntryPoints[i].funcName; ++i)
TRACE(" - '%s'\n", ext->extEntryPoints[i].funcName);
return TRUE;
}
static const WineGLExtension WGL_ARB_create_context_extension =
{
"WGL_ARB_create_context",
{
{ "wglCreateContextAttribsARB", (void *)1 /* called through the glxdrv_wgl_funcs driver */ },
}
};
static const WineGLExtension WGL_ARB_extensions_string_extension =
{
"WGL_ARB_extensions_string",
{
{ "wglGetExtensionsStringARB", X11DRV_wglGetExtensionsStringARB },
}
};
static const WineGLExtension WGL_ARB_make_current_read_extension =
{
"WGL_ARB_make_current_read",
{
{ "wglGetCurrentReadDCARB", X11DRV_wglGetCurrentReadDCARB },
{ "wglMakeContextCurrentARB", (void *)1 /* called through the glxdrv_wgl_funcs driver */ },
}
};
static const WineGLExtension WGL_ARB_multisample_extension =
{
"WGL_ARB_multisample",
};
static const WineGLExtension WGL_ARB_pbuffer_extension =
{
"WGL_ARB_pbuffer",
{
{ "wglCreatePbufferARB", X11DRV_wglCreatePbufferARB },
{ "wglDestroyPbufferARB", X11DRV_wglDestroyPbufferARB },
{ "wglGetPbufferDCARB", X11DRV_wglGetPbufferDCARB },
{ "wglQueryPbufferARB", X11DRV_wglQueryPbufferARB },
{ "wglReleasePbufferDCARB", X11DRV_wglReleasePbufferDCARB },
{ "wglSetPbufferAttribARB", X11DRV_wglSetPbufferAttribARB },
}
};
static const WineGLExtension WGL_ARB_pixel_format_extension =
{
"WGL_ARB_pixel_format",
{
{ "wglChoosePixelFormatARB", X11DRV_wglChoosePixelFormatARB },
{ "wglGetPixelFormatAttribfvARB", X11DRV_wglGetPixelFormatAttribfvARB },
{ "wglGetPixelFormatAttribivARB", X11DRV_wglGetPixelFormatAttribivARB },
}
};
static const WineGLExtension WGL_ARB_render_texture_extension =
{
"WGL_ARB_render_texture",
{
{ "wglBindTexImageARB", X11DRV_wglBindTexImageARB },
{ "wglReleaseTexImageARB", X11DRV_wglReleaseTexImageARB },
}
};
static const WineGLExtension WGL_EXT_extensions_string_extension =
{
"WGL_EXT_extensions_string",
{
{ "wglGetExtensionsStringEXT", X11DRV_wglGetExtensionsStringEXT },
}
};
static const WineGLExtension WGL_EXT_swap_control_extension =
{
"WGL_EXT_swap_control",
{
{ "wglSwapIntervalEXT", X11DRV_wglSwapIntervalEXT },
{ "wglGetSwapIntervalEXT", X11DRV_wglGetSwapIntervalEXT },
}
};
static const WineGLExtension WGL_NV_vertex_array_range_extension =
{
"WGL_NV_vertex_array_range",
{
{ "wglAllocateMemoryNV", X11DRV_wglAllocateMemoryNV },
{ "wglFreeMemoryNV", X11DRV_wglFreeMemoryNV },
}
};
static const WineGLExtension WGL_WINE_pixel_format_passthrough_extension =
{
"WGL_WINE_pixel_format_passthrough",
{
{ "wglSetPixelFormatWINE", X11DRV_wglSetPixelFormatWINE },
}
};
/**
* X11DRV_WineGL_LoadExtensions
*/
......@@ -3137,76 +2965,102 @@ static void X11DRV_WineGL_LoadExtensions(void)
if(glxRequireExtension("GLX_ARB_create_context"))
{
register_extension(&WGL_ARB_create_context_extension);
register_extension( "WGL_ARB_create_context" );
opengl_funcs.ext.p_wglCreateContextAttribsARB = X11DRV_wglCreateContextAttribsARB;
if(glxRequireExtension("GLX_ARB_create_context_profile"))
register_extension_string("WGL_ARB_create_context_profile");
register_extension("WGL_ARB_create_context_profile");
}
if(glxRequireExtension("GLX_ARB_fbconfig_float"))
{
register_extension_string("WGL_ARB_pixel_format_float");
register_extension_string("WGL_ATI_pixel_format_float");
register_extension("WGL_ARB_pixel_format_float");
register_extension("WGL_ATI_pixel_format_float");
}
register_extension(&WGL_ARB_extensions_string_extension);
register_extension( "WGL_ARB_extensions_string" );
opengl_funcs.ext.p_wglGetExtensionsStringARB = X11DRV_wglGetExtensionsStringARB;
if (glxRequireVersion(3))
register_extension(&WGL_ARB_make_current_read_extension);
{
register_extension( "WGL_ARB_make_current_read" );
opengl_funcs.ext.p_wglGetCurrentReadDCARB = X11DRV_wglGetCurrentReadDCARB;
opengl_funcs.ext.p_wglMakeContextCurrentARB = X11DRV_wglMakeContextCurrentARB;
}
if (glxRequireExtension("GLX_ARB_multisample"))
register_extension(&WGL_ARB_multisample_extension);
if (glxRequireExtension("GLX_ARB_multisample")) register_extension( "WGL_ARB_multisample" );
/* In general pbuffer functionality requires support in the X-server. The functionality is
* available either when the GLX_SGIX_pbuffer is present or when the GLX server version is 1.3.
*/
if ( glxRequireVersion(3) && glxRequireExtension("GLX_SGIX_pbuffer") )
register_extension(&WGL_ARB_pbuffer_extension);
{
register_extension( "WGL_ARB_pbuffer" );
opengl_funcs.ext.p_wglCreatePbufferARB = X11DRV_wglCreatePbufferARB;
opengl_funcs.ext.p_wglDestroyPbufferARB = X11DRV_wglDestroyPbufferARB;
opengl_funcs.ext.p_wglGetPbufferDCARB = X11DRV_wglGetPbufferDCARB;
opengl_funcs.ext.p_wglQueryPbufferARB = X11DRV_wglQueryPbufferARB;
opengl_funcs.ext.p_wglReleasePbufferDCARB = X11DRV_wglReleasePbufferDCARB;
opengl_funcs.ext.p_wglSetPbufferAttribARB = X11DRV_wglSetPbufferAttribARB;
}
register_extension(&WGL_ARB_pixel_format_extension);
register_extension( "WGL_ARB_pixel_format" );
opengl_funcs.ext.p_wglChoosePixelFormatARB = X11DRV_wglChoosePixelFormatARB;
opengl_funcs.ext.p_wglGetPixelFormatAttribfvARB = X11DRV_wglGetPixelFormatAttribfvARB;
opengl_funcs.ext.p_wglGetPixelFormatAttribivARB = X11DRV_wglGetPixelFormatAttribivARB;
/* Support WGL_ARB_render_texture when there's support or pbuffer based emulation */
if (glxRequireExtension("GLX_ARB_render_texture") ||
(glxRequireVersion(3) && glxRequireExtension("GLX_SGIX_pbuffer") && use_render_texture_emulation))
{
register_extension(&WGL_ARB_render_texture_extension);
register_extension( "WGL_ARB_render_texture" );
opengl_funcs.ext.p_wglBindTexImageARB = X11DRV_wglBindTexImageARB;
opengl_funcs.ext.p_wglReleaseTexImageARB = X11DRV_wglReleaseTexImageARB;
/* The WGL version of GLX_NV_float_buffer requires render_texture */
if(glxRequireExtension("GLX_NV_float_buffer"))
register_extension_string("WGL_NV_float_buffer");
register_extension("WGL_NV_float_buffer");
/* Again there's no GLX equivalent for this extension, so depend on the required GL extension */
if(strstr(WineGLInfo.glExtensions, "GL_NV_texture_rectangle") != NULL)
register_extension_string("WGL_NV_texture_rectangle");
register_extension("WGL_NV_texture_rectangle");
}
/* EXT Extensions */
register_extension(&WGL_EXT_extensions_string_extension);
register_extension( "WGL_EXT_extensions_string" );
opengl_funcs.ext.p_wglGetExtensionsStringEXT = X11DRV_wglGetExtensionsStringEXT;
/* Load this extension even when it isn't backed by a GLX extension because it is has been around for ages.
* Games like Call of Duty and K.O.T.O.R. rely on it. Further our emulation is good enough. */
register_extension(&WGL_EXT_swap_control_extension);
register_extension( "WGL_EXT_swap_control" );
opengl_funcs.ext.p_wglSwapIntervalEXT = X11DRV_wglSwapIntervalEXT;
opengl_funcs.ext.p_wglGetSwapIntervalEXT = X11DRV_wglGetSwapIntervalEXT;
if(glxRequireExtension("GLX_EXT_framebuffer_sRGB"))
register_extension_string("WGL_EXT_framebuffer_sRGB");
register_extension("WGL_EXT_framebuffer_sRGB");
if(glxRequireExtension("GLX_EXT_fbconfig_packed_float"))
register_extension_string("WGL_EXT_pixel_format_packed_float");
register_extension("WGL_EXT_pixel_format_packed_float");
if (glxRequireExtension("GLX_EXT_swap_control"))
has_swap_control = TRUE;
/* The OpenGL extension GL_NV_vertex_array_range adds wgl/glX functions which aren't exported as 'real' wgl/glX extensions. */
if(strstr(WineGLInfo.glExtensions, "GL_NV_vertex_array_range") != NULL)
register_extension(&WGL_NV_vertex_array_range_extension);
{
register_extension( "WGL_NV_vertex_array_range" );
opengl_funcs.ext.p_wglAllocateMemoryNV = pglXAllocateMemoryNV;
opengl_funcs.ext.p_wglFreeMemoryNV = pglXFreeMemoryNV;
}
/* WINE-specific WGL Extensions */
/* In WineD3D we need the ability to set the pixel format more than once (e.g. after a device reset).
* The default wglSetPixelFormat doesn't allow this, so add our own which allows it.
*/
register_extension(&WGL_WINE_pixel_format_passthrough_extension);
register_extension( "WGL_WINE_pixel_format_passthrough" );
opengl_funcs.ext.p_wglSetPixelFormatWINE = X11DRV_wglSetPixelFormatWINE;
}
......@@ -3555,12 +3409,10 @@ static struct opengl_funcs opengl_funcs =
{
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 */
}
......
......@@ -7,7 +7,7 @@
#define WINE_GLAPI
#endif
#define WINE_WGL_DRIVER_VERSION 2
#define WINE_WGL_DRIVER_VERSION 3
struct wgl_context;
......@@ -17,12 +17,10 @@ struct opengl_funcs
{
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;
......@@ -2433,6 +2431,27 @@ struct opengl_funcs
void (WINE_GLAPI *p_glWindowPos4sMESA)(GLshort,GLshort,GLshort,GLshort);
void (WINE_GLAPI *p_glWindowPos4svMESA)(const GLshort*);
void (WINE_GLAPI *p_glWriteMaskEXT)(GLuint,GLuint,GLenum,GLenum,GLenum,GLenum);
GLvoid* (WINE_GLAPI *p_wglAllocateMemoryNV)(GLsizei,GLfloat,GLfloat,GLfloat);
BOOL (WINE_GLAPI *p_wglBindTexImageARB)(HANDLE,int);
BOOL (WINE_GLAPI *p_wglChoosePixelFormatARB)(HDC,const int*,const FLOAT*,UINT,int*,UINT*);
struct wgl_context * (WINE_GLAPI *p_wglCreateContextAttribsARB)(HDC,struct wgl_context *,const int*);
HANDLE (WINE_GLAPI *p_wglCreatePbufferARB)(HDC,int,int,int,const int*);
BOOL (WINE_GLAPI *p_wglDestroyPbufferARB)(HANDLE);
void (WINE_GLAPI *p_wglFreeMemoryNV)(void*);
HDC (WINE_GLAPI *p_wglGetCurrentReadDCARB)(void);
const GLubyte * (WINE_GLAPI *p_wglGetExtensionsStringARB)(HDC);
const GLubyte * (WINE_GLAPI *p_wglGetExtensionsStringEXT)(void);
HDC (WINE_GLAPI *p_wglGetPbufferDCARB)(HANDLE);
BOOL (WINE_GLAPI *p_wglGetPixelFormatAttribfvARB)(HDC,int,int,UINT,const int*,FLOAT*);
BOOL (WINE_GLAPI *p_wglGetPixelFormatAttribivARB)(HDC,int,int,UINT,const int*,int*);
int (WINE_GLAPI *p_wglGetSwapIntervalEXT)(void);
BOOL (WINE_GLAPI *p_wglMakeContextCurrentARB)(HDC,HDC,struct wgl_context *);
BOOL (WINE_GLAPI *p_wglQueryPbufferARB)(HANDLE,int,int*);
int (WINE_GLAPI *p_wglReleasePbufferDCARB)(HANDLE,HDC);
BOOL (WINE_GLAPI *p_wglReleaseTexImageARB)(HANDLE,int);
BOOL (WINE_GLAPI *p_wglSetPbufferAttribARB)(HANDLE,const int*);
BOOL (WINE_GLAPI *p_wglSetPixelFormatWINE)(HDC,int);
BOOL (WINE_GLAPI *p_wglSwapIntervalEXT)(int);
} ext;
};
......
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