diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c index c6d345035c3..1c324a6f365 100644 --- a/dlls/wined3d/drawprim.c +++ b/dlls/wined3d/drawprim.c @@ -507,7 +507,7 @@ void draw_primitive(struct wined3d_device *device, const struct wined3d_state *s rt = wined3d_texture_from_resource(rtv->resource); if (state->render_states[WINED3D_RS_COLORWRITEENABLE]) { - wined3d_texture_load_location(rt, rtv->sub_resource_idx, context, rtv->resource->draw_binding); + wined3d_rendertarget_view_load_location(rtv, context, rtv->resource->draw_binding); wined3d_texture_invalidate_location(rt, rtv->sub_resource_idx, ~rtv->resource->draw_binding); } else @@ -527,7 +527,7 @@ void draw_primitive(struct wined3d_device *device, const struct wined3d_state *s struct wined3d_surface *ds = wined3d_rendertarget_view_get_surface(dsv); if (state->render_states[WINED3D_RS_ZWRITEENABLE] || state->render_states[WINED3D_RS_ZENABLE]) - wined3d_texture_load_location(ds->container, dsv->sub_resource_idx, context, location); + wined3d_rendertarget_view_load_location(dsv, context, location); else wined3d_texture_prepare_location(ds->container, dsv->sub_resource_idx, context, location); } diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c index 294ed9ac9b0..93788df3aa8 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_load_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) + { + wined3d_buffer_load_location(buffer_from_resource(resource), context, location); + 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_load_location(texture, sub_resource_idx, context, location); +} + static void wined3d_render_target_view_cs_init(void *object) { struct wined3d_rendertarget_view *view = object; diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 9e48b49bcc3..13e375a1dcd 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -3458,6 +3458,8 @@ static inline struct wined3d_surface *wined3d_rendertarget_view_get_surface( void wined3d_rendertarget_view_get_drawable_size(const struct wined3d_rendertarget_view *view, 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; struct wined3d_shader_resource_view {