wined3d: Load all layers for render target views.

For layered rendering to array textures.

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:11 +02:00 committed by Alexandre Julliard
parent 95a936d8c2
commit 9ffacc434e
3 changed files with 23 additions and 2 deletions

View File

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

View File

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

View File

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