From: Brian Date: Thu, 13 Dec 2007 16:05:15 +0000 (-0700) Subject: Add QuadX,Y fields to tgsi_exec_machine to pass quad's position to tgsi interpreter. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=81c9058ea90615cd0c819da6e51c3a539a540a7e;p=mesa.git Add QuadX,Y fields to tgsi_exec_machine to pass quad's position to tgsi interpreter. The tgsi linear/perspective attribute code now uses these values rather than input[0]. Need to update SSE path to take quad x,y as function params. Then, we can remove additional code. --- diff --git a/src/mesa/pipe/softpipe/sp_quad_fs.c b/src/mesa/pipe/softpipe/sp_quad_fs.c index 251b47341a2..da590b256aa 100644 --- a/src/mesa/pipe/softpipe/sp_quad_fs.c +++ b/src/mesa/pipe/softpipe/sp_quad_fs.c @@ -100,6 +100,7 @@ shade_quad( machine->InterpCoefs = quad->coef; +#if 1 /* XXX only do this if the fp really reads fragment.position */ machine->Inputs[0].xyzw[0].f[0] = fx; machine->Inputs[0].xyzw[0].f[1] = fx + 1.0f; machine->Inputs[0].xyzw[0].f[2] = fx; @@ -113,6 +114,10 @@ shade_quad( machine->Inputs[0].xyzw[1].f[1] = fy; machine->Inputs[0].xyzw[1].f[2] = fy + 1.0f; machine->Inputs[0].xyzw[1].f[3] = fy + 1.0f; +#endif + + machine->QuadX = quad->x0; + machine->QuadY = quad->y0; /* run shader */ #if defined(__i386__) || defined(__386__) @@ -123,7 +128,11 @@ shade_quad( machine->Outputs, machine->Consts, machine->Temps, - machine->InterpCoefs ); + machine->InterpCoefs +#if 0 + ,quad->x0, quad->y0 +#endif + ); quad->mask &= ~(machine->Temps[TGSI_EXEC_TEMP_KILMASK_I].xyzw[TGSI_EXEC_TEMP_KILMASK_C].u[0]); } else diff --git a/src/mesa/pipe/tgsi/exec/tgsi_exec.c b/src/mesa/pipe/tgsi/exec/tgsi_exec.c index 8636271a346..03997f90996 100644 --- a/src/mesa/pipe/tgsi/exec/tgsi_exec.c +++ b/src/mesa/pipe/tgsi/exec/tgsi_exec.c @@ -1352,8 +1352,7 @@ linear_interpolation( unsigned attrib, unsigned chan ) { - const float x = mach->Inputs[0].xyzw[0].f[0]; - const float y = mach->Inputs[0].xyzw[1].f[0]; + const float x = mach->QuadX, y = mach->QuadY; const float dadx = mach->InterpCoefs[attrib].dadx[chan]; const float dady = mach->InterpCoefs[attrib].dady[chan]; const float a0 = mach->InterpCoefs[attrib].a0[chan] + dadx * x + dady * y; @@ -1369,8 +1368,7 @@ perspective_interpolation( unsigned attrib, unsigned chan ) { - const float x = mach->Inputs[0].xyzw[0].f[0]; - const float y = mach->Inputs[0].xyzw[1].f[0]; + const float x = mach->QuadX, y = mach->QuadY; const float dadx = mach->InterpCoefs[attrib].dadx[chan]; const float dady = mach->InterpCoefs[attrib].dady[chan]; const float a0 = mach->InterpCoefs[attrib].a0[chan] + dadx * x + dady * y; diff --git a/src/mesa/pipe/tgsi/exec/tgsi_exec.h b/src/mesa/pipe/tgsi/exec/tgsi_exec.h index e7952a08e3a..8d166bb5f42 100644 --- a/src/mesa/pipe/tgsi/exec/tgsi_exec.h +++ b/src/mesa/pipe/tgsi/exec/tgsi_exec.h @@ -170,6 +170,7 @@ struct tgsi_exec_machine struct tgsi_exec_vector *Inputs; struct tgsi_exec_vector *Outputs; const struct tgsi_token *Tokens; + float QuadX, QuadY; /**< for frag progs only */ unsigned Processor; /* GEOMETRY processor only. */