mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-03-17 08:10:33 +01:00
ir3, freedreno, turnip: Lower io earlier
On the gallium side, set the NIR option to leave IO lowered after linking when using GLSL. On the turnip side, move up nir_lower_io to as early as currently possible. Further turnip passes will have to be converted to intrinsics before we can switch to using the new linker. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39328>
This commit is contained in:
parent
78f6c70304
commit
6a1c8d3a0c
5 changed files with 40 additions and 8 deletions
|
|
@ -137,6 +137,8 @@ static const nir_shader_compiler_options ir3_base_options = {
|
|||
|
||||
.per_view_unique_driver_locations = true,
|
||||
.compact_view_index = true,
|
||||
|
||||
.io_options = nir_io_has_intrinsics,
|
||||
};
|
||||
|
||||
struct ir3_compiler *
|
||||
|
|
|
|||
|
|
@ -659,9 +659,36 @@ ir3_finalize_nir(struct ir3_compiler *compiler,
|
|||
mesa_logi("----------------------");
|
||||
}
|
||||
|
||||
if (s->info.stage == MESA_SHADER_GEOMETRY)
|
||||
/* For vertex inputs, we expect them to all be at the top. FS inputs are also
|
||||
* more optimal at the top.
|
||||
*/
|
||||
if (s->info.stage == MESA_SHADER_VERTEX ||
|
||||
s->info.stage == MESA_SHADER_FRAGMENT)
|
||||
NIR_PASS(_, s, nir_opt_move_to_top, nir_move_to_top_input_loads);
|
||||
|
||||
if (s->info.stage == MESA_SHADER_GEOMETRY) {
|
||||
/* nir_unlower_io_to_vars expects constant indirect offsets to be folded
|
||||
* in.
|
||||
*/
|
||||
NIR_PASS(_, s, nir_opt_constant_folding);
|
||||
NIR_PASS(_, s, nir_opt_dce);
|
||||
|
||||
/* GS lowering works most easily with variables, so temporarily switch
|
||||
* inputs/outputs to variables and then switch back after the lowering is
|
||||
* done.
|
||||
*/
|
||||
NIR_PASS(_, s, nir_unlower_io_to_vars, false);
|
||||
/* nir_lower_io doesn't work with compact variables and non-constant
|
||||
* indices, so clean up output of unlower_io_to_vars.
|
||||
*/
|
||||
NIR_PASS(_, s, nir_opt_constant_folding);
|
||||
NIR_PASS(_, s, nir_opt_dce);
|
||||
|
||||
NIR_PASS(_, s, ir3_nir_lower_gs);
|
||||
|
||||
ir3_nir_lower_io(s);
|
||||
}
|
||||
|
||||
NIR_PASS(_, s, nir_lower_frexp);
|
||||
NIR_PASS(_, s, nir_lower_amul, ir3_glsl_type_size);
|
||||
|
||||
|
|
|
|||
|
|
@ -2949,6 +2949,8 @@ tu_shader_create(struct tu_device *dev,
|
|||
NIR_PASS(_, nir, nir_lower_mem_access_bit_sizes, &options);
|
||||
}
|
||||
|
||||
ir3_nir_lower_io(nir);
|
||||
|
||||
struct ir3_const_allocations const_allocs = {};
|
||||
NIR_PASS(_, nir, tu_lower_io, dev, shader, layout,
|
||||
key->read_only_input_attachments, key->dynamic_renderpass,
|
||||
|
|
@ -2961,8 +2963,6 @@ tu_shader_create(struct tu_device *dev,
|
|||
|
||||
ir3_finalize_nir(dev->compiler, &nir_options, nir);
|
||||
|
||||
ir3_nir_lower_io(nir);
|
||||
|
||||
/* This has to happen after finalizing, so that we know the final bitsize
|
||||
* after vectorizing.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -461,9 +461,11 @@ ir3_screen_finalize_nir(struct pipe_screen *pscreen, struct nir_shader *nir,
|
|||
|
||||
MESA_TRACE_FUNC();
|
||||
|
||||
ir3_nir_lower_io_vars_to_temporaries(nir);
|
||||
if (!nir->info.io_lowered) {
|
||||
ir3_nir_lower_io_vars_to_temporaries(nir);
|
||||
ir3_nir_lower_io(nir);
|
||||
}
|
||||
ir3_finalize_nir(screen->compiler, &options, nir);
|
||||
ir3_nir_lower_io(nir);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -168,9 +168,10 @@ spec@ext_framebuffer_multisample@interpolation 4 non-centroid-deriv-disabled,Fai
|
|||
spec@ext_framebuffer_multisample@interpolation 4 non-centroid-disabled,Fail
|
||||
spec@ext_framebuffer_multisample@sample-alpha-to-coverage 2 color,Fail
|
||||
spec@ext_framebuffer_multisample@sample-alpha-to-coverage 4 color,Fail
|
||||
spec@ext_transform_feedback@max-varyings,Fail
|
||||
spec@ext_transform_feedback@max-varyings@max-varying-arrays-of-arrays,Fail
|
||||
spec@ext_transform_feedback@max-varyings@max-varying-single-dimension-array,Fail
|
||||
|
||||
# see https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37602#note_3294118
|
||||
spec@ext_transform_feedback@max-varyings,Crash
|
||||
|
||||
spec@ext_transform_feedback@tessellation quad_strip wireframe,Fail
|
||||
spec@ext_transform_feedback@tessellation quads wireframe,Fail
|
||||
spec@ext_transform_feedback@tessellation triangle_fan flat_first,Fail
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue