wined3d: Prepare all layers for render target views.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2017-04-18 11:24:12 +02:00 committed by Alexandre Julliard
parent 9ffacc434e
commit 481999ce44
3 changed files with 23 additions and 3 deletions

View File

@ -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))

View File

@ -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)
{

View File

@ -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
{