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@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2020-12-14 17:57:19 +03:30 committed by Alexandre Julliard
parent 7b2c78c3bb
commit 46c7f66cf3
2 changed files with 5 additions and 3 deletions

View File

@ -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;

View File

@ -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;