nv50: enable primitive id generation when it is an FP input without GP

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
This commit is contained in:
Ilia Mirkin 2014-01-15 03:49:57 -05:00 committed by Maarten Lankhorst
parent 70a07ac352
commit c4adbd5a57
2 changed files with 8 additions and 9 deletions

View file

@ -168,6 +168,10 @@ nv50_fragprog_assign_slots(struct nv50_ir_prog_info *info)
if (info->in[i].sn == TGSI_SEMANTIC_COLOR)
prog->vp.bfc[info->in[i].si] = j;
else if (info->in[i].sn == TGSI_SEMANTIC_PRIMID) {
prog->vp.attrs[2] |= NV50_3D_VP_GP_BUILTIN_ATTR_EN_PRIMITIVE_ID;
prog->gp.primid = j;
}
prog->in[j].id = i;
prog->in[j].mask = info->in[i].mask;

View file

@ -401,18 +401,13 @@ nv50_fp_linkage_validate(struct nv50_context *nv50)
if (vp->out[n].sn == fp->in[i].sn &&
vp->out[n].si == fp->in[i].si)
break;
if (i == fp->gp.primid) {
primid = m;
}
m = nv50_vec4_map(map, m, lin,
&fp->in[i], (n < vp->out_nr) ? &vp->out[n] : &dummy);
}
/* PrimitiveID either is replaced by the system value, or
* written by the geometry shader into an output register
*/
if (fp->gp.primid < 0x80) {
primid = m;
map[m++] = vp->gp.primid;
}
if (vp->gp.has_layer) {
// In GL4.x, layer can be an fp input, but not in 3.x. Make sure to add
// it to the output map.
@ -461,7 +456,7 @@ nv50_fp_linkage_validate(struct nv50_context *nv50)
PUSH_DATAp(push, map, n);
} else {
BEGIN_NV04(push, NV50_3D(VP_GP_BUILTIN_ATTR_EN), 1);
PUSH_DATA (push, vp->vp.attrs[2]);
PUSH_DATA (push, vp->vp.attrs[2] | fp->vp.attrs[2]);
BEGIN_NV04(push, NV50_3D(SEMANTIC_PRIM_ID), 1);
PUSH_DATA (push, primid);