summaryrefslogtreecommitdiff
path: root/src/mesa/pipe/tgsi
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2007-09-18 12:55:20 -0600
committerBrian <brian.paul@tungstengraphics.com>2007-09-18 12:56:23 -0600
commit2a460f6185199bad8b2bca4d0bac319377f801fa (patch)
tree63a190340a554027851fc5af77c34d49e62a26d3 /src/mesa/pipe/tgsi
parent72b0a57cfa99e55ad6e1b4ddcd486c202ee1f22d (diff)
Fix some issues with perspective-corrected interpolation.
In mesa_to_tgsi.c, use TGSI_INTERPOLATE_PERSPECTIVE by default (to match post-transform vertex info convention). More to be done there... In sp_quad_fs.c, interpolate W in addition to Z. This fixes the divide by zero happening in perspective_interpolation() tgsi_exec.c As it was, we were only getting perspective correction of texture coords used by the TGSI_TEX instruction since it does a homogeneous divide. Other coords/varyings were incorrect.
Diffstat (limited to 'src/mesa/pipe/tgsi')
-rw-r--r--src/mesa/pipe/tgsi/exec/tgsi_exec.c1
-rw-r--r--src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c2
2 files changed, 2 insertions, 1 deletions
diff --git a/src/mesa/pipe/tgsi/exec/tgsi_exec.c b/src/mesa/pipe/tgsi/exec/tgsi_exec.c
index 793f8bc0f6..28dc049658 100644
--- a/src/mesa/pipe/tgsi/exec/tgsi_exec.c
+++ b/src/mesa/pipe/tgsi/exec/tgsi_exec.c
@@ -1104,6 +1104,7 @@ perspective_interpolation(
const float y = mach->Inputs[0].xyzw[1].f[i];
// WPOS.w here is really 1/w
const float w = 1.0f / mach->Inputs[0].xyzw[3].f[i];
+ assert(mach->Inputs[0].xyzw[3].f[i] != 0.0);
mach->Inputs[attrib].xyzw[chan].f[i] =
(mach->InterpCoefs[attrib].a0[chan] +
diff --git a/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c b/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c
index 182a7eff05..2820706537 100644
--- a/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c
+++ b/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c
@@ -859,7 +859,7 @@ tgsi_mesa_compile_fp_program(
fulldecl = make_frag_input_decl(
1,
1 + count - 1,
- TGSI_INTERPOLATE_LINEAR,
+ TGSI_INTERPOLATE_PERSPECTIVE,
TGSI_WRITEMASK_XYZW );
ti += tgsi_build_full_declaration(
&fulldecl,