nir/lower_out_to_temp: Add an "entrypoint" parameter
Previously, the pass assumed that the entrypoint would be whatever function happened to have the name "main". We really shouldn't trust in the function names. Reviewed-by: Rob Clark <robdclark@gmail.com>
This commit is contained in:
@@ -143,7 +143,7 @@ glsl_to_nir(const struct gl_shader_program *shader_prog,
|
|||||||
v2.run(sh->ir);
|
v2.run(sh->ir);
|
||||||
visit_exec_list(sh->ir, &v1);
|
visit_exec_list(sh->ir, &v1);
|
||||||
|
|
||||||
nir_lower_outputs_to_temporaries(shader);
|
nir_lower_outputs_to_temporaries(shader, nir_shader_get_entrypoint(shader));
|
||||||
|
|
||||||
shader->info.name = ralloc_asprintf(shader, "GLSL%d", shader_prog->Name);
|
shader->info.name = ralloc_asprintf(shader, "GLSL%d", shader_prog->Name);
|
||||||
if (shader_prog->Label)
|
if (shader_prog->Label)
|
||||||
|
@@ -2174,7 +2174,8 @@ bool nir_lower_indirect_derefs(nir_shader *shader, uint32_t mode_mask);
|
|||||||
|
|
||||||
bool nir_lower_locals_to_regs(nir_shader *shader);
|
bool nir_lower_locals_to_regs(nir_shader *shader);
|
||||||
|
|
||||||
void nir_lower_outputs_to_temporaries(nir_shader *shader);
|
void nir_lower_outputs_to_temporaries(nir_shader *shader,
|
||||||
|
nir_function *entrypoint);
|
||||||
|
|
||||||
void nir_assign_var_locations(struct exec_list *var_list,
|
void nir_assign_var_locations(struct exec_list *var_list,
|
||||||
unsigned *size,
|
unsigned *size,
|
||||||
|
@@ -74,7 +74,7 @@ emit_output_copies_block(nir_block *block, void *state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nir_lower_outputs_to_temporaries(nir_shader *shader)
|
nir_lower_outputs_to_temporaries(nir_shader *shader, nir_function *entrypoint)
|
||||||
{
|
{
|
||||||
struct lower_outputs_state state;
|
struct lower_outputs_state state;
|
||||||
|
|
||||||
@@ -117,7 +117,7 @@ nir_lower_outputs_to_temporaries(nir_shader *shader)
|
|||||||
* before each EmitVertex call.
|
* before each EmitVertex call.
|
||||||
*/
|
*/
|
||||||
nir_foreach_block(function->impl, emit_output_copies_block, &state);
|
nir_foreach_block(function->impl, emit_output_copies_block, &state);
|
||||||
} else if (strcmp(function->name, "main") == 0) {
|
} else if (function == entrypoint) {
|
||||||
/* For all other shader types, we need to do the copies right before
|
/* For all other shader types, we need to do the copies right before
|
||||||
* the jumps to the end block.
|
* the jumps to the end block.
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user