summaryrefslogtreecommitdiffstats
path: root/src/compiler/nir/nir.h
diff options
context:
space:
mode:
authorAlejandro PiƱeiro <[email protected]>2018-09-11 12:40:08 +0200
committerArcady Goldmints-Orlov <[email protected]>2019-06-30 16:58:26 -0500
commit12355c7e910222d97ecf23567e6f17841993acfe (patch)
tree7d542cf7f8686d15999ce85c784b5614ecdd6e38 /src/compiler/nir/nir.h
parent15f134412f690e3c23f5f3a14de2e4cd38dde852 (diff)
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 <[email protected]>
Diffstat (limited to 'src/compiler/nir/nir.h')
-rw-r--r--src/compiler/nir/nir.h20
1 files changed, 20 insertions, 0 deletions
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