nvc0: force perspective correction hint to nicest
authorChristoph Bumiller <e0425955@student.tuwien.ac.at>
Sun, 10 Apr 2011 11:55:01 +0000 (13:55 +0200)
committerChristoph Bumiller <e0425955@student.tuwien.ac.at>
Sun, 10 Apr 2011 12:06:52 +0000 (14:06 +0200)
Fixes issues in e.g. nexuiz (desertfactory) or supertuxkart that
look like lighting bugs.

They're not visible with the software rasterizers because their
notion of linear interpolation seems to be different from that
of nv50/nvc0.

src/gallium/drivers/nvc0/nvc0_pc_emit.c
src/gallium/drivers/nvc0/nvc0_program.c

index 76ad40dbcf8d018dcd4c914f14af27a0833b2623..6f409a9e925c1455d2a52fce51906d5ce60a30ca 100644 (file)
@@ -715,6 +715,10 @@ emit_interp(struct nv_pc *pc, struct nv_instruction *i)
    if (i->opcode == NV_OP_PINTERP) {
       pc->emit[0] |= 0x040;
       SID(pc, i->src[1], 26);
+
+      if (i->src[0]->value->reg.address >= 0x280 &&
+          i->src[0]->value->reg.address <= 0x29c)
+         pc->emit[0] |= 0x080; /* XXX: ? */
    } else {
       SID(pc, NULL, 26);
    }
index 3c59213176ef7ae8005d345a2ef4bd594d7bb60c..383bc30f20baaad6cb157f5180f2a4b7d1d43ab2 100644 (file)
@@ -224,6 +224,9 @@ nvc0_interp_mode(const struct tgsi_full_declaration *decl)
    else
    if (decl->Declaration.Interpolate == TGSI_INTERPOLATE_PERSPECTIVE)
       mode = NVC0_INTERP_PERSPECTIVE;
+   else
+   if (decl->Declaration.Semantic && decl->Semantic.Name == TGSI_SEMANTIC_COLOR)
+      mode = NVC0_INTERP_PERSPECTIVE;
    else
       mode = NVC0_INTERP_LINEAR;