Inigo Quilez :: computer graphics, mathematics, shaders, fractals, demoscene and more
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
- Paper Shaders – Ultra-fast zero-dependency shadersshaders.paper.design
- Branchless Equivalents of Simple Functions | Harder, Better, Faster, Strongerhbfs.wordpress.com
- Shadersshaders.com
- The Case for Use.GPU — Acko.netacko.net
- General-purpose computing on graphics processing units - Wikipediaen.wikipedia.org
- CUDA C++ Programming Guide (Legacy) — CUDA C++ Programming Guidedocs.nvidia.com
- What happens when you run a CUDA kernelfergusfinn.com
- Teaching GPU programming in p5.js: now with compute shaders - Dave Pagurekdavepagurek.com
- The Aggregate Magic Algorithmsaggregate.org
- Gentle introduction to GPUs inner workings | vkSegfaultvksegfault.github.io
- Michael Abrash's Graphics Programming Black Book Special Edition: Table of Contentsphatcode.net
- The Best GPUs for Deep Learning in 2023 — An In-depth Analysistimdettmers.com