radv/llvm: add clip distance outputs manually if they're missing

It's possible that undef is written to clip/cull distance outputs and
they're eliminated, and we never set any position export to done=1 because
outinfo->pos_exports was calculated with the expectation that clip/cull is
exported.

Eliminating the export and fixing the done=1 bit hangs because the
hardware is still expecting clip/cull distances.

Fixes dEQP-VK.rasterization.provoking_vertex.transform_feedback.first.line_list
hang with LLVM.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19200>
This commit is contained in:
Rhys Perry
2022-10-20 14:54:18 +01:00
committed by Marge Bot
parent 7aa94efe82
commit 974358a8c1

View File

@@ -924,6 +924,23 @@ radv_llvm_export_vs(struct radv_shader_context *ctx, struct radv_shader_output_v
pos_args[0].out[3] = ctx->ac.f32_1; /* W */
}
/* Add clip distance outputs manually if they're missing. */
uint8_t clip_cull_mask = outinfo->clip_dist_mask | outinfo->cull_dist_mask;
for (i = 2; i < 4; i++) {
uint8_t mask = 0xf << (i * 4 - 8);
if ((clip_cull_mask & mask) && !pos_args[i].out[0]) {
pos_args[i].enabled_channels = 0x0;
pos_args[i].valid_mask = 0;
pos_args[i].done = 0;
pos_args[i].target = V_008DFC_SQ_EXP_POS + i;
pos_args[i].compr = 0;
pos_args[i].out[0] = ctx->ac.f32_0;
pos_args[i].out[1] = ctx->ac.f32_0;
pos_args[i].out[2] = ctx->ac.f32_0;
pos_args[i].out[3] = ctx->ac.f32_0;
}
}
if (outinfo->writes_pointsize || outinfo->writes_layer || outinfo->writes_layer ||
outinfo->writes_viewport_index || outinfo->writes_primitive_shading_rate) {
pos_args[1].enabled_channels = ((outinfo->writes_pointsize == true ? 1 : 0) |