[Mesa-dev] [PATCH 05/16] radeonsi: Handle TGSI_SEMANTIC_PRIMID
Michel Dänzer
michel at daenzer.net
Fri Jan 24 01:33:17 PST 2014
From: Michel Dänzer <michel.daenzer at amd.com>
Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
src/gallium/drivers/radeonsi/si_shader.c | 15 ++++++++++++++-
src/gallium/drivers/radeonsi/si_shader.h | 1 +
src/gallium/drivers/radeonsi/si_state_draw.c | 2 +-
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 62ebf13..35a646b 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -177,6 +177,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;
@@ -268,7 +269,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(
@@ -289,6 +292,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;
@@ -1052,6 +1064,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 3299906..d11d346 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 3fc5074..2185f16 100644
--- a/src/gallium/drivers/radeonsi/si_state_draw.c
+++ b/src/gallium/drivers/radeonsi/si_state_draw.c
@@ -148,7 +148,7 @@ static void si_pipe_shader_gs(struct pipe_context *ctx, struct si_pipe_shader *s
si_conv_prim_to_gs_out(shader->shader.gs_output_prim));
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);
--
1.8.5.3
More information about the mesa-dev
mailing list