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
2a2554ee
Commit
2a2554ee
authored
Apr 10, 2016
by
Henri Verbeet
Committed by
Alexandre Julliard
Apr 11, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Store sub-resource map counts in the sub-resource structure.
Signed-off-by:
Henri Verbeet
<
hverbeet@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
bcb1ee82
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
22 deletions
+31
-22
surface.c
dlls/wined3d/surface.c
+21
-13
swapchain.c
dlls/wined3d/swapchain.c
+1
-1
texture.c
dlls/wined3d/texture.c
+8
-8
wined3d_private.h
dlls/wined3d/wined3d_private.h
+1
-0
No files found.
dlls/wined3d/surface.c
View file @
2a2554ee
...
...
@@ -477,7 +477,7 @@ static void surface_evict_sysmem(struct wined3d_surface *surface)
unsigned
int
sub_resource_idx
=
surface_get_sub_resource_idx
(
surface
);
struct
wined3d_texture
*
texture
=
surface
->
container
;
if
(
surface
->
resource
.
map_count
||
texture
->
download_count
>
MAXLOCKCOUNT
if
(
texture
->
sub_resources
[
sub_resource_idx
]
.
map_count
||
texture
->
download_count
>
MAXLOCKCOUNT
||
texture
->
flags
&
(
WINED3D_TEXTURE_CONVERTED
|
WINED3D_TEXTURE_PIN_SYSMEM
))
return
;
...
...
@@ -1124,6 +1124,7 @@ void wined3d_surface_upload_data(struct wined3d_surface *surface, const struct w
const
struct
wined3d_format
*
format
,
const
RECT
*
src_rect
,
UINT
src_pitch
,
const
POINT
*
dst_point
,
BOOL
srgb
,
const
struct
wined3d_const_bo_address
*
data
)
{
unsigned
int
sub_resource_idx
=
surface_get_sub_resource_idx
(
surface
);
struct
wined3d_texture
*
texture
=
surface
->
container
;
UINT
update_w
=
src_rect
->
right
-
src_rect
->
left
;
UINT
update_h
=
src_rect
->
bottom
-
src_rect
->
top
;
...
...
@@ -1132,7 +1133,7 @@ void wined3d_surface_upload_data(struct wined3d_surface *surface, const struct w
surface
,
gl_info
,
debug_d3dformat
(
format
->
id
),
wine_dbgstr_rect
(
src_rect
),
src_pitch
,
wine_dbgstr_point
(
dst_point
),
srgb
,
data
->
buffer_object
,
data
->
addr
);
if
(
surface
->
resource
.
map_count
)
if
(
texture
->
sub_resources
[
sub_resource_idx
]
.
map_count
)
{
WARN
(
"Uploading a surface that is currently mapped, setting WINED3D_TEXTURE_PIN_SYSMEM.
\n
"
);
texture
->
flags
|=
WINED3D_TEXTURE_PIN_SYSMEM
;
...
...
@@ -4178,6 +4179,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
struct
wined3d_device
*
device
=
dst_texture
->
resource
.
device
;
struct
wined3d_swapchain
*
src_swapchain
,
*
dst_swapchain
;
struct
wined3d_texture
*
src_texture
=
NULL
;
unsigned
int
src_sub_resource_idx
=
0
;
DWORD
src_ds_flags
,
dst_ds_flags
;
BOOL
scale
,
convert
;
...
...
@@ -4207,7 +4209,14 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
fx
->
src_color_key
.
color_space_high_value
);
}
if
(
dst_surface
->
resource
.
map_count
||
(
src_surface
&&
src_surface
->
resource
.
map_count
))
if
(
src_surface
)
{
src_texture
=
src_surface
->
container
;
src_sub_resource_idx
=
surface_get_sub_resource_idx
(
src_surface
);
}
if
(
dst_texture
->
sub_resources
[
dst_sub_resource_idx
].
map_count
||
(
src_texture
&&
src_texture
->
sub_resources
[
src_sub_resource_idx
].
map_count
))
{
WARN
(
"Surface is busy, returning WINEDDERR_SURFACEBUSY.
\n
"
);
return
WINEDDERR_SURFACEBUSY
;
...
...
@@ -4223,7 +4232,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
return
WINEDDERR_INVALIDRECT
;
}
if
(
src_
surfac
e
)
if
(
src_
textur
e
)
{
if
(
src_rect
->
left
>=
src_rect
->
right
||
src_rect
->
top
>=
src_rect
->
bottom
||
src_rect
->
left
>
src_surface
->
resource
.
width
||
src_rect
->
left
<
0
...
...
@@ -4234,7 +4243,6 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
WARN
(
"The application gave us a bad source rectangle.
\n
"
);
return
WINEDDERR_INVALIDRECT
;
}
src_texture
=
src_surface
->
container
;
}
if
(
!
fx
||
!
(
fx
->
fx
))
...
...
@@ -4284,7 +4292,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
goto
fallback
;
}
if
(
src_
surfac
e
)
if
(
src_
textur
e
)
src_swapchain
=
src_texture
->
swapchain
;
else
src_swapchain
=
NULL
;
...
...
@@ -4302,14 +4310,14 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
goto
fallback
;
}
scale
=
src_
surfac
e
scale
=
src_
textur
e
&&
(
src_rect
->
right
-
src_rect
->
left
!=
dst_rect
->
right
-
dst_rect
->
left
||
src_rect
->
bottom
-
src_rect
->
top
!=
dst_rect
->
bottom
-
dst_rect
->
top
);
convert
=
src_
surfac
e
&&
src_texture
->
resource
.
format
->
id
!=
dst_texture
->
resource
.
format
->
id
;
convert
=
src_
textur
e
&&
src_texture
->
resource
.
format
->
id
!=
dst_texture
->
resource
.
format
->
id
;
dst_ds_flags
=
dst_texture
->
resource
.
format_flags
&
(
WINED3DFMT_FLAG_DEPTH
|
WINED3DFMT_FLAG_STENCIL
);
if
(
src_
surfac
e
)
if
(
src_
textur
e
)
src_ds_flags
=
src_texture
->
resource
.
format_flags
&
(
WINED3DFMT_FLAG_DEPTH
|
WINED3DFMT_FLAG_STENCIL
);
else
...
...
@@ -4348,12 +4356,12 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
const
struct
blit_shader
*
blitter
;
dst_sub_resource
=
surface_get_sub_resource
(
dst_surface
);
src_sub_resource
=
src_
surface
?
surface_get_sub_resource
(
src_surface
)
:
NULL
;
src_sub_resource
=
src_
texture
?
&
src_texture
->
sub_resources
[
src_sub_resource_idx
]
:
NULL
;
/* In principle this would apply to depth blits as well, but we don't
* implement those in the CPU blitter at the moment. */
if
((
dst_sub_resource
->
locations
&
dst_surface
->
resource
.
map_binding
)
&&
(
!
src_
surfac
e
||
(
src_sub_resource
->
locations
&
src_surface
->
resource
.
map_binding
)))
&&
(
!
src_
textur
e
||
(
src_sub_resource
->
locations
&
src_surface
->
resource
.
map_binding
)))
{
if
(
scale
)
TRACE
(
"Not doing sysmem blit because of scaling.
\n
"
);
...
...
@@ -4483,8 +4491,8 @@ fallback:
return
WINED3D_OK
;
cpu:
return
surface_cpu_blt
(
dst_texture
,
surface_get_sub_resource_idx
(
dst_surface
)
,
&
dst_box
,
src_texture
,
src_
texture
?
surface_get_sub_resource_idx
(
src_surface
)
:
0
,
&
src_box
,
flags
,
fx
,
filter
);
return
surface_cpu_blt
(
dst_texture
,
dst_sub_resource_idx
,
&
dst_box
,
src_texture
,
src_
sub_resource_idx
,
&
src_box
,
flags
,
fx
,
filter
);
}
HRESULT
wined3d_surface_init
(
struct
wined3d_surface
*
surface
,
struct
wined3d_texture
*
container
,
...
...
dlls/wined3d/swapchain.c
View file @
2a2554ee
...
...
@@ -663,7 +663,7 @@ static void swapchain_gdi_frontbuffer_updated(struct wined3d_swapchain *swapchai
if
(
swapchain
->
palette
)
wined3d_palette_apply_to_dc
(
swapchain
->
palette
,
front
->
hDC
);
if
(
front
->
resource
.
map_count
)
if
(
front
->
container
->
resource
.
map_count
)
ERR
(
"Trying to blit a mapped surface.
\n
"
);
TRACE
(
"Copying surface %p to screen.
\n
"
,
front
);
...
...
dlls/wined3d/texture.c
View file @
2a2554ee
...
...
@@ -853,7 +853,7 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT
sub_resource
=
&
texture
->
sub_resources
[
0
];
surface
=
sub_resource
->
u
.
surface
;
if
(
sub_resource
->
resource
->
map_count
||
(
surface
->
flags
&
SFLAG_DCINUSE
))
if
(
sub_resource
->
map_count
||
(
surface
->
flags
&
SFLAG_DCINUSE
))
{
WARN
(
"Surface is mapped or the DC is in use.
\n
"
);
return
WINED3DERR_INVALIDCALL
;
...
...
@@ -1291,7 +1291,7 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour
return
WINED3DERR_INVALIDCALL
;
}
if
(
sub_resource
->
resource
->
map_count
)
if
(
sub_resource
->
map_count
)
{
WARN
(
"Sub-resource is already mapped.
\n
"
);
return
WINED3DERR_INVALIDCALL
;
...
...
@@ -1409,7 +1409,7 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour
}
++
resource
->
map_count
;
++
sub_resource
->
resource
->
map_count
;
++
sub_resource
->
map_count
;
TRACE
(
"Returning memory %p, row pitch %u, slice pitch %u.
\n
"
,
map_desc
->
data
,
map_desc
->
row_pitch
,
map_desc
->
slice_pitch
);
...
...
@@ -1430,7 +1430,7 @@ static HRESULT texture_resource_sub_resource_unmap(struct wined3d_resource *reso
if
(
!
(
sub_resource
=
wined3d_texture_get_sub_resource
(
texture
,
sub_resource_idx
)))
return
E_INVALIDARG
;
if
(
!
sub_resource
->
resource
->
map_count
)
if
(
!
sub_resource
->
map_count
)
{
WARN
(
"Trying to unmap unmapped sub-resource.
\n
"
);
return
WINEDDERR_NOTLOCKED
;
...
...
@@ -1473,7 +1473,7 @@ static HRESULT texture_resource_sub_resource_unmap(struct wined3d_resource *reso
FIXME
(
"Depth / stencil buffer locking is not implemented.
\n
"
);
}
--
sub_resource
->
resource
->
map_count
;
--
sub_resource
->
map_count
;
--
resource
->
map_count
;
return
WINED3D_OK
;
...
...
@@ -2237,7 +2237,7 @@ HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned i
return
WINEDDERR_DCALREADYCREATED
;
/* Can't GetDC if the surface is locked. */
if
(
su
rface
->
resource
.
map_count
)
if
(
su
b_resource
->
map_count
)
return
WINED3DERR_INVALIDCALL
;
if
(
device
->
d3d_initialized
)
...
...
@@ -2266,7 +2266,7 @@ HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned i
surface
->
flags
|=
SFLAG_DCINUSE
;
++
texture
->
resource
.
map_count
;
surface
->
resource
.
map_count
++
;
++
sub_resource
->
map_count
;
*
dc
=
surface
->
hDC
;
TRACE
(
"Returning dc %p.
\n
"
,
*
dc
);
...
...
@@ -2304,7 +2304,7 @@ HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsign
return
WINEDDERR_NODC
;
}
surface
->
resource
.
map_count
--
;
--
sub_resource
->
map_count
;
--
texture
->
resource
.
map_count
;
surface
->
flags
&=
~
SFLAG_DCINUSE
;
...
...
dlls/wined3d/wined3d_private.h
View file @
2a2554ee
...
...
@@ -2484,6 +2484,7 @@ struct wined3d_texture
struct
wined3d_volume
*
volume
;
}
u
;
unsigned
int
map_count
;
DWORD
locations
;
GLuint
buffer_object
;
}
sub_resources
[
1
];
...
...
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