• Stars
    star
    154
  • Rank 234,016 (Top 5 %)
  • Language
    Zig
  • License
    Other
  • Created over 1 year ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

mach/gpu: truly cross-platform WebGPU graphics for Zig
mach-gpu

The WebGPU interface for Zig - providing a truly cross-platform graphics API for Zig (desktop, mobile, and web) with unified low-level graphics & compute backed by Vulkan, Metal, D3D12, and OpenGL (as a best-effort fallback.)

Features

  • Desktop, Steam Deck, (soon) web, and (future) mobile support.
  • A modern graphics API similar to Metal, Vulkan, and DirectX 12.
  • Cross-platform shading language
  • Compute shaders
  • Seamless cross-compilation & zero-fuss installation, as with all Mach libraries.

Documentation

machengine.org/pkg/mach-gpu

Join the community

Join the Mach community on Discord to discuss this project, ask questions, get help, etc.

Issues

Issues are tracked in the main Mach repository.

WebGPU version

Dawn's webgpu.h is the authoritative source for our API. You can find the current version we use here.

Development rules

The rules for translating webgpu.h are as follows:

  • WGPUBuffer -> gpu.Buffer:
    • Opaque pointers like these become a pub const Buffer = opaque {_} to ensure they are still pointers compatible with the C ABI, while still allowing us to declare methods on them.
    • As a result, a nullable Buffer is represented simply as ?*Buffer, and any function that would normally take WGPUBuffer now takes *Buffer as a parameter.
  • WGPUBufferBindingType -> gpu.Buffer.BindingType (purely because it's prefix matches an opaque pointer type, it thus goes into the Buffer opaque type.)
  • Reserved Zig keywords are translated as follows:
    • error -> err
    • type -> typ
    • opaque -> opaq
  • Constant names map using a few simple rules, but it's easiest to describe them with some concrete examples:
    • RG11B10Ufloat -> rg11_b10_ufloat
    • Depth24PlusStencil8 -> depth24_plus_stencil8
    • BC5RGUnorm -> bc5_rg_unorm
    • BC6HRGBUfloat -> bc6_hrgb_ufloat
    • ASTC4x4UnormSrgb -> astc4x4_unorm_srgb
    • maxTextureDimension3D -> max_texture_dimension_3d
  • Sometimes an enum will begin with numbers, e.g. WGPUTextureViewDimension_2DArray. In this case, we add a prefix so instead of the enum field being 2d_array it is dimension_2d_array (an enum field name must not start with a number in Zig.)
  • Dawn extension types WGPUDawnFoobar are placed under gpu.dawn.Foobar
  • Regarding "undefined" terminology:
    • In Zig, undefined usually means undefined memory, undefined behavior, etc.
    • In WebGPU, undefined commonly refers to JS-style undefined: an optional value that was not specified

More Repositories

1

dockerfile

Dockerfile best-practices for writing production-worthy Docker images.
Dockerfile
4,012
star
2

vecty

Vecty lets you build responsive and dynamic web frontends in Go using WebAssembly, competing with modern web frameworks like React & VueJS.
Go
2,736
star
3

mach

zig game engine & graphics toolkit
Zig
2,613
star
4

mach-glfw

Ziggified GLFW bindings with 100% API coverage, zero-fuss installation, cross compilation, and more.
Zig
317
star
5

valast

Convert Go values to their AST
Go
298
star
6

autogold

Automatically update your Go tests
Go
271
star
7

fastfilter

fastfilter: Binary fuse & xor filters for Zig (faster and smaller than bloom filters)
Zig
231
star
8

mach-core

window+input+GPU, truly cross-platform
Zig
181
star
9

mach-gpu-dawn

Google's Dawn WebGPU implementation, cross-compiled with Zig into a single static library
Zig
140
star
10

gotextdiff

Unified text diffing in Go (copy of the internal diffing packages the officlal Go language server uses)
Go
124
star
11

mach-examples

Mach engine examples
Zig
86
star
12

mach-sysgpu

Highly experimental, blazingly fast, lean & mean descendant of WebGPU written in Zig
Zig
82
star
13

dawn

Fork of dawn.googlesource.com/dawn with generated code and third-party dependencies committed
C++
76
star
14

zorex

Zorex: the omnipotent regex engine
Zig
65
star
15

Azure-Kinect-Python

Python 3 bindings for the Azure Kinect SDK
Python
48
star
16

mach-freetype

Ziggified Freetype 2 bindings with zero-fuss installation, cross compilation, and more.
Zig
45
star
17

mach-glfw-vulkan-example

mach-glfw Vulkan example
Zig
37
star
18

mach-ecs

Entity Component System from first-principles designed for Zig
Zig
35
star
19

zgo

Go + Zig = πŸ’• | Zig and Go are best friends
Go
35
star
20

mach-dxcompiler

DXC built using Zig
C++
34
star
21

mach-glfw-opengl-example

Example for using mach-glfw with zig-opengl
Zig
32
star
22

mach-sysjs

enables Zig/WASM to speak to JavaScript
Zig
26
star
23

mach-sysaudio

cross-platform low-level audio IO in Zig
Zig
26
star
24

awesome-zig-gamedev

Comprehensive collection of maintained zig gamedev projects & libraries
17
star
25

xcode-frameworks

XCode frameworks packaged for the Zig build system
C
17
star
26

mach-gamemode

mach-gamemode: make your Linux games go brrr
Zig
14
star
27

mach-core-starter-project

The result of running through https://machengine.org/core/getting-started
Zig
13
star
28

pgtrgm_emperical_measurements

Emperical measurements of pg_trgm performance at scale
Shell
11
star
29

zigmonthly.org

Curated Zig news brought to you by @slimsag each month
SCSS
11
star
30

mach-system-sdk

DirectX 12 headers for MinGW/Zig, cross-compile DX12/Metal/etc with Zig, etc.
10
star
31

brotli

A fork of brotli packaged for the Zig build system
C
10
star
32

cmder

Lightweight Go pattern for writing CLIs with subcommands
Go
10
star
33

harfbuzz

A fork of harfbuzz packaged for the Zig build system
C++
10
star
34

sdk-macos-11.3

Also see https://github.com/hexops/sdk-macos-12.0
C
9
star
35

libmach

C API to Mach core and Mach engine
C
9
star
36

glfw

A fork of GLFW packaged for the Zig build system
C
8
star
37

wrench

[bot] 🐡 Wrench here! Let's fix this! πŸ”§
Go
8
star
38

freetype

A fork of freetype packaged for the Zig build system
C
8
star
39

machengine.org

machengine.org website, documentation, etc.
SCSS
8
star
40

mach-editor

Mach CLI and graphical editor
Zig
8
star
41

sinter

Sinter text search engine
Zig
7
star
42

devlog

Hexops devlog
SCSS
7
star
43

vulkan-zig-generated

Snektron/vulkan-zig, but generated and comitted for use as a package manager dependency
Zig
7
star
44

vulkan-headers

A fork of vulkan-headers packaged for the Zig build system
C++
7
star
45

mach-model3d

compact, featureful model format & alternative to glTF
C
7
star
46

font-assets

Various fonts packaged for the Zig build system
Zig
7
star
47

mach-opus

Opus audio decoding and encoding for Zig via the battle-hardened xiph.org libopus
Zig
6
star
48

basisu

A fork of basisu packaged for the Zig build system
C
6
star
49

sdk-macos-12.0

macOS 12.0 Monterey SDK for Mach engine
C
6
star
50

mach-objc

Generated Objective-C bindings for Zig
Zig
5
star
51

linux-audio-headers

linux-audio-headers packaged for the Zig build system
C
5
star
52

mach-flac

FLAC audio decoding and encoding for Zig via the battle-hardened xiph.org libflac
Zig
5
star
53

x11-headers

x11-headers packaged for the Zig build system
C
5
star
54

mach-rs

Rust bindings for Mach
5
star
55

mach-basisu

basis universal (supercompressed textures) for Zig
Zig
5
star
56

direct3d-headers

Enables using the latest Direct3D headers and libraries with Zig
C
4
star
57

ControlCursor

A C# library for getting and setting global cursor position.
C#
4
star
58

hexi-old

Hexi: Game Engine & Graphics Toolkit
Rust
4
star
59

wayland-headers

wayland-headers packaged for the Zig build system
C
4
star
60

spirv-cross

A fork of spirv-cross packaged for the Zig build system
C++
3
star
61

spirv-tools

A fork of spirv-tools packaged for the Zig build system
C++
3
star
62

hexops.com

hexops.com website
SCSS
3
star
63

opengl-headers

opengl-headers packaged for the Zig build system
C
3
star
64

soundio

libsoundio upstream sources used by Mach engine
C
3
star
65

sdk-macos-13.3

macOS 13.3 Ventura SDK for Mach engine
C
3
star
66

sdk-linux-x86_64

Linux x86_64 SDK for Mach engine
C++
3
star
67

mach-ggml

Zig
3
star
68

mach-core-example-assets

mach-core examples assets
Zig
2
star
69

sdk-linux-aarch64

Linux aarch64 SDK for Mach engine
C++
2
star
70

opusfile

A fork of opusfile packaged for the Zig build system
C
2
star
71

ogg

A fork of ogg packaged for the Zig build system
C
2
star
72

sdk-windows-x86_64

Windows x86_64 SDK for Mach engine
C
2
star
73

mach-objc-generator

Zig Objective-C binding generator
Zig
2
star
74

mach-example-assets

Example assets for Mach engine
1
star
75

ztemplate

Hexops Zig template repository
Zig
1
star
76

tridex-assets

Static contents / assets for Tridex
1
star
77

opus

A fork of opus packaged for the Zig build system
C
1
star
78

opusenc

A fork of libopusenc packaged for the Zig build system
C
1
star
79

directx-headers

A fork of DirectX-Headers, packaged with the Zig build system and compatible with cross-compilation
C
1
star
80

flac

A fork of flac packaged for the Zig build system
C
1
star