Project requires Zig 0.10.0-dev.4060 (master) or newer to compile.
To get started try out physically based rendering sample:
(git
with Git LFS extension and Zig 0.10.0-dev.4060 (master) or newer is required)
git clone https://github.com/michal-z/zig-gamedev.git
cd zig-gamedev
zig build physically_based_rendering-run
- zwin32 - Zig bindings for Win32 API
- zd3d12 - helper library for working with DirectX 12
- zxaudio2 - helper library for working with XAudio2
- zpix - support for GPU profiling with PIX
- Interop with Direct2D and DirectWrite for high-quality vector graphics and text rendering (optional)
If you are new to DirectX 12 graphics programming I recommend starting with intro applications.
-
rasterization: This sample application shows how GPU rasterizes triangles in slow motion.
zig build rasterization-run
-
simple raytracer: This sample implements basic hybrid renderer. It uses rasterization to resolve primary rays and raytracing (DXR) for shadow rays.
zig build simple_raytracer-run
-
mesh shader test: This sample shows how to use DirectX 12 Mesh Shader.
zig build mesh_shader_test-run
To build all sample applications (assuming zig
is in the PATH and Git LFS is installed):
git clone https://github.com/michal-z/zig-gamedev.git
cd zig-gamedev
zig build
Build artifacts will show up in zig-out/bin
folder.
zig build <sample_name>
will build sample application named <sample_name>
.
zig build <sample_name>-run
will build and run sample application named <sample_name>
.
To list all available sample names run zig build --help
and navigate to Steps
section.
All sample applications support the following build options:
-Drelease-safe=[bool]
- Optimizations on and safety on-Drelease-fast=[bool]
- Optimizations on and safety off-Dztracy-enable=[bool]
- Tracy profiler zones enabled
Addidtional options for Windows applications:
-Denable-dx-debug=[bool]
- Direct3D 12, Direct2D, DXGI debug layers enabled-Denable-dx-gpu-debug=[bool]
- Direct3D 12 GPU-Based Validation enabled (requires -Denable-dx-debug=true)-Dzpix-enable=[bool]
- PIX markers and events enabled
Thanks to all people who sponsor zig-gamedev project! In particular, these fine folks sponsor zig-gamedev for $25/month or more:
- Derek Collison (derekcollison)
- mzet (mzet-)
- Garett Bass (garettbass)
- Connor Rowland (ckrowland)
- Zig Software Foundation (ziglang)
- Ian (LinuXY)
- Simon A. Nielsen Knights (tauoverpi)
- shintales (shintales)
- Joran Dirk Greef (jorangreef)