wined3d: Properly compare integers in wined3d_bo_slab_vk_compare().

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2022-01-24 13:59:03 +01:00 committed by Alexandre Julliard
parent 18a6d9ab0e
commit 162fc7bd46
2 changed files with 11 additions and 5 deletions

View File

@ -1883,12 +1883,13 @@ 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 *slab = WINE_RB_ENTRY_VALUE(entry, const struct wined3d_bo_slab_vk, entry);
const struct wined3d_bo_slab_vk_key *k = key; const struct wined3d_bo_slab_vk_key *k = key;
int ret;
if (k->memory_type != slab->requested_memory_type) if ((ret = wined3d_uint32_compare(k->memory_type, slab->requested_memory_type)))
return k->memory_type - slab->requested_memory_type; return ret;
if (k->usage != slab->bo.usage) if ((ret = wined3d_uint32_compare(k->usage, slab->bo.usage)))
return k->usage - slab->bo.usage; return ret;
return k->size - slab->bo.size; return wined3d_uint64_compare(k->size, slab->bo.size);
} }
static void wined3d_context_vk_init_graphics_pipeline_key(struct wined3d_context_vk *context_vk) static void wined3d_context_vk_init_graphics_pipeline_key(struct wined3d_context_vk *context_vk)

View File

@ -452,6 +452,11 @@ static inline int wined3d_uint32_compare(uint32_t x, uint32_t y)
return (x > y) - (x < y); return (x > y) - (x < y);
} }
static inline int wined3d_uint64_compare(uint64_t x, uint64_t y)
{
return (x > y) - (x < y);
}
#define ORM_BACKBUFFER 0 #define ORM_BACKBUFFER 0
#define ORM_FBO 1 #define ORM_FBO 1