wined3d: Introduce wined3d_texture_set_sub_resource_parent().

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2016-02-29 11:38:21 +01:00 committed by Alexandre Julliard
parent 77960ab755
commit 5c1976c43b
4 changed files with 22 additions and 3 deletions

View File

@ -1266,7 +1266,7 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface7_Flip(IDirectDrawSurface7
wined3d_device_set_rendertarget_view(dst_impl->ddraw->wined3d_device, 0, src_rtv, FALSE); wined3d_device_set_rendertarget_view(dst_impl->ddraw->wined3d_device, 0, src_rtv, FALSE);
wined3d_rendertarget_view_set_parent(src_rtv, dst_impl); wined3d_rendertarget_view_set_parent(src_rtv, dst_impl);
dst_impl->wined3d_rtv = src_rtv; dst_impl->wined3d_rtv = src_rtv;
wined3d_resource_set_parent(wined3d_texture_get_sub_resource(src_impl->wined3d_texture, 0), dst_impl); wined3d_texture_set_sub_resource_parent(src_impl->wined3d_texture, 0, dst_impl);
prev_ddraw_texture = wined3d_texture_get_parent(src_impl->wined3d_texture); prev_ddraw_texture = wined3d_texture_get_parent(src_impl->wined3d_texture);
wined3d_resource_set_parent(wined3d_texture_get_resource(src_impl->wined3d_texture), ddraw_texture); wined3d_resource_set_parent(wined3d_texture_get_resource(src_impl->wined3d_texture), ddraw_texture);
if (src_impl->sub_resource_idx) if (src_impl->sub_resource_idx)
@ -1297,7 +1297,7 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface7_Flip(IDirectDrawSurface7
wined3d_device_set_rendertarget_view(dst_impl->ddraw->wined3d_device, 0, src_rtv, FALSE); wined3d_device_set_rendertarget_view(dst_impl->ddraw->wined3d_device, 0, src_rtv, FALSE);
wined3d_rendertarget_view_set_parent(src_rtv, dst_impl); wined3d_rendertarget_view_set_parent(src_rtv, dst_impl);
dst_impl->wined3d_rtv = src_rtv; dst_impl->wined3d_rtv = src_rtv;
wined3d_resource_set_parent(wined3d_texture_get_sub_resource(src_impl->wined3d_texture, 0), dst_impl); wined3d_texture_set_sub_resource_parent(src_impl->wined3d_texture, 0, dst_impl);
prev_ddraw_texture = wined3d_texture_get_parent(src_impl->wined3d_texture); prev_ddraw_texture = wined3d_texture_get_parent(src_impl->wined3d_texture);
wined3d_resource_set_parent(wined3d_texture_get_resource(src_impl->wined3d_texture), ddraw_texture); wined3d_resource_set_parent(wined3d_texture_get_resource(src_impl->wined3d_texture), ddraw_texture);
ddraw_texture = prev_ddraw_texture; ddraw_texture = prev_ddraw_texture;
@ -1314,7 +1314,7 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface7_Flip(IDirectDrawSurface7
wined3d_device_set_rendertarget_view(dst_impl->ddraw->wined3d_device, 0, tmp_rtv, FALSE); wined3d_device_set_rendertarget_view(dst_impl->ddraw->wined3d_device, 0, tmp_rtv, FALSE);
wined3d_rendertarget_view_set_parent(tmp_rtv, src_impl); wined3d_rendertarget_view_set_parent(tmp_rtv, src_impl);
src_impl->wined3d_rtv = tmp_rtv; src_impl->wined3d_rtv = tmp_rtv;
wined3d_resource_set_parent(wined3d_texture_get_sub_resource(texture, 0), src_impl); wined3d_texture_set_sub_resource_parent(texture, 0, src_impl);
wined3d_resource_set_parent(wined3d_texture_get_resource(texture), ddraw_texture); wined3d_resource_set_parent(wined3d_texture_get_resource(texture), ddraw_texture);
src_impl->wined3d_texture = texture; src_impl->wined3d_texture = texture;

View File

@ -1537,6 +1537,22 @@ void * CDECL wined3d_texture_get_sub_resource_parent(struct wined3d_texture *tex
return texture->sub_resources[sub_resource_idx].resource->parent; return texture->sub_resources[sub_resource_idx].resource->parent;
} }
void CDECL wined3d_texture_set_sub_resource_parent(struct wined3d_texture *texture,
unsigned int sub_resource_idx, void *parent)
{
unsigned int sub_count = texture->level_count * texture->layer_count;
TRACE("texture %p, sub_resource_idx %u, parent %p.\n", texture, sub_resource_idx, parent);
if (sub_resource_idx >= sub_count)
{
WARN("sub_resource_idx %u >= sub_count %u.\n", sub_resource_idx, sub_count);
return;
}
texture->sub_resources[sub_resource_idx].resource->parent = parent;
}
HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct wined3d_resource_desc *desc, HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct wined3d_resource_desc *desc,
UINT level_count, DWORD flags, const struct wined3d_sub_resource_data *data, void *parent, UINT level_count, DWORD flags, const struct wined3d_sub_resource_data *data, void *parent,
const struct wined3d_parent_ops *parent_ops, struct wined3d_texture **texture) const struct wined3d_parent_ops *parent_ops, struct wined3d_texture **texture)

View File

@ -259,6 +259,7 @@
@ cdecl wined3d_texture_set_color_key(ptr long ptr) @ cdecl wined3d_texture_set_color_key(ptr long ptr)
@ cdecl wined3d_texture_set_lod(ptr long) @ cdecl wined3d_texture_set_lod(ptr long)
@ cdecl wined3d_texture_set_overlay_position(ptr long long long) @ cdecl wined3d_texture_set_overlay_position(ptr long long long)
@ cdecl wined3d_texture_set_sub_resource_parent(ptr long ptr)
@ cdecl wined3d_texture_update_desc(ptr long long long long long ptr long) @ cdecl wined3d_texture_update_desc(ptr long long long long long ptr long)
@ cdecl wined3d_texture_update_overlay(ptr long ptr ptr long ptr long) @ cdecl wined3d_texture_update_overlay(ptr long ptr ptr long ptr long)

View File

@ -2458,6 +2458,8 @@ HRESULT __cdecl wined3d_texture_set_color_key(struct wined3d_texture *texture,
DWORD __cdecl wined3d_texture_set_lod(struct wined3d_texture *texture, DWORD lod); DWORD __cdecl wined3d_texture_set_lod(struct wined3d_texture *texture, DWORD lod);
HRESULT __cdecl wined3d_texture_set_overlay_position(struct wined3d_texture *texture, HRESULT __cdecl wined3d_texture_set_overlay_position(struct wined3d_texture *texture,
unsigned int sub_resource_idx, LONG x, LONG y); unsigned int sub_resource_idx, LONG x, LONG y);
void __cdecl wined3d_texture_set_sub_resource_parent(struct wined3d_texture *texture,
unsigned int sub_resource_idx, void *parent);
HRESULT __cdecl wined3d_texture_update_desc(struct wined3d_texture *texture, HRESULT __cdecl wined3d_texture_update_desc(struct wined3d_texture *texture,
UINT width, UINT height, enum wined3d_format_id format_id, UINT width, UINT height, enum wined3d_format_id format_id,
enum wined3d_multisample_type multisample_type, UINT multisample_quality, enum wined3d_multisample_type multisample_type, UINT multisample_quality,