[PATCH 11/13] nv50: add support for light-twoside
Christoph Bumiller
e0425955 at student.tuwien.ac.at
Sat Sep 12 12:33:56 PDT 2009
---
src/gallium/drivers/nv50/nv50_program.c | 19 +++++++++++++++++++
src/gallium/drivers/nv50/nv50_state.c | 4 +++-
2 files changed, 22 insertions(+), 1 deletions(-)
diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c
index feb1504..39c3afc 100644
--- a/src/gallium/drivers/nv50/nv50_program.c
+++ b/src/gallium/drivers/nv50/nv50_program.c
@@ -2048,6 +2048,11 @@ nv50_program_tx_prep(struct nv50_pc *pc)
si = d->Semantic.SemanticIndex;
switch (d->Semantic.SemanticName) {
+ case TGSI_SEMANTIC_BCOLOR:
+ p->cfg.two_side[si].hw_id = first;
+ if (p->cfg.io_nr > first)
+ p->cfg.io_nr = first;
+ break;
/*
case TGSI_SEMANTIC_CLIP_DISTANCE:
p->cfg.clpd = MIN2(p->cfg.clpd, first);
@@ -2125,6 +2130,11 @@ nv50_program_tx_prep(struct nv50_pc *pc)
p->cfg.io[i].mask |= 1 << c;
}
}
+
+ for (c = 0; c < 2; ++c)
+ if (p->cfg.two_side[c].hw_id < 0x40)
+ p->cfg.two_side[c] = p->cfg.io[
+ p->cfg.two_side[c].hw_id];
} else
if (p->type == PIPE_SHADER_FRAGMENT) {
int rid, aid;
@@ -2726,6 +2736,15 @@ nv50_linkage_validate(struct nv50_context *nv50)
}
reg[0] += (m - 4) << 8; /* adjust BFC0 id */
+
+ /* if VP writes any back-face colour, use separate slots */
+ if (vp->cfg.two_side[0].mask | vp->cfg.two_side[1].mask) {
+ vpo = &vp->cfg.two_side[0];
+
+ m = nv50_sreg4_map(map, m, lin, &fp->cfg.two_side[0], &vpo[0]);
+ m = nv50_sreg4_map(map, m, lin, &fp->cfg.two_side[1], &vpo[1]);
+ }
+
reg[0] += m - 4; /* adjust FFC0 id */
reg[4] |= m << 8; /* set mid where 'normal' FP inputs start */
diff --git a/src/gallium/drivers/nv50/nv50_state.c b/src/gallium/drivers/nv50/nv50_state.c
index 4283808..20d9f43 100644
--- a/src/gallium/drivers/nv50/nv50_state.c
+++ b/src/gallium/drivers/nv50/nv50_state.c
@@ -264,7 +264,6 @@ nv50_rasterizer_state_create(struct pipe_context *pipe,
CALLOC_STRUCT(nv50_rasterizer_stateobj);
/*XXX: ignored
- * - light_twosize
* - point_smooth
* - multisample
* - point_sprite / sprite_coord_mode
@@ -276,6 +275,9 @@ nv50_rasterizer_state_create(struct pipe_context *pipe,
so_method(so, tesla, 0x1684, 1);
so_data (so, cso->flatshade_first ? 0 : 1);
+ so_method(so, tesla, NV50TCL_VERTEX_TWO_SIDE_ENABLE, 1);
+ so_data (so, cso->light_twoside);
+
so_method(so, tesla, NV50TCL_LINE_WIDTH, 1);
so_data (so, fui(cso->line_width));
so_method(so, tesla, NV50TCL_LINE_SMOOTH_ENABLE, 1);
--
1.6.3.3
--------------010208090904000401070505
Content-Type: text/plain;
name="0012-nv50-add-support-for-point-size-per-vertex.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename*0="0012-nv50-add-support-for-point-size-per-vertex.patch"
More information about the Nouveau
mailing list