gl_shader_stage stage;
} nir_shader;
-static inline nir_function *
+static inline nir_function_impl *
nir_shader_get_entrypoint(nir_shader *shader)
{
assert(exec_list_length(&shader->functions) == 1);
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;
+ assert(func->impl);
+ return func->impl;
}
#define nir_foreach_function(func, shader) \
bool nir_lower_locals_to_regs(nir_shader *shader);
-void nir_lower_io_to_temporaries(nir_shader *shader, nir_function *entrypoint,
+void nir_lower_io_to_temporaries(nir_shader *shader,
+ nir_function_impl *entrypoint,
bool outputs, bool inputs);
void nir_shader_gather_info(nir_shader *shader, nir_function_impl *entrypoint);
nir_lower_bitmap(nir_shader *shader,
const nir_lower_bitmap_options *options)
{
- nir_function *function;
-
assert(shader->stage == MESA_SHADER_FRAGMENT);
- function = nir_shader_get_entrypoint(shader);
-
- if (function->impl)
- lower_bitmap_impl(function->impl, options);
+ lower_bitmap_impl(nir_shader_get_entrypoint(shader), options);
}
}
void
-nir_lower_io_to_temporaries(nir_shader *shader, nir_function *entrypoint,
+nir_lower_io_to_temporaries(nir_shader *shader, nir_function_impl *entrypoint,
bool outputs, bool inputs)
{
struct lower_io_state state;
return;
state.shader = shader;
- state.entrypoint = entrypoint->impl;
+ state.entrypoint = entrypoint;
if (inputs)
exec_list_move_nodes_to(&shader->inputs, &state.old_inputs);
void nir_lower_passthrough_edgeflags(nir_shader *shader)
{
- nir_function *function = nir_shader_get_entrypoint(shader);
- if (function->impl)
- lower_impl(function->impl);
+ lower_impl(nir_shader_get_entrypoint(shader));
}
emit_instructions(struct ir3_compile *ctx)
{
unsigned ninputs, noutputs;
- nir_function_impl *fxn = nir_shader_get_entrypoint(ctx->s)->impl;
+ nir_function_impl *fxn = nir_shader_get_entrypoint(ctx->s);
ninputs = (max_drvloc(&ctx->s->inputs) + 1) * 4;
noutputs = (max_drvloc(&ctx->s->outputs) + 1) * 4;
nir_propagate_invariant(nir);
nir_validate_shader(nir);
- nir_lower_io_to_temporaries(entry_point->shader, entry_point, true, false);
+ nir_lower_io_to_temporaries(entry_point->shader, entry_point->impl,
+ true, false);
nir_lower_system_values(nir);
nir_validate_shader(nir);
unsigned num_rts = 0;
struct anv_pipeline_binding rt_bindings[8];
- nir_function_impl *impl = nir_shader_get_entrypoint(nir)->impl;
+ nir_function_impl *impl = nir_shader_get_entrypoint(nir);
nir_foreach_variable_safe(var, &nir->outputs) {
if (var->data.location < FRAG_RESULT_DATA0)
continue;
nir = brw_preprocess_nir(compiler, nir);
nir_remove_dead_variables(nir, nir_var_shader_in);
- nir_shader_gather_info(nir, nir_shader_get_entrypoint(nir)->impl);
+ nir_shader_gather_info(nir, nir_shader_get_entrypoint(nir));
/* Uniforms are required to be lowered before going into compile_fs. For
* BLORP, we'll assume that whoever builds the shader sets the location