wined3d: Simplify wined3d_rendertarget_view_create_from_sub_resource().

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-02 19:23:31 +01:00 committed by Alexandre Julliard
parent 44f2589e7c
commit 8f1cf93b21
1 changed files with 6 additions and 11 deletions

View File

@ -164,22 +164,17 @@ HRESULT CDECL wined3d_rendertarget_view_create_from_sub_resource(struct wined3d_
unsigned int sub_resource_idx, void *parent, const struct wined3d_parent_ops *parent_ops, unsigned int sub_resource_idx, void *parent, const struct wined3d_parent_ops *parent_ops,
struct wined3d_rendertarget_view **view) struct wined3d_rendertarget_view **view)
{ {
struct wined3d_resource *sub_resource; struct wined3d_rendertarget_view_desc desc;
TRACE("texture %p, sub_resource_idx %u, parent %p, parent_ops %p, view %p.\n", TRACE("texture %p, sub_resource_idx %u, parent %p, parent_ops %p, view %p.\n",
texture, sub_resource_idx, parent, parent_ops, view); texture, sub_resource_idx, parent, parent_ops, view);
if (!(sub_resource = wined3d_texture_get_sub_resource(texture, sub_resource_idx))) desc.format_id = texture->resource.format->id;
return WINED3DERR_INVALIDCALL; desc.u.texture.level_idx = sub_resource_idx % texture->level_count;
desc.u.texture.layer_idx = sub_resource_idx / texture->level_count;
desc.u.texture.layer_count = 1;
if (sub_resource->type != WINED3D_RTYPE_SURFACE) return wined3d_rendertarget_view_create(&desc, &texture->resource, parent, parent_ops, view);
{
FIXME("Not implemented for %s resources.\n", debug_d3dresourcetype(texture->resource.type));
return WINED3DERR_INVALIDCALL;
}
return wined3d_rendertarget_view_create_from_surface(surface_from_resource(sub_resource),
parent, parent_ops, view);
} }
ULONG CDECL wined3d_shader_resource_view_incref(struct wined3d_shader_resource_view *view) ULONG CDECL wined3d_shader_resource_view_incref(struct wined3d_shader_resource_view *view)