flâneur — a map of the web's best reading

Inigo Quilez :: computer graphics, mathematics, shaders, fractals, demoscene and more

iquilezles.org · 1,054 words · saved by 1 readers

Inigo Quilez :: articles :: gpu conditionals - 2025 Intro In this article I want to correct a popular misconception that's been making the rounds in computer graphics aficionado circles for a long time now. It has to do with conditionals when selecting between two results in the GPUs. Unfortunately there are a couple of educational websites out there that are spreading some misinformation, and it would be nice correcting that. I tried contacting the authors without success, so without further ado, here goes my attempt to fix things up a little: The issue So, say I have this code, which I actually published the other day: vec2 snap45( in vec2 v ) { vec2 s = sign(v); float x = abs(v.x); return x>0.923880?vec2(s.x,0.0): x>0.382683?s*sqrt(0.5): vec2(0.0,s.y); } The exact details of what it does don't matter for this discussion. All we care about is the two ternary operations deciding what's the final value this function should retu

--> Inigo Quilez :: computer graphics, maths, shaders, fractals, demoscene Inigo Quilez :: :: Intro In this article I want to correct a popular misconception that's been making the rounds in computer graphics aficionado circles for a long time now. It has to do with conditionals when selecting between two results in the GPUs. Unfortunately there are a couple of educational websites out there that are spreading some misinformation, and it would be nice correcting that. I tried contacting the authors without success, so without further ado, here goes my attempt to fix things up a little: The iss

Explore this link on the map →

related reading