=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: wined3d: Use correct layer count for 3D textures.

Alexandre Julliard julliard at winehq.org
Thu Apr 20 16:41:33 CDT 2017


Module: wine
Branch: master
Commit: 583255f2b2ff97e26348b3db4d00a9fe80b28688
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=583255f2b2ff97e26348b3db4d00a9fe80b28688

Author: Józef Kucia <jkucia at codeweavers.com>
Date:   Thu Apr 20 12:26:59 2017 +0200

wined3d: Use correct layer count for 3D textures.

Fixes a regression introduced by commit
9ffacc434e90d80dbdfb107b10f02a759f2266f3.

Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

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




More information about the wine-cvs mailing list