Zig NEWS

Cover image for Zig monthly, December 2021: GUI, NodeJS modules, optional GC & more
Stephen Gutekanst for Zig monthly

Posted on

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

@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.

TinyVG

Felix "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 modules

Zig 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 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:

Gamedev progress

Progress continues in the area of gamedev, too, attempting to summarize:

Optional garbage collection

Mitchell 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 mentions

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!

Latest comments (0)