diff options
author | Eric Anholt <[email protected]> | 2018-09-18 15:53:54 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2018-10-15 17:16:43 -0700 |
commit | dda1ae9b3cb9ea39c9435fba01c6c31a99c4d35e (patch) | |
tree | 6d57a596152835d5b68e3cad5148ba410bdec659 /src/gallium/drivers | |
parent | da15a0d88ea1a29968ee624186d895fe5ff0f574 (diff) |
gallium/ttn: Convert inputs and outputs to derefs of variables.
This means that TTN shaders more closely resemble GTN shaders: they have
inputs and outputs as variable derefs, with the variables having their
.driver_location already set up for you.
This will be useful for v3d to do input variable DCE in NIR, which we
can't do when the TTN shaders never have a pre-nir_lower_io stage.
Acked-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/freedreno/ir3/ir3_shader.c | 5 | ||||
-rw-r--r-- | src/gallium/drivers/v3d/v3d_program.c | 7 | ||||
-rw-r--r-- | src/gallium/drivers/vc4/vc4_program.c | 7 |
3 files changed, 10 insertions, 9 deletions
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_shader.c b/src/gallium/drivers/freedreno/ir3/ir3_shader.c index 125bf3b983e..63922bfe652 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_shader.c +++ b/src/gallium/drivers/freedreno/ir3/ir3_shader.c @@ -309,9 +309,6 @@ ir3_shader_create(struct ir3_compiler *compiler, if (cso->type == PIPE_SHADER_IR_NIR) { /* we take ownership of the reference: */ nir = cso->ir.nir; - - NIR_PASS_V(nir, nir_lower_io, nir_var_all, ir3_glsl_type_size, - (nir_lower_io_options)0); } else { debug_assert(cso->type == PIPE_SHADER_IR_TGSI); if (fd_mesa_debug & FD_DBG_DISASM) { @@ -320,6 +317,8 @@ ir3_shader_create(struct ir3_compiler *compiler, } nir = ir3_tgsi_to_nir(cso->tokens); } + NIR_PASS_V(nir, nir_lower_io, nir_var_all, ir3_glsl_type_size, + (nir_lower_io_options)0); /* do first pass optimization, ignoring the key: */ shader->nir = ir3_optimize_nir(shader, nir, NULL); if (fd_mesa_debug & FD_DBG_DISASM) { diff --git a/src/gallium/drivers/v3d/v3d_program.c b/src/gallium/drivers/v3d/v3d_program.c index 85554586a6c..e9fae77d5c0 100644 --- a/src/gallium/drivers/v3d/v3d_program.c +++ b/src/gallium/drivers/v3d/v3d_program.c @@ -193,9 +193,6 @@ v3d_shader_state_create(struct pipe_context *pctx, */ s = cso->ir.nir; - NIR_PASS_V(s, nir_lower_io, nir_var_all & ~nir_var_uniform, - type_size, - (nir_lower_io_options)0); NIR_PASS_V(s, nir_lower_io, nir_var_uniform, uniforms_type_size, (nir_lower_io_options)0); @@ -213,6 +210,10 @@ v3d_shader_state_create(struct pipe_context *pctx, so->was_tgsi = true; } + NIR_PASS_V(s, nir_lower_io, nir_var_all & ~nir_var_uniform, + type_size, + (nir_lower_io_options)0); + NIR_PASS_V(s, nir_opt_global_to_local); NIR_PASS_V(s, nir_lower_regs_to_ssa); NIR_PASS_V(s, nir_normalize_cubemap_coords); diff --git a/src/gallium/drivers/vc4/vc4_program.c b/src/gallium/drivers/vc4/vc4_program.c index 3c439806d36..f734d121052 100644 --- a/src/gallium/drivers/vc4/vc4_program.c +++ b/src/gallium/drivers/vc4/vc4_program.c @@ -2487,9 +2487,6 @@ vc4_shader_state_create(struct pipe_context *pctx, */ s = cso->ir.nir; - NIR_PASS_V(s, nir_lower_io, nir_var_all & ~nir_var_uniform, - type_size, - (nir_lower_io_options)0); NIR_PASS_V(s, nir_lower_io, nir_var_uniform, uniforms_type_size, (nir_lower_io_options)0); @@ -2505,6 +2502,10 @@ vc4_shader_state_create(struct pipe_context *pctx, s = tgsi_to_nir(cso->tokens, &nir_options); } + NIR_PASS_V(s, nir_lower_io, nir_var_all & ~nir_var_uniform, + type_size, + (nir_lower_io_options)0); + NIR_PASS_V(s, nir_opt_global_to_local); NIR_PASS_V(s, nir_lower_regs_to_ssa); NIR_PASS_V(s, nir_normalize_cubemap_coords); |