๐งน tidy things up
๐ fix some prelude defs
๐ add license
current focus: c11 + win32 + d3d12
Unless specified otherwise, source code and assets are under CC0 1.0 and are dedicated to the public domain.
DirectX:
The C Programming Language:
Voxels:
u32 i = x + (z * 64) + (y * 64 * 64);
u8 x = i % 64;
u8 z = (i / 64) % 64;
u8 y = (i / 64 / 64) % 64;
d3dSDKLayers.dll
(debugging)-gdwarf
for debug symbols on win32#include <initguid.h>
first for uuid to work in CI tried to get this working, but there is a problem with the zig "libc" header files. they're just a bit old, specifically, error: incorrect <rpcndr.h> version. Use the header that matches with the MIDL compiler.
Version 500
is required for the Agility SDK, but zig currently only has version 475
(so close). I could probably link into the actual system libraries, which has version 501
, but I don't really know how to do that without the dreaded visual studio, plus that also defeats cross-compilation.
// download and place the agility sdk in src/external
// put before windows.h (but maybe after initguid.h)
#include "external/d3d12/build/native/include/d3d12.h"
#if DEBUG_D3D12
#include "external/d3d12/build/native/include/d3d12sdklayers.h"
#endif
// ...
#include <windows.h>
// ...
// try and use it (this may require "-fdeclspec" compiler flag maybe idk)
__declspec(dllexport) extern const UINT D3D12SDKVersion = 608;
__declspec(dllexport) extern const char* D3D12SDKPath = ".\\D3D12\\";
I'm literally just rendering a blue screen at the moment, but using PIX is pretty easy to get GPU and CPU info from the program. I just build in release mode, then launch the application with PIX for GPU Capture, then I can click a button to capture up to 10 frames at once. Run some analysis on that bad boi and badabing-badaboom you got yourself a spicy graphics pipeline view.
4,433.10ns
55,008.10ns
1,083.40ns
pretty cool stuff! In the future, I could use the "WinPixEventRuntime" to label specific GPU/CPU events to view and debug.
Following from Handmade Hero Day 011, I can do a "unity" build to support different platforms by basically building win32_main.c
for windows, linux_main.c
for linux, etc. Avoiding virtualising the platform code more than necessary.
Then we have two (2) types of interactions between platform code and application code; services provided to the application by the platform, and services provided to the platform by the application. Example: The application layer calls LoadFile("shader.hlsl")
of the platform code, which returns the contents of the file. Example: The platform layer calls Update(delta_time)
of the application code, providing the time elapsed between update loops.