{"slug": "knots-a-library-for-building-guis-with-zig", "title": "Knots - A library for building GUIs with Zig", "summary": "Knots, a GUI library for the Zig programming language, released an update that lets developers write fragment and vertex shaders in Zig and compile them at build time via the Zig build system, embedding the resulting SPIRV as an anonymous import. The release bumps the required Vulkan version to 1.3 from 1.2 for dynamic rendering, adds wasm32-freestanding and wasm64-freestanding as supported targets while dropping wasmxx-emscripten, and adds components including tooltips, context menus, dialogs, menu buttons, radio inputs and floating in-app window panels. The maintainer also noted the project's wgpu-native bindings for Zig support Zig 0.16 and newer.", "body_md": "Another update as it has been nearly 2 months since the last one now. Quite a lot has changed so below are some of the highlights, in no particular order.\n\n### \n\nYou might be wondering how, and the TDLR is that the Zig compiler is now powerful enough that I can write my fragment and vertex shaders in Zig, and compiling them at build time using the Zig build system, and embedding the SPIRV as an anonymous import. Huge props to the Zig compiler team and any contributors that are working on the SPIRV backend. Easily one of the coolest usages of Zig compiler and build system in this project right now! Vulkan required version has also been bumped to 1.3 from 1.2 to support dynamic rendering, which allowed me to simplify the backend.\n\n### \n\nIn other words wasm<32|64>-freestanding is now a supported target, and wasmxx-emscripten support has been dropped. Unfortunately this was not solved quite as elegantly, and essentially required an unwanted amount of JS glue, and build time logic I had to delegate downstream to the user. The upsides are much smaller wasm binaries, simplified compilation machinery (no need to call emcc and research its flags e.t.c), and reduced compile times. Downsides are that I have taken on yet another compilation target I will have to test and support going forward.\n\n### \n\n.qoi files generated from a simple test runner are checked in to the repository such that I can easily detect regressions in the renderer. This is all currently being done manually however as I am too lazy to set up a CI pipeline for this.\n\n### \n\nThis was a cool feature, I however do not think it really has any real practical use-case besides easily debugging both backends in one instance. To support this I had to have wrap my backends behind a vtable, which is just an unnecessary performance hit, as well as just making the code harder to debug. GPU backends are now behind a comptime interface, so the GPU backend must be known at compile time.\n\n### \n\nThis is quite a long list and I won’t bother going in to every one so I’ll just list them as bullet points below. You can try all of these in the web playground.\n\n- Support for opening multiple native windows.\n- Floating in-app window panels as a component.\n- Tooltip component.\n- Context menu component.\n- Dialog component.\n- Menu button component.\n- Radio input component.\n- Basic input key\n- General bug fixes, performance improvements and housekeeping.\n\n## \n\nI think I am going to spend some time building out the playground app, I want to find a way to showcase the true potential of knots, any suggestions would be appreciated. I also want to spend some time on improving documentation across the board, to make it easy for anyone to pick up the library and start building their next GUI application.\n\n## \n\nI am maintaining ~~what I believe is the only~~ wgpu-native bindings for Zig which are actually up to date, the reason I mention that is because the wgpu website and docs seem to point to a repository that has not had a commit in almost a year now [wgpu_native_zig](https://github.com/bronter/wgpu_native_zig). With that being said, if you want to get in to GPU programming with Zig, and you do not want to dive head first in to the monstrosity that is Vulkan, I would recommend trying these bindings [wgpu-zig](https://codeberg.org/shahwali/wgpu-zig) and following [Learn WebGPU for C++ documentation](https://eliemichel.github.io/LearnWebGPU/) (it is in C++, but it is trivially translatable to Zig). You can probably also follow the rust guide [Introduction | Learn Wgpu](https://sotrh.github.io/learn-wgpu/) although I’m not sure how easy it is to translate to Zig. The bindings support Zig 0.16 and newer. Please open an issue or a PR if you find some part of the API I have not covered yet.\n\nNow to [enjoy the sun](https://www.youtube.com/watch?v=DgGuTicdtyg) while it is still here", "url": "https://wpnews.pro/news/knots-a-library-for-building-guis-with-zig", "canonical_source": "https://ziggit.dev/t/knots-a-library-for-building-guis-with-zig/15244#post_10", "published_at": "2026-09-28 22:49:19+00:00", "updated_at": "2026-09-28 23:19:40.060482+00:00", "lang": "en", "topics": ["developer-tools"], "entities": ["Knots", "Zig", "Vulkan", "WebAssembly", "wgpu-native", "wgpu-zig", "wgpu_native_zig", "Emscripten"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/knots-a-library-for-building-guis-with-zig", "markdown": "https://wpnews.pro/news/knots-a-library-for-building-guis-with-zig.md", "text": "https://wpnews.pro/news/knots-a-library-for-building-guis-with-zig.txt", "jsonld": "https://wpnews.pro/news/knots-a-library-for-building-guis-with-zig.jsonld"}}