mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-03-06 23:00:31 +01:00
nir: Add a helper for getting the unique function in a shader
Reviewed-by: Rob Clark <robdclark@gmail.com>
This commit is contained in:
parent
49be812be6
commit
38de85f9a5
1 changed files with 11 additions and 0 deletions
|
|
@ -1761,6 +1761,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)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue