summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorMichel Dänzer <[email protected]>2014-01-09 12:55:26 +0900
committerMichel Dänzer <[email protected]>2014-01-29 11:07:11 +0900
commitd8b3d806fc328ee2997c1d9f9bb630682f49cce5 (patch)
treeba65192236817365814efdfdc0a38044b60933fe /src/gallium
parent7c7d7380f13d5863de846fef60d80ad13836634e (diff)
radeonsi: Handle TGSI_SEMANTIC_PRIMID
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/radeonsi/si_shader.c15
-rw-r--r--src/gallium/drivers/radeonsi/si_shader.h1
-rw-r--r--src/gallium/drivers/radeonsi/si_state_draw.c2
3 files changed, 16 insertions, 2 deletions
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index 42a3fc6a73b..6788255f62b 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -169,6 +169,7 @@ static int si_store_shader_io_attribs(struct si_shader *shader,
assert(i < Elements(shader->input));
shader->input[i].name = d->Semantic.Name;
shader->input[i].sid = d->Semantic.Index;
+ shader->input[i].index = d->Range.First;
shader->input[i].interpolate = d->Interp.Interpolate;
shader->input[i].centroid = d->Interp.Centroid;
return -1;
@@ -258,7 +259,9 @@ static void declare_input_gs(
struct si_shader *shader = &si_shader_ctx->shader->shader;
si_store_shader_io_attribs(shader, decl);
- shader->input[input_index].param_offset = shader->nparam++;
+
+ if (decl->Semantic.Name != TGSI_SEMANTIC_PRIMID)
+ shader->input[input_index].param_offset = shader->nparam++;
}
static LLVMValueRef fetch_input_gs(
@@ -279,6 +282,15 @@ static LLVMValueRef fetch_input_gs(
LLVMValueRef args[9];
unsigned vtx_offset_param;
+ if (swizzle != ~0 &&
+ shader->input[reg->Register.Index].name == TGSI_SEMANTIC_PRIMID) {
+ if (swizzle == 0)
+ return LLVMGetParam(si_shader_ctx->radeon_bld.main_fn,
+ SI_PARAM_PRIMITIVE_ID);
+ else
+ return uint->zero;
+ }
+
if (!reg->Register.Dimension)
return NULL;
@@ -1040,6 +1052,7 @@ handle_semantic:
case TGSI_SEMANTIC_CLIPVERTEX:
si_llvm_emit_clipvertex(bld_base, pos_args, outputs[i].values);
continue;
+ case TGSI_SEMANTIC_PRIMID:
case TGSI_SEMANTIC_FOG:
case TGSI_SEMANTIC_GENERIC:
target = V_008DFC_SQ_EXP_PARAM + param_count;
diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h
index 32999066cc5..d11d34646ac 100644
--- a/src/gallium/drivers/radeonsi/si_shader.h
+++ b/src/gallium/drivers/radeonsi/si_shader.h
@@ -93,6 +93,7 @@ struct si_shader_input {
unsigned name;
int sid;
unsigned param_offset;
+ unsigned index;
unsigned interpolate;
bool centroid;
};
diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c b/src/gallium/drivers/radeonsi/si_state_draw.c
index 66b7ef3e046..e770edd7f45 100644
--- a/src/gallium/drivers/radeonsi/si_state_draw.c
+++ b/src/gallium/drivers/radeonsi/si_state_draw.c
@@ -122,7 +122,7 @@ static void si_pipe_shader_gs(struct pipe_context *ctx, struct si_pipe_shader *s
si_pm4_set_reg(pm4, R_028A68_VGT_GSVS_RING_OFFSET_3, gsvs_itemsize);
si_pm4_set_reg(pm4, R_028AAC_VGT_ESGS_RING_ITEMSIZE,
- shader->shader.ninput * (16 >> 2));
+ shader->shader.nparam * (16 >> 2));
si_pm4_set_reg(pm4, R_028AB0_VGT_GSVS_RING_ITEMSIZE, gsvs_itemsize);
si_pm4_set_reg(pm4, R_028B38_VGT_GS_MAX_VERT_OUT, gs_max_vert_out);