wined3d: Implement surface_modify_ds_location() on top of the regular resource location management.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2016-04-20 19:29:10 +02:00 committed by Alexandre Julliard
parent a077c1f669
commit 2066e1a962
1 changed files with 5 additions and 8 deletions

View File

@ -2606,19 +2606,16 @@ static void surface_depth_blt(const struct wined3d_surface *surface, struct wine
void surface_modify_ds_location(struct wined3d_surface *surface, void surface_modify_ds_location(struct wined3d_surface *surface,
DWORD location, UINT w, UINT h) DWORD location, UINT w, UINT h)
{ {
struct wined3d_texture_sub_resource *sub_resource; struct wined3d_texture *texture = surface->container;
unsigned int sub_resource_idx;
TRACE("surface %p, new location %#x, w %u, h %u.\n", surface, location, w, h); TRACE("surface %p, new location %#x, w %u, h %u.\n", surface, location, w, h);
sub_resource = surface_get_sub_resource(surface); sub_resource_idx = surface_get_sub_resource_idx(surface);
if (((sub_resource->locations & WINED3D_LOCATION_TEXTURE_RGB) && !(location & WINED3D_LOCATION_TEXTURE_RGB))
|| (!(sub_resource->locations & WINED3D_LOCATION_TEXTURE_RGB)
&& (location & WINED3D_LOCATION_TEXTURE_RGB)))
wined3d_texture_set_dirty(surface->container);
surface->ds_current_size.cx = w; surface->ds_current_size.cx = w;
surface->ds_current_size.cy = h; surface->ds_current_size.cy = h;
sub_resource->locations = location; wined3d_texture_validate_location(texture, sub_resource_idx, location);
wined3d_texture_invalidate_location(texture, sub_resource_idx, ~location);
} }
/* Context activation is done by the caller. */ /* Context activation is done by the caller. */