[PATCH] wined3d: Use correct layer count for 3D textures.
Józef Kucia
jkucia at codeweavers.com
Thu Apr 20 05:26:59 CDT 2017
Fixes a regression introduced by commit
9ffacc434e90d80dbdfb107b10f02a759f2266f3.
Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
dlls/wined3d/view.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c
index cb3578a..3abd85b 100644
--- a/dlls/wined3d/view.c
+++ b/dlls/wined3d/view.c
@@ -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);
}
--
2.10.2
More information about the wine-patches
mailing list