Zig monthly, December 2021
GUI, NodeJS modules, optional GC & more
Vulkan GPU path tracing
@ashpil has been working on a GPU accelerated path tracer using vulkan-zig, GLFW, and the Vulkan ray tracing extensions:
It’s about 6K lines of code, I thought a realistic chess game would be a good way to learn some advanced graphics techniques, as the gameplay is so well established I could just focus on the visuals.
Plans for the near future include performance optimizations (it probably lags less on an RTX series card but I’m on a 1080) and more interesting materials that take full advantage of path tracing.
They’re planning to publish the code on GitHub after polishing some more, you can keep an eye on their GitHub profile or reach out to them on Discord (Brunch#9226) in the meantime!
Async generator library
Yurii Rashkovskii published zig-generator-a library for writing async generator functions, which I found best described by this commit message (but be sure to check out the code examples in the README):
Problem: what’s the point of generators?
Generators look nice, but they are still slower than callbacks (as they naturally have more harness code).
Solution: provide Map and Join generators
The beauty of generators is that they are async and this allows us to build higher-level primitives.
Of a particular interest is Join that will allow to consume values from two generators, as they come.
zgt: a Zig GUI toolkit
zgt is a pure Zig (in fact, the only backend that needs libc is the GTK+ one) library for making cross-platform GUIs. It has first class support for animations and data binding. One notable thing is that its main aim is to use native widgets when available, but it (will) be able to draw widgets manually which will be used for the OpenGL ES backend. […] Only thing missing is a Cocoa / Mac OS backend.
Low level terminal manipulation
- Allocation free.
- Raw mode.
- 8-16 colors.
- True Color (24-bit RGB).
- Cursor controls.
- Clear(Erase) functions.
- Key events.
Use Zig to build native NodeJS modules
Self hosted compiler progress
Development of the self-hosted Zig compiler continues, with the most recent numbers (Jan 1st, 2022) showing over 50% of behavior tests passing with the LLVM backend(!):
Zig self-hosted compiler progress report:
- 159,096 lines of code
- Behavior Tests Passing:
- LLVM backend: 575/1078 (53%)
- C backend: 298/1078 (28%)
- WASM: 157/1078 (15%)
- ARM: 7/1078 (1%)
- x86: 0/1078 (0%)
The 0.9 release notes included this awesome diagram:
Progress continues in the area of gamedev, too, attempting to summarize:
- @omaraaa published a vector math library which extends your own
Vec2f, etc. struct declarations with methods - an interesting approach.
- @MichalZiulek has been hard at work on a SIMD-accelerated vector math package for zig-gamedev: zmath
- @MichalZiulek published a zig-gamedev December 2020 progress report, including audio, mesh shaders, and more!
- I published a website and roadmap for the upcoming Mach game engine.
Optional garbage collection
The library implements the standard Zig
Allocator interface, and should allow one to mix and match garbage collection and manual memory management, very cool!
Other notable mentions
- Coil (the company behind Tigerbeetle DB) recently began sponsoring Zig and the Tigerbeetle team shared some interesting insights into how they use leverage comptime for their database.
- @sheredom and @postgoodism both shared Advent of Code postmortems after having completed it in Zig!
- Jens Goldberg shared an “Analysis of the overhead of a minimal Zig program”
Thanks for reading!
If you like my work on zigmonthly, Mach engine, etc. consider sponsoring me on GitHub so I can do even more of it!