Mesa (master): r600: update num of interp if posizition is used

Cooper Yuan cooperyuan at kemper.freedesktop.org
Tue Aug 11 06:36:38 UTC 2009


Module: Mesa
Branch: master
Commit: 2ccd66d8a049fc183a3598adf01ac5cc7fa5a92e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=2ccd66d8a049fc183a3598adf01ac5cc7fa5a92e

Author: Cooper Yuan <cooperyuan at gmail.com>
Date:   Tue Aug 11 14:36:01 2009 +0800

r600: update num of interp if posizition is used

---

 src/mesa/drivers/dri/r600/r700_fragprog.c |   18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/src/mesa/drivers/dri/r600/r700_fragprog.c b/src/mesa/drivers/dri/r600/r700_fragprog.c
index c914f75..efeea90 100644
--- a/src/mesa/drivers/dri/r600/r700_fragprog.c
+++ b/src/mesa/drivers/dri/r600/r700_fragprog.c
@@ -310,6 +310,16 @@ GLboolean r700SetupFragmentProgram(GLcontext * ctx)
 
     ui = (r700->SPI_PS_IN_CONTROL_0.u32All & NUM_INTERP_mask) / (1 << NUM_INTERP_shift);
 
+    /* PS uses fragment.position */
+    if (mesa_fp->Base.InputsRead & (1 << FRAG_ATTRIB_WPOS))
+    {
+        ui += 1;
+        SETfield(r700->SPI_PS_IN_CONTROL_0.u32All, ui, NUM_INTERP_shift, NUM_INTERP_mask);
+        SETfield(r700->SPI_PS_IN_CONTROL_0.u32All, CENTERS_ONLY, BARYC_SAMPLE_CNTL_shift, BARYC_SAMPLE_CNTL_mask);
+        SETbit(r700->SPI_PS_IN_CONTROL_0.u32All, POSITION_ENA_bit);
+        SETbit(r700->SPI_INPUT_Z.u32All, PROVIDE_Z_TO_SPI_bit);
+    }
+
     ui = (unNumOfReg < ui) ? ui : unNumOfReg;
 
     SETfield(r700->ps.SQ_PGM_RESOURCES_PS.u32All, ui, NUM_GPRS_shift, NUM_GPRS_mask); 
@@ -343,14 +353,6 @@ GLboolean r700SetupFragmentProgram(GLcontext * ctx)
         CLEARbit(r700->DB_SHADER_CONTROL.u32All, Z_EXPORT_ENABLE_bit);
     }
 
-    /* PS uses fragment.position */
-    if (mesa_fp->Base.InputsRead & (1 << FRAG_ATTRIB_WPOS))
-    {
-	SETbit(r700->SPI_PS_IN_CONTROL_0.u32All, POSITION_ENA_bit);
-	SETfield(r700->SPI_PS_IN_CONTROL_0.u32All, CENTERS_ONLY, BARYC_SAMPLE_CNTL_shift, BARYC_SAMPLE_CNTL_mask);
-	SETbit(r700->SPI_INPUT_Z.u32All, PROVIDE_Z_TO_SPI_bit);	
-    }
-
     /* sent out shader constants. */
     paramList = fp->mesa_program.Base.Parameters;
 




More information about the mesa-commit mailing list