summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nouveau/nv50
diff options
context:
space:
mode:
authorIlia Mirkin <[email protected]>2014-01-15 03:47:48 -0500
committerMaarten Lankhorst <[email protected]>2014-01-27 16:40:42 +0100
commit70a07ac35269c037adb2b724df28357b7f87efb1 (patch)
tree4607ddf32e1fa6065b97b504b94190c2f74112ac /src/gallium/drivers/nouveau/nv50
parent7c624148a699eb660565498ff91685be4d0f1c35 (diff)
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 <[email protected]>
Diffstat (limited to 'src/gallium/drivers/nouveau/nv50')
-rw-r--r--src/gallium/drivers/nouveau/nv50/nv50_program.c5
-rw-r--r--src/gallium/drivers/nouveau/nv50/nv50_program.h2
-rw-r--r--src/gallium/drivers/nouveau/nv50/nv50_shader_state.c12
3 files changed, 18 insertions, 1 deletions
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_program.c b/src/gallium/drivers/nouveau/nv50/nv50_program.c
index f46f240cc3c..82e1b8a2232 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_program.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_program.c
@@ -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;
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_program.h b/src/gallium/drivers/nouveau/nv50/nv50_program.h
index 95167272f44..5b092bde815 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_program.h
+++ b/src/gallium/drivers/nouveau/nv50/nv50_program.h
@@ -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 */
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_shader_state.c b/src/gallium/drivers/nouveau/nv50/nv50_shader_state.c
index ff711f96b63..b24e3ac90e6 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_shader_state.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_shader_state.c
@@ -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);