diff options
Diffstat (limited to 'src/mesa/drivers/dri/i915')
-rw-r--r-- | src/mesa/drivers/dri/i915/i830_texstate.c | 26 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i915/i915_texstate.c | 40 |
2 files changed, 35 insertions, 31 deletions
diff --git a/src/mesa/drivers/dri/i915/i830_texstate.c b/src/mesa/drivers/dri/i915/i830_texstate.c index 7554bd5e7b9..3298dbb69f5 100644 --- a/src/mesa/drivers/dri/i915/i830_texstate.c +++ b/src/mesa/drivers/dri/i915/i830_texstate.c @@ -29,6 +29,7 @@ #include "main/enums.h" #include "main/colormac.h" #include "main/macros.h" +#include "main/samplerobj.h" #include "intel_mipmap_tree.h" #include "intel_tex.h" @@ -120,6 +121,7 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) struct gl_texture_object *tObj = tUnit->_Current; struct intel_texture_object *intelObj = intel_texture_object(tObj); struct gl_texture_image *firstImage; + struct gl_sampler_object *sampler = _mesa_get_samplerobj(ctx, unit); GLuint *state = i830->state.Tex[unit], format, pitch; GLint lodbias; GLubyte border[4]; @@ -193,7 +195,7 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) float maxlod; uint32_t minlod_fixed, maxlod_fixed; - switch (tObj->Sampler.MinFilter) { + switch (sampler->MinFilter) { case GL_NEAREST: minFilt = FILTER_NEAREST; mipFilt = MIPFILTER_NONE; @@ -222,12 +224,12 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) return GL_FALSE; } - if (tObj->Sampler.MaxAnisotropy > 1.0) { + if (sampler->MaxAnisotropy > 1.0) { minFilt = FILTER_ANISOTROPIC; magFilt = FILTER_ANISOTROPIC; } else { - switch (tObj->Sampler.MagFilter) { + switch (sampler->MagFilter) { case GL_NEAREST: magFilt = FILTER_NEAREST; break; @@ -239,7 +241,7 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) } } - lodbias = (int) ((tUnit->LodBias + tObj->Sampler.LodBias) * 16.0); + lodbias = (int) ((tUnit->LodBias + sampler->LodBias) * 16.0); if (lodbias < -64) lodbias = -64; if (lodbias > 63) @@ -259,8 +261,8 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) * addressable (smallest resolution) LOD. Use it to cover both * MAX_LEVEL and MAX_LOD. */ - minlod_fixed = U_FIXED(CLAMP(tObj->Sampler.MinLod, 0.0, 11), 4); - maxlod = MIN2(tObj->Sampler.MaxLod, tObj->_MaxLevel - tObj->BaseLevel); + minlod_fixed = U_FIXED(CLAMP(sampler->MinLod, 0.0, 11), 4); + maxlod = MIN2(sampler->MaxLod, tObj->_MaxLevel - tObj->BaseLevel); if (intel->intelScreen->deviceID == PCI_CHIP_I855_GM || intel->intelScreen->deviceID == PCI_CHIP_I865_G) { maxlod_fixed = U_FIXED(CLAMP(maxlod, 0.0, 11.75), 2); @@ -279,8 +281,8 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) } { - GLenum ws = tObj->Sampler.WrapS; - GLenum wt = tObj->Sampler.WrapT; + GLenum ws = sampler->WrapS; + GLenum wt = sampler->WrapT; /* 3D textures not available on i830 @@ -300,10 +302,10 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) } /* convert border color from float to ubyte */ - CLAMPED_FLOAT_TO_UBYTE(border[0], tObj->Sampler.BorderColor.f[0]); - CLAMPED_FLOAT_TO_UBYTE(border[1], tObj->Sampler.BorderColor.f[1]); - CLAMPED_FLOAT_TO_UBYTE(border[2], tObj->Sampler.BorderColor.f[2]); - CLAMPED_FLOAT_TO_UBYTE(border[3], tObj->Sampler.BorderColor.f[3]); + CLAMPED_FLOAT_TO_UBYTE(border[0], sampler->BorderColor.f[0]); + CLAMPED_FLOAT_TO_UBYTE(border[1], sampler->BorderColor.f[1]); + CLAMPED_FLOAT_TO_UBYTE(border[2], sampler->BorderColor.f[2]); + CLAMPED_FLOAT_TO_UBYTE(border[3], sampler->BorderColor.f[3]); state[I830_TEXREG_TM0S4] = PACK_COLOR_8888(border[3], border[0], diff --git a/src/mesa/drivers/dri/i915/i915_texstate.c b/src/mesa/drivers/dri/i915/i915_texstate.c index 742bb994adb..5aa2ea18048 100644 --- a/src/mesa/drivers/dri/i915/i915_texstate.c +++ b/src/mesa/drivers/dri/i915/i915_texstate.c @@ -29,6 +29,7 @@ #include "main/enums.h" #include "main/macros.h" #include "main/colormac.h" +#include "main/samplerobj.h" #include "intel_mipmap_tree.h" #include "intel_tex.h" @@ -136,6 +137,7 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) struct gl_texture_object *tObj = tUnit->_Current; struct intel_texture_object *intelObj = intel_texture_object(tObj); struct gl_texture_image *firstImage; + struct gl_sampler_object *sampler = _mesa_get_samplerobj(ctx, unit); GLuint *state = i915->state.Tex[unit], format, pitch; GLint lodbias, aniso = 0; GLubyte border[4]; @@ -164,7 +166,7 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) format = translate_texture_format(firstImage->TexFormat, firstImage->InternalFormat, - tObj->Sampler.DepthMode); + sampler->DepthMode); pitch = intelObj->mt->region->pitch * intelObj->mt->cpp; state[I915_TEXREG_MS3] = @@ -181,7 +183,7 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) * (lowest resolution) LOD. Use it to cover both MAX_LEVEL and * MAX_LOD. */ - maxlod = MIN2(tObj->Sampler.MaxLod, tObj->_MaxLevel - tObj->BaseLevel); + maxlod = MIN2(sampler->MaxLod, tObj->_MaxLevel - tObj->BaseLevel); state[I915_TEXREG_MS4] = ((((pitch / 4) - 1) << MS4_PITCH_SHIFT) | MS4_CUBE_FACE_ENA_MASK | @@ -192,7 +194,7 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) { GLuint minFilt, mipFilt, magFilt; - switch (tObj->Sampler.MinFilter) { + switch (sampler->MinFilter) { case GL_NEAREST: minFilt = FILTER_NEAREST; mipFilt = MIPFILTER_NONE; @@ -221,16 +223,16 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) return GL_FALSE; } - if (tObj->Sampler.MaxAnisotropy > 1.0) { + if (sampler->MaxAnisotropy > 1.0) { minFilt = FILTER_ANISOTROPIC; magFilt = FILTER_ANISOTROPIC; - if (tObj->Sampler.MaxAnisotropy > 2.0) + if (sampler->MaxAnisotropy > 2.0) aniso = SS2_MAX_ANISO_4; else aniso = SS2_MAX_ANISO_2; } else { - switch (tObj->Sampler.MagFilter) { + switch (sampler->MagFilter) { case GL_NEAREST: magFilt = FILTER_NEAREST; break; @@ -242,7 +244,7 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) } } - lodbias = (int) ((tUnit->LodBias + tObj->Sampler.LodBias) * 16.0); + lodbias = (int) ((tUnit->LodBias + sampler->LodBias) * 16.0); if (lodbias < -256) lodbias = -256; if (lodbias > 255) @@ -258,14 +260,14 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) /* Shadow: */ - if (tObj->Sampler.CompareMode == GL_COMPARE_R_TO_TEXTURE_ARB && + if (sampler->CompareMode == GL_COMPARE_R_TO_TEXTURE_ARB && tObj->Target != GL_TEXTURE_3D) { if (tObj->Target == GL_TEXTURE_1D) return GL_FALSE; state[I915_TEXREG_SS2] |= (SS2_SHADOW_ENABLE | - intel_translate_shadow_compare_func(tObj->Sampler.CompareFunc)); + intel_translate_shadow_compare_func(sampler->CompareFunc)); minFilt = FILTER_4X4_FLAT; magFilt = FILTER_4X4_FLAT; @@ -278,9 +280,9 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) } { - GLenum ws = tObj->Sampler.WrapS; - GLenum wt = tObj->Sampler.WrapT; - GLenum wr = tObj->Sampler.WrapR; + GLenum ws = sampler->WrapS; + GLenum wt = sampler->WrapT; + GLenum wr = sampler->WrapR; float minlod; /* We program 1D textures as 2D textures, so the 2D texcoord could @@ -298,8 +300,8 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) * clamp_to_border. */ if (tObj->Target == GL_TEXTURE_3D && - (tObj->Sampler.MinFilter != GL_NEAREST || - tObj->Sampler.MagFilter != GL_NEAREST) && + (sampler->MinFilter != GL_NEAREST || + sampler->MagFilter != GL_NEAREST) && (ws == GL_CLAMP || wt == GL_CLAMP || wr == GL_CLAMP || @@ -322,7 +324,7 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) (translate_wrap_mode(wt) << SS3_TCY_ADDR_MODE_SHIFT) | (translate_wrap_mode(wr) << SS3_TCZ_ADDR_MODE_SHIFT)); - minlod = MIN2(tObj->Sampler.MinLod, tObj->_MaxLevel - tObj->BaseLevel); + minlod = MIN2(sampler->MinLod, tObj->_MaxLevel - tObj->BaseLevel); state[I915_TEXREG_SS3] |= (unit << SS3_TEXTUREMAP_INDEX_SHIFT); state[I915_TEXREG_SS3] |= (U_FIXED(CLAMP(minlod, 0.0, 11.0), 4) << SS3_MIN_LOD_SHIFT); @@ -330,10 +332,10 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) } /* convert border color from float to ubyte */ - CLAMPED_FLOAT_TO_UBYTE(border[0], tObj->Sampler.BorderColor.f[0]); - CLAMPED_FLOAT_TO_UBYTE(border[1], tObj->Sampler.BorderColor.f[1]); - CLAMPED_FLOAT_TO_UBYTE(border[2], tObj->Sampler.BorderColor.f[2]); - CLAMPED_FLOAT_TO_UBYTE(border[3], tObj->Sampler.BorderColor.f[3]); + CLAMPED_FLOAT_TO_UBYTE(border[0], sampler->BorderColor.f[0]); + CLAMPED_FLOAT_TO_UBYTE(border[1], sampler->BorderColor.f[1]); + CLAMPED_FLOAT_TO_UBYTE(border[2], sampler->BorderColor.f[2]); + CLAMPED_FLOAT_TO_UBYTE(border[3], sampler->BorderColor.f[3]); if (firstImage->_BaseFormat == GL_DEPTH_COMPONENT) { /* GL specs that border color for depth textures is taken from the |