diff options
author | Michel Dänzer <[email protected]> | 2014-01-09 12:55:26 +0900 |
---|---|---|
committer | Michel Dänzer <[email protected]> | 2014-01-29 11:07:11 +0900 |
commit | d8b3d806fc328ee2997c1d9f9bb630682f49cce5 (patch) | |
tree | ba65192236817365814efdfdc0a38044b60933fe /src/gallium/drivers/radeonsi/si_shader.c | |
parent | 7c7d7380f13d5863de846fef60d80ad13836634e (diff) |
radeonsi: Handle TGSI_SEMANTIC_PRIMID
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeonsi/si_shader.c')
-rw-r--r-- | src/gallium/drivers/radeonsi/si_shader.c | 15 |
1 files changed, 14 insertions, 1 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; |