summaryrefslogtreecommitdiffstats
path: root/src/amd/common
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2017-06-20 13:21:04 +1000
committerDave Airlie <[email protected]>2017-06-26 08:45:30 +1000
commit6a68170c8360d702a25e59740d04f79a4f8323a7 (patch)
tree64fbdaf11d2657331de0e29746a774f0e0e5aab6 /src/amd/common
parent2a87ddbdcb3129606f237d4eedf9cad588b5b4d9 (diff)
radv: handle primitive id input into fragment shader with no geom shader
Fixes: dEQP-VK.pipeline.framebuffer_attachment.no_attachments dEQP-VK.pipeline.framebuffer_attachment.no_attachments_ms Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/amd/common')
-rw-r--r--src/amd/common/ac_nir_to_llvm.c26
-rw-r--r--src/amd/common/ac_nir_to_llvm.h3
2 files changed, 26 insertions, 3 deletions
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index afef3fd28d4..f0ae7087379 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -5124,6 +5124,7 @@ si_llvm_init_export_args(struct nir_to_llvm_context *ctx,
static void
handle_vs_outputs_post(struct nir_to_llvm_context *ctx,
+ bool export_prim_id,
struct ac_vs_output_info *outinfo)
{
uint32_t param_count = 0;
@@ -5265,6 +5266,23 @@ handle_vs_outputs_post(struct nir_to_llvm_context *ctx,
ac_build_export(&ctx->ac, &pos_args[i]);
}
+
+ if (export_prim_id) {
+ LLVMValueRef values[4];
+ target = V_008DFC_SQ_EXP_PARAM + param_count;
+ outinfo->vs_output_param_offset[VARYING_SLOT_PRIMITIVE_ID] = param_count;
+ param_count++;
+
+ values[0] = ctx->vs_prim_id;
+ ctx->shader_info->vs.vgpr_comp_cnt = MAX2(2,
+ ctx->shader_info->vs.vgpr_comp_cnt);
+ for (unsigned j = 1; j < 4; j++)
+ values[j] = ctx->f32zero;
+ si_llvm_init_export_args(ctx, values, target, &args);
+ ac_build_export(&ctx->ac, &args);
+ outinfo->export_prim_id = true;
+ }
+
outinfo->pos_exports = num_pos_exports;
outinfo->param_exports = param_count;
}
@@ -5700,7 +5718,8 @@ handle_shader_outputs_post(struct nir_to_llvm_context *ctx)
else if (ctx->options->key.vs.as_es)
handle_es_outputs_post(ctx, &ctx->shader_info->vs.es_info);
else
- handle_vs_outputs_post(ctx, &ctx->shader_info->vs.outinfo);
+ handle_vs_outputs_post(ctx, ctx->options->key.vs.export_prim_id,
+ &ctx->shader_info->vs.outinfo);
break;
case MESA_SHADER_FRAGMENT:
handle_fs_outputs_post(ctx);
@@ -5715,7 +5734,8 @@ handle_shader_outputs_post(struct nir_to_llvm_context *ctx)
if (ctx->options->key.tes.as_es)
handle_es_outputs_post(ctx, &ctx->shader_info->tes.es_info);
else
- handle_vs_outputs_post(ctx, &ctx->shader_info->tes.outinfo);
+ handle_vs_outputs_post(ctx, ctx->options->key.tes.export_prim_id,
+ &ctx->shader_info->tes.outinfo);
break;
default:
break;
@@ -6191,7 +6211,7 @@ ac_gs_copy_shader_emit(struct nir_to_llvm_context *ctx)
}
idx += slot_inc;
}
- handle_vs_outputs_post(ctx, &ctx->shader_info->vs.outinfo);
+ handle_vs_outputs_post(ctx, false, &ctx->shader_info->vs.outinfo);
}
void ac_create_gs_copy_shader(LLVMTargetMachineRef tm,
diff --git a/src/amd/common/ac_nir_to_llvm.h b/src/amd/common/ac_nir_to_llvm.h
index 724d5e6b0fd..54d54891ac1 100644
--- a/src/amd/common/ac_nir_to_llvm.h
+++ b/src/amd/common/ac_nir_to_llvm.h
@@ -41,10 +41,12 @@ struct ac_vs_variant_key {
uint32_t instance_rate_inputs;
uint32_t as_es:1;
uint32_t as_ls:1;
+ uint32_t export_prim_id:1;
};
struct ac_tes_variant_key {
uint32_t as_es:1;
+ uint32_t export_prim_id:1;
};
struct ac_tcs_variant_key {
@@ -128,6 +130,7 @@ struct ac_vs_output_info {
bool writes_pointsize;
bool writes_layer;
bool writes_viewport_index;
+ bool export_prim_id;
uint32_t export_mask;
unsigned pos_exports;
};