[Mesa-dev] [PATCH] radeonsi: do not assert when reserving bindless slot 0

Samuel Pitoiset samuel.pitoiset at gmail.com
Wed Aug 23 08:10:17 UTC 2017


Both solutions look good to me.

On 08/23/2017 10:06 AM, Michael Schellenberger Costa wrote:
> Hi Samuel,
> 
> do you want to fully remove the assert or should this be something the kind of
> 
> MAYBE_UNUSED unsigned res = util_idalloc_alloc(&sctx->bindless_used_slots);
> assert(res != 0);
> 
> --Michael
> 
> -----Ursprüngliche Nachricht-----
> Von: mesa-dev [mailto:mesa-dev-bounces at lists.freedesktop.org] Im Auftrag von Samuel Pitoiset
> Gesendet: Mittwoch, 23. August 2017 09:43
> An: mesa-dev at lists.freedesktop.org
> Betreff: [Mesa-dev] [PATCH] 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 <samuel.pitoiset at gmail.com>
> ---
>   src/gallium/drivers/radeonsi/si_descriptors.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c
> index f66ecc3e68..c53253ac8d 100644
> --- a/src/gallium/drivers/radeonsi/si_descriptors.c
> +++ b/src/gallium/drivers/radeonsi/si_descriptors.c
> @@ -2192,7 +2192,7 @@ 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));
> +	util_idalloc_alloc(&sctx->bindless_used_slots);
>   }
>   
>   static void si_release_bindless_descriptors(struct si_context *sctx)
> 


More information about the mesa-dev mailing list