st/mesa: Set samplers views' first_level.

Base level and min LOD aren't equivalent. In particular, min LOD has no
effect on image array selection for magnification and non-mipmapped
minification.

Signed-off-by: Brian Paul <brianp@vmware.com>
This commit is contained in:
Henri Verbeet
2011-01-17 22:03:30 +01:00
committed by Marek Olšák
parent 7984c2d42d
commit 2ecb73379e
2 changed files with 6 additions and 7 deletions

View File

@@ -166,12 +166,9 @@ update_samplers(struct st_context *st)
sampler->lod_bias = st->ctx->Texture.Unit[texUnit].LodBias + sampler->lod_bias = st->ctx->Texture.Unit[texUnit].LodBias +
texobj->LodBias; texobj->LodBias;
sampler->min_lod = texobj->BaseLevel + texobj->MinLod; sampler->min_lod = MAX2(0.0f, texobj->MinLod);
if (sampler->min_lod < texobj->BaseLevel) sampler->max_lod = MIN2((GLfloat) texobj->MaxLevel - texobj->BaseLevel,
sampler->min_lod = texobj->BaseLevel; texobj->MaxLod);
sampler->max_lod = MIN2((GLfloat) texobj->MaxLevel,
(texobj->MaxLod + texobj->BaseLevel));
if (sampler->max_lod < sampler->min_lod) { if (sampler->max_lod < sampler->min_lod) {
/* The GL spec doesn't seem to specify what to do in this case. /* The GL spec doesn't seem to specify what to do in this case.
* Swap the values. * Swap the values.

View File

@@ -148,6 +148,7 @@ st_create_texture_sampler_view_from_stobj(struct pipe_context *pipe,
u_sampler_view_default_template(&templ, u_sampler_view_default_template(&templ,
stObj->pt, stObj->pt,
format); format);
templ.u.tex.first_level = stObj->base.BaseLevel;
if (swizzle != SWIZZLE_NOOP) { if (swizzle != SWIZZLE_NOOP) {
templ.swizzle_r = GET_SWZ(swizzle, 0); templ.swizzle_r = GET_SWZ(swizzle, 0);
@@ -248,7 +249,8 @@ update_textures(struct st_context *st)
if (check_sampler_swizzle(stObj->sampler_view, if (check_sampler_swizzle(stObj->sampler_view,
stObj->base._Swizzle, stObj->base._Swizzle,
stObj->base.DepthMode) || stObj->base.DepthMode) ||
(st_view_format != stObj->sampler_view->format)) (st_view_format != stObj->sampler_view->format) ||
stObj->base.BaseLevel != stObj->sampler_view->u.tex.first_level)
pipe_sampler_view_reference(&stObj->sampler_view, NULL); pipe_sampler_view_reference(&stObj->sampler_view, NULL);
sampler_view = st_get_texture_sampler_view_from_stobj(stObj, pipe, st_view_format); sampler_view = st_get_texture_sampler_view_from_stobj(stObj, pipe, st_view_format);