OSDN Git Service

nv50: handle TGSI_SEMANTIC_FACE
authorChristoph Bumiller <e0425955@student.tuwien.ac.at>
Sun, 1 Nov 2009 13:15:30 +0000 (14:15 +0100)
committerChristoph Bumiller <e0425955@student.tuwien.ac.at>
Sun, 1 Nov 2009 13:28:08 +0000 (14:28 +0100)
src/gallium/drivers/nv50/nv50_program.c

index 66190f0..27827c7 100644 (file)
@@ -2463,6 +2463,23 @@ load_interpolant(struct nv50_pc *pc, struct nv50_reg *reg)
        emit_interp(pc, reg, iv, mode);
 }
 
+/* The face input is always at v[255] (varying space), with a
+ * value of 0 for back-facing, and 0xffffffff for front-facing.
+ */
+static void
+load_frontfacing(struct nv50_pc *pc, struct nv50_reg *a)
+{
+       struct nv50_reg *one = alloc_immd(pc, 1.0f);
+
+       assert(a->rhw == -1);
+       alloc_reg(pc, a); /* do this before rhw is set */
+       a->rhw = 255;
+       load_interpolant(pc, a);
+       emit_bitop2(pc, a, a, one, TGSI_OPCODE_AND);
+
+       FREE(one);
+}
+
 static boolean
 nv50_program_tx_prep(struct nv50_pc *pc)
 {
@@ -2607,6 +2624,8 @@ nv50_program_tx_prep(struct nv50_pc *pc)
                int rid, aid;
                unsigned n = 0, m = pc->attr_nr - flat_nr;
 
+               pc->allow32 = TRUE;
+
                int base = (TGSI_SEMANTIC_POSITION ==
                            p->info.input_semantic_name[0]) ? 0 : 1;
 
@@ -2635,6 +2654,12 @@ nv50_program_tx_prep(struct nv50_pc *pc)
                        p->cfg.io[n].hw = rid = aid;
                        i = p->cfg.io[n].id_fp;
 
+                       if (p->info.input_semantic_name[n] ==
+                           TGSI_SEMANTIC_FACE) {
+                               load_frontfacing(pc, &pc->attr[i * 4]);
+                               continue;
+                       }
+
                        for (c = 0; c < 4; ++c) {
                                if (!pc->attr[i * 4 + c].acc)
                                        continue;