summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorIlia Mirkin <[email protected]>2014-01-15 03:49:57 -0500
committerMaarten Lankhorst <[email protected]>2014-01-27 16:40:42 +0100
commitc4adbd5a579a0b5952674106c1a4e0420209b321 (patch)
treef0dda9177b985e11c4b5d54a63e8a68b62405d0c /src
parent70a07ac35269c037adb2b724df28357b7f87efb1 (diff)
nv50: enable primitive id generation when it is an FP input without GP
Signed-off-by: Ilia Mirkin <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/nouveau/nv50/nv50_program.c4
-rw-r--r--src/gallium/drivers/nouveau/nv50/nv50_shader_state.c13
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);