diff --git a/src/imagination/pco/pco_nir.c b/src/imagination/pco/pco_nir.c index 6934fb7db94..640fafad867 100644 --- a/src/imagination/pco/pco_nir.c +++ b/src/imagination/pco/pco_nir.c @@ -825,16 +825,6 @@ void pco_lower_nir(pco_ctx *ctx, nir_shader *nir, pco_data *data) NIR_PASS(_, nir, nir_opt_constant_folding); - if (nir->info.stage == MESA_SHADER_VERTEX) { - /* TODO: false? */ - NIR_PASS(_, nir, nir_lower_io_array_vars_to_elements_no_indirects, true); - NIR_PASS(_, nir, nir_split_struct_vars, nir_var_shader_out); - NIR_PASS(_, nir, nir_split_struct_vars, nir_var_shader_in); - } else if (nir->info.stage == MESA_SHADER_FRAGMENT) { - NIR_PASS(_, nir, nir_lower_io_array_vars_to_elements_no_indirects, false); - NIR_PASS(_, nir, nir_split_struct_vars, nir_var_shader_in); - } - NIR_PASS(_, nir, nir_lower_io, @@ -859,11 +849,13 @@ void pco_lower_nir(pco_ctx *ctx, nir_shader *nir, pco_data *data) nir_io_add_const_offset_to_base, nir_var_shader_in | nir_var_shader_out); + /* Internal shaders will be using invalid32 types at this stage. */ + if (!nir->info.internal) + NIR_PASS(_, nir, nir_unlower_io_to_vars, true); + if (nir->info.stage == MESA_SHADER_VERTEX) NIR_PASS(_, nir, pco_nir_lower_clip_cull_vars); - NIR_PASS(_, nir, pco_nir_lower_variables, true, true); - NIR_PASS(_, nir, pco_nir_lower_images, data); NIR_PASS(_, nir, diff --git a/src/imagination/pco/pco_nir_io.c b/src/imagination/pco/pco_nir_io.c index a56dfac41bf..4ab68f3e51b 100644 --- a/src/imagination/pco/pco_nir_io.c +++ b/src/imagination/pco/pco_nir_io.c @@ -103,57 +103,3 @@ bool pco_nir_lower_io(nir_shader *shader) return progress; } - -bool pco_nir_lower_variables(nir_shader *shader, bool inputs, bool outputs) -{ - bool progress = false; - - nir_variable_mode modes = 0; - assert(inputs || outputs); - - if (inputs) - modes |= nir_var_shader_in; - - if (outputs) - modes |= nir_var_shader_out; - - nir_foreach_variable_with_modes (var, shader, modes) { - unsigned slots = glsl_count_vec4_slots(var->type, false, false); - if (slots == 1) - continue; - - assert(!var->data.location_frac); - - unsigned dwords = glsl_count_dword_slots(var->type, false); - assert(!(dwords % slots)); - unsigned slot_size = dwords / slots; - - unsigned location = var->data.location; - - var->type = glsl_vector_type( - glsl_get_base_type(glsl_without_array_or_matrix(var->type)), - slot_size); - dwords -= slot_size; - for (unsigned u = 1; u < slots; ++u) { - assert(!nir_find_variable_with_location(shader, - var->data.mode, - location + u)); - - unsigned comps = dwords < slot_size ? dwords : slot_size; - const glsl_type *type = - glsl_vector_type(glsl_get_base_type(var->type), comps); - dwords -= comps; - - nir_create_variable_with_location(shader, - var->data.mode, - location + u, - type); - } - - progress = true; - } - - return nir_progress(progress, - nir_shader_get_entrypoint(shader), - nir_metadata_none); -}