I came across this quote on the Outerra blog:
using log2 instead of log: in shaders, log function is implemented using the log2 instruction, so it's better to use log2 directly, avoiding an extra multiply
Quote is from https://outerra.blogspot.com/2013/07/logarithmic-depth-buffer-optimizations.html
Can StackOverflow confirm this statement is true for WebGL and WebGPU?
loghowever it wishes. While it may be true that all/most GPUs implementedlogusinglog2in 2013 (!), there is no guarantee. In general, GLSL applications should be profiled on various targeted hardware to see what the actual performance is (and whether these sort of substitutes are actually faster).