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
related reading
- How to Optimize a CUDA Matmul Kernel for cuBLAS-like Performance: a Worklogsiboehm.com
- A case for learning GPU programming with a compute-first mindset – Maister's Graphics Adventuresthemaister.net
- The Best GPUs for Deep Learning in 2023 — An In-depth Analysistimdettmers.com
- The Case for Use.GPU — Acko.netacko.net
- Inside NVIDIA GPUs: Anatomy of high performance matmul kernels - Aleksa Gordićaleksagordic.com
- Teaching GPU programming in p5.js: now with compute shaders - Dave Pagurekdavepagurek.com
- Strangely, Matrix Multiplications on GPUs Run Faster When Given "Predictable" Data! [short]thonking.ai
- Why Rendering a Triangle is Complicated | LiamHzliamhz.com
- The Best GPUs for Deep Learning in 2023 — An In-depth Analysistimdettmers.com
- GitHub - adam-maj/tiny-gpu: A minimal GPU design in Verilog to learn how GPUs work from the ground up · GitHubgithub.com
- What To Learn To Be A Real Time Graphics Programmerblog.demofox.org
- Thousands of Styled Rectangles in 120FPS on GPU - tchayen.comtchayen.com