Zig monthly, December 2021 GUI, Node.js modules, optional GC and more
Zig monthly, December 2021: GUI, NodeJS modules, optional GC & more
GUI, NodeJS modules, optional GC & moreVulkan 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 libraryYurii 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 generatorsThe 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.@zenith391 released v0.1 of zgt (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@xyaman released mibu, a library for low-level terminal manipulation, “[…] It’s far from complete, but the basics work”:Features:Allocation free.Raw mode.8-16 colors.True Color (24-bit RGB).Cursor controls.Clear(Erase) functions.Colors.Key events.TinyVGFelix “xq” Queißner released TinyVG: “A challenger to the throne of vector graphics. SVG is dead, long live TinyVG!” - definitely worth checking out!Use Zig to build native NodeJS modulesZig 0.9 was released - which has enabled zig ld to be used to create native NodeJS modules without node-gyp. You can find some exampls from the Tigerbeetle team here!Self hosted compiler progressDevelopment 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 codeBehavior 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:Gamedev progressProgress 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 collectionMitchell Hashimoto (founder of Hashicorp) wrote a wrapper for libgc in Zig in order to learn how Zig interoperates with C (“turns out: exceptionally good”)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 mentionsLibrarieszig-qoi: a Zig implementation of the QOI image formatzig-v8: Zig and C bindings for V8 useful for embedding V8 into projects.zlib, libcurl, and more C library bindings from @mattniteNewsCoil (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!