Mesa (master): nvc0: force perspective correction hint to nicest

Christoph Bumiller chrisbmr at kemper.freedesktop.org
Sun Apr 10 12:07:43 UTC 2011


Module: Mesa
Branch: master
Commit: d546df4d9c090656c506e8a959646a48ed00efc2
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d546df4d9c090656c506e8a959646a48ed00efc2

Author: Christoph Bumiller <e0425955 at student.tuwien.ac.at>
Date:   Sun Apr 10 13:55:01 2011 +0200

nvc0: force perspective correction hint to nicest

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 |    4 ++++
 src/gallium/drivers/nvc0/nvc0_program.c |    3 +++
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/nvc0/nvc0_pc_emit.c b/src/gallium/drivers/nvc0/nvc0_pc_emit.c
index 76ad40d..6f409a9 100644
--- a/src/gallium/drivers/nvc0/nvc0_pc_emit.c
+++ b/src/gallium/drivers/nvc0/nvc0_pc_emit.c
@@ -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);
    }
diff --git a/src/gallium/drivers/nvc0/nvc0_program.c b/src/gallium/drivers/nvc0/nvc0_program.c
index 3c59213..383bc30 100644
--- a/src/gallium/drivers/nvc0/nvc0_program.c
+++ b/src/gallium/drivers/nvc0/nvc0_program.c
@@ -225,6 +225,9 @@ nvc0_interp_mode(const struct tgsi_full_declaration *decl)
    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;
 
    if (decl->Declaration.Centroid)




More information about the mesa-commit mailing list