[Mesa-dev] [PATCH 07/14] i915: Drop use of _ReallyEnabled.

Eric Anholt eric at anholt.net
Thu Apr 24 17:50:14 PDT 2014


We can just look at _Current's target.
---
 src/mesa/drivers/dri/i915/i830_texstate.c | 44 +++++++++++++++---------------
 src/mesa/drivers/dri/i915/i915_texstate.c | 45 +++++++++++++++----------------
 2 files changed, 44 insertions(+), 45 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/i830_texstate.c b/src/mesa/drivers/dri/i915/i830_texstate.c
index 7209655..58d3356 100644
--- a/src/mesa/drivers/dri/i915/i830_texstate.c
+++ b/src/mesa/drivers/dri/i915/i830_texstate.c
@@ -331,30 +331,30 @@ i830UpdateTextureState(struct intel_context *intel)
    GLuint i;
 
    for (i = 0; i < I830_TEX_UNITS && ok; i++) {
-      switch (intel->ctx.Texture.Unit[i]._ReallyEnabled) {
-      case TEXTURE_1D_BIT:
-      case TEXTURE_2D_BIT:
-      case TEXTURE_CUBE_BIT:
-         ok = i830_update_tex_unit(intel, i, TEXCOORDS_ARE_NORMAL);
-         break;
-      case TEXTURE_RECT_BIT:
-         ok = i830_update_tex_unit(intel, i, TEXCOORDS_ARE_IN_TEXELUNITS);
-         break;
-      case 0:{
-	 struct i830_context *i830 = i830_context(&intel->ctx);
-         if (i830->state.active & I830_UPLOAD_TEX(i)) 
+      if (intel->ctx.Texture.Unit[i]._Current) {
+         switch (intel->ctx.Texture.Unit[i]._Current->Target) {
+         case GL_TEXTURE_1D:
+         case GL_TEXTURE_2D:
+         case GL_TEXTURE_CUBE_MAP:
+            ok = i830_update_tex_unit(intel, i, TEXCOORDS_ARE_NORMAL);
+            break;
+         case GL_TEXTURE_RECTANGLE:
+            ok = i830_update_tex_unit(intel, i, TEXCOORDS_ARE_IN_TEXELUNITS);
+            break;
+         case GL_TEXTURE_3D:
+         default:
+            ok = false;
+            break;
+         }
+      } else {
+         struct i830_context *i830 = i830_context(&intel->ctx);
+         if (i830->state.active & I830_UPLOAD_TEX(i))
             I830_ACTIVESTATE(i830, I830_UPLOAD_TEX(i), false);
 
-	 if (i830->state.tex_buffer[i] != NULL) {
-	    drm_intel_bo_unreference(i830->state.tex_buffer[i]);
-	    i830->state.tex_buffer[i] = NULL;
-	 }
-         break;
-      }
-      case TEXTURE_3D_BIT:
-      default:
-         ok = false;
-         break;
+         if (i830->state.tex_buffer[i] != NULL) {
+            drm_intel_bo_unreference(i830->state.tex_buffer[i]);
+            i830->state.tex_buffer[i] = NULL;
+         }
       }
    }
 
diff --git a/src/mesa/drivers/dri/i915/i915_texstate.c b/src/mesa/drivers/dri/i915/i915_texstate.c
index 70530e5..000ab6e 100644
--- a/src/mesa/drivers/dri/i915/i915_texstate.c
+++ b/src/mesa/drivers/dri/i915/i915_texstate.c
@@ -417,31 +417,30 @@ i915UpdateTextureState(struct intel_context *intel)
    GLuint i;
 
    for (i = 0; i < I915_TEX_UNITS && ok; i++) {
-      switch (intel->ctx.Texture.Unit[i]._ReallyEnabled) {
-      case TEXTURE_1D_BIT:
-      case TEXTURE_2D_BIT:
-      case TEXTURE_CUBE_BIT:
-      case TEXTURE_3D_BIT:
-         ok = i915_update_tex_unit(intel, i, SS3_NORMALIZED_COORDS);
-         break;
-      case TEXTURE_RECT_BIT:
-         ok = i915_update_tex_unit(intel, i, 0);
-         break;
-      case 0:{
-            struct i915_context *i915 = i915_context(&intel->ctx);
-            if (i915->state.active & I915_UPLOAD_TEX(i))
-               I915_ACTIVESTATE(i915, I915_UPLOAD_TEX(i), false);
-
-	    if (i915->state.tex_buffer[i] != NULL) {
-	       drm_intel_bo_unreference(i915->state.tex_buffer[i]);
-	       i915->state.tex_buffer[i] = NULL;
-	    }
-
+      if (intel->ctx.Texture.Unit[i]._Current) {
+         switch (intel->ctx.Texture.Unit[i]._Current->Target) {
+         case GL_TEXTURE_1D:
+         case GL_TEXTURE_2D:
+         case GL_TEXTURE_CUBE_MAP:
+         case GL_TEXTURE_3D:
+            ok = i915_update_tex_unit(intel, i, SS3_NORMALIZED_COORDS);
+            break;
+         case GL_TEXTURE_RECTANGLE:
+            ok = i915_update_tex_unit(intel, i, 0);
+            break;
+         default:
+            ok = false;
             break;
          }
-      default:
-         ok = false;
-         break;
+      } else {
+         struct i915_context *i915 = i915_context(&intel->ctx);
+         if (i915->state.active & I915_UPLOAD_TEX(i))
+            I915_ACTIVESTATE(i915, I915_UPLOAD_TEX(i), false);
+
+         if (i915->state.tex_buffer[i] != NULL) {
+            drm_intel_bo_unreference(i915->state.tex_buffer[i]);
+            i915->state.tex_buffer[i] = NULL;
+         }
       }
    }
 
-- 
1.9.2



More information about the mesa-dev mailing list