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
28de0a56
Commit
28de0a56
authored
Oct 07, 2022
by
Rémi Bernon
Committed by
Alexandre Julliard
Nov 03, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
opengl32: Use the unixlib interface for WGL functions.
parent
dceaa225
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
238 additions
and
29 deletions
+238
-29
make_opengl
dlls/opengl32/make_opengl
+29
-0
opengl_ext.h
dlls/opengl32/opengl_ext.h
+2
-0
thunks.c
dlls/opengl32/thunks.c
+18
-0
unix_thunks.c
dlls/opengl32/unix_thunks.c
+96
-0
unixlib.h
dlls/opengl32/unixlib.h
+79
-0
wgl.c
dlls/opengl32/wgl.c
+14
-29
No files found.
dlls/opengl32/make_opengl
View file @
28de0a56
...
...
@@ -508,6 +508,9 @@ sub needs_wrapper($$)
"glGetString"
=>
1
,
"glGetStringi"
=>
1
,
"wglGetCurrentReadDCARB"
=>
1
,
"wglGetPixelFormat"
=>
1
,
"wglGetProcAddress"
=>
1
,
"wglSwapBuffers"
=>
1
,
);
my
(
$name
,
$func
)
=
@_
;
...
...
@@ -799,6 +802,11 @@ print OUT "#include \"wingdi.h\"\n\n";
print
OUT
"#include \"wine/wgl.h\"\n"
;
print
OUT
"#include \"wine/unixlib.h\"\n\n"
;
foreach
(
sort
keys
%
wgl_functions
)
{
next
if
defined
$manual_win_functions
{
$_
};
print
OUT
generate_func_params
(
$_
,
$wgl_functions
{
$_
});
}
foreach
(
sort
keys
%
norm_functions
)
{
next
if
defined
$manual_win_functions
{
$_
};
...
...
@@ -812,6 +820,11 @@ foreach (sort keys %ext_functions)
print
OUT
"enum unix_funcs\n"
;
print
OUT
"{\n"
;
foreach
(
sort
keys
%
wgl_functions
)
{
next
if
defined
$manual_win_functions
{
$_
};
printf
OUT
" unix_%s,\n"
,
$_
;
}
foreach
(
sort
keys
%
norm_functions
)
{
next
if
defined
$manual_win_functions
{
$_
};
...
...
@@ -851,6 +864,12 @@ print OUT "#include \"opengl_ext.h\"\n\n";
print
OUT
"#include \"wine/debug.h\"\n\n"
;
print
OUT
"WINE_DEFAULT_DEBUG_CHANNEL(opengl);\n"
;
foreach
(
sort
keys
%
wgl_functions
)
{
next
if
defined
$manual_win_functions
{
$_
};
next
if
needs_wrapper
(
$_
,
$wgl_functions
{
$_
}
);
print
OUT
"\n"
.
generate_win_thunk
(
$_
,
$wgl_functions
{
$_
});
}
foreach
(
sort
keys
%
norm_functions
)
{
next
if
defined
$manual_win_functions
{
$_
};
...
...
@@ -905,6 +924,11 @@ print OUT "#include \"wingdi.h\"\n\n";
print
OUT
"#include \"unixlib.h\"\n\n"
;
print
OUT
"#include \"opengl_ext.h\"\n\n"
;
foreach
(
sort
keys
%
wgl_functions
)
{
next
if
defined
$manual_win_functions
{
$_
};
print
OUT
generate_unix_thunk
(
$_
,
$wgl_functions
{
$_
},
"wgl"
);
}
foreach
(
sort
keys
%
norm_functions
)
{
next
if
defined
$manual_win_functions
{
$_
};
...
...
@@ -918,6 +942,11 @@ foreach (sort keys %ext_functions)
print
OUT
"const unixlib_function_t __wine_unix_call_funcs[] =\n"
;
print
OUT
"{\n"
;
foreach
(
sort
keys
%
wgl_functions
)
{
next
if
defined
$manual_win_functions
{
$_
};
printf
OUT
" &wgl_%s,\n"
,
$_
;
}
foreach
(
sort
keys
%
norm_functions
)
{
next
if
defined
$manual_win_functions
{
$_
};
...
...
dlls/opengl32/opengl_ext.h
View file @
28de0a56
...
...
@@ -43,4 +43,6 @@ static inline struct opengl_funcs *get_dc_funcs( HDC hdc )
return
funcs
;
}
extern
int
WINAPI
wglDescribePixelFormat
(
HDC
hdc
,
int
ipfd
,
UINT
cjpfd
,
PIXELFORMATDESCRIPTOR
*
ppfd
);
#endif
/* __DLLS_OPENGL32_OPENGL_EXT_H */
dlls/opengl32/thunks.c
View file @
28de0a56
...
...
@@ -17,6 +17,24 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
opengl
);
int
WINAPI
wglDescribePixelFormat
(
HDC
hdc
,
int
ipfd
,
UINT
cjpfd
,
PIXELFORMATDESCRIPTOR
*
ppfd
)
{
struct
wglDescribePixelFormat_params
args
=
{
.
hdc
=
hdc
,
.
ipfd
=
ipfd
,
.
cjpfd
=
cjpfd
,
.
ppfd
=
ppfd
,
};
NTSTATUS
status
;
TRACE
(
"hdc %p, ipfd %d, cjpfd %u, ppfd %p
\n
"
,
hdc
,
ipfd
,
cjpfd
,
ppfd
);
if
((
status
=
UNIX_CALL
(
wglDescribePixelFormat
,
&
args
)))
WARN
(
"wglDescribePixelFormat returned %#x
\n
"
,
status
);
return
args
.
ret
;
}
BOOL
WINAPI
wglSetPixelFormat
(
HDC
hdc
,
int
ipfd
,
const
PIXELFORMATDESCRIPTOR
*
ppfd
)
{
struct
wglSetPixelFormat_params
args
=
{
.
hdc
=
hdc
,
.
ipfd
=
ipfd
,
.
ppfd
=
ppfd
,
};
NTSTATUS
status
;
TRACE
(
"hdc %p, ipfd %d, ppfd %p
\n
"
,
hdc
,
ipfd
,
ppfd
);
if
((
status
=
UNIX_CALL
(
wglSetPixelFormat
,
&
args
)))
WARN
(
"wglSetPixelFormat returned %#x
\n
"
,
status
);
return
args
.
ret
;
}
void
WINAPI
glAccum
(
GLenum
op
,
GLfloat
value
)
{
struct
glAccum_params
args
=
{
.
op
=
op
,
.
value
=
value
,
};
dlls/opengl32/unix_thunks.c
View file @
28de0a56
...
...
@@ -13,6 +13,92 @@
#include "opengl_ext.h"
static
NTSTATUS
wgl_wglCopyContext
(
void
*
args
)
{
struct
wglCopyContext_params
*
params
=
args
;
const
struct
opengl_funcs
*
funcs
=
NtCurrentTeb
()
->
glTable
;
params
->
ret
=
funcs
->
wgl
.
p_wglCopyContext
(
(
struct
wgl_context
*
)
params
->
hglrcSrc
,
(
struct
wgl_context
*
)
params
->
hglrcDst
,
params
->
mask
);
return
STATUS_SUCCESS
;
}
static
NTSTATUS
wgl_wglCreateContext
(
void
*
args
)
{
struct
wglCreateContext_params
*
params
=
args
;
const
struct
opengl_funcs
*
funcs
=
get_dc_funcs
(
params
->
hDc
);
if
(
!
funcs
||
!
funcs
->
wgl
.
p_wglCreateContext
)
return
STATUS_NOT_IMPLEMENTED
;
params
->
ret
=
(
HGLRC
)
funcs
->
wgl
.
p_wglCreateContext
(
params
->
hDc
);
return
STATUS_SUCCESS
;
}
static
NTSTATUS
wgl_wglDeleteContext
(
void
*
args
)
{
struct
wglDeleteContext_params
*
params
=
args
;
const
struct
opengl_funcs
*
funcs
=
NtCurrentTeb
()
->
glTable
;
params
->
ret
=
funcs
->
wgl
.
p_wglDeleteContext
(
(
struct
wgl_context
*
)
params
->
oldContext
);
return
STATUS_SUCCESS
;
}
static
NTSTATUS
wgl_wglDescribePixelFormat
(
void
*
args
)
{
struct
wglDescribePixelFormat_params
*
params
=
args
;
const
struct
opengl_funcs
*
funcs
=
get_dc_funcs
(
params
->
hdc
);
if
(
!
funcs
||
!
funcs
->
wgl
.
p_wglDescribePixelFormat
)
return
STATUS_NOT_IMPLEMENTED
;
params
->
ret
=
funcs
->
wgl
.
p_wglDescribePixelFormat
(
params
->
hdc
,
params
->
ipfd
,
params
->
cjpfd
,
params
->
ppfd
);
return
STATUS_SUCCESS
;
}
static
NTSTATUS
wgl_wglGetPixelFormat
(
void
*
args
)
{
struct
wglGetPixelFormat_params
*
params
=
args
;
const
struct
opengl_funcs
*
funcs
=
get_dc_funcs
(
params
->
hdc
);
if
(
!
funcs
||
!
funcs
->
wgl
.
p_wglGetPixelFormat
)
return
STATUS_NOT_IMPLEMENTED
;
params
->
ret
=
funcs
->
wgl
.
p_wglGetPixelFormat
(
params
->
hdc
);
return
STATUS_SUCCESS
;
}
static
NTSTATUS
wgl_wglGetProcAddress
(
void
*
args
)
{
struct
wglGetProcAddress_params
*
params
=
args
;
const
struct
opengl_funcs
*
funcs
=
NtCurrentTeb
()
->
glTable
;
params
->
ret
=
funcs
->
wgl
.
p_wglGetProcAddress
(
params
->
lpszProc
);
return
STATUS_SUCCESS
;
}
static
NTSTATUS
wgl_wglMakeCurrent
(
void
*
args
)
{
struct
wglMakeCurrent_params
*
params
=
args
;
const
struct
opengl_funcs
*
funcs
=
get_dc_funcs
(
params
->
hDc
);
if
(
!
funcs
||
!
funcs
->
wgl
.
p_wglMakeCurrent
)
return
STATUS_NOT_IMPLEMENTED
;
params
->
ret
=
funcs
->
wgl
.
p_wglMakeCurrent
(
params
->
hDc
,
(
struct
wgl_context
*
)
params
->
newContext
);
return
STATUS_SUCCESS
;
}
static
NTSTATUS
wgl_wglSetPixelFormat
(
void
*
args
)
{
struct
wglSetPixelFormat_params
*
params
=
args
;
const
struct
opengl_funcs
*
funcs
=
get_dc_funcs
(
params
->
hdc
);
if
(
!
funcs
||
!
funcs
->
wgl
.
p_wglSetPixelFormat
)
return
STATUS_NOT_IMPLEMENTED
;
params
->
ret
=
funcs
->
wgl
.
p_wglSetPixelFormat
(
params
->
hdc
,
params
->
ipfd
,
params
->
ppfd
);
return
STATUS_SUCCESS
;
}
static
NTSTATUS
wgl_wglShareLists
(
void
*
args
)
{
struct
wglShareLists_params
*
params
=
args
;
const
struct
opengl_funcs
*
funcs
=
NtCurrentTeb
()
->
glTable
;
params
->
ret
=
funcs
->
wgl
.
p_wglShareLists
(
(
struct
wgl_context
*
)
params
->
hrcSrvShare
,
(
struct
wgl_context
*
)
params
->
hrcSrvSource
);
return
STATUS_SUCCESS
;
}
static
NTSTATUS
wgl_wglSwapBuffers
(
void
*
args
)
{
struct
wglSwapBuffers_params
*
params
=
args
;
const
struct
opengl_funcs
*
funcs
=
get_dc_funcs
(
params
->
hdc
);
if
(
!
funcs
||
!
funcs
->
wgl
.
p_wglSwapBuffers
)
return
STATUS_NOT_IMPLEMENTED
;
params
->
ret
=
funcs
->
wgl
.
p_wglSwapBuffers
(
params
->
hdc
);
return
STATUS_SUCCESS
;
}
static
NTSTATUS
gl_glAccum
(
void
*
args
)
{
struct
glAccum_params
*
params
=
args
;
...
...
@@ -24216,6 +24302,16 @@ static NTSTATUS ext_wglSwapIntervalEXT( void *args )
const
unixlib_function_t
__wine_unix_call_funcs
[]
=
{
&
wgl_wglCopyContext
,
&
wgl_wglCreateContext
,
&
wgl_wglDeleteContext
,
&
wgl_wglDescribePixelFormat
,
&
wgl_wglGetPixelFormat
,
&
wgl_wglGetProcAddress
,
&
wgl_wglMakeCurrent
,
&
wgl_wglSetPixelFormat
,
&
wgl_wglShareLists
,
&
wgl_wglSwapBuffers
,
&
gl_glAccum
,
&
gl_glAlphaFunc
,
&
gl_glAreTexturesResident
,
dlls/opengl32/unixlib.h
View file @
28de0a56
...
...
@@ -16,6 +16,75 @@
#include "wine/wgl.h"
#include "wine/unixlib.h"
struct
wglCopyContext_params
{
HGLRC
hglrcSrc
;
HGLRC
hglrcDst
;
UINT
mask
;
BOOL
ret
;
};
struct
wglCreateContext_params
{
HDC
hDc
;
HGLRC
ret
;
};
struct
wglDeleteContext_params
{
HGLRC
oldContext
;
BOOL
ret
;
};
struct
wglDescribePixelFormat_params
{
HDC
hdc
;
int
ipfd
;
UINT
cjpfd
;
PIXELFORMATDESCRIPTOR
*
ppfd
;
int
ret
;
};
struct
wglGetPixelFormat_params
{
HDC
hdc
;
int
ret
;
};
struct
wglGetProcAddress_params
{
LPCSTR
lpszProc
;
PROC
ret
;
};
struct
wglMakeCurrent_params
{
HDC
hDc
;
HGLRC
newContext
;
BOOL
ret
;
};
struct
wglSetPixelFormat_params
{
HDC
hdc
;
int
ipfd
;
const
PIXELFORMATDESCRIPTOR
*
ppfd
;
BOOL
ret
;
};
struct
wglShareLists_params
{
HGLRC
hrcSrvShare
;
HGLRC
hrcSrvSource
;
BOOL
ret
;
};
struct
wglSwapBuffers_params
{
HDC
hdc
;
BOOL
ret
;
};
struct
glAccum_params
{
GLenum
op
;
...
...
@@ -22224,6 +22293,16 @@ struct wglSwapIntervalEXT_params
enum
unix_funcs
{
unix_wglCopyContext
,
unix_wglCreateContext
,
unix_wglDeleteContext
,
unix_wglDescribePixelFormat
,
unix_wglGetPixelFormat
,
unix_wglGetProcAddress
,
unix_wglMakeCurrent
,
unix_wglSetPixelFormat
,
unix_wglShareLists
,
unix_wglSwapBuffers
,
unix_glAccum
,
unix_glAlphaFunc
,
unix_glAreTexturesResident
,
...
...
dlls/opengl32/wgl.c
View file @
28de0a56
...
...
@@ -442,16 +442,6 @@ HGLRC WINAPI wglGetCurrentContext(void)
}
/***********************************************************************
* wglDescribePixelFormat (OPENGL32.@)
*/
INT
WINAPI
wglDescribePixelFormat
(
HDC
hdc
,
INT
format
,
UINT
size
,
PIXELFORMATDESCRIPTOR
*
descr
)
{
struct
opengl_funcs
*
funcs
=
get_dc_funcs
(
hdc
);
if
(
!
funcs
)
return
0
;
return
funcs
->
wgl
.
p_wglDescribePixelFormat
(
hdc
,
format
,
size
,
descr
);
}
/***********************************************************************
* wglChoosePixelFormat (OPENGL32.@)
*/
INT
WINAPI
wglChoosePixelFormat
(
HDC
hdc
,
const
PIXELFORMATDESCRIPTOR
*
ppfd
)
...
...
@@ -626,23 +616,18 @@ INT WINAPI wglChoosePixelFormat(HDC hdc, const PIXELFORMATDESCRIPTOR* ppfd)
*/
INT
WINAPI
wglGetPixelFormat
(
HDC
hdc
)
{
struct
opengl_funcs
*
funcs
=
get_dc_funcs
(
hdc
);
if
(
!
funcs
)
struct
wglGetPixelFormat_params
args
=
{
.
hdc
=
hdc
,
};
NTSTATUS
status
;
TRACE
(
"hdc %p
\n
"
,
hdc
);
if
((
status
=
UNIX_CALL
(
wglGetPixelFormat
,
&
args
)))
{
WARN
(
"wglGetPixelFormat returned %#x
\n
"
,
status
);
SetLastError
(
ERROR_INVALID_PIXEL_FORMAT
);
return
0
;
}
return
funcs
->
wgl
.
p_wglGetPixelFormat
(
hdc
);
}
/***********************************************************************
* wglSetPixelFormat(OPENGL32.@)
*/
BOOL
WINAPI
wglSetPixelFormat
(
HDC
hdc
,
INT
format
,
const
PIXELFORMATDESCRIPTOR
*
descr
)
{
struct
opengl_funcs
*
funcs
=
get_dc_funcs
(
hdc
);
if
(
!
funcs
)
return
FALSE
;
return
funcs
->
wgl
.
p_wglSetPixelFormat
(
hdc
,
format
,
descr
);
return
args
.
ret
;
}
/***********************************************************************
...
...
@@ -650,12 +635,11 @@ BOOL WINAPI wglSetPixelFormat( HDC hdc, INT format, const PIXELFORMATDESCRIPTOR
*/
BOOL
WINAPI
DECLSPEC_HOTPATCH
wglSwapBuffers
(
HDC
hdc
)
{
const
struct
opengl_funcs
*
funcs
=
get_dc_funcs
(
hdc
);
if
(
!
funcs
||
!
funcs
->
wgl
.
p_wglSwapBuffers
)
return
FALSE
;
if
(
!
funcs
->
wgl
.
p_wglSwapBuffers
(
hdc
))
return
FALSE
;
struct
wglSwapBuffers_params
args
=
{
.
hdc
=
hdc
,
};
NTSTATUS
status
;
if
(
TRACE_ON
(
fps
))
if
((
status
=
UNIX_CALL
(
wglSwapBuffers
,
&
args
)))
WARN
(
"wglSwapBuffers returned %#x
\n
"
,
status
);
else
if
(
TRACE_ON
(
fps
))
{
static
long
prev_time
,
start_time
;
static
unsigned
long
frames
,
frames_total
;
...
...
@@ -673,7 +657,8 @@ BOOL WINAPI DECLSPEC_HOTPATCH wglSwapBuffers( HDC hdc )
if
(
start_time
==
0
)
start_time
=
time
;
}
}
return
TRUE
;
return
args
.
ret
;
}
/***********************************************************************
...
...
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