From 12355c7e910222d97ecf23567e6f17841993acfe Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alejandro=20Pi=C3=B1eiro?= Date: Tue, 11 Sep 2018 12:40:08 +0200 Subject: [PATCH] nir: add is_in_ubo/ssbo/block helpers Equivalent to the already existing ir_variable is_in_buffer_block and is_in_shader_storage_block, adding the uniform buffer object one. I'm using the short forms (ssbo, ubo) to avoid having method names too long. Reviewed-by: Timothy Arceri --- src/compiler/nir/nir.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 9b0d13910d4..df6dc5ba904 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -3665,6 +3665,26 @@ gl_system_value nir_system_value_from_intrinsic(nir_intrinsic_op intrin); bool nir_lower_sincos(nir_shader *shader); +static inline bool +nir_variable_is_in_ubo(const nir_variable *var) +{ + return (var->data.mode == nir_var_mem_ubo && + var->interface_type != NULL); +} + +static inline bool +nir_variable_is_in_ssbo(const nir_variable *var) +{ + return (var->data.mode == nir_var_mem_ssbo && + var->interface_type != NULL); +} + +static inline bool +nir_variable_is_in_block(const nir_variable *var) +{ + return nir_variable_is_in_ubo(var) || nir_variable_is_in_ssbo(var); +} + #ifdef __cplusplus } /* extern "C" */ #endif -- 2.30.2