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
d4bed8ed
Commit
d4bed8ed
authored
Oct 06, 2022
by
Rémi Bernon
Committed by
Alexandre Julliard
Nov 09, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
opengl32: Avoid recursively entering WGL critical section.
parent
cb4fecc2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
65 deletions
+54
-65
unix_wgl.c
dlls/opengl32/unix_wgl.c
+54
-65
No files found.
dlls/opengl32/unix_wgl.c
View file @
d4bed8ed
...
...
@@ -102,26 +102,18 @@ static struct wgl_handle *get_handle_ptr( HANDLE handle, enum wgl_handle_type ty
{
unsigned
int
index
=
LOWORD
(
handle
)
&
~
HANDLE_TYPE_MASK
;
EnterCriticalSection
(
&
wgl_section
);
if
(
index
<
handle_count
&&
ULongToHandle
(
wgl_handles
[
index
].
handle
)
==
handle
)
return
&
wgl_handles
[
index
];
LeaveCriticalSection
(
&
wgl_section
);
SetLastError
(
ERROR_INVALID_HANDLE
);
return
NULL
;
}
static
void
release_handle_ptr
(
struct
wgl_handle
*
ptr
)
{
if
(
ptr
)
LeaveCriticalSection
(
&
wgl_section
);
}
static
HANDLE
alloc_handle
(
enum
wgl_handle_type
type
,
struct
opengl_funcs
*
funcs
,
void
*
user_ptr
)
{
HANDLE
handle
=
0
;
struct
wgl_handle
*
ptr
=
NULL
;
EnterCriticalSection
(
&
wgl_section
);
if
((
ptr
=
next_free
))
next_free
=
next_free
->
u
.
next
;
else
if
(
handle_count
<
MAX_WGL_HANDLES
)
...
...
@@ -134,7 +126,6 @@ static HANDLE alloc_handle( enum wgl_handle_type type, struct opengl_funcs *func
handle
=
next_handle
(
ptr
,
type
);
}
else
SetLastError
(
ERROR_NOT_ENOUGH_MEMORY
);
LeaveCriticalSection
(
&
wgl_section
);
return
handle
;
}
...
...
@@ -144,7 +135,6 @@ static void free_handle_ptr( struct wgl_handle *ptr )
ptr
->
u
.
next
=
next_free
;
ptr
->
funcs
=
NULL
;
next_free
=
ptr
;
LeaveCriticalSection
(
&
wgl_section
);
}
/* check if the extension is present in the list */
...
...
@@ -498,8 +488,6 @@ static BOOL wrap_wglCopyContext( HGLRC hglrcSrc, HGLRC hglrcDst, UINT mask )
if
(
src
->
funcs
!=
dst
->
funcs
)
SetLastError
(
ERROR_INVALID_HANDLE
);
else
ret
=
src
->
funcs
->
wgl
.
p_wglCopyContext
(
src
->
u
.
context
->
drv_ctx
,
dst
->
u
.
context
->
drv_ctx
,
mask
);
}
release_handle_ptr
(
dst
);
release_handle_ptr
(
src
);
return
ret
;
}
...
...
@@ -548,7 +536,6 @@ static BOOL wrap_wglMakeCurrent( HDC hdc, HGLRC hglrc )
SetLastError
(
ERROR_BUSY
);
ret
=
FALSE
;
}
release_handle_ptr
(
ptr
);
}
else
if
(
prev
)
{
...
...
@@ -567,14 +554,12 @@ static BOOL wrap_wglMakeCurrent( HDC hdc, HGLRC hglrc )
static
BOOL
wrap_wglDeleteContext
(
HGLRC
hglrc
)
{
struct
wgl_handle
*
ptr
=
get_handle_ptr
(
hglrc
,
HANDLE_CONTEXT
);
if
(
!
ptr
)
return
FALSE
;
struct
wgl_handle
*
ptr
;
if
(
!
(
ptr
=
get_handle_ptr
(
hglrc
,
HANDLE_CONTEXT
)))
return
FALSE
;
if
(
ptr
->
u
.
context
->
tid
&&
ptr
->
u
.
context
->
tid
!=
GetCurrentThreadId
())
{
SetLastError
(
ERROR_BUSY
);
release_handle_ptr
(
ptr
);
return
FALSE
;
}
if
(
hglrc
==
NtCurrentTeb
()
->
glCurrentRC
)
wrap_wglMakeCurrent
(
0
,
0
);
...
...
@@ -597,20 +582,14 @@ static BOOL wrap_wglShareLists( HGLRC hglrcSrc, HGLRC hglrcDst )
if
(
src
->
funcs
!=
dst
->
funcs
)
SetLastError
(
ERROR_INVALID_HANDLE
);
else
ret
=
src
->
funcs
->
wgl
.
p_wglShareLists
(
src
->
u
.
context
->
drv_ctx
,
dst
->
u
.
context
->
drv_ctx
);
}
release_handle_ptr
(
dst
);
release_handle_ptr
(
src
);
return
ret
;
}
static
BOOL
wrap_wglBindTexImageARB
(
HPBUFFERARB
handle
,
int
buffer
)
{
struct
wgl_handle
*
ptr
=
get_handle_ptr
(
handle
,
HANDLE_PBUFFER
);
BOOL
ret
;
if
(
!
ptr
)
return
FALSE
;
ret
=
ptr
->
funcs
->
ext
.
p_wglBindTexImageARB
(
ptr
->
u
.
pbuffer
,
buffer
);
release_handle_ptr
(
ptr
);
return
ret
;
struct
wgl_handle
*
ptr
;
if
(
!
(
ptr
=
get_handle_ptr
(
handle
,
HANDLE_PBUFFER
)))
return
FALSE
;
return
ptr
->
funcs
->
ext
.
p_wglBindTexImageARB
(
ptr
->
u
.
pbuffer
,
buffer
);
}
static
HGLRC
wrap_wglCreateContextAttribsARB
(
HDC
hdc
,
HGLRC
share
,
const
int
*
attribs
)
...
...
@@ -657,7 +636,6 @@ static HGLRC wrap_wglCreateContextAttribsARB( HDC hdc, HGLRC share, const int *a
if
(
!
ret
)
funcs
->
wgl
.
p_wglDeleteContext
(
drv_ctx
);
}
release_handle_ptr
(
share_ptr
);
return
ret
;
}
...
...
@@ -676,9 +654,9 @@ static HPBUFFERARB wrap_wglCreatePbufferARB( HDC hdc, int format, int width, int
static
BOOL
wrap_wglDestroyPbufferARB
(
HPBUFFERARB
handle
)
{
struct
wgl_handle
*
ptr
=
get_handle_ptr
(
handle
,
HANDLE_PBUFFER
)
;
struct
wgl_handle
*
ptr
;
if
(
!
ptr
)
return
FALSE
;
if
(
!
(
ptr
=
get_handle_ptr
(
handle
,
HANDLE_PBUFFER
))
)
return
FALSE
;
ptr
->
funcs
->
ext
.
p_wglDestroyPbufferARB
(
ptr
->
u
.
pbuffer
);
free_handle_ptr
(
ptr
);
return
TRUE
;
...
...
@@ -686,13 +664,9 @@ static BOOL wrap_wglDestroyPbufferARB( HPBUFFERARB handle )
static
HDC
wrap_wglGetPbufferDCARB
(
HPBUFFERARB
handle
)
{
struct
wgl_handle
*
ptr
=
get_handle_ptr
(
handle
,
HANDLE_PBUFFER
);
HDC
ret
;
if
(
!
ptr
)
return
0
;
ret
=
ptr
->
funcs
->
ext
.
p_wglGetPbufferDCARB
(
ptr
->
u
.
pbuffer
);
release_handle_ptr
(
ptr
);
return
ret
;
struct
wgl_handle
*
ptr
;
if
(
!
(
ptr
=
get_handle_ptr
(
handle
,
HANDLE_PBUFFER
)))
return
0
;
return
ptr
->
funcs
->
ext
.
p_wglGetPbufferDCARB
(
ptr
->
u
.
pbuffer
);
}
static
BOOL
wrap_wglMakeContextCurrentARB
(
HDC
draw_hdc
,
HDC
read_hdc
,
HGLRC
hglrc
)
...
...
@@ -722,7 +696,6 @@ static BOOL wrap_wglMakeContextCurrentARB( HDC draw_hdc, HDC read_hdc, HGLRC hgl
SetLastError
(
ERROR_BUSY
);
ret
=
FALSE
;
}
release_handle_ptr
(
ptr
);
}
else
if
(
prev
)
{
...
...
@@ -736,46 +709,30 @@ static BOOL wrap_wglMakeContextCurrentARB( HDC draw_hdc, HDC read_hdc, HGLRC hgl
static
BOOL
wrap_wglQueryPbufferARB
(
HPBUFFERARB
handle
,
int
attrib
,
int
*
value
)
{
struct
wgl_handle
*
ptr
=
get_handle_ptr
(
handle
,
HANDLE_PBUFFER
);
BOOL
ret
;
if
(
!
ptr
)
return
FALSE
;
ret
=
ptr
->
funcs
->
ext
.
p_wglQueryPbufferARB
(
ptr
->
u
.
pbuffer
,
attrib
,
value
);
release_handle_ptr
(
ptr
);
return
ret
;
struct
wgl_handle
*
ptr
;
if
(
!
(
ptr
=
get_handle_ptr
(
handle
,
HANDLE_PBUFFER
)))
return
FALSE
;
return
ptr
->
funcs
->
ext
.
p_wglQueryPbufferARB
(
ptr
->
u
.
pbuffer
,
attrib
,
value
);
}
static
int
wrap_wglReleasePbufferDCARB
(
HPBUFFERARB
handle
,
HDC
hdc
)
{
struct
wgl_handle
*
ptr
=
get_handle_ptr
(
handle
,
HANDLE_PBUFFER
);
BOOL
ret
;
if
(
!
ptr
)
return
FALSE
;
ret
=
ptr
->
funcs
->
ext
.
p_wglReleasePbufferDCARB
(
ptr
->
u
.
pbuffer
,
hdc
);
release_handle_ptr
(
ptr
);
return
ret
;
struct
wgl_handle
*
ptr
;
if
(
!
(
ptr
=
get_handle_ptr
(
handle
,
HANDLE_PBUFFER
)))
return
FALSE
;
return
ptr
->
funcs
->
ext
.
p_wglReleasePbufferDCARB
(
ptr
->
u
.
pbuffer
,
hdc
);
}
static
BOOL
wrap_wglReleaseTexImageARB
(
HPBUFFERARB
handle
,
int
buffer
)
{
struct
wgl_handle
*
ptr
=
get_handle_ptr
(
handle
,
HANDLE_PBUFFER
);
BOOL
ret
;
if
(
!
ptr
)
return
FALSE
;
ret
=
ptr
->
funcs
->
ext
.
p_wglReleaseTexImageARB
(
ptr
->
u
.
pbuffer
,
buffer
);
release_handle_ptr
(
ptr
);
return
ret
;
struct
wgl_handle
*
ptr
;
if
(
!
(
ptr
=
get_handle_ptr
(
handle
,
HANDLE_PBUFFER
)))
return
FALSE
;
return
ptr
->
funcs
->
ext
.
p_wglReleaseTexImageARB
(
ptr
->
u
.
pbuffer
,
buffer
);
}
static
BOOL
wrap_wglSetPbufferAttribARB
(
HPBUFFERARB
handle
,
const
int
*
attribs
)
{
struct
wgl_handle
*
ptr
=
get_handle_ptr
(
handle
,
HANDLE_PBUFFER
);
BOOL
ret
;
if
(
!
ptr
)
return
FALSE
;
ret
=
ptr
->
funcs
->
ext
.
p_wglSetPbufferAttribARB
(
ptr
->
u
.
pbuffer
,
attribs
);
release_handle_ptr
(
ptr
);
return
ret
;
struct
wgl_handle
*
ptr
;
if
(
!
(
ptr
=
get_handle_ptr
(
handle
,
HANDLE_PBUFFER
)))
return
FALSE
;
return
ptr
->
funcs
->
ext
.
p_wglSetPbufferAttribARB
(
ptr
->
u
.
pbuffer
,
attribs
);
}
static
void
gl_debug_message_callback
(
GLenum
source
,
GLenum
type
,
GLuint
id
,
GLenum
severity
,
...
...
@@ -841,21 +798,27 @@ static void WINAPI wrap_glDebugMessageCallbackARB( GLDEBUGPROCARB callback, cons
NTSTATUS
wgl_wglCopyContext
(
void
*
args
)
{
struct
wglCopyContext_params
*
params
=
args
;
EnterCriticalSection
(
&
wgl_section
);
params
->
ret
=
wrap_wglCopyContext
(
params
->
hglrcSrc
,
params
->
hglrcDst
,
params
->
mask
);
LeaveCriticalSection
(
&
wgl_section
);
return
STATUS_SUCCESS
;
}
NTSTATUS
wgl_wglCreateContext
(
void
*
args
)
{
struct
wglCreateContext_params
*
params
=
args
;
EnterCriticalSection
(
&
wgl_section
);
params
->
ret
=
wrap_wglCreateContext
(
params
->
hDc
);
LeaveCriticalSection
(
&
wgl_section
);
return
STATUS_SUCCESS
;
}
NTSTATUS
wgl_wglDeleteContext
(
void
*
args
)
{
struct
wglDeleteContext_params
*
params
=
args
;
EnterCriticalSection
(
&
wgl_section
);
params
->
ret
=
wrap_wglDeleteContext
(
params
->
oldContext
);
LeaveCriticalSection
(
&
wgl_section
);
return
STATUS_SUCCESS
;
}
...
...
@@ -869,14 +832,18 @@ NTSTATUS wgl_wglGetProcAddress( void *args )
NTSTATUS
wgl_wglMakeCurrent
(
void
*
args
)
{
struct
wglMakeCurrent_params
*
params
=
args
;
if
(
params
->
newContext
)
EnterCriticalSection
(
&
wgl_section
);
params
->
ret
=
wrap_wglMakeCurrent
(
params
->
hDc
,
params
->
newContext
);
if
(
params
->
newContext
)
LeaveCriticalSection
(
&
wgl_section
);
return
STATUS_SUCCESS
;
}
NTSTATUS
wgl_wglShareLists
(
void
*
args
)
{
struct
wglShareLists_params
*
params
=
args
;
EnterCriticalSection
(
&
wgl_section
);
params
->
ret
=
wrap_wglShareLists
(
params
->
hrcSrvShare
,
params
->
hrcSrvSource
);
LeaveCriticalSection
(
&
wgl_section
);
return
STATUS_SUCCESS
;
}
...
...
@@ -900,12 +867,14 @@ NTSTATUS ext_glDebugMessageCallback( void *args )
wrap_glDebugMessageCallback
(
params
->
callback
,
params
->
userParam
);
return
STATUS_SUCCESS
;
}
NTSTATUS
ext_glDebugMessageCallbackAMD
(
void
*
args
)
{
struct
glDebugMessageCallbackAMD_params
*
params
=
args
;
wrap_glDebugMessageCallbackAMD
(
params
->
callback
,
params
->
userParam
);
return
STATUS_SUCCESS
;
}
NTSTATUS
ext_glDebugMessageCallbackARB
(
void
*
args
)
{
struct
glDebugMessageCallbackARB_params
*
params
=
args
;
...
...
@@ -923,69 +892,89 @@ NTSTATUS ext_glGetStringi( void *args )
NTSTATUS
ext_wglBindTexImageARB
(
void
*
args
)
{
struct
wglBindTexImageARB_params
*
params
=
args
;
EnterCriticalSection
(
&
wgl_section
);
params
->
ret
=
wrap_wglBindTexImageARB
(
params
->
hPbuffer
,
params
->
iBuffer
);
LeaveCriticalSection
(
&
wgl_section
);
return
STATUS_SUCCESS
;
}
NTSTATUS
ext_wglCreateContextAttribsARB
(
void
*
args
)
{
struct
wglCreateContextAttribsARB_params
*
params
=
args
;
EnterCriticalSection
(
&
wgl_section
);
params
->
ret
=
wrap_wglCreateContextAttribsARB
(
params
->
hDC
,
params
->
hShareContext
,
params
->
attribList
);
LeaveCriticalSection
(
&
wgl_section
);
return
STATUS_SUCCESS
;
}
NTSTATUS
ext_wglCreatePbufferARB
(
void
*
args
)
{
struct
wglCreatePbufferARB_params
*
params
=
args
;
EnterCriticalSection
(
&
wgl_section
);
params
->
ret
=
wrap_wglCreatePbufferARB
(
params
->
hDC
,
params
->
iPixelFormat
,
params
->
iWidth
,
params
->
iHeight
,
params
->
piAttribList
);
LeaveCriticalSection
(
&
wgl_section
);
return
STATUS_SUCCESS
;
}
NTSTATUS
ext_wglDestroyPbufferARB
(
void
*
args
)
{
struct
wglDestroyPbufferARB_params
*
params
=
args
;
EnterCriticalSection
(
&
wgl_section
);
params
->
ret
=
wrap_wglDestroyPbufferARB
(
params
->
hPbuffer
);
LeaveCriticalSection
(
&
wgl_section
);
return
STATUS_SUCCESS
;
}
NTSTATUS
ext_wglGetPbufferDCARB
(
void
*
args
)
{
struct
wglGetPbufferDCARB_params
*
params
=
args
;
EnterCriticalSection
(
&
wgl_section
);
params
->
ret
=
wrap_wglGetPbufferDCARB
(
params
->
hPbuffer
);
LeaveCriticalSection
(
&
wgl_section
);
return
STATUS_SUCCESS
;
}
NTSTATUS
ext_wglMakeContextCurrentARB
(
void
*
args
)
{
struct
wglMakeContextCurrentARB_params
*
params
=
args
;
if
(
params
->
hglrc
)
EnterCriticalSection
(
&
wgl_section
);
params
->
ret
=
wrap_wglMakeContextCurrentARB
(
params
->
hDrawDC
,
params
->
hReadDC
,
params
->
hglrc
);
if
(
params
->
hglrc
)
LeaveCriticalSection
(
&
wgl_section
);
return
STATUS_SUCCESS
;
}
NTSTATUS
ext_wglQueryPbufferARB
(
void
*
args
)
{
struct
wglQueryPbufferARB_params
*
params
=
args
;
EnterCriticalSection
(
&
wgl_section
);
params
->
ret
=
wrap_wglQueryPbufferARB
(
params
->
hPbuffer
,
params
->
iAttribute
,
params
->
piValue
);
LeaveCriticalSection
(
&
wgl_section
);
return
STATUS_SUCCESS
;
}
NTSTATUS
ext_wglReleasePbufferDCARB
(
void
*
args
)
{
struct
wglReleasePbufferDCARB_params
*
params
=
args
;
EnterCriticalSection
(
&
wgl_section
);
params
->
ret
=
wrap_wglReleasePbufferDCARB
(
params
->
hPbuffer
,
params
->
hDC
);
LeaveCriticalSection
(
&
wgl_section
);
return
STATUS_SUCCESS
;
}
NTSTATUS
ext_wglReleaseTexImageARB
(
void
*
args
)
{
struct
wglReleaseTexImageARB_params
*
params
=
args
;
EnterCriticalSection
(
&
wgl_section
);
params
->
ret
=
wrap_wglReleaseTexImageARB
(
params
->
hPbuffer
,
params
->
iBuffer
);
LeaveCriticalSection
(
&
wgl_section
);
return
STATUS_SUCCESS
;
}
NTSTATUS
ext_wglSetPbufferAttribARB
(
void
*
args
)
{
struct
wglSetPbufferAttribARB_params
*
params
=
args
;
EnterCriticalSection
(
&
wgl_section
);
params
->
ret
=
wrap_wglSetPbufferAttribARB
(
params
->
hPbuffer
,
params
->
piAttribList
);
LeaveCriticalSection
(
&
wgl_section
);
return
STATUS_SUCCESS
;
}
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