diff options
author | Samuel Pitoiset <[email protected]> | 2017-12-14 17:32:41 +0100 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2017-12-14 22:22:26 +0100 |
commit | 90c3bf07892c27c86c2474b14388e6b627454d76 (patch) | |
tree | c6120db7014f93241ec7d215db92a7b83eb10644 /src/amd | |
parent | 2294d35b243dee15af15895e876a63b7d22e48cc (diff) |
radv: do not load the local invocation index when it's unused
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src/amd')
-rw-r--r-- | src/amd/common/ac_nir_to_llvm.c | 3 | ||||
-rw-r--r-- | src/amd/common/ac_shader_info.c | 3 | ||||
-rw-r--r-- | src/amd/common/ac_shader_info.h | 1 | ||||
-rw-r--r-- | src/amd/vulkan/radv_shader.c | 2 |
4 files changed, 7 insertions, 2 deletions
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index 0e1d7e0082f..2fe346b012e 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -751,7 +751,8 @@ static void create_function(struct nir_to_llvm_context *ctx, &ctx->num_work_groups); } add_sgpr_argument(&args, ctx->ac.v3i32, &ctx->workgroup_ids); - add_sgpr_argument(&args, ctx->ac.i32, &ctx->tg_size); + if (ctx->shader_info->info.cs.uses_local_invocation_idx) + add_sgpr_argument(&args, ctx->ac.i32, &ctx->tg_size); add_vgpr_argument(&args, ctx->ac.v3i32, &ctx->local_invocation_ids); break; case MESA_SHADER_VERTEX: diff --git a/src/amd/common/ac_shader_info.c b/src/amd/common/ac_shader_info.c index 87744ed23e1..3299b47e6b8 100644 --- a/src/amd/common/ac_shader_info.c +++ b/src/amd/common/ac_shader_info.c @@ -58,6 +58,9 @@ gather_intrinsic_info(nir_intrinsic_instr *instr, struct ac_shader_info *info) } break; } + case nir_intrinsic_load_local_invocation_index: + info->cs.uses_local_invocation_idx = true; + break; case nir_intrinsic_load_sample_id: info->ps.force_persample = true; break; diff --git a/src/amd/common/ac_shader_info.h b/src/amd/common/ac_shader_info.h index 0136d5af403..79e5615254b 100644 --- a/src/amd/common/ac_shader_info.h +++ b/src/amd/common/ac_shader_info.h @@ -45,6 +45,7 @@ struct ac_shader_info { bool uses_grid_size; bool uses_block_id[3]; bool uses_thread_id[3]; + bool uses_local_invocation_idx; } cs; }; diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c index 907c1986f8a..ab8ba42511e 100644 --- a/src/amd/vulkan/radv_shader.c +++ b/src/amd/vulkan/radv_shader.c @@ -400,7 +400,7 @@ radv_fill_shader_variant(struct radv_device *device, S_00B84C_TGID_Z_EN(info->cs.uses_block_id[2]) | S_00B84C_TIDIG_COMP_CNT(info->cs.uses_thread_id[2] ? 2 : info->cs.uses_thread_id[1] ? 1 : 0) | - S_00B84C_TG_SIZE_EN(1) | + S_00B84C_TG_SIZE_EN(info->cs.uses_local_invocation_idx) | S_00B84C_LDS_SIZE(variant->config.lds_size); break; } |