Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
eb5993a7
Commit
eb5993a7
authored
Jan 22, 2024
by
Paul Gofman
Committed by
Alexandre Julliard
Jan 25, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winex11.drv: Fix wglSwapBuffers() with NULL current context with child window rendering.
parent
e5aafd9e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
5 deletions
+57
-5
opengl.c
dlls/opengl32/tests/opengl.c
+52
-0
opengl.c
dlls/winex11.drv/opengl.c
+5
-5
No files found.
dlls/opengl32/tests/opengl.c
View file @
eb5993a7
...
...
@@ -2006,6 +2006,55 @@ static void test_copy_context(HDC hdc)
ok
(
ret
,
"wglMakeCurrent failed, last error %#lx.
\n
"
,
GetLastError
());
}
static
void
test_child_window
(
HWND
hwnd
,
PIXELFORMATDESCRIPTOR
*
pfd
)
{
int
pixel_format
;
DWORD
t1
,
t
;
HGLRC
hglrc
;
HWND
child
;
HDC
hdc
;
int
res
;
child
=
CreateWindowA
(
"static"
,
"Title"
,
WS_CHILDWINDOW
|
WS_VISIBLE
,
50
,
50
,
100
,
100
,
hwnd
,
NULL
,
NULL
,
NULL
);
ok
(
!!
child
,
"got error %lu.
\n
"
,
GetLastError
());
hdc
=
GetDC
(
child
);
pixel_format
=
ChoosePixelFormat
(
hdc
,
pfd
);
res
=
SetPixelFormat
(
hdc
,
pixel_format
,
pfd
);
ok
(
res
,
"got error %lu.
\n
"
,
GetLastError
());
hglrc
=
wglCreateContext
(
hdc
);
ok
(
!!
hglrc
,
"got error %lu.
\n
"
,
GetLastError
());
/* Test SwapBuffers with NULL context. */
glDrawBuffer
(
GL_BACK
);
/* Currently blit happening for child window in winex11 may not be updated with the latest GL frame
* even on glXWaitForSbcOML() path. So simulate continuous present for the test purpose. */
trace
(
"Child window rectangle should turn from red to green now.
\n
"
);
t1
=
GetTickCount
();
while
((
t
=
GetTickCount
())
-
t1
<
3000
)
{
res
=
wglMakeCurrent
(
hdc
,
hglrc
);
ok
(
res
,
"got error %lu.
\n
"
,
GetLastError
());
if
(
t
-
t1
>
1500
)
glClearColor
(
0
.
0
f
,
1
.
0
f
,
0
.
0
f
,
1
.
0
f
);
else
glClearColor
(
1
.
0
f
,
0
.
0
f
,
0
.
0
f
,
1
.
0
f
);
glClear
(
GL_COLOR_BUFFER_BIT
);
res
=
wglMakeCurrent
(
NULL
,
NULL
);
ok
(
res
,
"got error %lu.
\n
"
,
GetLastError
());
SwapBuffers
(
hdc
);
}
res
=
wglDeleteContext
(
hglrc
);
ok
(
res
,
"got error %lu.
\n
"
,
GetLastError
());
ReleaseDC
(
child
,
hdc
);
DestroyWindow
(
child
);
}
START_TEST
(
opengl
)
{
HWND
hwnd
;
...
...
@@ -2138,6 +2187,9 @@ START_TEST(opengl)
else
skip
(
"WGL_EXT_swap_control not supported, skipping test
\n
"
);
if
(
winetest_interactive
)
test_child_window
(
hwnd
,
&
pfd
);
cleanup
:
ReleaseDC
(
hwnd
,
hdc
);
DestroyWindow
(
hwnd
);
...
...
dlls/winex11.drv/opengl.c
View file @
eb5993a7
...
...
@@ -3378,7 +3378,7 @@ static BOOL glxdrv_wglSwapBuffers( HDC hdc )
case
DC_GL_PIXMAP_WIN
:
if
(
ctx
)
sync_context
(
ctx
);
escape
.
gl_drawable
=
gl
->
pixmap
;
if
(
pglXCopySubBufferMESA
)
{
if
(
ctx
&&
pglXCopySubBufferMESA
)
{
/* (glX)SwapBuffers has an implicit glFlush effect, however
* GLX_MESA_copy_sub_buffer doesn't. Make sure GL is flushed before
* copying */
...
...
@@ -3387,7 +3387,7 @@ static BOOL glxdrv_wglSwapBuffers( HDC hdc )
gl
->
pixmap_size
.
cx
,
gl
->
pixmap_size
.
cy
);
break
;
}
if
(
pglXSwapBuffersMscOML
)
if
(
ctx
&&
pglXSwapBuffersMscOML
)
{
pglFlush
();
target_sbc
=
pglXSwapBuffersMscOML
(
gdi_display
,
gl
->
drawable
,
0
,
0
,
0
);
...
...
@@ -3401,7 +3401,7 @@ static BOOL glxdrv_wglSwapBuffers( HDC hdc )
if
(
gl
->
type
==
DC_GL_CHILD_WIN
)
escape
.
gl_drawable
=
gl
->
window
;
/* fall through */
default:
if
(
escape
.
gl_drawable
&&
pglXSwapBuffersMscOML
)
if
(
ctx
&&
escape
.
gl_drawable
&&
pglXSwapBuffersMscOML
)
{
pglFlush
();
target_sbc
=
pglXSwapBuffersMscOML
(
gdi_display
,
gl
->
drawable
,
0
,
0
,
0
);
...
...
@@ -3411,13 +3411,13 @@ static BOOL glxdrv_wglSwapBuffers( HDC hdc )
break
;
}
if
(
escape
.
gl_drawable
&&
pglXWaitForSbcOML
)
if
(
ctx
&&
escape
.
gl_drawable
&&
pglXWaitForSbcOML
)
pglXWaitForSbcOML
(
gdi_display
,
gl
->
drawable
,
target_sbc
,
&
ust
,
&
msc
,
&
sbc
);
release_gl_drawable
(
gl
);
if
(
escape
.
gl_drawable
)
NtGdiExtEscape
(
ctx
->
hdc
,
NULL
,
0
,
X11DRV_ESCAPE
,
sizeof
(
escape
),
(
LPSTR
)
&
escape
,
0
,
NULL
);
NtGdiExtEscape
(
ctx
?
ctx
->
hdc
:
hdc
,
NULL
,
0
,
X11DRV_ESCAPE
,
sizeof
(
escape
),
(
LPSTR
)
&
escape
,
0
,
NULL
);
return
TRUE
;
}
...
...
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