Minimal D3D11
April 17, 2026 ยท View on GitHub
Minimal D3D11 reference implementation: An uncluttered Direct3D 11 setup + basic rendering primer and API familiarizer. Complete, runnable Windows application contained in a single function and laid out in a linear, step-by-step fashion that should be easy to follow from the code alone. ~200 LOC. No modern C++ / OOP or (other) obscuring cruft. View on YouTube
Other gists in this series:
- Minimal D3D11 part 2: instancing
Introduces instanced rendering, where each instance is described in the form of a separate 4x4 transformation matrix, allowing arbitrary scaling, rotation and translation per entity.
Alternative and advanced techniques:
- Minimal D3D11 elaborations I
Reconfigured for instanced rendering of the hollow cube itself. Trigonometry and matrix math moved from CPU to GPU. Simplified program structure, tighter codebase, more compact 3D model data. - Minimal D3D11 elaborations II
Adds shadowmapping. Misc improvements and alternative approaches to rendering setup (manual vertex fetching, samplerless texture lookup, null shader depth map rendering, procedurally generated texture and instance data).
2D sprite rendering engines:
- Minimal D3D11 sprite renderer
Basic back-to-front animated sprite rendering reference code. Text renderer modification. Sprite/glyph clipping. - Minimal D3D11 sprite renderer NEO
Ultra-compact sprite rendering engine with example frame animation logic. Includes rotation, anchor/pivot point, color filtering, alpha blending, built-in antialiased point sampling.
Minimal D3D11 bonus material:
- Extra minimal triangle complete program to render a triangle using D3D11 in less than 40 LOC
- Pixel art antialiasing custom aa point sampling for non-aliased zooming / subpixel scaling and movement of pixel art
- Simple 2D rendering draw to 2D canvas with absolute pixel coordinate positioning of arbitrarily placed vertices in D3D11
- Even simpler 2D same as above, but without texturing or alpha blending
- MSAA the original Minimal D3D11 codebase with 8x MSAA added (and texturing removed for clarity)
- Fullscreen triangle setup for rendering a fullscreen triangle (as opposed to a fullscreen quad) for post processing etc
