From: Jason Ekstrand Date: Wed, 10 Jun 2020 22:42:15 +0000 (-0500) Subject: freedreno: Only call nir_lower_io on shader_in/out X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=36a90468486252cb35cdea3d67ace991f1fb4bd0;p=mesa.git freedreno: Only call nir_lower_io on shader_in/out Gallium drivers should never see nir_var_uniform because gallium lowers regular uniforms to a UBO. No GL driver should ever see either nir_var_mem_shared because that's lowered in GLSL IR. Reviewed-by: Eric Anholt Reviewed-by: Connor Abbott Part-of: --- diff --git a/src/freedreno/ir3/ir3_nir.c b/src/freedreno/ir3/ir3_nir.c index 5c15f5b8dfc..5707cbcb66f 100644 --- a/src/freedreno/ir3/ir3_nir.c +++ b/src/freedreno/ir3/ir3_nir.c @@ -278,8 +278,8 @@ ir3_finalize_nir(struct ir3_compiler *compiler, nir_shader *s) void ir3_nir_post_finalize(struct ir3_compiler *compiler, nir_shader *s) { - NIR_PASS_V(s, nir_lower_io, nir_var_all, ir3_glsl_type_size, - (nir_lower_io_options)0); + NIR_PASS_V(s, nir_lower_io, nir_var_shader_in | nir_var_shader_out, + ir3_glsl_type_size, (nir_lower_io_options)0); if (s->info.stage == MESA_SHADER_FRAGMENT) { /* NOTE: lower load_barycentric_at_sample first, since it diff --git a/src/gallium/drivers/freedreno/a2xx/fd2_program.c b/src/gallium/drivers/freedreno/a2xx/fd2_program.c index 958b1f784b2..7d40e8c99b3 100644 --- a/src/gallium/drivers/freedreno/a2xx/fd2_program.c +++ b/src/gallium/drivers/freedreno/a2xx/fd2_program.c @@ -100,8 +100,9 @@ fd2_fp_state_create(struct pipe_context *pctx, so->nir = (cso->type == PIPE_SHADER_IR_NIR) ? cso->ir.nir : tgsi_to_nir(cso->tokens, pctx->screen, false); - NIR_PASS_V(so->nir, nir_lower_io, nir_var_all, ir2_glsl_type_size, - (nir_lower_io_options)0); + NIR_PASS_V(so->nir, nir_lower_io, + nir_var_shader_in | nir_var_shader_out, + ir2_glsl_type_size, (nir_lower_io_options)0); if (ir2_optimize_nir(so->nir, true)) goto fail; @@ -137,8 +138,9 @@ fd2_vp_state_create(struct pipe_context *pctx, so->nir = (cso->type == PIPE_SHADER_IR_NIR) ? cso->ir.nir : tgsi_to_nir(cso->tokens, pctx->screen, false); - NIR_PASS_V(so->nir, nir_lower_io, nir_var_all, ir2_glsl_type_size, - (nir_lower_io_options)0); + NIR_PASS_V(so->nir, nir_lower_io, + nir_var_shader_in | nir_var_shader_out, + ir2_glsl_type_size, (nir_lower_io_options)0); if (ir2_optimize_nir(so->nir, true)) goto fail; diff --git a/src/gallium/drivers/freedreno/ir3/ir3_cmdline.c b/src/gallium/drivers/freedreno/ir3/ir3_cmdline.c index 0498c5828ad..81895a7aebe 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_cmdline.c +++ b/src/gallium/drivers/freedreno/ir3/ir3_cmdline.c @@ -183,7 +183,9 @@ load_glsl(unsigned num_files, char* const* files, gl_shader_stage stage) NIR_PASS_V(nir, nir_lower_system_values); NIR_PASS_V(nir, nir_lower_frexp); - NIR_PASS_V(nir, nir_lower_io, nir_var_all, ir3_glsl_type_size, 0); + NIR_PASS_V(nir, nir_lower_io, + nir_var_shader_in | nir_var_shader_out, + ir3_glsl_type_size, (nir_lower_io_options)0); NIR_PASS_V(nir, gl_nir_lower_samplers, prog); return nir; @@ -475,8 +477,9 @@ int main(int argc, char **argv) } else if (from_spirv) { nir = load_spirv(filenames[0], entry, stage); - NIR_PASS_V(nir, nir_lower_io, nir_var_all, ir3_glsl_type_size, - (nir_lower_io_options)0); + NIR_PASS_V(nir, nir_lower_io, + nir_var_shader_in | nir_var_shader_out, + ir3_glsl_type_size, (nir_lower_io_options)0); /* TODO do this somewhere else */ nir_lower_int64(nir, ~0);