From 945e8a90249410b7698d3500ad4d486ebe62688d Mon Sep 17 00:00:00 2001 From: Conor McCarthy Date: Sat, 21 Sep 2024 13:43:20 +1000 Subject: [PATCH] vkd3d: Sort bounded descriptor ranges after unbounded ones of equal offset. Enables the bounded range to be mapped to the unbounded one, instead of being mapped to a separate binding which will be populated from the same d3d12 descriptors as the unbounded one. --- libs/vkd3d/state.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libs/vkd3d/state.c b/libs/vkd3d/state.c index ea7d8f04..fb377177 100644 --- a/libs/vkd3d/state.c +++ b/libs/vkd3d/state.c @@ -1107,7 +1107,9 @@ static int compare_descriptor_range(const void *a, const void *b) if ((ret = vkd3d_u32_compare(range_a->offset, range_b->offset))) return ret; - return (range_a->descriptor_count == UINT_MAX) - (range_b->descriptor_count == UINT_MAX); + /* Place bounded ranges after unbounded ones of equal offset, + * so the bounded range can be mapped to the unbounded one. */ + return (range_b->descriptor_count == UINT_MAX) - (range_a->descriptor_count == UINT_MAX); } static HRESULT d3d12_root_signature_init_root_descriptor_tables(struct d3d12_root_signature *root_signature,