Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
ad5e02e6
Commit
ad5e02e6
authored
Jun 09, 2006
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
opengl32: Store function pointers in a separate array to avoid a bunch of relocations.
parent
3e68508e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
29 deletions
+27
-29
make_opengl
dlls/opengl32/make_opengl
+22
-24
opengl_ext.c
dlls/opengl32/opengl_ext.c
+0
-0
opengl_ext.h
dlls/opengl32/opengl_ext.h
+1
-1
wgl.c
dlls/opengl32/wgl.c
+4
-4
No files found.
dlls/opengl32/make_opengl
View file @
ad5e02e6
...
...
@@ -202,9 +202,9 @@ sub ConvertVarName($)
#
# This functions generates the thunk for a given function.
#
sub
GenerateThunk
($$$$)
sub
GenerateThunk
($$$$
$
)
{
my
(
$func_ref
,
$comment
,
$prefix
,
$thread_safe
)
=
@_
;
my
(
$func_ref
,
$comment
,
$prefix
,
$thread_safe
,
$local_var
)
=
@_
;
my
$ret
=
""
;
my
$call_arg
=
""
;
my
$trace_arg
=
""
;
...
...
@@ -244,6 +244,7 @@ sub GenerateThunk($$$$)
if
(
$func_ref
->
[
1
]
ne
"void"
)
{
$ret
=
"$ret "
.
ConvertType
(
$func_ref
->
[
1
])
.
" ret_value;\n"
;
}
$ret
.=
$local_var
;
if
(
$gen_traces
)
{
$ret
=
"$ret TRACE(\"($trace_arg)\\n\""
;
if
(
$trace_arg
ne
""
)
{
...
...
@@ -660,7 +661,7 @@ print NORM "
WINE_DEFAULT_DEBUG_CHANNEL(opengl);
"
;
foreach
(
sort
keys
%
norm_functions
)
{
my
$string
=
GenerateThunk
(
$norm_functions
{
$_
},
1
,
""
,
$gen_thread_safe
);
my
$string
=
GenerateThunk
(
$norm_functions
{
$_
},
1
,
""
,
$gen_thread_safe
,
""
);
print
NORM
"\n$string"
;
}
...
...
@@ -681,48 +682,45 @@ WINE_DEFAULT_DEBUG_CHANNEL(opengl);
"
;
# First, generate the function pointers
# The thunks themselves....
my
$count
=
keys
%
ext_functions
;
print
EXT
"const int extension_registry_size = $count;\n"
;
print
EXT
"void *extension_funcs[$count];\n"
;
print
EXT
"\n/* The thunks themselves....*/"
;
my
$pos
=
0
;
foreach
(
sort
keys
%
ext_functions
)
{
my
$func_ref
=
$ext_functions
{
$_
};
print
EXT
"static "
,
ConvertType
(
$func_ref
->
[
1
]),
" (*$ext_prefix$func_ref->[0])( "
;
my
$local_var
=
" "
.
ConvertType
(
$func_ref
->
[
1
])
.
" (*$ext_prefix$func_ref->[0])( "
;
for
(
my
$i
=
0
;
$i
<=
$#
{
@
{
$func_ref
->
[
2
]}};
$i
++
)
{
my
$type
=
ConvertType
(
$func_ref
->
[
2
]
->
[
$i
]
->
[
0
]);
print
EXT
"$type"
;
$local_var
.=
"$type"
;
if
(
$i
!=
$#
{
@
{
$func_ref
->
[
2
]}})
{
print
EXT
", "
;
$local_var
.=
", "
;
}
else
{
print
EXT
" "
;
$local_var
.=
" "
;
}
}
print
EXT
'void '
if
(
$#
{
@
{
$func_ref
->
[
2
]}}
<
0
);
print
EXT
");\n"
;
}
# The thunks themselves....
print
EXT
"\n/* The thunks themselves....*/"
;
foreach
(
sort
keys
%
ext_functions
)
{
my
$string
=
GenerateThunk
(
$ext_functions
{
$_
},
0
,
$ext_prefix
,
$gen_thread_safe
);
print
EXT
"\nstatic $string"
;
$local_var
.=
'void '
if
(
$#
{
@
{
$func_ref
->
[
2
]}}
<
0
);
$local_var
.=
") = extension_funcs[$pos];\n"
;
$pos
++
;
print
EXT
"\nstatic "
,
GenerateThunk
(
$ext_functions
{
$_
},
0
,
$ext_prefix
,
$gen_thread_safe
,
$local_var
);
}
# Then the table giving the string <-> function correspondance */
print
EXT
"\n\n/* The table giving the correspondance between names and functions */\n"
;
my
@tmp
=
keys
%
ext_functions
;
print
EXT
"const int extension_registry_size = "
,
(
$#tmp
+
1
),
";\n"
;
print
EXT
"const OpenGL_extension extension_registry["
,
(
$#tmp
+
1
),
"] = {\n"
;
print
EXT
"const OpenGL_extension extension_registry[$count] = {\n"
;
my
$i
=
0
;
foreach
(
sort
keys
%
ext_functions
)
{
my
$func_ref
=
$ext_functions
{
$_
};
if
(
$func_ref
->
[
0
]
eq
$func_ref
->
[
3
])
{
print
EXT
" { \"$func_ref->[0]\", NULL, (void *) wine_$func_ref->[0]
, (void **) &$ext_prefix$func_ref->[0]
}"
;
print
EXT
" { \"$func_ref->[0]\", NULL, (void *) wine_$func_ref->[0] }"
;
}
else
{
print
EXT
" { \"$func_ref->[0]\", \"$func_ref->[3]\", (void *) wine_$func_ref->[0]
, (void **) &$ext_prefix$func_ref->[0]
}"
;
print
EXT
" { \"$func_ref->[0]\", \"$func_ref->[3]\", (void *) wine_$func_ref->[0] }"
;
}
if
(
$i
!=
$
#tmp
)
{
if
(
$i
!=
$
count
-
1
)
{
print
EXT
","
;
}
$i
++
;
...
...
dlls/opengl32/opengl_ext.c
View file @
ad5e02e6
This source diff could not be displayed because it is too large. You can
view the blob
instead.
dlls/opengl32/opengl_ext.h
View file @
ad5e02e6
...
...
@@ -67,9 +67,9 @@ typedef struct {
const
char
*
name
;
/* name of the extension */
const
char
*
glx_name
;
/* name used on Unix's libGL */
void
*
func
;
/* pointer to the Wine function for this extension */
void
**
func_ptr
;
/* where to store the value of glXGetProcAddressARB */
}
OpenGL_extension
;
extern
void
*
extension_funcs
[];
extern
const
OpenGL_extension
extension_registry
[];
extern
const
int
extension_registry_size
;
...
...
dlls/opengl32/wgl.c
View file @
ad5e02e6
...
...
@@ -397,7 +397,7 @@ static int wgl_compar(const void *elt_a, const void *elt_b) {
PROC
WINAPI
wglGetProcAddress
(
LPCSTR
lpszProc
)
{
void
*
local_func
;
OpenGL_extension
ext
;
OpenGL_extension
*
ext_ret
;
const
OpenGL_extension
*
ext_ret
;
TRACE
(
"(%s)
\n
"
,
lpszProc
);
...
...
@@ -413,8 +413,8 @@ PROC WINAPI wglGetProcAddress(LPCSTR lpszProc) {
}
/* After that, search in the thunks to find the real name of the extension */
ext
.
name
=
(
char
*
)
lpszProc
;
ext_ret
=
(
OpenGL_extension
*
)
bsearch
(
&
ext
,
extension_registry
,
ext
.
name
=
lpszProc
;
ext_ret
=
(
const
OpenGL_extension
*
)
bsearch
(
&
ext
,
extension_registry
,
extension_registry_size
,
sizeof
(
OpenGL_extension
),
compar
);
if
(
ext_ret
==
NULL
)
{
...
...
@@ -489,7 +489,7 @@ PROC WINAPI wglGetProcAddress(LPCSTR lpszProc) {
return
ret
;
}
else
{
TRACE
(
" returning function (%p)
\n
"
,
ext_ret
->
func
);
*
(
ext_ret
->
func_ptr
)
=
local_func
;
extension_funcs
[
ext_ret
-
extension_registry
]
=
local_func
;
return
ext_ret
->
func
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment