Skip to content

Instantly share code, notes, and snippets.

@RandyGaul
Created October 10, 2025 19:41
Show Gist options
  • Save RandyGaul/130b7dc7d4648f31acb7a28815112838 to your computer and use it in GitHub Desktop.
Save RandyGaul/130b7dc7d4648f31acb7a28815112838 to your computer and use it in GitHub Desktop.
CF renderer blog post sketch
renderer
- sprite as pod type
- Online atlas compiler
- SDF shapes
- Local aa
- Local rounding
- Alpha discard cutouts and shrink wrap OBB quads
- Polylines with SDF compatible triangulation
- On demand glyph rasterization
- No need to declare utf8 codes up-front, extremely efficient storage for blur/bold/italic, multiple languages, multiple fonts, etc
- Memory cost only scales relative to what you actually render
- Text markup and render system
- Box wrapping
- Vertical layouts
- Stream all verts dynamically to the GPU (no static meshes internally)
- SDL_Gpu backend
- Shader, vert buffer, texture buffer, uniforms
- Organized into “passes”, static layout of params all uploaded together as a bundle
- GLES3 backend
- Legacy API for web builds
- On demand triple buffers of mesh or texture updates
- Organized in a similar manner to passes API in SDL_Gpu
- Shader abstraction
- Truly cross platform, runtime (or offline) compileable shaders
- Material abstraction to match material values (key name and typically a float/vector/matrix value) to uniforms and build a memcpy’able block of data for uniform uploads
- High level “draw” fragment shader abstraction for setting up shaders on sprites or canvas
- Canvas based render paradigm
- Render to a canvas
- Blit one canvas to another
- Apply custom shader to canvases
- Internal geometry details
- All draw-API shapes go through the “sprite batch”, but really are often just packed implicitly defied shapes
- Like circle, capsule, box, etc
- Sprites get sorted around, and if an actual sprite with a texture then the texture is automagically stuffed into an atlas with other items you’ve rendered recently
- Text glyphs are just sprites generated and stuffed into atlases on the fly
- The camera hooks into sprites and modifies verts before they sent to the GPU. However, for shapes the world space positions are packed into vertex attributes for SDF rendering
- Built in (to draw-api) helpers for screen to world translation for points, mouse, and screen bounds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment