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
b712d6c8
Commit
b712d6c8
authored
Jan 03, 2024
by
Zebediah Figura
Committed by
Alexandre Julliard
Jan 17, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw: Sync to sysmem after performing a color fill.
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=56119
parent
48ecde18
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
3 deletions
+33
-3
surface.c
dlls/ddraw/surface.c
+31
-1
ddraw1.c
dlls/ddraw/tests/ddraw1.c
+2
-2
No files found.
dlls/ddraw/surface.c
View file @
b712d6c8
...
...
@@ -1531,6 +1531,33 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface2_Flip(IDirectDrawSurface2
src_impl
?
&
src_impl
->
IDirectDrawSurface_iface
:
NULL
,
flags
);
}
/* Emperor: Rise of the Middle Kingdom accesses the map pointer outside of
* Lock()/Unlock(), and expects those updates to be propagated by a Blt().
* It also blits to the surface, and color-fills it.
*
* This function is called after a color-fill that might update the GPU side.
* We need to make sure the sysmem surface is synchronized. */
static
void
ddraw_surface_sync_pinned_sysmem
(
struct
ddraw_surface
*
surface
)
{
RECT
rect
;
if
(
!
surface
->
draw_texture
)
return
;
if
(
!
(
surface
->
surface_desc
.
ddsCaps
.
dwCaps
&
DDSCAPS_SYSTEMMEMORY
))
return
;
SetRect
(
&
rect
,
0
,
0
,
surface
->
surface_desc
.
dwWidth
,
surface
->
surface_desc
.
dwHeight
);
wined3d_device_context_blt
(
surface
->
ddraw
->
immediate_context
,
surface
->
wined3d_texture
,
surface
->
sub_resource_idx
,
&
rect
,
surface
->
draw_texture
,
surface
->
sub_resource_idx
,
&
rect
,
WINED3D_BLT_SYNCHRONOUS
,
NULL
,
WINED3D_TEXF_POINT
);
/* The sysmem surface may be updated at any time, so we must invalidate the
* draw texture location here. */
surface
->
texture_location
=
DDRAW_SURFACE_LOCATION_DEFAULT
;
}
static
HRESULT
ddraw_surface_blt
(
struct
ddraw_surface
*
dst_surface
,
const
RECT
*
dst_rect
,
struct
ddraw_surface
*
src_surface
,
const
RECT
*
src_rect
,
DWORD
flags
,
DWORD
fill_colour
,
const
struct
wined3d_blt_fx
*
fx
,
enum
wined3d_texture_filter_type
filter
)
...
...
@@ -1539,6 +1566,7 @@ static HRESULT ddraw_surface_blt(struct ddraw_surface *dst_surface, const RECT *
struct
wined3d_device
*
wined3d_device
=
ddraw
->
wined3d_device
;
struct
wined3d_color
colour
;
DWORD
wined3d_flags
;
HRESULT
hr
;
if
(
flags
&
DDBLT_COLORFILL
)
{
...
...
@@ -1552,9 +1580,11 @@ static HRESULT ddraw_surface_blt(struct ddraw_surface *dst_surface, const RECT *
wined3d_device_apply_stateblock
(
wined3d_device
,
ddraw
->
state
);
ddraw_surface_get_draw_texture
(
dst_surface
,
dst_rect
?
DDRAW_SURFACE_RW
:
DDRAW_SURFACE_WRITE
);
return
wined3d_device_context_clear_rendertarget_view
(
ddraw
->
immediate_context
,
hr
=
wined3d_device_context_clear_rendertarget_view
(
ddraw
->
immediate_context
,
ddraw_surface_get_rendertarget_view
(
dst_surface
),
dst_rect
,
wined3d_flags
,
&
colour
,
0
.
0
f
,
0
);
ddraw_surface_sync_pinned_sysmem
(
dst_surface
);
return
hr
;
}
if
(
flags
&
DDBLT_DEPTHFILL
)
...
...
dlls/ddraw/tests/ddraw1.c
View file @
b712d6c8
...
...
@@ -15507,7 +15507,7 @@ static void test_pinned_sysmem(void)
ok
(
hr
==
S_OK
,
"Got hr %#lx.
\n
"
,
hr
);
color
=
((
unsigned
short
*
)
surface_desc
.
lpSurface
)[
0
];
todo_wine
ok
(
color
==
0xface
,
"Got color %04x.
\n
"
,
color
);
ok
(
color
==
0xface
,
"Got color %04x.
\n
"
,
color
);
memset
(
surface_desc
.
lpSurface
,
0x55
,
32
*
16
*
2
);
...
...
@@ -15517,7 +15517,7 @@ static void test_pinned_sysmem(void)
hr
=
IDirectDrawSurface_Lock
(
surface2
,
NULL
,
&
surface_desc
,
DDLOCK_WAIT
,
NULL
);
ok
(
hr
==
S_OK
,
"Got hr %#lx.
\n
"
,
hr
);
color
=
((
unsigned
short
*
)
surface_desc
.
lpSurface
)[
0
];
todo_wine
ok
(
color
==
0x5555
,
"Got color %04x.
\n
"
,
color
);
ok
(
color
==
0x5555
,
"Got color %04x.
\n
"
,
color
);
color
=
((
unsigned
short
*
)
surface_desc
.
lpSurface
)[
32
*
16
];
ok
(
color
==
0xface
,
"Got color %04x.
\n
"
,
color
);
hr
=
IDirectDrawSurface_Unlock
(
surface2
,
NULL
);
...
...
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