[PATCH] i915: set SPRITE_POINT_ENABLE bit just when we need do coord replace

Yuanhan Liu yuanhan.liu at linux.intel.com
Thu Mar 8 02:48:54 PST 2012


When SPRITE_POINT_ENABLE bit is set, the texture coord would be
replaced, and this is only needed when we called something like
glTexEnvi(GL_POINT_SPRITE, GL_COORD_REPLACE, GL_TRUE).

Since we currently handling varying inputs as tex coord, we would be
careful when setting this bit and set it just when needed, or you will
find the value of varying input is not right and changed.

With handling the bit setup at i915ValidateFragmentProgram, we don't
need the code at i915Enable then.

This patch would _really_ fix the webglc point-size.html test case and
of course, not regress piglit point-sprite and glean-pointSprite testcase.

NOTE: This is a candidate for stable release branches.

Signed-off-by: Yuanhan Liu <yuanhan.liu at linux.intel.com>
---
 src/mesa/drivers/dri/i915/i915_fragprog.c |    5 +++++
 src/mesa/drivers/dri/i915/i915_state.c    |   13 +------------
 2 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/i915_fragprog.c b/src/mesa/drivers/dri/i915/i915_fragprog.c
index 5b7e93e..8829e8d 100644
--- a/src/mesa/drivers/dri/i915/i915_fragprog.c
+++ b/src/mesa/drivers/dri/i915/i915_fragprog.c
@@ -1379,7 +1379,12 @@ i915ValidateFragmentProgram(struct i915_context *i915)
       EMIT_ATTR(_TNL_ATTRIB_FOG, EMIT_1F, S4_VFMT_FOG_PARAM, 4);
    }
 
+   s4 &= ~S4_SPRITE_POINT_ENABLE;
    for (i = 0; i < p->ctx->Const.MaxTextureCoordUnits; i++) {
+      /* Do set SPRITE_POINT_ENABLE bit when we need do coord replace */
+      if (ctx->Point.CoordReplace[i] && ctx->Point.PointSprite)
+         s4 |= S4_SPRITE_POINT_ENABLE;
+
       if (inputsRead & FRAG_BIT_TEX(i)) {
          int sz = VB->AttribPtr[_TNL_ATTRIB_TEX0 + i]->size;
 
diff --git a/src/mesa/drivers/dri/i915/i915_state.c b/src/mesa/drivers/dri/i915/i915_state.c
index 756001f..9904123 100644
--- a/src/mesa/drivers/dri/i915/i915_state.c
+++ b/src/mesa/drivers/dri/i915/i915_state.c
@@ -869,18 +869,7 @@ i915Enable(struct gl_context * ctx, GLenum cap, GLboolean state)
       break;
 
    case GL_POINT_SPRITE:
-      /* This state change is handled in i915_reduced_primitive_state because
-       * the hardware bit should only be set when rendering points.
-       */
-	 dw = i915->state.Ctx[I915_CTXREG_LIS4];
-      if (state)
-	 dw |= S4_SPRITE_POINT_ENABLE;
-      else
-	 dw &= ~S4_SPRITE_POINT_ENABLE;
-      if (dw != i915->state.Ctx[I915_CTXREG_LIS4]) {
-	 i915->state.Ctx[I915_CTXREG_LIS4] = dw;
-	 I915_STATECHANGE(i915, I915_UPLOAD_CTX);
-      }
+      /* Handle it at i915ValidateFragmentProgram */
       break;
 
    case GL_POINT_SMOOTH:
-- 
1.7.7




More information about the mesa-dev mailing list