d3d8: Use wined3d_rendertarget_view_create_from_sub_resource() in d3d8_surface_get_rendertarget_view().
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
3e491662ba
commit
c43b290fa5
|
@ -347,24 +347,13 @@ static const struct wined3d_parent_ops d3d8_view_wined3d_parent_ops =
|
||||||
|
|
||||||
struct wined3d_rendertarget_view *d3d8_surface_get_rendertarget_view(struct d3d8_surface *surface)
|
struct wined3d_rendertarget_view *d3d8_surface_get_rendertarget_view(struct d3d8_surface *surface)
|
||||||
{
|
{
|
||||||
struct wined3d_resource *resource;
|
|
||||||
struct wined3d_resource_desc resource_desc;
|
|
||||||
struct wined3d_rendertarget_view_desc desc;
|
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
if (surface->wined3d_rtv)
|
if (surface->wined3d_rtv)
|
||||||
return surface->wined3d_rtv;
|
return surface->wined3d_rtv;
|
||||||
|
|
||||||
resource = wined3d_texture_get_resource(surface->wined3d_texture);
|
if (FAILED(hr = wined3d_rendertarget_view_create_from_sub_resource(surface->wined3d_texture,
|
||||||
wined3d_resource_get_desc(resource, &resource_desc);
|
surface->sub_resource_idx, surface, &d3d8_view_wined3d_parent_ops, &surface->wined3d_rtv)))
|
||||||
|
|
||||||
desc.format_id = resource_desc.format;
|
|
||||||
desc.u.texture.level_idx = surface->sub_resource_idx;
|
|
||||||
desc.u.texture.layer_idx = 0;
|
|
||||||
desc.u.texture.layer_count = 1;
|
|
||||||
|
|
||||||
if (FAILED(hr = wined3d_rendertarget_view_create(&desc, resource,
|
|
||||||
surface, &d3d8_view_wined3d_parent_ops, &surface->wined3d_rtv)))
|
|
||||||
{
|
{
|
||||||
ERR("Failed to create rendertarget view, hr %#x.\n", hr);
|
ERR("Failed to create rendertarget view, hr %#x.\n", hr);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
Loading…
Reference in New Issue