[Mesa-dev] [PATCH 22/26] nir: Add a helper for getting the unique function in a shader
Jason Ekstrand
jason at jlekstrand.net
Fri Mar 25 23:12:36 UTC 2016
---
src/compiler/nir/nir.h | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index d46858e..d39c5fd 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -1816,6 +1816,17 @@ typedef struct nir_shader {
gl_shader_stage stage;
} nir_shader;
+static inline nir_function *
+nir_shader_get_entrypoint(nir_shader *shader)
+{
+ assert(exec_list_length(&shader->functions) == 1);
+ struct exec_node *func_node = exec_list_get_head(&shader->functions);
+ nir_function *func = exec_node_data(nir_function, func_node, node);
+ assert(func->return_type == glsl_void_type());
+ assert(func->num_params == 0);
+ return func;
+}
+
#define nir_foreach_function(shader, func) \
foreach_list_typed(nir_function, func, node, &(shader)->functions)
--
2.5.0.400.gff86faf
More information about the mesa-dev
mailing list