summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-07-25 14:27:38 -0600
committerBrian <[email protected]>2007-07-25 14:27:38 -0600
commitbe8725321ccbc4ca5f52afc9a3e257c91f43a119 (patch)
tree854692f3706f31765aae96ccef0dc44aa87e1c16 /src
parentd24e60a6b10ab3cb365e9c8f9dc0b36864bd485d (diff)
Fix pinterp() to compute 1 / FRAG_ATTRIB_WPOS.w Update comments too.
Diffstat (limited to 'src')
-rw-r--r--src/mesa/pipe/softpipe/sp_quad_fs.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/mesa/pipe/softpipe/sp_quad_fs.c b/src/mesa/pipe/softpipe/sp_quad_fs.c
index 526992408aa..9b0b5b91e5a 100644
--- a/src/mesa/pipe/softpipe/sp_quad_fs.c
+++ b/src/mesa/pipe/softpipe/sp_quad_fs.c
@@ -91,11 +91,11 @@ static INLINE void linterp( struct exec_machine *exec,
*
* Push into the fp:
*
- * INPUT[attr] = MAD COEF_A0[attr], COEF_DADX[attr], INPUT_WPOS.xxxx
- * INPUT[attr] = MAD INPUT[attr], COEF_DADY[attr], INPUT_WPOS.yyyy
- * INPUT[attr] = MUL INPUT[attr], INPUT_WPOS.wwww
+ * INPUT[attr] = MAD COEF_DADX[attr], INPUT_WPOS.xxxx, COEF_A0[attr]
+ * INPUT[attr] = MAD COEF_DADY[attr], INPUT_WPOS.yyyy, INPUT[attr]
+ * TMP = RCP INPUT_WPOS.w
+ * INPUT[attr] = MUL INPUT[attr], TMP.xxxx
*
- * (Or should that be 1/w ???)
*/
static INLINE void pinterp( struct exec_machine *exec,
GLuint attrib,
@@ -106,10 +106,11 @@ static INLINE void pinterp( struct exec_machine *exec,
for (j = 0; j < QUAD_SIZE; j++) {
const GLfloat x = exec->attr[FRAG_ATTRIB_WPOS][0][j];
const GLfloat y = exec->attr[FRAG_ATTRIB_WPOS][1][j];
- const GLfloat invW = exec->attr[FRAG_ATTRIB_WPOS][3][j];
+ /* FRAG_ATTRIB_WPOS.w here is really 1/w */
+ const GLfloat w = 1.0 / exec->attr[FRAG_ATTRIB_WPOS][3][j];
exec->attr[attrib][i][j] = ((exec->coef[attrib].a0[i] +
exec->coef[attrib].dadx[i] * x +
- exec->coef[attrib].dady[i] * y) * invW);
+ exec->coef[attrib].dady[i] * y) * w);
}
}