From be8725321ccbc4ca5f52afc9a3e257c91f43a119 Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 25 Jul 2007 14:27:38 -0600 Subject: [PATCH] Fix pinterp() to compute 1 / FRAG_ATTRIB_WPOS.w Update comments too. --- src/mesa/pipe/softpipe/sp_quad_fs.c | 13 +++++++------ 1 file 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 5269924..9b0b5b9 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); } } -- 2.7.4