wined3d: Use correct layer count for 3D textures.

Fixes a regression introduced by commit
9ffacc434e.

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-20 12:26:59 +02:00 committed by Alexandre Julliard
parent c08da43ddd
commit 583255f2b2
1 changed files with 9 additions and 6 deletions

View File

@ -422,7 +422,7 @@ void wined3d_rendertarget_view_prepare_location(struct wined3d_rendertarget_view
struct wined3d_context *context, DWORD location)
{
struct wined3d_resource *resource = view->resource;
unsigned int i, sub_resource_idx;
unsigned int i, sub_resource_idx, layer_count;
struct wined3d_texture *texture;
if (resource->type == WINED3D_RTYPE_BUFFER)
@ -433,7 +433,8 @@ void wined3d_rendertarget_view_prepare_location(struct wined3d_rendertarget_view
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)
layer_count = resource->type != WINED3D_RTYPE_TEXTURE_3D ? view->layer_count : 1;
for (i = 0; i < layer_count; ++i, sub_resource_idx += texture->level_count)
wined3d_texture_prepare_location(texture, sub_resource_idx, context, location);
}
@ -441,7 +442,7 @@ void wined3d_rendertarget_view_load_location(struct wined3d_rendertarget_view *v
struct wined3d_context *context, DWORD location)
{
struct wined3d_resource *resource = view->resource;
unsigned int i, sub_resource_idx;
unsigned int i, sub_resource_idx, layer_count;
struct wined3d_texture *texture;
if (resource->type == WINED3D_RTYPE_BUFFER)
@ -452,14 +453,15 @@ void wined3d_rendertarget_view_load_location(struct wined3d_rendertarget_view *v
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)
layer_count = resource->type != WINED3D_RTYPE_TEXTURE_3D ? view->layer_count : 1;
for (i = 0; i < layer_count; ++i, sub_resource_idx += texture->level_count)
wined3d_texture_load_location(texture, sub_resource_idx, context, location);
}
void wined3d_rendertarget_view_validate_location(struct wined3d_rendertarget_view *view, DWORD location)
{
struct wined3d_resource *resource = view->resource;
unsigned int i, sub_resource_idx;
unsigned int i, sub_resource_idx, layer_count;
struct wined3d_texture *texture;
if (resource->type == WINED3D_RTYPE_BUFFER)
@ -470,7 +472,8 @@ void wined3d_rendertarget_view_validate_location(struct wined3d_rendertarget_vie
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)
layer_count = resource->type != WINED3D_RTYPE_TEXTURE_3D ? view->layer_count : 1;
for (i = 0; i < layer_count; ++i, sub_resource_idx += texture->level_count)
wined3d_texture_validate_location(texture, sub_resource_idx, location);
}