Skip to content

Instantly share code, notes, and snippets.

View d7samurai's full-sized avatar
💭
innovation through irritation™

d7samurai

💭
innovation through irritation™
View GitHub Profile
@d7samurai
d7samurai / .readme.md
Last active December 15, 2025 14:57
Minimal D3D11 bonus material: MSAA

Minimal D3D11 bonus material: MSAA

image

This is essentially just the original Minimal D3D11 codebase with 8x MSAA added. However, since MSAA only smooths triangle edges and does not affect textured surface interiors, texturing is removed to isolate and make the effect of MSAA clearer.

In short there are two parts to it: 1) Create and render to an MSAA texture rather than your typical rendertarget/framebuffer (note: the depth buffer must match), and 2) [Resolve](https://gist.github.com/d7samurai/d74299f8bcadcb9cb0686

@d7samurai
d7samurai / .readme.md
Last active January 27, 2026 19:11
Minimal D3D11 bonus material: fullscreen triangle

Minimal D3D11 bonus material: fullscreen triangle

image

Basic setup for rendering a fullscreen triangle - as opposed to a fullscreen quad. This is a triangle that extends past the screen boundaries so that it covers it all, with the excess getting clipped away. The use case for this is typically doing a full screen pass for composition or post processing effects etc (though nowadays you might go for a compute shader instead).

Generally a triangle is preferred over a quad because the geometry is simpler (fewer vertices / shader invocations) and it eliminates the quad’s internal diagonal split. Since pixel shading runs in 2×2 pixel units (incidentally also referred to as "quads"), units that straddle the diagonal will do redundant work on pixels that gets masked out and discarded; both triangles pay this cost along the split, each discarding work tha

@d7samurai
d7samurai / .readme.md
Last active April 25, 2026 18:42
Minimal D3D11 part 2: instancing

Minimal D3D11 part 2: instancing

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. ~220 LOC. No modern C++ / OOP or (other) obscuring cruft. View on YouTube

Minimal D3D11 part 2: instancing

Building directly on the canonical Minimal D3D11 this follow-up introduces instanced rendering, where each instance is described in the form of a [separate transformation matrix](https:/