3 ms·
If you offload graphics to the GPU (which is what shaders are), there's surprisingly little CPU work left in a 2D platformer game. Think of (fragment) shaders
by kaoD 4y ago
If you offload graphics to the GPU (which is what shaders are), there's surprisingly little CPU work left in a 2D platformer game.
Think of (fragment) shaders as programs that run in the GPU per-texture-pixel. There is some initial CPU/memory-bound work setting everything up (e.g. uploading textures to GPU RAM, compiling the program, sending vertex buffers...) and then per-frame you just call the shader with some parameters (e.g. character's current position) and the GPU does the rest.
In-CPU you mostly do the non-parallelizable work such as collisions, game logic, keyboard input, etc. which can be very light for a simple 2D platformer.