No description
Find a file
Lue eed2be4591 glfw: refactor getError and related functions
`getError()` now returns a struct `Error` containing `error_code` and
`description`. Rationale: retrieving the error code with the previous
implementation of `getError()` caused `getErrorString()` to return
null (the reverse is also true). The new implementation allows both
values to be retrieved at once.

The previous `getError()` function has been renamed to
`getErrorCode()` to reflect the fact that it returns a simple Zig
error rather than the `Error` struct. The error set returned by
`getErrorCode()` is now named `ErrorCode` rather than `Error`.

The behavior of the `getError()` family of functions clearing the
stored error is unchanged. However, since all code that used
`defer glfw.getError() catch {}` to explicitly clear errors had to be
refactored, a new `glfw.clearError()` function that returns void is
now available to make this operation more explicit.

Additionally, `mustGetError()` is now `mustGetErrorCode()`, and new
functions `mustGetError()` and `mustGetErrorString()` have been added
which wrap `getError()` and `getErrorString()` but panic if no error
is actually available.

Tests and API documentation had to be refactored across all of
`mach/glfw`. This commit also takes the opportunity to skip tests
involving window creation on CI so that other tests may still execute
normally.
2023-01-10 20:52:41 -07:00
.github all: update Zig to version 0.11.0-dev.1247+87b223428 2023-01-08 18:21:50 -07:00
dev Revert "all: build: fix sdkPath for relative @src.file / fix autocompletion with ZLS / IDEs (#661)" 2023-01-10 01:57:52 -07:00
doc doc: add FAQ details about how to install Vulkan on Linux (#591) 2022-10-21 07:38:09 -07:00
libmach libmach: fix small issues and naming conventions 2022-07-20 18:59:29 -07:00
libs glfw: refactor getError and related functions 2023-01-10 20:52:41 -07:00
shaderexp {shaderexp,gpu}: fix command buffer coercion (#603) 2022-10-31 08:17:50 -07:00
src glfw: refactor getError and related functions 2023-01-10 20:52:41 -07:00
tools Revert "all: build: fix sdkPath for relative @src.file / fix autocompletion with ZLS / IDEs (#661)" 2023-01-10 01:57:52 -07:00
.gitattributes gitattributes: update linguist-vendored C code marking (#612) 2022-11-13 17:40:36 -07:00
.gitignore all: ensure .git* files are standard across subprojects 2022-08-23 08:36:51 -07:00
.gitmodules sysaudio: rewrite in zig 2022-12-18 18:02:31 -07:00
build.zig Revert "all: build: fix sdkPath for relative @src.file / fix autocompletion with ZLS / IDEs (#661)" 2023-01-10 01:57:52 -07:00
LICENSE LICENSE: note directories with a separate LICENSE file 2021-07-05 12:46:20 -07:00
LICENSE-APACHE initialize repository 2021-07-04 10:36:34 -07:00
LICENSE-MIT initialize repository 2021-07-04 10:36:34 -07:00
README.md all: update Zig to version 0.11.0-dev.1247+87b223428 2023-01-08 18:21:50 -07:00

Mach is still early stages - see what we have today and stay tuned

Mach: game engine & graphics toolkit for the future

Written in Zig, Mach is for creating games, graphical applications, and desktop/mobile apps:

  • Data-driven, tooling oriented
  • Composable
  • Competitive with Unity and Unreal in spirit (a fully fledged editor in the future, etc.)

example-advanced-gen-texture-light example-boids example-textured-cube

Example showcase

Cross-platform graphics in ~60 seconds

git clone --recursive https://github.com/hexops/mach-examples
cd mach-examples/
zig build run-boids

Cross-platform graphics, a unified shader language & compute shaders.

(Requires zig 0.11.x | known issues)

Get started with 15+ examples

Libraries

Mach has many libraries you can use for game development in Zig - you don't have to use the entire engine. All our libraries aim to have the same zero-fuss installation, cross compilation, and platform support:

  • mach-glfw: Ziggified GLFW bindings with 100% API coverage
  • mach-freetype: Ziggified Freetype 2 & HarfBuzz bindings
  • mach-gpu-dawn: Google's Dawn WebGPU implementation, cross-compiled with Zig into a single static library
  • mach-system-sdk: More libraries for cross-compilation with Zig

Join the community

Contributors are very welcome! There are lots of places you can help out with little knowledge, so feel free to join the Matrix chat and say hi!

Sponsor development

No, its not Tom from myspace - its me, @slimsag! Its taken almost a year to get here - staring at broken CI pipelines, C++ compiler errors, buying hardware to test every OS+arch possible, and more.

There are few things in life that I am more serious about than this work. I dedicate ~48 hours/week to my dayjob, and ~50h/week to Zig building Mach and running zigmonthly.org. After three years of aggressively pushing for progress in this exact way, I have no plans to slow down anytime soon.

Supported platforms

Mach is still early stages, so far we have support for building from the following OS to the following targets:

Building for From macOS x86_64 From macOS M1/aarch64 From Linux x86_64 From Windows x86_64
macOS x86_64
macOS M1/aarch64
Linux x86_64
Windows x86_64
iOS 🏃 🏃 🏃 🏃
Android 🏃 🏃 🏃 🏃
Web (Wasm) 🏃 🏃 🏃 🏃
  • Tested and verified via CI.
  • ✔️ Should work, not tested via CI yet.
  • 🏃 Planned or in progress.
  • ⚠️ Implemented, but has known issues (e.g. bugs in Zig.)

Supported Zig version

Mach works with the new self-hosted Zig compiler only. This means you'll need to use the latest Zig nightly version.

Currently we test using 0.11.0-dev.1247+87b223428. Newer is generally better, but you can download this version here:

Contributing

Mach is maintained as a monorepo. When changes are merged to this repository, we use some git-fu to pick out the commits to subdirectories and push them to sub-repositories automagically. Changes to the libs/glfw/ directory in this repository get pushed to the separate mach-glfw repository after being merged here, for example.

Please prefix commits / pull requests with the project name (glfw: fix an issue, gpu: fix an issue, etc.) and if possible only one project per commit. If you don't know how to do this, no worries, we can help - just send your PR anyway!