Commit 15a4a77a authored by Lionel Ulmer's avatar Lionel Ulmer Committed by Alexandre Julliard

- add tracing to OpenGL thunks

- update to latest gl.spec file
parent 0c2885e1
......@@ -8,6 +8,8 @@
# spec files are located. These files are part of the OpenGL
# sample implementation CVS tree and are located in
# CVS_ROOT/projects/ogl-sample/main/doc/registry/specs.
# You can find them on the web at the following URL :
# http://oss.sgi.com/cgi-bin/cvsweb.cgi/projects/ogl-sample/main/doc/registry/specs/
#
# - opengl_version is the OpenGL version emulated by the library
# (can be 1.0 to 1.2).
......@@ -34,12 +36,95 @@
#
#
# Files to generate
#
$spec_file = "opengl32.spec";
$norm_file = "opengl_norm.c";
$ext_file = "opengl_ext.c";
# Set to 0 for removing the ENTER / LEAVE GL calls
$gen_thread_safe = 1;
# Prefix used for the local variables
$ext_prefix = "func_";
# If set to 1, generate TRACEs for each OpenGL function
$gen_traces = 1;
#
# List of categories to put in the 'opengl_norm.c' file
#
%cat_1_0 = ( "display-list" => 1,
"drawing" => 1,
"drawing-control" => 1,
"feedback" => 1,
"framebuf" => 1,
"misc" => 1,
"modeling" => 1,
"pixel-op" => 1,
"pixel-rw" => 1,
"state-req" => 1,
"xform" => 1 );
%cat_1_1 = ( %cat_1_0,
"1_1" => 1 );
%cat_1_2 = ( %cat_1_1,
"VERSION_1_2" => 1,
"ARB_multitexture" => 1 );
%norm_categories = ();
#
# This hash table gives the conversion between OpenGL types and what
# is used by the TRACE printfs
#
%debug_conv =
("GLbitfield" => "%d",
"GLboolean" => "%d",
"GLbyte" => "%d",
"GLclampd" => "%f",
"GLclampf" => "%f",
"GLdouble" => "%f",
"GLenum" => "%d",
"GLfloat" => "%f",
"GLint" => "%d",
"GLshort" => "%d",
"GLsizei" => "%d",
"GLstring" => "%s",
"GLubyte" => "%d",
"GLuint" => "%d",
"GLushort" => "%d",
"GLvoid" => "(void)",
"_GLfuncptr" => "%p");
#
# This hash table gives the conversion between OpenGL types and what
# is used in the .spec file
#
%arg_conv =
("GLbitfield" => [ "long", 4 ],
"GLboolean" => [ "long", 4 ],
"GLbyte" => [ "long", 4 ],
"GLclampd" => [ "double", 8 ],
"GLclampf" => [ "long", 4 ],
"GLdouble" => [ "double", 8 ],
"GLenum" => [ "long", 4 ],
"GLfloat" => [ "long", 4 ],
"GLint" => [ "long", 4 ],
"GLshort" => [ "long", 4 ],
"GLsizei" => [ "long", 4 ],
"GLstring" => [ "str", 4 ],
"GLubyte" => [ "long", 4 ],
"GLuint" => [ "long", 4 ],
"GLushort" => [ "long", 4 ],
"GLvoid" => [ "void", 4 ],
"_GLfuncptr" => [ "ptr", 4 ]);
#
# This functions generates the thunk for a given function.
#
sub GenerateThunk {
my ($func_ref, $comment, $prefix, $thread_safe) = @_;
my ($ret) = ("");
my ($call_arg) = ("");
my ($trace_arg) = ("");
# If for opengl_norm.c, generate a nice heading otherwise Patrik won't be happy :-)
if ($comment eq 1) {
......@@ -53,9 +138,15 @@ sub GenerateThunk {
$name = $func_ref->[2]->[$i]->[1];
$ret = $ret . "$type $name";
$call_arg = $call_arg . "$name";
if ($type =~ /\*/) {
$trace_arg = $trace_arg . "%p";
} else {
$trace_arg = $trace_arg . $debug_conv{$type};
}
if ($i != $#{@{$func_ref->[2]}}) {
$ret = $ret . ", ";
$call_arg = $call_arg . ", ";
$trace_arg = $trace_arg . ", ";
} else {
$ret = $ret . " ";
$call_arg = $call_arg . " ";
......@@ -65,6 +156,13 @@ sub GenerateThunk {
if ($func_ref->[1] ne "void") {
$ret = $ret . " " . $func_ref->[1] . " ret_value;\n";
}
if ($gen_traces) {
$ret = $ret . " TRACE(\"(" . $trace_arg . ")\\n\"";
if ($trace_arg ne "") {
$ret = $ret . ", " . $call_arg;
}
$ret = $ret . ");\n";
}
if ($thread_safe) {
$ret = $ret . " ENTER_GL();\n";
}
......@@ -86,63 +184,6 @@ sub GenerateThunk {
}
#
# This hash table gives the conversion between OpenGL types and what
# is used in the .spec file
#
%arg_conv =
("GLbitfield" => [ "long", 4 ],
"GLboolean" => [ "long", 4 ],
"GLbyte" => [ "long", 4 ],
"GLclampd" => [ "double", 8 ],
"GLclampf" => [ "long", 4 ],
"GLdouble" => [ "double", 8 ],
"GLenum" => [ "long", 4 ],
"GLfloat" => [ "long", 4 ],
"GLint" => [ "long", 4 ],
"GLshort" => [ "long", 4 ],
"GLsizei" => [ "long", 4 ],
"GLstring" => [ "str", 4 ],
"GLubyte" => [ "long", 4 ],
"GLuint" => [ "long", 4 ],
"GLushort" => [ "long", 4 ],
"GLvoid" => [ "void", 4 ],
"_GLfuncptr" => [ "ptr", 4 ]);
#
# Files to generate
#
$spec_file = "opengl32.spec";
$norm_file = "opengl_norm.c";
$ext_file = "opengl_ext.c";
# Set to 0 for removing the ENTER / LEAVE GL calls
$gen_thread_safe = 1;
# Prefix used for the local variables
$ext_prefix = "func_";
#
# List of categories to put in the 'opengl_norm.c' file
#
%cat_1_0 = ( "display-list" => 1,
"drawing" => 1,
"drawing-control" => 1,
"feedback" => 1,
"framebuf" => 1,
"misc" => 1,
"modeling" => 1,
"pixel-op" => 1,
"pixel-rw" => 1,
"state-req" => 1,
"xform" => 1 );
%cat_1_1 = ( %cat_1_0,
"1_1" => 1 );
%cat_1_2 = ( %cat_1_1,
"VERSION_1_2" => 1,
"ARB_multitexture" => 1 );
%norm_categories = ();
#
# Extract and checks the number of arguments
#
if ($#ARGV != 1) {
......@@ -177,6 +218,11 @@ while ($line = <TYPES>) {
}
# This is to override the 'void' -> '*' bogus conversion
$pseudo_to_opengl{"void"} = "void";
# This is a bug in the spec file...
$pseudo_to_opengl{"FfdTargetSGIX"} = "GLint";
$pseudo_to_opengl{"FfdMaskSGIX"} = "GLint";
$pseudo_to_opengl{"IglooFunctionSelectSGIX"} = "GLint";
$pseudo_to_opengl{"IglooParameterSGIX"} = "GLint";
#
# Then, create the list of all OpenGL functions using the 'gl.spec'
......@@ -322,8 +368,12 @@ open(SPEC, ">" . $spec_file);
print SPEC "
name opengl32
type win32
init OpenGL32_Init
import x11drv
import kernel32
debug_channels (opengl)
@ stdcall wglCreateContext(long) wglCreateContext
@ stdcall wglCreateLayerContext(long long) wglCreateLayerContext
......@@ -378,9 +428,12 @@ print NORM "
#include \"config.h\"
#include \"wine_gl.h\"
#include \"debugtools.h\"
typedef const GLubyte * GLstring;
DEFAULT_DEBUG_CHANNEL(opengl);
";
foreach (sort keys %norm_functions) {
$string = GenerateThunk($norm_functions{$_}, 1, "", $gen_thread_safe);
......@@ -398,11 +451,14 @@ print EXT "
#include \"config.h\"
#include \"wine_gl.h\"
#include \"debugtools.h\"
typedef const GLubyte * GLstring;
#include \"opengl_ext.h\"
DEFAULT_DEBUG_CHANNEL(opengl);
";
# First, generate the function pointers
......
name opengl32
type win32
init OpenGL32_Init
init OpenGL32_Init
import x11drv
import kernel32
......
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