summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2017-07-25 17:33:05 +0200
committerMarek Olšák <[email protected]>2017-07-26 19:53:26 +0200
commit033b4e434057a6cc885f443792167dfabfb077b6 (patch)
treeb853e829c09330a330216f68932b2e1e4564cfab
parent914f11e75b8ebe8a0faab76ce25fe185ab580eee (diff)
st/mesa: also clamp and quantize per-unit lod bias
Reviewed-by: Samuel Pitoiset <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
-rw-r--r--src/mesa/state_tracker/st_atom_sampler.c7
-rw-r--r--src/mesa/state_tracker/st_cb_texture.c2
-rw-r--r--src/mesa/state_tracker/st_texture.h1
3 files changed, 6 insertions, 4 deletions
diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c
index 208b6f7a1df..d9e8de3c9e0 100644
--- a/src/mesa/state_tracker/st_atom_sampler.c
+++ b/src/mesa/state_tracker/st_atom_sampler.c
@@ -105,6 +105,7 @@ void
st_convert_sampler(const struct st_context *st,
const struct gl_texture_object *texobj,
const struct gl_sampler_object *msamp,
+ float tex_unit_lod_bias,
struct pipe_sampler_state *sampler)
{
memset(sampler, 0, sizeof(*sampler));
@@ -119,7 +120,7 @@ st_convert_sampler(const struct st_context *st,
if (texobj->Target != GL_TEXTURE_RECTANGLE_ARB)
sampler->normalized_coords = 1;
- sampler->lod_bias = msamp->LodBias;
+ sampler->lod_bias = msamp->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.
@@ -241,9 +242,9 @@ st_convert_sampler_from_unit(const struct st_context *st,
msamp = _mesa_get_samplerobj(ctx, texUnit);
- st_convert_sampler(st, texobj, msamp, sampler);
+ st_convert_sampler(st, texobj, msamp, ctx->Texture.Unit[texUnit].LodBias,
+ sampler);
- sampler->lod_bias += ctx->Texture.Unit[texUnit].LodBias;
sampler->seamless_cube_map |= ctx->Texture.CubeMapSeamless;
}
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index d0a7b55c587..db2913ed9e3 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -2972,7 +2972,7 @@ st_NewTextureHandle(struct gl_context *ctx, struct gl_texture_object *texObj,
if (!st_finalize_texture(ctx, pipe, texObj, 0))
return 0;
- st_convert_sampler(st, texObj, sampObj, &sampler);
+ st_convert_sampler(st, texObj, sampObj, 0, &sampler);
view = st_get_texture_sampler_view_from_stobj(st, stObj, sampObj, 0);
} else {
view = st_get_buffer_sampler_view_from_stobj(st, stObj);
diff --git a/src/mesa/state_tracker/st_texture.h b/src/mesa/state_tracker/st_texture.h
index a6f6ee8ebef..8448f4c6f02 100644
--- a/src/mesa/state_tracker/st_texture.h
+++ b/src/mesa/state_tracker/st_texture.h
@@ -281,6 +281,7 @@ void
st_convert_sampler(const struct st_context *st,
const struct gl_texture_object *texobj,
const struct gl_sampler_object *msamp,
+ float tex_unit_lod_bias,
struct pipe_sampler_state *sampler);
void