From: Brian Date: Wed, 25 Jul 2007 20:27:38 +0000 (-0600) Subject: Fix pinterp() to compute 1 / FRAG_ATTRIB_WPOS.w Update comments too. X-Git-Tag: 062012170305~17580^2~390^2~4660 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=be8725321ccbc4ca5f52afc9a3e257c91f43a119;p=profile%2Fivi%2Fmesa.git Fix pinterp() to compute 1 / FRAG_ATTRIB_WPOS.w Update comments too. --- 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); } }