From f4c754bcd13f9891f71dc8f23079f3bf8acf95c7 Mon Sep 17 00:00:00 2001 From: Iago Toral Quiroga Date: Wed, 26 Aug 2020 11:46:55 +0200 Subject: [PATCH] nir: add a nir_get_ubo_size intrinsic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is the same as nir_get_buffer_size but geared towards UBOs instead of SSBOs. The new intrinsic is useful in Vulkan backends that need to add bound checks on buffer accesses to honor the robust buffer access feature. Reviewed-by: Alejandro PiƱeiro Reviewed-by: Jason Ekstrand Part-of: --- src/compiler/nir/nir_intrinsics.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/compiler/nir/nir_intrinsics.py b/src/compiler/nir/nir_intrinsics.py index f7e51c6fd9d..b23ba9b4af1 100644 --- a/src/compiler/nir/nir_intrinsics.py +++ b/src/compiler/nir/nir_intrinsics.py @@ -209,6 +209,8 @@ intrinsic("deref_buffer_array_length", src_comp=[-1], dest_comp=1, # as source. intrinsic("get_ssbo_size", src_comp=[-1], dest_comp=1, flags=[CAN_ELIMINATE, CAN_REORDER]) +intrinsic("get_ubo_size", src_comp=[-1], dest_comp=1, + flags=[CAN_ELIMINATE, CAN_REORDER]) # a barrier is an intrinsic with no inputs/outputs but which can't be moved # around/optimized in general