diff options
author | Samuel Pitoiset <[email protected]> | 2018-05-16 17:43:22 +0200 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2018-05-17 14:14:11 +0200 |
commit | a6e44d12714871193ef130845b1f8727ffdbf01e (patch) | |
tree | 0061eae49d4c5f62db609f4593760931eff9ec7b | |
parent | 507402ada6dbe56daca49c1f9bdba3b445132e50 (diff) |
radv: do not emit unnecessary GS output stores
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
-rw-r--r-- | src/amd/vulkan/radv_nir_to_llvm.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/amd/vulkan/radv_nir_to_llvm.c b/src/amd/vulkan/radv_nir_to_llvm.c index b4af0f29415..05ae7096857 100644 --- a/src/amd/vulkan/radv_nir_to_llvm.c +++ b/src/amd/vulkan/radv_nir_to_llvm.c @@ -1684,6 +1684,8 @@ visit_emit_vertex(struct ac_shader_abi *abi, unsigned stream, LLVMValueRef *addr /* loop num outputs */ idx = 0; for (unsigned i = 0; i < AC_LLVM_MAX_OUTPUTS; ++i) { + unsigned output_usage_mask = + ctx->shader_info->info.gs.output_usage_mask[i]; LLVMValueRef *out_ptr = &addrs[i * 4]; int length = 4; int slot = idx; @@ -1697,8 +1699,13 @@ visit_emit_vertex(struct ac_shader_abi *abi, unsigned stream, LLVMValueRef *addr length = ctx->num_output_clips + ctx->num_output_culls; if (length > 4) slot_inc = 2; + output_usage_mask = (1 << length) - 1; } + for (unsigned j = 0; j < length; j++) { + if (!(output_usage_mask & (1 << j))) + continue; + LLVMValueRef out_val = LLVMBuildLoad(ctx->ac.builder, out_ptr[j], ""); LLVMValueRef voffset = LLVMConstInt(ctx->ac.i32, (slot * 4 + j) * ctx->gs_max_out_vertices, false); |