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
992dbc10
Commit
992dbc10
authored
Jan 17, 2012
by
Henri Verbeet
Committed by
Alexandre Julliard
Jan 18, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw: Maintain D3D state across cooperative level changes.
parent
dfa7e9b5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
69 additions
and
10 deletions
+69
-10
ddraw.c
dlls/ddraw/ddraw.c
+59
-0
ddraw1.c
dlls/ddraw/tests/ddraw1.c
+1
-1
ddraw2.c
dlls/ddraw/tests/ddraw2.c
+3
-3
ddraw4.c
dlls/ddraw/tests/ddraw4.c
+3
-3
ddraw7.c
dlls/ddraw/tests/ddraw7.c
+3
-3
No files found.
dlls/ddraw/ddraw.c
View file @
992dbc10
...
...
@@ -759,6 +759,9 @@ static HRESULT ddraw_create_swapchain(IDirectDrawImpl *ddraw, HWND window, BOOL
static
HRESULT
WINAPI
ddraw7_SetCooperativeLevel
(
IDirectDraw7
*
iface
,
HWND
hwnd
,
DWORD
cooplevel
)
{
IDirectDrawImpl
*
This
=
impl_from_IDirectDraw7
(
iface
);
struct
wined3d_stateblock
*
stateblock
;
struct
wined3d_surface
*
rt
,
*
ds
;
BOOL
restore_state
=
FALSE
;
HWND
window
;
HRESULT
hr
;
...
...
@@ -914,10 +917,66 @@ static HRESULT WINAPI ddraw7_SetCooperativeLevel(IDirectDraw7 *iface, HWND hwnd,
wined3d_device_set_multithreaded
(
This
->
wined3d_device
);
if
(
This
->
wined3d_swapchain
)
{
if
(
DefaultSurfaceType
!=
SURFACE_GDI
)
{
restore_state
=
TRUE
;
if
(
FAILED
(
hr
=
wined3d_stateblock_create
(
This
->
wined3d_device
,
WINED3DSBT_ALL
,
&
stateblock
)))
{
ERR
(
"Failed to create stateblock, hr %#x.
\n
"
,
hr
);
wined3d_mutex_unlock
();
return
hr
;
}
if
(
FAILED
(
hr
=
wined3d_stateblock_capture
(
stateblock
)))
{
ERR
(
"Failed to capture stateblock, hr %#x.
\n
"
,
hr
);
wined3d_stateblock_decref
(
stateblock
);
wined3d_mutex_unlock
();
return
hr
;
}
wined3d_device_get_render_target
(
This
->
wined3d_device
,
0
,
&
rt
);
if
(
rt
==
This
->
wined3d_frontbuffer
)
{
wined3d_surface_decref
(
rt
);
rt
=
NULL
;
}
wined3d_device_get_depth_stencil
(
This
->
wined3d_device
,
&
ds
);
}
ddraw_destroy_swapchain
(
This
);
}
if
(
FAILED
(
hr
=
ddraw_create_swapchain
(
This
,
This
->
dest_window
,
!
(
cooplevel
&
DDSCL_FULLSCREEN
))))
ERR
(
"Failed to create swapchain, hr %#x.
\n
"
,
hr
);
if
(
restore_state
)
{
if
(
ds
)
{
wined3d_device_set_depth_stencil
(
This
->
wined3d_device
,
ds
);
wined3d_surface_decref
(
ds
);
}
if
(
rt
)
{
wined3d_device_set_render_target
(
This
->
wined3d_device
,
0
,
rt
,
FALSE
);
wined3d_surface_decref
(
rt
);
}
hr
=
wined3d_stateblock_apply
(
stateblock
);
wined3d_stateblock_decref
(
stateblock
);
if
(
FAILED
(
hr
))
{
ERR
(
"Failed to apply stateblock, hr %#x.
\n
"
,
hr
);
wined3d_mutex_unlock
();
return
hr
;
}
}
/* Unhandled flags */
if
(
cooplevel
&
DDSCL_ALLOWREBOOT
)
WARN
(
"(%p) Unhandled flag DDSCL_ALLOWREBOOT, harmless
\n
"
,
This
);
...
...
dlls/ddraw/tests/ddraw1.c
View file @
992dbc10
...
...
@@ -575,7 +575,7 @@ static void test_coop_level_d3d_state(void)
hr
=
IDirect3DViewport_Clear
(
viewport
,
1
,
&
clear_rect
,
D3DCLEAR_TARGET
);
ok
(
SUCCEEDED
(
hr
),
"Failed to clear viewport, hr %#x.
\n
"
,
hr
);
color
=
get_surface_color
(
rt
,
320
,
240
);
todo_wine
ok
(
compare_color
(
color
,
0x0000ff00
,
1
),
"Got unexpected color 0x%08x.
\n
"
,
color
);
ok
(
compare_color
(
color
,
0x0000ff00
,
1
),
"Got unexpected color 0x%08x.
\n
"
,
color
);
hr
=
IDirect3DDevice_DeleteViewport
(
device
,
viewport
);
ok
(
SUCCEEDED
(
hr
),
"Failed to delete viewport, hr %#x.
\n
"
,
hr
);
...
...
dlls/ddraw/tests/ddraw2.c
View file @
992dbc10
...
...
@@ -593,14 +593,14 @@ static void test_coop_level_d3d_state(void)
ok
(
surface
==
rt
,
"Got unexpected surface %p.
\n
"
,
surface
);
hr
=
IDirect3DDevice2_GetRenderState
(
device
,
D3DRENDERSTATE_ZENABLE
,
&
value
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get render state, hr %#x.
\n
"
,
hr
);
todo_wine
ok
(
!!
value
,
"Got unexpected z-enable state %#x.
\n
"
,
value
);
ok
(
!!
value
,
"Got unexpected z-enable state %#x.
\n
"
,
value
);
hr
=
IDirect3DDevice2_GetRenderState
(
device
,
D3DRENDERSTATE_ALPHABLENDENABLE
,
&
value
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get render state, hr %#x.
\n
"
,
hr
);
todo_wine
ok
(
!!
value
,
"Got unexpected alpha blend enable state %#x.
\n
"
,
value
);
ok
(
!!
value
,
"Got unexpected alpha blend enable state %#x.
\n
"
,
value
);
hr
=
IDirect3DViewport2_Clear
(
viewport
,
1
,
&
clear_rect
,
D3DCLEAR_TARGET
);
ok
(
SUCCEEDED
(
hr
),
"Failed to clear viewport, hr %#x.
\n
"
,
hr
);
color
=
get_surface_color
(
rt
,
320
,
240
);
todo_wine
ok
(
compare_color
(
color
,
0x0000ff00
,
1
),
"Got unexpected color 0x%08x.
\n
"
,
color
);
ok
(
compare_color
(
color
,
0x0000ff00
,
1
),
"Got unexpected color 0x%08x.
\n
"
,
color
);
hr
=
IDirect3DDevice2_DeleteViewport
(
device
,
viewport
);
ok
(
SUCCEEDED
(
hr
),
"Failed to delete viewport, hr %#x.
\n
"
,
hr
);
...
...
dlls/ddraw/tests/ddraw4.c
View file @
992dbc10
...
...
@@ -784,14 +784,14 @@ static void test_coop_level_d3d_state(void)
ok
(
surface
==
rt
,
"Got unexpected surface %p.
\n
"
,
surface
);
hr
=
IDirect3DDevice3_GetRenderState
(
device
,
D3DRENDERSTATE_ZENABLE
,
&
value
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get render state, hr %#x.
\n
"
,
hr
);
todo_wine
ok
(
!!
value
,
"Got unexpected z-enable state %#x.
\n
"
,
value
);
ok
(
!!
value
,
"Got unexpected z-enable state %#x.
\n
"
,
value
);
hr
=
IDirect3DDevice3_GetRenderState
(
device
,
D3DRENDERSTATE_ALPHABLENDENABLE
,
&
value
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get render state, hr %#x.
\n
"
,
hr
);
todo_wine
ok
(
!!
value
,
"Got unexpected alpha blend enable state %#x.
\n
"
,
value
);
ok
(
!!
value
,
"Got unexpected alpha blend enable state %#x.
\n
"
,
value
);
hr
=
IDirect3DViewport3_Clear2
(
viewport
,
1
,
&
clear_rect
,
D3DCLEAR_TARGET
,
0xff00ff00
,
0
.
0
f
,
0
);
ok
(
SUCCEEDED
(
hr
),
"Failed to clear viewport, hr %#x.
\n
"
,
hr
);
color
=
get_surface_color
(
rt
,
320
,
240
);
todo_wine
ok
(
compare_color
(
color
,
0x0000ff00
,
1
),
"Got unexpected color 0x%08x.
\n
"
,
color
);
ok
(
compare_color
(
color
,
0x0000ff00
,
1
),
"Got unexpected color 0x%08x.
\n
"
,
color
);
hr
=
IDirect3DDevice3_DeleteViewport
(
device
,
viewport
);
ok
(
SUCCEEDED
(
hr
),
"Failed to delete viewport, hr %#x.
\n
"
,
hr
);
...
...
dlls/ddraw/tests/ddraw7.c
View file @
992dbc10
...
...
@@ -754,14 +754,14 @@ static void test_coop_level_d3d_state(void)
ok
(
surface
==
rt
,
"Got unexpected surface %p.
\n
"
,
surface
);
hr
=
IDirect3DDevice7_GetRenderState
(
device
,
D3DRENDERSTATE_ZENABLE
,
&
value
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get render state, hr %#x.
\n
"
,
hr
);
todo_wine
ok
(
!!
value
,
"Got unexpected z-enable state %#x.
\n
"
,
value
);
ok
(
!!
value
,
"Got unexpected z-enable state %#x.
\n
"
,
value
);
hr
=
IDirect3DDevice7_GetRenderState
(
device
,
D3DRENDERSTATE_ALPHABLENDENABLE
,
&
value
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get render state, hr %#x.
\n
"
,
hr
);
todo_wine
ok
(
!!
value
,
"Got unexpected alpha blend enable state %#x.
\n
"
,
value
);
ok
(
!!
value
,
"Got unexpected alpha blend enable state %#x.
\n
"
,
value
);
hr
=
IDirect3DDevice7_Clear
(
device
,
0
,
NULL
,
D3DCLEAR_TARGET
,
0xff00ff00
,
0
.
0
f
,
0
);
ok
(
SUCCEEDED
(
hr
),
"Failed to clear render target, hr %#x.
\n
"
,
hr
);
color
=
get_surface_color
(
rt
,
320
,
240
);
todo_wine
ok
(
compare_color
(
color
,
0x0000ff00
,
1
),
"Got unexpected color 0x%08x.
\n
"
,
color
);
ok
(
compare_color
(
color
,
0x0000ff00
,
1
),
"Got unexpected color 0x%08x.
\n
"
,
color
);
IDirectDrawSurface7_Release
(
surface
);
IDirectDrawSurface7_Release
(
rt
);
...
...
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