3 ms·
> Unlike normal programming languages, fragment shaders always execute both parts of each branch due to gpu limitations. GPUs do have real branching and even l
by account42 6y ago
> Unlike normal programming languages, fragment shaders always execute both parts of each branch due to gpu limitations.
GPUs do have real branching and even loops these days, you just can't have divergent branching within a shader group.
I'm not sure how efficient it is to splatter individual pixels like in the mask used in the article since adjacent pixels will likely need to be evaluated anyway if the shader uses derivatives. Too bad that the author didn't bother to include any performance numbers.
- underanalyzer 6y agoGood points. I should have definitely include perf numbers. This shader https://www.shadertoy.com/view/3l23Rh https://www.shadertoy.com/view/3l23Rh goes from 20-25 fps on my laptop to over 60 when rendering 1/10th of the pixels and up around 57-60 fps when rendering 1/5th of the pixels although I know that's not exactly great benchmarking. I don't think derivatives are a computational problem here (and a few tests seem to confirm it) but the values of the derivatives are definitely ruined in the process.