Module: Mesa
Branch: master
Commit: 94cc01105ec70cc364d6cea3f909b0b04dcad7c1
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=94cc01105ec70cc364d6cea3f909b0b04dcad7c1

Author: Samuel Pitoiset <[email protected]>
Date:   Wed Aug 23 09:42:58 2017 +0200

radeonsi: do not assert when reserving bindless slot 0

When assertions were disabled, the compiler removed
the call to util_idalloc_alloc() and the first allocated
bindless slot was 0 which is invalid per the spec.

Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Timothy Arceri <[email protected]>

---

 src/gallium/drivers/radeonsi/si_descriptors.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c 
b/src/gallium/drivers/radeonsi/si_descriptors.c
index 3fdfdbbec7..cc897c9817 100644
--- a/src/gallium/drivers/radeonsi/si_descriptors.c
+++ b/src/gallium/drivers/radeonsi/si_descriptors.c
@@ -2179,6 +2179,8 @@ static void si_init_bindless_descriptors(struct 
si_context *sctx,
                                         unsigned shader_userdata_index,
                                         unsigned num_elements)
 {
+       MAYBE_UNUSED unsigned desc_slot;
+
        si_init_descriptors(desc, shader_userdata_index, 16, num_elements);
        sctx->bindless_descriptors.num_active_slots = num_elements;
 
@@ -2192,7 +2194,8 @@ static void si_init_bindless_descriptors(struct 
si_context *sctx,
        util_idalloc_resize(&sctx->bindless_used_slots, num_elements);
 
        /* Reserve slot 0 because it's an invalid handle for bindless. */
-       assert(!util_idalloc_alloc(&sctx->bindless_used_slots));
+       desc_slot = util_idalloc_alloc(&sctx->bindless_used_slots);
+       assert(desc_slot != 0);
 }
 
 static void si_release_bindless_descriptors(struct si_context *sctx)

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to