[Mesa-dev] [PATCH] lp_build_lod_selector: Disable brilinear folding on explicit lod.
Olivier Galibert
galibert at pobox.com
Mon Jun 25 23:12:34 PDT 2012
On Mon, Jun 25, 2012 at 03:16:35PM -0700, Jose Fonseca wrote:
> Indeed lp_build_brilinear_lod is not faster than
> lp_build_ifloor_fract, but brilinear is faster, not because log is a
> faster approximation, but because it increases the odds that fract
> part is zero, which means that we can sample from a single mip
> level, instead of lerping between two mip levels.
>
> I think you have a good point here -- lp_build_brilinear_lod is a
> log2 approximation which is wrong here and that's a great catch, --
> but I have a point too: lp_build_ifloor_fract will slow down texture
> sampling.
>
> Just like log2 and brilinear log2, we need a variant of
> ifloor_fract, that increases the probability of fract part being
> zero, essentially by applying a stair case transformation like:
You can do that by multiplying by 'k', subtracting 0.5*k and clamping
to [0,1[. The question is whether you really want to do something
like that for explicit lod, where the user supposedly exactly knows
what he wants. "textureLod" is not used often at all[1], so one can
think that when it's used you'd better do it precisely.
OG.
[1] You see more uses of lod bias and/or textureGrad, the latter due
to the use of conditionals.
More information about the mesa-dev
mailing list