From 07b94c99a73481d08b285474db22106de1ca89fd Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 23 Apr 2014 17:19:41 -0700 Subject: [PATCH] i915: Drop use of _ReallyEnabled. We can just look at _Current's target. Reviewed-by: Matt Turner Reviewed-by: Kenneth Graunke --- 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 7209655c167..58d3356d6e4 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 70530e5b3b6..000ab6eb7f3 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; + } } } -- 2.30.2