From: Alejandro PiƱeiro Date: Tue, 11 Sep 2018 10:40:08 +0000 (+0200) Subject: nir: add is_in_ubo/ssbo/block helpers X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=12355c7e910222d97ecf23567e6f17841993acfe;p=mesa.git 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 --- 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