aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2019-09-06 10:34:35 +0200
committerSamuel Pitoiset <[email protected]>2019-09-06 17:25:28 +0200
commitc6be5cefba7e9480f103c2ce2794a67ed9fa33eb (patch)
tree250578cbecd92ef47057f1cc2060cd660472cf21
parentb1a872f0c0f03abfeb63773b509d633bb4879d24 (diff)
radv/gfx10: make use the output usage mask when exporting NGG GS params
It shouldn't matter much because output varyings should have been compacted during NIR shader linking but it mirrors what the driver does when emitting NGG GS vertex parameters. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
-rw-r--r--src/amd/vulkan/radv_nir_to_llvm.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/amd/vulkan/radv_nir_to_llvm.c b/src/amd/vulkan/radv_nir_to_llvm.c
index 10cc82eb8d9..0c13860fe28 100644
--- a/src/amd/vulkan/radv_nir_to_llvm.c
+++ b/src/amd/vulkan/radv_nir_to_llvm.c
@@ -3489,16 +3489,21 @@ static void gfx10_ngg_gs_emit_epilogue_2(struct radv_shader_context *ctx)
unsigned out_idx = 0;
gep_idx[1] = ctx->ac.i32_0;
for (unsigned i = 0; i < AC_LLVM_MAX_OUTPUTS; ++i) {
+ unsigned output_usage_mask =
+ ctx->shader_info->gs.output_usage_mask[i];
+ int length = util_last_bit(output_usage_mask);
+
if (!(ctx->output_mask & (1ull << i)))
continue;
outputs[noutput].slot_name = i;
outputs[noutput].slot_index = i == VARYING_SLOT_CLIP_DIST1;
-
- outputs[noutput].usage_mask = ctx->shader_info->gs.output_usage_mask[i];
- int length = util_last_bit(outputs[noutput].usage_mask);
+ outputs[noutput].usage_mask = output_usage_mask;
for (unsigned j = 0; j < length; j++, out_idx++) {
+ if (!(output_usage_mask & (1 << j)))
+ continue;
+
gep_idx[2] = LLVMConstInt(ctx->ac.i32, out_idx, false);
tmp = LLVMBuildGEP(builder, vertexptr, gep_idx, 3, "");
tmp = LLVMBuildLoad(builder, tmp, "");