wined3d: Introduce wined3d_rendertarget_view_create_from_sub_resource().
Initial usage in d3d9. Signed-off-by: Riccardo Bortolato <rikyz619@gmail.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
2d23a95c96
commit
3e491662ba
|
@ -428,8 +428,8 @@ struct wined3d_rendertarget_view *d3d9_surface_get_rendertarget_view(struct d3d9
|
|||
if (surface->wined3d_rtv)
|
||||
return surface->wined3d_rtv;
|
||||
|
||||
if (FAILED(hr = wined3d_rendertarget_view_create_from_surface(surface->wined3d_surface,
|
||||
surface, &d3d9_view_wined3d_parent_ops, &surface->wined3d_rtv)))
|
||||
if (FAILED(hr = wined3d_rendertarget_view_create_from_sub_resource(surface->wined3d_texture,
|
||||
surface->sub_resource_idx, surface, &d3d9_view_wined3d_parent_ops, &surface->wined3d_rtv)))
|
||||
{
|
||||
ERR("Failed to create rendertarget view, hr %#x.\n", hr);
|
||||
return NULL;
|
||||
|
|
|
@ -160,6 +160,28 @@ HRESULT CDECL wined3d_rendertarget_view_create_from_surface(struct wined3d_surfa
|
|||
return wined3d_rendertarget_view_create(&desc, &surface->container->resource, parent, parent_ops, view);
|
||||
}
|
||||
|
||||
HRESULT CDECL wined3d_rendertarget_view_create_from_sub_resource(struct wined3d_texture *texture,
|
||||
unsigned int sub_resource_idx, void *parent, const struct wined3d_parent_ops *parent_ops,
|
||||
struct wined3d_rendertarget_view **view)
|
||||
{
|
||||
struct wined3d_resource *sub_resource;
|
||||
|
||||
TRACE("texture %p, sub_resource_idx %u, parent %p, parent_ops %p, view %p.\n",
|
||||
texture, sub_resource_idx, parent, parent_ops, view);
|
||||
|
||||
if (!(sub_resource = wined3d_texture_get_sub_resource(texture, sub_resource_idx)))
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
|
||||
if (sub_resource->type != WINED3D_RTYPE_SURFACE)
|
||||
{
|
||||
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 refcount = InterlockedIncrement(&view->refcount);
|
||||
|
|
|
@ -187,6 +187,7 @@
|
|||
|
||||
@ cdecl wined3d_rendertarget_view_create(ptr ptr ptr ptr ptr)
|
||||
@ cdecl wined3d_rendertarget_view_create_from_surface(ptr ptr ptr ptr)
|
||||
@ cdecl wined3d_rendertarget_view_create_from_sub_resource(ptr long ptr ptr ptr)
|
||||
@ cdecl wined3d_rendertarget_view_decref(ptr)
|
||||
@ cdecl wined3d_rendertarget_view_get_parent(ptr)
|
||||
@ cdecl wined3d_rendertarget_view_get_resource(ptr)
|
||||
|
|
|
@ -2430,6 +2430,9 @@ HRESULT __cdecl wined3d_rendertarget_view_create(const struct wined3d_rendertarg
|
|||
struct wined3d_rendertarget_view **view);
|
||||
HRESULT __cdecl wined3d_rendertarget_view_create_from_surface(struct wined3d_surface *surface,
|
||||
void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_rendertarget_view **view);
|
||||
HRESULT __cdecl wined3d_rendertarget_view_create_from_sub_resource(struct wined3d_texture *texture,
|
||||
unsigned int sub_resource_idx, void *parent, const struct wined3d_parent_ops *parent_ops,
|
||||
struct wined3d_rendertarget_view **view);
|
||||
ULONG __cdecl wined3d_rendertarget_view_decref(struct wined3d_rendertarget_view *view);
|
||||
void * __cdecl wined3d_rendertarget_view_get_parent(const struct wined3d_rendertarget_view *view);
|
||||
struct wined3d_resource * __cdecl wined3d_rendertarget_view_get_resource(const struct wined3d_rendertarget_view *view);
|
||||
|
|
Loading…
Reference in New Issue