From ecfaab88b2577bd0395bc05d75a036126806a9c4 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 10 Apr 2011 12:44:46 -0600 Subject: [PATCH] mesa: move sampler state into new gl_sampler_object type gl_texture_object contains an instance of this type for the regular texture object sampling state. glGenSamplers() generates new instances of gl_sampler_object which can override that state with glBindSampler(). --- src/mesa/drivers/common/meta.c | 18 +- src/mesa/drivers/dri/common/texmem.c | 7 +- src/mesa/drivers/dri/i810/i810tex.c | 12 +- src/mesa/drivers/dri/i915/i830_texstate.c | 24 +- src/mesa/drivers/dri/i915/i915_texstate.c | 38 +-- src/mesa/drivers/dri/i965/brw_draw.c | 12 +- src/mesa/drivers/dri/i965/brw_wm.c | 8 +- .../drivers/dri/i965/brw_wm_sampler_state.c | 34 +-- .../drivers/dri/i965/brw_wm_surface_state.c | 5 +- src/mesa/drivers/dri/intel/intel_tex_image.c | 4 +- .../drivers/dri/intel/intel_tex_validate.c | 2 +- src/mesa/drivers/dri/mach64/mach64_tex.c | 12 +- src/mesa/drivers/dri/mga/mgatex.c | 12 +- .../drivers/dri/nouveau/nouveau_texture.c | 4 +- src/mesa/drivers/dri/nouveau/nv04_state_tex.c | 12 +- src/mesa/drivers/dri/nouveau/nv10_state_tex.c | 12 +- src/mesa/drivers/dri/nouveau/nv20_state_tex.c | 14 +- src/mesa/drivers/dri/r128/r128_tex.c | 12 +- src/mesa/drivers/dri/r200/r200_tex.c | 18 +- .../drivers/dri/r300/r300_fragprog_common.c | 4 +- src/mesa/drivers/dri/r300/r300_state.c | 4 +- src/mesa/drivers/dri/r300/r300_tex.c | 18 +- src/mesa/drivers/dri/r300/r300_texstate.c | 2 +- src/mesa/drivers/dri/r600/evergreen_tex.c | 16 +- src/mesa/drivers/dri/r600/r600_tex.c | 16 +- src/mesa/drivers/dri/r600/r700_chip.c | 4 +- .../drivers/dri/radeon/radeon_mipmap_tree.c | 6 +- src/mesa/drivers/dri/radeon/radeon_tex.c | 18 +- src/mesa/drivers/dri/savage/savagerender.c | 12 +- src/mesa/drivers/dri/savage/savagetex.c | 12 +- src/mesa/drivers/dri/sis/sis_texstate.c | 22 +- src/mesa/drivers/dri/tdfx/tdfx_tex.c | 8 +- src/mesa/drivers/dri/unichrome/via_state.c | 32 +-- src/mesa/drivers/dri/unichrome/via_tex.c | 6 +- src/mesa/main/attrib.c | 25 +- src/mesa/main/ff_fragment_shader.cpp | 7 +- src/mesa/main/mtypes.h | 60 +++-- src/mesa/main/texfetch.c | 2 +- src/mesa/main/texobj.c | 90 ++++--- src/mesa/main/texparam.c | 160 +++++------ src/mesa/main/texstate.c | 8 +- src/mesa/program/prog_statevars.c | 2 +- src/mesa/state_tracker/st_atom_sampler.c | 31 ++- src/mesa/state_tracker/st_atom_texture.c | 18 +- src/mesa/state_tracker/st_cb_texture.c | 12 +- src/mesa/state_tracker/st_texture.h | 15 ++ src/mesa/swrast/s_fragprog.c | 6 +- src/mesa/swrast/s_span.c | 2 +- src/mesa/swrast/s_texcombine.c | 22 +- src/mesa/swrast/s_texfilter.c | 255 +++++++++--------- src/mesa/swrast/s_triangle.c | 12 +- 51 files changed, 620 insertions(+), 547 deletions(-) diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 2b00e8979d2..c92bf29c30f 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -1124,12 +1124,12 @@ blitframebuffer_texture(struct gl_context *ctx, if (readAtt && readAtt->Texture) { const struct gl_texture_object *texObj = readAtt->Texture; const GLuint srcLevel = readAtt->TextureLevel; - const GLenum minFilterSave = texObj->MinFilter; - const GLenum magFilterSave = texObj->MagFilter; + const GLenum minFilterSave = texObj->Sampler.MinFilter; + const GLenum magFilterSave = texObj->Sampler.MagFilter; const GLint baseLevelSave = texObj->BaseLevel; const GLint maxLevelSave = texObj->MaxLevel; - const GLenum wrapSSave = texObj->WrapS; - const GLenum wrapTSave = texObj->WrapT; + const GLenum wrapSSave = texObj->Sampler.WrapS; + const GLenum wrapTSave = texObj->Sampler.WrapT; const GLenum target = texObj->Target; if (drawAtt->Texture == readAtt->Texture) { @@ -2259,13 +2259,13 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target, struct vertex verts[4]; const GLuint baseLevel = texObj->BaseLevel; const GLuint maxLevel = texObj->MaxLevel; - const GLenum minFilterSave = texObj->MinFilter; - const GLenum magFilterSave = texObj->MagFilter; + const GLenum minFilterSave = texObj->Sampler.MinFilter; + const GLenum magFilterSave = texObj->Sampler.MagFilter; const GLint maxLevelSave = texObj->MaxLevel; const GLboolean genMipmapSave = texObj->GenerateMipmap; - const GLenum wrapSSave = texObj->WrapS; - const GLenum wrapTSave = texObj->WrapT; - const GLenum wrapRSave = texObj->WrapR; + const GLenum wrapSSave = texObj->Sampler.WrapS; + const GLenum wrapTSave = texObj->Sampler.WrapT; + const GLenum wrapRSave = texObj->Sampler.WrapR; const GLuint fboSave = ctx->DrawBuffer->Name; const GLuint original_active_unit = ctx->Texture.CurrentUnit; GLenum faceTarget; diff --git a/src/mesa/drivers/dri/common/texmem.c b/src/mesa/drivers/dri/common/texmem.c index 8eec07d5bcc..e927cf0addd 100644 --- a/src/mesa/drivers/dri/common/texmem.c +++ b/src/mesa/drivers/dri/common/texmem.c @@ -1264,17 +1264,18 @@ driCalculateTextureFirstLastLevel( driTextureObject * t ) case GL_TEXTURE_2D: case GL_TEXTURE_3D: case GL_TEXTURE_CUBE_MAP: - if (tObj->MinFilter == GL_NEAREST || tObj->MinFilter == GL_LINEAR) { + if (tObj->Sampler.MinFilter == GL_NEAREST || + tObj->Sampler.MinFilter == GL_LINEAR) { /* GL_NEAREST and GL_LINEAR only care about GL_TEXTURE_BASE_LEVEL. */ firstLevel = lastLevel = tObj->BaseLevel; } else { - firstLevel = tObj->BaseLevel + (GLint)(tObj->MinLod + 0.5); + firstLevel = tObj->BaseLevel + (GLint)(tObj->Sampler.MinLod + 0.5); firstLevel = MAX2(firstLevel, tObj->BaseLevel); firstLevel = MIN2(firstLevel, tObj->BaseLevel + baseImage->MaxLog2); - lastLevel = tObj->BaseLevel + (GLint)(tObj->MaxLod + 0.5); + lastLevel = tObj->BaseLevel + (GLint)(tObj->Sampler.MaxLod + 0.5); lastLevel = MAX2(lastLevel, t->tObj->BaseLevel); lastLevel = MIN2(lastLevel, t->tObj->BaseLevel + baseImage->MaxLog2); lastLevel = MIN2(lastLevel, t->tObj->MaxLevel); diff --git a/src/mesa/drivers/dri/i810/i810tex.c b/src/mesa/drivers/dri/i810/i810tex.c index 49364aeb225..dba4ebaa5c7 100644 --- a/src/mesa/drivers/dri/i810/i810tex.c +++ b/src/mesa/drivers/dri/i810/i810tex.c @@ -204,10 +204,10 @@ i810AllocTexObj( struct gl_context *ctx, struct gl_texture_object *texObj ) make_empty_list( & t->base ); - i810SetTexWrapping( t, texObj->WrapS, texObj->WrapT ); + i810SetTexWrapping( t, texObj->Sampler.WrapS, texObj->Sampler.WrapT ); /*i830SetTexMaxAnisotropy( t, texObj->MaxAnisotropy );*/ - i810SetTexFilter( imesa, t, texObj->MinFilter, texObj->MagFilter, bias ); - i810SetTexBorderColor( t, texObj->BorderColor.f ); + i810SetTexFilter( imesa, t, texObj->Sampler.MinFilter, texObj->Sampler.MagFilter, bias ); + i810SetTexBorderColor( t, texObj->Sampler.BorderColor.f ); } return t; @@ -238,17 +238,17 @@ static void i810TexParameter( struct gl_context *ctx, GLenum target, case GL_TEXTURE_MAG_FILTER: { GLfloat bias = ctx->Texture.Unit[ctx->Texture.CurrentUnit].LodBias; - i810SetTexFilter( imesa, t, tObj->MinFilter, tObj->MagFilter, bias ); + i810SetTexFilter( imesa, t, tObj->Sampler.MinFilter, tObj->Sampler.MagFilter, bias ); } break; case GL_TEXTURE_WRAP_S: case GL_TEXTURE_WRAP_T: - i810SetTexWrapping( t, tObj->WrapS, tObj->WrapT ); + i810SetTexWrapping( t, tObj->Sampler.WrapS, tObj->Sampler.WrapT ); break; case GL_TEXTURE_BORDER_COLOR: - i810SetTexBorderColor( t, tObj->BorderColor.f ); + i810SetTexBorderColor( t, tObj->Sampler.BorderColor.f ); break; case GL_TEXTURE_BASE_LEVEL: diff --git a/src/mesa/drivers/dri/i915/i830_texstate.c b/src/mesa/drivers/dri/i915/i830_texstate.c index c35b4b5ed06..7554bd5e7b9 100644 --- a/src/mesa/drivers/dri/i915/i830_texstate.c +++ b/src/mesa/drivers/dri/i915/i830_texstate.c @@ -193,7 +193,7 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) float maxlod; uint32_t minlod_fixed, maxlod_fixed; - switch (tObj->MinFilter) { + switch (tObj->Sampler.MinFilter) { case GL_NEAREST: minFilt = FILTER_NEAREST; mipFilt = MIPFILTER_NONE; @@ -222,12 +222,12 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) return GL_FALSE; } - if (tObj->MaxAnisotropy > 1.0) { + if (tObj->Sampler.MaxAnisotropy > 1.0) { minFilt = FILTER_ANISOTROPIC; magFilt = FILTER_ANISOTROPIC; } else { - switch (tObj->MagFilter) { + switch (tObj->Sampler.MagFilter) { case GL_NEAREST: magFilt = FILTER_NEAREST; break; @@ -239,7 +239,7 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) } } - lodbias = (int) ((tUnit->LodBias + tObj->LodBias) * 16.0); + lodbias = (int) ((tUnit->LodBias + tObj->Sampler.LodBias) * 16.0); if (lodbias < -64) lodbias = -64; if (lodbias > 63) @@ -259,8 +259,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->MinLod, 0.0, 11), 4); - maxlod = MIN2(tObj->MaxLod, tObj->_MaxLevel - tObj->BaseLevel); + minlod_fixed = U_FIXED(CLAMP(tObj->Sampler.MinLod, 0.0, 11), 4); + maxlod = MIN2(tObj->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 +279,8 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) } { - GLenum ws = tObj->WrapS; - GLenum wt = tObj->WrapT; + GLenum ws = tObj->Sampler.WrapS; + GLenum wt = tObj->Sampler.WrapT; /* 3D textures not available on i830 @@ -300,10 +300,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->BorderColor.f[0]); - CLAMPED_FLOAT_TO_UBYTE(border[1], tObj->BorderColor.f[1]); - CLAMPED_FLOAT_TO_UBYTE(border[2], tObj->BorderColor.f[2]); - CLAMPED_FLOAT_TO_UBYTE(border[3], tObj->BorderColor.f[3]); + 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]); 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 af140c85f50..742bb994adb 100644 --- a/src/mesa/drivers/dri/i915/i915_texstate.c +++ b/src/mesa/drivers/dri/i915/i915_texstate.c @@ -164,7 +164,7 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) format = translate_texture_format(firstImage->TexFormat, firstImage->InternalFormat, - tObj->DepthMode); + tObj->Sampler.DepthMode); pitch = intelObj->mt->region->pitch * intelObj->mt->cpp; state[I915_TEXREG_MS3] = @@ -181,7 +181,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->MaxLod, tObj->_MaxLevel - tObj->BaseLevel); + maxlod = MIN2(tObj->Sampler.MaxLod, tObj->_MaxLevel - tObj->BaseLevel); state[I915_TEXREG_MS4] = ((((pitch / 4) - 1) << MS4_PITCH_SHIFT) | MS4_CUBE_FACE_ENA_MASK | @@ -192,7 +192,7 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) { GLuint minFilt, mipFilt, magFilt; - switch (tObj->MinFilter) { + switch (tObj->Sampler.MinFilter) { case GL_NEAREST: minFilt = FILTER_NEAREST; mipFilt = MIPFILTER_NONE; @@ -221,16 +221,16 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) return GL_FALSE; } - if (tObj->MaxAnisotropy > 1.0) { + if (tObj->Sampler.MaxAnisotropy > 1.0) { minFilt = FILTER_ANISOTROPIC; magFilt = FILTER_ANISOTROPIC; - if (tObj->MaxAnisotropy > 2.0) + if (tObj->Sampler.MaxAnisotropy > 2.0) aniso = SS2_MAX_ANISO_4; else aniso = SS2_MAX_ANISO_2; } else { - switch (tObj->MagFilter) { + switch (tObj->Sampler.MagFilter) { case GL_NEAREST: magFilt = FILTER_NEAREST; break; @@ -242,7 +242,7 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) } } - lodbias = (int) ((tUnit->LodBias + tObj->LodBias) * 16.0); + lodbias = (int) ((tUnit->LodBias + tObj->Sampler.LodBias) * 16.0); if (lodbias < -256) lodbias = -256; if (lodbias > 255) @@ -258,14 +258,14 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) /* Shadow: */ - if (tObj->CompareMode == GL_COMPARE_R_TO_TEXTURE_ARB && + if (tObj->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->CompareFunc)); + intel_translate_shadow_compare_func(tObj->Sampler.CompareFunc)); minFilt = FILTER_4X4_FLAT; magFilt = FILTER_4X4_FLAT; @@ -278,9 +278,9 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) } { - GLenum ws = tObj->WrapS; - GLenum wt = tObj->WrapT; - GLenum wr = tObj->WrapR; + GLenum ws = tObj->Sampler.WrapS; + GLenum wt = tObj->Sampler.WrapT; + GLenum wr = tObj->Sampler.WrapR; float minlod; /* We program 1D textures as 2D textures, so the 2D texcoord could @@ -298,8 +298,8 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) * clamp_to_border. */ if (tObj->Target == GL_TEXTURE_3D && - (tObj->MinFilter != GL_NEAREST || - tObj->MagFilter != GL_NEAREST) && + (tObj->Sampler.MinFilter != GL_NEAREST || + tObj->Sampler.MagFilter != GL_NEAREST) && (ws == GL_CLAMP || wt == GL_CLAMP || wr == GL_CLAMP || @@ -322,7 +322,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->MinLod, tObj->_MaxLevel - tObj->BaseLevel); + minlod = MIN2(tObj->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 +330,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->BorderColor.f[0]); - CLAMPED_FLOAT_TO_UBYTE(border[1], tObj->BorderColor.f[1]); - CLAMPED_FLOAT_TO_UBYTE(border[2], tObj->BorderColor.f[2]); - CLAMPED_FLOAT_TO_UBYTE(border[3], tObj->BorderColor.f[3]); + 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]); if (firstImage->_BaseFormat == GL_DEPTH_COMPONENT) { /* GL specs that border color for depth textures is taken from the diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c index f5abe021c43..63ae28f8575 100644 --- a/src/mesa/drivers/dri/i965/brw_draw.c +++ b/src/mesa/drivers/dri/i965/brw_draw.c @@ -271,20 +271,20 @@ static GLboolean check_fallbacks( struct brw_context *brw, struct gl_texture_unit *texUnit = &ctx->Texture.Unit[u]; if (texUnit->Enabled) { if (texUnit->Enabled & TEXTURE_1D_BIT) { - if (texUnit->CurrentTex[TEXTURE_1D_INDEX]->WrapS == GL_CLAMP) { + if (texUnit->CurrentTex[TEXTURE_1D_INDEX]->Sampler.WrapS == GL_CLAMP) { return GL_TRUE; } } if (texUnit->Enabled & TEXTURE_2D_BIT) { - if (texUnit->CurrentTex[TEXTURE_2D_INDEX]->WrapS == GL_CLAMP || - texUnit->CurrentTex[TEXTURE_2D_INDEX]->WrapT == GL_CLAMP) { + if (texUnit->CurrentTex[TEXTURE_2D_INDEX]->Sampler.WrapS == GL_CLAMP || + texUnit->CurrentTex[TEXTURE_2D_INDEX]->Sampler.WrapT == GL_CLAMP) { return GL_TRUE; } } if (texUnit->Enabled & TEXTURE_3D_BIT) { - if (texUnit->CurrentTex[TEXTURE_3D_INDEX]->WrapS == GL_CLAMP || - texUnit->CurrentTex[TEXTURE_3D_INDEX]->WrapT == GL_CLAMP || - texUnit->CurrentTex[TEXTURE_3D_INDEX]->WrapR == GL_CLAMP) { + if (texUnit->CurrentTex[TEXTURE_3D_INDEX]->Sampler.WrapS == GL_CLAMP || + texUnit->CurrentTex[TEXTURE_3D_INDEX]->Sampler.WrapT == GL_CLAMP || + texUnit->CurrentTex[TEXTURE_3D_INDEX]->Sampler.WrapR == GL_CLAMP) { return GL_TRUE; } } diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index ca51d1599a4..2dd28fd1c58 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -370,14 +370,14 @@ static void brw_wm_populate_key( struct brw_context *brw, * well and our shadow compares always return the result in * all 4 channels. */ - if (t->CompareMode == GL_COMPARE_R_TO_TEXTURE_ARB) { - if (t->DepthMode == GL_ALPHA) { + if (t->Sampler.CompareMode == GL_COMPARE_R_TO_TEXTURE_ARB) { + if (t->Sampler.DepthMode == GL_ALPHA) { swizzles[0] = SWIZZLE_ZERO; swizzles[1] = SWIZZLE_ZERO; swizzles[2] = SWIZZLE_ZERO; - } else if (t->DepthMode == GL_LUMINANCE) { + } else if (t->Sampler.DepthMode == GL_LUMINANCE) { swizzles[3] = SWIZZLE_ONE; - } else if (t->DepthMode == GL_RED) { + } else if (t->Sampler.DepthMode == GL_RED) { /* See table 3.23 of the GL 3.0 spec. */ swizzles[1] = SWIZZLE_ZERO; swizzles[2] = SWIZZLE_ZERO; diff --git a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c index 30672b4251b..cfc30d8613f 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c @@ -288,26 +288,26 @@ brw_wm_sampler_populate_key(struct brw_context *brw, entry->seamless_cube_map = (texObj->Target == GL_TEXTURE_CUBE_MAP) ? ctx->Texture.CubeMapSeamless : GL_FALSE; - entry->wrap_r = texObj->WrapR; - entry->wrap_s = texObj->WrapS; - entry->wrap_t = texObj->WrapT; - - entry->maxlod = texObj->MaxLod; - entry->minlod = texObj->MinLod; - entry->lod_bias = texUnit->LodBias + texObj->LodBias; - entry->max_aniso = texObj->MaxAnisotropy; - entry->minfilter = texObj->MinFilter; - entry->magfilter = texObj->MagFilter; - entry->comparemode = texObj->CompareMode; - entry->comparefunc = texObj->CompareFunc; + entry->wrap_r = texObj->Sampler.WrapR; + entry->wrap_s = texObj->Sampler.WrapS; + entry->wrap_t = texObj->Sampler.WrapT; + + entry->maxlod = texObj->Sampler.MaxLod; + entry->minlod = texObj->Sampler.MinLod; + entry->lod_bias = texUnit->LodBias + texObj->Sampler.LodBias; + entry->max_aniso = texObj->Sampler.MaxAnisotropy; + entry->minfilter = texObj->Sampler.MinFilter; + entry->magfilter = texObj->Sampler.MagFilter; + entry->comparemode = texObj->Sampler.CompareMode; + entry->comparefunc = texObj->Sampler.CompareFunc; drm_intel_bo_unreference(brw->wm.sdc_bo[unit]); if (firstImage->_BaseFormat == GL_DEPTH_COMPONENT) { float bordercolor[4] = { - texObj->BorderColor.f[0], - texObj->BorderColor.f[0], - texObj->BorderColor.f[0], - texObj->BorderColor.f[0] + texObj->Sampler.BorderColor.f[0], + texObj->Sampler.BorderColor.f[0], + texObj->Sampler.BorderColor.f[0], + texObj->Sampler.BorderColor.f[0] }; /* GL specs that border color for depth textures is taken from the * R channel, while the hardware uses A. Spam R into all the @@ -316,7 +316,7 @@ brw_wm_sampler_populate_key(struct brw_context *brw, brw->wm.sdc_bo[unit] = upload_default_color(brw, bordercolor); } else { brw->wm.sdc_bo[unit] = upload_default_color(brw, - texObj->BorderColor.f); + texObj->Sampler.BorderColor.f); } key->sampler_count = unit + 1; } diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c index aeda4d5ce4e..5a478a76e5c 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -201,8 +201,9 @@ brw_update_texture_surface( struct gl_context *ctx, GLuint unit ) surf->ss0.mipmap_layout_mode = BRW_SURFACE_MIPMAPLAYOUT_BELOW; surf->ss0.surface_type = translate_tex_target(tObj->Target); surf->ss0.surface_format = translate_tex_format(firstImage->TexFormat, - firstImage->InternalFormat, - tObj->DepthMode, tObj->sRGBDecode); + firstImage->InternalFormat, + tObj->Sampler.DepthMode, + tObj->Sampler.sRGBDecode); /* This is ok for all textures with channel width 8bit or less: */ diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index b3a2b1b0c85..775fd1008f9 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -112,8 +112,8 @@ intel_miptree_create_for_teximage(struct intel_context *intel, * resizable buffers, or require that buffers implement lazy * pagetable arrangements. */ - if ((intelObj->base.MinFilter == GL_NEAREST || - intelObj->base.MinFilter == GL_LINEAR) && + if ((intelObj->base.Sampler.MinFilter == GL_NEAREST || + intelObj->base.Sampler.MinFilter == GL_LINEAR) && intelImage->level == firstLevel && (intel->gen < 4 || firstLevel == 0)) { lastLevel = firstLevel; diff --git a/src/mesa/drivers/dri/intel/intel_tex_validate.c b/src/mesa/drivers/dri/intel/intel_tex_validate.c index a11b07ed09d..5e705c93619 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_validate.c +++ b/src/mesa/drivers/dri/intel/intel_tex_validate.c @@ -18,7 +18,7 @@ intel_update_max_level(struct intel_context *intel, { struct gl_texture_object *tObj = &intelObj->base; - if (tObj->MinFilter == GL_NEAREST || tObj->MinFilter == GL_LINEAR) { + if (tObj->Sampler.MinFilter == GL_NEAREST || tObj->Sampler.MinFilter == GL_LINEAR) { intelObj->_MaxLevel = tObj->BaseLevel; } else { intelObj->_MaxLevel = tObj->_MaxLevel; diff --git a/src/mesa/drivers/dri/mach64/mach64_tex.c b/src/mesa/drivers/dri/mach64/mach64_tex.c index 68d273a3e75..8e10b314b64 100644 --- a/src/mesa/drivers/dri/mach64/mach64_tex.c +++ b/src/mesa/drivers/dri/mach64/mach64_tex.c @@ -123,9 +123,9 @@ mach64AllocTexObj( struct gl_texture_object *texObj ) make_empty_list( (driTextureObject *) t ); - mach64SetTexWrap( t, texObj->WrapS, texObj->WrapT ); - mach64SetTexFilter( t, texObj->MinFilter, texObj->MagFilter ); - mach64SetTexBorderColor( t, texObj->BorderColor.f ); + mach64SetTexWrap( t, texObj->Sampler.WrapS, texObj->Sampler.WrapT ); + mach64SetTexFilter( t, texObj->Sampler.MinFilter, texObj->Sampler.MagFilter ); + mach64SetTexBorderColor( t, texObj->Sampler.BorderColor.f ); return t; } @@ -454,18 +454,18 @@ static void mach64DDTexParameter( struct gl_context *ctx, GLenum target, case GL_TEXTURE_MIN_FILTER: case GL_TEXTURE_MAG_FILTER: if ( t->base.bound ) FLUSH_BATCH( mmesa ); - mach64SetTexFilter( t, tObj->MinFilter, tObj->MagFilter ); + mach64SetTexFilter( t, tObj->Sampler.MinFilter, tObj->Sampler.MagFilter ); break; case GL_TEXTURE_WRAP_S: case GL_TEXTURE_WRAP_T: if ( t->base.bound ) FLUSH_BATCH( mmesa ); - mach64SetTexWrap( t, tObj->WrapS, tObj->WrapT ); + mach64SetTexWrap( t, tObj->Sampler.WrapS, tObj->Sampler.WrapT ); break; case GL_TEXTURE_BORDER_COLOR: if ( t->base.bound ) FLUSH_BATCH( mmesa ); - mach64SetTexBorderColor( t, tObj->BorderColor.f ); + mach64SetTexBorderColor( t, tObj->Sampler.BorderColor.f ); break; case GL_TEXTURE_BASE_LEVEL: diff --git a/src/mesa/drivers/dri/mga/mgatex.c b/src/mesa/drivers/dri/mga/mgatex.c index 11ab9b6117d..ebbfec36556 100644 --- a/src/mesa/drivers/dri/mga/mgatex.c +++ b/src/mesa/drivers/dri/mga/mgatex.c @@ -327,9 +327,9 @@ mgaAllocTexObj( struct gl_texture_object *tObj ) make_empty_list( & t->base ); - mgaSetTexWrapping( t, tObj->WrapS, tObj->WrapT ); - mgaSetTexFilter( t, tObj->MinFilter, tObj->MagFilter ); - mgaSetTexBorderColor( t, tObj->BorderColor.f ); + mgaSetTexWrapping( t, tObj->Sampler.WrapS, tObj->Sampler.WrapT ); + mgaSetTexFilter( t, tObj->Sampler.MinFilter, tObj->Sampler.MagFilter ); + mgaSetTexBorderColor( t, tObj->Sampler.BorderColor.f ); } return( t ); @@ -447,18 +447,18 @@ mgaTexParameter( struct gl_context *ctx, GLenum target, /* FALLTHROUGH */ case GL_TEXTURE_MAG_FILTER: FLUSH_BATCH(mmesa); - mgaSetTexFilter( t, tObj->MinFilter, tObj->MagFilter ); + mgaSetTexFilter( t, tObj->Sampler.MinFilter, tObj->Sampler.MagFilter ); break; case GL_TEXTURE_WRAP_S: case GL_TEXTURE_WRAP_T: FLUSH_BATCH(mmesa); - mgaSetTexWrapping(t,tObj->WrapS,tObj->WrapT); + mgaSetTexWrapping(t,tObj->Sampler.WrapS,tObj->Sampler.WrapT); break; case GL_TEXTURE_BORDER_COLOR: FLUSH_BATCH(mmesa); - mgaSetTexBorderColor(t, tObj->BorderColor.f); + mgaSetTexBorderColor(t, tObj->Sampler.BorderColor.f); break; case GL_TEXTURE_BASE_LEVEL: diff --git a/src/mesa/drivers/dri/nouveau/nouveau_texture.c b/src/mesa/drivers/dri/nouveau/nouveau_texture.c index 1a1e10e0b3a..36e68c99181 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_texture.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_texture.c @@ -270,8 +270,8 @@ get_last_level(struct gl_texture_object *t) { struct gl_texture_image *base = t->Image[0][t->BaseLevel]; - if (t->MinFilter == GL_NEAREST || - t->MinFilter == GL_LINEAR || !base) + if (t->Sampler.MinFilter == GL_NEAREST || + t->Sampler.MinFilter == GL_LINEAR || !base) return t->BaseLevel; else return MIN2(t->BaseLevel + base->MaxLog2, t->MaxLevel); diff --git a/src/mesa/drivers/dri/nouveau/nv04_state_tex.c b/src/mesa/drivers/dri/nouveau/nv04_state_tex.c index 5ed8b147559..6c96e580013 100644 --- a/src/mesa/drivers/dri/nouveau/nv04_state_tex.c +++ b/src/mesa/drivers/dri/nouveau/nv04_state_tex.c @@ -80,8 +80,8 @@ nv04_emit_tex_obj(struct gl_context *ctx, int emit) s = &to_nouveau_texture(t)->surfaces[t->BaseLevel]; - if (t->MinFilter != GL_NEAREST && - t->MinFilter != GL_LINEAR) { + if (t->Sampler.MinFilter != GL_NEAREST && + t->Sampler.MinFilter != GL_LINEAR) { lod_max = CLAMP(MIN2(t->MaxLod, t->_MaxLambda), 0, 15) + 1; @@ -89,17 +89,17 @@ nv04_emit_tex_obj(struct gl_context *ctx, int emit) t->LodBias, -16, 15) * 8; } - format |= nvgl_wrap_mode(t->WrapT) << 28 | - nvgl_wrap_mode(t->WrapS) << 24 | + format |= nvgl_wrap_mode(t->Sampler.WrapT) << 28 | + nvgl_wrap_mode(t->Sampler.WrapS) << 24 | ti->HeightLog2 << 20 | ti->WidthLog2 << 16 | lod_max << 12 | get_tex_format(ti); filter |= log2i(t->MaxAnisotropy) << 31 | - nvgl_filter_mode(t->MagFilter) << 28 | + nvgl_filter_mode(t->Sampler.MagFilter) << 28 | log2i(t->MaxAnisotropy) << 27 | - nvgl_filter_mode(t->MinFilter) << 24 | + nvgl_filter_mode(t->Sampler.MinFilter) << 24 | (lod_bias & 0xff) << 16; } else { diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_tex.c b/src/mesa/drivers/dri/nouveau/nv10_state_tex.c index fda67b15073..1d98b1970ef 100644 --- a/src/mesa/drivers/dri/nouveau/nv10_state_tex.c +++ b/src/mesa/drivers/dri/nouveau/nv10_state_tex.c @@ -173,14 +173,14 @@ nv10_emit_tex_obj(struct gl_context *ctx, int emit) return; /* Recompute the texturing registers. */ - tx_format = nvgl_wrap_mode(t->WrapT) << 28 - | nvgl_wrap_mode(t->WrapS) << 24 + tx_format = nvgl_wrap_mode(t->Sampler.WrapT) << 28 + | nvgl_wrap_mode(t->Sampler.WrapS) << 24 | ti->HeightLog2 << 20 | ti->WidthLog2 << 16 | 5 << 4 | 1 << 12; - tx_filter = nvgl_filter_mode(t->MagFilter) << 28 - | nvgl_filter_mode(t->MinFilter) << 24; + tx_filter = nvgl_filter_mode(t->Sampler.MagFilter) << 28 + | nvgl_filter_mode(t->Sampler.MinFilter) << 24; tx_enable = NV10_3D_TEX_ENABLE_ENABLE | log2i(t->MaxAnisotropy) << 4; @@ -196,8 +196,8 @@ nv10_emit_tex_obj(struct gl_context *ctx, int emit) tx_format |= get_tex_format_pot(ti); } - if (t->MinFilter != GL_NEAREST && - t->MinFilter != GL_LINEAR) { + if (t->Sampler.MinFilter != GL_NEAREST && + t->Sampler.MinFilter != GL_LINEAR) { int lod_min = t->MinLod; int lod_max = MIN2(t->MaxLod, t->_MaxLambda); int lod_bias = t->LodBias diff --git a/src/mesa/drivers/dri/nouveau/nv20_state_tex.c b/src/mesa/drivers/dri/nouveau/nv20_state_tex.c index c362aca0fdb..fdbfdf42595 100644 --- a/src/mesa/drivers/dri/nouveau/nv20_state_tex.c +++ b/src/mesa/drivers/dri/nouveau/nv20_state_tex.c @@ -186,12 +186,12 @@ nv20_emit_tex_obj(struct gl_context *ctx, int emit) | NV20_3D_TEX_FORMAT_NO_BORDER | 1 << 16; - tx_wrap = nvgl_wrap_mode(t->WrapR) << 16 - | nvgl_wrap_mode(t->WrapT) << 8 - | nvgl_wrap_mode(t->WrapS) << 0; + tx_wrap = nvgl_wrap_mode(t->Sampler.WrapR) << 16 + | nvgl_wrap_mode(t->Sampler.WrapT) << 8 + | nvgl_wrap_mode(t->Sampler.WrapS) << 0; - tx_filter = nvgl_filter_mode(t->MagFilter) << 24 - | nvgl_filter_mode(t->MinFilter) << 16 + tx_filter = nvgl_filter_mode(t->Sampler.MagFilter) << 24 + | nvgl_filter_mode(t->Sampler.MinFilter) << 16 | 2 << 12; tx_enable = NV20_3D_TEX_ENABLE_ENABLE @@ -208,8 +208,8 @@ nv20_emit_tex_obj(struct gl_context *ctx, int emit) tx_format |= get_tex_format_pot(ti); } - if (t->MinFilter != GL_NEAREST && - t->MinFilter != GL_LINEAR) { + if (t->Sampler.MinFilter != GL_NEAREST && + t->Sampler.MinFilter != GL_LINEAR) { int lod_min = t->MinLod; int lod_max = MIN2(t->MaxLod, t->_MaxLambda); int lod_bias = t->LodBias diff --git a/src/mesa/drivers/dri/r128/r128_tex.c b/src/mesa/drivers/dri/r128/r128_tex.c index ba3305e076e..a3f6ce8edeb 100644 --- a/src/mesa/drivers/dri/r128/r128_tex.c +++ b/src/mesa/drivers/dri/r128/r128_tex.c @@ -162,9 +162,9 @@ static r128TexObjPtr r128AllocTexObj( struct gl_texture_object *texObj ) make_empty_list( (driTextureObject *) t ); - r128SetTexWrap( t, texObj->WrapS, texObj->WrapT ); - r128SetTexFilter( t, texObj->MinFilter, texObj->MagFilter ); - r128SetTexBorderColor( t, texObj->BorderColor.f ); + r128SetTexWrap( t, texObj->Sampler.WrapS, texObj->Sampler.WrapT ); + r128SetTexFilter( t, texObj->Sampler.MinFilter, texObj->Sampler.MagFilter ); + r128SetTexBorderColor( t, texObj->Sampler.BorderColor.f ); } return t; @@ -519,18 +519,18 @@ static void r128TexParameter( struct gl_context *ctx, GLenum target, case GL_TEXTURE_MIN_FILTER: case GL_TEXTURE_MAG_FILTER: if ( t->base.bound ) FLUSH_BATCH( rmesa ); - r128SetTexFilter( t, tObj->MinFilter, tObj->MagFilter ); + r128SetTexFilter( t, tObj->Sampler.MinFilter, tObj->Sampler.MagFilter ); break; case GL_TEXTURE_WRAP_S: case GL_TEXTURE_WRAP_T: if ( t->base.bound ) FLUSH_BATCH( rmesa ); - r128SetTexWrap( t, tObj->WrapS, tObj->WrapT ); + r128SetTexWrap( t, tObj->Sampler.WrapS, tObj->Sampler.WrapT ); break; case GL_TEXTURE_BORDER_COLOR: if ( t->base.bound ) FLUSH_BATCH( rmesa ); - r128SetTexBorderColor( t, tObj->BorderColor.f ); + r128SetTexBorderColor( t, tObj->Sampler.BorderColor.f ); break; case GL_TEXTURE_BASE_LEVEL: diff --git a/src/mesa/drivers/dri/r200/r200_tex.c b/src/mesa/drivers/dri/r200/r200_tex.c index 092b7575831..d42e8f12041 100644 --- a/src/mesa/drivers/dri/r200/r200_tex.c +++ b/src/mesa/drivers/dri/r200/r200_tex.c @@ -383,18 +383,18 @@ static void r200TexParameter( struct gl_context *ctx, GLenum target, case GL_TEXTURE_MIN_FILTER: case GL_TEXTURE_MAG_FILTER: case GL_TEXTURE_MAX_ANISOTROPY_EXT: - r200SetTexMaxAnisotropy( t, texObj->MaxAnisotropy ); - r200SetTexFilter( t, texObj->MinFilter, texObj->MagFilter ); + r200SetTexMaxAnisotropy( t, texObj->Sampler.MaxAnisotropy ); + r200SetTexFilter( t, texObj->Sampler.MinFilter, texObj->Sampler.MagFilter ); break; case GL_TEXTURE_WRAP_S: case GL_TEXTURE_WRAP_T: case GL_TEXTURE_WRAP_R: - r200SetTexWrap( t, texObj->WrapS, texObj->WrapT, texObj->WrapR ); + r200SetTexWrap( t, texObj->Sampler.WrapS, texObj->Sampler.WrapT, texObj->Sampler.WrapR ); break; case GL_TEXTURE_BORDER_COLOR: - r200SetTexBorderColor( t, texObj->BorderColor.f ); + r200SetTexBorderColor( t, texObj->Sampler.BorderColor.f ); break; case GL_TEXTURE_BASE_LEVEL: @@ -479,13 +479,13 @@ static struct gl_texture_object *r200NewTextureObject(struct gl_context * ctx, _mesa_lookup_enum_by_nr(target), t); _mesa_initialize_texture_object(&t->base, name, target); - t->base.MaxAnisotropy = rmesa->radeon.initialMaxAnisotropy; + t->base.Sampler.MaxAnisotropy = rmesa->radeon.initialMaxAnisotropy; /* Initialize hardware state */ - r200SetTexWrap( t, t->base.WrapS, t->base.WrapT, t->base.WrapR ); - r200SetTexMaxAnisotropy( t, t->base.MaxAnisotropy ); - r200SetTexFilter(t, t->base.MinFilter, t->base.MagFilter); - r200SetTexBorderColor(t, t->base.BorderColor.f); + r200SetTexWrap( t, t->base.Sampler.WrapS, t->base.Sampler.WrapT, t->base.Sampler.WrapR ); + r200SetTexMaxAnisotropy( t, t->base.Sampler.MaxAnisotropy ); + r200SetTexFilter(t, t->base.Sampler.MinFilter, t->base.Sampler.MagFilter); + r200SetTexBorderColor(t, t->base.Sampler.BorderColor.f); return &t->base; } diff --git a/src/mesa/drivers/dri/r300/r300_fragprog_common.c b/src/mesa/drivers/dri/r300/r300_fragprog_common.c index 50cf8d6f9db..f0d960dca54 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog_common.c +++ b/src/mesa/drivers/dri/r300/r300_fragprog_common.c @@ -77,8 +77,8 @@ static void build_state( if (fp->Base.ShadowSamplers & (1 << unit)) { struct gl_texture_object* tex = r300->radeon.glCtx->Texture.Unit[unit]._Current; - state->unit[unit].texture_swizzle = build_dts(tex->DepthMode); - state->unit[unit].texture_compare_func = build_func(tex->CompareFunc); + state->unit[unit].texture_swizzle = build_dts(tex->Sampler.DepthMode); + state->unit[unit].texture_compare_func = build_func(tex->Sampler.CompareFunc); } } } diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index 51989c6b224..da6c8b602e1 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -1343,7 +1343,7 @@ static void r300SetupTextures(struct gl_context * ctx) */ r300->hw.tex.filter_1.cmd[R300_TEX_VALUE_0 + hw_tmu] = t->pp_txfilter_1 | - translate_lod_bias(ctx->Texture.Unit[i].LodBias + t->base.LodBias); + translate_lod_bias(ctx->Texture.Unit[i].LodBias + t->base.Sampler.LodBias); r300->hw.tex.size.cmd[R300_TEX_VALUE_0 + hw_tmu] = t->pp_txsize; r300->hw.tex.format.cmd[R300_TEX_VALUE_0 + @@ -2014,7 +2014,7 @@ static const GLfloat *get_fragmentprogram_constant(struct gl_context *ctx, GLuin buffer[0] = buffer[1] = buffer[2] = - buffer[3] = texObj->CompareFailValue; + buffer[3] = texObj->Sampler.CompareFailValue; } return buffer; } diff --git a/src/mesa/drivers/dri/r300/r300_tex.c b/src/mesa/drivers/dri/r300/r300_tex.c index f930b4d06bf..590d9afe14a 100644 --- a/src/mesa/drivers/dri/r300/r300_tex.c +++ b/src/mesa/drivers/dri/r300/r300_tex.c @@ -81,13 +81,13 @@ static void r300UpdateTexWrap(radeonTexObjPtr t) t->pp_txfilter &= ~(R300_TX_WRAP_S_MASK | R300_TX_WRAP_T_MASK | R300_TX_WRAP_R_MASK); - t->pp_txfilter |= translate_wrap_mode(tObj->WrapS) << R300_TX_WRAP_S_SHIFT; + t->pp_txfilter |= translate_wrap_mode(tObj->Sampler.WrapS) << R300_TX_WRAP_S_SHIFT; if (tObj->Target != GL_TEXTURE_1D) { - t->pp_txfilter |= translate_wrap_mode(tObj->WrapT) << R300_TX_WRAP_T_SHIFT; + t->pp_txfilter |= translate_wrap_mode(tObj->Sampler.WrapT) << R300_TX_WRAP_T_SHIFT; if (tObj->Target == GL_TEXTURE_3D) - t->pp_txfilter |= translate_wrap_mode(tObj->WrapR) << R300_TX_WRAP_R_SHIFT; + t->pp_txfilter |= translate_wrap_mode(tObj->Sampler.WrapR) << R300_TX_WRAP_R_SHIFT; } } @@ -202,7 +202,7 @@ static void r300TexParameter(struct gl_context * ctx, GLenum target, case GL_TEXTURE_MIN_FILTER: case GL_TEXTURE_MAG_FILTER: case GL_TEXTURE_MAX_ANISOTROPY_EXT: - r300SetTexFilter(t, texObj->MinFilter, texObj->MagFilter, texObj->MaxAnisotropy); + r300SetTexFilter(t, texObj->Sampler.MinFilter, texObj->Sampler.MagFilter, texObj->Sampler.MaxAnisotropy); break; case GL_TEXTURE_WRAP_S: @@ -212,7 +212,7 @@ static void r300TexParameter(struct gl_context * ctx, GLenum target, break; case GL_TEXTURE_BORDER_COLOR: - r300SetTexBorderColor(t, texObj->BorderColor.f); + r300SetTexBorderColor(t, texObj->Sampler.BorderColor.f); break; case GL_TEXTURE_BASE_LEVEL: @@ -299,12 +299,14 @@ static struct gl_texture_object *r300NewTextureObject(struct gl_context * ctx, } _mesa_initialize_texture_object(&t->base, name, target); - t->base.MaxAnisotropy = rmesa->radeon.initialMaxAnisotropy; + t->base.Sampler.MaxAnisotropy = rmesa->radeon.initialMaxAnisotropy; /* Initialize hardware state */ r300UpdateTexWrap(t); - r300SetTexFilter(t, t->base.MinFilter, t->base.MagFilter, t->base.MaxAnisotropy); - r300SetTexBorderColor(t, t->base.BorderColor.f); + r300SetTexFilter(t, t->base.Sampler.MinFilter, + t->base.Sampler.MagFilter, + t->base.Sampler.MaxAnisotropy); + r300SetTexBorderColor(t, t->base.Sampler.BorderColor.f); return &t->base; } diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c index ed9955b05d8..e24ad6f088d 100644 --- a/src/mesa/drivers/dri/r300/r300_texstate.c +++ b/src/mesa/drivers/dri/r300/r300_texstate.c @@ -216,7 +216,7 @@ void r300SetDepthTexMode(struct gl_texture_object *tObj) return; } - switch (tObj->DepthMode) { + switch (tObj->Sampler.DepthMode) { case GL_LUMINANCE: t->pp_txformat = format[0]; break; diff --git a/src/mesa/drivers/dri/r600/evergreen_tex.c b/src/mesa/drivers/dri/r600/evergreen_tex.c index 3b5448a0e4e..5fdb91a63d1 100644 --- a/src/mesa/drivers/dri/r600/evergreen_tex.c +++ b/src/mesa/drivers/dri/r600/evergreen_tex.c @@ -699,18 +699,18 @@ static void evergreenUpdateTexWrap(radeonTexObjPtr t) { struct gl_texture_object *tObj = &t->base; - SETfield(t->SQ_TEX_SAMPLER0, evergreen_translate_wrap_mode(tObj->WrapS), + SETfield(t->SQ_TEX_SAMPLER0, evergreen_translate_wrap_mode(tObj->Sampler.WrapS), EG_SQ_TEX_SAMPLER_WORD0_0__CLAMP_X_shift, EG_SQ_TEX_SAMPLER_WORD0_0__CLAMP_X_mask); if (tObj->Target != GL_TEXTURE_1D) { - SETfield(t->SQ_TEX_SAMPLER0, evergreen_translate_wrap_mode(tObj->WrapT), + SETfield(t->SQ_TEX_SAMPLER0, evergreen_translate_wrap_mode(tObj->Sampler.WrapT), EG_SQ_TEX_SAMPLER_WORD0_0__CLAMP_Y_shift, EG_SQ_TEX_SAMPLER_WORD0_0__CLAMP_Y_mask); if (tObj->Target == GL_TEXTURE_3D) - SETfield(t->SQ_TEX_SAMPLER0, evergreen_translate_wrap_mode(tObj->WrapR), + SETfield(t->SQ_TEX_SAMPLER0, evergreen_translate_wrap_mode(tObj->Sampler.WrapR), EG_SQ_TEX_SAMPLER_WORD0_0__CLAMP_Z_shift, EG_SQ_TEX_SAMPLER_WORD0_0__CLAMP_Z_mask); } @@ -901,7 +901,7 @@ static void evergreenSetTexFilter(radeonTexObjPtr t, GLenum minf, GLenum magf, G } } -static void evergreenSetTexBorderColor(radeonTexObjPtr t, const GLfloat color[4]) +static void evergreenSetTexSampler.BorderColor(radeonTexObjPtr t, const GLfloat color[4]) { t->TD_PS_SAMPLER0_BORDER_ALPHA = *((uint32_t*)&(color[3])); t->TD_PS_SAMPLER0_BORDER_RED = *((uint32_t*)&(color[2])); @@ -1424,8 +1424,8 @@ static struct gl_texture_object *evergreenNewTextureObject(struct gl_context * c evergreenSetTexDefaultState(t); evergreenUpdateTexWrap(t); - evergreenSetTexFilter(t, t->base.MinFilter, t->base.MagFilter, t->base.MaxAnisotropy); - evergreenSetTexBorderColor(t, t->base.BorderColor.f); + evergreenSetTexFilter(t, t->base.Sampler.MinFilter, t->base.Sampler.MagFilter, t->base.MaxAnisotropy); + evergreenSetTexSampler.BorderColor(t, t->base.Sampler.BorderColor.f); return &t->base; } @@ -1475,7 +1475,7 @@ static void evergreenTexParameter(struct gl_context * ctx, GLenum target, case GL_TEXTURE_MIN_FILTER: case GL_TEXTURE_MAG_FILTER: case GL_TEXTURE_MAX_ANISOTROPY_EXT: - evergreenSetTexFilter(t, texObj->MinFilter, texObj->MagFilter, texObj->MaxAnisotropy); + evergreenSetTexFilter(t, texObj->Sampler.MinFilter, texObj->Sampler.MagFilter, texObj->MaxAnisotropy); break; case GL_TEXTURE_WRAP_S: @@ -1485,7 +1485,7 @@ static void evergreenTexParameter(struct gl_context * ctx, GLenum target, break; case GL_TEXTURE_BORDER_COLOR: - evergreenSetTexBorderColor(t, texObj->BorderColor.f); + evergreenSetTexSampler.BorderColor(t, texObj->Sampler.BorderColor.f); break; case GL_TEXTURE_BASE_LEVEL: diff --git a/src/mesa/drivers/dri/r600/r600_tex.c b/src/mesa/drivers/dri/r600/r600_tex.c index fe4f0e48661..07f6de7ad49 100644 --- a/src/mesa/drivers/dri/r600/r600_tex.c +++ b/src/mesa/drivers/dri/r600/r600_tex.c @@ -78,15 +78,15 @@ static void r600UpdateTexWrap(radeonTexObjPtr t) { struct gl_texture_object *tObj = &t->base; - SETfield(t->SQ_TEX_SAMPLER0, translate_wrap_mode(tObj->WrapS), + SETfield(t->SQ_TEX_SAMPLER0, translate_wrap_mode(tObj->Sampler.WrapS), SQ_TEX_SAMPLER_WORD0_0__CLAMP_X_shift, SQ_TEX_SAMPLER_WORD0_0__CLAMP_X_mask); if (tObj->Target != GL_TEXTURE_1D) { - SETfield(t->SQ_TEX_SAMPLER0, translate_wrap_mode(tObj->WrapT), + SETfield(t->SQ_TEX_SAMPLER0, translate_wrap_mode(tObj->Sampler.WrapT), CLAMP_Y_shift, CLAMP_Y_mask); if (tObj->Target == GL_TEXTURE_3D) - SETfield(t->SQ_TEX_SAMPLER0, translate_wrap_mode(tObj->WrapR), + SETfield(t->SQ_TEX_SAMPLER0, translate_wrap_mode(tObj->Sampler.WrapR), CLAMP_Z_shift, CLAMP_Z_mask); } } @@ -262,7 +262,7 @@ static void r600SetTexFilter(radeonTexObjPtr t, GLenum minf, GLenum magf, GLfloa } } -static void r600SetTexBorderColor(radeonTexObjPtr t, const GLfloat color[4]) +static void r600SetTexSampler.BorderColor(radeonTexObjPtr t, const GLfloat color[4]) { t->TD_PS_SAMPLER0_BORDER_ALPHA = *((uint32_t*)&(color[3])); t->TD_PS_SAMPLER0_BORDER_BLUE = *((uint32_t*)&(color[2])); @@ -292,7 +292,7 @@ static void r600TexParameter(struct gl_context * ctx, GLenum target, case GL_TEXTURE_MIN_FILTER: case GL_TEXTURE_MAG_FILTER: case GL_TEXTURE_MAX_ANISOTROPY_EXT: - r600SetTexFilter(t, texObj->MinFilter, texObj->MagFilter, texObj->MaxAnisotropy); + r600SetTexFilter(t, texObj->Sampler.MinFilter, texObj->Sampler.MagFilter, texObj->MaxAnisotropy); break; case GL_TEXTURE_WRAP_S: @@ -302,7 +302,7 @@ static void r600TexParameter(struct gl_context * ctx, GLenum target, break; case GL_TEXTURE_BORDER_COLOR: - r600SetTexBorderColor(t, texObj->BorderColor.f); + r600SetTexSampler.BorderColor(t, texObj->Sampler.BorderColor.f); break; case GL_TEXTURE_BASE_LEVEL: @@ -387,8 +387,8 @@ static struct gl_texture_object *r600NewTextureObject(struct gl_context * ctx, /* Initialize hardware state */ r600SetTexDefaultState(t); r600UpdateTexWrap(t); - r600SetTexFilter(t, t->base.MinFilter, t->base.MagFilter, t->base.MaxAnisotropy); - r600SetTexBorderColor(t, t->base.BorderColor.f); + r600SetTexFilter(t, t->base.Sampler.MinFilter, t->base.Sampler.MagFilter, t->base.MaxAnisotropy); + r600SetTexSampler.BorderColor(t, t->base.Sampler.BorderColor.f); return &t->base; } diff --git a/src/mesa/drivers/dri/r600/r700_chip.c b/src/mesa/drivers/dri/r600/r700_chip.c index 4ec2845ab44..ff456c67e2e 100644 --- a/src/mesa/drivers/dri/r600/r700_chip.c +++ b/src/mesa/drivers/dri/r600/r700_chip.c @@ -141,7 +141,7 @@ static void r700SendTexSamplerState(struct gl_context *ctx, struct radeon_state_ } } -static void r700SendTexBorderColorState(struct gl_context *ctx, struct radeon_state_atom *atom) +static void r700SendTexSampler.BorderColorState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -1640,7 +1640,7 @@ void r600InitAtoms(context_t *context) ALLOC_STATE(vtx, vtx, (VERT_ATTRIB_MAX * 18), r700SendVTXState); ALLOC_STATE(tx, tx, (R700_TEXTURE_NUMBERUNITS * 20), r700SendTexState); ALLOC_STATE(tx_smplr, tx, (R700_TEXTURE_NUMBERUNITS * 5), r700SendTexSamplerState); - ALLOC_STATE(tx_brdr_clr, tx, (R700_TEXTURE_NUMBERUNITS * 6), r700SendTexBorderColorState); + ALLOC_STATE(tx_brdr_clr, tx, (R700_TEXTURE_NUMBERUNITS * 6), r700SendTexSampler.BorderColorState); r600_init_query_stateobj(&context->radeon, 6 * 2); context->radeon.hw.is_dirty = GL_TRUE; diff --git a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c index 1fadad2756b..03d9b264367 100644 --- a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c +++ b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c @@ -296,15 +296,15 @@ static void calculate_min_max_lod(struct gl_texture_object *tObj, case GL_TEXTURE_2D: case GL_TEXTURE_3D: case GL_TEXTURE_CUBE_MAP: - if (tObj->MinFilter == GL_NEAREST || tObj->MinFilter == GL_LINEAR) { + if (tObj->Sampler.MinFilter == GL_NEAREST || tObj->Sampler.MinFilter == GL_LINEAR) { /* GL_NEAREST and GL_LINEAR only care about GL_TEXTURE_BASE_LEVEL. */ minLod = maxLod = tObj->BaseLevel; } else { - minLod = tObj->BaseLevel + (GLint)(tObj->MinLod); + minLod = tObj->BaseLevel + (GLint)(tObj->Sampler.MinLod); minLod = MAX2(minLod, tObj->BaseLevel); minLod = MIN2(minLod, tObj->MaxLevel); - maxLod = tObj->BaseLevel + (GLint)(tObj->MaxLod + 0.5); + maxLod = tObj->BaseLevel + (GLint)(tObj->Sampler.MaxLod + 0.5); maxLod = MIN2(maxLod, tObj->MaxLevel); maxLod = MIN2(maxLod, tObj->Image[0][minLod]->MaxLog2 + minLod); maxLod = MAX2(maxLod, minLod); /* need at least one level */ diff --git a/src/mesa/drivers/dri/radeon/radeon_tex.c b/src/mesa/drivers/dri/radeon/radeon_tex.c index 8a35c7d2d27..25a8ddf7b6a 100644 --- a/src/mesa/drivers/dri/radeon/radeon_tex.c +++ b/src/mesa/drivers/dri/radeon/radeon_tex.c @@ -330,17 +330,17 @@ static void radeonTexParameter( struct gl_context *ctx, GLenum target, case GL_TEXTURE_MIN_FILTER: case GL_TEXTURE_MAG_FILTER: case GL_TEXTURE_MAX_ANISOTROPY_EXT: - radeonSetTexMaxAnisotropy( t, texObj->MaxAnisotropy ); - radeonSetTexFilter( t, texObj->MinFilter, texObj->MagFilter ); + radeonSetTexMaxAnisotropy( t, texObj->Sampler.MaxAnisotropy ); + radeonSetTexFilter( t, texObj->Sampler.MinFilter, texObj->Sampler.MagFilter ); break; case GL_TEXTURE_WRAP_S: case GL_TEXTURE_WRAP_T: - radeonSetTexWrap( t, texObj->WrapS, texObj->WrapT ); + radeonSetTexWrap( t, texObj->Sampler.WrapS, texObj->Sampler.WrapT ); break; case GL_TEXTURE_BORDER_COLOR: - radeonSetTexBorderColor( t, texObj->BorderColor.f ); + radeonSetTexBorderColor( t, texObj->Sampler.BorderColor.f ); break; case GL_TEXTURE_BASE_LEVEL: @@ -416,7 +416,7 @@ radeonNewTextureObject( struct gl_context *ctx, GLuint name, GLenum target ) radeonTexObj* t = CALLOC_STRUCT(radeon_tex_obj); _mesa_initialize_texture_object(&t->base, name, target); - t->base.MaxAnisotropy = rmesa->radeon.initialMaxAnisotropy; + t->base.Sampler.MaxAnisotropy = rmesa->radeon.initialMaxAnisotropy; t->border_fallback = GL_FALSE; @@ -424,10 +424,10 @@ radeonNewTextureObject( struct gl_context *ctx, GLuint name, GLenum target ) t->pp_txformat = (RADEON_TXFORMAT_ENDIAN_NO_SWAP | RADEON_TXFORMAT_PERSPECTIVE_ENABLE); - radeonSetTexWrap( t, t->base.WrapS, t->base.WrapT ); - radeonSetTexMaxAnisotropy( t, t->base.MaxAnisotropy ); - radeonSetTexFilter( t, t->base.MinFilter, t->base.MagFilter ); - radeonSetTexBorderColor( t, t->base.BorderColor.f ); + radeonSetTexWrap( t, t->base.Sampler.WrapS, t->base.Sampler.WrapT ); + radeonSetTexMaxAnisotropy( t, t->base.Sampler.MaxAnisotropy ); + radeonSetTexFilter( t, t->base.Sampler.MinFilter, t->base.Sampler.MagFilter ); + radeonSetTexBorderColor( t, t->base.Sampler.BorderColor.f ); return &t->base; } diff --git a/src/mesa/drivers/dri/savage/savagerender.c b/src/mesa/drivers/dri/savage/savagerender.c index 8cc448ad4f7..6687dc5f466 100644 --- a/src/mesa/drivers/dri/savage/savagerender.c +++ b/src/mesa/drivers/dri/savage/savagerender.c @@ -250,9 +250,9 @@ static GLboolean run_texnorm_stage( struct gl_context *ctx, const GLbitfield reallyEnabled = ctx->Texture.Unit[i]._ReallyEnabled; if (reallyEnabled) { const struct gl_texture_object *texObj = ctx->Texture.Unit[i]._Current; - const GLboolean normalizeS = (texObj->WrapS == GL_REPEAT); + const GLboolean normalizeS = (texObj->Sampler.WrapS == GL_REPEAT); const GLboolean normalizeT = (reallyEnabled & TEXTURE_2D_BIT) && - (texObj->WrapT == GL_REPEAT); + (texObj->Sampler.WrapT == GL_REPEAT); const GLfloat *in = (GLfloat *)VB->AttribPtr[_TNL_ATTRIB_TEX0 + i]->data; const GLint instride = VB->AttribPtr[_TNL_ATTRIB_TEX0 + i]->stride; GLfloat (*out)[4] = store->texcoord[i].data; @@ -332,15 +332,15 @@ static void validate_texnorm( struct gl_context *ctx, GLuint flags = 0; if (((ctx->Texture.Unit[0]._ReallyEnabled & (TEXTURE_1D_BIT|TEXTURE_2D_BIT)) && - (ctx->Texture.Unit[0]._Current->WrapS == GL_REPEAT)) || + (ctx->Texture.Unit[0]._Current->Sampler.WrapS == GL_REPEAT)) || ((ctx->Texture.Unit[0]._ReallyEnabled & TEXTURE_2D_BIT) && - (ctx->Texture.Unit[0]._Current->WrapT == GL_REPEAT))) + (ctx->Texture.Unit[0]._Current->Sampler.WrapT == GL_REPEAT))) flags |= VERT_BIT_TEX0; if (((ctx->Texture.Unit[1]._ReallyEnabled & (TEXTURE_1D_BIT|TEXTURE_2D_BIT)) && - (ctx->Texture.Unit[1]._Current->WrapS == GL_REPEAT)) || + (ctx->Texture.Unit[1]._Current->Sampler.WrapS == GL_REPEAT)) || ((ctx->Texture.Unit[1]._ReallyEnabled & TEXTURE_2D_BIT) && - (ctx->Texture.Unit[1]._Current->WrapT == GL_REPEAT))) + (ctx->Texture.Unit[1]._Current->Sampler.WrapT == GL_REPEAT))) flags |= VERT_BIT_TEX1; store->active = (flags != 0); diff --git a/src/mesa/drivers/dri/savage/savagetex.c b/src/mesa/drivers/dri/savage/savagetex.c index 3aece732c99..9486c12c158 100644 --- a/src/mesa/drivers/dri/savage/savagetex.c +++ b/src/mesa/drivers/dri/savage/savagetex.c @@ -502,9 +502,9 @@ savageAllocTexObj( struct gl_texture_object *texObj ) make_empty_list( &t->base ); - savageSetTexWrapping(t,texObj->WrapS,texObj->WrapT); - savageSetTexFilter(t,texObj->MinFilter,texObj->MagFilter); - savageSetTexBorderColor(t,texObj->BorderColor.f); + savageSetTexWrapping(t,texObj->Sampler.WrapS,texObj->Sampler.WrapT); + savageSetTexFilter(t,texObj->Sampler.MinFilter,texObj->Sampler.MagFilter); + savageSetTexBorderColor(t,texObj->Sampler.BorderColor.f); } return t; @@ -2031,16 +2031,16 @@ static void savageTexParameter( struct gl_context *ctx, GLenum target, switch (pname) { case GL_TEXTURE_MIN_FILTER: case GL_TEXTURE_MAG_FILTER: - savageSetTexFilter(t,tObj->MinFilter,tObj->MagFilter); + savageSetTexFilter(t,tObj->Sampler.MinFilter,tObj->Sampler.MagFilter); break; case GL_TEXTURE_WRAP_S: case GL_TEXTURE_WRAP_T: - savageSetTexWrapping(t,tObj->WrapS,tObj->WrapT); + savageSetTexWrapping(t,tObj->Sampler.WrapS,tObj->Sampler.WrapT); break; case GL_TEXTURE_BORDER_COLOR: - savageSetTexBorderColor(t,tObj->BorderColor.f); + savageSetTexBorderColor(t,tObj->Sampler.BorderColor.f); break; default: diff --git a/src/mesa/drivers/dri/sis/sis_texstate.c b/src/mesa/drivers/dri/sis/sis_texstate.c index daec2393211..6580f155bae 100644 --- a/src/mesa/drivers/dri/sis/sis_texstate.c +++ b/src/mesa/drivers/dri/sis/sis_texstate.c @@ -335,7 +335,7 @@ sis_set_texobj_parm( struct gl_context *ctx, struct gl_texture_object *texObj, current->texture[hw_unit].hwTextureMip = 0UL; current->texture[hw_unit].hwTextureSet = t->hwformat; - if ((texObj->MinFilter == GL_NEAREST) || (texObj->MinFilter == GL_LINEAR)) { + if ((texObj->Sampler.MinFilter == GL_NEAREST) || (texObj->Sampler.MinFilter == GL_LINEAR)) { firstLevel = lastLevel = texObj->BaseLevel; } else { /* Compute which mipmap levels we really want to send to the hardware. @@ -344,9 +344,9 @@ sis_set_texobj_parm( struct gl_context *ctx, struct gl_texture_object *texObj, * Yes, this looks overly complicated, but it's all needed. */ - firstLevel = texObj->BaseLevel + (GLint)(texObj->MinLod + 0.5); + firstLevel = texObj->BaseLevel + (GLint)(texObj->Sampler.MinLod + 0.5); firstLevel = MAX2(firstLevel, texObj->BaseLevel); - lastLevel = texObj->BaseLevel + (GLint)(texObj->MaxLod + 0.5); + lastLevel = texObj->BaseLevel + (GLint)(texObj->Sampler.MaxLod + 0.5); lastLevel = MAX2(lastLevel, texObj->BaseLevel); lastLevel = MIN2(lastLevel, texObj->BaseLevel + texObj->Image[0][texObj->BaseLevel]->MaxLog2); @@ -356,7 +356,7 @@ sis_set_texobj_parm( struct gl_context *ctx, struct gl_texture_object *texObj, current->texture[hw_unit].hwTextureSet |= (lastLevel << 8); - switch (texObj->MagFilter) + switch (texObj->Sampler.MagFilter) { case GL_NEAREST: current->texture[hw_unit].hwTextureMip |= TEXTURE_FILTER_NEAREST; @@ -382,7 +382,7 @@ sis_set_texobj_parm( struct gl_context *ctx, struct gl_texture_object *texObj, MASK_TextureMipmapLodBias); } - switch (texObj->MinFilter) + switch (texObj->Sampler.MinFilter) { case GL_NEAREST: current->texture[hw_unit].hwTextureMip |= TEXTURE_FILTER_NEAREST; @@ -408,7 +408,7 @@ sis_set_texobj_parm( struct gl_context *ctx, struct gl_texture_object *texObj, break; } - switch (texObj->WrapS) + switch (texObj->Sampler.WrapS) { case GL_REPEAT: current->texture[hw_unit].hwTextureSet |= MASK_TextureWrapU; @@ -431,7 +431,7 @@ sis_set_texobj_parm( struct gl_context *ctx, struct gl_texture_object *texObj, break; } - switch (texObj->WrapT) + switch (texObj->Sampler.WrapT) { case GL_REPEAT: current->texture[hw_unit].hwTextureSet |= MASK_TextureWrapV; @@ -456,10 +456,10 @@ sis_set_texobj_parm( struct gl_context *ctx, struct gl_texture_object *texObj, { GLubyte c[4]; - CLAMPED_FLOAT_TO_UBYTE(c[0], texObj->BorderColor.f[0]); - CLAMPED_FLOAT_TO_UBYTE(c[1], texObj->BorderColor.f[1]); - CLAMPED_FLOAT_TO_UBYTE(c[2], texObj->BorderColor.f[2]); - CLAMPED_FLOAT_TO_UBYTE(c[3], texObj->BorderColor.f[3]); + CLAMPED_FLOAT_TO_UBYTE(c[0], texObj->Sampler.BorderColor.f[0]); + CLAMPED_FLOAT_TO_UBYTE(c[1], texObj->Sampler.BorderColor.f[1]); + CLAMPED_FLOAT_TO_UBYTE(c[2], texObj->Sampler.BorderColor.f[2]); + CLAMPED_FLOAT_TO_UBYTE(c[3], texObj->Sampler.BorderColor.f[3]); current->texture[hw_unit].hwTextureBorderColor = PACK_COLOR_8888(c[3], c[0], c[1], c[2]); diff --git a/src/mesa/drivers/dri/tdfx/tdfx_tex.c b/src/mesa/drivers/dri/tdfx/tdfx_tex.c index 4cca243d076..d74ddb24005 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_tex.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_tex.c @@ -327,7 +327,7 @@ static void RevalidateTexture(struct gl_context *ctx, struct gl_texture_object * &(ti->sScale), &(ti->tScale), NULL, NULL); } - if (tObj->Image[0][maxl] && (tObj->MinFilter != GL_NEAREST) && (tObj->MinFilter != GL_LINEAR)) { + if (tObj->Image[0][maxl] && (tObj->Sampler.MinFilter != GL_NEAREST) && (tObj->Sampler.MinFilter != GL_LINEAR)) { /* mipmapping: need to compute smallLodLog2 */ tdfxTexGetInfo(ctx, tObj->Image[0][maxl]->Width, tObj->Image[0][maxl]->Height, @@ -1786,12 +1786,12 @@ tdfxTestProxyTexImage(struct gl_context *ctx, GLenum target, #endif if (level == 0) { /* don't use mipmap levels > 0 */ - tObj->MinFilter = tObj->MagFilter = GL_NEAREST; + tObj->Sampler.MinFilter = tObj->Sampler.MagFilter = GL_NEAREST; } else { /* test with all mipmap levels */ - tObj->MinFilter = GL_LINEAR_MIPMAP_LINEAR; - tObj->MagFilter = GL_NEAREST; + tObj->Sampler.MinFilter = GL_LINEAR_MIPMAP_LINEAR; + tObj->Sampler.MagFilter = GL_NEAREST; } RevalidateTexture(ctx, tObj); diff --git a/src/mesa/drivers/dri/unichrome/via_state.c b/src/mesa/drivers/dri/unichrome/via_state.c index 774f439bfb6..3b270e02a97 100644 --- a/src/mesa/drivers/dri/unichrome/via_state.c +++ b/src/mesa/drivers/dri/unichrome/via_state.c @@ -877,21 +877,21 @@ static GLboolean viaChooseTextureState(struct gl_context *ctx) if (texUnit0->_ReallyEnabled) { struct gl_texture_object *texObj = texUnit0->_Current; - vmesa->regHTXnTB[0] = get_minmag_filter( texObj->MinFilter, - texObj->MagFilter ); + vmesa->regHTXnTB[0] = get_minmag_filter( texObj->Sampler.MinFilter, + texObj->Sampler.MagFilter ); vmesa->regHTXnMPMD[0] &= ~(HC_HTXnMPMD_SMASK | HC_HTXnMPMD_TMASK); - vmesa->regHTXnMPMD[0] |= get_wrap_mode( texObj->WrapS, - texObj->WrapT ); + vmesa->regHTXnMPMD[0] |= get_wrap_mode( texObj->Sampler.WrapS, + texObj->Sampler.WrapT ); vmesa->regHTXnTB[0] &= ~(HC_HTXnTB_TBC_S | HC_HTXnTB_TBC_T); if (texObj->Image[0][texObj->BaseLevel]->Border > 0) { vmesa->regHTXnTB[0] |= (HC_HTXnTB_TBC_S | HC_HTXnTB_TBC_T); vmesa->regHTXnTBC[0] = - PACK_COLOR_888(FLOAT_TO_UBYTE(texObj->BorderColor.f[0]), - FLOAT_TO_UBYTE(texObj->BorderColor.f[1]), - FLOAT_TO_UBYTE(texObj->BorderColor.f[2])); - vmesa->regHTXnTRAH[0] = FLOAT_TO_UBYTE(texObj->BorderColor.f[3]); + PACK_COLOR_888(FLOAT_TO_UBYTE(texObj->Sampler.BorderColor.f[0]), + FLOAT_TO_UBYTE(texObj->Sampler.BorderColor.f[1]), + FLOAT_TO_UBYTE(texObj->Sampler.BorderColor.f[2])); + vmesa->regHTXnTRAH[0] = FLOAT_TO_UBYTE(texObj->Sampler.BorderColor.f[3]); } if (texUnit0->LodBias != 0.0f) { @@ -911,20 +911,20 @@ static GLboolean viaChooseTextureState(struct gl_context *ctx) if (texUnit1->_ReallyEnabled) { struct gl_texture_object *texObj = texUnit1->_Current; - vmesa->regHTXnTB[1] = get_minmag_filter( texObj->MinFilter, - texObj->MagFilter ); + vmesa->regHTXnTB[1] = get_minmag_filter( texObj->Sampler.MinFilter, + texObj->Sampler.MagFilter ); vmesa->regHTXnMPMD[1] &= ~(HC_HTXnMPMD_SMASK | HC_HTXnMPMD_TMASK); - vmesa->regHTXnMPMD[1] |= get_wrap_mode( texObj->WrapS, - texObj->WrapT ); + vmesa->regHTXnMPMD[1] |= get_wrap_mode( texObj->Sampler.WrapS, + texObj->Sampler.WrapT ); vmesa->regHTXnTB[1] &= ~(HC_HTXnTB_TBC_S | HC_HTXnTB_TBC_T); if (texObj->Image[0][texObj->BaseLevel]->Border > 0) { vmesa->regHTXnTB[1] |= (HC_HTXnTB_TBC_S | HC_HTXnTB_TBC_T); vmesa->regHTXnTBC[1] = - PACK_COLOR_888(FLOAT_TO_UBYTE(texObj->BorderColor.f[0]), - FLOAT_TO_UBYTE(texObj->BorderColor.f[1]), - FLOAT_TO_UBYTE(texObj->BorderColor.f[2])); - vmesa->regHTXnTRAH[1] = FLOAT_TO_UBYTE(texObj->BorderColor.f[3]); + PACK_COLOR_888(FLOAT_TO_UBYTE(texObj->Sampler.BorderColor.f[0]), + FLOAT_TO_UBYTE(texObj->Sampler.BorderColor.f[1]), + FLOAT_TO_UBYTE(texObj->Sampler.BorderColor.f[2])); + vmesa->regHTXnTRAH[1] = FLOAT_TO_UBYTE(texObj->Sampler.BorderColor.f[3]); } diff --git a/src/mesa/drivers/dri/unichrome/via_tex.c b/src/mesa/drivers/dri/unichrome/via_tex.c index a2fb010e142..1a0d1eaf070 100644 --- a/src/mesa/drivers/dri/unichrome/via_tex.c +++ b/src/mesa/drivers/dri/unichrome/via_tex.c @@ -495,13 +495,13 @@ static GLboolean viaSetTexImages(struct gl_context *ctx, * GL_TEXTURE_MAX_LOD, GL_TEXTURE_BASE_LEVEL, and GL_TEXTURE_MAX_LEVEL. * Yes, this looks overly complicated, but it's all needed. */ - if (texObj->MinFilter == GL_LINEAR || texObj->MinFilter == GL_NEAREST) { + if (texObj->Sampler.MinFilter == GL_LINEAR || texObj->Sampler.MinFilter == GL_NEAREST) { firstLevel = lastLevel = texObj->BaseLevel; } else { - firstLevel = texObj->BaseLevel + (GLint)(texObj->MinLod + 0.5); + firstLevel = texObj->BaseLevel + (GLint)(texObj->Sampler.MinLod + 0.5); firstLevel = MAX2(firstLevel, texObj->BaseLevel); - lastLevel = texObj->BaseLevel + (GLint)(texObj->MaxLod + 0.5); + lastLevel = texObj->BaseLevel + (GLint)(texObj->Sampler.MaxLod + 0.5); lastLevel = MAX2(lastLevel, texObj->BaseLevel); lastLevel = MIN2(lastLevel, texObj->BaseLevel + baseImage->image.MaxLog2); lastLevel = MIN2(lastLevel, texObj->MaxLevel); diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 6a2f4870db9..57310040235 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -770,6 +770,7 @@ pop_texture_group(struct gl_context *ctx, struct texture_state *texstate) /* Restore texture object state for each target */ for (tgt = 0; tgt < NUM_TEXTURE_TARGETS; tgt++) { const struct gl_texture_object *obj = NULL; + const struct gl_sampler_object *samp; GLenum target; obj = &texstate->SavedObj[u][tgt]; @@ -797,26 +798,28 @@ pop_texture_group(struct gl_context *ctx, struct texture_state *texstate) _mesa_BindTexture(target, obj->Name); - _mesa_TexParameterfv(target, GL_TEXTURE_BORDER_COLOR, obj->BorderColor.f); + samp = &obj->Sampler; + + _mesa_TexParameterfv(target, GL_TEXTURE_BORDER_COLOR, samp->BorderColor.f); + _mesa_TexParameteri(target, GL_TEXTURE_WRAP_S, samp->WrapS); + _mesa_TexParameteri(target, GL_TEXTURE_WRAP_T, samp->WrapT); + _mesa_TexParameteri(target, GL_TEXTURE_WRAP_R, samp->WrapR); + _mesa_TexParameteri(target, GL_TEXTURE_MIN_FILTER, samp->MinFilter); + _mesa_TexParameteri(target, GL_TEXTURE_MAG_FILTER, samp->MagFilter); + _mesa_TexParameterf(target, GL_TEXTURE_MIN_LOD, samp->MinLod); + _mesa_TexParameterf(target, GL_TEXTURE_MAX_LOD, samp->MaxLod); + _mesa_TexParameterf(target, GL_TEXTURE_LOD_BIAS, samp->LodBias); _mesa_TexParameterf(target, GL_TEXTURE_PRIORITY, obj->Priority); - _mesa_TexParameteri(target, GL_TEXTURE_WRAP_S, obj->WrapS); - _mesa_TexParameteri(target, GL_TEXTURE_WRAP_T, obj->WrapT); - _mesa_TexParameteri(target, GL_TEXTURE_WRAP_R, obj->WrapR); - _mesa_TexParameteri(target, GL_TEXTURE_MIN_FILTER, obj->MinFilter); - _mesa_TexParameteri(target, GL_TEXTURE_MAG_FILTER, obj->MagFilter); - _mesa_TexParameterf(target, GL_TEXTURE_MIN_LOD, obj->MinLod); - _mesa_TexParameterf(target, GL_TEXTURE_MAX_LOD, obj->MaxLod); - _mesa_TexParameterf(target, GL_TEXTURE_LOD_BIAS, obj->LodBias); _mesa_TexParameteri(target, GL_TEXTURE_BASE_LEVEL, obj->BaseLevel); if (target != GL_TEXTURE_RECTANGLE_ARB) _mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, obj->MaxLevel); if (ctx->Extensions.EXT_texture_filter_anisotropic) { _mesa_TexParameterf(target, GL_TEXTURE_MAX_ANISOTROPY_EXT, - obj->MaxAnisotropy); + samp->MaxAnisotropy); } if (ctx->Extensions.ARB_shadow_ambient) { _mesa_TexParameterf(target, GL_TEXTURE_COMPARE_FAIL_VALUE_ARB, - obj->CompareFailValue); + samp->CompareFailValue); } } diff --git a/src/mesa/main/ff_fragment_shader.cpp b/src/mesa/main/ff_fragment_shader.cpp index bf65a4f6485..43930a4b30e 100644 --- a/src/mesa/main/ff_fragment_shader.cpp +++ b/src/mesa/main/ff_fragment_shader.cpp @@ -439,9 +439,10 @@ static GLuint make_state_key( struct gl_context *ctx, struct state_key *key ) key->unit[i].source_index = translate_tex_src_bit(texUnit->_ReallyEnabled); - key->unit[i].shadow = ((texObj->CompareMode == GL_COMPARE_R_TO_TEXTURE) && - ((format == GL_DEPTH_COMPONENT) || - (format == GL_DEPTH_STENCIL_EXT))); + key->unit[i].shadow = + ((texObj->Sampler.CompareMode == GL_COMPARE_R_TO_TEXTURE) && + ((format == GL_DEPTH_COMPONENT) || + (format == GL_DEPTH_STENCIL_EXT))); key->unit[i].NumArgsRGB = comb->_NumArgsRGB; key->unit[i].NumArgsA = comb->_NumArgsA; diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 13e4325ee45..9e2905ab2b1 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1305,37 +1305,58 @@ typedef enum /** - * Texture object state. Contains the array of mipmap images, border color, - * wrap modes, filter modes, shadow/texcompare state, and the per-texture - * color palette. + * Sampler object state. These objects are new with GL_ARB_sampler_objects + * and OpenGL 3.3. Legacy texture objects also contain a sampler object. */ -struct gl_texture_object +struct gl_sampler_object { - _glthread_Mutex Mutex; /**< for thread safety */ - GLint RefCount; /**< reference count */ - GLuint Name; /**< the user-visible texture object ID */ - GLenum Target; /**< GL_TEXTURE_1D, GL_TEXTURE_2D, etc. */ - GLfloat Priority; /**< in [0,1] */ - union { - GLfloat f[4]; - GLuint ui[4]; - GLint i[4]; - } BorderColor; /**< Interpreted according to texture format */ + GLuint Name; + GLint RefCount; + GLenum WrapS; /**< S-axis texture image wrap mode */ GLenum WrapT; /**< T-axis texture image wrap mode */ GLenum WrapR; /**< R-axis texture image wrap mode */ GLenum MinFilter; /**< minification filter */ GLenum MagFilter; /**< magnification filter */ + union { + GLfloat f[4]; + GLuint ui[4]; + GLint i[4]; + } BorderColor; /**< Interpreted according to texture format */ GLfloat MinLod; /**< min lambda, OpenGL 1.2 */ GLfloat MaxLod; /**< max lambda, OpenGL 1.2 */ GLfloat LodBias; /**< OpenGL 1.4 */ - GLint BaseLevel; /**< min mipmap level, OpenGL 1.2 */ - GLint MaxLevel; /**< max mipmap level, OpenGL 1.2 */ GLfloat MaxAnisotropy; /**< GL_EXT_texture_filter_anisotropic */ GLenum CompareMode; /**< GL_ARB_shadow */ GLenum CompareFunc; /**< GL_ARB_shadow */ GLfloat CompareFailValue; /**< GL_ARB_shadow_ambient */ + GLenum sRGBDecode; /**< GL_DECODE_EXT or GL_SKIP_DECODE_EXT */ + + /* deprecated sampler state */ GLenum DepthMode; /**< GL_ARB_depth_texture */ + + /** Is the texture object complete with respect to this sampler? */ + GLboolean _CompleteTexture; +}; + + +/** + * Texture object state. Contains the array of mipmap images, border color, + * wrap modes, filter modes, shadow/texcompare state, and the per-texture + * color palette. + */ +struct gl_texture_object +{ + _glthread_Mutex Mutex; /**< for thread safety */ + GLint RefCount; /**< reference count */ + GLuint Name; /**< the user-visible texture object ID */ + GLenum Target; /**< GL_TEXTURE_1D, GL_TEXTURE_2D, etc. */ + + struct gl_sampler_object Sampler; + + GLfloat Priority; /**< in [0,1] */ + GLint BaseLevel; /**< min mipmap level, OpenGL 1.2 */ + GLint MaxLevel; /**< max mipmap level, OpenGL 1.2 */ GLint _MaxLevel; /**< actual max mipmap level (q in the spec) */ GLfloat _MaxLambda; /**< = _MaxLevel - BaseLevel (q - b in spec) */ GLint CropRect[4]; /**< GL_OES_draw_texture */ @@ -1345,7 +1366,6 @@ struct gl_texture_object GLboolean _Complete; /**< Is texture object complete? */ GLboolean _RenderToTexture; /**< Any rendering to this texture? */ GLboolean Purgeable; /**< Is the buffer purgeable under memory pressure? */ - GLenum sRGBDecode; /**< GL_DECODE_EXT or GL_SKIP_DECODE_EXT */ /** Actual texture images, indexed by [cube face] and [mipmap level] */ struct gl_texture_image *Image[MAX_FACES][MAX_TEXTURE_LEVELS]; @@ -1429,6 +1449,9 @@ struct gl_texture_unit GLenum BumpTarget; GLfloat RotMatrix[4]; /* 2x2 matrix */ + /** Current sampler object (GL_ARB_sampler_objects) */ + struct gl_sampler_object *Sampler; + /** * \name GL_EXT_texture_env_combine */ @@ -2363,6 +2386,9 @@ struct gl_shared_state /* GL_ARB_sync */ struct simple_node SyncObjects; + /** GL_ARB_sampler_objects */ + struct _mesa_HashTable *SamplerObjects; + void *DriverData; /**< Device driver shared state */ }; diff --git a/src/mesa/main/texfetch.c b/src/mesa/main/texfetch.c index b2181af2931..caabc19bb17 100644 --- a/src/mesa/main/texfetch.c +++ b/src/mesa/main/texfetch.c @@ -975,7 +975,7 @@ _mesa_set_fetch_functions(struct gl_texture_image *texImage, GLuint dims) ASSERT(dims == 1 || dims == 2 || dims == 3); - if (texImage->TexObject->sRGBDecode == GL_SKIP_DECODE_EXT && + if (texImage->TexObject->Sampler.sRGBDecode == GL_SKIP_DECODE_EXT && _mesa_get_format_color_encoding(format) == GL_SRGB) { format = _mesa_get_srgb_format_linear(format); } diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 61b9bc70d77..43d6e52dfe9 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -116,35 +116,37 @@ _mesa_initialize_texture_object( struct gl_texture_object *obj, obj->Name = name; obj->Target = target; obj->Priority = 1.0F; + obj->BaseLevel = 0; + obj->MaxLevel = 1000; + + /* sampler state */ if (target == GL_TEXTURE_RECTANGLE_NV) { - obj->WrapS = GL_CLAMP_TO_EDGE; - obj->WrapT = GL_CLAMP_TO_EDGE; - obj->WrapR = GL_CLAMP_TO_EDGE; - obj->MinFilter = GL_LINEAR; + obj->Sampler.WrapS = GL_CLAMP_TO_EDGE; + obj->Sampler.WrapT = GL_CLAMP_TO_EDGE; + obj->Sampler.WrapR = GL_CLAMP_TO_EDGE; + obj->Sampler.MinFilter = GL_LINEAR; } else { - obj->WrapS = GL_REPEAT; - obj->WrapT = GL_REPEAT; - obj->WrapR = GL_REPEAT; - obj->MinFilter = GL_NEAREST_MIPMAP_LINEAR; + obj->Sampler.WrapS = GL_REPEAT; + obj->Sampler.WrapT = GL_REPEAT; + obj->Sampler.WrapR = GL_REPEAT; + obj->Sampler.MinFilter = GL_NEAREST_MIPMAP_LINEAR; } - obj->MagFilter = GL_LINEAR; - obj->MinLod = -1000.0; - obj->MaxLod = 1000.0; - obj->LodBias = 0.0; - obj->BaseLevel = 0; - obj->MaxLevel = 1000; - obj->MaxAnisotropy = 1.0; - obj->CompareMode = GL_NONE; /* ARB_shadow */ - obj->CompareFunc = GL_LEQUAL; /* ARB_shadow */ - obj->CompareFailValue = 0.0F; /* ARB_shadow_ambient */ - obj->DepthMode = GL_LUMINANCE; /* ARB_depth_texture */ + obj->Sampler.MagFilter = GL_LINEAR; + obj->Sampler.MinLod = -1000.0; + obj->Sampler.MaxLod = 1000.0; + obj->Sampler.LodBias = 0.0; + obj->Sampler.MaxAnisotropy = 1.0; + obj->Sampler.CompareMode = GL_NONE; /* ARB_shadow */ + obj->Sampler.CompareFunc = GL_LEQUAL; /* ARB_shadow */ + obj->Sampler.CompareFailValue = 0.0F; /* ARB_shadow_ambient */ + obj->Sampler.DepthMode = GL_LUMINANCE; /* ARB_depth_texture */ obj->Swizzle[0] = GL_RED; obj->Swizzle[1] = GL_GREEN; obj->Swizzle[2] = GL_BLUE; obj->Swizzle[3] = GL_ALPHA; obj->_Swizzle = SWIZZLE_NOOP; - obj->sRGBDecode = GL_DECODE_EXT; + obj->Sampler.sRGBDecode = GL_DECODE_EXT; } @@ -160,10 +162,10 @@ finish_texture_init(struct gl_context *ctx, GLenum target, if (target == GL_TEXTURE_RECTANGLE_NV) { /* have to init wrap and filter state here - kind of klunky */ - obj->WrapS = GL_CLAMP_TO_EDGE; - obj->WrapT = GL_CLAMP_TO_EDGE; - obj->WrapR = GL_CLAMP_TO_EDGE; - obj->MinFilter = GL_LINEAR; + obj->Sampler.WrapS = GL_CLAMP_TO_EDGE; + obj->Sampler.WrapT = GL_CLAMP_TO_EDGE; + obj->Sampler.WrapR = GL_CLAMP_TO_EDGE; + obj->Sampler.MinFilter = GL_LINEAR; if (ctx->Driver.TexParameter) { static const GLfloat fparam_wrap[1] = {(GLfloat) GL_CLAMP_TO_EDGE}; static const GLfloat fparam_filter[1] = {(GLfloat) GL_LINEAR}; @@ -231,25 +233,25 @@ _mesa_copy_texture_object( struct gl_texture_object *dest, dest->Target = src->Target; dest->Name = src->Name; dest->Priority = src->Priority; - dest->BorderColor.f[0] = src->BorderColor.f[0]; - dest->BorderColor.f[1] = src->BorderColor.f[1]; - dest->BorderColor.f[2] = src->BorderColor.f[2]; - dest->BorderColor.f[3] = src->BorderColor.f[3]; - dest->WrapS = src->WrapS; - dest->WrapT = src->WrapT; - dest->WrapR = src->WrapR; - dest->MinFilter = src->MinFilter; - dest->MagFilter = src->MagFilter; - dest->MinLod = src->MinLod; - dest->MaxLod = src->MaxLod; - dest->LodBias = src->LodBias; + dest->Sampler.BorderColor.f[0] = src->Sampler.BorderColor.f[0]; + dest->Sampler.BorderColor.f[1] = src->Sampler.BorderColor.f[1]; + dest->Sampler.BorderColor.f[2] = src->Sampler.BorderColor.f[2]; + dest->Sampler.BorderColor.f[3] = src->Sampler.BorderColor.f[3]; + dest->Sampler.WrapS = src->Sampler.WrapS; + dest->Sampler.WrapT = src->Sampler.WrapT; + dest->Sampler.WrapR = src->Sampler.WrapR; + dest->Sampler.MinFilter = src->Sampler.MinFilter; + dest->Sampler.MagFilter = src->Sampler.MagFilter; + dest->Sampler.MinLod = src->Sampler.MinLod; + dest->Sampler.MaxLod = src->Sampler.MaxLod; + dest->Sampler.LodBias = src->Sampler.LodBias; dest->BaseLevel = src->BaseLevel; dest->MaxLevel = src->MaxLevel; - dest->MaxAnisotropy = src->MaxAnisotropy; - dest->CompareMode = src->CompareMode; - dest->CompareFunc = src->CompareFunc; - dest->CompareFailValue = src->CompareFailValue; - dest->DepthMode = src->DepthMode; + dest->Sampler.MaxAnisotropy = src->Sampler.MaxAnisotropy; + dest->Sampler.CompareMode = src->Sampler.CompareMode; + dest->Sampler.CompareFunc = src->Sampler.CompareFunc; + dest->Sampler.CompareFailValue = src->Sampler.CompareFailValue; + dest->Sampler.DepthMode = src->Sampler.DepthMode; dest->_MaxLevel = src->_MaxLevel; dest->_MaxLambda = src->_MaxLambda; dest->GenerateMipmap = src->GenerateMipmap; @@ -506,7 +508,7 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx, } /* extra checking for mipmaps */ - if (t->MinFilter != GL_NEAREST && t->MinFilter != GL_LINEAR) { + if (t->Sampler.MinFilter != GL_NEAREST && t->Sampler.MinFilter != GL_LINEAR) { /* * Mipmapping: determine if we have a complete set of mipmaps */ @@ -761,8 +763,8 @@ _mesa_get_fallback_texture(struct gl_context *ctx) /* create texture object */ texObj = ctx->Driver.NewTextureObject(ctx, 0, GL_TEXTURE_2D); assert(texObj->RefCount == 1); - texObj->MinFilter = GL_NEAREST; - texObj->MagFilter = GL_NEAREST; + texObj->Sampler.MinFilter = GL_NEAREST; + texObj->Sampler.MagFilter = GL_NEAREST; /* create level[0] texture image */ texImage = _mesa_get_tex_image(ctx, texObj, GL_TEXTURE_2D, 0); diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index 34b6addb9b0..3d56dac3f91 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -216,13 +216,13 @@ set_tex_parameteri(struct gl_context *ctx, { switch (pname) { case GL_TEXTURE_MIN_FILTER: - if (texObj->MinFilter == params[0]) + if (texObj->Sampler.MinFilter == params[0]) return GL_FALSE; switch (params[0]) { case GL_NEAREST: case GL_LINEAR: incomplete(ctx, texObj); - texObj->MinFilter = params[0]; + texObj->Sampler.MinFilter = params[0]; return GL_TRUE; case GL_NEAREST_MIPMAP_NEAREST: case GL_LINEAR_MIPMAP_NEAREST: @@ -230,7 +230,7 @@ set_tex_parameteri(struct gl_context *ctx, case GL_LINEAR_MIPMAP_LINEAR: if (texObj->Target != GL_TEXTURE_RECTANGLE_NV) { incomplete(ctx, texObj); - texObj->MinFilter = params[0]; + texObj->Sampler.MinFilter = params[0]; return GL_TRUE; } /* fall-through */ @@ -240,13 +240,13 @@ set_tex_parameteri(struct gl_context *ctx, return GL_FALSE; case GL_TEXTURE_MAG_FILTER: - if (texObj->MagFilter == params[0]) + if (texObj->Sampler.MagFilter == params[0]) return GL_FALSE; switch (params[0]) { case GL_NEAREST: case GL_LINEAR: flush(ctx); /* does not effect completeness */ - texObj->MagFilter = params[0]; + texObj->Sampler.MagFilter = params[0]; return GL_TRUE; default: goto invalid_param; @@ -254,31 +254,31 @@ set_tex_parameteri(struct gl_context *ctx, return GL_FALSE; case GL_TEXTURE_WRAP_S: - if (texObj->WrapS == params[0]) + if (texObj->Sampler.WrapS == params[0]) return GL_FALSE; if (validate_texture_wrap_mode(ctx, texObj->Target, params[0])) { flush(ctx); - texObj->WrapS = params[0]; + texObj->Sampler.WrapS = params[0]; return GL_TRUE; } return GL_FALSE; case GL_TEXTURE_WRAP_T: - if (texObj->WrapT == params[0]) + if (texObj->Sampler.WrapT == params[0]) return GL_FALSE; if (validate_texture_wrap_mode(ctx, texObj->Target, params[0])) { flush(ctx); - texObj->WrapT = params[0]; + texObj->Sampler.WrapT = params[0]; return GL_TRUE; } return GL_FALSE; case GL_TEXTURE_WRAP_R: - if (texObj->WrapR == params[0]) + if (texObj->Sampler.WrapR == params[0]) return GL_FALSE; if (validate_texture_wrap_mode(ctx, texObj->Target, params[0])) { flush(ctx); - texObj->WrapR = params[0]; + texObj->Sampler.WrapR = params[0]; return GL_TRUE; } return GL_FALSE; @@ -318,12 +318,12 @@ set_tex_parameteri(struct gl_context *ctx, case GL_TEXTURE_COMPARE_MODE_ARB: if (ctx->Extensions.ARB_shadow) { - if (texObj->CompareMode == params[0]) + if (texObj->Sampler.CompareMode == params[0]) return GL_FALSE; if (params[0] == GL_NONE || params[0] == GL_COMPARE_R_TO_TEXTURE_ARB) { flush(ctx); - texObj->CompareMode = params[0]; + texObj->Sampler.CompareMode = params[0]; return GL_TRUE; } goto invalid_param; @@ -332,13 +332,13 @@ set_tex_parameteri(struct gl_context *ctx, case GL_TEXTURE_COMPARE_FUNC_ARB: if (ctx->Extensions.ARB_shadow) { - if (texObj->CompareFunc == params[0]) + if (texObj->Sampler.CompareFunc == params[0]) return GL_FALSE; switch (params[0]) { case GL_LEQUAL: case GL_GEQUAL: flush(ctx); - texObj->CompareFunc = params[0]; + texObj->Sampler.CompareFunc = params[0]; return GL_TRUE; case GL_EQUAL: case GL_NOTEQUAL: @@ -348,7 +348,7 @@ set_tex_parameteri(struct gl_context *ctx, case GL_NEVER: if (ctx->Extensions.EXT_shadow_funcs) { flush(ctx); - texObj->CompareFunc = params[0]; + texObj->Sampler.CompareFunc = params[0]; return GL_TRUE; } /* fall-through */ @@ -360,14 +360,14 @@ set_tex_parameteri(struct gl_context *ctx, case GL_DEPTH_TEXTURE_MODE_ARB: if (ctx->Extensions.ARB_depth_texture) { - if (texObj->DepthMode == params[0]) + if (texObj->Sampler.DepthMode == params[0]) return GL_FALSE; if (params[0] == GL_LUMINANCE || params[0] == GL_INTENSITY || params[0] == GL_ALPHA || (ctx->Extensions.ARB_texture_rg && params[0] == GL_RED)) { flush(ctx); - texObj->DepthMode = params[0]; + texObj->Sampler.DepthMode = params[0]; return GL_TRUE; } goto invalid_param; @@ -429,9 +429,9 @@ set_tex_parameteri(struct gl_context *ctx, if (ctx->Extensions.EXT_texture_sRGB_decode) { GLenum decode = params[0]; if (decode == GL_DECODE_EXT || decode == GL_SKIP_DECODE_EXT) { - if (texObj->sRGBDecode != decode) { + if (texObj->Sampler.sRGBDecode != decode) { flush(ctx); - texObj->sRGBDecode = decode; + texObj->Sampler.sRGBDecode = decode; _mesa_update_fetch_functions(texObj); } return GL_TRUE; @@ -466,17 +466,17 @@ set_tex_parameterf(struct gl_context *ctx, { switch (pname) { case GL_TEXTURE_MIN_LOD: - if (texObj->MinLod == params[0]) + if (texObj->Sampler.MinLod == params[0]) return GL_FALSE; flush(ctx); - texObj->MinLod = params[0]; + texObj->Sampler.MinLod = params[0]; return GL_TRUE; case GL_TEXTURE_MAX_LOD: - if (texObj->MaxLod == params[0]) + if (texObj->Sampler.MaxLod == params[0]) return GL_FALSE; flush(ctx); - texObj->MaxLod = params[0]; + texObj->Sampler.MaxLod = params[0]; return GL_TRUE; case GL_TEXTURE_PRIORITY: @@ -486,7 +486,7 @@ set_tex_parameterf(struct gl_context *ctx, case GL_TEXTURE_MAX_ANISOTROPY_EXT: if (ctx->Extensions.EXT_texture_filter_anisotropic) { - if (texObj->MaxAnisotropy == params[0]) + if (texObj->Sampler.MaxAnisotropy == params[0]) return GL_FALSE; if (params[0] < 1.0) { _mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)" ); @@ -494,7 +494,7 @@ set_tex_parameterf(struct gl_context *ctx, } flush(ctx); /* clamp to max, that's what NVIDIA does */ - texObj->MaxAnisotropy = MIN2(params[0], + texObj->Sampler.MaxAnisotropy = MIN2(params[0], ctx->Const.MaxTextureMaxAnisotropy); return GL_TRUE; } @@ -508,9 +508,9 @@ set_tex_parameterf(struct gl_context *ctx, case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB: if (ctx->Extensions.ARB_shadow_ambient) { - if (texObj->CompareFailValue != params[0]) { + if (texObj->Sampler.CompareFailValue != params[0]) { flush(ctx); - texObj->CompareFailValue = CLAMP(params[0], 0.0F, 1.0F); + texObj->Sampler.CompareFailValue = CLAMP(params[0], 0.0F, 1.0F); return GL_TRUE; } } @@ -523,9 +523,9 @@ set_tex_parameterf(struct gl_context *ctx, case GL_TEXTURE_LOD_BIAS: /* NOTE: this is really part of OpenGL 1.4, not EXT_texture_lod_bias */ if (ctx->Extensions.EXT_texture_lod_bias) { - if (texObj->LodBias != params[0]) { + if (texObj->Sampler.LodBias != params[0]) { flush(ctx); - texObj->LodBias = params[0]; + texObj->Sampler.LodBias = params[0]; return GL_TRUE; } return GL_FALSE; @@ -536,15 +536,15 @@ set_tex_parameterf(struct gl_context *ctx, flush(ctx); /* ARB_texture_float disables clamping */ if (ctx->Extensions.ARB_texture_float) { - texObj->BorderColor.f[RCOMP] = params[0]; - texObj->BorderColor.f[GCOMP] = params[1]; - texObj->BorderColor.f[BCOMP] = params[2]; - texObj->BorderColor.f[ACOMP] = params[3]; + texObj->Sampler.BorderColor.f[RCOMP] = params[0]; + texObj->Sampler.BorderColor.f[GCOMP] = params[1]; + texObj->Sampler.BorderColor.f[BCOMP] = params[2]; + texObj->Sampler.BorderColor.f[ACOMP] = params[3]; } else { - texObj->BorderColor.f[RCOMP] = CLAMP(params[0], 0.0F, 1.0F); - texObj->BorderColor.f[GCOMP] = CLAMP(params[1], 0.0F, 1.0F); - texObj->BorderColor.f[BCOMP] = CLAMP(params[2], 0.0F, 1.0F); - texObj->BorderColor.f[ACOMP] = CLAMP(params[3], 0.0F, 1.0F); + texObj->Sampler.BorderColor.f[RCOMP] = CLAMP(params[0], 0.0F, 1.0F); + texObj->Sampler.BorderColor.f[GCOMP] = CLAMP(params[1], 0.0F, 1.0F); + texObj->Sampler.BorderColor.f[BCOMP] = CLAMP(params[2], 0.0F, 1.0F); + texObj->Sampler.BorderColor.f[ACOMP] = CLAMP(params[3], 0.0F, 1.0F); } return GL_TRUE; @@ -784,7 +784,7 @@ _mesa_TexParameterIiv(GLenum target, GLenum pname, const GLint *params) case GL_TEXTURE_BORDER_COLOR: FLUSH_VERTICES(ctx, _NEW_TEXTURE); /* set the integer-valued border color */ - COPY_4V(texObj->BorderColor.i, params); + COPY_4V(texObj->Sampler.BorderColor.i, params); break; default: _mesa_TexParameteriv(target, pname, params); @@ -814,7 +814,7 @@ _mesa_TexParameterIuiv(GLenum target, GLenum pname, const GLuint *params) case GL_TEXTURE_BORDER_COLOR: FLUSH_VERTICES(ctx, _NEW_TEXTURE); /* set the unsigned integer-valued border color */ - COPY_4V(texObj->BorderColor.ui, params); + COPY_4V(texObj->Sampler.BorderColor.ui, params); break; default: _mesa_TexParameteriv(target, pname, (const GLint *) params); @@ -1101,36 +1101,36 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params ) _mesa_lock_texture(ctx, obj); switch (pname) { case GL_TEXTURE_MAG_FILTER: - *params = ENUM_TO_FLOAT(obj->MagFilter); + *params = ENUM_TO_FLOAT(obj->Sampler.MagFilter); break; case GL_TEXTURE_MIN_FILTER: - *params = ENUM_TO_FLOAT(obj->MinFilter); + *params = ENUM_TO_FLOAT(obj->Sampler.MinFilter); break; case GL_TEXTURE_WRAP_S: - *params = ENUM_TO_FLOAT(obj->WrapS); + *params = ENUM_TO_FLOAT(obj->Sampler.WrapS); break; case GL_TEXTURE_WRAP_T: - *params = ENUM_TO_FLOAT(obj->WrapT); + *params = ENUM_TO_FLOAT(obj->Sampler.WrapT); break; case GL_TEXTURE_WRAP_R: - *params = ENUM_TO_FLOAT(obj->WrapR); + *params = ENUM_TO_FLOAT(obj->Sampler.WrapR); break; case GL_TEXTURE_BORDER_COLOR: if(ctx->NewState & (_NEW_BUFFERS | _NEW_FRAG_CLAMP)) _mesa_update_state_locked(ctx); if(ctx->Color._ClampFragmentColor) { - params[0] = CLAMP(obj->BorderColor.f[0], 0.0F, 1.0F); - params[1] = CLAMP(obj->BorderColor.f[1], 0.0F, 1.0F); - params[2] = CLAMP(obj->BorderColor.f[2], 0.0F, 1.0F); - params[3] = CLAMP(obj->BorderColor.f[3], 0.0F, 1.0F); + params[0] = CLAMP(obj->Sampler.BorderColor.f[0], 0.0F, 1.0F); + params[1] = CLAMP(obj->Sampler.BorderColor.f[1], 0.0F, 1.0F); + params[2] = CLAMP(obj->Sampler.BorderColor.f[2], 0.0F, 1.0F); + params[3] = CLAMP(obj->Sampler.BorderColor.f[3], 0.0F, 1.0F); } else { - params[0] = obj->BorderColor.f[0]; - params[1] = obj->BorderColor.f[1]; - params[2] = obj->BorderColor.f[2]; - params[3] = obj->BorderColor.f[3]; + params[0] = obj->Sampler.BorderColor.f[0]; + params[1] = obj->Sampler.BorderColor.f[1]; + params[2] = obj->Sampler.BorderColor.f[2]; + params[3] = obj->Sampler.BorderColor.f[3]; } break; case GL_TEXTURE_RESIDENT: @@ -1147,10 +1147,10 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params ) *params = obj->Priority; break; case GL_TEXTURE_MIN_LOD: - *params = obj->MinLod; + *params = obj->Sampler.MinLod; break; case GL_TEXTURE_MAX_LOD: - *params = obj->MaxLod; + *params = obj->Sampler.MaxLod; break; case GL_TEXTURE_BASE_LEVEL: *params = (GLfloat) obj->BaseLevel; @@ -1160,14 +1160,14 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params ) break; case GL_TEXTURE_MAX_ANISOTROPY_EXT: if (ctx->Extensions.EXT_texture_filter_anisotropic) { - *params = obj->MaxAnisotropy; + *params = obj->Sampler.MaxAnisotropy; } else error = GL_TRUE; break; case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB: if (ctx->Extensions.ARB_shadow_ambient) { - *params = obj->CompareFailValue; + *params = obj->Sampler.CompareFailValue; } else error = GL_TRUE; @@ -1177,28 +1177,28 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params ) break; case GL_TEXTURE_COMPARE_MODE_ARB: if (ctx->Extensions.ARB_shadow) { - *params = (GLfloat) obj->CompareMode; + *params = (GLfloat) obj->Sampler.CompareMode; } else error = GL_TRUE; break; case GL_TEXTURE_COMPARE_FUNC_ARB: if (ctx->Extensions.ARB_shadow) { - *params = (GLfloat) obj->CompareFunc; + *params = (GLfloat) obj->Sampler.CompareFunc; } else error = GL_TRUE; break; case GL_DEPTH_TEXTURE_MODE_ARB: if (ctx->Extensions.ARB_depth_texture) { - *params = (GLfloat) obj->DepthMode; + *params = (GLfloat) obj->Sampler.DepthMode; } else error = GL_TRUE; break; case GL_TEXTURE_LOD_BIAS: if (ctx->Extensions.EXT_texture_lod_bias) { - *params = obj->LodBias; + *params = obj->Sampler.LodBias; } else error = GL_TRUE; @@ -1265,27 +1265,27 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params ) _mesa_lock_texture(ctx, obj); switch (pname) { case GL_TEXTURE_MAG_FILTER: - *params = (GLint) obj->MagFilter; + *params = (GLint) obj->Sampler.MagFilter; break;; case GL_TEXTURE_MIN_FILTER: - *params = (GLint) obj->MinFilter; + *params = (GLint) obj->Sampler.MinFilter; break;; case GL_TEXTURE_WRAP_S: - *params = (GLint) obj->WrapS; + *params = (GLint) obj->Sampler.WrapS; break;; case GL_TEXTURE_WRAP_T: - *params = (GLint) obj->WrapT; + *params = (GLint) obj->Sampler.WrapT; break;; case GL_TEXTURE_WRAP_R: - *params = (GLint) obj->WrapR; + *params = (GLint) obj->Sampler.WrapR; break;; case GL_TEXTURE_BORDER_COLOR: { GLfloat b[4]; - b[0] = CLAMP(obj->BorderColor.f[0], 0.0F, 1.0F); - b[1] = CLAMP(obj->BorderColor.f[1], 0.0F, 1.0F); - b[2] = CLAMP(obj->BorderColor.f[2], 0.0F, 1.0F); - b[3] = CLAMP(obj->BorderColor.f[3], 0.0F, 1.0F); + b[0] = CLAMP(obj->Sampler.BorderColor.f[0], 0.0F, 1.0F); + b[1] = CLAMP(obj->Sampler.BorderColor.f[1], 0.0F, 1.0F); + b[2] = CLAMP(obj->Sampler.BorderColor.f[2], 0.0F, 1.0F); + b[3] = CLAMP(obj->Sampler.BorderColor.f[3], 0.0F, 1.0F); params[0] = FLOAT_TO_INT(b[0]); params[1] = FLOAT_TO_INT(b[1]); params[2] = FLOAT_TO_INT(b[2]); @@ -1306,10 +1306,10 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params ) *params = FLOAT_TO_INT(obj->Priority); break;; case GL_TEXTURE_MIN_LOD: - *params = (GLint) obj->MinLod; + *params = (GLint) obj->Sampler.MinLod; break;; case GL_TEXTURE_MAX_LOD: - *params = (GLint) obj->MaxLod; + *params = (GLint) obj->Sampler.MaxLod; break;; case GL_TEXTURE_BASE_LEVEL: *params = obj->BaseLevel; @@ -1319,7 +1319,7 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params ) break;; case GL_TEXTURE_MAX_ANISOTROPY_EXT: if (ctx->Extensions.EXT_texture_filter_anisotropic) { - *params = (GLint) obj->MaxAnisotropy; + *params = (GLint) obj->Sampler.MaxAnisotropy; } else { error = GL_TRUE; @@ -1327,7 +1327,7 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params ) break; case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB: if (ctx->Extensions.ARB_shadow_ambient) { - *params = (GLint) FLOAT_TO_INT(obj->CompareFailValue); + *params = (GLint) FLOAT_TO_INT(obj->Sampler.CompareFailValue); } else { error = GL_TRUE; @@ -1338,7 +1338,7 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params ) break; case GL_TEXTURE_COMPARE_MODE_ARB: if (ctx->Extensions.ARB_shadow) { - *params = (GLint) obj->CompareMode; + *params = (GLint) obj->Sampler.CompareMode; } else { error = GL_TRUE; @@ -1346,7 +1346,7 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params ) break; case GL_TEXTURE_COMPARE_FUNC_ARB: if (ctx->Extensions.ARB_shadow) { - *params = (GLint) obj->CompareFunc; + *params = (GLint) obj->Sampler.CompareFunc; } else { error = GL_TRUE; @@ -1354,7 +1354,7 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params ) break; case GL_DEPTH_TEXTURE_MODE_ARB: if (ctx->Extensions.ARB_depth_texture) { - *params = (GLint) obj->DepthMode; + *params = (GLint) obj->Sampler.DepthMode; } else { error = GL_TRUE; @@ -1362,7 +1362,7 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params ) break; case GL_TEXTURE_LOD_BIAS: if (ctx->Extensions.EXT_texture_lod_bias) { - *params = (GLint) obj->LodBias; + *params = (GLint) obj->Sampler.LodBias; } else { error = GL_TRUE; @@ -1422,7 +1422,7 @@ _mesa_GetTexParameterIiv(GLenum target, GLenum pname, GLint *params) switch (pname) { case GL_TEXTURE_BORDER_COLOR: - COPY_4V(params, texObj->BorderColor.i); + COPY_4V(params, texObj->Sampler.BorderColor.i); break; default: _mesa_GetTexParameteriv(target, pname, params); @@ -1442,7 +1442,7 @@ _mesa_GetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params) switch (pname) { case GL_TEXTURE_BORDER_COLOR: - COPY_4V(params, texObj->BorderColor.i); + COPY_4V(params, texObj->Sampler.BorderColor.i); break; default: { diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 82e69ae11b5..1810b88b2bf 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -407,7 +407,7 @@ update_tex_combine(struct gl_context *ctx, struct gl_texture_unit *texUnit) } else if (format == GL_DEPTH_COMPONENT || format == GL_DEPTH_STENCIL_EXT) { - format = texObj->DepthMode; + format = texObj->Sampler.DepthMode; } calculate_derived_texenv(&texUnit->_EnvMode, texUnit->EnvMode, format); texUnit->_CurrentCombine = & texUnit->_EnvMode; @@ -827,6 +827,12 @@ _mesa_free_texture_data(struct gl_context *ctx) /* GL_ARB_texture_buffer_object */ _mesa_reference_buffer_object(ctx, &ctx->Texture.BufferObject, NULL); + +#if FEATURE_sampler_objects + for (u = 0; u < Elements(ctx->Texture.Unit); u++) { + _mesa_reference_sampler_object(ctx, &ctx->Texture.Unit[u].Sampler, NULL); + } +#endif } diff --git a/src/mesa/program/prog_statevars.c b/src/mesa/program/prog_statevars.c index 384aa2cb2c6..1fd26f44d56 100644 --- a/src/mesa/program/prog_statevars.c +++ b/src/mesa/program/prog_statevars.c @@ -582,7 +582,7 @@ _mesa_fetch_state(struct gl_context *ctx, const gl_state_index state[], value[0] = value[1] = value[2] = - value[3] = texObj->CompareFailValue; + value[3] = texObj->Sampler.CompareFailValue; } } return; diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c index 19d41e7061a..808aa73a083 100644 --- a/src/mesa/state_tracker/st_atom_sampler.c +++ b/src/mesa/state_tracker/st_atom_sampler.c @@ -38,6 +38,7 @@ #include "st_cb_texture.h" #include "st_format.h" #include "st_atom.h" +#include "st_texture.h" #include "pipe/p_context.h" #include "pipe/p_defines.h" @@ -138,6 +139,7 @@ update_samplers(struct st_context *st) if (samplersUsed & (1 << su)) { struct gl_texture_object *texobj; struct gl_texture_image *teximg; + struct gl_sampler_object *msamp; GLuint texUnit; if (fprog->Base.SamplersUsed & (1 << su)) @@ -152,25 +154,27 @@ update_samplers(struct st_context *st) teximg = texobj->Image[0][texobj->BaseLevel]; - sampler->wrap_s = gl_wrap_xlate(texobj->WrapS); - sampler->wrap_t = gl_wrap_xlate(texobj->WrapT); - sampler->wrap_r = gl_wrap_xlate(texobj->WrapR); + msamp = st_get_mesa_sampler(st->ctx, texUnit); - sampler->min_img_filter = gl_filter_to_img_filter(texobj->MinFilter); - sampler->min_mip_filter = gl_filter_to_mip_filter(texobj->MinFilter); - sampler->mag_img_filter = gl_filter_to_img_filter(texobj->MagFilter); + sampler->wrap_s = gl_wrap_xlate(msamp->WrapS); + sampler->wrap_t = gl_wrap_xlate(msamp->WrapT); + sampler->wrap_r = gl_wrap_xlate(msamp->WrapR); + + sampler->min_img_filter = gl_filter_to_img_filter(msamp->MinFilter); + sampler->min_mip_filter = gl_filter_to_mip_filter(msamp->MinFilter); + sampler->mag_img_filter = gl_filter_to_img_filter(msamp->MagFilter); if (texobj->Target != GL_TEXTURE_RECTANGLE_ARB) sampler->normalized_coords = 1; sampler->lod_bias = st->ctx->Texture.Unit[texUnit].LodBias + - texobj->LodBias; + msamp->LodBias; - sampler->min_lod = CLAMP(texobj->MinLod, + sampler->min_lod = CLAMP(msamp->MinLod, 0.0f, (GLfloat) texobj->MaxLevel - texobj->BaseLevel); sampler->max_lod = MIN2((GLfloat) texobj->MaxLevel - texobj->BaseLevel, - texobj->MaxLod); + msamp->MaxLod); if (sampler->max_lod < sampler->min_lod) { /* The GL spec doesn't seem to specify what to do in this case. * Swap the values. @@ -181,17 +185,18 @@ update_samplers(struct st_context *st) assert(sampler->min_lod <= sampler->max_lod); } - st_translate_color(texobj->BorderColor.f, + st_translate_color(msamp->BorderColor.f, teximg ? teximg->_BaseFormat : GL_RGBA, sampler->border_color); - sampler->max_anisotropy = (texobj->MaxAnisotropy == 1.0 ? 0 : (GLuint)texobj->MaxAnisotropy); + sampler->max_anisotropy = (msamp->MaxAnisotropy == 1.0 ? + 0 : (GLuint) msamp->MaxAnisotropy); /* only care about ARB_shadow, not SGI shadow */ - if (texobj->CompareMode == GL_COMPARE_R_TO_TEXTURE) { + if (msamp->CompareMode == GL_COMPARE_R_TO_TEXTURE) { sampler->compare_mode = PIPE_TEX_COMPARE_R_TO_TEXTURE; sampler->compare_func - = st_compare_func_to_pipe(texobj->CompareFunc); + = st_compare_func_to_pipe(msamp->CompareFunc); } st->state.num_samplers = su + 1; diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c index 6b9f969ac00..e5fb8f86878 100644 --- a/src/mesa/state_tracker/st_atom_texture.c +++ b/src/mesa/state_tracker/st_atom_texture.c @@ -138,12 +138,13 @@ check_sampler_swizzle(struct pipe_sampler_view *sv, static INLINE struct pipe_sampler_view * st_create_texture_sampler_view_from_stobj(struct pipe_context *pipe, struct st_texture_object *stObj, + const struct gl_sampler_object *samp, enum pipe_format format) { struct pipe_sampler_view templ; GLuint swizzle = apply_depthmode(stObj->pt->format, stObj->base._Swizzle, - stObj->base.DepthMode); + samp->DepthMode); u_sampler_view_default_template(&templ, stObj->pt, @@ -164,6 +165,7 @@ st_create_texture_sampler_view_from_stobj(struct pipe_context *pipe, static INLINE struct pipe_sampler_view * st_get_texture_sampler_view_from_stobj(struct st_texture_object *stObj, struct pipe_context *pipe, + const struct gl_sampler_object *samp, enum pipe_format format) { if (!stObj || !stObj->pt) { @@ -172,7 +174,7 @@ st_get_texture_sampler_view_from_stobj(struct st_texture_object *stObj, if (!stObj->sampler_view) { stObj->sampler_view = - st_create_texture_sampler_view_from_stobj(pipe, stObj, format); + st_create_texture_sampler_view_from_stobj(pipe, stObj, samp, format); } return stObj->sampler_view; @@ -200,16 +202,20 @@ update_textures(struct st_context *st) struct st_texture_object *stObj; GLboolean retval; GLuint texUnit; + const struct gl_sampler_object *samp; if (fprog->Base.SamplersUsed & (1 << su)) texUnit = fprog->Base.SamplerUnits[su]; else texUnit = vprog->Base.SamplerUnits[su]; + samp = st_get_mesa_sampler(st->ctx, texUnit); + texObj = st->ctx->Texture.Unit[texUnit]._Current; if (!texObj) { texObj = st_get_default_texture(st); + samp = &texObj->Sampler; } stObj = st_texture_object(texObj); @@ -228,7 +234,7 @@ update_textures(struct st_context *st) enum pipe_format firstImageFormat = st_mesa_format_to_pipe_format(texFormat); - if ((stObj->base.sRGBDecode == GL_SKIP_DECODE_EXT) && + if ((samp->sRGBDecode == GL_SKIP_DECODE_EXT) && (_mesa_get_format_color_encoding(texFormat) == GL_SRGB)) { /* don't do sRGB->RGB conversion. Interpret the texture * texture data as linear values. @@ -248,12 +254,14 @@ update_textures(struct st_context *st) if (stObj->sampler_view) if (check_sampler_swizzle(stObj->sampler_view, stObj->base._Swizzle, - stObj->base.DepthMode) || + samp->DepthMode) || (st_view_format != stObj->sampler_view->format) || stObj->base.BaseLevel != stObj->sampler_view->u.tex.first_level) pipe_sampler_view_reference(&stObj->sampler_view, NULL); - sampler_view = st_get_texture_sampler_view_from_stobj(stObj, pipe, st_view_format); + sampler_view = st_get_texture_sampler_view_from_stobj(stObj, pipe, + samp, + st_view_format); } pipe_sampler_view_reference(&st->state.sampler_views[su], sampler_view); } diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 302f2e1fa17..914c06b7023 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -362,8 +362,8 @@ guess_and_alloc_texture(struct st_context *st, * to re-allocating a texture buffer with space for more (or fewer) * mipmap levels later. */ - if ((stObj->base.MinFilter == GL_NEAREST || - stObj->base.MinFilter == GL_LINEAR || + if ((stObj->base.Sampler.MinFilter == GL_NEAREST || + stObj->base.Sampler.MinFilter == GL_LINEAR || stImage->base._BaseFormat == GL_DEPTH_COMPONENT || stImage->base._BaseFormat == GL_DEPTH_STENCIL_EXT) && !stObj->base.GenerateMipmap && @@ -1742,8 +1742,8 @@ st_finalize_texture(struct gl_context *ctx, * incomplete. In that case, we'll have set stObj->lastLevel before * we get here. */ - if (stObj->base.MinFilter == GL_LINEAR || - stObj->base.MinFilter == GL_NEAREST) + if (stObj->base.Sampler.MinFilter == GL_LINEAR || + stObj->base.Sampler.MinFilter == GL_NEAREST) stObj->lastLevel = stObj->base.BaseLevel; else stObj->lastLevel = stObj->base._MaxLevel; @@ -1890,8 +1890,8 @@ st_get_default_texture(struct st_context *st) texObj, texImg, 0, 0); - texObj->MinFilter = GL_NEAREST; - texObj->MagFilter = GL_NEAREST; + texObj->Sampler.MinFilter = GL_NEAREST; + texObj->Sampler.MagFilter = GL_NEAREST; texObj->_Complete = GL_TRUE; st->default_texture = texObj; diff --git a/src/mesa/state_tracker/st_texture.h b/src/mesa/state_tracker/st_texture.h index d50c3c9af79..903e30df52f 100644 --- a/src/mesa/state_tracker/st_texture.h +++ b/src/mesa/state_tracker/st_texture.h @@ -163,6 +163,21 @@ st_get_texture_sampler_view(struct st_texture_object *stObj, } +/** + * Get pointer to the active sampler object for the given texture unit. + * This will either be a user-defined sampler object or the texture + * object's own sampler state. + */ +static INLINE struct gl_sampler_object * +st_get_mesa_sampler(const struct gl_context *ctx, GLuint unit) +{ + if (ctx->Texture.Unit[unit].Sampler) + return ctx->Texture.Unit[unit].Sampler; + else + return &ctx->Texture.Unit[unit]._Current->Sampler; +} + + extern struct pipe_resource * st_texture_create(struct st_context *st, enum pipe_texture_target target, diff --git a/src/mesa/swrast/s_fragprog.c b/src/mesa/swrast/s_fragprog.c index e391043f4d9..b6bfeaed4a9 100644 --- a/src/mesa/swrast/s_fragprog.c +++ b/src/mesa/swrast/s_fragprog.c @@ -71,7 +71,7 @@ fetch_texel_lod( struct gl_context *ctx, const GLfloat texcoord[4], GLfloat lamb SWcontext *swrast = SWRAST_CONTEXT(ctx); GLfloat rgba[4]; - lambda = CLAMP(lambda, texObj->MinLod, texObj->MaxLod); + lambda = CLAMP(lambda, texObj->Sampler.MinLod, texObj->Sampler.MaxLod); swrast->TextureSample[unit](ctx, texObj, 1, (const GLfloat (*)[4]) texcoord, @@ -115,9 +115,9 @@ fetch_texel_deriv( struct gl_context *ctx, const GLfloat texcoord[4], texcoord[0], texcoord[1], texcoord[3], 1.0F / texcoord[3]); - lambda += lodBias + texUnit->LodBias + texObj->LodBias; + lambda += lodBias + texUnit->LodBias + texObj->Sampler.LodBias; - lambda = CLAMP(lambda, texObj->MinLod, texObj->MaxLod); + lambda = CLAMP(lambda, texObj->Sampler.MinLod, texObj->Sampler.MaxLod); swrast->TextureSample[unit](ctx, texObj, 1, (const GLfloat (*)[4]) texcoord, diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c index ef38a6b22b8..9cfecc9e3a4 100644 --- a/src/mesa/swrast/s_span.c +++ b/src/mesa/swrast/s_span.c @@ -490,7 +490,7 @@ interpolate_texcoords(struct gl_context *ctx, SWspan *span) if (obj) { const struct gl_texture_image *img = obj->Image[0][obj->BaseLevel]; - needLambda = (obj->MinFilter != obj->MagFilter) + needLambda = (obj->Sampler.MinFilter != obj->Sampler.MagFilter) || ctx->FragmentProgram._Current; texW = img->WidthScale; texH = img->HeightScale; diff --git a/src/mesa/swrast/s_texcombine.c b/src/mesa/swrast/s_texcombine.c index 0c8cc9ff37b..7f49b6ffa50 100644 --- a/src/mesa/swrast/s_texcombine.c +++ b/src/mesa/swrast/s_texcombine.c @@ -631,9 +631,9 @@ _swrast_texture_span( struct gl_context *ctx, SWspan *span ) /* adjust texture lod (lambda) */ if (span->arrayMask & SPAN_LAMBDA) { - if (texUnit->LodBias + curObj->LodBias != 0.0F) { + if (texUnit->LodBias + curObj->Sampler.LodBias != 0.0F) { /* apply LOD bias, but don't clamp yet */ - const GLfloat bias = CLAMP(texUnit->LodBias + curObj->LodBias, + const GLfloat bias = CLAMP(texUnit->LodBias + curObj->Sampler.LodBias, -ctx->Const.MaxTextureLodBias, ctx->Const.MaxTextureLodBias); GLuint i; @@ -642,10 +642,11 @@ _swrast_texture_span( struct gl_context *ctx, SWspan *span ) } } - if (curObj->MinLod != -1000.0 || curObj->MaxLod != 1000.0) { + if (curObj->Sampler.MinLod != -1000.0 || + curObj->Sampler.MaxLod != 1000.0) { /* apply LOD clamping to lambda */ - const GLfloat min = curObj->MinLod; - const GLfloat max = curObj->MaxLod; + const GLfloat min = curObj->Sampler.MinLod; + const GLfloat max = curObj->Sampler.MaxLod; GLuint i; for (i = 0; i < span->end; i++) { GLfloat l = lambda[i]; @@ -686,9 +687,9 @@ _swrast_texture_span( struct gl_context *ctx, SWspan *span ) /* adjust texture lod (lambda) */ if (span->arrayMask & SPAN_LAMBDA) { - if (texUnit->LodBias + curObj->LodBias != 0.0F) { + if (texUnit->LodBias + curObj->Sampler.LodBias != 0.0F) { /* apply LOD bias, but don't clamp yet */ - const GLfloat bias = CLAMP(texUnit->LodBias + curObj->LodBias, + const GLfloat bias = CLAMP(texUnit->LodBias + curObj->Sampler.LodBias, -ctx->Const.MaxTextureLodBias, ctx->Const.MaxTextureLodBias); GLuint i; @@ -697,10 +698,11 @@ _swrast_texture_span( struct gl_context *ctx, SWspan *span ) } } - if (curObj->MinLod != -1000.0 || curObj->MaxLod != 1000.0) { + if (curObj->Sampler.MinLod != -1000.0 || + curObj->Sampler.MaxLod != 1000.0) { /* apply LOD clamping to lambda */ - const GLfloat min = curObj->MinLod; - const GLfloat max = curObj->MaxLod; + const GLfloat min = curObj->Sampler.MinLod; + const GLfloat max = curObj->Sampler.MaxLod; GLuint i; for (i = 0; i < span->end; i++) { GLfloat l = lambda[i]; diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c index 42785400c0e..106f8b75f9e 100644 --- a/src/mesa/swrast/s_texfilter.c +++ b/src/mesa/swrast/s_texfilter.c @@ -505,28 +505,28 @@ nearest_texcoord(const struct gl_texture_object *texObj, switch (texObj->Target) { case GL_TEXTURE_RECTANGLE_ARB: - *i = clamp_rect_coord_nearest(texObj->WrapS, texcoord[0], width); - *j = clamp_rect_coord_nearest(texObj->WrapT, texcoord[1], height); + *i = clamp_rect_coord_nearest(texObj->Sampler.WrapS, texcoord[0], width); + *j = clamp_rect_coord_nearest(texObj->Sampler.WrapT, texcoord[1], height); *k = 0; break; case GL_TEXTURE_1D: - *i = nearest_texel_location(texObj->WrapS, img, width, texcoord[0]); + *i = nearest_texel_location(texObj->Sampler.WrapS, img, width, texcoord[0]); *j = 0; *k = 0; break; case GL_TEXTURE_2D: - *i = nearest_texel_location(texObj->WrapS, img, width, texcoord[0]); - *j = nearest_texel_location(texObj->WrapT, img, height, texcoord[1]); + *i = nearest_texel_location(texObj->Sampler.WrapS, img, width, texcoord[0]); + *j = nearest_texel_location(texObj->Sampler.WrapT, img, height, texcoord[1]); *k = 0; break; case GL_TEXTURE_1D_ARRAY_EXT: - *i = nearest_texel_location(texObj->WrapS, img, width, texcoord[0]); + *i = nearest_texel_location(texObj->Sampler.WrapS, img, width, texcoord[0]); *j = tex_array_slice(texcoord[1], height); *k = 0; break; case GL_TEXTURE_2D_ARRAY_EXT: - *i = nearest_texel_location(texObj->WrapS, img, width, texcoord[0]); - *j = nearest_texel_location(texObj->WrapT, img, height, texcoord[1]); + *i = nearest_texel_location(texObj->Sampler.WrapS, img, width, texcoord[0]); + *j = nearest_texel_location(texObj->Sampler.WrapT, img, height, texcoord[1]); *k = tex_array_slice(texcoord[2], depth); break; default: @@ -553,24 +553,24 @@ linear_texcoord(const struct gl_texture_object *texObj, switch (texObj->Target) { case GL_TEXTURE_RECTANGLE_ARB: - clamp_rect_coord_linear(texObj->WrapS, texcoord[0], + clamp_rect_coord_linear(texObj->Sampler.WrapS, texcoord[0], width, i0, i1, wi); - clamp_rect_coord_linear(texObj->WrapT, texcoord[1], + clamp_rect_coord_linear(texObj->Sampler.WrapT, texcoord[1], height, j0, j1, wj); *slice = 0; break; case GL_TEXTURE_1D: case GL_TEXTURE_2D: - linear_texel_locations(texObj->WrapS, img, width, + linear_texel_locations(texObj->Sampler.WrapS, img, width, texcoord[0], i0, i1, wi); - linear_texel_locations(texObj->WrapT, img, height, + linear_texel_locations(texObj->Sampler.WrapT, img, height, texcoord[1], j0, j1, wj); *slice = 0; break; case GL_TEXTURE_1D_ARRAY_EXT: - linear_texel_locations(texObj->WrapS, img, width, + linear_texel_locations(texObj->Sampler.WrapS, img, width, texcoord[0], i0, i1, wi); *j0 = tex_array_slice(texcoord[1], height); *j1 = *j0; @@ -578,9 +578,9 @@ linear_texcoord(const struct gl_texture_object *texObj, break; case GL_TEXTURE_2D_ARRAY_EXT: - linear_texel_locations(texObj->WrapS, img, width, + linear_texel_locations(texObj->Sampler.WrapS, img, width, texcoord[0], i0, i1, wi); - linear_texel_locations(texObj->WrapT, img, height, + linear_texel_locations(texObj->Sampler.WrapT, img, height, texcoord[1], j0, j1, wj); *slice = tex_array_slice(texcoord[2], depth); break; @@ -656,12 +656,12 @@ compute_min_mag_ranges(const struct gl_texture_object *tObj, GLfloat minMagThresh; /* we shouldn't be here if minfilter == magfilter */ - ASSERT(tObj->MinFilter != tObj->MagFilter); + ASSERT(tObj->Sampler.MinFilter != tObj->Sampler.MagFilter); /* This bit comes from the OpenGL spec: */ - if (tObj->MagFilter == GL_LINEAR - && (tObj->MinFilter == GL_NEAREST_MIPMAP_NEAREST || - tObj->MinFilter == GL_NEAREST_MIPMAP_LINEAR)) { + if (tObj->Sampler.MagFilter == GL_LINEAR + && (tObj->Sampler.MinFilter == GL_NEAREST_MIPMAP_NEAREST || + tObj->Sampler.MinFilter == GL_NEAREST_MIPMAP_LINEAR)) { minMagThresh = 0.5F; } else { @@ -763,28 +763,28 @@ get_border_color(const struct gl_texture_object *tObj, { switch (img->_BaseFormat) { case GL_RGB: - rgba[0] = tObj->BorderColor.f[0]; - rgba[1] = tObj->BorderColor.f[1]; - rgba[2] = tObj->BorderColor.f[2]; + rgba[0] = tObj->Sampler.BorderColor.f[0]; + rgba[1] = tObj->Sampler.BorderColor.f[1]; + rgba[2] = tObj->Sampler.BorderColor.f[2]; rgba[3] = 1.0F; break; case GL_ALPHA: rgba[0] = rgba[1] = rgba[2] = 0.0; - rgba[3] = tObj->BorderColor.f[3]; + rgba[3] = tObj->Sampler.BorderColor.f[3]; break; case GL_LUMINANCE: - rgba[0] = rgba[1] = rgba[2] = tObj->BorderColor.f[0]; + rgba[0] = rgba[1] = rgba[2] = tObj->Sampler.BorderColor.f[0]; rgba[3] = 1.0; break; case GL_LUMINANCE_ALPHA: - rgba[0] = rgba[1] = rgba[2] = tObj->BorderColor.f[0]; - rgba[3] = tObj->BorderColor.f[3]; + rgba[0] = rgba[1] = rgba[2] = tObj->Sampler.BorderColor.f[0]; + rgba[3] = tObj->Sampler.BorderColor.f[3]; break; case GL_INTENSITY: - rgba[0] = rgba[1] = rgba[2] = rgba[3] = tObj->BorderColor.f[0]; + rgba[0] = rgba[1] = rgba[2] = rgba[3] = tObj->Sampler.BorderColor.f[0]; break; default: - COPY_4V(rgba, tObj->BorderColor.f); + COPY_4V(rgba, tObj->Sampler.BorderColor.f); } } @@ -804,7 +804,7 @@ sample_1d_nearest(struct gl_context *ctx, { const GLint width = img->Width2; /* without border, power of two */ GLint i; - i = nearest_texel_location(tObj->WrapS, img, width, texcoord[0]); + i = nearest_texel_location(tObj->Sampler.WrapS, img, width, texcoord[0]); /* skip over the border, if any */ i += img->Border; if (i < 0 || i >= (GLint) img->Width) { @@ -832,7 +832,7 @@ sample_1d_linear(struct gl_context *ctx, GLfloat a; GLfloat t0[4], t1[4]; /* texels */ - linear_texel_locations(tObj->WrapS, img, width, texcoord[0], &i0, &i1, &a); + linear_texel_locations(tObj->Sampler.WrapS, img, width, texcoord[0], &i0, &i1, &a); if (img->Border) { i0 += img->Border; @@ -991,7 +991,7 @@ sample_lambda_1d( struct gl_context *ctx, if (minStart < minEnd) { /* do the minified texels */ const GLuint m = minEnd - minStart; - switch (tObj->MinFilter) { + switch (tObj->Sampler.MinFilter) { case GL_NEAREST: for (i = minStart; i < minEnd; i++) sample_1d_nearest(ctx, tObj, tObj->Image[0][tObj->BaseLevel], @@ -1026,7 +1026,7 @@ sample_lambda_1d( struct gl_context *ctx, if (magStart < magEnd) { /* do the magnified texels */ - switch (tObj->MagFilter) { + switch (tObj->Sampler.MagFilter) { case GL_NEAREST: for (i = magStart; i < magEnd; i++) sample_1d_nearest(ctx, tObj, tObj->Image[0][tObj->BaseLevel], @@ -1065,8 +1065,8 @@ sample_2d_nearest(struct gl_context *ctx, GLint i, j; (void) ctx; - i = nearest_texel_location(tObj->WrapS, img, width, texcoord[0]); - j = nearest_texel_location(tObj->WrapT, img, height, texcoord[1]); + i = nearest_texel_location(tObj->Sampler.WrapS, img, width, texcoord[0]); + j = nearest_texel_location(tObj->Sampler.WrapT, img, height, texcoord[1]); /* skip over the border, if any */ i += img->Border; @@ -1100,8 +1100,8 @@ sample_2d_linear(struct gl_context *ctx, GLfloat a, b; GLfloat t00[4], t10[4], t01[4], t11[4]; /* sampled texel colors */ - linear_texel_locations(tObj->WrapS, img, width, texcoord[0], &i0, &i1, &a); - linear_texel_locations(tObj->WrapT, img, height, texcoord[1], &j0, &j1, &b); + linear_texel_locations(tObj->Sampler.WrapS, img, width, texcoord[0], &i0, &i1, &a); + linear_texel_locations(tObj->Sampler.WrapT, img, height, texcoord[1], &j0, &j1, &b); if (img->Border) { i0 += img->Border; @@ -1165,8 +1165,8 @@ sample_2d_linear_repeat(struct gl_context *ctx, (void) ctx; - ASSERT(tObj->WrapS == GL_REPEAT); - ASSERT(tObj->WrapT == GL_REPEAT); + ASSERT(tObj->Sampler.WrapS == GL_REPEAT); + ASSERT(tObj->Sampler.WrapT == GL_REPEAT); ASSERT(img->Border == 0); ASSERT(img->_BaseFormat != GL_COLOR_INDEX); ASSERT(img->_IsPowerOfTwo); @@ -1270,8 +1270,8 @@ sample_2d_linear_mipmap_linear_repeat(struct gl_context *ctx, { GLuint i; ASSERT(lambda != NULL); - ASSERT(tObj->WrapS == GL_REPEAT); - ASSERT(tObj->WrapT == GL_REPEAT); + ASSERT(tObj->Sampler.WrapS == GL_REPEAT); + ASSERT(tObj->Sampler.WrapT == GL_REPEAT); for (i = 0; i < n; i++) { GLint level = linear_mipmap_level(tObj, lambda[i]); if (level >= tObj->_MaxLevel) { @@ -1317,8 +1317,8 @@ sample_linear_2d(struct gl_context *ctx, GLuint i; struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel]; (void) lambda; - if (tObj->WrapS == GL_REPEAT && - tObj->WrapT == GL_REPEAT && + if (tObj->Sampler.WrapS == GL_REPEAT && + tObj->Sampler.WrapT == GL_REPEAT && image->_IsPowerOfTwo && image->Border == 0) { for (i = 0; i < n; i++) { @@ -1356,8 +1356,8 @@ opt_sample_rgb_2d(struct gl_context *ctx, GLuint k; (void) ctx; (void) lambda; - ASSERT(tObj->WrapS==GL_REPEAT); - ASSERT(tObj->WrapT==GL_REPEAT); + ASSERT(tObj->Sampler.WrapS==GL_REPEAT); + ASSERT(tObj->Sampler.WrapT==GL_REPEAT); ASSERT(img->Border==0); ASSERT(img->TexFormat == MESA_FORMAT_RGB888); ASSERT(img->_IsPowerOfTwo); @@ -1398,8 +1398,8 @@ opt_sample_rgba_2d(struct gl_context *ctx, GLuint i; (void) ctx; (void) lambda; - ASSERT(tObj->WrapS==GL_REPEAT); - ASSERT(tObj->WrapT==GL_REPEAT); + ASSERT(tObj->Sampler.WrapS==GL_REPEAT); + ASSERT(tObj->Sampler.WrapT==GL_REPEAT); ASSERT(img->Border==0); ASSERT(img->TexFormat == MESA_FORMAT_RGBA8888); ASSERT(img->_IsPowerOfTwo); @@ -1428,8 +1428,8 @@ sample_lambda_2d(struct gl_context *ctx, GLuint minStart, minEnd; /* texels with minification */ GLuint magStart, magEnd; /* texels with magnification */ - const GLboolean repeatNoBorderPOT = (tObj->WrapS == GL_REPEAT) - && (tObj->WrapT == GL_REPEAT) + const GLboolean repeatNoBorderPOT = (tObj->Sampler.WrapS == GL_REPEAT) + && (tObj->Sampler.WrapT == GL_REPEAT) && (tImg->Border == 0 && (tImg->Width == tImg->RowStride)) && (tImg->_BaseFormat != GL_COLOR_INDEX) && tImg->_IsPowerOfTwo; @@ -1441,7 +1441,7 @@ sample_lambda_2d(struct gl_context *ctx, if (minStart < minEnd) { /* do the minified texels */ const GLuint m = minEnd - minStart; - switch (tObj->MinFilter) { + switch (tObj->Sampler.MinFilter) { case GL_NEAREST: if (repeatNoBorderPOT) { switch (tImg->TexFormat) { @@ -1498,7 +1498,7 @@ sample_lambda_2d(struct gl_context *ctx, /* do the magnified texels */ const GLuint m = magEnd - magStart; - switch (tObj->MagFilter) { + switch (tObj->Sampler.MagFilter) { case GL_NEAREST: if (repeatNoBorderPOT) { switch (tImg->TexFormat) { @@ -1552,9 +1552,9 @@ sample_3d_nearest(struct gl_context *ctx, GLint i, j, k; (void) ctx; - i = nearest_texel_location(tObj->WrapS, img, width, texcoord[0]); - j = nearest_texel_location(tObj->WrapT, img, height, texcoord[1]); - k = nearest_texel_location(tObj->WrapR, img, depth, texcoord[2]); + i = nearest_texel_location(tObj->Sampler.WrapS, img, width, texcoord[0]); + j = nearest_texel_location(tObj->Sampler.WrapT, img, height, texcoord[1]); + k = nearest_texel_location(tObj->Sampler.WrapR, img, depth, texcoord[2]); if (i < 0 || i >= (GLint) img->Width || j < 0 || j >= (GLint) img->Height || @@ -1587,9 +1587,9 @@ sample_3d_linear(struct gl_context *ctx, GLfloat t000[4], t010[4], t001[4], t011[4]; GLfloat t100[4], t110[4], t101[4], t111[4]; - linear_texel_locations(tObj->WrapS, img, width, texcoord[0], &i0, &i1, &a); - linear_texel_locations(tObj->WrapT, img, height, texcoord[1], &j0, &j1, &b); - linear_texel_locations(tObj->WrapR, img, depth, texcoord[2], &k0, &k1, &c); + linear_texel_locations(tObj->Sampler.WrapS, img, width, texcoord[0], &i0, &i1, &a); + linear_texel_locations(tObj->Sampler.WrapT, img, height, texcoord[1], &j0, &j1, &b); + linear_texel_locations(tObj->Sampler.WrapR, img, depth, texcoord[2], &k0, &k1, &c); if (img->Border) { i0 += img->Border; @@ -1794,7 +1794,7 @@ sample_lambda_3d(struct gl_context *ctx, if (minStart < minEnd) { /* do the minified texels */ GLuint m = minEnd - minStart; - switch (tObj->MinFilter) { + switch (tObj->Sampler.MinFilter) { case GL_NEAREST: for (i = minStart; i < minEnd; i++) sample_3d_nearest(ctx, tObj, tObj->Image[0][tObj->BaseLevel], @@ -1829,7 +1829,7 @@ sample_lambda_3d(struct gl_context *ctx, if (magStart < magEnd) { /* do the magnified texels */ - switch (tObj->MagFilter) { + switch (tObj->Sampler.MagFilter) { case GL_NEAREST: for (i = magStart; i < magEnd; i++) sample_3d_nearest(ctx, tObj, tObj->Image[0][tObj->BaseLevel], @@ -2091,7 +2091,7 @@ sample_lambda_cube(struct gl_context *ctx, if (minStart < minEnd) { /* do the minified texels */ const GLuint m = minEnd - minStart; - switch (tObj->MinFilter) { + switch (tObj->Sampler.MinFilter) { case GL_NEAREST: sample_nearest_cube(ctx, tObj, m, texcoords + minStart, lambda + minStart, rgba + minStart); @@ -2128,7 +2128,7 @@ sample_lambda_cube(struct gl_context *ctx, if (magStart < magEnd) { /* do the magnified texels */ const GLuint m = magEnd - magStart; - switch (tObj->MagFilter) { + switch (tObj->Sampler.MagFilter) { case GL_NEAREST: sample_nearest_cube(ctx, tObj, m, texcoords + magStart, lambda + magStart, rgba + magStart); @@ -2163,18 +2163,18 @@ sample_nearest_rect(struct gl_context *ctx, (void) ctx; (void) lambda; - ASSERT(tObj->WrapS == GL_CLAMP || - tObj->WrapS == GL_CLAMP_TO_EDGE || - tObj->WrapS == GL_CLAMP_TO_BORDER); - ASSERT(tObj->WrapT == GL_CLAMP || - tObj->WrapT == GL_CLAMP_TO_EDGE || - tObj->WrapT == GL_CLAMP_TO_BORDER); + ASSERT(tObj->Sampler.WrapS == GL_CLAMP || + tObj->Sampler.WrapS == GL_CLAMP_TO_EDGE || + tObj->Sampler.WrapS == GL_CLAMP_TO_BORDER); + ASSERT(tObj->Sampler.WrapT == GL_CLAMP || + tObj->Sampler.WrapT == GL_CLAMP_TO_EDGE || + tObj->Sampler.WrapT == GL_CLAMP_TO_BORDER); ASSERT(img->_BaseFormat != GL_COLOR_INDEX); for (i = 0; i < n; i++) { GLint row, col; - col = clamp_rect_coord_nearest(tObj->WrapS, texcoords[i][0], width); - row = clamp_rect_coord_nearest(tObj->WrapT, texcoords[i][1], height); + col = clamp_rect_coord_nearest(tObj->Sampler.WrapS, texcoords[i][0], width); + row = clamp_rect_coord_nearest(tObj->Sampler.WrapT, texcoords[i][1], height); if (col < 0 || col >= width || row < 0 || row >= height) get_border_color(tObj, img, rgba[i]); else @@ -2197,12 +2197,12 @@ sample_linear_rect(struct gl_context *ctx, (void) ctx; (void) lambda; - ASSERT(tObj->WrapS == GL_CLAMP || - tObj->WrapS == GL_CLAMP_TO_EDGE || - tObj->WrapS == GL_CLAMP_TO_BORDER); - ASSERT(tObj->WrapT == GL_CLAMP || - tObj->WrapT == GL_CLAMP_TO_EDGE || - tObj->WrapT == GL_CLAMP_TO_BORDER); + ASSERT(tObj->Sampler.WrapS == GL_CLAMP || + tObj->Sampler.WrapS == GL_CLAMP_TO_EDGE || + tObj->Sampler.WrapS == GL_CLAMP_TO_BORDER); + ASSERT(tObj->Sampler.WrapT == GL_CLAMP || + tObj->Sampler.WrapT == GL_CLAMP_TO_EDGE || + tObj->Sampler.WrapT == GL_CLAMP_TO_BORDER); ASSERT(img->_BaseFormat != GL_COLOR_INDEX); for (i = 0; i < n; i++) { @@ -2211,9 +2211,9 @@ sample_linear_rect(struct gl_context *ctx, GLfloat a, b; GLbitfield useBorderColor = 0x0; - clamp_rect_coord_linear(tObj->WrapS, texcoords[i][0], width, + clamp_rect_coord_linear(tObj->Sampler.WrapS, texcoords[i][0], width, &i0, &i1, &a); - clamp_rect_coord_linear(tObj->WrapT, texcoords[i][1], height, + clamp_rect_coord_linear(tObj->Sampler.WrapT, texcoords[i][1], height, &j0, &j1, &b); /* compute integer rows/columns */ @@ -2264,7 +2264,7 @@ sample_lambda_rect(struct gl_context *ctx, &minStart, &minEnd, &magStart, &magEnd); if (minStart < minEnd) { - if (tObj->MinFilter == GL_NEAREST) { + if (tObj->Sampler.MinFilter == GL_NEAREST) { sample_nearest_rect(ctx, tObj, minEnd - minStart, texcoords + minStart, NULL, rgba + minStart); } @@ -2274,7 +2274,7 @@ sample_lambda_rect(struct gl_context *ctx, } } if (magStart < magEnd) { - if (tObj->MagFilter == GL_NEAREST) { + if (tObj->Sampler.MagFilter == GL_NEAREST) { sample_nearest_rect(ctx, tObj, magEnd - magStart, texcoords + magStart, NULL, rgba + magStart); } @@ -2307,8 +2307,8 @@ sample_2d_array_nearest(struct gl_context *ctx, GLint array; (void) ctx; - i = nearest_texel_location(tObj->WrapS, img, width, texcoord[0]); - j = nearest_texel_location(tObj->WrapT, img, height, texcoord[1]); + i = nearest_texel_location(tObj->Sampler.WrapS, img, width, texcoord[0]); + j = nearest_texel_location(tObj->Sampler.WrapT, img, height, texcoord[1]); array = tex_array_slice(texcoord[2], depth); if (i < 0 || i >= (GLint) img->Width || @@ -2342,12 +2342,12 @@ sample_2d_array_linear(struct gl_context *ctx, GLfloat a, b; GLfloat t00[4], t01[4], t10[4], t11[4]; - linear_texel_locations(tObj->WrapS, img, width, texcoord[0], &i0, &i1, &a); - linear_texel_locations(tObj->WrapT, img, height, texcoord[1], &j0, &j1, &b); + linear_texel_locations(tObj->Sampler.WrapS, img, width, texcoord[0], &i0, &i1, &a); + linear_texel_locations(tObj->Sampler.WrapT, img, height, texcoord[1], &j0, &j1, &b); array = tex_array_slice(texcoord[2], depth); if (array < 0 || array >= depth) { - COPY_4V(rgba, tObj->BorderColor.f); + COPY_4V(rgba, tObj->Sampler.BorderColor.f); } else { if (img->Border) { @@ -2532,7 +2532,7 @@ sample_lambda_2d_array(struct gl_context *ctx, if (minStart < minEnd) { /* do the minified texels */ GLuint m = minEnd - minStart; - switch (tObj->MinFilter) { + switch (tObj->Sampler.MinFilter) { case GL_NEAREST: for (i = minStart; i < minEnd; i++) sample_2d_array_nearest(ctx, tObj, tObj->Image[0][tObj->BaseLevel], @@ -2575,7 +2575,7 @@ sample_lambda_2d_array(struct gl_context *ctx, if (magStart < magEnd) { /* do the magnified texels */ - switch (tObj->MagFilter) { + switch (tObj->Sampler.MagFilter) { case GL_NEAREST: for (i = magStart; i < magEnd; i++) sample_2d_array_nearest(ctx, tObj, tObj->Image[0][tObj->BaseLevel], @@ -2616,7 +2616,7 @@ sample_1d_array_nearest(struct gl_context *ctx, GLint array; (void) ctx; - i = nearest_texel_location(tObj->WrapS, img, width, texcoord[0]); + i = nearest_texel_location(tObj->Sampler.WrapS, img, width, texcoord[0]); array = tex_array_slice(texcoord[1], height); if (i < 0 || i >= (GLint) img->Width || @@ -2648,7 +2648,7 @@ sample_1d_array_linear(struct gl_context *ctx, GLfloat a; GLfloat t0[4], t1[4]; - linear_texel_locations(tObj->WrapS, img, width, texcoord[0], &i0, &i1, &a); + linear_texel_locations(tObj->Sampler.WrapS, img, width, texcoord[0], &i0, &i1, &a); array = tex_array_slice(texcoord[1], height); if (img->Border) { @@ -2813,7 +2813,7 @@ sample_lambda_1d_array(struct gl_context *ctx, if (minStart < minEnd) { /* do the minified texels */ GLuint m = minEnd - minStart; - switch (tObj->MinFilter) { + switch (tObj->Sampler.MinFilter) { case GL_NEAREST: for (i = minStart; i < minEnd; i++) sample_1d_array_nearest(ctx, tObj, tObj->Image[0][tObj->BaseLevel], @@ -2852,7 +2852,7 @@ sample_lambda_1d_array(struct gl_context *ctx, if (magStart < magEnd) { /* do the magnified texels */ - switch (tObj->MagFilter) { + switch (tObj->Sampler.MagFilter) { case GL_NEAREST: for (i = magStart; i < magEnd; i++) sample_1d_array_nearest(ctx, tObj, tObj->Image[0][tObj->BaseLevel], @@ -2975,13 +2975,13 @@ choose_depth_texture_level(const struct gl_texture_object *tObj, GLfloat lambda) { GLint level; - if (tObj->MinFilter == GL_NEAREST || tObj->MinFilter == GL_LINEAR) { + if (tObj->Sampler.MinFilter == GL_NEAREST || tObj->Sampler.MinFilter == GL_LINEAR) { /* no mipmapping - use base level */ level = tObj->BaseLevel; } else { /* choose mipmap level */ - lambda = CLAMP(lambda, tObj->MinLod, tObj->MaxLod); + lambda = CLAMP(lambda, tObj->Sampler.MinLod, tObj->Sampler.MaxLod); level = (GLint) lambda; level = CLAMP(level, tObj->BaseLevel, tObj->_MaxLevel); } @@ -3020,14 +3020,14 @@ sample_depth_texture( struct gl_context *ctx, tObj->Target == GL_TEXTURE_1D_ARRAY_EXT || tObj->Target == GL_TEXTURE_2D_ARRAY_EXT); - ambient = tObj->CompareFailValue; + ambient = tObj->Sampler.CompareFailValue; - /* XXXX if tObj->MinFilter != tObj->MagFilter, we're ignoring lambda */ + /* XXXX if tObj->Sampler.MinFilter != tObj->Sampler.MagFilter, we're ignoring lambda */ - function = (tObj->CompareMode == GL_COMPARE_R_TO_TEXTURE_ARB) ? - tObj->CompareFunc : GL_NONE; + function = (tObj->Sampler.CompareMode == GL_COMPARE_R_TO_TEXTURE_ARB) ? + tObj->Sampler.CompareFunc : GL_NONE; - if (tObj->MagFilter == GL_NEAREST) { + if (tObj->Sampler.MagFilter == GL_NEAREST) { GLuint i; for (i = 0; i < n; i++) { GLfloat depthSample, depthRef; @@ -3040,14 +3040,14 @@ sample_depth_texture( struct gl_context *ctx, img->FetchTexelf(img, col, row, slice, &depthSample); } else { - depthSample = tObj->BorderColor.f[0]; + depthSample = tObj->Sampler.BorderColor.f[0]; } depthRef = CLAMP(texcoords[i][compare_coord], 0.0F, 1.0F); result = shadow_compare(function, depthRef, depthSample, ambient); - switch (tObj->DepthMode) { + switch (tObj->Sampler.DepthMode) { case GL_LUMINANCE: ASSIGN_4V(texel[i], result, result, result, 1.0F); break; @@ -3067,7 +3067,7 @@ sample_depth_texture( struct gl_context *ctx, } else { GLuint i; - ASSERT(tObj->MagFilter == GL_LINEAR); + ASSERT(tObj->Sampler.MagFilter == GL_LINEAR); for (i = 0; i < n; i++) { GLfloat depth00, depth01, depth10, depth11, depthRef; GLint i0, i1, j0, j1; @@ -3095,21 +3095,21 @@ sample_depth_texture( struct gl_context *ctx, } if (slice < 0 || slice >= (GLint) depth) { - depth00 = tObj->BorderColor.f[0]; - depth01 = tObj->BorderColor.f[0]; - depth10 = tObj->BorderColor.f[0]; - depth11 = tObj->BorderColor.f[0]; + depth00 = tObj->Sampler.BorderColor.f[0]; + depth01 = tObj->Sampler.BorderColor.f[0]; + depth10 = tObj->Sampler.BorderColor.f[0]; + depth11 = tObj->Sampler.BorderColor.f[0]; } else { /* get four depth samples from the texture */ if (useBorderTexel & (I0BIT | J0BIT)) { - depth00 = tObj->BorderColor.f[0]; + depth00 = tObj->Sampler.BorderColor.f[0]; } else { img->FetchTexelf(img, i0, j0, slice, &depth00); } if (useBorderTexel & (I1BIT | J0BIT)) { - depth10 = tObj->BorderColor.f[0]; + depth10 = tObj->Sampler.BorderColor.f[0]; } else { img->FetchTexelf(img, i1, j0, slice, &depth10); @@ -3117,13 +3117,13 @@ sample_depth_texture( struct gl_context *ctx, if (tObj->Target != GL_TEXTURE_1D_ARRAY_EXT) { if (useBorderTexel & (I0BIT | J1BIT)) { - depth01 = tObj->BorderColor.f[0]; + depth01 = tObj->Sampler.BorderColor.f[0]; } else { img->FetchTexelf(img, i0, j1, slice, &depth01); } if (useBorderTexel & (I1BIT | J1BIT)) { - depth11 = tObj->BorderColor.f[0]; + depth11 = tObj->Sampler.BorderColor.f[0]; } else { img->FetchTexelf(img, i1, j1, slice, &depth11); @@ -3141,7 +3141,7 @@ sample_depth_texture( struct gl_context *ctx, depth00, depth01, depth10, depth11, ambient, wi, wj); - switch (tObj->DepthMode) { + switch (tObj->Sampler.DepthMode) { case GL_LUMINANCE: ASSIGN_4V(texel[i], result, result, result, 1.0F); break; @@ -3197,7 +3197,8 @@ _swrast_choose_texture_sample_func( struct gl_context *ctx, return &null_sample_func; } else { - const GLboolean needLambda = (GLboolean) (t->MinFilter != t->MagFilter); + const GLboolean needLambda = + (GLboolean) (t->Sampler.MinFilter != t->Sampler.MagFilter); const GLenum format = t->Image[0][t->BaseLevel]->_BaseFormat; switch (t->Target) { @@ -3208,11 +3209,11 @@ _swrast_choose_texture_sample_func( struct gl_context *ctx, else if (needLambda) { return &sample_lambda_1d; } - else if (t->MinFilter == GL_LINEAR) { + else if (t->Sampler.MinFilter == GL_LINEAR) { return &sample_linear_1d; } else { - ASSERT(t->MinFilter == GL_NEAREST); + ASSERT(t->Sampler.MinFilter == GL_NEAREST); return &sample_nearest_1d; } case GL_TEXTURE_2D: @@ -3222,22 +3223,22 @@ _swrast_choose_texture_sample_func( struct gl_context *ctx, else if (needLambda) { return &sample_lambda_2d; } - else if (t->MinFilter == GL_LINEAR) { + else if (t->Sampler.MinFilter == GL_LINEAR) { return &sample_linear_2d; } else { /* check for a few optimized cases */ const struct gl_texture_image *img = t->Image[0][t->BaseLevel]; - ASSERT(t->MinFilter == GL_NEAREST); - if (t->WrapS == GL_REPEAT && - t->WrapT == GL_REPEAT && + ASSERT(t->Sampler.MinFilter == GL_NEAREST); + if (t->Sampler.WrapS == GL_REPEAT && + t->Sampler.WrapT == GL_REPEAT && img->_IsPowerOfTwo && img->Border == 0 && img->TexFormat == MESA_FORMAT_RGB888) { return &opt_sample_rgb_2d; } - else if (t->WrapS == GL_REPEAT && - t->WrapT == GL_REPEAT && + else if (t->Sampler.WrapS == GL_REPEAT && + t->Sampler.WrapT == GL_REPEAT && img->_IsPowerOfTwo && img->Border == 0 && img->TexFormat == MESA_FORMAT_RGBA8888) { @@ -3251,22 +3252,22 @@ _swrast_choose_texture_sample_func( struct gl_context *ctx, if (needLambda) { return &sample_lambda_3d; } - else if (t->MinFilter == GL_LINEAR) { + else if (t->Sampler.MinFilter == GL_LINEAR) { return &sample_linear_3d; } else { - ASSERT(t->MinFilter == GL_NEAREST); + ASSERT(t->Sampler.MinFilter == GL_NEAREST); return &sample_nearest_3d; } case GL_TEXTURE_CUBE_MAP: if (needLambda) { return &sample_lambda_cube; } - else if (t->MinFilter == GL_LINEAR) { + else if (t->Sampler.MinFilter == GL_LINEAR) { return &sample_linear_cube; } else { - ASSERT(t->MinFilter == GL_NEAREST); + ASSERT(t->Sampler.MinFilter == GL_NEAREST); return &sample_nearest_cube; } case GL_TEXTURE_RECTANGLE_NV: @@ -3276,33 +3277,33 @@ _swrast_choose_texture_sample_func( struct gl_context *ctx, else if (needLambda) { return &sample_lambda_rect; } - else if (t->MinFilter == GL_LINEAR) { + else if (t->Sampler.MinFilter == GL_LINEAR) { return &sample_linear_rect; } else { - ASSERT(t->MinFilter == GL_NEAREST); + ASSERT(t->Sampler.MinFilter == GL_NEAREST); return &sample_nearest_rect; } case GL_TEXTURE_1D_ARRAY_EXT: if (needLambda) { return &sample_lambda_1d_array; } - else if (t->MinFilter == GL_LINEAR) { + else if (t->Sampler.MinFilter == GL_LINEAR) { return &sample_linear_1d_array; } else { - ASSERT(t->MinFilter == GL_NEAREST); + ASSERT(t->Sampler.MinFilter == GL_NEAREST); return &sample_nearest_1d_array; } case GL_TEXTURE_2D_ARRAY_EXT: if (needLambda) { return &sample_lambda_2d_array; } - else if (t->MinFilter == GL_LINEAR) { + else if (t->Sampler.MinFilter == GL_LINEAR) { return &sample_linear_2d_array; } else { - ASSERT(t->MinFilter == GL_NEAREST); + ASSERT(t->Sampler.MinFilter == GL_NEAREST); return &sample_nearest_2d_array; } default: diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c index d07a4ef7513..8a9671aa08a 100644 --- a/src/mesa/swrast/s_triangle.c +++ b/src/mesa/swrast/s_triangle.c @@ -540,7 +540,7 @@ affine_span(struct gl_context *ctx, SWspan *span, info.smask = texImg->Width - 1; \ info.tmask = texImg->Height - 1; \ info.format = texImg->TexFormat; \ - info.filter = obj->MinFilter; \ + info.filter = obj->Sampler.MinFilter; \ info.envmode = unit->EnvMode; \ info.er = 0; \ info.eg = 0; \ @@ -805,7 +805,7 @@ fast_persp_span(struct gl_context *ctx, SWspan *span, info.smask = texImg->Width - 1; \ info.tmask = texImg->Height - 1; \ info.format = texImg->TexFormat; \ - info.filter = obj->MinFilter; \ + info.filter = obj->Sampler.MinFilter; \ info.envmode = unit->EnvMode; \ info.er = 0; \ info.eg = 0; \ @@ -1044,8 +1044,8 @@ _swrast_choose_triangle( struct gl_context *ctx ) texImg = texObj2D ? texObj2D->Image[0][texObj2D->BaseLevel] : NULL; format = texImg ? texImg->TexFormat : MESA_FORMAT_NONE; - minFilter = texObj2D ? texObj2D->MinFilter : GL_NONE; - magFilter = texObj2D ? texObj2D->MagFilter : GL_NONE; + minFilter = texObj2D ? texObj2D->Sampler.MinFilter : GL_NONE; + magFilter = texObj2D ? texObj2D->Sampler.MagFilter : GL_NONE; envMode = ctx->Texture.Unit[0].EnvMode; /* First see if we can use an optimized 2-D texture function */ @@ -1054,8 +1054,8 @@ _swrast_choose_triangle( struct gl_context *ctx ) && !ctx->ATIFragmentShader._Enabled && ctx->Texture._EnabledUnits == 0x1 && ctx->Texture.Unit[0]._ReallyEnabled == TEXTURE_2D_BIT - && texObj2D->WrapS == GL_REPEAT - && texObj2D->WrapT == GL_REPEAT + && texObj2D->Sampler.WrapS == GL_REPEAT + && texObj2D->Sampler.WrapT == GL_REPEAT && texObj2D->_Swizzle == SWIZZLE_NOOP && texImg->_IsPowerOfTwo && texImg->Border == 0 -- 2.30.2