Every time I drunk browse so I see an unanswered fwidth
question.
And it makes me wonder what it actually was designed to do.
Reading the docs it is:
abs(dFdx(p)) + abs(dFdy(p))
So it is not classic mip selection which is max(dx,dy)
.
Is it for alternative mip selection? But I fail to find a case where abs(dx) + abs(dy)
would be better.
There must be some siggraph paper or common algorithm I am completely missing that uses that function. And it must be really popular because it made it into GLSL.
The only thing I can think of is some 2d post filter I am missing.
But what?
I am sure somebody here knows and once you see it it's obvious.
So: What algorithm uses abs(dx) + abs(dy)
?
You're actually quite on the money with the 2D filtering suggestion. Any filter which relies on some sort of metric for the rate of change between a pixel and its neighbors could benefit from this function.
Examples would be anti-aliasing, edge detection, anisotropic filtering. I'm sure there are more examples one could think of.
It seems from your question and comments that you expect there to be a mind-blowing reason for this function to be included in GLSL. I would just say that it's a useful function to have. Perhaps someone with more in-depth knowledge about the actual internals of this function could provide more detail on what happens behind the scenes (i.e. if there is any performance improvement over a handwritten equivalent with dFdx and dFdy).