i915: Drop use of _ReallyEnabled.
authorEric Anholt <eric@anholt.net>
Thu, 24 Apr 2014 00:19:41 +0000 (17:19 -0700)
committerEric Anholt <eric@anholt.net>
Wed, 30 Apr 2014 21:33:20 +0000 (14:33 -0700)
We can just look at _Current's target.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i915/i830_texstate.c
src/mesa/drivers/dri/i915/i915_texstate.c

index 7209655c167292174ee80f539444639e9837332b..58d3356d6e427d7c16601165346e39c2282b2de5 100644 (file)
@@ -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;
+         }
       }
    }
 
index 70530e5b3b678162fd1d7b24ad0fba9019dbb492..000ab6eb7f35a270f9286e8667e77420c94a76c4 100644 (file)
@@ -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;
+         }
       }
    }