Zebediah Figura : wined3d: Correctly handle 3D textures in wined3d_view_{load, invalidate}_location().

Alexandre Julliard julliard at winehq.org
Tue May 24 15:54:59 CDT 2022


Module: wine
Branch: master
Commit: 7c529506af6c8ad1b8a2d869eb78930469ded85f
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=7c529506af6c8ad1b8a2d869eb78930469ded85f

Author: Zebediah Figura <zfigura at codeweavers.com>
Date:   Mon May 23 17:37:43 2022 -0500

wined3d: Correctly handle 3D textures in wined3d_view_{load, invalidate}_location().

The sub-resource index should not be offset by the layer index, which represents
a depth offset.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53027
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wined3d/view.c | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c
index f2dea8f0f9a..dbd385219f0 100644
--- a/dlls/wined3d/view.c
+++ b/dlls/wined3d/view.c
@@ -315,7 +315,7 @@ static void create_buffer_view(struct wined3d_gl_view *view, struct wined3d_cont
 static void wined3d_view_invalidate_location(struct wined3d_resource *resource,
         const struct wined3d_view_desc *desc, DWORD location)
 {
-    unsigned int i, sub_resource_idx, layer_count;
+    unsigned int i, sub_resource_idx;
     struct wined3d_texture *texture;
 
     if (resource->type == WINED3D_RTYPE_BUFFER)
@@ -325,17 +325,21 @@ static void wined3d_view_invalidate_location(struct wined3d_resource *resource,
     }
 
     texture = texture_from_resource(resource);
+    if (resource->type == WINED3D_RTYPE_TEXTURE_3D)
+    {
+        wined3d_texture_invalidate_location(texture, desc->u.texture.level_idx, location);
+        return;
+    }
 
     sub_resource_idx = desc->u.texture.layer_idx * texture->level_count + desc->u.texture.level_idx;
-    layer_count = resource->type != WINED3D_RTYPE_TEXTURE_3D ? desc->u.texture.layer_count : 1;
-    for (i = 0; i < layer_count; ++i, sub_resource_idx += texture->level_count)
+    for (i = 0; i < desc->u.texture.layer_count; ++i, sub_resource_idx += texture->level_count)
         wined3d_texture_invalidate_location(texture, sub_resource_idx, location);
 }
 
 static void wined3d_view_load_location(struct wined3d_resource *resource,
         const struct wined3d_view_desc *desc, struct wined3d_context *context, DWORD location)
 {
-    unsigned int i, sub_resource_idx, layer_count;
+    unsigned int i, sub_resource_idx;
     struct wined3d_texture *texture;
 
     if (resource->type == WINED3D_RTYPE_BUFFER)
@@ -345,9 +349,14 @@ static void wined3d_view_load_location(struct wined3d_resource *resource,
     }
 
     texture = texture_from_resource(resource);
+    if (resource->type == WINED3D_RTYPE_TEXTURE_3D)
+    {
+        wined3d_texture_load_location(texture, desc->u.texture.level_idx, context, location);
+        return;
+    }
+
     sub_resource_idx = desc->u.texture.layer_idx * texture->level_count + desc->u.texture.level_idx;
-    layer_count = resource->type != WINED3D_RTYPE_TEXTURE_3D ? desc->u.texture.layer_count : 1;
-    for (i = 0; i < layer_count; ++i, sub_resource_idx += texture->level_count)
+    for (i = 0; i < desc->u.texture.layer_count; ++i, sub_resource_idx += texture->level_count)
         wined3d_texture_load_location(texture, sub_resource_idx, context, location);
 }
 




More information about the wine-cvs mailing list