70 posts
innovation through innovation™
Minimal D3D11
Edited by d7samurai on

New version of my minimal D3D11 reference / tutorial implementation; a small uncluttered Direct3D 11 setup and rendering primer for newcomers to the API.

https://gist.github.com/d7samurai/261c69490cce0620d0bfc93003cd1052

No modern C++ / OOP / obscuring cruft. The source code is a complete, runnable C+ application contained in a single function (WinMain), laid out in a step-by-step fashion that should be easy to follow from the code alone (about 250 LOC). Win7 compatible. Produces this output:

Mārtiņš Možeiko
2356 posts / 2 projects
Minimal D3D11
Edited by Mārtiņš Možeiko on
Some time back I wrote similar thing: https://git.handmade.network/snippets/19
Yours is a bit complete, mine is only rendering one triangle, but it has extra features:
* Plain C, no C++
* Does not require DirectD3 11.1, uses 11.0
* Optionally does not link to D3DCompiler_XXX.dll file
* Handles window resizing
* Handles GPU driver reset on present call

70 posts
innovation through innovation™
Minimal D3D11
Edited by d7samurai on

Minimal D3D11 pt2:

https://gist.github.com/d7samurai/aee35fd5d132c51e8b0a78699cbaa1e4

Follow-up to Minimal D3D11, adding instanced rendering. The main difference here is that the hollow cube is rendered using DrawIndexedInstanced (which saves a lot of vertices compared to the original, so model data is now small enough to be included in the source without being too much in the way), but also all trigonometry and matrix math is moved to the vertex shader, further simplifying the main code.