radv/gfx10: Fix NGG GS output mask handlings for LDS indexing.
authorBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Thu, 11 Jul 2019 06:44:19 +0000 (08:44 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 11 Jul 2019 13:45:59 +0000 (15:45 +0200)
In emit_vertex we optimize storage if the output mask does not
have all bits set. Do the same in the epilogue so the indices
actually match up.

Fixes dEQP-VK.geometry.input.basic_primitive.points because it
outputs PSIZE with an output mask of 1, which cause the generic
attribute for the color to be loaded from the wrong indices.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
src/amd/vulkan/radv_nir_to_llvm.c

index b5469677d2b23590ac3adf09c3ded03a929812c0..11498bc27aa364b601f02d9570cadd669ff3c3e7 100644 (file)
@@ -3627,14 +3627,18 @@ static void gfx10_ngg_gs_emit_epilogue_2(struct radv_shader_context *ctx)
                        outputs[noutput].slot_index = i == VARYING_SLOT_CLIP_DIST1;
 
                        outputs[noutput].usage_mask = ctx->shader_info->info.gs.output_usage_mask[i];
+                       int length = util_last_bit(outputs[noutput].usage_mask);
 
-                       for (unsigned j = 0; j < 4; j++, out_idx++) {
+                       for (unsigned j = 0; j < length; j++, out_idx++) {
                                gep_idx[2] = LLVMConstInt(ctx->ac.i32, out_idx, false);
                                tmp = LLVMBuildGEP(builder, vertexptr, gep_idx, 3, "");
                                tmp = LLVMBuildLoad(builder, tmp, "");
                                outputs[noutput].values[j] = ac_to_float(&ctx->ac, tmp);
                        }
 
+                       for (unsigned j = length; j < 4; j++)
+                               outputs[noutput].values[j] = LLVMGetUndef(ctx->ac.f32);
+
                        noutput++;
                }