Henri Verbeet : wined3d: Compare requested memory types in wined3d_bo_slab_vk_compare().

Alexandre Julliard julliard at winehq.org
Mon Dec 14 15:51:17 CST 2020


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

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Mon Dec 14 18:15:19 2020 +0330

wined3d: Compare requested memory types in wined3d_bo_slab_vk_compare().

Instead of comparing the requested memory type against what we actually got.
For example, we may have gotten coherent memory without having explicitly
requested it, in which case wined3d_context_vk_create_slab_bo() would fail to
find an existing slab to allocate from.

Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wined3d/context_vk.c      | 7 ++++---
 dlls/wined3d/wined3d_private.h | 1 +
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/dlls/wined3d/context_vk.c b/dlls/wined3d/context_vk.c
index f1258842152..66f5109dc87 100644
--- a/dlls/wined3d/context_vk.c
+++ b/dlls/wined3d/context_vk.c
@@ -371,6 +371,7 @@ static bool wined3d_context_vk_create_slab_bo(struct wined3d_context_vk *context
             return false;
         }
 
+        slab->requested_memory_type = memory_type;
         if (!wined3d_context_vk_create_bo(context_vk, key.size, usage, memory_type, &slab->bo))
         {
             ERR("Failed to create slab bo.\n");
@@ -625,7 +626,7 @@ static void wined3d_bo_slab_vk_free_slice(struct wined3d_bo_slab_vk *slab,
 
     if (!slab->map)
     {
-        key.memory_type = slab->bo.memory_type;
+        key.memory_type = slab->requested_memory_type;
         key.usage = slab->bo.usage;
         key.size = slab->bo.size;
 
@@ -1677,8 +1678,8 @@ static int wined3d_bo_slab_vk_compare(const void *key, const struct wine_rb_entr
     const struct wined3d_bo_slab_vk *slab = WINE_RB_ENTRY_VALUE(entry, const struct wined3d_bo_slab_vk, entry);
     const struct wined3d_bo_slab_vk_key *k = key;
 
-    if (k->memory_type != slab->bo.memory_type)
-        return k->memory_type - slab->bo.memory_type;
+    if (k->memory_type != slab->requested_memory_type)
+        return k->memory_type - slab->requested_memory_type;
     if (k->usage != slab->bo.usage)
         return k->usage - slab->bo.usage;
     return k->size - slab->bo.size;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index cf1a0bb0668..30b21a8225f 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1626,6 +1626,7 @@ struct wined3d_bo_slab_vk
 {
     struct wine_rb_entry entry;
     struct wined3d_bo_slab_vk *next;
+    VkMemoryPropertyFlags requested_memory_type;
     struct wined3d_bo_vk bo;
     unsigned int map_count;
     void *map_ptr;




More information about the wine-cvs mailing list