summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2016-02-17 13:46:25 -0800
committerJason Ekstrand <[email protected]>2016-02-17 18:04:39 -0800
commit979732fafc8d5c8db4c70461493b7c93ac870cfd (patch)
tree44f016cb75a3fe64d3390ec58b02b6334b868fb7
parent8c05b44bbb317b5547f1079d1957c05ac29a591e (diff)
nir: Add a helper for getting the one function from a shader
-rw-r--r--src/compiler/nir/nir.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index 932cab62e64..0f8c78100bf 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -1756,6 +1756,15 @@ 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);
+ return func;
+}
+
#define nir_foreach_function(shader, func) \
foreach_list_typed(nir_function, func, node, &(shader)->functions)