Jan Sikorski : wined3d: Introduce wined3d_view_load_location() helper.

Alexandre Julliard julliard at winehq.org
Tue Oct 5 15:51:42 CDT 2021


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

Author: Jan Sikorski <jsikorski at codeweavers.com>
Date:   Thu Sep 30 12:58:00 2021 +0200

wined3d: Introduce wined3d_view_load_location() helper.

Signed-off-by: Jan Sikorski <jsikorski 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 | 35 ++++++++++++++++++++---------------
 1 file changed, 20 insertions(+), 15 deletions(-)

diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c
index 0adb0a115dc..dfca8fc53f8 100644
--- a/dlls/wined3d/view.c
+++ b/dlls/wined3d/view.c
@@ -332,6 +332,25 @@ static void wined3d_view_invalidate_location(struct wined3d_resource *resource,
         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;
+    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 = 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)
+        wined3d_texture_load_location(texture, sub_resource_idx, context, location);
+}
+
 ULONG CDECL wined3d_rendertarget_view_incref(struct wined3d_rendertarget_view *view)
 {
     ULONG refcount = InterlockedIncrement(&view->refcount);
@@ -461,21 +480,7 @@ void wined3d_rendertarget_view_prepare_location(struct wined3d_rendertarget_view
 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, layer_count;
-    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;
-    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);
+    wined3d_view_load_location(view->resource, &view->desc, context, location);
 }
 
 void wined3d_rendertarget_view_validate_location(struct wined3d_rendertarget_view *view, DWORD location)




More information about the wine-cvs mailing list