Module: Mesa Branch: master Commit: 132b69c4edb824c70c98f8937c63e49b04f3adff URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=132b69c4edb824c70c98f8937c63e49b04f3adff
Author: Marek Olšák <marek.ol...@amd.com> Date: Fri Dec 2 16:37:22 2016 +0100 st/mesa: round lod_bias to a multiple of 1/256 This reduces the number of sampler states 3.6x in Batman Arkham: Origins. (from ~7200 to ~2000) Reviewed-by: Nicolai Hähnle <nicolai.haeh...@amd.com> --- src/mesa/state_tracker/st_atom_sampler.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c index 4568630..daf98c3 100644 --- a/src/mesa/state_tracker/st_atom_sampler.c +++ b/src/mesa/state_tracker/st_atom_sampler.c @@ -159,6 +159,12 @@ convert_sampler(struct st_context *st, sampler->normalized_coords = 1; sampler->lod_bias = ctx->Texture.Unit[texUnit].LodBias + msamp->LodBias; + /* 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. + */ + sampler->lod_bias = CLAMP(sampler->lod_bias, -16, 16); + sampler->lod_bias = floorf(sampler->lod_bias * 256) / 256; sampler->min_lod = MAX2(msamp->MinLod, 0.0f); sampler->max_lod = msamp->MaxLod; _______________________________________________ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit