News for hackers. Stuff that matters.
Re:I still teach OpenGL ES 3.0 by avaer on Tuesday October 27, 2026 @12:13AM (#50254635)
There can be overhead, though GPU memory + drivers are some of the most optimized software in the world.

Some OS/hardware have separate GPU memory (Nvidia), some have unified memory (Macos, modern consoles), but moving memory is usually not the problem.

Things don't "run on CPU by default", it's up to the programmer where to run it. But the CPU and GPU paradigm of "running a program" are very different, since on GPU you're running SIMD (i.e. running your code on arrays) or else there is no point to use a GPU.

Re:I still teach OpenGL ES 3.0 by tvbusy on Tuesday October 27, 2026 @03:20AM (#50255633)
For me, if-branching is the hardest to wrap my head around. "If"s are so natural to CPU programming that it's second nature to any developer but on GPU, it's expensive.
Re:I still teach OpenGL ES 3.0 by __del__ on Tuesday October 27, 2026 @03:45AM (#50255778)
instead of iterating over an array and if-branching to one of two paths for each item, conceive of your conditionals as logic operations which test for set membership (i.e. "is this array item a member of the set i care about?") and with this array mask of "do the thing or don't do the thing" flags, you can mutate your data 0 or 1 times.

the key for me is thinking in terms of sets—much of your conditional logic is probably about sorting things into sets anyway.