summaryrefslogtreecommitdiffstats
path: root/src/amd
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2017-01-19 15:23:02 +1000
committerDave Airlie <[email protected]>2017-01-31 09:30:08 +1000
commitfd4ea9e62d9a89e58c22c77758adcfd193f172ec (patch)
treee5527d879acb82af74cd854b82ac4bce818998c4 /src/amd
parent4ec294adce93392c015e7b2bbd79a7f9a50990a0 (diff)
radv/ac: handle primitive id
Reviewed-by: Bas Nieuwenhuizen <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/amd')
-rw-r--r--src/amd/common/ac_nir_to_llvm.c10
-rw-r--r--src/amd/common/ac_nir_to_llvm.h2
2 files changed, 11 insertions, 1 deletions
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index c5c32eb80fd..15ea727755a 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -4113,7 +4113,8 @@ handle_fs_inputs_pre(struct nir_to_llvm_context *ctx,
if (!(ctx->input_mask & (1ull << i)))
continue;
- if (i >= VARYING_SLOT_VAR0 || i == VARYING_SLOT_PNTC) {
+ if (i >= VARYING_SLOT_VAR0 || i == VARYING_SLOT_PNTC ||
+ i == VARYING_SLOT_PRIMITIVE_ID) {
interp_param = *inputs;
interp_fs_input(ctx, index, interp_param, ctx->prim_mask,
inputs);
@@ -4131,6 +4132,8 @@ handle_fs_inputs_pre(struct nir_to_llvm_context *ctx,
ctx->shader_info->fs.num_interp = index;
if (ctx->input_mask & (1 << VARYING_SLOT_PNTC))
ctx->shader_info->fs.has_pcoord = true;
+ if (ctx->input_mask & (1 << VARYING_SLOT_PRIMITIVE_ID))
+ ctx->shader_info->fs.prim_id_input = true;
ctx->shader_info->fs.input_mask = ctx->input_mask >> VARYING_SLOT_VAR0;
}
@@ -4418,6 +4421,7 @@ handle_vs_outputs_post(struct nir_to_llvm_context *ctx)
(1ull << VARYING_SLOT_CULL_DIST0) |
(1ull << VARYING_SLOT_CULL_DIST1));
+ ctx->shader_info->vs.prim_id_output = 0xffffffff;
if (clip_mask) {
LLVMValueRef slots[8];
unsigned j;
@@ -4479,6 +4483,10 @@ handle_vs_outputs_post(struct nir_to_llvm_context *ctx)
ctx->shader_info->vs.writes_viewport_index = true;
viewport_index_value = values[0];
continue;
+ } else if (i == VARYING_SLOT_PRIMITIVE_ID) {
+ ctx->shader_info->vs.prim_id_output = param_count;
+ target = V_008DFC_SQ_EXP_PARAM + param_count;
+ param_count++;
} else if (i >= VARYING_SLOT_VAR0) {
ctx->shader_info->vs.export_mask |= 1u << (i - VARYING_SLOT_VAR0);
target = V_008DFC_SQ_EXP_PARAM + param_count;
diff --git a/src/amd/common/ac_nir_to_llvm.h b/src/amd/common/ac_nir_to_llvm.h
index ab6ce5a5c6a..4a6572d5d7c 100644
--- a/src/amd/common/ac_nir_to_llvm.h
+++ b/src/amd/common/ac_nir_to_llvm.h
@@ -106,6 +106,7 @@ struct ac_shader_variant_info {
uint8_t clip_dist_mask;
uint8_t cull_dist_mask;
uint32_t esgs_itemsize;
+ uint32_t prim_id_output;
} vs;
struct {
unsigned num_interp;
@@ -119,6 +120,7 @@ struct ac_shader_variant_info {
bool early_fragment_test;
bool writes_memory;
bool force_persample;
+ bool prim_id_input;
} fs;
struct {
unsigned block_size[3];