nv50: handle gl_Layer writes in GP

Marks gl_Layer as only having one component, and makes sure to keep
track of where it is and emit it in the output map, since it is not an
input to the FP.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
This commit is contained in:
Ilia Mirkin
2014-01-15 03:47:48 -05:00
committed by Maarten Lankhorst
parent 7c624148a6
commit 70a07ac352
4 changed files with 19 additions and 1 deletions

View File

@@ -1030,6 +1030,7 @@ bool Source::scanInstruction(const struct tgsi_full_instruction *inst)
if (info->out[dst.getIndex(0)].sn == TGSI_SEMANTIC_PSIZE ||
info->out[dst.getIndex(0)].sn == TGSI_SEMANTIC_PRIMID ||
info->out[dst.getIndex(0)].sn == TGSI_SEMANTIC_LAYER ||
info->out[dst.getIndex(0)].sn == TGSI_SEMANTIC_FOG)
info->out[dst.getIndex(0)].mask &= 1;

View File

@@ -103,6 +103,10 @@ nv50_vertprog_assign_slots(struct nv50_ir_prog_info *info)
case TGSI_SEMANTIC_BCOLOR:
prog->vp.bfc[info->out[i].si] = i;
break;
case TGSI_SEMANTIC_LAYER:
prog->gp.has_layer = true;
prog->gp.layerid = n;
break;
default:
break;
}
@@ -331,6 +335,7 @@ nv50_program_translate(struct nv50_program *prog, uint16_t chipset)
prog->vp.clpd[1] = map_undef;
prog->vp.psiz = map_undef;
prog->gp.primid = 0x80;
prog->gp.has_layer = 0;
info->driverPriv = prog;

View File

@@ -90,6 +90,8 @@ struct nv50_program {
uint32_t vert_count;
ubyte primid; /* primitive id output register */
uint8_t prim_type; /* point, line strip or tri strip */
bool has_layer;
ubyte layerid; /* hw value of layer output */
} gp;
void *fixups; /* relocation records */

View File

@@ -346,6 +346,7 @@ nv50_fp_linkage_validate(struct nv50_context *nv50)
struct nv50_varying dummy;
int i, n, c, m;
uint32_t primid = 0;
uint32_t layerid = vp->gp.layerid;
uint32_t psiz = 0x000;
uint32_t interp = fp->fp.interp;
uint32_t colors = fp->fp.colors;
@@ -412,6 +413,12 @@ nv50_fp_linkage_validate(struct nv50_context *nv50)
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.
map[m++] = layerid;
}
if (nv50->rast->pipe.point_size_per_vertex) {
psiz = (m << 4) | 1;
map[m++] = vp->vp.psiz;
@@ -468,9 +475,12 @@ nv50_fp_linkage_validate(struct nv50_context *nv50)
BEGIN_NV04(push, NV50_3D(SEMANTIC_COLOR), 4);
PUSH_DATA (push, colors);
PUSH_DATA (push, (vp->vp.clpd_nr << 8) | 4);
PUSH_DATA (push, 0);
PUSH_DATA (push, layerid);
PUSH_DATA (push, psiz);
BEGIN_NV04(push, NV50_3D(LAYER), 1);
PUSH_DATA (push, vp->gp.has_layer << 16);
BEGIN_NV04(push, NV50_3D(FP_INTERPOLANT_CTRL), 1);
PUSH_DATA (push, interp);