From 481999ce44fc919178f7a90dd8fb428cb2029371 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3zef=20Kucia?= Date: Tue, 18 Apr 2017 11:24:12 +0200 Subject: [PATCH] wined3d: Prepare all layers for render target views. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Józef Kucia Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/wined3d/drawprim.c | 5 ++--- dlls/wined3d/view.c | 19 +++++++++++++++++++ dlls/wined3d/wined3d_private.h | 2 ++ 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c index 1c324a6f365..15b3791b31b 100644 --- a/dlls/wined3d/drawprim.c +++ b/dlls/wined3d/drawprim.c @@ -512,7 +512,7 @@ void draw_primitive(struct wined3d_device *device, const struct wined3d_state *s } else { - wined3d_texture_prepare_location(rt, rtv->sub_resource_idx, context, rtv->resource->draw_binding); + wined3d_rendertarget_view_prepare_location(rtv, context, rtv->resource->draw_binding); } } @@ -524,12 +524,11 @@ void draw_primitive(struct wined3d_device *device, const struct wined3d_state *s * depthstencil for D3DCMP_NEVER and D3DCMP_ALWAYS as well. Also note * that we never copy the stencil data.*/ DWORD location = context->render_offscreen ? dsv->resource->draw_binding : WINED3D_LOCATION_DRAWABLE; - struct wined3d_surface *ds = wined3d_rendertarget_view_get_surface(dsv); if (state->render_states[WINED3D_RS_ZWRITEENABLE] || state->render_states[WINED3D_RS_ZENABLE]) wined3d_rendertarget_view_load_location(dsv, context, location); else - wined3d_texture_prepare_location(ds->container, dsv->sub_resource_idx, context, location); + wined3d_rendertarget_view_prepare_location(dsv, context, location); } if (!context_apply_draw_state(context, device, state)) diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c index 93788df3aa8..e1e19566ccf 100644 --- a/dlls/wined3d/view.c +++ b/dlls/wined3d/view.c @@ -398,6 +398,25 @@ void wined3d_rendertarget_view_get_drawable_size(const struct wined3d_rendertarg } } +void wined3d_rendertarget_view_prepare_location(struct wined3d_rendertarget_view *view, + struct wined3d_context *context, DWORD location) +{ + struct wined3d_resource *resource = view->resource; + unsigned int i, sub_resource_idx; + struct wined3d_texture *texture; + + if (resource->type == WINED3D_RTYPE_BUFFER) + { + FIXME("Not implemented for resources %s.\n", debug_d3dresourcetype(resource->type)); + return; + } + + texture = texture_from_resource(resource); + sub_resource_idx = view->sub_resource_idx; + for (i = 0; i < view->layer_count; ++i, sub_resource_idx += texture->level_count) + wined3d_texture_prepare_location(texture, sub_resource_idx, context, location); +} + void wined3d_rendertarget_view_load_location(struct wined3d_rendertarget_view *view, struct wined3d_context *context, DWORD location) { diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 13e375a1dcd..ff5b242f8b6 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -3460,6 +3460,8 @@ void wined3d_rendertarget_view_get_drawable_size(const struct wined3d_rendertarg const struct wined3d_context *context, unsigned int *width, unsigned int *height) DECLSPEC_HIDDEN; void wined3d_rendertarget_view_load_location(struct wined3d_rendertarget_view *view, struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN; +void wined3d_rendertarget_view_prepare_location(struct wined3d_rendertarget_view *view, + struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN; struct wined3d_shader_resource_view {