Rendering should move to the SDL GPU renderer, for lighting and particles #74

Open
opened 2026-08-02 18:38:31 -04:00 by tachikoma · 0 comments
Collaborator

Source: TODO.txt (at bbb7b8f)

The 2D backend draws through SDL_Renderer. Lighting and particles want the GPU
renderer instead.

The vtable is already the seam this goes behind. akgl_RenderBackend is a
record of six function pointers, and akgl_render_2d_bind installs one
implementation of them; a GPU backend is another akgl_render_gpu_bind beside it,
not a rewrite of the callers. That was the point of splitting bind out of
init.

Research collected while this sat in TODO.txt, kept because it is the part that
took the time:

Sequencing note: several perf items measure the software renderer today. A GPU
backend changes what "the blit" costs and therefore what the bookkeeping targets
in PERFORMANCE.md are being compared against -- worth re-recording the baseline
rather than reasoning across the two.

Files: src/renderer.c, include/akgl/renderer.h


Filed by Tachikoma (Claude Code, Opus 5, 1M context)

**Source:** TODO.txt (at bbb7b8f) The 2D backend draws through `SDL_Renderer`. Lighting and particles want the GPU renderer instead. **The vtable is already the seam this goes behind.** `akgl_RenderBackend` is a record of six function pointers, and `akgl_render_2d_bind` installs one implementation of them; a GPU backend is another `akgl_render_gpu_bind` beside it, not a rewrite of the callers. That was the point of splitting `bind` out of `init`. Research collected while this sat in `TODO.txt`, kept because it is the part that took the time: - A worked example at roughly the right level: <https://github.com/TheSpydog/SDL_gpu_examples/blob/main/Examples/Blit2DArray.c> - Background, since the SDL GPU API assumes you have met a modern pipeline before: <https://vulkan-tutorial.com/Drawing_a_triangle/Graphics_pipeline_basics/Introduction>, <https://learn.microsoft.com/en-us/previous-versions/windows/desktop/bb153302(v=vs.85)>, <http://www.directxtutorial.com/LessonList.aspx?listid=112> - Shaders compile with <https://github.com/libsdl-org/SDL_shadercross>. **There are no docs on this tool.** - **Shader language is the awkward decision.** Microsoft is abandoning HLSL and everyone is unifying on SPIR-V, but SPIR-V is an intermediate representation and HLSL is higher level, so HLSL is easier to pick up and points at a language with a stated end date. - <https://flathub.org/apps/org.shadered.SHADERed> - HLSL tutorials: <https://www.youtube.com/playlist?list=PL78XDi0TS4lEMvytsE_MoWEpzBcukXv9b> - SPIR-V tutorials: <https://github.com/google/spirv-tutor> Sequencing note: several perf items measure the software renderer today. A GPU backend changes what "the blit" costs and therefore what the bookkeeping targets in `PERFORMANCE.md` are being compared against -- worth re-recording the baseline rather than reasoning across the two. **Files:** `src/renderer.c`, `include/akgl/renderer.h` --- Filed by Tachikoma (Claude Code, Opus 5, 1M context)
tachikoma added this to the 1.0.0 milestone 2026-08-02 18:38:31 -04:00
tachikoma added the performancedesign-decisionblast-radius:high labels 2026-08-02 18:38:31 -04:00
tachikoma added the status::grooming label 2026-08-02 18:49:29 -04:00
Sign in to join this conversation.