From c4adbd5a579a0b5952674106c1a4e0420209b321 Mon Sep 17 00:00:00 2001 From: Ilia Mirkin Date: Wed, 15 Jan 2014 03:49:57 -0500 Subject: [PATCH] nv50: enable primitive id generation when it is an FP input without GP Signed-off-by: Ilia Mirkin --- src/gallium/drivers/nouveau/nv50/nv50_program.c | 4 ++++ .../drivers/nouveau/nv50/nv50_shader_state.c | 13 ++++--------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/gallium/drivers/nouveau/nv50/nv50_program.c b/src/gallium/drivers/nouveau/nv50/nv50_program.c index 82e1b8a2232..27d899a4beb 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_program.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_program.c @@ -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; diff --git a/src/gallium/drivers/nouveau/nv50/nv50_shader_state.c b/src/gallium/drivers/nouveau/nv50/nv50_shader_state.c index b24e3ac90e6..6bd1974b4ae 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_shader_state.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_shader_state.c @@ -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); -- 2.30.2