mesa: reorganize gl_texture and sampler structures for glPush/PopAttrib

Put the fields saved by glPush/PopAttrib into the sub-structure declared
as Attrib. This will make glPush/PopAttrib much faster because it will
only save and restore that structure.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946>
This commit is contained in:
Marek Olšák 2020-10-05 02:45:03 -04:00 committed by Marge Bot
parent 7fa9d9d06c
commit 9a8b54285d
57 changed files with 875 additions and 853 deletions

View File

@ -1902,7 +1902,7 @@ dri2_interop_export_object(__DRIcontext *_ctx,
* section 3.8.10 (Texture Completeness) of the OpenGL 2.1
* specification and section 3.7.10 of the OpenGL ES 2.0."
*/
if (in->miplevel < obj->BaseLevel || in->miplevel > obj->_MaxLevel) {
if (in->miplevel < obj->Attrib.BaseLevel || in->miplevel > obj->_MaxLevel) {
simple_mtx_unlock(&ctx->Shared->Mutex);
return MESA_GLINTEROP_INVALID_MIP_LEVEL;
}

View File

@ -352,7 +352,7 @@ dri2_create_from_texture(__DRIcontext *context, int target, unsigned texture,
return NULL;
}
if (level < obj->BaseLevel || level > obj->_MaxLevel) {
if (level < obj->Attrib.BaseLevel || level > obj->_MaxLevel) {
*error = __DRI_IMAGE_ERROR_BAD_MATCH;
return NULL;
}

View File

@ -3153,8 +3153,8 @@ decompress_texture_image(struct gl_context *ctx,
{
/* save texture object state */
const GLint baseLevelSave = texObj->BaseLevel;
const GLint maxLevelSave = texObj->MaxLevel;
const GLint baseLevelSave = texObj->Attrib.BaseLevel;
const GLint maxLevelSave = texObj->Attrib.MaxLevel;
/* restrict sampling to the texture level of interest */
if (target != GL_TEXTURE_RECTANGLE_ARB) {
@ -3391,7 +3391,7 @@ _mesa_meta_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
}
texObj = ctx->Texture.Unit[i]._Current;
texImage = texObj->Image[0][texObj->BaseLevel];
texImage = texObj->Image[0][texObj->Attrib.BaseLevel];
tw = texImage->Width2;
th = texImage->Height2;

View File

@ -176,9 +176,9 @@ blitframebuffer_texture(struct gl_context *ctx,
target = texObj->Target;
fb_tex_blit.tex_obj = texObj;
fb_tex_blit.baseLevelSave = texObj->BaseLevel;
fb_tex_blit.maxLevelSave = texObj->MaxLevel;
fb_tex_blit.stencilSamplingSave = texObj->StencilSampling;
fb_tex_blit.baseLevelSave = texObj->Attrib.BaseLevel;
fb_tex_blit.maxLevelSave = texObj->Attrib.MaxLevel;
fb_tex_blit.stencilSamplingSave = texObj->Attrib.StencilSampling;
if (glsl_version) {
setup_glsl_blit_framebuffer(ctx, blit, drawFb, rb, target, do_depth);
@ -329,16 +329,16 @@ _mesa_meta_fb_tex_blit_end(struct gl_context *ctx, GLenum target,
/* If the target restricts values for base level or max level, we assume
* that the original values were valid.
*/
if (blit->baseLevelSave != texObj->BaseLevel)
if (blit->baseLevelSave != texObj->Attrib.BaseLevel)
_mesa_texture_parameteriv(ctx, texObj, GL_TEXTURE_BASE_LEVEL,
&blit->baseLevelSave, false);
if (blit->maxLevelSave != texObj->MaxLevel)
if (blit->maxLevelSave != texObj->Attrib.MaxLevel)
_mesa_texture_parameteriv(ctx, texObj, GL_TEXTURE_MAX_LEVEL,
&blit->maxLevelSave, false);
/* If ARB_stencil_texturing is not supported, the mode won't have changed. */
if (texObj->StencilSampling != blit->stencilSamplingSave) {
if (texObj->Attrib.StencilSampling != blit->stencilSamplingSave) {
/* GLint so the compiler won't complain about type signedness mismatch
* in the call to _mesa_texture_parameteriv below.
*/
@ -393,7 +393,7 @@ setup_sampler(struct gl_context *ctx, struct gl_texture_object *texObj,
_mesa_bind_sampler(ctx, ctx->Texture.CurrentUnit, samp_obj);
_mesa_set_sampler_filters(ctx, samp_obj, filter, filter);
_mesa_set_sampler_wrap(ctx, samp_obj, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE,
samp_obj->WrapR);
samp_obj->Attrib.WrapR);
/* Prepare src texture state */
_mesa_bind_texture(ctx, target, texObj);

View File

@ -71,7 +71,7 @@ fallback_required(struct gl_context *ctx, GLenum target,
return true;
}
srcLevel = texObj->BaseLevel;
srcLevel = texObj->Attrib.BaseLevel;
baseImage = _mesa_select_tex_image(texObj, target, srcLevel);
if (!baseImage) {
_mesa_perf_debug(ctx, MESA_DEBUG_SEVERITY_HIGH,
@ -149,10 +149,10 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
{
struct gen_mipmap_state *mipmap = &ctx->Meta->Mipmap;
struct vertex verts[4];
const GLuint baseLevel = texObj->BaseLevel;
const GLuint maxLevel = texObj->MaxLevel;
const GLint maxLevelSave = texObj->MaxLevel;
const GLboolean genMipmapSave = texObj->GenerateMipmap;
const GLuint baseLevel = texObj->Attrib.BaseLevel;
const GLuint maxLevel = texObj->Attrib.MaxLevel;
const GLint maxLevelSave = texObj->Attrib.MaxLevel;
const GLboolean genMipmapSave = texObj->Attrib.GenerateMipmap;
const GLboolean use_glsl_version = ctx->Extensions.ARB_vertex_shader &&
ctx->Extensions.ARB_fragment_shader;
GLenum faceTarget;
@ -226,7 +226,7 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
if (ctx->Extensions.EXT_texture_sRGB_decode) {
const struct gl_texture_image *baseImage =
_mesa_select_tex_image(texObj, target, texObj->BaseLevel);
_mesa_select_tex_image(texObj, target, texObj->Attrib.BaseLevel);
const bool srgb = _mesa_is_format_srgb(baseImage->TexFormat);
_mesa_set_sampler_srgb_decode(ctx, mipmap->samp_obj,
@ -241,9 +241,9 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
_mesa_texture_parameteriv(ctx, texObj, GL_GENERATE_MIPMAP, &always_false, false);
if (texObj->_Swizzle != SWIZZLE_NOOP) {
if (texObj->Attrib._Swizzle != SWIZZLE_NOOP) {
static const GLint swizzleNoop[4] = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA };
memcpy(swizzle, texObj->Swizzle, sizeof(swizzle));
memcpy(swizzle, texObj->Attrib.Swizzle, sizeof(swizzle));
swizzleSaved = GL_TRUE;
_mesa_texture_parameteriv(ctx, texObj, GL_TEXTURE_SWIZZLE_RGBA,
swizzleNoop, false);

View File

@ -141,9 +141,9 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
/* Get first image here, since intelObj->firstLevel will get set in
* the intel_finalize_mipmap_tree() call above.
*/
firstImage = tObj->Image[0][tObj->BaseLevel];
firstImage = tObj->Image[0][tObj->Attrib.BaseLevel];
intel_miptree_get_image_offset(intelObj->mt, tObj->BaseLevel, 0,
intel_miptree_get_image_offset(intelObj->mt, tObj->Attrib.BaseLevel, 0,
&dst_x, &dst_y);
drm_intel_bo_reference(intelObj->mt->region->bo);
@ -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 (sampler->MinFilter) {
switch (sampler->Attrib.MinFilter) {
case GL_NEAREST:
minFilt = FILTER_NEAREST;
mipFilt = MIPFILTER_NONE;
@ -222,14 +222,14 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
return false;
}
if (sampler->MaxAnisotropy > 1.0) {
if (sampler->Attrib.MaxAnisotropy > 1.0) {
minFilt = FILTER_ANISOTROPIC;
magFilt = FILTER_ANISOTROPIC;
/* no trilinear + anisotropic */
mipFilt = MIPFILTER_NEAREST;
}
else {
switch (sampler->MagFilter) {
switch (sampler->Attrib.MagFilter) {
case GL_NEAREST:
magFilt = FILTER_NEAREST;
break;
@ -241,7 +241,7 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
}
}
lodbias = (int) ((tUnit->LodBias + sampler->LodBias) * 16.0);
lodbias = (int) ((tUnit->LodBias + sampler->Attrib.LodBias) * 16.0);
if (lodbias < -64)
lodbias = -64;
if (lodbias > 63)
@ -261,8 +261,8 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
* addressable (smallest resolution) LOD. Use it to cover both
* MAX_LEVEL and MAX_LOD.
*/
minlod_fixed = U_FIXED(CLAMP(sampler->MinLod, 0.0, 11), 4);
maxlod = MIN2(sampler->MaxLod, tObj->_MaxLevel - tObj->BaseLevel);
minlod_fixed = U_FIXED(CLAMP(sampler->Attrib.MinLod, 0.0, 11), 4);
maxlod = MIN2(sampler->Attrib.MaxLod, tObj->_MaxLevel - tObj->Attrib.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);
@ -281,8 +281,8 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
}
{
GLenum ws = sampler->WrapS;
GLenum wt = sampler->WrapT;
GLenum ws = sampler->Attrib.WrapS;
GLenum wt = sampler->Attrib.WrapT;
/* 3D textures not available on i830
@ -302,10 +302,10 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
}
/* convert border color from float to ubyte */
CLAMPED_FLOAT_TO_UBYTE(border[0], sampler->BorderColor.f[0]);
CLAMPED_FLOAT_TO_UBYTE(border[1], sampler->BorderColor.f[1]);
CLAMPED_FLOAT_TO_UBYTE(border[2], sampler->BorderColor.f[2]);
CLAMPED_FLOAT_TO_UBYTE(border[3], sampler->BorderColor.f[3]);
CLAMPED_FLOAT_TO_UBYTE(border[0], sampler->Attrib.BorderColor.f[0]);
CLAMPED_FLOAT_TO_UBYTE(border[1], sampler->Attrib.BorderColor.f[1]);
CLAMPED_FLOAT_TO_UBYTE(border[2], sampler->Attrib.BorderColor.f[2]);
CLAMPED_FLOAT_TO_UBYTE(border[3], sampler->Attrib.BorderColor.f[3]);
state[I830_TEXREG_TM0S4] = PACK_COLOR_8888(border[3],
border[0],

View File

@ -166,14 +166,14 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
/* Get first image here, since intelObj->firstLevel will get set in
* the intel_finalize_mipmap_tree() call above.
*/
firstImage = tObj->Image[0][tObj->BaseLevel];
firstImage = tObj->Image[0][tObj->Attrib.BaseLevel];
drm_intel_bo_reference(intelObj->mt->region->bo);
i915->state.tex_buffer[unit] = intelObj->mt->region->bo;
i915->state.tex_offset[unit] = intelObj->mt->offset;
format = translate_texture_format(firstImage->TexFormat,
tObj->DepthMode);
tObj->Attrib.DepthMode);
state[I915_TEXREG_MS3] =
(((firstImage->Height - 1) << MS3_HEIGHT_SHIFT) |
@ -189,7 +189,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(sampler->MaxLod, tObj->_MaxLevel - tObj->BaseLevel);
maxlod = MIN2(sampler->Attrib.MaxLod, tObj->_MaxLevel - tObj->Attrib.BaseLevel);
state[I915_TEXREG_MS4] =
((((intelObj->mt->region->pitch / 4) - 1) << MS4_PITCH_SHIFT) |
MS4_CUBE_FACE_ENA_MASK |
@ -200,7 +200,7 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
{
GLuint minFilt, mipFilt, magFilt;
switch (sampler->MinFilter) {
switch (sampler->Attrib.MinFilter) {
case GL_NEAREST:
minFilt = FILTER_NEAREST;
mipFilt = MIPFILTER_NONE;
@ -229,16 +229,16 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
return false;
}
if (sampler->MaxAnisotropy > 1.0) {
if (sampler->Attrib.MaxAnisotropy > 1.0) {
minFilt = FILTER_ANISOTROPIC;
magFilt = FILTER_ANISOTROPIC;
if (sampler->MaxAnisotropy > 2.0)
if (sampler->Attrib.MaxAnisotropy > 2.0)
aniso = SS2_MAX_ANISO_4;
else
aniso = SS2_MAX_ANISO_2;
}
else {
switch (sampler->MagFilter) {
switch (sampler->Attrib.MagFilter) {
case GL_NEAREST:
magFilt = FILTER_NEAREST;
break;
@ -250,7 +250,7 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
}
}
lodbias = (int) ((tUnit->LodBias + sampler->LodBias) * 16.0);
lodbias = (int) ((tUnit->LodBias + sampler->Attrib.LodBias) * 16.0);
if (lodbias < -256)
lodbias = -256;
if (lodbias > 255)
@ -266,14 +266,14 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
/* Shadow:
*/
if (sampler->CompareMode == GL_COMPARE_R_TO_TEXTURE_ARB &&
if (sampler->Attrib.CompareMode == GL_COMPARE_R_TO_TEXTURE_ARB &&
tObj->Target != GL_TEXTURE_3D) {
if (tObj->Target == GL_TEXTURE_1D)
return false;
state[I915_TEXREG_SS2] |=
(SS2_SHADOW_ENABLE |
intel_translate_shadow_compare_func(sampler->CompareFunc));
intel_translate_shadow_compare_func(sampler->Attrib.CompareFunc));
minFilt = FILTER_4X4_FLAT;
magFilt = FILTER_4X4_FLAT;
@ -286,9 +286,9 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
}
{
GLenum ws = sampler->WrapS;
GLenum wt = sampler->WrapT;
GLenum wr = sampler->WrapR;
GLenum ws = sampler->Attrib.WrapS;
GLenum wt = sampler->Attrib.WrapT;
GLenum wr = sampler->Attrib.WrapR;
float minlod;
/* We program 1D textures as 2D textures, so the 2D texcoord could
@ -306,8 +306,8 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
* clamp_to_border.
*/
if (tObj->Target == GL_TEXTURE_3D &&
(sampler->MinFilter != GL_NEAREST ||
sampler->MagFilter != GL_NEAREST) &&
(sampler->Attrib.MinFilter != GL_NEAREST ||
sampler->Attrib.MagFilter != GL_NEAREST) &&
(ws == GL_CLAMP ||
wt == GL_CLAMP ||
wr == GL_CLAMP ||
@ -352,24 +352,24 @@ 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(sampler->MinLod, tObj->_MaxLevel - tObj->BaseLevel);
minlod = MIN2(sampler->Attrib.MinLod, tObj->_MaxLevel - tObj->Attrib.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);
}
if (sampler->sRGBDecode == GL_DECODE_EXT &&
if (sampler->Attrib.sRGBDecode == GL_DECODE_EXT &&
(_mesa_get_srgb_format_linear(firstImage->TexFormat) !=
firstImage->TexFormat)) {
state[I915_TEXREG_SS2] |= SS2_REVERSE_GAMMA_ENABLE;
}
/* convert border color from float to ubyte */
CLAMPED_FLOAT_TO_UBYTE(border[0], sampler->BorderColor.f[0]);
CLAMPED_FLOAT_TO_UBYTE(border[1], sampler->BorderColor.f[1]);
CLAMPED_FLOAT_TO_UBYTE(border[2], sampler->BorderColor.f[2]);
CLAMPED_FLOAT_TO_UBYTE(border[3], sampler->BorderColor.f[3]);
CLAMPED_FLOAT_TO_UBYTE(border[0], sampler->Attrib.BorderColor.f[0]);
CLAMPED_FLOAT_TO_UBYTE(border[1], sampler->Attrib.BorderColor.f[1]);
CLAMPED_FLOAT_TO_UBYTE(border[2], sampler->Attrib.BorderColor.f[2]);
CLAMPED_FLOAT_TO_UBYTE(border[3], sampler->Attrib.BorderColor.f[3]);
if (firstImage->_BaseFormat == GL_DEPTH_COMPONENT) {
/* GL specs that border color for depth textures is taken from the

View File

@ -392,7 +392,7 @@ intel_create_image_from_texture(__DRIcontext *context, int target,
return NULL;
}
if (level < obj->BaseLevel || level > obj->_MaxLevel) {
if (level < obj->Attrib.BaseLevel || level > obj->_MaxLevel) {
*error = __DRI_IMAGE_ERROR_BAD_MATCH;
return NULL;
}

View File

@ -44,7 +44,7 @@ intel_miptree_create_for_teximage(struct intel_context *intel,
DBG("%s\n", __func__);
if (intelImage->base.Base.Level > intelObj->base.BaseLevel &&
if (intelImage->base.Base.Level > intelObj->base.Attrib.BaseLevel &&
(width == 1 ||
(intelObj->base.Target != GL_TEXTURE_1D && height == 1) ||
(intelObj->base.Target == GL_TEXTURE_3D && depth == 1))) {
@ -59,10 +59,10 @@ intel_miptree_create_for_teximage(struct intel_context *intel,
/* If this image disrespects BaseLevel, allocate from level zero.
* Usually BaseLevel == 0, so it's unlikely to happen.
*/
if (intelImage->base.Base.Level < intelObj->base.BaseLevel)
if (intelImage->base.Base.Level < intelObj->base.Attrib.BaseLevel)
firstLevel = 0;
else
firstLevel = intelObj->base.BaseLevel;
firstLevel = intelObj->base.Attrib.BaseLevel;
/* Figure out image dimensions at start level. */
for (i = intelImage->base.Base.Level; i > firstLevel; i--) {
@ -78,8 +78,8 @@ intel_miptree_create_for_teximage(struct intel_context *intel,
* resizable buffers, or require that buffers implement lazy
* pagetable arrangements.
*/
if ((intelObj->base.Sampler.MinFilter == GL_NEAREST ||
intelObj->base.Sampler.MinFilter == GL_LINEAR) &&
if ((intelObj->base.Sampler.Attrib.MinFilter == GL_NEAREST ||
intelObj->base.Sampler.Attrib.MinFilter == GL_LINEAR) &&
intelImage->base.Base.Level == firstLevel) {
lastLevel = firstLevel;
} else {

View File

@ -24,9 +24,9 @@ intel_update_max_level(struct intel_texture_object *intelObj,
struct gl_texture_object *tObj = &intelObj->base;
int maxlevel;
if (sampler->MinFilter == GL_NEAREST ||
sampler->MinFilter == GL_LINEAR) {
maxlevel = tObj->BaseLevel;
if (sampler->Attrib.MinFilter == GL_NEAREST ||
sampler->Attrib.MinFilter == GL_LINEAR) {
maxlevel = tObj->Attrib.BaseLevel;
} else {
maxlevel = tObj->_MaxLevel;
}
@ -62,13 +62,13 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit)
/* What levels must the tree include at a minimum?
*/
intel_update_max_level(intelObj, sampler);
if (intelObj->mt && intelObj->mt->first_level != tObj->BaseLevel)
if (intelObj->mt && intelObj->mt->first_level != tObj->Attrib.BaseLevel)
intelObj->needs_validate = true;
if (!intelObj->needs_validate)
return true;
firstImage = intel_texture_image(tObj->Image[0][tObj->BaseLevel]);
firstImage = intel_texture_image(tObj->Image[0][tObj->Attrib.BaseLevel]);
/* Check tree can hold all active levels. Check tree matches
* target, imageFormat, etc.
@ -80,7 +80,7 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit)
*/
if (intelObj->mt &&
(!intel_miptree_match_image(intelObj->mt, &firstImage->base.Base) ||
intelObj->mt->first_level != tObj->BaseLevel ||
intelObj->mt->first_level != tObj->Attrib.BaseLevel ||
intelObj->mt->last_level < intelObj->_MaxLevel)) {
intel_miptree_release(&intelObj->mt);
}
@ -95,12 +95,12 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit)
perf_debug("Creating new %s %dx%dx%d %d..%d miptree to handle finalized "
"texture miptree.\n",
_mesa_get_format_name(firstImage->base.Base.TexFormat),
width, height, depth, tObj->BaseLevel, intelObj->_MaxLevel);
width, height, depth, tObj->Attrib.BaseLevel, intelObj->_MaxLevel);
intelObj->mt = intel_miptree_create(intel,
intelObj->base.Target,
firstImage->base.Base.TexFormat,
tObj->BaseLevel,
tObj->Attrib.BaseLevel,
intelObj->_MaxLevel,
width,
height,
@ -115,7 +115,7 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit)
*/
nr_faces = _mesa_num_tex_faces(intelObj->base.Target);
for (face = 0; face < nr_faces; face++) {
for (i = tObj->BaseLevel; i <= intelObj->_MaxLevel; i++) {
for (i = tObj->Attrib.BaseLevel; i <= intelObj->_MaxLevel; i++) {
struct intel_texture_image *intelImage =
intel_texture_image(intelObj->base.Image[face][i]);
/* skip too small size mipmap */

View File

@ -543,7 +543,7 @@ brw_predraw_resolve_inputs(struct brw_context *brw, bool rendering,
struct gl_sampler_object *sampler = _mesa_get_samplerobj(ctx, i);
enum isl_format view_format =
translate_tex_format(brw, tex_obj->_Format, sampler->sRGBDecode);
translate_tex_format(brw, tex_obj->_Format, sampler->Attrib.sRGBDecode);
unsigned min_level, min_layer, num_levels, num_layers;
if (tex_obj->base.Immutable) {
@ -553,8 +553,8 @@ brw_predraw_resolve_inputs(struct brw_context *brw, bool rendering,
num_layers = tex_obj->base.Target != GL_TEXTURE_3D ?
tex_obj->base.NumLayers : INTEL_REMAINING_LAYERS;
} else {
min_level = tex_obj->base.BaseLevel;
num_levels = tex_obj->_MaxLevel - tex_obj->base.BaseLevel + 1;
min_level = tex_obj->base.Attrib.BaseLevel;
num_levels = tex_obj->_MaxLevel - tex_obj->base.Attrib.BaseLevel + 1;
min_layer = 0;
num_layers = INTEL_REMAINING_LAYERS;
}
@ -586,7 +586,7 @@ brw_predraw_resolve_inputs(struct brw_context *brw, bool rendering,
brw_cache_flush_for_read(brw, tex_obj->mt->bo);
if (tex_obj->base.StencilSampling ||
if (tex_obj->base.Attrib.StencilSampling ||
tex_obj->mt->format == MESA_FORMAT_S_UINT8) {
intel_update_r8stencil(brw, tex_obj->mt);
}

View File

@ -41,7 +41,7 @@ brw_generate_mipmap(struct gl_context *ctx, GLenum target,
struct brw_context *brw = brw_context(ctx);
struct gen_device_info *devinfo = &brw->screen->devinfo;
struct intel_texture_object *intel_obj = intel_texture_object(tex_obj);
const unsigned base_level = tex_obj->BaseLevel;
const unsigned base_level = tex_obj->Attrib.BaseLevel;
unsigned last_level, first_layer, last_layer;
/* Blorp doesn't handle combined depth/stencil surfaces on Gen4-5 yet. */
@ -120,7 +120,7 @@ brw_generate_mipmap(struct gl_context *ctx, GLenum target,
* encode and decode steps, sRGB mipmap generation should match
* the mipmap generation for a non-sRGB texture."
*/
bool do_srgb = tex_obj->Sampler.sRGBDecode == GL_DECODE_EXT;
bool do_srgb = tex_obj->Sampler.Attrib.sRGBDecode == GL_DECODE_EXT;
for (unsigned dst_level = base_level + 1;
dst_level <= last_level;

View File

@ -206,10 +206,10 @@ brw_populate_sampler_prog_key_data(struct gl_context *ctx,
if (unit->_Current && unit->_Current->Target != GL_TEXTURE_BUFFER) {
const struct gl_texture_object *t = unit->_Current;
const struct gl_texture_image *img = t->Image[0][t->BaseLevel];
const struct gl_texture_image *img = t->Image[0][t->Attrib.BaseLevel];
struct gl_sampler_object *sampler = _mesa_get_samplerobj(ctx, unit_id);
const bool alpha_depth = t->DepthMode == GL_ALPHA &&
const bool alpha_depth = t->Attrib.DepthMode == GL_ALPHA &&
(img->_BaseFormat == GL_DEPTH_COMPONENT ||
img->_BaseFormat == GL_DEPTH_STENCIL);
@ -220,13 +220,13 @@ brw_populate_sampler_prog_key_data(struct gl_context *ctx,
key->swizzles[s] = brw_get_texture_swizzle(ctx, t);
if (devinfo->gen < 8 &&
sampler->MinFilter != GL_NEAREST &&
sampler->MagFilter != GL_NEAREST) {
if (sampler->WrapS == GL_CLAMP)
sampler->Attrib.MinFilter != GL_NEAREST &&
sampler->Attrib.MagFilter != GL_NEAREST) {
if (sampler->Attrib.WrapS == GL_CLAMP)
key->gl_clamp_mask[0] |= 1 << s;
if (sampler->WrapT == GL_CLAMP)
if (sampler->Attrib.WrapT == GL_CLAMP)
key->gl_clamp_mask[1] |= 1 << s;
if (sampler->WrapR == GL_CLAMP)
if (sampler->Attrib.WrapR == GL_CLAMP)
key->gl_clamp_mask[2] |= 1 << s;
}
@ -245,7 +245,7 @@ brw_populate_sampler_prog_key_data(struct gl_context *ctx,
* leaving normal texture swizzling to SCS.
*/
unsigned src_swizzle =
devinfo->is_haswell ? t->_Swizzle : key->swizzles[s];
devinfo->is_haswell ? t->Attrib._Swizzle : key->swizzles[s];
for (int i = 0; i < 4; i++) {
unsigned src_comp = GET_SWZ(src_swizzle, i);
if (src_comp == SWIZZLE_ONE || src_comp == SWIZZLE_W) {

View File

@ -324,7 +324,7 @@ int
brw_get_texture_swizzle(const struct gl_context *ctx,
const struct gl_texture_object *t)
{
const struct gl_texture_image *img = t->Image[0][t->BaseLevel];
const struct gl_texture_image *img = t->Image[0][t->Attrib.BaseLevel];
int swizzles[SWIZZLE_NIL + 1] = {
SWIZZLE_X,
@ -338,7 +338,7 @@ brw_get_texture_swizzle(const struct gl_context *ctx,
if (img->_BaseFormat == GL_DEPTH_COMPONENT ||
img->_BaseFormat == GL_DEPTH_STENCIL) {
GLenum depth_mode = t->DepthMode;
GLenum depth_mode = t->Attrib.DepthMode;
/* In ES 3.0, DEPTH_TEXTURE_MODE is expected to be GL_RED for textures
* with depth component data specified with a sized internal format.
@ -434,10 +434,10 @@ brw_get_texture_swizzle(const struct gl_context *ctx,
break;
}
return MAKE_SWIZZLE4(swizzles[GET_SWZ(t->_Swizzle, 0)],
swizzles[GET_SWZ(t->_Swizzle, 1)],
swizzles[GET_SWZ(t->_Swizzle, 2)],
swizzles[GET_SWZ(t->_Swizzle, 3)]);
return MAKE_SWIZZLE4(swizzles[GET_SWZ(t->Attrib._Swizzle, 0)],
swizzles[GET_SWZ(t->Attrib._Swizzle, 1)],
swizzles[GET_SWZ(t->Attrib._Swizzle, 2)],
swizzles[GET_SWZ(t->Attrib._Swizzle, 3)]);
}
/**
@ -502,8 +502,8 @@ static void brw_update_texture_surface(struct gl_context *ctx,
* texturing functions that return a float, as our code generation always
* selects the .x channel (which would always be 0).
*/
struct gl_texture_image *firstImage = obj->Image[0][obj->BaseLevel];
const bool alpha_depth = obj->DepthMode == GL_ALPHA &&
struct gl_texture_image *firstImage = obj->Image[0][obj->Attrib.BaseLevel];
const bool alpha_depth = obj->Attrib.DepthMode == GL_ALPHA &&
(firstImage->_BaseFormat == GL_DEPTH_COMPONENT ||
firstImage->_BaseFormat == GL_DEPTH_STENCIL);
const unsigned swizzle = (unlikely(alpha_depth) ? SWIZZLE_XYZW :
@ -526,7 +526,7 @@ static void brw_update_texture_surface(struct gl_context *ctx,
}
enum isl_format format = translate_tex_format(brw, mesa_fmt,
for_txf ? GL_DECODE_EXT :
sampler->sRGBDecode);
sampler->Attrib.sRGBDecode);
/* Implement gen6 and gen7 gather work-around */
bool need_green_to_blue = false;
@ -566,7 +566,7 @@ static void brw_update_texture_surface(struct gl_context *ctx,
}
}
if (obj->StencilSampling && firstImage->_BaseFormat == GL_DEPTH_STENCIL) {
if (obj->Attrib.StencilSampling && firstImage->_BaseFormat == GL_DEPTH_STENCIL) {
if (devinfo->gen <= 7) {
assert(mt->shadow_mt && !mt->stencil_mt->shadow_needs_update);
mt = mt->shadow_mt;
@ -587,8 +587,8 @@ static void brw_update_texture_surface(struct gl_context *ctx,
struct isl_view view = {
.format = format,
.base_level = obj->MinLevel + obj->BaseLevel,
.levels = intel_obj->_MaxLevel - obj->BaseLevel + 1,
.base_level = obj->MinLevel + obj->Attrib.BaseLevel,
.levels = intel_obj->_MaxLevel - obj->Attrib.BaseLevel + 1,
.base_array_layer = obj->MinLayer,
.array_len = view_num_layers,
.swizzle = {
@ -1151,7 +1151,7 @@ is_depth_texture(struct intel_texture_object *iobj)
{
GLenum base_format = _mesa_get_format_base_format(iobj->_Format);
return base_format == GL_DEPTH_COMPONENT ||
(base_format == GL_DEPTH_STENCIL && !iobj->base.StencilSampling);
(base_format == GL_DEPTH_STENCIL && !iobj->base.Attrib.StencilSampling);
}
static void

View File

@ -23,6 +23,8 @@
#include <assert.h>
#include "main/samplerobj.h"
#include "dev/gen_device_info.h"
#include "common/gen_sample_positions.h"
#include "genxml/gen_macros.h"
@ -52,7 +54,6 @@
#include "main/fbobject.h"
#include "main/framebuffer.h"
#include "main/glformats.h"
#include "main/samplerobj.h"
#include "main/shaderapi.h"
#include "main/stencil.h"
#include "main/transformfeedback.h"
@ -4965,40 +4966,40 @@ genX(upload_default_color)(struct brw_context *brw,
* R channel, while the hardware uses A. Spam R into all the
* channels for safety.
*/
color.ui[0] = sampler->BorderColor.ui[0];
color.ui[1] = sampler->BorderColor.ui[0];
color.ui[2] = sampler->BorderColor.ui[0];
color.ui[3] = sampler->BorderColor.ui[0];
color.ui[0] = sampler->Attrib.BorderColor.ui[0];
color.ui[1] = sampler->Attrib.BorderColor.ui[0];
color.ui[2] = sampler->Attrib.BorderColor.ui[0];
color.ui[3] = sampler->Attrib.BorderColor.ui[0];
break;
case GL_ALPHA:
color.ui[0] = 0u;
color.ui[1] = 0u;
color.ui[2] = 0u;
color.ui[3] = sampler->BorderColor.ui[3];
color.ui[3] = sampler->Attrib.BorderColor.ui[3];
break;
case GL_INTENSITY:
color.ui[0] = sampler->BorderColor.ui[0];
color.ui[1] = sampler->BorderColor.ui[0];
color.ui[2] = sampler->BorderColor.ui[0];
color.ui[3] = sampler->BorderColor.ui[0];
color.ui[0] = sampler->Attrib.BorderColor.ui[0];
color.ui[1] = sampler->Attrib.BorderColor.ui[0];
color.ui[2] = sampler->Attrib.BorderColor.ui[0];
color.ui[3] = sampler->Attrib.BorderColor.ui[0];
break;
case GL_LUMINANCE:
color.ui[0] = sampler->BorderColor.ui[0];
color.ui[1] = sampler->BorderColor.ui[0];
color.ui[2] = sampler->BorderColor.ui[0];
color.ui[0] = sampler->Attrib.BorderColor.ui[0];
color.ui[1] = sampler->Attrib.BorderColor.ui[0];
color.ui[2] = sampler->Attrib.BorderColor.ui[0];
color.ui[3] = float_as_int(1.0);
break;
case GL_LUMINANCE_ALPHA:
color.ui[0] = sampler->BorderColor.ui[0];
color.ui[1] = sampler->BorderColor.ui[0];
color.ui[2] = sampler->BorderColor.ui[0];
color.ui[3] = sampler->BorderColor.ui[3];
color.ui[0] = sampler->Attrib.BorderColor.ui[0];
color.ui[1] = sampler->Attrib.BorderColor.ui[0];
color.ui[2] = sampler->Attrib.BorderColor.ui[0];
color.ui[3] = sampler->Attrib.BorderColor.ui[3];
break;
default:
color.ui[0] = sampler->BorderColor.ui[0];
color.ui[1] = sampler->BorderColor.ui[1];
color.ui[2] = sampler->BorderColor.ui[2];
color.ui[3] = sampler->BorderColor.ui[3];
color.ui[0] = sampler->Attrib.BorderColor.ui[0];
color.ui[1] = sampler->Attrib.BorderColor.ui[1];
color.ui[2] = sampler->Attrib.BorderColor.ui[2];
color.ui[3] = sampler->Attrib.BorderColor.ui[3];
break;
}
@ -5199,7 +5200,7 @@ genX(update_sampler_state)(struct brw_context *brw,
struct GENX(SAMPLER_STATE) samp_st = { 0 };
/* Select min and mip filters. */
switch (sampler->MinFilter) {
switch (sampler->Attrib.MinFilter) {
case GL_NEAREST:
samp_st.MinModeFilter = MAPFILTER_NEAREST;
samp_st.MipModeFilter = MIPFILTER_NONE;
@ -5229,21 +5230,21 @@ genX(update_sampler_state)(struct brw_context *brw,
}
/* Select mag filter. */
samp_st.MagModeFilter = sampler->MagFilter == GL_LINEAR ?
samp_st.MagModeFilter = sampler->Attrib.MagFilter == GL_LINEAR ?
MAPFILTER_LINEAR : MAPFILTER_NEAREST;
/* Enable anisotropic filtering if desired. */
samp_st.MaximumAnisotropy = RATIO21;
if (sampler->MaxAnisotropy > 1.0f) {
if (sampler->Attrib.MaxAnisotropy > 1.0f) {
if (samp_st.MinModeFilter == MAPFILTER_LINEAR)
samp_st.MinModeFilter = MAPFILTER_ANISOTROPIC;
if (samp_st.MagModeFilter == MAPFILTER_LINEAR)
samp_st.MagModeFilter = MAPFILTER_ANISOTROPIC;
if (sampler->MaxAnisotropy > 2.0f) {
if (sampler->Attrib.MaxAnisotropy > 2.0f) {
samp_st.MaximumAnisotropy =
MIN2((sampler->MaxAnisotropy - 2) / 2, RATIO161);
MIN2((sampler->Attrib.MaxAnisotropy - 2) / 2, RATIO161);
}
}
@ -5261,10 +5262,10 @@ genX(update_sampler_state)(struct brw_context *brw,
}
bool either_nearest =
sampler->MinFilter == GL_NEAREST || sampler->MagFilter == GL_NEAREST;
unsigned wrap_s = translate_wrap_mode(sampler->WrapS, either_nearest);
unsigned wrap_t = translate_wrap_mode(sampler->WrapT, either_nearest);
unsigned wrap_r = translate_wrap_mode(sampler->WrapR, either_nearest);
sampler->Attrib.MinFilter == GL_NEAREST || sampler->Attrib.MagFilter == GL_NEAREST;
unsigned wrap_s = translate_wrap_mode(sampler->Attrib.WrapS, either_nearest);
unsigned wrap_t = translate_wrap_mode(sampler->Attrib.WrapT, either_nearest);
unsigned wrap_r = translate_wrap_mode(sampler->Attrib.WrapR, either_nearest);
if (target == GL_TEXTURE_CUBE_MAP ||
target == GL_TEXTURE_CUBE_MAP_ARRAY) {
@ -5274,7 +5275,7 @@ genX(update_sampler_state)(struct brw_context *brw,
* Ivybridge and Baytrail seem to have problems with CUBE mode and
* integer formats. Fall back to CLAMP for now.
*/
if ((tex_cube_map_seamless || sampler->CubeMapSeamless) &&
if ((tex_cube_map_seamless || sampler->Attrib.CubeMapSeamless) &&
!(GEN_GEN == 7 && !GEN_IS_HASWELL && texObj->_IsIntegerFormat)) {
wrap_s = TCM_CUBE;
wrap_t = TCM_CUBE;
@ -5298,8 +5299,8 @@ genX(update_sampler_state)(struct brw_context *brw,
samp_st.TCZAddressControlMode = wrap_r;
samp_st.ShadowFunction =
sampler->CompareMode == GL_COMPARE_R_TO_TEXTURE_ARB ?
intel_translate_shadow_compare_func(sampler->CompareFunc) : 0;
sampler->Attrib.CompareMode == GL_COMPARE_R_TO_TEXTURE_ARB ?
intel_translate_shadow_compare_func(sampler->Attrib.CompareFunc) : 0;
#if GEN_GEN >= 7
/* Set shadow function. */
@ -5313,14 +5314,14 @@ genX(update_sampler_state)(struct brw_context *brw,
#endif
const float hw_max_lod = GEN_GEN >= 7 ? 14 : 13;
samp_st.MinLOD = CLAMP(sampler->MinLod, 0, hw_max_lod);
samp_st.MaxLOD = CLAMP(sampler->MaxLod, 0, hw_max_lod);
samp_st.MinLOD = CLAMP(sampler->Attrib.MinLod, 0, hw_max_lod);
samp_st.MaxLOD = CLAMP(sampler->Attrib.MaxLod, 0, hw_max_lod);
samp_st.TextureLODBias =
CLAMP(tex_unit_lod_bias + sampler->LodBias, -16, 15);
CLAMP(tex_unit_lod_bias + sampler->Attrib.LodBias, -16, 15);
#if GEN_GEN == 6
samp_st.BaseMipLevel =
CLAMP(texObj->MinLevel + texObj->BaseLevel, 0, hw_max_lod);
CLAMP(texObj->MinLevel + texObj->Attrib.BaseLevel, 0, hw_max_lod);
samp_st.MinandMagStateNotEqual =
samp_st.MinModeFilter != samp_st.MagModeFilter;
#endif
@ -5335,7 +5336,7 @@ genX(update_sampler_state)(struct brw_context *brw,
wrap_mode_needs_border_color(wrap_r)) {
genX(upload_default_color)(brw, sampler, format, base_format,
texObj->_IsIntegerFormat,
texObj->StencilSampling,
texObj->Attrib.StencilSampling,
&border_color_offset);
}
#if GEN_GEN < 6
@ -5368,7 +5369,7 @@ update_sampler_state(struct brw_context *brw,
if (texObj->Target == GL_TEXTURE_BUFFER)
return;
struct gl_texture_image *firstImage = texObj->Image[0][texObj->BaseLevel];
struct gl_texture_image *firstImage = texObj->Image[0][texObj->Attrib.BaseLevel];
genX(update_sampler_state)(brw, texObj->Target,
ctx->Texture.CubeMapSeamless,
texUnit->LodBias,

View File

@ -611,7 +611,7 @@ intel_create_image_from_texture(__DRIcontext *context, int target,
return NULL;
}
if (level < obj->BaseLevel || level > obj->_MaxLevel) {
if (level < obj->Attrib.BaseLevel || level > obj->_MaxLevel) {
*error = __DRI_IMAGE_ERROR_BAD_MATCH;
return NULL;
}

View File

@ -105,10 +105,10 @@ intel_miptree_create_for_teximage(struct brw_context *brw,
* resizable buffers, or require that buffers implement lazy
* pagetable arrangements.
*/
if ((intelObj->base.Sampler.MinFilter == GL_NEAREST ||
intelObj->base.Sampler.MinFilter == GL_LINEAR) &&
if ((intelObj->base.Sampler.Attrib.MinFilter == GL_NEAREST ||
intelObj->base.Sampler.Attrib.MinFilter == GL_LINEAR) &&
intelImage->base.Base.Level == 0 &&
!intelObj->base.GenerateMipmap) {
!intelObj->base.Attrib.GenerateMipmap) {
lastLevel = 0;
} else {
lastLevel = _mesa_get_tex_max_num_levels(intelObj->base.Target,

View File

@ -49,9 +49,9 @@ intel_update_max_level(struct gl_texture_object *tObj,
if (!tObj->_MipmapComplete ||
(tObj->_RenderToTexture &&
(sampler->MinFilter == GL_NEAREST ||
sampler->MinFilter == GL_LINEAR))) {
intelObj->_MaxLevel = tObj->BaseLevel;
(sampler->Attrib.MinFilter == GL_NEAREST ||
sampler->Attrib.MinFilter == GL_LINEAR))) {
intelObj->_MaxLevel = tObj->Attrib.BaseLevel;
} else {
intelObj->_MaxLevel = tObj->_MaxLevel;
}
@ -78,7 +78,7 @@ intel_finalize_mipmap_tree(struct brw_context *brw,
return;
/* What levels does this validated texture image require? */
int validate_first_level = tObj->BaseLevel;
int validate_first_level = tObj->Attrib.BaseLevel;
int validate_last_level = intelObj->_MaxLevel;
/* Skip the loop over images in the common case of no images having
@ -103,7 +103,7 @@ intel_finalize_mipmap_tree(struct brw_context *brw,
*/
assert(!tObj->Immutable || brw->screen->devinfo.gen < 6);
firstImage = intel_texture_image(tObj->Image[0][tObj->BaseLevel]);
firstImage = intel_texture_image(tObj->Image[0][tObj->Attrib.BaseLevel]);
/* Check tree can hold all active levels. Check tree matches
* target, imageFormat, etc.

View File

@ -261,7 +261,7 @@ teximage_fits(struct gl_texture_object *t, int level)
if (!ti || !to_nouveau_teximage(ti)->surface.bo)
return GL_FALSE;
if (level == t->BaseLevel && (s->offset & 0x7f))
if (level == t->Attrib.BaseLevel && (s->offset & 0x7f))
return GL_FALSE;
return t->Target == GL_TEXTURE_RECTANGLE ||
@ -296,19 +296,19 @@ validate_teximage(struct gl_context *ctx, struct gl_texture_object *t,
static int
get_last_level(struct gl_texture_object *t)
{
struct gl_texture_image *base = t->Image[0][t->BaseLevel];
struct gl_texture_image *base = t->Image[0][t->Attrib.BaseLevel];
if (t->Sampler.MinFilter == GL_NEAREST ||
t->Sampler.MinFilter == GL_LINEAR || !base)
return t->BaseLevel;
if (t->Sampler.Attrib.MinFilter == GL_NEAREST ||
t->Sampler.Attrib.MinFilter == GL_LINEAR || !base)
return t->Attrib.BaseLevel;
else
return MIN2(t->BaseLevel + base->MaxNumLevels - 1, t->MaxLevel);
return MIN2(t->Attrib.BaseLevel + base->MaxNumLevels - 1, t->Attrib.MaxLevel);
}
static void
relayout_texture(struct gl_context *ctx, struct gl_texture_object *t)
{
struct gl_texture_image *base = t->Image[0][t->BaseLevel];
struct gl_texture_image *base = t->Image[0][t->Attrib.BaseLevel];
if (base && t->Target != GL_TEXTURE_RECTANGLE) {
struct nouveau_surface *ss = to_nouveau_texture(t)->surfaces;
@ -325,7 +325,7 @@ relayout_texture(struct gl_context *ctx, struct gl_texture_object *t)
nouveau_bo_ref(NULL, &ss[i].bo);
/* Relayout the mipmap tree. */
for (i = t->BaseLevel; i <= last; i++) {
for (i = t->Attrib.BaseLevel; i <= last; i++) {
pitch = _mesa_format_row_stride(s->format, width);
size = get_format_blocksy(s->format, height) * pitch;
@ -348,7 +348,7 @@ relayout_texture(struct gl_context *ctx, struct gl_texture_object *t)
height = minify(height, 1);
}
if (t->BaseLevel <= last) {
if (t->Attrib.BaseLevel <= last) {
/* Get new storage. */
size = align(offset, 64);
assert(size);
@ -358,7 +358,7 @@ relayout_texture(struct gl_context *ctx, struct gl_texture_object *t)
0, size, NULL, &ss[last].bo);
assert(!ret);
for (i = t->BaseLevel; i < last; i++)
for (i = t->Attrib.BaseLevel; i < last; i++)
nouveau_bo_ref(ss[last].bo, &ss[i].bo);
}
}
@ -370,7 +370,7 @@ nouveau_texture_validate(struct gl_context *ctx, struct gl_texture_object *t)
struct nouveau_texture *nt = to_nouveau_texture(t);
int i, last = get_last_level(t);
if (!teximage_fits(t, t->BaseLevel) ||
if (!teximage_fits(t, t->Attrib.BaseLevel) ||
!teximage_fits(t, last))
return GL_FALSE;
@ -378,7 +378,7 @@ nouveau_texture_validate(struct gl_context *ctx, struct gl_texture_object *t)
nt->dirty = GL_FALSE;
/* Copy the teximages to the actual miptree. */
for (i = t->BaseLevel; i <= last; i++) {
for (i = t->Attrib.BaseLevel; i <= last; i++) {
struct nouveau_surface *s = &nt->surfaces[i];
validate_teximage(ctx, t, i, 0, 0, 0,
@ -394,7 +394,7 @@ nouveau_texture_validate(struct gl_context *ctx, struct gl_texture_object *t)
void
nouveau_texture_reallocate(struct gl_context *ctx, struct gl_texture_object *t)
{
if (!teximage_fits(t, t->BaseLevel) ||
if (!teximage_fits(t, t->Attrib.BaseLevel) ||
!teximage_fits(t, get_last_level(t))) {
texture_dirty(t);
relayout_texture(ctx, t);
@ -502,7 +502,7 @@ nouveau_teximage(struct gl_context *ctx, GLint dims,
texture_dirty(t);
}
if (level == t->BaseLevel) {
if (level == t->Attrib.BaseLevel) {
if (!teximage_fits(t, level))
relayout_texture(ctx, t);
nouveau_texture_validate(ctx, t);

View File

@ -37,7 +37,7 @@ texunit_needs_combiners(struct gl_texture_unit *u,
struct gl_fixedfunc_texture_unit *f)
{
struct gl_texture_object *t = u->_Current;
struct gl_texture_image *ti = t->Image[0][t->BaseLevel];
struct gl_texture_image *ti = t->Image[0][t->Attrib.BaseLevel];
return ti->TexFormat == MESA_FORMAT_A_UNORM8 ||
ti->TexFormat == MESA_FORMAT_L_UNORM8 ||

View File

@ -139,7 +139,7 @@ get_input_arg(struct combiner_state *rc, int arg, int flags)
int i = (source == GL_TEXTURE ?
rc->unit : source - GL_TEXTURE0);
struct gl_texture_object *t = rc->ctx->Texture.Unit[i]._Current;
mesa_format format = t->Image[0][t->BaseLevel]->TexFormat;
mesa_format format = t->Image[0][t->Attrib.BaseLevel]->TexFormat;
if (format == MESA_FORMAT_A_UNORM8) {
/* Emulated using I8. */

View File

@ -67,35 +67,35 @@ nv04_emit_tex_obj(struct gl_context *ctx, int emit)
if (ctx->Texture.Unit[i]._Current) {
struct gl_texture_object *t = ctx->Texture.Unit[i]._Current;
struct gl_texture_image *ti = t->Image[0][t->BaseLevel];
struct gl_texture_image *ti = t->Image[0][t->Attrib.BaseLevel];
const struct gl_sampler_object *sa = _mesa_get_samplerobj(ctx, i);
int lod_max = 1, lod_bias = 0;
if (!nouveau_texture_validate(ctx, t))
return;
s = &to_nouveau_texture(t)->surfaces[t->BaseLevel];
s = &to_nouveau_texture(t)->surfaces[t->Attrib.BaseLevel];
if (sa->MinFilter != GL_NEAREST &&
sa->MinFilter != GL_LINEAR) {
lod_max = CLAMP(MIN2(sa->MaxLod, t->_MaxLambda),
if (sa->Attrib.MinFilter != GL_NEAREST &&
sa->Attrib.MinFilter != GL_LINEAR) {
lod_max = CLAMP(MIN2(sa->Attrib.MaxLod, t->_MaxLambda),
0, 15) + 1;
lod_bias = CLAMP(ctx->Texture.Unit[i].LodBias +
sa->LodBias, -16, 15) * 8;
sa->Attrib.LodBias, -16, 15) * 8;
}
format |= nvgl_wrap_mode(sa->WrapT) << 28 |
nvgl_wrap_mode(sa->WrapS) << 24 |
format |= nvgl_wrap_mode(sa->Attrib.WrapT) << 28 |
nvgl_wrap_mode(sa->Attrib.WrapS) << 24 |
ti->HeightLog2 << 20 |
ti->WidthLog2 << 16 |
lod_max << 12 |
get_tex_format(ti);
filter |= log2i(sa->MaxAnisotropy) << 31 |
nvgl_filter_mode(sa->MagFilter) << 28 |
log2i(sa->MaxAnisotropy) << 27 |
nvgl_filter_mode(sa->MinFilter) << 24 |
filter |= log2i(sa->Attrib.MaxAnisotropy) << 31 |
nvgl_filter_mode(sa->Attrib.MagFilter) << 28 |
log2i(sa->Attrib.MaxAnisotropy) << 27 |
nvgl_filter_mode(sa->Attrib.MinFilter) << 24 |
(lod_bias & 0xff) << 16;
} else {

View File

@ -170,7 +170,7 @@ get_input_arg(struct combiner_state *rc, int arg, int flags)
int i = (source == GL_TEXTURE ?
rc->unit : source - GL_TEXTURE0);
struct gl_texture_object *t = rc->ctx->Texture.Unit[i]._Current;
mesa_format format = t->Image[0][t->BaseLevel]->TexFormat;
mesa_format format = t->Image[0][t->Attrib.BaseLevel]->TexFormat;
if (format == MESA_FORMAT_A_UNORM8) {
/* Emulated using I8. */

View File

@ -173,25 +173,25 @@ nv10_emit_tex_obj(struct gl_context *ctx, int emit)
}
t = ctx->Texture.Unit[i]._Current;
s = &to_nouveau_texture(t)->surfaces[t->BaseLevel];
ti = t->Image[0][t->BaseLevel];
s = &to_nouveau_texture(t)->surfaces[t->Attrib.BaseLevel];
ti = t->Image[0][t->Attrib.BaseLevel];
sa = _mesa_get_samplerobj(ctx, i);
if (!nouveau_texture_validate(ctx, t))
return;
/* Recompute the texturing registers. */
tx_format = nvgl_wrap_mode(sa->WrapT) << 28
| nvgl_wrap_mode(sa->WrapS) << 24
tx_format = nvgl_wrap_mode(sa->Attrib.WrapT) << 28
| nvgl_wrap_mode(sa->Attrib.WrapS) << 24
| ti->HeightLog2 << 20
| ti->WidthLog2 << 16
| 5 << 4 | 1 << 12;
tx_filter = nvgl_filter_mode(sa->MagFilter) << 28
| nvgl_filter_mode(sa->MinFilter) << 24;
tx_filter = nvgl_filter_mode(sa->Attrib.MagFilter) << 28
| nvgl_filter_mode(sa->Attrib.MinFilter) << 24;
tx_enable = NV10_3D_TEX_ENABLE_ENABLE
| log2i(sa->MaxAnisotropy) << 4;
| log2i(sa->Attrib.MaxAnisotropy) << 4;
if (t->Target == GL_TEXTURE_RECTANGLE) {
BEGIN_NV04(push, NV10_3D(TEX_NPOT_PITCH(i)), 1);
@ -204,11 +204,11 @@ nv10_emit_tex_obj(struct gl_context *ctx, int emit)
tx_format |= get_tex_format_pot(ti);
}
if (sa->MinFilter != GL_NEAREST &&
sa->MinFilter != GL_LINEAR) {
int lod_min = sa->MinLod;
int lod_max = MIN2(sa->MaxLod, t->_MaxLambda);
int lod_bias = sa->LodBias
if (sa->Attrib.MinFilter != GL_NEAREST &&
sa->Attrib.MinFilter != GL_LINEAR) {
int lod_min = sa->Attrib.MinLod;
int lod_max = MIN2(sa->Attrib.MaxLod, t->_MaxLambda);
int lod_bias = sa->Attrib.LodBias
+ ctx->Texture.Unit[i].LodBias;
lod_max = CLAMP(lod_max, 0, 15);

View File

@ -180,8 +180,8 @@ nv20_emit_tex_obj(struct gl_context *ctx, int emit)
}
t = ctx->Texture.Unit[i]._Current;
s = &to_nouveau_texture(t)->surfaces[t->BaseLevel];
ti = t->Image[0][t->BaseLevel];
s = &to_nouveau_texture(t)->surfaces[t->Attrib.BaseLevel];
ti = t->Image[0][t->Attrib.BaseLevel];
sa = _mesa_get_samplerobj(ctx, i);
if (!nouveau_texture_validate(ctx, t))
@ -199,24 +199,24 @@ nv20_emit_tex_obj(struct gl_context *ctx, int emit)
case GL_TEXTURE_1D:
tx_wrap = NV20_3D_TEX_WRAP_R_CLAMP_TO_EDGE
| NV20_3D_TEX_WRAP_T_CLAMP_TO_EDGE
| nvgl_wrap_mode_nv20(sa->WrapS) << 0;
| nvgl_wrap_mode_nv20(sa->Attrib.WrapS) << 0;
break;
default:
tx_wrap = nvgl_wrap_mode_nv20(sa->WrapR) << 16
| nvgl_wrap_mode_nv20(sa->WrapT) << 8
| nvgl_wrap_mode_nv20(sa->WrapS) << 0;
tx_wrap = nvgl_wrap_mode_nv20(sa->Attrib.WrapR) << 16
| nvgl_wrap_mode_nv20(sa->Attrib.WrapT) << 8
| nvgl_wrap_mode_nv20(sa->Attrib.WrapS) << 0;
break;
}
tx_filter = nvgl_filter_mode(sa->MagFilter) << 24
| nvgl_filter_mode(sa->MinFilter) << 16
tx_filter = nvgl_filter_mode(sa->Attrib.MagFilter) << 24
| nvgl_filter_mode(sa->Attrib.MinFilter) << 16
| 2 << 12;
r = FLOAT_TO_UBYTE(sa->BorderColor.f[0]);
g = FLOAT_TO_UBYTE(sa->BorderColor.f[1]);
b = FLOAT_TO_UBYTE(sa->BorderColor.f[2]);
a = FLOAT_TO_UBYTE(sa->BorderColor.f[3]);
r = FLOAT_TO_UBYTE(sa->Attrib.BorderColor.f[0]);
g = FLOAT_TO_UBYTE(sa->Attrib.BorderColor.f[1]);
b = FLOAT_TO_UBYTE(sa->Attrib.BorderColor.f[2]);
a = FLOAT_TO_UBYTE(sa->Attrib.BorderColor.f[3]);
switch (ti->_BaseFormat) {
case GL_LUMINANCE:
a = 0xff;
@ -237,7 +237,7 @@ nv20_emit_tex_obj(struct gl_context *ctx, int emit)
tx_bcolor = b << 0 | g << 8 | r << 16 | a << 24;
tx_enable = NV20_3D_TEX_ENABLE_ENABLE
| log2i(sa->MaxAnisotropy) << 4;
| log2i(sa->Attrib.MaxAnisotropy) << 4;
if (t->Target == GL_TEXTURE_RECTANGLE) {
BEGIN_NV04(push, NV20_3D(TEX_NPOT_PITCH(i)), 1);
@ -250,11 +250,11 @@ nv20_emit_tex_obj(struct gl_context *ctx, int emit)
tx_format |= get_tex_format_pot(ti);
}
if (sa->MinFilter != GL_NEAREST &&
sa->MinFilter != GL_LINEAR) {
int lod_min = sa->MinLod;
int lod_max = MIN2(sa->MaxLod, t->_MaxLambda);
int lod_bias = sa->LodBias
if (sa->Attrib.MinFilter != GL_NEAREST &&
sa->Attrib.MinFilter != GL_LINEAR) {
int lod_min = sa->Attrib.MinLod;
int lod_max = MIN2(sa->Attrib.MaxLod, t->_MaxLambda);
int lod_bias = sa->Attrib.LodBias
+ ctx->Texture.Unit[i].LodBias;
lod_max = CLAMP(lod_max, 0, 15);

View File

@ -365,10 +365,10 @@ void r200TexUpdateParameters(struct gl_context *ctx, GLuint unit)
struct gl_sampler_object *samp = _mesa_get_samplerobj(ctx, unit);
radeonTexObj* t = radeon_tex_obj(ctx->Texture.Unit[unit]._Current);
r200SetTexMaxAnisotropy(t , samp->MaxAnisotropy);
r200SetTexFilter(t, samp->MinFilter, samp->MagFilter);
r200SetTexWrap(t, samp->WrapS, samp->WrapT, samp->WrapR);
r200SetTexBorderColor(t, samp->BorderColor.f);
r200SetTexMaxAnisotropy(t , samp->Attrib.MaxAnisotropy);
r200SetTexFilter(t, samp->Attrib.MinFilter, samp->Attrib.MagFilter);
r200SetTexWrap(t, samp->Attrib.WrapS, samp->Attrib.WrapT, samp->Attrib.WrapR);
r200SetTexBorderColor(t, samp->Attrib.BorderColor.f);
}
/**
@ -476,13 +476,13 @@ static struct gl_texture_object *r200NewTextureObject(struct gl_context * ctx,
_mesa_enum_to_string(target), t);
_mesa_initialize_texture_object(ctx, &t->base, name, target);
t->base.Sampler.MaxAnisotropy = rmesa->radeon.initialMaxAnisotropy;
t->base.Sampler.Attrib.MaxAnisotropy = rmesa->radeon.initialMaxAnisotropy;
/* Initialize hardware state */
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);
r200SetTexWrap( t, t->base.Sampler.Attrib.WrapS, t->base.Sampler.Attrib.WrapT, t->base.Sampler.Attrib.WrapR );
r200SetTexMaxAnisotropy( t, t->base.Sampler.Attrib.MaxAnisotropy );
r200SetTexFilter(t, t->base.Sampler.Attrib.MinFilter, t->base.Sampler.Attrib.MagFilter);
r200SetTexBorderColor(t, t->base.Sampler.Attrib.BorderColor.f);
return &t->base;
}
@ -493,7 +493,7 @@ r200NewSamplerObject(struct gl_context *ctx, GLuint name)
r200ContextPtr rmesa = R200_CONTEXT(ctx);
struct gl_sampler_object *samp = _mesa_new_sampler_object(ctx, name);
if (samp)
samp->MaxAnisotropy = rmesa->radeon.initialMaxAnisotropy;
samp->Attrib.MaxAnisotropy = rmesa->radeon.initialMaxAnisotropy;
return samp;
}

View File

@ -251,16 +251,16 @@ static void calculate_min_max_lod(struct gl_sampler_object *samp, struct gl_text
case GL_TEXTURE_2D:
case GL_TEXTURE_3D:
case GL_TEXTURE_CUBE_MAP:
if (samp->MinFilter == GL_NEAREST || samp->MinFilter == GL_LINEAR) {
if (samp->Attrib.MinFilter == GL_NEAREST || samp->Attrib.MinFilter == GL_LINEAR) {
/* GL_NEAREST and GL_LINEAR only care about GL_TEXTURE_BASE_LEVEL.
*/
minLod = maxLod = tObj->BaseLevel;
minLod = maxLod = tObj->Attrib.BaseLevel;
} else {
minLod = tObj->BaseLevel + (GLint)(samp->MinLod);
minLod = MAX2(minLod, tObj->BaseLevel);
minLod = MIN2(minLod, tObj->MaxLevel);
maxLod = tObj->BaseLevel + (GLint)(samp->MaxLod + 0.5);
maxLod = MIN2(maxLod, tObj->MaxLevel);
minLod = tObj->Attrib.BaseLevel + (GLint)(samp->Attrib.MinLod);
minLod = MAX2(minLod, tObj->Attrib.BaseLevel);
minLod = MIN2(minLod, tObj->Attrib.MaxLevel);
maxLod = tObj->Attrib.BaseLevel + (GLint)(samp->Attrib.MaxLod + 0.5);
maxLod = MIN2(maxLod, tObj->Attrib.MaxLevel);
maxLod = MIN2(maxLod, tObj->Image[0][minLod]->MaxNumLevels - 1 + minLod);
maxLod = MAX2(maxLod, minLod); /* need at least one level */
}
@ -315,12 +315,12 @@ static GLboolean radeon_miptree_matches_texture(radeon_mipmap_tree *mt, struct g
unsigned numLevels;
radeon_mipmap_level *mtBaseLevel;
if (texObj->BaseLevel < mt->baseLevel)
if (texObj->Attrib.BaseLevel < mt->baseLevel)
return GL_FALSE;
mtBaseLevel = &mt->levels[texObj->BaseLevel - mt->baseLevel];
firstImage = texObj->Image[0][texObj->BaseLevel];
numLevels = MIN2(texObj->_MaxLevel - texObj->BaseLevel + 1, firstImage->MaxNumLevels);
mtBaseLevel = &mt->levels[texObj->Attrib.BaseLevel - mt->baseLevel];
firstImage = texObj->Image[0][texObj->Attrib.BaseLevel];
numLevels = MIN2(texObj->_MaxLevel - texObj->Attrib.BaseLevel + 1, firstImage->MaxNumLevels);
if (radeon_is_debug_enabled(RADEON_TEXTURE,RADEON_TRACE)) {
fprintf(stderr, "Checking if miptree %p matches texObj %p\n", mt, texObj);
@ -358,7 +358,7 @@ static GLboolean radeon_miptree_matches_texture(radeon_mipmap_tree *mt, struct g
void radeon_try_alloc_miptree(radeonContextPtr rmesa, radeonTexObj *t)
{
struct gl_texture_object *texObj = &t->base;
struct gl_texture_image *texImg = texObj->Image[0][texObj->BaseLevel];
struct gl_texture_image *texImg = texObj->Image[0][texObj->Attrib.BaseLevel];
GLuint numLevels;
assert(!t->mt);
@ -369,10 +369,10 @@ void radeon_try_alloc_miptree(radeonContextPtr rmesa, radeonTexObj *t)
}
numLevels = MIN2(texObj->MaxLevel - texObj->BaseLevel + 1, texImg->MaxNumLevels);
numLevels = MIN2(texObj->Attrib.MaxLevel - texObj->Attrib.BaseLevel + 1, texImg->MaxNumLevels);
t->mt = radeon_miptree_create(rmesa, t->base.Target,
texImg->TexFormat, texObj->BaseLevel,
texImg->TexFormat, texObj->Attrib.BaseLevel,
numLevels, texImg->Width, texImg->Height,
texImg->Depth, t->tile_bits);
}
@ -524,7 +524,7 @@ int radeon_validate_texture_miptree(struct gl_context * ctx,
"%s: Validating texture %p now, minLod = %d, maxLod = %d\n",
__func__, texObj ,t->minLod, t->maxLod);
dst_miptree = get_biggest_matching_miptree(t, t->base.BaseLevel, t->base._MaxLevel);
dst_miptree = get_biggest_matching_miptree(t, t->base.Attrib.BaseLevel, t->base._MaxLevel);
radeon_miptree_unreference(&t->mt);
if (!dst_miptree) {

View File

@ -315,10 +315,10 @@ void radeonTexUpdateParameters(struct gl_context *ctx, GLuint unit)
struct gl_sampler_object *samp = _mesa_get_samplerobj(ctx, unit);
radeonTexObj* t = radeon_tex_obj(ctx->Texture.Unit[unit]._Current);
radeonSetTexMaxAnisotropy(t , samp->MaxAnisotropy);
radeonSetTexFilter(t, samp->MinFilter, samp->MagFilter);
radeonSetTexWrap(t, samp->WrapS, samp->WrapT);
radeonSetTexBorderColor(t, samp->BorderColor.f);
radeonSetTexMaxAnisotropy(t , samp->Attrib.MaxAnisotropy);
radeonSetTexFilter(t, samp->Attrib.MinFilter, samp->Attrib.MagFilter);
radeonSetTexWrap(t, samp->Attrib.WrapS, samp->Attrib.WrapT);
radeonSetTexBorderColor(t, samp->Attrib.BorderColor.f);
}
@ -410,7 +410,7 @@ radeonNewTextureObject( struct gl_context *ctx, GLuint name, GLenum target )
radeonTexObj* t = CALLOC_STRUCT(radeon_tex_obj);
_mesa_initialize_texture_object(ctx, &t->base, name, target);
t->base.Sampler.MaxAnisotropy = rmesa->radeon.initialMaxAnisotropy;
t->base.Sampler.Attrib.MaxAnisotropy = rmesa->radeon.initialMaxAnisotropy;
t->border_fallback = GL_FALSE;
@ -418,10 +418,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.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 );
radeonSetTexWrap( t, t->base.Sampler.Attrib.WrapS, t->base.Sampler.Attrib.WrapT );
radeonSetTexMaxAnisotropy( t, t->base.Sampler.Attrib.MaxAnisotropy );
radeonSetTexFilter( t, t->base.Sampler.Attrib.MinFilter, t->base.Sampler.Attrib.MagFilter );
radeonSetTexBorderColor( t, t->base.Sampler.Attrib.BorderColor.f );
return &t->base;
}
@ -432,7 +432,7 @@ radeonNewSamplerObject(struct gl_context *ctx, GLuint name)
r100ContextPtr rmesa = R100_CONTEXT(ctx);
struct gl_sampler_object *samp = _mesa_new_sampler_object(ctx, name);
if (samp)
samp->MaxAnisotropy = rmesa->radeon.initialMaxAnisotropy;
samp->Attrib.MaxAnisotropy = rmesa->radeon.initialMaxAnisotropy;
return samp;
}

View File

@ -201,7 +201,7 @@ do { \
static GLenum
texture_base_format(const struct gl_texture_object *t)
{
return t->Image[0][t->BaseLevel]->_BaseFormat;
return t->Image[0][t->Attrib.BaseLevel]->_BaseFormat;
}
static GLboolean radeonUpdateTextureEnv( struct gl_context *ctx, int unit )

View File

@ -651,7 +651,7 @@ static radeon_mipmap_tree *radeon_miptree_create_for_teximage(radeonContextPtr r
height = texImage->Height;
depth = texImage->Depth;
if (texImage->Level > texObj->BaseLevel &&
if (texImage->Level > texObj->Attrib.BaseLevel &&
(width == 1 ||
(texObj->Target != GL_TEXTURE_1D && height == 1) ||
(texObj->Target == GL_TEXTURE_3D && depth == 1))) {
@ -663,10 +663,10 @@ static radeon_mipmap_tree *radeon_miptree_create_for_teximage(radeonContextPtr r
firstLevel = texImage->Level;
lastLevel = texImage->Level;
} else {
if (texImage->Level < texObj->BaseLevel)
if (texImage->Level < texObj->Attrib.BaseLevel)
firstLevel = 0;
else
firstLevel = texObj->BaseLevel;
firstLevel = texObj->Attrib.BaseLevel;
for (i = texImage->Level; i > firstLevel; i--) {
width <<= 1;
@ -675,8 +675,8 @@ static radeon_mipmap_tree *radeon_miptree_create_for_teximage(radeonContextPtr r
if (depth != 1)
depth <<= 1;
}
if ((texObj->Sampler.MinFilter == GL_NEAREST ||
texObj->Sampler.MinFilter == GL_LINEAR) &&
if ((texObj->Sampler.Attrib.MinFilter == GL_NEAREST ||
texObj->Sampler.Attrib.MinFilter == GL_LINEAR) &&
texImage->Level == firstLevel) {
lastLevel = firstLevel;
} else {

View File

@ -602,31 +602,31 @@ pop_texture_group(struct gl_context *ctx, struct gl_texture_attrib_node *texstat
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_BASE_LEVEL, obj->BaseLevel);
_mesa_TexParameterfv(target, GL_TEXTURE_BORDER_COLOR, samp->Attrib.BorderColor.f);
_mesa_TexParameteri(target, GL_TEXTURE_WRAP_S, samp->Attrib.WrapS);
_mesa_TexParameteri(target, GL_TEXTURE_WRAP_T, samp->Attrib.WrapT);
_mesa_TexParameteri(target, GL_TEXTURE_WRAP_R, samp->Attrib.WrapR);
_mesa_TexParameteri(target, GL_TEXTURE_MIN_FILTER, samp->Attrib.MinFilter);
_mesa_TexParameteri(target, GL_TEXTURE_MAG_FILTER, samp->Attrib.MagFilter);
_mesa_TexParameterf(target, GL_TEXTURE_MIN_LOD, samp->Attrib.MinLod);
_mesa_TexParameterf(target, GL_TEXTURE_MAX_LOD, samp->Attrib.MaxLod);
_mesa_TexParameterf(target, GL_TEXTURE_LOD_BIAS, samp->Attrib.LodBias);
_mesa_TexParameterf(target, GL_TEXTURE_PRIORITY, obj->Attrib.Priority);
_mesa_TexParameteri(target, GL_TEXTURE_BASE_LEVEL, obj->Attrib.BaseLevel);
if (target != GL_TEXTURE_RECTANGLE_ARB)
_mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, obj->MaxLevel);
_mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, obj->Attrib.MaxLevel);
if (ctx->Extensions.EXT_texture_filter_anisotropic) {
_mesa_TexParameterf(target, GL_TEXTURE_MAX_ANISOTROPY_EXT,
samp->MaxAnisotropy);
samp->Attrib.MaxAnisotropy);
}
if (ctx->Extensions.ARB_shadow) {
_mesa_TexParameteri(target, GL_TEXTURE_COMPARE_MODE,
samp->CompareMode);
samp->Attrib.CompareMode);
_mesa_TexParameteri(target, GL_TEXTURE_COMPARE_FUNC,
samp->CompareFunc);
samp->Attrib.CompareFunc);
}
if (ctx->Extensions.ARB_depth_texture)
_mesa_TexParameteri(target, GL_DEPTH_TEXTURE_MODE, obj->DepthMode);
_mesa_TexParameteri(target, GL_DEPTH_TEXTURE_MODE, obj->Attrib.DepthMode);
}
/* remove saved references to the texture objects */

View File

@ -998,9 +998,9 @@ build_bitmap_atlas(struct gl_context *ctx, struct gl_bitmap_atlas *atlas,
goto out_of_memory;
}
atlas->texObj->Sampler.MinFilter = GL_NEAREST;
atlas->texObj->Sampler.MagFilter = GL_NEAREST;
atlas->texObj->MaxLevel = 0;
atlas->texObj->Sampler.Attrib.MinFilter = GL_NEAREST;
atlas->texObj->Sampler.Attrib.MagFilter = GL_NEAREST;
atlas->texObj->Attrib.MaxLevel = 0;
atlas->texObj->Immutable = GL_TRUE;
atlas->texImage = _mesa_get_tex_image(ctx, atlas->texObj,

View File

@ -286,7 +286,7 @@ static GLuint make_state_key( struct gl_context *ctx, struct state_key *key )
key->unit[i].source_index = texObj->TargetIndex;
const struct gl_sampler_object *samp = _mesa_get_samplerobj(ctx, i);
if (samp->CompareMode == GL_COMPARE_R_TO_TEXTURE) {
if (samp->Attrib.CompareMode == GL_COMPARE_R_TO_TEXTURE) {
const GLenum format = _mesa_texture_base_format(texObj);
key->unit[i].shadow = (format == GL_DEPTH_COMPONENT ||
format == GL_DEPTH_STENCIL_EXT);

View File

@ -117,7 +117,7 @@ generate_texture_mipmap(struct gl_context *ctx,
FLUSH_VERTICES(ctx, 0);
if (texObj->BaseLevel >= texObj->MaxLevel) {
if (texObj->Attrib.BaseLevel >= texObj->Attrib.MaxLevel) {
/* nothing to do */
return;
}
@ -131,7 +131,7 @@ generate_texture_mipmap(struct gl_context *ctx,
_mesa_lock_texture(ctx, texObj);
srcImage = _mesa_select_tex_image(texObj, target, texObj->BaseLevel);
srcImage = _mesa_select_tex_image(texObj, target, texObj->Attrib.BaseLevel);
if (caller) {
if (!srcImage) {
_mesa_unlock_texture(ctx, texObj);

View File

@ -57,10 +57,10 @@ _mesa_compute_num_levels(struct gl_context *ctx,
const struct gl_texture_image *baseImage;
GLuint numLevels;
baseImage = _mesa_get_tex_image(ctx, texObj, target, texObj->BaseLevel);
baseImage = _mesa_get_tex_image(ctx, texObj, target, texObj->Attrib.BaseLevel);
numLevels = texObj->BaseLevel + baseImage->MaxNumLevels;
numLevels = MIN2(numLevels, (GLuint) texObj->MaxLevel + 1);
numLevels = texObj->Attrib.BaseLevel + baseImage->MaxNumLevels;
numLevels = MIN2(numLevels, (GLuint) texObj->Attrib.MaxLevel + 1);
if (texObj->Immutable)
numLevels = MIN2(numLevels, texObj->NumLevels);
assert(numLevels >= 1);
@ -1954,7 +1954,7 @@ generate_mipmap_uncompressed(struct gl_context *ctx, GLenum target,
_mesa_uncompressed_format_to_type_and_comps(srcImage->TexFormat, &datatype, &comps);
for (level = texObj->BaseLevel; level < maxLevel; level++) {
for (level = texObj->Attrib.BaseLevel; level < maxLevel; level++) {
/* generate image[level+1] from image[level] */
struct gl_texture_image *srcImage, *dstImage;
GLint srcRowStride, dstRowStride;
@ -2130,7 +2130,7 @@ generate_mipmap_compressed(struct gl_context *ctx, GLenum target,
ctx->Pack = ctx->DefaultPacking;
/* Get the uncompressed image */
assert(srcImage->Level == texObj->BaseLevel);
assert(srcImage->Level == texObj->Attrib.BaseLevel);
ctx->Driver.GetTexSubImage(ctx,
0, 0, 0,
srcImage->Width, srcImage->Height,
@ -2141,7 +2141,7 @@ generate_mipmap_compressed(struct gl_context *ctx, GLenum target,
ctx->Pack = save;
}
for (level = texObj->BaseLevel; level < maxLevel; level++) {
for (level = texObj->Attrib.BaseLevel; level < maxLevel; level++) {
/* generate image[level+1] from image[level] */
const struct gl_texture_image *srcImage;
struct gl_texture_image *dstImage;
@ -2237,15 +2237,15 @@ _mesa_generate_mipmap(struct gl_context *ctx, GLenum target,
GLint maxLevel;
assert(texObj);
srcImage = _mesa_select_tex_image(texObj, target, texObj->BaseLevel);
srcImage = _mesa_select_tex_image(texObj, target, texObj->Attrib.BaseLevel);
assert(srcImage);
maxLevel = _mesa_max_texture_levels(ctx, texObj->Target) - 1;
assert(maxLevel >= 0); /* bad target */
maxLevel = MIN2(maxLevel, texObj->MaxLevel);
maxLevel = MIN2(maxLevel, texObj->Attrib.MaxLevel);
_mesa_prepare_mipmap_levels(ctx, texObj, texObj->BaseLevel, maxLevel);
_mesa_prepare_mipmap_levels(ctx, texObj, texObj->Attrib.BaseLevel, maxLevel);
if (_mesa_is_format_compressed(srcImage->TexFormat)) {
generate_mipmap_compressed(ctx, target, texObj, srcImage, maxLevel);

View File

@ -933,6 +933,47 @@ typedef enum
MAX_FACES = 6
} gl_face_index;
/**
* Sampler state saved and restore by glPush/PopAttrib.
*
* Don't put fields here that glPushAttrib shouldn't save.
* E.g. no GLES fields because GLES doesn't have glPushAttrib.
*/
struct gl_sampler_attrib
{
GLenum16 WrapS; /**< S-axis texture image wrap mode */
GLenum16 WrapT; /**< T-axis texture image wrap mode */
GLenum16 WrapR; /**< R-axis texture image wrap mode */
GLenum16 MinFilter; /**< minification filter */
GLenum16 MagFilter; /**< magnification filter */
GLenum16 sRGBDecode; /**< GL_DECODE_EXT or GL_SKIP_DECODE_EXT */
union gl_color_union 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 */
GLfloat MaxAnisotropy; /**< GL_EXT_texture_filter_anisotropic */
GLenum16 CompareMode; /**< GL_ARB_shadow */
GLenum16 CompareFunc; /**< GL_ARB_shadow */
GLboolean CubeMapSeamless; /**< GL_AMD_seamless_cubemap_per_texture */
};
/**
* Texture state saved and restored by glPush/PopAttrib.
*
* Don't put fields here that glPushAttrib shouldn't save.
* E.g. no GLES fields because GLES doesn't have glPushAttrib.
*/
struct gl_texture_object_attrib
{
GLfloat Priority; /**< in [0,1] */
GLint BaseLevel; /**< min mipmap level, OpenGL 1.2 */
GLint MaxLevel; /**< max mipmap level (max=1000), OpenGL 1.2 */
GLenum Swizzle[4]; /**< GL_EXT_texture_swizzle */
GLushort _Swizzle; /**< same as Swizzle, but SWIZZLE_* format */
GLenum16 DepthMode; /**< GL_ARB_depth_texture */
bool StencilSampling; /**< Should we sample stencil instead of depth? */
GLboolean GenerateMipmap; /**< GL_SGIS_generate_mipmap */
};
/**
* Sampler object state. These objects are new with GL_ARB_sampler_objects
@ -945,20 +986,7 @@ struct gl_sampler_object
GLchar *Label; /**< GL_KHR_debug */
GLint RefCount;
GLenum16 WrapS; /**< S-axis texture image wrap mode */
GLenum16 WrapT; /**< T-axis texture image wrap mode */
GLenum16 WrapR; /**< R-axis texture image wrap mode */
GLenum16 MinFilter; /**< minification filter */
GLenum16 MagFilter; /**< magnification filter */
GLenum16 sRGBDecode; /**< GL_DECODE_EXT or GL_SKIP_DECODE_EXT */
union gl_color_union 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 */
GLfloat MaxAnisotropy; /**< GL_EXT_texture_filter_anisotropic */
GLenum16 CompareMode; /**< GL_ARB_shadow */
GLenum16 CompareFunc; /**< GL_ARB_shadow */
GLboolean CubeMapSeamless; /**< GL_AMD_seamless_cubemap_per_texture */
struct gl_sampler_attrib Attrib; /**< State saved by glPushAttrib */
/** GL_ARB_bindless_texture */
bool HandleAllocated;
@ -976,23 +1004,17 @@ struct gl_texture_object
GLint RefCount; /**< reference count */
GLuint Name; /**< the user-visible texture object ID */
GLenum16 Target; /**< GL_TEXTURE_1D, GL_TEXTURE_2D, etc. */
GLenum16 DepthMode; /**< GL_ARB_depth_texture */
GLchar *Label; /**< GL_KHR_debug */
struct gl_sampler_object Sampler;
struct gl_texture_object_attrib Attrib; /**< State saved by glPushAttrib */
gl_texture_index TargetIndex; /**< The gl_texture_unit::CurrentTex index.
Only valid when Target is valid. */
GLfloat Priority; /**< in [0,1] */
GLint MaxLevel; /**< max mipmap level (max=1000), OpenGL 1.2 */
GLint BaseLevel; /**< min mipmap level, OpenGL 1.2 */
GLbyte _MaxLevel; /**< actual max mipmap level (q in the spec) */
GLfloat _MaxLambda; /**< = _MaxLevel - BaseLevel (q - p in spec) */
GLint CropRect[4]; /**< GL_OES_draw_texture */
GLenum Swizzle[4]; /**< GL_EXT_texture_swizzle */
GLushort _Swizzle; /**< same as Swizzle, but SWIZZLE_* format */
GLbyte ImmutableLevels; /**< ES 3.0 / ARB_texture_view */
GLboolean GenerateMipmap; /**< GL_SGIS_generate_mipmap */
GLboolean _BaseComplete; /**< Is the base texture level valid? */
GLboolean _MipmapComplete; /**< Is the whole mipmap valid? */
GLboolean _IsIntegerFormat; /**< Does the texture store integer values? */
@ -1002,7 +1024,6 @@ struct gl_texture_object
GLboolean Immutable; /**< GL_ARB_texture_storage */
GLboolean _IsFloat; /**< GL_OES_float_texture */
GLboolean _IsHalfFloat; /**< GL_OES_half_float_texture */
bool StencilSampling; /**< Should we sample stencil instead of depth? */
bool HandleAllocated; /**< GL_ARB_bindless_texture */
/** GL_OES_EGL_image_external */

View File

@ -117,23 +117,23 @@ _mesa_init_sampler_object(struct gl_sampler_object *sampObj, GLuint name)
simple_mtx_init(&sampObj->Mutex, mtx_plain);
sampObj->Name = name;
sampObj->RefCount = 1;
sampObj->WrapS = GL_REPEAT;
sampObj->WrapT = GL_REPEAT;
sampObj->WrapR = GL_REPEAT;
sampObj->MinFilter = GL_NEAREST_MIPMAP_LINEAR;
sampObj->MagFilter = GL_LINEAR;
sampObj->BorderColor.f[0] = 0.0;
sampObj->BorderColor.f[1] = 0.0;
sampObj->BorderColor.f[2] = 0.0;
sampObj->BorderColor.f[3] = 0.0;
sampObj->MinLod = -1000.0F;
sampObj->MaxLod = 1000.0F;
sampObj->LodBias = 0.0F;
sampObj->MaxAnisotropy = 1.0F;
sampObj->CompareMode = GL_NONE;
sampObj->CompareFunc = GL_LEQUAL;
sampObj->sRGBDecode = GL_DECODE_EXT;
sampObj->CubeMapSeamless = GL_FALSE;
sampObj->Attrib.WrapS = GL_REPEAT;
sampObj->Attrib.WrapT = GL_REPEAT;
sampObj->Attrib.WrapR = GL_REPEAT;
sampObj->Attrib.MinFilter = GL_NEAREST_MIPMAP_LINEAR;
sampObj->Attrib.MagFilter = GL_LINEAR;
sampObj->Attrib.BorderColor.f[0] = 0.0;
sampObj->Attrib.BorderColor.f[1] = 0.0;
sampObj->Attrib.BorderColor.f[2] = 0.0;
sampObj->Attrib.BorderColor.f[3] = 0.0;
sampObj->Attrib.MinLod = -1000.0F;
sampObj->Attrib.MaxLod = 1000.0F;
sampObj->Attrib.LodBias = 0.0F;
sampObj->Attrib.MaxAnisotropy = 1.0F;
sampObj->Attrib.CompareMode = GL_NONE;
sampObj->Attrib.CompareFunc = GL_LEQUAL;
sampObj->Attrib.sRGBDecode = GL_DECODE_EXT;
sampObj->Attrib.CubeMapSeamless = GL_FALSE;
sampObj->HandleAllocated = GL_FALSE;
/* GL_ARB_bindless_texture */
@ -521,13 +521,13 @@ _mesa_set_sampler_wrap(struct gl_context *ctx, struct gl_sampler_object *samp,
assert(validate_texture_wrap_mode(ctx, t));
assert(validate_texture_wrap_mode(ctx, r));
if (samp->WrapS == s && samp->WrapT == t && samp->WrapR == r)
if (samp->Attrib.WrapS == s && samp->Attrib.WrapT == t && samp->Attrib.WrapR == r)
return;
flush(ctx);
samp->WrapS = s;
samp->WrapT = t;
samp->WrapR = r;
samp->Attrib.WrapS = s;
samp->Attrib.WrapT = t;
samp->Attrib.WrapR = r;
}
#define INVALID_PARAM 0x100
@ -538,11 +538,11 @@ static GLuint
set_sampler_wrap_s(struct gl_context *ctx, struct gl_sampler_object *samp,
GLint param)
{
if (samp->WrapS == param)
if (samp->Attrib.WrapS == param)
return GL_FALSE;
if (validate_texture_wrap_mode(ctx, param)) {
flush(ctx);
samp->WrapS = param;
samp->Attrib.WrapS = param;
return GL_TRUE;
}
return INVALID_PARAM;
@ -553,11 +553,11 @@ static GLuint
set_sampler_wrap_t(struct gl_context *ctx, struct gl_sampler_object *samp,
GLint param)
{
if (samp->WrapT == param)
if (samp->Attrib.WrapT == param)
return GL_FALSE;
if (validate_texture_wrap_mode(ctx, param)) {
flush(ctx);
samp->WrapT = param;
samp->Attrib.WrapT = param;
return GL_TRUE;
}
return INVALID_PARAM;
@ -568,11 +568,11 @@ static GLuint
set_sampler_wrap_r(struct gl_context *ctx, struct gl_sampler_object *samp,
GLint param)
{
if (samp->WrapR == param)
if (samp->Attrib.WrapR == param)
return GL_FALSE;
if (validate_texture_wrap_mode(ctx, param)) {
flush(ctx);
samp->WrapR = param;
samp->Attrib.WrapR = param;
return GL_TRUE;
}
return INVALID_PARAM;
@ -592,19 +592,19 @@ _mesa_set_sampler_filters(struct gl_context *ctx,
assert(mag_filter == GL_NEAREST ||
mag_filter == GL_LINEAR);
if (samp->MinFilter == min_filter && samp->MagFilter == mag_filter)
if (samp->Attrib.MinFilter == min_filter && samp->Attrib.MagFilter == mag_filter)
return;
flush(ctx);
samp->MinFilter = min_filter;
samp->MagFilter = mag_filter;
samp->Attrib.MinFilter = min_filter;
samp->Attrib.MagFilter = mag_filter;
}
static GLuint
set_sampler_min_filter(struct gl_context *ctx, struct gl_sampler_object *samp,
GLint param)
{
if (samp->MinFilter == param)
if (samp->Attrib.MinFilter == param)
return GL_FALSE;
switch (param) {
@ -615,7 +615,7 @@ set_sampler_min_filter(struct gl_context *ctx, struct gl_sampler_object *samp,
case GL_NEAREST_MIPMAP_LINEAR:
case GL_LINEAR_MIPMAP_LINEAR:
flush(ctx);
samp->MinFilter = param;
samp->Attrib.MinFilter = param;
return GL_TRUE;
default:
return INVALID_PARAM;
@ -627,14 +627,14 @@ static GLuint
set_sampler_mag_filter(struct gl_context *ctx, struct gl_sampler_object *samp,
GLint param)
{
if (samp->MagFilter == param)
if (samp->Attrib.MagFilter == param)
return GL_FALSE;
switch (param) {
case GL_NEAREST:
case GL_LINEAR:
flush(ctx);
samp->MagFilter = param;
samp->Attrib.MagFilter = param;
return GL_TRUE;
default:
return INVALID_PARAM;
@ -646,11 +646,11 @@ static GLuint
set_sampler_lod_bias(struct gl_context *ctx, struct gl_sampler_object *samp,
GLfloat param)
{
if (samp->LodBias == param)
if (samp->Attrib.LodBias == param)
return GL_FALSE;
flush(ctx);
samp->LodBias = param;
samp->Attrib.LodBias = param;
return GL_TRUE;
}
@ -661,10 +661,10 @@ set_sampler_border_colorf(struct gl_context *ctx,
const GLfloat params[4])
{
flush(ctx);
samp->BorderColor.f[RCOMP] = params[0];
samp->BorderColor.f[GCOMP] = params[1];
samp->BorderColor.f[BCOMP] = params[2];
samp->BorderColor.f[ACOMP] = params[3];
samp->Attrib.BorderColor.f[RCOMP] = params[0];
samp->Attrib.BorderColor.f[GCOMP] = params[1];
samp->Attrib.BorderColor.f[BCOMP] = params[2];
samp->Attrib.BorderColor.f[ACOMP] = params[3];
return GL_TRUE;
}
@ -675,10 +675,10 @@ set_sampler_border_colori(struct gl_context *ctx,
const GLint params[4])
{
flush(ctx);
samp->BorderColor.i[RCOMP] = params[0];
samp->BorderColor.i[GCOMP] = params[1];
samp->BorderColor.i[BCOMP] = params[2];
samp->BorderColor.i[ACOMP] = params[3];
samp->Attrib.BorderColor.i[RCOMP] = params[0];
samp->Attrib.BorderColor.i[GCOMP] = params[1];
samp->Attrib.BorderColor.i[BCOMP] = params[2];
samp->Attrib.BorderColor.i[ACOMP] = params[3];
return GL_TRUE;
}
@ -689,10 +689,10 @@ set_sampler_border_colorui(struct gl_context *ctx,
const GLuint params[4])
{
flush(ctx);
samp->BorderColor.ui[RCOMP] = params[0];
samp->BorderColor.ui[GCOMP] = params[1];
samp->BorderColor.ui[BCOMP] = params[2];
samp->BorderColor.ui[ACOMP] = params[3];
samp->Attrib.BorderColor.ui[RCOMP] = params[0];
samp->Attrib.BorderColor.ui[GCOMP] = params[1];
samp->Attrib.BorderColor.ui[BCOMP] = params[2];
samp->Attrib.BorderColor.ui[ACOMP] = params[3];
return GL_TRUE;
}
@ -701,11 +701,11 @@ static GLuint
set_sampler_min_lod(struct gl_context *ctx, struct gl_sampler_object *samp,
GLfloat param)
{
if (samp->MinLod == param)
if (samp->Attrib.MinLod == param)
return GL_FALSE;
flush(ctx);
samp->MinLod = param;
samp->Attrib.MinLod = param;
return GL_TRUE;
}
@ -714,11 +714,11 @@ static GLuint
set_sampler_max_lod(struct gl_context *ctx, struct gl_sampler_object *samp,
GLfloat param)
{
if (samp->MaxLod == param)
if (samp->Attrib.MaxLod == param)
return GL_FALSE;
flush(ctx);
samp->MaxLod = param;
samp->Attrib.MaxLod = param;
return GL_TRUE;
}
@ -734,13 +734,13 @@ set_sampler_compare_mode(struct gl_context *ctx,
if (!ctx->Extensions.ARB_shadow)
return GL_FALSE;
if (samp->CompareMode == param)
if (samp->Attrib.CompareMode == param)
return GL_FALSE;
if (param == GL_NONE ||
param == GL_COMPARE_R_TO_TEXTURE_ARB) {
flush(ctx);
samp->CompareMode = param;
samp->Attrib.CompareMode = param;
return GL_TRUE;
}
@ -759,7 +759,7 @@ set_sampler_compare_func(struct gl_context *ctx,
if (!ctx->Extensions.ARB_shadow)
return GL_FALSE;
if (samp->CompareFunc == param)
if (samp->Attrib.CompareFunc == param)
return GL_FALSE;
switch (param) {
@ -772,7 +772,7 @@ set_sampler_compare_func(struct gl_context *ctx,
case GL_ALWAYS:
case GL_NEVER:
flush(ctx);
samp->CompareFunc = param;
samp->Attrib.CompareFunc = param;
return GL_TRUE;
default:
return INVALID_PARAM;
@ -787,7 +787,7 @@ set_sampler_max_anisotropy(struct gl_context *ctx,
if (!ctx->Extensions.EXT_texture_filter_anisotropic)
return INVALID_PNAME;
if (samp->MaxAnisotropy == param)
if (samp->Attrib.MaxAnisotropy == param)
return GL_FALSE;
if (param < 1.0F)
@ -795,7 +795,7 @@ set_sampler_max_anisotropy(struct gl_context *ctx,
flush(ctx);
/* clamp to max, that's what NVIDIA does */
samp->MaxAnisotropy = MIN2(param, ctx->Const.MaxTextureMaxAnisotropy);
samp->Attrib.MaxAnisotropy = MIN2(param, ctx->Const.MaxTextureMaxAnisotropy);
return GL_TRUE;
}
@ -808,14 +808,14 @@ set_sampler_cube_map_seamless(struct gl_context *ctx,
|| !ctx->Extensions.AMD_seamless_cubemap_per_texture)
return INVALID_PNAME;
if (samp->CubeMapSeamless == param)
if (samp->Attrib.CubeMapSeamless == param)
return GL_FALSE;
if (param != GL_TRUE && param != GL_FALSE)
return INVALID_VALUE;
flush(ctx);
samp->CubeMapSeamless = param;
samp->Attrib.CubeMapSeamless = param;
return GL_TRUE;
}
@ -826,7 +826,7 @@ _mesa_set_sampler_srgb_decode(struct gl_context *ctx,
assert(param == GL_DECODE_EXT || param == GL_SKIP_DECODE_EXT);
flush(ctx);
samp->sRGBDecode = param;
samp->Attrib.sRGBDecode = param;
}
static GLuint
@ -836,7 +836,7 @@ set_sampler_srgb_decode(struct gl_context *ctx,
if (!ctx->Extensions.EXT_texture_sRGB_decode)
return INVALID_PNAME;
if (samp->sRGBDecode == param)
if (samp->Attrib.sRGBDecode == param)
return GL_FALSE;
/* The EXT_texture_sRGB_decode spec says:
@ -854,7 +854,7 @@ set_sampler_srgb_decode(struct gl_context *ctx,
return INVALID_PARAM;
flush(ctx);
samp->sRGBDecode = param;
samp->Attrib.sRGBDecode = param;
return GL_TRUE;
}
@ -1410,47 +1410,47 @@ _mesa_GetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params)
switch (pname) {
case GL_TEXTURE_WRAP_S:
*params = sampObj->WrapS;
*params = sampObj->Attrib.WrapS;
break;
case GL_TEXTURE_WRAP_T:
*params = sampObj->WrapT;
*params = sampObj->Attrib.WrapT;
break;
case GL_TEXTURE_WRAP_R:
*params = sampObj->WrapR;
*params = sampObj->Attrib.WrapR;
break;
case GL_TEXTURE_MIN_FILTER:
*params = sampObj->MinFilter;
*params = sampObj->Attrib.MinFilter;
break;
case GL_TEXTURE_MAG_FILTER:
*params = sampObj->MagFilter;
*params = sampObj->Attrib.MagFilter;
break;
case GL_TEXTURE_MIN_LOD:
/* GL spec 'Data Conversions' section specifies that floating-point
* value in integer Get function is rounded to nearest integer
*/
*params = lroundf(sampObj->MinLod);
*params = lroundf(sampObj->Attrib.MinLod);
break;
case GL_TEXTURE_MAX_LOD:
/* GL spec 'Data Conversions' section specifies that floating-point
* value in integer Get function is rounded to nearest integer
*/
*params = lroundf(sampObj->MaxLod);
*params = lroundf(sampObj->Attrib.MaxLod);
break;
case GL_TEXTURE_LOD_BIAS:
/* GL spec 'Data Conversions' section specifies that floating-point
* value in integer Get function is rounded to nearest integer
*/
*params = lroundf(sampObj->LodBias);
*params = lroundf(sampObj->Attrib.LodBias);
break;
case GL_TEXTURE_COMPARE_MODE:
if (!ctx->Extensions.ARB_shadow)
goto invalid_pname;
*params = sampObj->CompareMode;
*params = sampObj->Attrib.CompareMode;
break;
case GL_TEXTURE_COMPARE_FUNC:
if (!ctx->Extensions.ARB_shadow)
goto invalid_pname;
*params = sampObj->CompareFunc;
*params = sampObj->Attrib.CompareFunc;
break;
case GL_TEXTURE_MAX_ANISOTROPY_EXT:
if (!ctx->Extensions.EXT_texture_filter_anisotropic)
@ -1458,25 +1458,25 @@ _mesa_GetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params)
/* GL spec 'Data Conversions' section specifies that floating-point
* value in integer Get function is rounded to nearest integer
*/
*params = lroundf(sampObj->MaxAnisotropy);
*params = lroundf(sampObj->Attrib.MaxAnisotropy);
break;
case GL_TEXTURE_BORDER_COLOR:
if (!ctx->Extensions.ARB_texture_border_clamp)
goto invalid_pname;
params[0] = FLOAT_TO_INT(sampObj->BorderColor.f[0]);
params[1] = FLOAT_TO_INT(sampObj->BorderColor.f[1]);
params[2] = FLOAT_TO_INT(sampObj->BorderColor.f[2]);
params[3] = FLOAT_TO_INT(sampObj->BorderColor.f[3]);
params[0] = FLOAT_TO_INT(sampObj->Attrib.BorderColor.f[0]);
params[1] = FLOAT_TO_INT(sampObj->Attrib.BorderColor.f[1]);
params[2] = FLOAT_TO_INT(sampObj->Attrib.BorderColor.f[2]);
params[3] = FLOAT_TO_INT(sampObj->Attrib.BorderColor.f[3]);
break;
case GL_TEXTURE_CUBE_MAP_SEAMLESS:
if (!ctx->Extensions.AMD_seamless_cubemap_per_texture)
goto invalid_pname;
*params = sampObj->CubeMapSeamless;
*params = sampObj->Attrib.CubeMapSeamless;
break;
case GL_TEXTURE_SRGB_DECODE_EXT:
if (!ctx->Extensions.EXT_texture_sRGB_decode)
goto invalid_pname;
*params = (GLenum) sampObj->sRGBDecode;
*params = (GLenum) sampObj->Attrib.sRGBDecode;
break;
default:
goto invalid_pname;
@ -1502,53 +1502,53 @@ _mesa_GetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params)
switch (pname) {
case GL_TEXTURE_WRAP_S:
*params = (GLfloat) sampObj->WrapS;
*params = (GLfloat) sampObj->Attrib.WrapS;
break;
case GL_TEXTURE_WRAP_T:
*params = (GLfloat) sampObj->WrapT;
*params = (GLfloat) sampObj->Attrib.WrapT;
break;
case GL_TEXTURE_WRAP_R:
*params = (GLfloat) sampObj->WrapR;
*params = (GLfloat) sampObj->Attrib.WrapR;
break;
case GL_TEXTURE_MIN_FILTER:
*params = (GLfloat) sampObj->MinFilter;
*params = (GLfloat) sampObj->Attrib.MinFilter;
break;
case GL_TEXTURE_MAG_FILTER:
*params = (GLfloat) sampObj->MagFilter;
*params = (GLfloat) sampObj->Attrib.MagFilter;
break;
case GL_TEXTURE_MIN_LOD:
*params = sampObj->MinLod;
*params = sampObj->Attrib.MinLod;
break;
case GL_TEXTURE_MAX_LOD:
*params = sampObj->MaxLod;
*params = sampObj->Attrib.MaxLod;
break;
case GL_TEXTURE_LOD_BIAS:
*params = sampObj->LodBias;
*params = sampObj->Attrib.LodBias;
break;
case GL_TEXTURE_COMPARE_MODE:
*params = (GLfloat) sampObj->CompareMode;
*params = (GLfloat) sampObj->Attrib.CompareMode;
break;
case GL_TEXTURE_COMPARE_FUNC:
*params = (GLfloat) sampObj->CompareFunc;
*params = (GLfloat) sampObj->Attrib.CompareFunc;
break;
case GL_TEXTURE_MAX_ANISOTROPY_EXT:
*params = sampObj->MaxAnisotropy;
*params = sampObj->Attrib.MaxAnisotropy;
break;
case GL_TEXTURE_BORDER_COLOR:
params[0] = sampObj->BorderColor.f[0];
params[1] = sampObj->BorderColor.f[1];
params[2] = sampObj->BorderColor.f[2];
params[3] = sampObj->BorderColor.f[3];
params[0] = sampObj->Attrib.BorderColor.f[0];
params[1] = sampObj->Attrib.BorderColor.f[1];
params[2] = sampObj->Attrib.BorderColor.f[2];
params[3] = sampObj->Attrib.BorderColor.f[3];
break;
case GL_TEXTURE_CUBE_MAP_SEAMLESS:
if (!ctx->Extensions.AMD_seamless_cubemap_per_texture)
goto invalid_pname;
*params = (GLfloat) sampObj->CubeMapSeamless;
*params = (GLfloat) sampObj->Attrib.CubeMapSeamless;
break;
case GL_TEXTURE_SRGB_DECODE_EXT:
if (!ctx->Extensions.EXT_texture_sRGB_decode)
goto invalid_pname;
*params = (GLfloat) sampObj->sRGBDecode;
*params = (GLfloat) sampObj->Attrib.sRGBDecode;
break;
default:
goto invalid_pname;
@ -1574,53 +1574,53 @@ _mesa_GetSamplerParameterIiv(GLuint sampler, GLenum pname, GLint *params)
switch (pname) {
case GL_TEXTURE_WRAP_S:
*params = sampObj->WrapS;
*params = sampObj->Attrib.WrapS;
break;
case GL_TEXTURE_WRAP_T:
*params = sampObj->WrapT;
*params = sampObj->Attrib.WrapT;
break;
case GL_TEXTURE_WRAP_R:
*params = sampObj->WrapR;
*params = sampObj->Attrib.WrapR;
break;
case GL_TEXTURE_MIN_FILTER:
*params = sampObj->MinFilter;
*params = sampObj->Attrib.MinFilter;
break;
case GL_TEXTURE_MAG_FILTER:
*params = sampObj->MagFilter;
*params = sampObj->Attrib.MagFilter;
break;
case GL_TEXTURE_MIN_LOD:
*params = (GLint) sampObj->MinLod;
*params = (GLint) sampObj->Attrib.MinLod;
break;
case GL_TEXTURE_MAX_LOD:
*params = (GLint) sampObj->MaxLod;
*params = (GLint) sampObj->Attrib.MaxLod;
break;
case GL_TEXTURE_LOD_BIAS:
*params = (GLint) sampObj->LodBias;
*params = (GLint) sampObj->Attrib.LodBias;
break;
case GL_TEXTURE_COMPARE_MODE:
*params = sampObj->CompareMode;
*params = sampObj->Attrib.CompareMode;
break;
case GL_TEXTURE_COMPARE_FUNC:
*params = sampObj->CompareFunc;
*params = sampObj->Attrib.CompareFunc;
break;
case GL_TEXTURE_MAX_ANISOTROPY_EXT:
*params = (GLint) sampObj->MaxAnisotropy;
*params = (GLint) sampObj->Attrib.MaxAnisotropy;
break;
case GL_TEXTURE_BORDER_COLOR:
params[0] = sampObj->BorderColor.i[0];
params[1] = sampObj->BorderColor.i[1];
params[2] = sampObj->BorderColor.i[2];
params[3] = sampObj->BorderColor.i[3];
params[0] = sampObj->Attrib.BorderColor.i[0];
params[1] = sampObj->Attrib.BorderColor.i[1];
params[2] = sampObj->Attrib.BorderColor.i[2];
params[3] = sampObj->Attrib.BorderColor.i[3];
break;
case GL_TEXTURE_CUBE_MAP_SEAMLESS:
if (!ctx->Extensions.AMD_seamless_cubemap_per_texture)
goto invalid_pname;
*params = sampObj->CubeMapSeamless;
*params = sampObj->Attrib.CubeMapSeamless;
break;
case GL_TEXTURE_SRGB_DECODE_EXT:
if (!ctx->Extensions.EXT_texture_sRGB_decode)
goto invalid_pname;
*params = (GLenum) sampObj->sRGBDecode;
*params = (GLenum) sampObj->Attrib.sRGBDecode;
break;
default:
goto invalid_pname;
@ -1646,53 +1646,53 @@ _mesa_GetSamplerParameterIuiv(GLuint sampler, GLenum pname, GLuint *params)
switch (pname) {
case GL_TEXTURE_WRAP_S:
*params = sampObj->WrapS;
*params = sampObj->Attrib.WrapS;
break;
case GL_TEXTURE_WRAP_T:
*params = sampObj->WrapT;
*params = sampObj->Attrib.WrapT;
break;
case GL_TEXTURE_WRAP_R:
*params = sampObj->WrapR;
*params = sampObj->Attrib.WrapR;
break;
case GL_TEXTURE_MIN_FILTER:
*params = sampObj->MinFilter;
*params = sampObj->Attrib.MinFilter;
break;
case GL_TEXTURE_MAG_FILTER:
*params = sampObj->MagFilter;
*params = sampObj->Attrib.MagFilter;
break;
case GL_TEXTURE_MIN_LOD:
*params = (GLuint) sampObj->MinLod;
*params = (GLuint) sampObj->Attrib.MinLod;
break;
case GL_TEXTURE_MAX_LOD:
*params = (GLuint) sampObj->MaxLod;
*params = (GLuint) sampObj->Attrib.MaxLod;
break;
case GL_TEXTURE_LOD_BIAS:
*params = (GLuint) sampObj->LodBias;
*params = (GLuint) sampObj->Attrib.LodBias;
break;
case GL_TEXTURE_COMPARE_MODE:
*params = sampObj->CompareMode;
*params = sampObj->Attrib.CompareMode;
break;
case GL_TEXTURE_COMPARE_FUNC:
*params = sampObj->CompareFunc;
*params = sampObj->Attrib.CompareFunc;
break;
case GL_TEXTURE_MAX_ANISOTROPY_EXT:
*params = (GLuint) sampObj->MaxAnisotropy;
*params = (GLuint) sampObj->Attrib.MaxAnisotropy;
break;
case GL_TEXTURE_BORDER_COLOR:
params[0] = sampObj->BorderColor.ui[0];
params[1] = sampObj->BorderColor.ui[1];
params[2] = sampObj->BorderColor.ui[2];
params[3] = sampObj->BorderColor.ui[3];
params[0] = sampObj->Attrib.BorderColor.ui[0];
params[1] = sampObj->Attrib.BorderColor.ui[1];
params[2] = sampObj->Attrib.BorderColor.ui[2];
params[3] = sampObj->Attrib.BorderColor.ui[3];
break;
case GL_TEXTURE_CUBE_MAP_SEAMLESS:
if (!ctx->Extensions.AMD_seamless_cubemap_per_texture)
goto invalid_pname;
*params = sampObj->CubeMapSeamless;
*params = sampObj->Attrib.CubeMapSeamless;
break;
case GL_TEXTURE_SRGB_DECODE_EXT:
if (!ctx->Extensions.EXT_texture_sRGB_decode)
goto invalid_pname;
*params = (GLenum) sampObj->sRGBDecode;
*params = (GLenum) sampObj->Attrib.sRGBDecode;
break;
default:
goto invalid_pname;

View File

@ -51,7 +51,7 @@ _mesa_get_samplerobj(struct gl_context *ctx, GLuint unit)
static inline GLboolean
_mesa_is_mipmap_filter(const struct gl_sampler_object *samp)
{
return samp->MinFilter != GL_NEAREST && samp->MinFilter != GL_LINEAR;
return samp->Attrib.MinFilter != GL_NEAREST && samp->Attrib.MinFilter != GL_LINEAR;
}

View File

@ -468,10 +468,10 @@ _mesa_is_image_unit_valid(struct gl_context *ctx, struct gl_image_unit *u)
if (!t->_BaseComplete && !t->_MipmapComplete)
_mesa_test_texobj_completeness(ctx, t);
if (u->Level < t->BaseLevel ||
if (u->Level < t->Attrib.BaseLevel ||
u->Level > t->_MaxLevel ||
(u->Level == t->BaseLevel && !t->_BaseComplete) ||
(u->Level != t->BaseLevel && !t->_MipmapComplete))
(u->Level == t->Attrib.BaseLevel && !t->_BaseComplete) ||
(u->Level != t->Attrib.BaseLevel && !t->_MipmapComplete))
return GL_FALSE;
if (_mesa_tex_target_is_layered(t->Target) &&

View File

@ -2745,9 +2745,9 @@ static inline void
check_gen_mipmap(struct gl_context *ctx, GLenum target,
struct gl_texture_object *texObj, GLint level)
{
if (texObj->GenerateMipmap &&
level == texObj->BaseLevel &&
level < texObj->MaxLevel) {
if (texObj->Attrib.GenerateMipmap &&
level == texObj->Attrib.BaseLevel &&
level < texObj->Attrib.MaxLevel) {
assert(ctx->Driver.GenerateMipmap);
ctx->Driver.GenerateMipmap(ctx, target, texObj);
}

View File

@ -174,7 +174,7 @@ _mesa_get_texbuffer_format(const struct gl_context *ctx, GLenum internalFormat);
static inline const struct gl_texture_image *
_mesa_base_tex_image(const struct gl_texture_object *texObj)
{
return texObj->Image[0][texObj->BaseLevel];
return texObj->Image[0][texObj->Attrib.BaseLevel];
}

View File

@ -67,7 +67,7 @@ static bool
valid_filter_for_float(const struct gl_context *ctx,
const struct gl_texture_object *obj)
{
switch (obj->Sampler.MagFilter) {
switch (obj->Sampler.Attrib.MagFilter) {
case GL_LINEAR:
if (obj->_IsHalfFloat && !ctx->Extensions.OES_texture_half_float_linear) {
return false;
@ -82,7 +82,7 @@ valid_filter_for_float(const struct gl_context *ctx,
unreachable("Invalid mag filter");
}
switch (obj->Sampler.MinFilter) {
switch (obj->Sampler.Attrib.MinFilter) {
case GL_LINEAR:
case GL_NEAREST_MIPMAP_LINEAR:
case GL_LINEAR_MIPMAP_NEAREST:
@ -323,9 +323,9 @@ _mesa_initialize_texture_object( struct gl_context *ctx,
else {
obj->TargetIndex = NUM_TEXTURE_TARGETS; /* invalid/error value */
}
obj->Priority = 1.0F;
obj->BaseLevel = 0;
obj->MaxLevel = 1000;
obj->Attrib.Priority = 1.0F;
obj->Attrib.BaseLevel = 0;
obj->Attrib.MaxLevel = 1000;
/* must be one; no support for (YUV) planes in separate buffers */
obj->RequiredTextureImageUnits = 1;
@ -333,34 +333,34 @@ _mesa_initialize_texture_object( struct gl_context *ctx,
/* sampler state */
if (target == GL_TEXTURE_RECTANGLE_NV ||
target == GL_TEXTURE_EXTERNAL_OES) {
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;
obj->Sampler.Attrib.WrapS = GL_CLAMP_TO_EDGE;
obj->Sampler.Attrib.WrapT = GL_CLAMP_TO_EDGE;
obj->Sampler.Attrib.WrapR = GL_CLAMP_TO_EDGE;
obj->Sampler.Attrib.MinFilter = GL_LINEAR;
}
else {
obj->Sampler.WrapS = GL_REPEAT;
obj->Sampler.WrapT = GL_REPEAT;
obj->Sampler.WrapR = GL_REPEAT;
obj->Sampler.MinFilter = GL_NEAREST_MIPMAP_LINEAR;
obj->Sampler.Attrib.WrapS = GL_REPEAT;
obj->Sampler.Attrib.WrapT = GL_REPEAT;
obj->Sampler.Attrib.WrapR = GL_REPEAT;
obj->Sampler.Attrib.MinFilter = GL_NEAREST_MIPMAP_LINEAR;
}
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->DepthMode = ctx->API == API_OPENGL_CORE ? GL_RED : GL_LUMINANCE;
obj->StencilSampling = false;
obj->Sampler.CubeMapSeamless = GL_FALSE;
obj->Sampler.Attrib.MagFilter = GL_LINEAR;
obj->Sampler.Attrib.MinLod = -1000.0;
obj->Sampler.Attrib.MaxLod = 1000.0;
obj->Sampler.Attrib.LodBias = 0.0;
obj->Sampler.Attrib.MaxAnisotropy = 1.0;
obj->Sampler.Attrib.CompareMode = GL_NONE; /* ARB_shadow */
obj->Sampler.Attrib.CompareFunc = GL_LEQUAL; /* ARB_shadow */
obj->Attrib.DepthMode = ctx->API == API_OPENGL_CORE ? GL_RED : GL_LUMINANCE;
obj->Attrib.StencilSampling = false;
obj->Sampler.Attrib.CubeMapSeamless = GL_FALSE;
obj->Sampler.HandleAllocated = GL_FALSE;
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->Sampler.sRGBDecode = GL_DECODE_EXT;
obj->Attrib.Swizzle[0] = GL_RED;
obj->Attrib.Swizzle[1] = GL_GREEN;
obj->Attrib.Swizzle[2] = GL_BLUE;
obj->Attrib.Swizzle[3] = GL_ALPHA;
obj->Attrib._Swizzle = SWIZZLE_NOOP;
obj->Sampler.Attrib.sRGBDecode = GL_DECODE_EXT;
obj->BufferObjectFormat = GL_R8;
obj->_BufferObjectFormat = MESA_FORMAT_R_UNORM8;
obj->ImageFormatCompatibilityType = GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE;
@ -394,11 +394,11 @@ finish_texture_init(struct gl_context *ctx, GLenum target,
case GL_TEXTURE_RECTANGLE_NV:
case GL_TEXTURE_EXTERNAL_OES:
/* have to init wrap and filter state here - kind of klunky */
obj->Sampler.WrapS = GL_CLAMP_TO_EDGE;
obj->Sampler.WrapT = GL_CLAMP_TO_EDGE;
obj->Sampler.WrapR = GL_CLAMP_TO_EDGE;
obj->Sampler.MinFilter = filter;
obj->Sampler.MagFilter = filter;
obj->Sampler.Attrib.WrapS = GL_CLAMP_TO_EDGE;
obj->Sampler.Attrib.WrapT = GL_CLAMP_TO_EDGE;
obj->Sampler.Attrib.WrapR = GL_CLAMP_TO_EDGE;
obj->Sampler.Attrib.MinFilter = filter;
obj->Sampler.Attrib.MagFilter = filter;
if (ctx->Driver.TexParameter) {
/* XXX we probably don't need to make all these calls */
ctx->Driver.TexParameter(ctx, obj, GL_TEXTURE_WRAP_S);
@ -473,35 +473,35 @@ _mesa_copy_texture_object( struct gl_texture_object *dest,
dest->Target = src->Target;
dest->TargetIndex = src->TargetIndex;
dest->Name = src->Name;
dest->Priority = src->Priority;
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->Sampler.MaxAnisotropy = src->Sampler.MaxAnisotropy;
dest->Sampler.CompareMode = src->Sampler.CompareMode;
dest->Sampler.CompareFunc = src->Sampler.CompareFunc;
dest->Sampler.CubeMapSeamless = src->Sampler.CubeMapSeamless;
dest->DepthMode = src->DepthMode;
dest->StencilSampling = src->StencilSampling;
dest->Sampler.sRGBDecode = src->Sampler.sRGBDecode;
dest->Attrib.Priority = src->Attrib.Priority;
dest->Sampler.Attrib.BorderColor.f[0] = src->Sampler.Attrib.BorderColor.f[0];
dest->Sampler.Attrib.BorderColor.f[1] = src->Sampler.Attrib.BorderColor.f[1];
dest->Sampler.Attrib.BorderColor.f[2] = src->Sampler.Attrib.BorderColor.f[2];
dest->Sampler.Attrib.BorderColor.f[3] = src->Sampler.Attrib.BorderColor.f[3];
dest->Sampler.Attrib.WrapS = src->Sampler.Attrib.WrapS;
dest->Sampler.Attrib.WrapT = src->Sampler.Attrib.WrapT;
dest->Sampler.Attrib.WrapR = src->Sampler.Attrib.WrapR;
dest->Sampler.Attrib.MinFilter = src->Sampler.Attrib.MinFilter;
dest->Sampler.Attrib.MagFilter = src->Sampler.Attrib.MagFilter;
dest->Sampler.Attrib.MinLod = src->Sampler.Attrib.MinLod;
dest->Sampler.Attrib.MaxLod = src->Sampler.Attrib.MaxLod;
dest->Sampler.Attrib.LodBias = src->Sampler.Attrib.LodBias;
dest->Attrib.BaseLevel = src->Attrib.BaseLevel;
dest->Attrib.MaxLevel = src->Attrib.MaxLevel;
dest->Sampler.Attrib.MaxAnisotropy = src->Sampler.Attrib.MaxAnisotropy;
dest->Sampler.Attrib.CompareMode = src->Sampler.Attrib.CompareMode;
dest->Sampler.Attrib.CompareFunc = src->Sampler.Attrib.CompareFunc;
dest->Sampler.Attrib.CubeMapSeamless = src->Sampler.Attrib.CubeMapSeamless;
dest->Attrib.DepthMode = src->Attrib.DepthMode;
dest->Attrib.StencilSampling = src->Attrib.StencilSampling;
dest->Sampler.Attrib.sRGBDecode = src->Sampler.Attrib.sRGBDecode;
dest->_MaxLevel = src->_MaxLevel;
dest->_MaxLambda = src->_MaxLambda;
dest->GenerateMipmap = src->GenerateMipmap;
dest->Attrib.GenerateMipmap = src->Attrib.GenerateMipmap;
dest->_BaseComplete = src->_BaseComplete;
dest->_MipmapComplete = src->_MipmapComplete;
COPY_4V(dest->Swizzle, src->Swizzle);
dest->_Swizzle = src->_Swizzle;
COPY_4V(dest->Attrib.Swizzle, src->Attrib.Swizzle);
dest->Attrib._Swizzle = src->Attrib._Swizzle;
dest->_IsHalfFloat = src->_IsHalfFloat;
dest->_IsFloat = src->_IsFloat;
@ -682,7 +682,7 @@ void
_mesa_test_texobj_completeness( const struct gl_context *ctx,
struct gl_texture_object *t )
{
const GLint baseLevel = t->BaseLevel;
const GLint baseLevel = t->Attrib.BaseLevel;
const struct gl_texture_image *baseImage;
GLint maxLevels = 0;
@ -706,9 +706,9 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx,
return;
}
if (t->MaxLevel < baseLevel) {
if (t->Attrib.MaxLevel < baseLevel) {
incomplete(t, MIPMAP, "MAX_LEVEL (%d) < BASE_LEVEL (%d)",
t->MaxLevel, baseLevel);
t->Attrib.MaxLevel, baseLevel);
return;
}
@ -750,7 +750,7 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx,
assert(maxLevels > 0);
t->_MaxLevel = MIN3(t->MaxLevel,
t->_MaxLevel = MIN3(t->Attrib.MaxLevel,
/* 'p' in the GL spec */
(int) (baseLevel + baseImage->MaxNumLevels - 1),
/* 'q' in the GL spec */
@ -926,7 +926,7 @@ _mesa_cube_level_complete(const struct gl_texture_object *texObj,
GLboolean
_mesa_cube_complete(const struct gl_texture_object *texObj)
{
return _mesa_cube_level_complete(texObj, texObj->BaseLevel);
return _mesa_cube_level_complete(texObj, texObj->Attrib.BaseLevel);
}
/**
@ -1034,8 +1034,8 @@ _mesa_get_fallback_texture(struct gl_context *ctx, gl_texture_index tex)
return NULL;
assert(texObj->RefCount == 1);
texObj->Sampler.MinFilter = GL_NEAREST;
texObj->Sampler.MagFilter = GL_NEAREST;
texObj->Sampler.Attrib.MinFilter = GL_NEAREST;
texObj->Sampler.Attrib.MagFilter = GL_NEAREST;
texFormat = ctx->Driver.ChooseTextureFormat(ctx, target,
GL_RGBA, GL_RGBA,
@ -1172,7 +1172,7 @@ invalidate_tex_image_error_check(struct gl_context *ctx, GLuint texture,
* of the maximum texture width, height, or depth, the error
* INVALID_VALUE is generated."
*/
if (level < 0 || level > t->MaxLevel) {
if (level < 0 || level > t->Attrib.MaxLevel) {
_mesa_error(ctx, GL_INVALID_VALUE, "%s(level)", name);
return NULL;
}
@ -2089,7 +2089,7 @@ _mesa_PrioritizeTextures( GLsizei n, const GLuint *texName,
if (texName[i] > 0) {
struct gl_texture_object *t = _mesa_lookup_texture(ctx, texName[i]);
if (t) {
t->Priority = CLAMP( priorities[i], 0.0F, 1.0F );
t->Attrib.Priority = CLAMP( priorities[i], 0.0F, 1.0F );
}
}
}

View File

@ -127,7 +127,7 @@ _mesa_is_texture_complete(const struct gl_texture_object *texObj,
const struct gl_sampler_object *sampler,
bool linear_as_nearest_for_int_tex)
{
struct gl_texture_image *img = texObj->Image[0][texObj->BaseLevel];
struct gl_texture_image *img = texObj->Image[0][texObj->Attrib.BaseLevel];
bool isMultisample = img && img->NumSamples >= 2;
/*
@ -147,11 +147,11 @@ _mesa_is_texture_complete(const struct gl_texture_object *texObj,
*/
if (!isMultisample &&
(texObj->_IsIntegerFormat ||
(texObj->StencilSampling &&
(texObj->Attrib.StencilSampling &&
img->_BaseFormat == GL_DEPTH_STENCIL)) &&
(sampler->MagFilter != GL_NEAREST ||
(sampler->MinFilter != GL_NEAREST &&
sampler->MinFilter != GL_NEAREST_MIPMAP_NEAREST))) {
(sampler->Attrib.MagFilter != GL_NEAREST ||
(sampler->Attrib.MinFilter != GL_NEAREST &&
sampler->Attrib.MinFilter != GL_NEAREST_MIPMAP_NEAREST))) {
/* If the format is integer, only nearest filtering is allowed,
* but some applications (eg: Grid Autosport) uses the default
* filtering values.

View File

@ -268,13 +268,13 @@ set_tex_parameteri(struct gl_context *ctx,
if (!_mesa_target_allows_setting_sampler_parameters(texObj->Target))
goto invalid_dsa;
if (texObj->Sampler.MinFilter == params[0])
if (texObj->Sampler.Attrib.MinFilter == params[0])
return GL_FALSE;
switch (params[0]) {
case GL_NEAREST:
case GL_LINEAR:
flush(ctx);
texObj->Sampler.MinFilter = params[0];
texObj->Sampler.Attrib.MinFilter = params[0];
return GL_TRUE;
case GL_NEAREST_MIPMAP_NEAREST:
case GL_LINEAR_MIPMAP_NEAREST:
@ -283,7 +283,7 @@ set_tex_parameteri(struct gl_context *ctx,
if (texObj->Target != GL_TEXTURE_RECTANGLE_NV &&
texObj->Target != GL_TEXTURE_EXTERNAL_OES) {
flush(ctx);
texObj->Sampler.MinFilter = params[0];
texObj->Sampler.Attrib.MinFilter = params[0];
return GL_TRUE;
}
FALLTHROUGH;
@ -296,13 +296,13 @@ set_tex_parameteri(struct gl_context *ctx,
if (!_mesa_target_allows_setting_sampler_parameters(texObj->Target))
goto invalid_dsa;
if (texObj->Sampler.MagFilter == params[0])
if (texObj->Sampler.Attrib.MagFilter == params[0])
return GL_FALSE;
switch (params[0]) {
case GL_NEAREST:
case GL_LINEAR:
flush(ctx); /* does not effect completeness */
texObj->Sampler.MagFilter = params[0];
texObj->Sampler.Attrib.MagFilter = params[0];
return GL_TRUE;
default:
goto invalid_param;
@ -313,11 +313,11 @@ set_tex_parameteri(struct gl_context *ctx,
if (!_mesa_target_allows_setting_sampler_parameters(texObj->Target))
goto invalid_dsa;
if (texObj->Sampler.WrapS == params[0])
if (texObj->Sampler.Attrib.WrapS == params[0])
return GL_FALSE;
if (validate_texture_wrap_mode(ctx, texObj->Target, params[0])) {
flush(ctx);
texObj->Sampler.WrapS = params[0];
texObj->Sampler.Attrib.WrapS = params[0];
return GL_TRUE;
}
return GL_FALSE;
@ -326,11 +326,11 @@ set_tex_parameteri(struct gl_context *ctx,
if (!_mesa_target_allows_setting_sampler_parameters(texObj->Target))
goto invalid_dsa;
if (texObj->Sampler.WrapT == params[0])
if (texObj->Sampler.Attrib.WrapT == params[0])
return GL_FALSE;
if (validate_texture_wrap_mode(ctx, texObj->Target, params[0])) {
flush(ctx);
texObj->Sampler.WrapT = params[0];
texObj->Sampler.Attrib.WrapT = params[0];
return GL_TRUE;
}
return GL_FALSE;
@ -339,11 +339,11 @@ set_tex_parameteri(struct gl_context *ctx,
if (!_mesa_target_allows_setting_sampler_parameters(texObj->Target))
goto invalid_dsa;
if (texObj->Sampler.WrapR == params[0])
if (texObj->Sampler.Attrib.WrapR == params[0])
return GL_FALSE;
if (validate_texture_wrap_mode(ctx, texObj->Target, params[0])) {
flush(ctx);
texObj->Sampler.WrapR = params[0];
texObj->Sampler.Attrib.WrapR = params[0];
return GL_TRUE;
}
return GL_FALSE;
@ -352,7 +352,7 @@ set_tex_parameteri(struct gl_context *ctx,
if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
goto invalid_pname;
if (texObj->BaseLevel == params[0])
if (texObj->Attrib.BaseLevel == params[0])
return GL_FALSE;
/* Section 8.10 (Texture Parameters) of the OpenGL 4.5 Core Profile spec
@ -386,14 +386,14 @@ set_tex_parameteri(struct gl_context *ctx,
/** See note about ARB_texture_storage below */
if (texObj->Immutable)
texObj->BaseLevel = MIN2(texObj->ImmutableLevels - 1, params[0]);
texObj->Attrib.BaseLevel = MIN2(texObj->ImmutableLevels - 1, params[0]);
else
texObj->BaseLevel = params[0];
texObj->Attrib.BaseLevel = params[0];
return GL_TRUE;
case GL_TEXTURE_MAX_LEVEL:
if (texObj->MaxLevel == params[0])
if (texObj->Attrib.MaxLevel == params[0])
return GL_FALSE;
if (params[0] < 0 ||
@ -412,10 +412,10 @@ set_tex_parameteri(struct gl_context *ctx,
* passed the call to TexStorage* for the texture object.
*/
if (texObj->Immutable)
texObj->MaxLevel = CLAMP(params[0], texObj->BaseLevel,
texObj->Attrib.MaxLevel = CLAMP(params[0], texObj->Attrib.BaseLevel,
texObj->ImmutableLevels - 1);
else
texObj->MaxLevel = params[0];
texObj->Attrib.MaxLevel = params[0];
return GL_TRUE;
@ -425,9 +425,9 @@ set_tex_parameteri(struct gl_context *ctx,
if (params[0] && texObj->Target == GL_TEXTURE_EXTERNAL_OES)
goto invalid_param;
if (texObj->GenerateMipmap != params[0]) {
if (texObj->Attrib.GenerateMipmap != params[0]) {
/* no flush() */
texObj->GenerateMipmap = params[0] ? GL_TRUE : GL_FALSE;
texObj->Attrib.GenerateMipmap = params[0] ? GL_TRUE : GL_FALSE;
return GL_TRUE;
}
return GL_FALSE;
@ -439,12 +439,12 @@ set_tex_parameteri(struct gl_context *ctx,
if (!_mesa_target_allows_setting_sampler_parameters(texObj->Target))
goto invalid_dsa;
if (texObj->Sampler.CompareMode == params[0])
if (texObj->Sampler.Attrib.CompareMode == params[0])
return GL_FALSE;
if (params[0] == GL_NONE ||
params[0] == GL_COMPARE_R_TO_TEXTURE_ARB) {
flush(ctx);
texObj->Sampler.CompareMode = params[0];
texObj->Sampler.Attrib.CompareMode = params[0];
return GL_TRUE;
}
goto invalid_param;
@ -458,7 +458,7 @@ set_tex_parameteri(struct gl_context *ctx,
if (!_mesa_target_allows_setting_sampler_parameters(texObj->Target))
goto invalid_dsa;
if (texObj->Sampler.CompareFunc == params[0])
if (texObj->Sampler.Attrib.CompareFunc == params[0])
return GL_FALSE;
switch (params[0]) {
case GL_LEQUAL:
@ -470,7 +470,7 @@ set_tex_parameteri(struct gl_context *ctx,
case GL_ALWAYS:
case GL_NEVER:
flush(ctx);
texObj->Sampler.CompareFunc = params[0];
texObj->Sampler.Attrib.CompareFunc = params[0];
return GL_TRUE;
default:
goto invalid_param;
@ -483,14 +483,14 @@ set_tex_parameteri(struct gl_context *ctx,
* existed in OpenGL ES.
*/
if (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.ARB_depth_texture) {
if (texObj->DepthMode == params[0])
if (texObj->Attrib.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->Attrib.DepthMode = params[0];
return GL_TRUE;
}
goto invalid_param;
@ -503,10 +503,10 @@ set_tex_parameteri(struct gl_context *ctx,
if (!stencil && params[0] != GL_DEPTH_COMPONENT)
goto invalid_param;
if (texObj->StencilSampling == stencil)
if (texObj->Attrib.StencilSampling == stencil)
return GL_FALSE;
texObj->StencilSampling = stencil;
texObj->Attrib.StencilSampling = stencil;
return GL_TRUE;
}
goto invalid_pname;
@ -537,8 +537,8 @@ set_tex_parameteri(struct gl_context *ctx,
assert(comp < 4);
flush(ctx);
texObj->Swizzle[comp] = params[0];
set_swizzle_component(&texObj->_Swizzle, comp, swz);
texObj->Attrib.Swizzle[comp] = params[0];
set_swizzle_component(&texObj->Attrib._Swizzle, comp, swz);
return GL_TRUE;
}
goto invalid_pname;
@ -551,8 +551,8 @@ set_tex_parameteri(struct gl_context *ctx,
for (comp = 0; comp < 4; comp++) {
const GLint swz = comp_to_swizzle(params[comp]);
if (swz >= 0) {
texObj->Swizzle[comp] = params[comp];
set_swizzle_component(&texObj->_Swizzle, comp, swz);
texObj->Attrib.Swizzle[comp] = params[comp];
set_swizzle_component(&texObj->Attrib._Swizzle, comp, swz);
}
else {
_mesa_error(ctx, GL_INVALID_ENUM,
@ -573,9 +573,9 @@ set_tex_parameteri(struct gl_context *ctx,
goto invalid_dsa;
if (decode == GL_DECODE_EXT || decode == GL_SKIP_DECODE_EXT) {
if (texObj->Sampler.sRGBDecode != decode) {
if (texObj->Sampler.Attrib.sRGBDecode != decode) {
flush(ctx);
texObj->Sampler.sRGBDecode = decode;
texObj->Sampler.Attrib.sRGBDecode = decode;
}
return GL_TRUE;
}
@ -593,9 +593,9 @@ set_tex_parameteri(struct gl_context *ctx,
if (param != GL_TRUE && param != GL_FALSE) {
goto invalid_param;
}
if (param != texObj->Sampler.CubeMapSeamless) {
if (param != texObj->Sampler.Attrib.CubeMapSeamless) {
flush(ctx);
texObj->Sampler.CubeMapSeamless = param;
texObj->Sampler.Attrib.CubeMapSeamless = param;
}
return GL_TRUE;
}
@ -671,10 +671,10 @@ set_tex_parameterf(struct gl_context *ctx,
if (!_mesa_target_allows_setting_sampler_parameters(texObj->Target))
goto invalid_dsa;
if (texObj->Sampler.MinLod == params[0])
if (texObj->Sampler.Attrib.MinLod == params[0])
return GL_FALSE;
flush(ctx);
texObj->Sampler.MinLod = params[0];
texObj->Sampler.Attrib.MinLod = params[0];
return GL_TRUE;
case GL_TEXTURE_MAX_LOD:
@ -684,10 +684,10 @@ set_tex_parameterf(struct gl_context *ctx,
if (!_mesa_target_allows_setting_sampler_parameters(texObj->Target))
goto invalid_dsa;
if (texObj->Sampler.MaxLod == params[0])
if (texObj->Sampler.Attrib.MaxLod == params[0])
return GL_FALSE;
flush(ctx);
texObj->Sampler.MaxLod = params[0];
texObj->Sampler.Attrib.MaxLod = params[0];
return GL_TRUE;
case GL_TEXTURE_PRIORITY:
@ -695,7 +695,7 @@ set_tex_parameterf(struct gl_context *ctx,
goto invalid_pname;
flush(ctx);
texObj->Priority = CLAMP(params[0], 0.0F, 1.0F);
texObj->Attrib.Priority = CLAMP(params[0], 0.0F, 1.0F);
return GL_TRUE;
case GL_TEXTURE_MAX_ANISOTROPY_EXT:
@ -703,7 +703,7 @@ set_tex_parameterf(struct gl_context *ctx,
if (!_mesa_target_allows_setting_sampler_parameters(texObj->Target))
goto invalid_dsa;
if (texObj->Sampler.MaxAnisotropy == params[0])
if (texObj->Sampler.Attrib.MaxAnisotropy == params[0])
return GL_FALSE;
if (params[0] < 1.0F) {
_mesa_error(ctx, GL_INVALID_VALUE, "glTex%sParameter(param)",
@ -712,7 +712,7 @@ set_tex_parameterf(struct gl_context *ctx,
}
flush(ctx);
/* clamp to max, that's what NVIDIA does */
texObj->Sampler.MaxAnisotropy = MIN2(params[0],
texObj->Sampler.Attrib.MaxAnisotropy = MIN2(params[0],
ctx->Const.MaxTextureMaxAnisotropy);
return GL_TRUE;
}
@ -731,9 +731,9 @@ set_tex_parameterf(struct gl_context *ctx,
if (!_mesa_target_allows_setting_sampler_parameters(texObj->Target))
goto invalid_dsa;
if (texObj->Sampler.LodBias != params[0]) {
if (texObj->Sampler.Attrib.LodBias != params[0]) {
flush(ctx);
texObj->Sampler.LodBias = params[0];
texObj->Sampler.Attrib.LodBias = params[0];
return GL_TRUE;
}
break;
@ -757,15 +757,15 @@ set_tex_parameterf(struct gl_context *ctx,
flush(ctx);
/* ARB_texture_float disables clamping */
if (ctx->Extensions.ARB_texture_float) {
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];
texObj->Sampler.Attrib.BorderColor.f[RCOMP] = params[0];
texObj->Sampler.Attrib.BorderColor.f[GCOMP] = params[1];
texObj->Sampler.Attrib.BorderColor.f[BCOMP] = params[2];
texObj->Sampler.Attrib.BorderColor.f[ACOMP] = params[3];
} else {
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);
texObj->Sampler.Attrib.BorderColor.f[RCOMP] = CLAMP(params[0], 0.0F, 1.0F);
texObj->Sampler.Attrib.BorderColor.f[GCOMP] = CLAMP(params[1], 0.0F, 1.0F);
texObj->Sampler.Attrib.BorderColor.f[BCOMP] = CLAMP(params[2], 0.0F, 1.0F);
texObj->Sampler.Attrib.BorderColor.f[ACOMP] = CLAMP(params[3], 0.0F, 1.0F);
}
return GL_TRUE;
@ -1028,7 +1028,7 @@ _mesa_texture_parameterIiv(struct gl_context *ctx,
}
FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT);
/* set the integer-valued border color */
COPY_4V(texObj->Sampler.BorderColor.i, params);
COPY_4V(texObj->Sampler.Attrib.BorderColor.i, params);
break;
default:
_mesa_texture_parameteriv(ctx, texObj, pname, params, dsa);
@ -1056,7 +1056,7 @@ _mesa_texture_parameterIuiv(struct gl_context *ctx,
}
FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT);
/* set the unsigned integer-valued border color */
COPY_4V(texObj->Sampler.BorderColor.ui, params);
COPY_4V(texObj->Sampler.Attrib.BorderColor.ui, params);
break;
default:
_mesa_texture_parameteriv(ctx, texObj, pname, (const GLint *) params,
@ -2146,19 +2146,19 @@ get_tex_parameterfv(struct gl_context *ctx,
_mesa_lock_context_textures(ctx);
switch (pname) {
case GL_TEXTURE_MAG_FILTER:
*params = ENUM_TO_FLOAT(obj->Sampler.MagFilter);
*params = ENUM_TO_FLOAT(obj->Sampler.Attrib.MagFilter);
break;
case GL_TEXTURE_MIN_FILTER:
*params = ENUM_TO_FLOAT(obj->Sampler.MinFilter);
*params = ENUM_TO_FLOAT(obj->Sampler.Attrib.MinFilter);
break;
case GL_TEXTURE_WRAP_S:
*params = ENUM_TO_FLOAT(obj->Sampler.WrapS);
*params = ENUM_TO_FLOAT(obj->Sampler.Attrib.WrapS);
break;
case GL_TEXTURE_WRAP_T:
*params = ENUM_TO_FLOAT(obj->Sampler.WrapT);
*params = ENUM_TO_FLOAT(obj->Sampler.Attrib.WrapT);
break;
case GL_TEXTURE_WRAP_R:
*params = ENUM_TO_FLOAT(obj->Sampler.WrapR);
*params = ENUM_TO_FLOAT(obj->Sampler.Attrib.WrapR);
break;
case GL_TEXTURE_BORDER_COLOR:
if (ctx->API == API_OPENGLES ||
@ -2166,16 +2166,16 @@ get_tex_parameterfv(struct gl_context *ctx,
goto invalid_pname;
if (_mesa_get_clamp_fragment_color(ctx, ctx->DrawBuffer)) {
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);
params[0] = CLAMP(obj->Sampler.Attrib.BorderColor.f[0], 0.0F, 1.0F);
params[1] = CLAMP(obj->Sampler.Attrib.BorderColor.f[1], 0.0F, 1.0F);
params[2] = CLAMP(obj->Sampler.Attrib.BorderColor.f[2], 0.0F, 1.0F);
params[3] = CLAMP(obj->Sampler.Attrib.BorderColor.f[3], 0.0F, 1.0F);
}
else {
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];
params[0] = obj->Sampler.Attrib.BorderColor.f[0];
params[1] = obj->Sampler.Attrib.BorderColor.f[1];
params[2] = obj->Sampler.Attrib.BorderColor.f[2];
params[3] = obj->Sampler.Attrib.BorderColor.f[3];
}
break;
case GL_TEXTURE_RESIDENT:
@ -2188,51 +2188,51 @@ get_tex_parameterfv(struct gl_context *ctx,
if (ctx->API != API_OPENGL_COMPAT)
goto invalid_pname;
*params = obj->Priority;
*params = obj->Attrib.Priority;
break;
case GL_TEXTURE_MIN_LOD:
if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
goto invalid_pname;
*params = obj->Sampler.MinLod;
*params = obj->Sampler.Attrib.MinLod;
break;
case GL_TEXTURE_MAX_LOD:
if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
goto invalid_pname;
*params = obj->Sampler.MaxLod;
*params = obj->Sampler.Attrib.MaxLod;
break;
case GL_TEXTURE_BASE_LEVEL:
if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
goto invalid_pname;
*params = (GLfloat) obj->BaseLevel;
*params = (GLfloat) obj->Attrib.BaseLevel;
break;
case GL_TEXTURE_MAX_LEVEL:
*params = (GLfloat) obj->MaxLevel;
*params = (GLfloat) obj->Attrib.MaxLevel;
break;
case GL_TEXTURE_MAX_ANISOTROPY_EXT:
if (!ctx->Extensions.EXT_texture_filter_anisotropic)
goto invalid_pname;
*params = obj->Sampler.MaxAnisotropy;
*params = obj->Sampler.Attrib.MaxAnisotropy;
break;
case GL_GENERATE_MIPMAP_SGIS:
if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_pname;
*params = (GLfloat) obj->GenerateMipmap;
*params = (GLfloat) obj->Attrib.GenerateMipmap;
break;
case GL_TEXTURE_COMPARE_MODE_ARB:
if ((!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_shadow)
&& !_mesa_is_gles3(ctx))
goto invalid_pname;
*params = (GLfloat) obj->Sampler.CompareMode;
*params = (GLfloat) obj->Sampler.Attrib.CompareMode;
break;
case GL_TEXTURE_COMPARE_FUNC_ARB:
if ((!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_shadow)
&& !_mesa_is_gles3(ctx))
goto invalid_pname;
*params = (GLfloat) obj->Sampler.CompareFunc;
*params = (GLfloat) obj->Sampler.Attrib.CompareFunc;
break;
case GL_DEPTH_TEXTURE_MODE_ARB:
/* GL_DEPTH_TEXTURE_MODE_ARB is removed in core-profile and it has
@ -2240,19 +2240,19 @@ get_tex_parameterfv(struct gl_context *ctx,
*/
if (ctx->API != API_OPENGL_COMPAT || !ctx->Extensions.ARB_depth_texture)
goto invalid_pname;
*params = (GLfloat) obj->DepthMode;
*params = (GLfloat) obj->Attrib.DepthMode;
break;
case GL_DEPTH_STENCIL_TEXTURE_MODE:
if (!_mesa_has_ARB_stencil_texturing(ctx) && !_mesa_is_gles31(ctx))
goto invalid_pname;
*params = (GLfloat)
(obj->StencilSampling ? GL_STENCIL_INDEX : GL_DEPTH_COMPONENT);
(obj->Attrib.StencilSampling ? GL_STENCIL_INDEX : GL_DEPTH_COMPONENT);
break;
case GL_TEXTURE_LOD_BIAS:
if (_mesa_is_gles(ctx))
goto invalid_pname;
*params = obj->Sampler.LodBias;
*params = obj->Sampler.Attrib.LodBias;
break;
case GL_TEXTURE_CROP_RECT_OES:
if (ctx->API != API_OPENGLES || !ctx->Extensions.OES_draw_texture)
@ -2272,7 +2272,7 @@ get_tex_parameterfv(struct gl_context *ctx,
|| !ctx->Extensions.EXT_texture_swizzle)
&& !_mesa_is_gles3(ctx))
goto invalid_pname;
*params = (GLfloat) obj->Swizzle[pname - GL_TEXTURE_SWIZZLE_R_EXT];
*params = (GLfloat) obj->Attrib.Swizzle[pname - GL_TEXTURE_SWIZZLE_R_EXT];
break;
case GL_TEXTURE_SWIZZLE_RGBA_EXT:
@ -2284,7 +2284,7 @@ get_tex_parameterfv(struct gl_context *ctx,
else {
GLuint comp;
for (comp = 0; comp < 4; comp++) {
params[comp] = (GLfloat) obj->Swizzle[comp];
params[comp] = (GLfloat) obj->Attrib.Swizzle[comp];
}
}
break;
@ -2293,7 +2293,7 @@ get_tex_parameterfv(struct gl_context *ctx,
if (!_mesa_is_desktop_gl(ctx)
|| !ctx->Extensions.AMD_seamless_cubemap_per_texture)
goto invalid_pname;
*params = (GLfloat) obj->Sampler.CubeMapSeamless;
*params = (GLfloat) obj->Sampler.Attrib.CubeMapSeamless;
break;
case GL_TEXTURE_IMMUTABLE_FORMAT:
@ -2340,7 +2340,7 @@ get_tex_parameterfv(struct gl_context *ctx,
case GL_TEXTURE_SRGB_DECODE_EXT:
if (!ctx->Extensions.EXT_texture_sRGB_decode)
goto invalid_pname;
*params = (GLfloat) obj->Sampler.sRGBDecode;
*params = (GLfloat) obj->Sampler.Attrib.sRGBDecode;
break;
case GL_IMAGE_FORMAT_COMPATIBILITY_TYPE:
@ -2384,19 +2384,19 @@ get_tex_parameteriv(struct gl_context *ctx,
_mesa_lock_texture(ctx, obj);
switch (pname) {
case GL_TEXTURE_MAG_FILTER:
*params = (GLint) obj->Sampler.MagFilter;
*params = (GLint) obj->Sampler.Attrib.MagFilter;
break;
case GL_TEXTURE_MIN_FILTER:
*params = (GLint) obj->Sampler.MinFilter;
*params = (GLint) obj->Sampler.Attrib.MinFilter;
break;
case GL_TEXTURE_WRAP_S:
*params = (GLint) obj->Sampler.WrapS;
*params = (GLint) obj->Sampler.Attrib.WrapS;
break;
case GL_TEXTURE_WRAP_T:
*params = (GLint) obj->Sampler.WrapT;
*params = (GLint) obj->Sampler.Attrib.WrapT;
break;
case GL_TEXTURE_WRAP_R:
*params = (GLint) obj->Sampler.WrapR;
*params = (GLint) obj->Sampler.Attrib.WrapR;
break;
case GL_TEXTURE_BORDER_COLOR:
if (ctx->API == API_OPENGLES ||
@ -2405,10 +2405,10 @@ get_tex_parameteriv(struct gl_context *ctx,
{
GLfloat b[4];
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);
b[0] = CLAMP(obj->Sampler.Attrib.BorderColor.f[0], 0.0F, 1.0F);
b[1] = CLAMP(obj->Sampler.Attrib.BorderColor.f[1], 0.0F, 1.0F);
b[2] = CLAMP(obj->Sampler.Attrib.BorderColor.f[2], 0.0F, 1.0F);
b[3] = CLAMP(obj->Sampler.Attrib.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]);
@ -2425,7 +2425,7 @@ get_tex_parameteriv(struct gl_context *ctx,
if (ctx->API != API_OPENGL_COMPAT)
goto invalid_pname;
*params = FLOAT_TO_INT(obj->Priority);
*params = FLOAT_TO_INT(obj->Attrib.Priority);
break;
case GL_TEXTURE_MIN_LOD:
if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
@ -2440,7 +2440,7 @@ get_tex_parameteriv(struct gl_context *ctx,
* it cannot be represented by the returned data type, then the
* nearest value representable using that type is returned.
*/
*params = CLAMP(lroundf(obj->Sampler.MinLod), INT_MIN, INT_MAX);
*params = CLAMP(lroundf(obj->Sampler.Attrib.MinLod), INT_MIN, INT_MAX);
break;
case GL_TEXTURE_MAX_LOD:
if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
@ -2455,16 +2455,16 @@ get_tex_parameteriv(struct gl_context *ctx,
* it cannot be represented by the returned data type, then the
* nearest value representable using that type is returned.
*/
*params = CLAMP(lroundf(obj->Sampler.MaxLod), INT_MIN, INT_MAX);
*params = CLAMP(lroundf(obj->Sampler.Attrib.MaxLod), INT_MIN, INT_MAX);
break;
case GL_TEXTURE_BASE_LEVEL:
if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
goto invalid_pname;
*params = obj->BaseLevel;
*params = obj->Attrib.BaseLevel;
break;
case GL_TEXTURE_MAX_LEVEL:
*params = obj->MaxLevel;
*params = obj->Attrib.MaxLevel;
break;
case GL_TEXTURE_MAX_ANISOTROPY_EXT:
if (!ctx->Extensions.EXT_texture_filter_anisotropic)
@ -2479,36 +2479,36 @@ get_tex_parameteriv(struct gl_context *ctx,
* it cannot be represented by the returned data type, then the
* nearest value representable using that type is returned.
*/
*params = CLAMP(lroundf(obj->Sampler.MaxAnisotropy), INT_MIN, INT_MAX);
*params = CLAMP(lroundf(obj->Sampler.Attrib.MaxAnisotropy), INT_MIN, INT_MAX);
break;
case GL_GENERATE_MIPMAP_SGIS:
if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_pname;
*params = (GLint) obj->GenerateMipmap;
*params = (GLint) obj->Attrib.GenerateMipmap;
break;
case GL_TEXTURE_COMPARE_MODE_ARB:
if ((!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_shadow)
&& !_mesa_is_gles3(ctx))
goto invalid_pname;
*params = (GLint) obj->Sampler.CompareMode;
*params = (GLint) obj->Sampler.Attrib.CompareMode;
break;
case GL_TEXTURE_COMPARE_FUNC_ARB:
if ((!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_shadow)
&& !_mesa_is_gles3(ctx))
goto invalid_pname;
*params = (GLint) obj->Sampler.CompareFunc;
*params = (GLint) obj->Sampler.Attrib.CompareFunc;
break;
case GL_DEPTH_TEXTURE_MODE_ARB:
if (ctx->API != API_OPENGL_COMPAT || !ctx->Extensions.ARB_depth_texture)
goto invalid_pname;
*params = (GLint) obj->DepthMode;
*params = (GLint) obj->Attrib.DepthMode;
break;
case GL_DEPTH_STENCIL_TEXTURE_MODE:
if (!_mesa_has_ARB_stencil_texturing(ctx) && !_mesa_is_gles31(ctx))
goto invalid_pname;
*params = (GLint)
(obj->StencilSampling ? GL_STENCIL_INDEX : GL_DEPTH_COMPONENT);
(obj->Attrib.StencilSampling ? GL_STENCIL_INDEX : GL_DEPTH_COMPONENT);
break;
case GL_TEXTURE_LOD_BIAS:
if (_mesa_is_gles(ctx))
@ -2524,7 +2524,7 @@ get_tex_parameteriv(struct gl_context *ctx,
* it cannot be represented by the returned data type, then the
* nearest value representable using that type is returned.
*/
*params = CLAMP(lroundf(obj->Sampler.LodBias), INT_MIN, INT_MAX);
*params = CLAMP(lroundf(obj->Sampler.Attrib.LodBias), INT_MIN, INT_MAX);
break;
case GL_TEXTURE_CROP_RECT_OES:
if (ctx->API != API_OPENGLES || !ctx->Extensions.OES_draw_texture)
@ -2543,7 +2543,7 @@ get_tex_parameteriv(struct gl_context *ctx,
|| !ctx->Extensions.EXT_texture_swizzle)
&& !_mesa_is_gles3(ctx))
goto invalid_pname;
*params = obj->Swizzle[pname - GL_TEXTURE_SWIZZLE_R_EXT];
*params = obj->Attrib.Swizzle[pname - GL_TEXTURE_SWIZZLE_R_EXT];
break;
case GL_TEXTURE_SWIZZLE_RGBA_EXT:
@ -2551,14 +2551,14 @@ get_tex_parameteriv(struct gl_context *ctx,
|| !ctx->Extensions.EXT_texture_swizzle)
&& !_mesa_is_gles3(ctx))
goto invalid_pname;
COPY_4V(params, obj->Swizzle);
COPY_4V(params, obj->Attrib.Swizzle);
break;
case GL_TEXTURE_CUBE_MAP_SEAMLESS:
if (!_mesa_is_desktop_gl(ctx)
|| !ctx->Extensions.AMD_seamless_cubemap_per_texture)
goto invalid_pname;
*params = (GLint) obj->Sampler.CubeMapSeamless;
*params = (GLint) obj->Sampler.Attrib.CubeMapSeamless;
break;
case GL_TEXTURE_IMMUTABLE_FORMAT:
@ -2606,7 +2606,7 @@ get_tex_parameteriv(struct gl_context *ctx,
case GL_TEXTURE_SRGB_DECODE_EXT:
if (!ctx->Extensions.EXT_texture_sRGB_decode)
goto invalid_pname;
*params = obj->Sampler.sRGBDecode;
*params = obj->Sampler.Attrib.sRGBDecode;
break;
case GL_IMAGE_FORMAT_COMPATIBILITY_TYPE:
@ -2648,7 +2648,7 @@ get_tex_parameterIiv(struct gl_context *ctx,
{
switch (pname) {
case GL_TEXTURE_BORDER_COLOR:
COPY_4V(params, obj->Sampler.BorderColor.i);
COPY_4V(params, obj->Sampler.Attrib.BorderColor.i);
break;
default:
get_tex_parameteriv(ctx, obj, pname, params, dsa);

View File

@ -529,10 +529,10 @@ update_tex_combine(struct gl_context *ctx,
}
else {
const struct gl_texture_object *texObj = texUnit->_Current;
GLenum format = texObj->Image[0][texObj->BaseLevel]->_BaseFormat;
GLenum format = texObj->Image[0][texObj->Attrib.BaseLevel]->_BaseFormat;
if (format == GL_DEPTH_COMPONENT || format == GL_DEPTH_STENCIL_EXT) {
format = texObj->DepthMode;
format = texObj->Attrib.DepthMode;
}
calculate_derived_texenv(&fftexUnit->_EnvMode, fftexUnit->EnvMode, format);
fftexUnit->_CurrentCombine = & fftexUnit->_EnvMode;

View File

@ -510,7 +510,7 @@ is_sampler_border_color_valid(struct gl_sampler_object *samp)
{ 1, 1, 1, 0 },
{ 1, 1, 1, 1 },
};
size_t size = sizeof(samp->BorderColor.ui);
size_t size = sizeof(samp->Attrib.BorderColor.ui);
/* The ARB_bindless_texture spec says:
*
@ -523,16 +523,16 @@ is_sampler_border_color_valid(struct gl_sampler_object *samp)
* (0.0,0.0,0.0,0.0), (0.0,0.0,0.0,1.0), (1.0,1.0,1.0,0.0), and
* (1.0,1.0,1.0,1.0)."
*/
if (!memcmp(samp->BorderColor.f, valid_float_border_colors[0], size) ||
!memcmp(samp->BorderColor.f, valid_float_border_colors[1], size) ||
!memcmp(samp->BorderColor.f, valid_float_border_colors[2], size) ||
!memcmp(samp->BorderColor.f, valid_float_border_colors[3], size))
if (!memcmp(samp->Attrib.BorderColor.f, valid_float_border_colors[0], size) ||
!memcmp(samp->Attrib.BorderColor.f, valid_float_border_colors[1], size) ||
!memcmp(samp->Attrib.BorderColor.f, valid_float_border_colors[2], size) ||
!memcmp(samp->Attrib.BorderColor.f, valid_float_border_colors[3], size))
return GL_TRUE;
if (!memcmp(samp->BorderColor.ui, valid_integer_border_colors[0], size) ||
!memcmp(samp->BorderColor.ui, valid_integer_border_colors[1], size) ||
!memcmp(samp->BorderColor.ui, valid_integer_border_colors[2], size) ||
!memcmp(samp->BorderColor.ui, valid_integer_border_colors[3], size))
if (!memcmp(samp->Attrib.BorderColor.ui, valid_integer_border_colors[0], size) ||
!memcmp(samp->Attrib.BorderColor.ui, valid_integer_border_colors[1], size) ||
!memcmp(samp->Attrib.BorderColor.ui, valid_integer_border_colors[2], size) ||
!memcmp(samp->Attrib.BorderColor.ui, valid_integer_border_colors[3], size))
return GL_TRUE;
return GL_FALSE;

View File

@ -110,23 +110,23 @@ st_convert_sampler(const struct st_context *st,
struct pipe_sampler_state *sampler)
{
memset(sampler, 0, sizeof(*sampler));
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->wrap_s = gl_wrap_xlate(msamp->Attrib.WrapS);
sampler->wrap_t = gl_wrap_xlate(msamp->Attrib.WrapT);
sampler->wrap_r = gl_wrap_xlate(msamp->Attrib.WrapR);
if (texobj->_IsIntegerFormat && st->ctx->Const.ForceIntegerTexNearest) {
sampler->min_img_filter = gl_filter_to_img_filter(GL_NEAREST);
sampler->mag_img_filter = gl_filter_to_img_filter(GL_NEAREST);
} else {
sampler->min_img_filter = gl_filter_to_img_filter(msamp->MinFilter);
sampler->mag_img_filter = gl_filter_to_img_filter(msamp->MagFilter);
sampler->min_img_filter = gl_filter_to_img_filter(msamp->Attrib.MinFilter);
sampler->mag_img_filter = gl_filter_to_img_filter(msamp->Attrib.MagFilter);
}
sampler->min_mip_filter = gl_filter_to_mip_filter(msamp->MinFilter);
sampler->min_mip_filter = gl_filter_to_mip_filter(msamp->Attrib.MinFilter);
if (texobj->Target != GL_TEXTURE_RECTANGLE_ARB)
sampler->normalized_coords = 1;
sampler->lod_bias = msamp->LodBias + tex_unit_lod_bias;
sampler->lod_bias = msamp->Attrib.LodBias + tex_unit_lod_bias;
/* Reduce the number of states by allowing only the values that AMD GCN
* can represent. Apps use lod_bias for smooth transitions to bigger mipmap
* levels.
@ -134,8 +134,8 @@ st_convert_sampler(const struct st_context *st,
sampler->lod_bias = CLAMP(sampler->lod_bias, -16, 16);
sampler->lod_bias = roundf(sampler->lod_bias * 256) / 256;
sampler->min_lod = MAX2(msamp->MinLod, 0.0f);
sampler->max_lod = msamp->MaxLod;
sampler->min_lod = MAX2(msamp->Attrib.MinLod, 0.0f);
sampler->max_lod = msamp->Attrib.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.
@ -161,14 +161,14 @@ st_convert_sampler(const struct st_context *st,
/* For non-black borders... */
if (/* This is true if wrap modes are using the border color: */
(sampler->wrap_s | sampler->wrap_t | sampler->wrap_r) & 0x1 &&
(msamp->BorderColor.ui[0] ||
msamp->BorderColor.ui[1] ||
msamp->BorderColor.ui[2] ||
msamp->BorderColor.ui[3])) {
(msamp->Attrib.BorderColor.ui[0] ||
msamp->Attrib.BorderColor.ui[1] ||
msamp->Attrib.BorderColor.ui[2] ||
msamp->Attrib.BorderColor.ui[3])) {
const GLboolean is_integer = texobj->_IsIntegerFormat;
GLenum texBaseFormat = _mesa_base_tex_image(texobj)->_BaseFormat;
if (texobj->StencilSampling)
if (texobj->Attrib.StencilSampling)
texBaseFormat = GL_STENCIL_INDEX;
if (st->apply_texture_swizzle_to_border_color) {
@ -187,34 +187,34 @@ st_convert_sampler(const struct st_context *st,
view->swizzle_a,
};
st_translate_color(&msamp->BorderColor, &tmp,
st_translate_color(&msamp->Attrib.BorderColor, &tmp,
texBaseFormat, is_integer);
util_format_apply_color_swizzle(&sampler->border_color,
&tmp, swz, is_integer);
} else {
st_translate_color(&msamp->BorderColor,
st_translate_color(&msamp->Attrib.BorderColor,
&sampler->border_color,
texBaseFormat, is_integer);
}
} else {
st_translate_color(&msamp->BorderColor,
st_translate_color(&msamp->Attrib.BorderColor,
&sampler->border_color,
texBaseFormat, is_integer);
}
}
sampler->max_anisotropy = (msamp->MaxAnisotropy == 1.0 ?
0 : (GLuint) msamp->MaxAnisotropy);
sampler->max_anisotropy = (msamp->Attrib.MaxAnisotropy == 1.0 ?
0 : (GLuint) msamp->Attrib.MaxAnisotropy);
/* If sampling a depth texture and using shadow comparison */
if (msamp->CompareMode == GL_COMPARE_R_TO_TEXTURE) {
if (msamp->Attrib.CompareMode == GL_COMPARE_R_TO_TEXTURE) {
GLenum texBaseFormat = _mesa_base_tex_image(texobj)->_BaseFormat;
if (texBaseFormat == GL_DEPTH_COMPONENT ||
(texBaseFormat == GL_DEPTH_STENCIL && !texobj->StencilSampling)) {
(texBaseFormat == GL_DEPTH_STENCIL && !texobj->Attrib.StencilSampling)) {
sampler->compare_mode = PIPE_TEX_COMPARE_R_TO_TEXTURE;
sampler->compare_func = st_compare_func_to_pipe(msamp->CompareFunc);
sampler->compare_func = st_compare_func_to_pipe(msamp->Attrib.CompareFunc);
}
}
@ -222,7 +222,7 @@ st_convert_sampler(const struct st_context *st,
* enable should be ignored and treated as disabled when using texture
* handles, as specified by ARB_bindless_texture.
*/
sampler->seamless_cube_map = msamp->CubeMapSeamless;
sampler->seamless_cube_map = msamp->Attrib.CubeMapSeamless;
}
/**

View File

@ -546,7 +546,7 @@ allocate_full_mipmap(const struct st_texture_object *stObj,
return FALSE;
}
if (stImage->base.Level > 0 || stObj->base.GenerateMipmap)
if (stImage->base.Level > 0 || stObj->base.Attrib.GenerateMipmap)
return TRUE;
/* If the application has explicitly called glTextureParameter to set
@ -556,8 +556,8 @@ allocate_full_mipmap(const struct st_texture_object *stObj,
* Core Mesa will initialize MaxLevel to value much larger than
* MAX_TEXTURE_LEVELS, so we check that to see if it's been set at all.
*/
if (stObj->base.MaxLevel < MAX_TEXTURE_LEVELS &&
stObj->base.MaxLevel - stObj->base.BaseLevel > 0)
if (stObj->base.Attrib.MaxLevel < MAX_TEXTURE_LEVELS &&
stObj->base.Attrib.MaxLevel - stObj->base.Attrib.BaseLevel > 0)
return TRUE;
if (stImage->base._BaseFormat == GL_DEPTH_COMPONENT ||
@ -565,11 +565,11 @@ allocate_full_mipmap(const struct st_texture_object *stObj,
/* depth/stencil textures are seldom mipmapped */
return FALSE;
if (stObj->base.BaseLevel == 0 && stObj->base.MaxLevel == 0)
if (stObj->base.Attrib.BaseLevel == 0 && stObj->base.Attrib.MaxLevel == 0)
return FALSE;
if (stObj->base.Sampler.MinFilter == GL_NEAREST ||
stObj->base.Sampler.MinFilter == GL_LINEAR)
if (stObj->base.Sampler.Attrib.MinFilter == GL_NEAREST ||
stObj->base.Sampler.Attrib.MinFilter == GL_LINEAR)
/* not a mipmap minification filter */
return FALSE;
@ -582,7 +582,7 @@ allocate_full_mipmap(const struct st_texture_object *stObj,
* allocate a mipmapped texture by default. This may cause texture
* reallocation later, but GL_NEAREST_MIPMAP_LINEAR is pretty rare.
*/
if (stObj->base.Sampler.MinFilter == GL_NEAREST_MIPMAP_LINEAR)
if (stObj->base.Sampler.Attrib.MinFilter == GL_NEAREST_MIPMAP_LINEAR)
return FALSE;
if (stObj->base.Target == GL_TEXTURE_3D)
@ -2676,14 +2676,14 @@ st_finalize_texture(struct gl_context *ctx,
if (tObj->_MipmapComplete)
stObj->lastLevel = stObj->base._MaxLevel;
else if (tObj->_BaseComplete)
stObj->lastLevel = stObj->base.BaseLevel;
stObj->lastLevel = stObj->base.Attrib.BaseLevel;
/* Skip the loop over images in the common case of no images having
* changed. But if the GL_BASE_LEVEL or GL_MAX_LEVEL change to something we
* haven't looked at, then we do need to look at those new images.
*/
if (!stObj->needs_validation &&
stObj->base.BaseLevel >= stObj->validated_first_level &&
stObj->base.Attrib.BaseLevel >= stObj->validated_first_level &&
stObj->lastLevel <= stObj->validated_last_level) {
return GL_TRUE;
}
@ -2694,7 +2694,7 @@ st_finalize_texture(struct gl_context *ctx,
}
firstImage = st_texture_image_const(stObj->base.Image[cubeMapFace]
[stObj->base.BaseLevel]);
[stObj->base.Attrib.BaseLevel]);
assert(firstImage);
/* If both firstImage and stObj point to a texture which can contain
@ -2817,7 +2817,7 @@ st_finalize_texture(struct gl_context *ctx,
*/
for (face = 0; face < nr_faces; face++) {
GLuint level;
for (level = stObj->base.BaseLevel; level <= stObj->lastLevel; level++) {
for (level = stObj->base.Attrib.BaseLevel; level <= stObj->lastLevel; level++) {
struct st_texture_image *stImage =
st_texture_image(stObj->base.Image[face][level]);
@ -2850,7 +2850,7 @@ st_finalize_texture(struct gl_context *ctx,
}
}
stObj->validated_first_level = stObj->base.BaseLevel;
stObj->validated_first_level = stObj->base.Attrib.BaseLevel;
stObj->validated_last_level = stObj->lastLevel;
stObj->needs_validation = false;
@ -3094,8 +3094,8 @@ st_TestProxyTexImage(struct gl_context *ctx, GLenum target,
/* For immutable textures we know the final number of mip levels */
pt.last_level = numLevels - 1;
}
else if (level == 0 && (texObj->Sampler.MinFilter == GL_LINEAR ||
texObj->Sampler.MinFilter == GL_NEAREST)) {
else if (level == 0 && (texObj->Sampler.Attrib.MinFilter == GL_LINEAR ||
texObj->Sampler.Attrib.MinFilter == GL_NEAREST)) {
/* assume just one mipmap level */
pt.last_level = 0;
}

View File

@ -56,7 +56,7 @@ st_generate_mipmap(struct gl_context *ctx, GLenum target,
struct st_context *st = st_context(ctx);
struct st_texture_object *stObj = st_texture_object(texObj);
struct pipe_resource *pt = st_get_texobj_resource(texObj);
uint baseLevel = texObj->BaseLevel;
uint baseLevel = texObj->Attrib.BaseLevel;
enum pipe_format format;
uint lastLevel, first_layer, last_layer;
@ -88,16 +88,16 @@ st_generate_mipmap(struct gl_context *ctx, GLenum target,
stObj->lastLevel = lastLevel;
if (!texObj->Immutable) {
const GLboolean genSave = texObj->GenerateMipmap;
const GLboolean genSave = texObj->Attrib.GenerateMipmap;
/* Temporarily set GenerateMipmap to true so that allocate_full_mipmap()
* makes the right decision about full mipmap allocation.
*/
texObj->GenerateMipmap = GL_TRUE;
texObj->Attrib.GenerateMipmap = GL_TRUE;
_mesa_prepare_mipmap_levels(ctx, texObj, baseLevel, lastLevel);
texObj->GenerateMipmap = genSave;
texObj->Attrib.GenerateMipmap = genSave;
/* At this point, memory for all the texture levels has been
* allocated. However, the base level image may be in one resource
@ -131,7 +131,7 @@ st_generate_mipmap(struct gl_context *ctx, GLenum target,
else
format = pt->format;
if (texObj->Sampler.sRGBDecode == GL_SKIP_DECODE_EXT)
if (texObj->Sampler.Attrib.sRGBDecode == GL_SKIP_DECODE_EXT)
format = util_format_linear(format);
/* First see if the driver supports hardware mipmap generation,

View File

@ -396,7 +396,7 @@ get_texture_format_swizzle(const struct st_context *st,
{
GLenum baseFormat = _mesa_base_tex_image(&stObj->base)->_BaseFormat;
unsigned tex_swizzle;
GLenum depth_mode = stObj->base.DepthMode;
GLenum depth_mode = stObj->base.Attrib.DepthMode;
/* In ES 3.0, DEPTH_TEXTURE_MODE is expected to be GL_RED for textures
* with depth component data specified with a sized internal format.
@ -417,7 +417,7 @@ get_texture_format_swizzle(const struct st_context *st,
glsl130_or_later);
/* Combine the texture format swizzle with user's swizzle */
return swizzle_swizzle(stObj->base._Swizzle, tex_swizzle);
return swizzle_swizzle(stObj->base.Attrib._Swizzle, tex_swizzle);
}
@ -479,7 +479,7 @@ get_sampler_view_format(struct st_context *st,
if (baseFormat == GL_DEPTH_COMPONENT ||
baseFormat == GL_DEPTH_STENCIL ||
baseFormat == GL_STENCIL_INDEX) {
if (stObj->base.StencilSampling || baseFormat == GL_STENCIL_INDEX)
if (stObj->base.Attrib.StencilSampling || baseFormat == GL_STENCIL_INDEX)
format = util_format_stencil_only(format);
return format;
@ -541,7 +541,7 @@ st_create_texture_sampler_view_from_stobj(struct st_context *st,
if (stObj->level_override >= 0) {
templ.u.tex.first_level = templ.u.tex.last_level = stObj->level_override;
} else {
templ.u.tex.first_level = stObj->base.MinLevel + stObj->base.BaseLevel;
templ.u.tex.first_level = stObj->base.MinLevel + stObj->base.Attrib.BaseLevel;
templ.u.tex.last_level = last_level(stObj);
}
if (stObj->layer_override >= 0) {
@ -573,7 +573,7 @@ st_get_texture_sampler_view_from_stobj(struct st_context *st,
const struct st_sampler_view *sv;
bool srgb_skip_decode = false;
if (!ignore_srgb_decode && samp->sRGBDecode == GL_SKIP_DECODE_EXT)
if (!ignore_srgb_decode && samp->Attrib.sRGBDecode == GL_SKIP_DECODE_EXT)
srgb_skip_decode = true;
sv = st_texture_get_current_sampler_view(st, stObj);
@ -590,7 +590,7 @@ st_get_texture_sampler_view_from_stobj(struct st_context *st,
assert(get_sampler_view_format(st, stObj, srgb_skip_decode) == view->format);
assert(gl_target_to_pipe(stObj->base.Target) == view->target);
assert(stObj->level_override >= 0 ||
stObj->base.MinLevel + stObj->base.BaseLevel == view->u.tex.first_level);
stObj->base.MinLevel + stObj->base.Attrib.BaseLevel == view->u.tex.first_level);
assert(stObj->level_override >= 0 || last_level(stObj) == view->u.tex.last_level);
assert(stObj->layer_override >= 0 || stObj->base.MinLayer == view->u.tex.first_layer);
assert(stObj->layer_override >= 0 || last_layer(stObj) == view->u.tex.last_layer);

View File

@ -87,12 +87,12 @@ fetch_texel_lod( struct gl_context *ctx, const GLfloat texcoord[4], GLfloat lamb
GLfloat rgba[4];
const struct gl_sampler_object *samp = _mesa_get_samplerobj(ctx, unit);
lambda = CLAMP(lambda, samp->MinLod, samp->MaxLod);
lambda = CLAMP(lambda, samp->Attrib.MinLod, samp->Attrib.MaxLod);
swrast->TextureSample[unit](ctx, samp, ctx->Texture.Unit[unit]._Current,
1, (const GLfloat (*)[4]) texcoord,
&lambda, &rgba);
swizzle_texel(rgba, color, texObj->_Swizzle);
swizzle_texel(rgba, color, texObj->Attrib._Swizzle);
}
else {
ASSIGN_4V(color, 0.0F, 0.0F, 0.0F, 1.0F);
@ -133,14 +133,14 @@ 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 + samp->LodBias;
lambda += lodBias + texUnit->LodBias + samp->Attrib.LodBias;
lambda = CLAMP(lambda, samp->MinLod, samp->MaxLod);
lambda = CLAMP(lambda, samp->Attrib.MinLod, samp->Attrib.MaxLod);
swrast->TextureSample[unit](ctx, samp, ctx->Texture.Unit[unit]._Current,
1, (const GLfloat (*)[4]) texcoord,
&lambda, &rgba);
swizzle_texel(rgba, color, texObj->_Swizzle);
swizzle_texel(rgba, color, texObj->Attrib._Swizzle);
}
else {
ASSIGN_4V(color, 0.0F, 0.0F, 0.0F, 1.0F);

View File

@ -504,13 +504,13 @@ interpolate_texcoords(struct gl_context *ctx, SWspan *span)
swrast_texture_image_const(img);
const struct gl_sampler_object *samp = _mesa_get_samplerobj(ctx, u);
needLambda = (samp->MinFilter != samp->MagFilter)
needLambda = (samp->Attrib.MinFilter != samp->Attrib.MagFilter)
|| _swrast_use_fragment_program(ctx);
/* LOD is calculated directly in the ansiotropic filter, we can
* skip the normal lambda function as the result is ignored.
*/
if (samp->MaxAnisotropy > 1.0F &&
samp->MinFilter == GL_LINEAR_MIPMAP_LINEAR) {
if (samp->Attrib.MaxAnisotropy > 1.0F &&
samp->Attrib.MinFilter == GL_LINEAR_MIPMAP_LINEAR) {
needLambda = GL_FALSE;
}
texW = swImg->WidthScale;

View File

@ -660,9 +660,9 @@ _swrast_texture_span( struct gl_context *ctx, SWspan *span )
/* adjust texture lod (lambda) */
if (span->arrayMask & SPAN_LAMBDA) {
if (texUnit->LodBias + samp->LodBias != 0.0F) {
if (texUnit->LodBias + samp->Attrib.LodBias != 0.0F) {
/* apply LOD bias, but don't clamp yet */
const GLfloat bias = CLAMP(texUnit->LodBias + samp->LodBias,
const GLfloat bias = CLAMP(texUnit->LodBias + samp->Attrib.LodBias,
-ctx->Const.MaxTextureLodBias,
ctx->Const.MaxTextureLodBias);
GLuint i;
@ -671,11 +671,11 @@ _swrast_texture_span( struct gl_context *ctx, SWspan *span )
}
}
if (samp->MinLod != -1000.0F ||
samp->MaxLod != 1000.0F) {
if (samp->Attrib.MinLod != -1000.0F ||
samp->Attrib.MaxLod != 1000.0F) {
/* apply LOD clamping to lambda */
const GLfloat min = samp->MinLod;
const GLfloat max = samp->MaxLod;
const GLfloat min = samp->Attrib.MinLod;
const GLfloat max = samp->Attrib.MaxLod;
GLuint i;
for (i = 0; i < span->end; i++) {
GLfloat l = lambda[i];
@ -683,8 +683,8 @@ _swrast_texture_span( struct gl_context *ctx, SWspan *span )
}
}
}
else if (samp->MaxAnisotropy > 1.0F &&
samp->MinFilter == GL_LINEAR_MIPMAP_LINEAR) {
else if (samp->Attrib.MaxAnisotropy > 1.0F &&
samp->Attrib.MinFilter == GL_LINEAR_MIPMAP_LINEAR) {
/* sample_lambda_2d_aniso is beeing used as texture_sample_func,
* it requires the current SWspan *span as an additional parameter.
* In order to keep the same function signature, the unused lambda
@ -702,8 +702,8 @@ _swrast_texture_span( struct gl_context *ctx, SWspan *span )
span->end, texcoords, lambda, texels );
/* GL_EXT_texture_swizzle */
if (curObj->_Swizzle != SWIZZLE_NOOP) {
swizzle_texels(curObj->_Swizzle, span->end, texels);
if (curObj->Attrib._Swizzle != SWIZZLE_NOOP) {
swizzle_texels(curObj->Attrib._Swizzle, span->end, texels);
}
}
}

View File

@ -312,7 +312,7 @@ set_fetch_functions(const struct gl_sampler_object *samp,
{
mesa_format format = texImage->Base.TexFormat;
if (samp->sRGBDecode == GL_SKIP_DECODE_EXT)
if (samp->Attrib.sRGBDecode == GL_SKIP_DECODE_EXT)
format = _mesa_get_srgb_format_linear(format);
texImage->FetchTexel = NULL;

View File

@ -515,28 +515,28 @@ nearest_texcoord(const struct gl_sampler_object *samp,
switch (texObj->Target) {
case GL_TEXTURE_RECTANGLE_ARB:
*i = clamp_rect_coord_nearest(samp->WrapS, texcoord[0], width);
*j = clamp_rect_coord_nearest(samp->WrapT, texcoord[1], height);
*i = clamp_rect_coord_nearest(samp->Attrib.WrapS, texcoord[0], width);
*j = clamp_rect_coord_nearest(samp->Attrib.WrapT, texcoord[1], height);
*k = 0;
break;
case GL_TEXTURE_1D:
*i = nearest_texel_location(samp->WrapS, img, width, texcoord[0]);
*i = nearest_texel_location(samp->Attrib.WrapS, img, width, texcoord[0]);
*j = 0;
*k = 0;
break;
case GL_TEXTURE_2D:
*i = nearest_texel_location(samp->WrapS, img, width, texcoord[0]);
*j = nearest_texel_location(samp->WrapT, img, height, texcoord[1]);
*i = nearest_texel_location(samp->Attrib.WrapS, img, width, texcoord[0]);
*j = nearest_texel_location(samp->Attrib.WrapT, img, height, texcoord[1]);
*k = 0;
break;
case GL_TEXTURE_1D_ARRAY_EXT:
*i = nearest_texel_location(samp->WrapS, img, width, texcoord[0]);
*i = nearest_texel_location(samp->Attrib.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(samp->WrapS, img, width, texcoord[0]);
*j = nearest_texel_location(samp->WrapT, img, height, texcoord[1]);
*i = nearest_texel_location(samp->Attrib.WrapS, img, width, texcoord[0]);
*j = nearest_texel_location(samp->Attrib.WrapT, img, height, texcoord[1]);
*k = tex_array_slice(texcoord[2], depth);
break;
default:
@ -565,24 +565,24 @@ linear_texcoord(const struct gl_sampler_object *samp,
switch (texObj->Target) {
case GL_TEXTURE_RECTANGLE_ARB:
clamp_rect_coord_linear(samp->WrapS, texcoord[0],
clamp_rect_coord_linear(samp->Attrib.WrapS, texcoord[0],
width, i0, i1, wi);
clamp_rect_coord_linear(samp->WrapT, texcoord[1],
clamp_rect_coord_linear(samp->Attrib.WrapT, texcoord[1],
height, j0, j1, wj);
*slice = 0;
break;
case GL_TEXTURE_1D:
case GL_TEXTURE_2D:
linear_texel_locations(samp->WrapS, img, width,
linear_texel_locations(samp->Attrib.WrapS, img, width,
texcoord[0], i0, i1, wi);
linear_texel_locations(samp->WrapT, img, height,
linear_texel_locations(samp->Attrib.WrapT, img, height,
texcoord[1], j0, j1, wj);
*slice = 0;
break;
case GL_TEXTURE_1D_ARRAY_EXT:
linear_texel_locations(samp->WrapS, img, width,
linear_texel_locations(samp->Attrib.WrapS, img, width,
texcoord[0], i0, i1, wi);
*j0 = tex_array_slice(texcoord[1], height);
*j1 = *j0;
@ -590,9 +590,9 @@ linear_texcoord(const struct gl_sampler_object *samp,
break;
case GL_TEXTURE_2D_ARRAY_EXT:
linear_texel_locations(samp->WrapS, img, width,
linear_texel_locations(samp->Attrib.WrapS, img, width,
texcoord[0], i0, i1, wi);
linear_texel_locations(samp->WrapT, img, height,
linear_texel_locations(samp->Attrib.WrapT, img, height,
texcoord[1], j0, j1, wj);
*slice = tex_array_slice(texcoord[2], depth);
break;
@ -613,11 +613,11 @@ static GLint
linear_mipmap_level(const struct gl_texture_object *tObj, GLfloat lambda)
{
if (lambda < 0.0F)
return tObj->BaseLevel;
return tObj->Attrib.BaseLevel;
else if (lambda > tObj->_MaxLambda)
return (GLint) (tObj->BaseLevel + tObj->_MaxLambda);
return (GLint) (tObj->Attrib.BaseLevel + tObj->_MaxLambda);
else
return (GLint) (tObj->BaseLevel + lambda);
return (GLint) (tObj->Attrib.BaseLevel + lambda);
}
@ -635,7 +635,7 @@ nearest_mipmap_level(const struct gl_texture_object *tObj, GLfloat lambda)
l = tObj->_MaxLambda + 0.4999F;
else
l = lambda;
level = (GLint) (tObj->BaseLevel + l + 0.5F);
level = (GLint) (tObj->Attrib.BaseLevel + l + 0.5F);
if (level > tObj->_MaxLevel)
level = tObj->_MaxLevel;
return level;
@ -669,12 +669,12 @@ compute_min_mag_ranges(const struct gl_sampler_object *samp,
GLfloat minMagThresh;
/* we shouldn't be here if minfilter == magfilter */
assert(samp->MinFilter != samp->MagFilter);
assert(samp->Attrib.MinFilter != samp->Attrib.MagFilter);
/* This bit comes from the OpenGL spec: */
if (samp->MagFilter == GL_LINEAR
&& (samp->MinFilter == GL_NEAREST_MIPMAP_NEAREST ||
samp->MinFilter == GL_NEAREST_MIPMAP_LINEAR)) {
if (samp->Attrib.MagFilter == GL_LINEAR
&& (samp->Attrib.MinFilter == GL_NEAREST_MIPMAP_NEAREST ||
samp->Attrib.MinFilter == GL_NEAREST_MIPMAP_LINEAR)) {
minMagThresh = 0.5F;
}
else {
@ -776,28 +776,28 @@ get_border_color(const struct gl_sampler_object *samp,
{
switch (img->_BaseFormat) {
case GL_RGB:
rgba[0] = samp->BorderColor.f[0];
rgba[1] = samp->BorderColor.f[1];
rgba[2] = samp->BorderColor.f[2];
rgba[0] = samp->Attrib.BorderColor.f[0];
rgba[1] = samp->Attrib.BorderColor.f[1];
rgba[2] = samp->Attrib.BorderColor.f[2];
rgba[3] = 1.0F;
break;
case GL_ALPHA:
rgba[0] = rgba[1] = rgba[2] = 0.0;
rgba[3] = samp->BorderColor.f[3];
rgba[3] = samp->Attrib.BorderColor.f[3];
break;
case GL_LUMINANCE:
rgba[0] = rgba[1] = rgba[2] = samp->BorderColor.f[0];
rgba[0] = rgba[1] = rgba[2] = samp->Attrib.BorderColor.f[0];
rgba[3] = 1.0;
break;
case GL_LUMINANCE_ALPHA:
rgba[0] = rgba[1] = rgba[2] = samp->BorderColor.f[0];
rgba[3] = samp->BorderColor.f[3];
rgba[0] = rgba[1] = rgba[2] = samp->Attrib.BorderColor.f[0];
rgba[3] = samp->Attrib.BorderColor.f[3];
break;
case GL_INTENSITY:
rgba[0] = rgba[1] = rgba[2] = rgba[3] = samp->BorderColor.f[0];
rgba[0] = rgba[1] = rgba[2] = rgba[3] = samp->Attrib.BorderColor.f[0];
break;
default:
COPY_4V(rgba, samp->BorderColor.f);
COPY_4V(rgba, samp->Attrib.BorderColor.f);
break;
}
}
@ -855,7 +855,7 @@ sample_1d_nearest(struct gl_context *ctx,
const struct swrast_texture_image *swImg = swrast_texture_image_const(img);
const GLint width = img->Width2; /* without border, power of two */
GLint i;
i = nearest_texel_location(samp->WrapS, img, width, texcoord[0]);
i = nearest_texel_location(samp->Attrib.WrapS, img, width, texcoord[0]);
/* skip over the border, if any */
i += img->Border;
if (i < 0 || i >= (GLint) img->Width) {
@ -884,7 +884,7 @@ sample_1d_linear(struct gl_context *ctx,
GLfloat a;
GLfloat t0[4], t1[4]; /* texels */
linear_texel_locations(samp->WrapS, img, width, texcoord[0], &i0, &i1, &a);
linear_texel_locations(samp->Attrib.WrapS, img, width, texcoord[0], &i0, &i1, &a);
if (img->Border) {
i0 += img->Border;
@ -1050,7 +1050,7 @@ sample_lambda_1d( struct gl_context *ctx,
if (minStart < minEnd) {
/* do the minified texels */
const GLuint m = minEnd - minStart;
switch (samp->MinFilter) {
switch (samp->Attrib.MinFilter) {
case GL_NEAREST:
for (i = minStart; i < minEnd; i++)
sample_1d_nearest(ctx, samp, _mesa_base_tex_image(tObj),
@ -1085,7 +1085,7 @@ sample_lambda_1d( struct gl_context *ctx,
if (magStart < magEnd) {
/* do the magnified texels */
switch (samp->MagFilter) {
switch (samp->Attrib.MagFilter) {
case GL_NEAREST:
for (i = magStart; i < magEnd; i++)
sample_1d_nearest(ctx, samp, _mesa_base_tex_image(tObj),
@ -1125,8 +1125,8 @@ sample_2d_nearest(struct gl_context *ctx,
GLint i, j;
(void) ctx;
i = nearest_texel_location(samp->WrapS, img, width, texcoord[0]);
j = nearest_texel_location(samp->WrapT, img, height, texcoord[1]);
i = nearest_texel_location(samp->Attrib.WrapS, img, width, texcoord[0]);
j = nearest_texel_location(samp->Attrib.WrapT, img, height, texcoord[1]);
/* skip over the border, if any */
i += img->Border;
@ -1161,8 +1161,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(samp->WrapS, img, width, texcoord[0], &i0, &i1, &a);
linear_texel_locations(samp->WrapT, img, height, texcoord[1], &j0, &j1, &b);
linear_texel_locations(samp->Attrib.WrapS, img, width, texcoord[0], &i0, &i1, &a);
linear_texel_locations(samp->Attrib.WrapT, img, height, texcoord[1], &j0, &j1, &b);
if (img->Border) {
i0 += img->Border;
@ -1227,8 +1227,8 @@ sample_2d_linear_repeat(struct gl_context *ctx,
(void) ctx;
assert(samp->WrapS == GL_REPEAT);
assert(samp->WrapT == GL_REPEAT);
assert(samp->Attrib.WrapS == GL_REPEAT);
assert(samp->Attrib.WrapT == GL_REPEAT);
assert(img->Border == 0);
assert(swImg->_IsPowerOfTwo);
@ -1336,8 +1336,8 @@ sample_2d_linear_mipmap_linear_repeat(struct gl_context *ctx,
{
GLuint i;
assert(lambda != NULL);
assert(samp->WrapS == GL_REPEAT);
assert(samp->WrapT == GL_REPEAT);
assert(samp->Attrib.WrapS == GL_REPEAT);
assert(samp->Attrib.WrapT == GL_REPEAT);
for (i = 0; i < n; i++) {
GLint level = linear_mipmap_level(tObj, lambda[i]);
if (level >= tObj->_MaxLevel) {
@ -1386,8 +1386,8 @@ sample_linear_2d(struct gl_context *ctx,
const struct gl_texture_image *image = _mesa_base_tex_image(tObj);
const struct swrast_texture_image *swImg = swrast_texture_image_const(image);
(void) lambda;
if (samp->WrapS == GL_REPEAT &&
samp->WrapT == GL_REPEAT &&
if (samp->Attrib.WrapS == GL_REPEAT &&
samp->Attrib.WrapT == GL_REPEAT &&
swImg->_IsPowerOfTwo &&
image->Border == 0) {
for (i = 0; i < n; i++) {
@ -1427,8 +1427,8 @@ opt_sample_rgb_2d(struct gl_context *ctx,
GLuint k;
(void) ctx;
(void) lambda;
assert(samp->WrapS==GL_REPEAT);
assert(samp->WrapT==GL_REPEAT);
assert(samp->Attrib.WrapS==GL_REPEAT);
assert(samp->Attrib.WrapT==GL_REPEAT);
assert(img->Border==0);
assert(img->TexFormat == MESA_FORMAT_BGR_UNORM8);
assert(swImg->_IsPowerOfTwo);
@ -1472,8 +1472,8 @@ opt_sample_rgba_2d(struct gl_context *ctx,
GLuint i;
(void) ctx;
(void) lambda;
assert(samp->WrapS==GL_REPEAT);
assert(samp->WrapT==GL_REPEAT);
assert(samp->Attrib.WrapS==GL_REPEAT);
assert(samp->Attrib.WrapT==GL_REPEAT);
assert(img->Border==0);
assert(img->TexFormat == MESA_FORMAT_A8B8G8R8_UNORM);
assert(swImg->_IsPowerOfTwo);
@ -1505,8 +1505,8 @@ sample_lambda_2d(struct gl_context *ctx,
GLuint minStart, minEnd; /* texels with minification */
GLuint magStart, magEnd; /* texels with magnification */
const GLboolean repeatNoBorderPOT = (samp->WrapS == GL_REPEAT)
&& (samp->WrapT == GL_REPEAT)
const GLboolean repeatNoBorderPOT = (samp->Attrib.WrapS == GL_REPEAT)
&& (samp->Attrib.WrapT == GL_REPEAT)
&& (tImg->Border == 0)
&& (_mesa_format_row_stride(tImg->TexFormat, tImg->Width) ==
swImg->RowStride)
@ -1519,7 +1519,7 @@ sample_lambda_2d(struct gl_context *ctx,
if (minStart < minEnd) {
/* do the minified texels */
const GLuint m = minEnd - minStart;
switch (samp->MinFilter) {
switch (samp->Attrib.MinFilter) {
case GL_NEAREST:
if (repeatNoBorderPOT) {
switch (tImg->TexFormat) {
@ -1576,7 +1576,7 @@ sample_lambda_2d(struct gl_context *ctx,
/* do the magnified texels */
const GLuint m = magEnd - magStart;
switch (samp->MagFilter) {
switch (samp->Attrib.MagFilter) {
case GL_NEAREST:
if (repeatNoBorderPOT) {
switch (tImg->TexFormat) {
@ -1870,7 +1870,7 @@ sample_lambda_2d_aniso(struct gl_context *ctx,
const struct gl_texture_image *tImg = _mesa_base_tex_image(tObj);
const struct swrast_texture_image *swImg = swrast_texture_image_const(tImg);
const GLfloat maxEccentricity =
samp->MaxAnisotropy * samp->MaxAnisotropy;
samp->Attrib.MaxAnisotropy * samp->Attrib.MaxAnisotropy;
/* re-calculate the lambda values so that they are usable with anisotropic
* filtering
@ -1901,8 +1901,8 @@ sample_lambda_2d_aniso(struct gl_context *ctx,
/* from swrast/s_texcombine.c _swrast_texture_span */
const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[u];
const GLboolean adjustLOD =
(texUnit->LodBias + samp->LodBias != 0.0F)
|| (samp->MinLod != -1000.0F || samp->MaxLod != 1000.0F);
(texUnit->LodBias + samp->Attrib.LodBias != 0.0F)
|| (samp->Attrib.MinLod != -1000.0F || samp->Attrib.MaxLod != 1000.0F);
GLuint i;
@ -1965,18 +1965,18 @@ sample_lambda_2d_aniso(struct gl_context *ctx,
if (adjustLOD) {
/* from swrast/s_texcombine.c _swrast_texture_span */
if (texUnit->LodBias + samp->LodBias != 0.0F) {
if (texUnit->LodBias + samp->Attrib.LodBias != 0.0F) {
/* apply LOD bias, but don't clamp yet */
const GLfloat bias =
CLAMP(texUnit->LodBias + samp->LodBias,
CLAMP(texUnit->LodBias + samp->Attrib.LodBias,
-ctx->Const.MaxTextureLodBias,
ctx->Const.MaxTextureLodBias);
lod += bias;
if (samp->MinLod != -1000.0F ||
samp->MaxLod != 1000.0F) {
if (samp->Attrib.MinLod != -1000.0F ||
samp->Attrib.MaxLod != 1000.0F) {
/* apply LOD clamping to lambda */
lod = CLAMP(lod, samp->MinLod, samp->MaxLod);
lod = CLAMP(lod, samp->Attrib.MinLod, samp->Attrib.MaxLod);
}
}
}
@ -2028,9 +2028,9 @@ sample_3d_nearest(struct gl_context *ctx,
GLint i, j, k;
(void) ctx;
i = nearest_texel_location(samp->WrapS, img, width, texcoord[0]);
j = nearest_texel_location(samp->WrapT, img, height, texcoord[1]);
k = nearest_texel_location(samp->WrapR, img, depth, texcoord[2]);
i = nearest_texel_location(samp->Attrib.WrapS, img, width, texcoord[0]);
j = nearest_texel_location(samp->Attrib.WrapT, img, height, texcoord[1]);
k = nearest_texel_location(samp->Attrib.WrapR, img, depth, texcoord[2]);
if (i < 0 || i >= (GLint) img->Width ||
j < 0 || j >= (GLint) img->Height ||
@ -2064,9 +2064,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(samp->WrapS, img, width, texcoord[0], &i0, &i1, &a);
linear_texel_locations(samp->WrapT, img, height, texcoord[1], &j0, &j1, &b);
linear_texel_locations(samp->WrapR, img, depth, texcoord[2], &k0, &k1, &c);
linear_texel_locations(samp->Attrib.WrapS, img, width, texcoord[0], &i0, &i1, &a);
linear_texel_locations(samp->Attrib.WrapT, img, height, texcoord[1], &j0, &j1, &b);
linear_texel_locations(samp->Attrib.WrapR, img, depth, texcoord[2], &k0, &k1, &c);
if (img->Border) {
i0 += img->Border;
@ -2278,7 +2278,7 @@ sample_lambda_3d(struct gl_context *ctx,
if (minStart < minEnd) {
/* do the minified texels */
GLuint m = minEnd - minStart;
switch (samp->MinFilter) {
switch (samp->Attrib.MinFilter) {
case GL_NEAREST:
for (i = minStart; i < minEnd; i++)
sample_3d_nearest(ctx, samp, _mesa_base_tex_image(tObj),
@ -2313,7 +2313,7 @@ sample_lambda_3d(struct gl_context *ctx,
if (magStart < magEnd) {
/* do the magnified texels */
switch (samp->MagFilter) {
switch (samp->Attrib.MagFilter) {
case GL_NEAREST:
for (i = magStart; i < magEnd; i++)
sample_3d_nearest(ctx, samp, _mesa_base_tex_image(tObj),
@ -2429,12 +2429,12 @@ sample_nearest_cube(struct gl_context *ctx,
const struct gl_texture_image **images;
GLfloat newCoord[4];
images = choose_cube_face(tObj, texcoords[i], newCoord);
sample_2d_nearest(ctx, samp, images[tObj->BaseLevel],
sample_2d_nearest(ctx, samp, images[tObj->Attrib.BaseLevel],
newCoord, rgba[i]);
}
if (is_depth_texture(tObj)) {
for (i = 0; i < n; i++) {
apply_depth_mode(tObj->DepthMode, rgba[i][0], rgba[i]);
apply_depth_mode(tObj->Attrib.DepthMode, rgba[i][0], rgba[i]);
}
}
}
@ -2453,12 +2453,12 @@ sample_linear_cube(struct gl_context *ctx,
const struct gl_texture_image **images;
GLfloat newCoord[4];
images = choose_cube_face(tObj, texcoords[i], newCoord);
sample_2d_linear(ctx, samp, images[tObj->BaseLevel],
sample_2d_linear(ctx, samp, images[tObj->Attrib.BaseLevel],
newCoord, rgba[i]);
}
if (is_depth_texture(tObj)) {
for (i = 0; i < n; i++) {
apply_depth_mode(tObj->DepthMode, rgba[i][0], rgba[i]);
apply_depth_mode(tObj->Attrib.DepthMode, rgba[i][0], rgba[i]);
}
}
}
@ -2493,7 +2493,7 @@ sample_cube_nearest_mipmap_nearest(struct gl_context *ctx,
}
if (is_depth_texture(tObj)) {
for (i = 0; i < n; i++) {
apply_depth_mode(tObj->DepthMode, rgba[i][0], rgba[i]);
apply_depth_mode(tObj->Attrib.DepthMode, rgba[i][0], rgba[i]);
}
}
}
@ -2518,7 +2518,7 @@ sample_cube_linear_mipmap_nearest(struct gl_context *ctx,
}
if (is_depth_texture(tObj)) {
for (i = 0; i < n; i++) {
apply_depth_mode(tObj->DepthMode, rgba[i][0], rgba[i]);
apply_depth_mode(tObj->Attrib.DepthMode, rgba[i][0], rgba[i]);
}
}
}
@ -2553,7 +2553,7 @@ sample_cube_nearest_mipmap_linear(struct gl_context *ctx,
}
if (is_depth_texture(tObj)) {
for (i = 0; i < n; i++) {
apply_depth_mode(tObj->DepthMode, rgba[i][0], rgba[i]);
apply_depth_mode(tObj->Attrib.DepthMode, rgba[i][0], rgba[i]);
}
}
}
@ -2588,7 +2588,7 @@ sample_cube_linear_mipmap_linear(struct gl_context *ctx,
}
if (is_depth_texture(tObj)) {
for (i = 0; i < n; i++) {
apply_depth_mode(tObj->DepthMode, rgba[i][0], rgba[i]);
apply_depth_mode(tObj->Attrib.DepthMode, rgba[i][0], rgba[i]);
}
}
}
@ -2612,7 +2612,7 @@ sample_lambda_cube(struct gl_context *ctx,
if (minStart < minEnd) {
/* do the minified texels */
const GLuint m = minEnd - minStart;
switch (samp->MinFilter) {
switch (samp->Attrib.MinFilter) {
case GL_NEAREST:
sample_nearest_cube(ctx, samp, tObj, m, texcoords + minStart,
lambda + minStart, rgba + minStart);
@ -2650,7 +2650,7 @@ sample_lambda_cube(struct gl_context *ctx,
if (magStart < magEnd) {
/* do the magnified texels */
const GLuint m = magEnd - magStart;
switch (samp->MagFilter) {
switch (samp->Attrib.MagFilter) {
case GL_NEAREST:
sample_nearest_cube(ctx, samp, tObj, m, texcoords + magStart,
lambda + magStart, rgba + magStart);
@ -2688,17 +2688,17 @@ sample_nearest_rect(struct gl_context *ctx,
(void) ctx;
(void) lambda;
assert(samp->WrapS == GL_CLAMP ||
samp->WrapS == GL_CLAMP_TO_EDGE ||
samp->WrapS == GL_CLAMP_TO_BORDER);
assert(samp->WrapT == GL_CLAMP ||
samp->WrapT == GL_CLAMP_TO_EDGE ||
samp->WrapT == GL_CLAMP_TO_BORDER);
assert(samp->Attrib.WrapS == GL_CLAMP ||
samp->Attrib.WrapS == GL_CLAMP_TO_EDGE ||
samp->Attrib.WrapS == GL_CLAMP_TO_BORDER);
assert(samp->Attrib.WrapT == GL_CLAMP ||
samp->Attrib.WrapT == GL_CLAMP_TO_EDGE ||
samp->Attrib.WrapT == GL_CLAMP_TO_BORDER);
for (i = 0; i < n; i++) {
GLint row, col;
col = clamp_rect_coord_nearest(samp->WrapS, texcoords[i][0], width);
row = clamp_rect_coord_nearest(samp->WrapT, texcoords[i][1], height);
col = clamp_rect_coord_nearest(samp->Attrib.WrapS, texcoords[i][0], width);
row = clamp_rect_coord_nearest(samp->Attrib.WrapT, texcoords[i][1], height);
if (col < 0 || col >= width || row < 0 || row >= height)
get_border_color(samp, img, rgba[i]);
else
@ -2723,12 +2723,12 @@ sample_linear_rect(struct gl_context *ctx,
(void) ctx;
(void) lambda;
assert(samp->WrapS == GL_CLAMP ||
samp->WrapS == GL_CLAMP_TO_EDGE ||
samp->WrapS == GL_CLAMP_TO_BORDER);
assert(samp->WrapT == GL_CLAMP ||
samp->WrapT == GL_CLAMP_TO_EDGE ||
samp->WrapT == GL_CLAMP_TO_BORDER);
assert(samp->Attrib.WrapS == GL_CLAMP ||
samp->Attrib.WrapS == GL_CLAMP_TO_EDGE ||
samp->Attrib.WrapS == GL_CLAMP_TO_BORDER);
assert(samp->Attrib.WrapT == GL_CLAMP ||
samp->Attrib.WrapT == GL_CLAMP_TO_EDGE ||
samp->Attrib.WrapT == GL_CLAMP_TO_BORDER);
for (i = 0; i < n; i++) {
GLint i0, j0, i1, j1;
@ -2736,9 +2736,9 @@ sample_linear_rect(struct gl_context *ctx,
GLfloat a, b;
GLbitfield useBorderColor = 0x0;
clamp_rect_coord_linear(samp->WrapS, texcoords[i][0], width,
clamp_rect_coord_linear(samp->Attrib.WrapS, texcoords[i][0], width,
&i0, &i1, &a);
clamp_rect_coord_linear(samp->WrapT, texcoords[i][1], height,
clamp_rect_coord_linear(samp->Attrib.WrapT, texcoords[i][1], height,
&j0, &j1, &b);
/* compute integer rows/columns */
@ -2790,7 +2790,7 @@ sample_lambda_rect(struct gl_context *ctx,
&minStart, &minEnd, &magStart, &magEnd);
if (minStart < minEnd) {
if (samp->MinFilter == GL_NEAREST) {
if (samp->Attrib.MinFilter == GL_NEAREST) {
sample_nearest_rect(ctx, samp, tObj, minEnd - minStart,
texcoords + minStart, NULL, rgba + minStart);
}
@ -2800,7 +2800,7 @@ sample_lambda_rect(struct gl_context *ctx,
}
}
if (magStart < magEnd) {
if (samp->MagFilter == GL_NEAREST) {
if (samp->Attrib.MagFilter == GL_NEAREST) {
sample_nearest_rect(ctx, samp, tObj, magEnd - magStart,
texcoords + magStart, NULL, rgba + magStart);
}
@ -2834,8 +2834,8 @@ sample_2d_array_nearest(struct gl_context *ctx,
GLint array;
(void) ctx;
i = nearest_texel_location(samp->WrapS, img, width, texcoord[0]);
j = nearest_texel_location(samp->WrapT, img, height, texcoord[1]);
i = nearest_texel_location(samp->Attrib.WrapS, img, width, texcoord[0]);
j = nearest_texel_location(samp->Attrib.WrapT, img, height, texcoord[1]);
array = tex_array_slice(texcoord[2], depth);
if (i < 0 || i >= (GLint) img->Width ||
@ -2870,12 +2870,12 @@ sample_2d_array_linear(struct gl_context *ctx,
GLfloat a, b;
GLfloat t00[4], t01[4], t10[4], t11[4];
linear_texel_locations(samp->WrapS, img, width, texcoord[0], &i0, &i1, &a);
linear_texel_locations(samp->WrapT, img, height, texcoord[1], &j0, &j1, &b);
linear_texel_locations(samp->Attrib.WrapS, img, width, texcoord[0], &i0, &i1, &a);
linear_texel_locations(samp->Attrib.WrapT, img, height, texcoord[1], &j0, &j1, &b);
array = tex_array_slice(texcoord[2], depth);
if (array < 0 || array >= depth) {
COPY_4V(rgba, samp->BorderColor.f);
COPY_4V(rgba, samp->Attrib.BorderColor.f);
}
else {
if (img->Border) {
@ -3067,7 +3067,7 @@ sample_lambda_2d_array(struct gl_context *ctx,
if (minStart < minEnd) {
/* do the minified texels */
GLuint m = minEnd - minStart;
switch (samp->MinFilter) {
switch (samp->Attrib.MinFilter) {
case GL_NEAREST:
for (i = minStart; i < minEnd; i++)
sample_2d_array_nearest(ctx, samp, _mesa_base_tex_image(tObj),
@ -3110,7 +3110,7 @@ sample_lambda_2d_array(struct gl_context *ctx,
if (magStart < magEnd) {
/* do the magnified texels */
switch (samp->MagFilter) {
switch (samp->Attrib.MagFilter) {
case GL_NEAREST:
for (i = magStart; i < magEnd; i++)
sample_2d_array_nearest(ctx, samp, _mesa_base_tex_image(tObj),
@ -3152,7 +3152,7 @@ sample_1d_array_nearest(struct gl_context *ctx,
GLint array;
(void) ctx;
i = nearest_texel_location(samp->WrapS, img, width, texcoord[0]);
i = nearest_texel_location(samp->Attrib.WrapS, img, width, texcoord[0]);
array = tex_array_slice(texcoord[1], height);
if (i < 0 || i >= (GLint) img->Width ||
@ -3185,7 +3185,7 @@ sample_1d_array_linear(struct gl_context *ctx,
GLfloat a;
GLfloat t0[4], t1[4];
linear_texel_locations(samp->WrapS, img, width, texcoord[0], &i0, &i1, &a);
linear_texel_locations(samp->Attrib.WrapS, img, width, texcoord[0], &i0, &i1, &a);
array = tex_array_slice(texcoord[1], height);
if (img->Border) {
@ -3357,7 +3357,7 @@ sample_lambda_1d_array(struct gl_context *ctx,
if (minStart < minEnd) {
/* do the minified texels */
GLuint m = minEnd - minStart;
switch (samp->MinFilter) {
switch (samp->Attrib.MinFilter) {
case GL_NEAREST:
for (i = minStart; i < minEnd; i++)
sample_1d_array_nearest(ctx, samp, _mesa_base_tex_image(tObj),
@ -3396,7 +3396,7 @@ sample_lambda_1d_array(struct gl_context *ctx,
if (magStart < magEnd) {
/* do the magnified texels */
switch (samp->MagFilter) {
switch (samp->Attrib.MagFilter) {
case GL_NEAREST:
for (i = magStart; i < magEnd; i++)
sample_1d_array_nearest(ctx, samp, _mesa_base_tex_image(tObj),
@ -3519,15 +3519,15 @@ choose_depth_texture_level(const struct gl_sampler_object *samp,
{
GLint level;
if (samp->MinFilter == GL_NEAREST || samp->MinFilter == GL_LINEAR) {
if (samp->Attrib.MinFilter == GL_NEAREST || samp->Attrib.MinFilter == GL_LINEAR) {
/* no mipmapping - use base level */
level = tObj->BaseLevel;
level = tObj->Attrib.BaseLevel;
}
else {
/* choose mipmap level */
lambda = CLAMP(lambda, samp->MinLod, samp->MaxLod);
lambda = CLAMP(lambda, samp->Attrib.MinLod, samp->Attrib.MaxLod);
level = (GLint) lambda;
level = CLAMP(level, tObj->BaseLevel, tObj->_MaxLevel);
level = CLAMP(level, tObj->Attrib.BaseLevel, tObj->_MaxLevel);
}
return level;
@ -3568,10 +3568,10 @@ sample_depth_texture( struct gl_context *ctx,
/* XXXX if samp->MinFilter != samp->MagFilter, we're ignoring lambda */
function = (samp->CompareMode == GL_COMPARE_R_TO_TEXTURE_ARB) ?
samp->CompareFunc : GL_NONE;
function = (samp->Attrib.CompareMode == GL_COMPARE_R_TO_TEXTURE_ARB) ?
samp->Attrib.CompareFunc : GL_NONE;
if (samp->MagFilter == GL_NEAREST) {
if (samp->Attrib.MagFilter == GL_NEAREST) {
GLuint i;
for (i = 0; i < n; i++) {
GLfloat depthSample, depthRef;
@ -3584,19 +3584,19 @@ sample_depth_texture( struct gl_context *ctx,
swImg->FetchTexel(swImg, col, row, slice, &depthSample);
}
else {
depthSample = samp->BorderColor.f[0];
depthSample = samp->Attrib.BorderColor.f[0];
}
depthRef = CLAMP(texcoords[i][compare_coord], 0.0F, 1.0F);
result = shadow_compare(function, depthRef, depthSample);
apply_depth_mode(tObj->DepthMode, result, texel[i]);
apply_depth_mode(tObj->Attrib.DepthMode, result, texel[i]);
}
}
else {
GLuint i;
assert(samp->MagFilter == GL_LINEAR);
assert(samp->Attrib.MagFilter == GL_LINEAR);
for (i = 0; i < n; i++) {
GLfloat depth00, depth01, depth10, depth11, depthRef;
GLint i0, i1, j0, j1;
@ -3624,21 +3624,21 @@ sample_depth_texture( struct gl_context *ctx,
}
if (slice < 0 || slice >= (GLint) depth) {
depth00 = samp->BorderColor.f[0];
depth01 = samp->BorderColor.f[0];
depth10 = samp->BorderColor.f[0];
depth11 = samp->BorderColor.f[0];
depth00 = samp->Attrib.BorderColor.f[0];
depth01 = samp->Attrib.BorderColor.f[0];
depth10 = samp->Attrib.BorderColor.f[0];
depth11 = samp->Attrib.BorderColor.f[0];
}
else {
/* get four depth samples from the texture */
if (useBorderTexel & (I0BIT | J0BIT)) {
depth00 = samp->BorderColor.f[0];
depth00 = samp->Attrib.BorderColor.f[0];
}
else {
swImg->FetchTexel(swImg, i0, j0, slice, &depth00);
}
if (useBorderTexel & (I1BIT | J0BIT)) {
depth10 = samp->BorderColor.f[0];
depth10 = samp->Attrib.BorderColor.f[0];
}
else {
swImg->FetchTexel(swImg, i1, j0, slice, &depth10);
@ -3646,13 +3646,13 @@ sample_depth_texture( struct gl_context *ctx,
if (tObj->Target != GL_TEXTURE_1D_ARRAY_EXT) {
if (useBorderTexel & (I0BIT | J1BIT)) {
depth01 = samp->BorderColor.f[0];
depth01 = samp->Attrib.BorderColor.f[0];
}
else {
swImg->FetchTexel(swImg, i0, j1, slice, &depth01);
}
if (useBorderTexel & (I1BIT | J1BIT)) {
depth11 = samp->BorderColor.f[0];
depth11 = samp->Attrib.BorderColor.f[0];
}
else {
swImg->FetchTexel(swImg, i1, j1, slice, &depth11);
@ -3670,7 +3670,7 @@ sample_depth_texture( struct gl_context *ctx,
depth00, depth01, depth10, depth11,
wi, wj);
apply_depth_mode(tObj->DepthMode, result, texel[i]);
apply_depth_mode(tObj->Attrib.DepthMode, result, texel[i]);
} /* for */
} /* if filter */
}
@ -3718,7 +3718,7 @@ _swrast_choose_texture_sample_func( struct gl_context *ctx,
}
else {
const GLboolean needLambda =
(GLboolean) (sampler->MinFilter != sampler->MagFilter);
(GLboolean) (sampler->Attrib.MinFilter != sampler->Attrib.MagFilter);
switch (t->Target) {
case GL_TEXTURE_1D:
@ -3728,11 +3728,11 @@ _swrast_choose_texture_sample_func( struct gl_context *ctx,
else if (needLambda) {
return sample_lambda_1d;
}
else if (sampler->MinFilter == GL_LINEAR) {
else if (sampler->Attrib.MinFilter == GL_LINEAR) {
return sample_linear_1d;
}
else {
assert(sampler->MinFilter == GL_NEAREST);
assert(sampler->Attrib.MinFilter == GL_NEAREST);
return sample_nearest_1d;
}
case GL_TEXTURE_2D:
@ -3741,13 +3741,13 @@ _swrast_choose_texture_sample_func( struct gl_context *ctx,
}
else if (needLambda) {
/* Anisotropic filtering extension. Activated only if mipmaps are used */
if (sampler->MaxAnisotropy > 1.0F &&
sampler->MinFilter == GL_LINEAR_MIPMAP_LINEAR) {
if (sampler->Attrib.MaxAnisotropy > 1.0F &&
sampler->Attrib.MinFilter == GL_LINEAR_MIPMAP_LINEAR) {
return sample_lambda_2d_aniso;
}
return sample_lambda_2d;
}
else if (sampler->MinFilter == GL_LINEAR) {
else if (sampler->Attrib.MinFilter == GL_LINEAR) {
return sample_linear_2d;
}
else {
@ -3757,10 +3757,10 @@ _swrast_choose_texture_sample_func( struct gl_context *ctx,
swrast_texture_image_const(img);
texture_sample_func func;
assert(sampler->MinFilter == GL_NEAREST);
assert(sampler->Attrib.MinFilter == GL_NEAREST);
func = &sample_nearest_2d;
if (sampler->WrapS == GL_REPEAT &&
sampler->WrapT == GL_REPEAT &&
if (sampler->Attrib.WrapS == GL_REPEAT &&
sampler->Attrib.WrapT == GL_REPEAT &&
swImg->_IsPowerOfTwo &&
img->Border == 0) {
if (img->TexFormat == MESA_FORMAT_BGR_UNORM8)
@ -3775,22 +3775,22 @@ _swrast_choose_texture_sample_func( struct gl_context *ctx,
if (needLambda) {
return sample_lambda_3d;
}
else if (sampler->MinFilter == GL_LINEAR) {
else if (sampler->Attrib.MinFilter == GL_LINEAR) {
return sample_linear_3d;
}
else {
assert(sampler->MinFilter == GL_NEAREST);
assert(sampler->Attrib.MinFilter == GL_NEAREST);
return sample_nearest_3d;
}
case GL_TEXTURE_CUBE_MAP:
if (needLambda) {
return sample_lambda_cube;
}
else if (sampler->MinFilter == GL_LINEAR) {
else if (sampler->Attrib.MinFilter == GL_LINEAR) {
return sample_linear_cube;
}
else {
assert(sampler->MinFilter == GL_NEAREST);
assert(sampler->Attrib.MinFilter == GL_NEAREST);
return sample_nearest_cube;
}
case GL_TEXTURE_RECTANGLE_NV:
@ -3800,11 +3800,11 @@ _swrast_choose_texture_sample_func( struct gl_context *ctx,
else if (needLambda) {
return sample_lambda_rect;
}
else if (sampler->MinFilter == GL_LINEAR) {
else if (sampler->Attrib.MinFilter == GL_LINEAR) {
return sample_linear_rect;
}
else {
assert(sampler->MinFilter == GL_NEAREST);
assert(sampler->Attrib.MinFilter == GL_NEAREST);
return sample_nearest_rect;
}
case GL_TEXTURE_1D_ARRAY_EXT:
@ -3814,11 +3814,11 @@ _swrast_choose_texture_sample_func( struct gl_context *ctx,
else if (needLambda) {
return sample_lambda_1d_array;
}
else if (sampler->MinFilter == GL_LINEAR) {
else if (sampler->Attrib.MinFilter == GL_LINEAR) {
return sample_linear_1d_array;
}
else {
assert(sampler->MinFilter == GL_NEAREST);
assert(sampler->Attrib.MinFilter == GL_NEAREST);
return sample_nearest_1d_array;
}
case GL_TEXTURE_2D_ARRAY_EXT:
@ -3828,11 +3828,11 @@ _swrast_choose_texture_sample_func( struct gl_context *ctx,
else if (needLambda) {
return sample_lambda_2d_array;
}
else if (sampler->MinFilter == GL_LINEAR) {
else if (sampler->Attrib.MinFilter == GL_LINEAR) {
return sample_linear_2d_array;
}
else {
assert(sampler->MinFilter == GL_NEAREST);
assert(sampler->Attrib.MinFilter == GL_NEAREST);
return sample_nearest_2d_array;
}
default:

View File

@ -268,7 +268,7 @@ _swrast_map_texture(struct gl_context *ctx, struct gl_texture_object *texObj)
GLuint face, level;
for (face = 0; face < faces; face++) {
for (level = texObj->BaseLevel; level < MAX_TEXTURE_LEVELS; level++) {
for (level = texObj->Attrib.BaseLevel; level < MAX_TEXTURE_LEVELS; level++) {
struct gl_texture_image *texImage = texObj->Image[face][level];
struct swrast_texture_image *swImage = swrast_texture_image(texImage);
unsigned int i, slices;
@ -328,7 +328,7 @@ _swrast_unmap_texture(struct gl_context *ctx, struct gl_texture_object *texObj)
GLuint face, level;
for (face = 0; face < faces; face++) {
for (level = texObj->BaseLevel; level < MAX_TEXTURE_LEVELS; level++) {
for (level = texObj->Attrib.BaseLevel; level < MAX_TEXTURE_LEVELS; level++) {
struct gl_texture_image *texImage = texObj->Image[face][level];
struct swrast_texture_image *swImage = swrast_texture_image(texImage);
unsigned int i, slices;

View File

@ -553,7 +553,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->Sampler.MinFilter; \
info.filter = obj->Sampler.Attrib.MinFilter; \
info.envmode = unit->EnvMode; \
info.er = 0; \
info.eg = 0; \
@ -820,7 +820,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->Sampler.MinFilter; \
info.filter = obj->Sampler.Attrib.MinFilter; \
info.envmode = unit->EnvMode; \
info.er = 0; \
info.eg = 0; \
@ -1064,8 +1064,8 @@ _swrast_choose_triangle( struct gl_context *ctx )
swImg = swrast_texture_image_const(texImg);
format = texImg ? texImg->TexFormat : MESA_FORMAT_NONE;
minFilter = texObj2D ? samp->MinFilter : GL_NONE;
magFilter = texObj2D ? samp->MagFilter : GL_NONE;
minFilter = texObj2D ? samp->Attrib.MinFilter : GL_NONE;
magFilter = texObj2D ? samp->Attrib.MagFilter : GL_NONE;
envMode = ctx->Texture.FixedFuncUnit[0].EnvMode;
/* First see if we can use an optimized 2-D texture function */
@ -1074,9 +1074,9 @@ _swrast_choose_triangle( struct gl_context *ctx )
&& !_mesa_ati_fragment_shader_enabled(ctx)
&& ctx->Texture._MaxEnabledTexImageUnit == 0
&& ctx->Texture.Unit[0]._Current->Target == GL_TEXTURE_2D
&& samp->WrapS == GL_REPEAT
&& samp->WrapT == GL_REPEAT
&& texObj2D->_Swizzle == SWIZZLE_NOOP
&& samp->Attrib.WrapS == GL_REPEAT
&& samp->Attrib.WrapT == GL_REPEAT
&& texObj2D->Attrib._Swizzle == SWIZZLE_NOOP
&& swImg->_IsPowerOfTwo
&& texImg->Border == 0
&& (_mesa_format_row_stride(format, texImg->Width) ==