anv: get rid of ilog2_round_up
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Wed, 16 Nov 2022 18:34:24 +0000 (20:34 +0200)
committerMarge Bot <emma+marge@anholt.net>
Thu, 17 Nov 2022 10:06:37 +0000 (10:06 +0000)
commit440da44a84022ec63e87e2c5a55ad03a244697a4
tree4df14f6403d450fd997361f892236d53b94e01f9
parenta61378859c7f19db1425c74f404a4d71c98a8460
anv: get rid of ilog2_round_up

__builtin_clz(value - 1) is undefined for with value=1 (because
__builtin_clz(0) is undefined).

Because we set rt_pipeline->stack_size = 1 when a ray tracing pipeline
doesn't need any stack allocation to differentiate from a dynamic size
(rt_pipeline->stack_size = 0) we can run into this undefinied behavior
issue.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: f68d64dac015 ("anv: Add support for vkCmdSetRayTracingPipelineStackSizeKHR")
Reviewed-by: Marcin Ĺšlusarz <marcin.slusarz@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19781>
src/intel/vulkan/anv_allocator.c
src/intel/vulkan/anv_cmd_buffer.c