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>) {
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,
},
......
......@@ -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