Commit graph

1197 commits

Author SHA1 Message Date
Johan Forsberg
3b86aa08cc
examples: add instanced-cube example (#246)
add example based on webgpu-samples' instancedCube sample.

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
Co-authored-by: Stephen Gutekanst <stephen@hexops.com>
2022-04-20 23:00:02 -07:00
PiergiorgioZagaria
8f7a20d2e6
examples: fix BlendState for rotating-cube and two-cubes (#244) 2022-04-20 10:59:40 -07:00
iddev5
bb65083561 CI: dont run aarch64-mac workflow on forks
The workflow uses a self hosted runner which is only available for
hexops/mach* repositories. Without this commit, whenever a fork of mach
or mach-* were pushed, it would queue an aarch64-mac job and then crash
after one day due to no machines being found.
2022-04-19 20:12:22 -07:00
iddev5
fde336736d README: Add web (wasm) status 2022-04-19 01:30:13 -07:00
d3m1gd
6300c85e79
examples: fix blend mode in triangle example (#240)
Co-authored-by: d3m1gd <mach+d3m1gd@users.noreply.github.com>
2022-04-18 23:50:23 -07:00
Stephen Gutekanst
0db0481f01
README: fix formatting, add sponsor section, etc. 2022-04-18 23:48:39 -07:00
Stephen Gutekanst
6901711734
README: polish it up! 2022-04-18 23:29:49 -07:00
Release automation
c9ac61c1c4 gpu-dawn: update to latest binary release 2022-04-19 04:26:30 +00:00
Stephen Gutekanst
954a5d3cc0 gpu-dawn: fix compilation on Linux
Helps hexops/mach#236

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-04-18 20:47:23 -07:00
Michal Ziulek
bd28946397 gpu: Changes needed for latest Dawn (generated-2022-04-18). 2022-04-18 20:45:33 -07:00
Stephen Gutekanst
b2ac779180 glfw: update vulkan headers to latest (adds v1.3 support)
Produced via `./update-upstream.sh`

Helps hexops/mach#236

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-04-18 20:44:34 -07:00
Stephen Gutekanst
a127378b19 gpu-dawn: update Dawn to latest revision as of 2022-04-18
Effectively a redo of hexops/mach#231 where I messed up the submodule update by accident.

Updates Dawn to latest revision as of 2022-04-18 c7b7b6def6

* Followed https://github.com/hexops/dawn/tree/main/mach#updating
* The UB issue should now actually get fixed (once CI builds the binary releases.)
* Verified example runs on macOS.

Helps hexops/mach#221

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-04-18 11:38:32 -07:00
PiergiorgioZagaria
169b1e2a42
gpu: correct alignment in pointer casts; handle void Context in all callbacks (#233)
* Fixed ErrorCallback.init() alignment
* Fixed callbacks alignments
* Fixed more of the callback alignment problems
* Added checks for void Context in callback
2022-04-18 11:38:09 -07:00
Stephen Gutekanst
d664c8e55d
do not produce needless libraries (#220)
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-04-18 10:32:21 -07:00
Stephen Gutekanst
7285fa0f03 gpu-dawn: correct update to latest Dawn revision
In e673e6c5d4 I failed to update the submodule correctly, this
commit fixes that and actually updates us to the latest Dawn revision.

Helps hexops/mach#221

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-04-18 06:47:00 -07:00
Release automation
3b92e9f2cf gpu-dawn: update to latest binary release 2022-04-18 07:30:07 +00:00
Stephen Gutekanst
e673e6c5d4
gpu-dawn: update Dawn to latest revision as of 2022-04-17 (#231)
Updates Dawn to latest revision as of 2022-04-17 69daaab759

* Followed https://github.com/hexops/dawn/tree/main/mach#updating
* Includes a fix for UB issue https://github.com/hexops/dawn/pull/9 (I will send a CL for this upstream soon.)
* Verified examples run on macOS (other OSes will get built by CI and verified later)

Closes hexops/mach#221

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-04-17 23:39:34 -07:00
Stephen Gutekanst
e9671f388c examples: ensure zmath submodule is cloned during zig build
Fixes the issue people are running into at e.g.:

* https://old.reddit.com/r/Zig/comments/u622dq/mach_engine_webgpu_examples_showcase/i564w4s/
* https://twitter.com/slimsag/status/1515925666230784000?s=20&t=M2KXFUcLZT0-mJAcMy6sPw

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-04-17 23:00:39 -07:00
PiergiorgioZagaria
3fb59a1e34
examples: add ported two-cubes example (#228) 2022-04-17 14:31:52 -07:00
PiergiorgioZagaria
f96bbb453e
examples: add ported rotating-cube example (#227) 2022-04-17 13:50:25 -07:00
Stephen Gutekanst
93629022c5 examples: add libs/zmath dependency
Helps hexops/mach#222

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-04-17 12:57:59 -07:00
iddev5
a922b4b29b mach: set error message to be shown on glfw error
This uses glfw.setErrorCallback to set a global callback in mach's App
which would work across all mach applications
2022-04-17 11:50:33 -07:00
iddev5
27146af8ce glfw: add getErrorString() to access the current error description 2022-04-17 10:49:05 -07:00
Stephen Gutekanst
6f3864c1f9 examples: boids: make boids calculation framerate independent
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-04-17 10:07:27 -07:00
Stephen Gutekanst
305c446aa2 add delta time calculation for frame-rate independent movement
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-04-17 10:06:56 -07:00
d3m1gd
7e8cbc78ff
gpu: fix samler typo (#224)
Co-authored-by: d3m1gd <mach+d3m1gd@users.noreply.github.com>
2022-04-17 09:15:52 -07:00
Stephen Gutekanst
5883a50d92 add high-level vsync modes
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-04-16 11:52:47 -07:00
d3m1gd
05853da233
gpu: fix alignment issues with getMappedRange, getConstMappedRange (#223)
fixes alignment issues with getMappedRange, getConstMappedRange

Prior to this change `getMappedRange` and `getConstMappedRange` would not handle alignment to `COPY_BUFFER_ALIGNMENT` for users, and so invocation could result in an unhelpful error message:

```
    thread 254201 panic: attempt to use null value
    .../mach/gpu/src/NativeInstance.zig:1721:42: 0x480747
    in .gpu.NativeInstance.buffer_vtable.getMappedRange (game)
            return @ptrCast([*c]u8, range.?)[0..size];
					 ^
```

To address this:

1. Ensure we always request a 4-byte aligned buffer when `createBuffer` is called.
2. Ensure we always map 4-byte aligned buffers.

Co-authored-by: d3m1gd <mach+d3m1gd@users.noreply.github.com>
2022-04-16 10:16:20 -07:00
Andrew Gutekanst
c11d818c89 examples: add license information 2022-04-14 10:46:31 -07:00
Andrew Gutekanst
a7727c6b54 examples: add ported boids example
Ported from https://github.com/austinEng/webgpu-samples/
2022-04-14 10:46:31 -07:00
Andrew Gutekanst
9e945ce951 gpu: improve optional handling
Helps hexops/mach#182
2022-04-14 10:46:31 -07:00
Andrew Gutekanst
9489fe7083 examples: prepare for adding more examples 2022-04-14 10:46:31 -07:00
Release automation
2496b50b16 gpu-dawn: update to latest binary release 2022-04-12 19:48:01 +00:00
Michal Ziulek
fe8e0e7c98
gpu: Add default values for some structs (taken from the spec). (#218)
Helps hexops/mach#182
2022-04-12 12:09:48 -07:00
Isaac Freund
02e357ab44
build: never use pkg-config to link system libraries (#217)
Every library we want to link against is either provided by the Zig
toolchain or part of our SDK. Therefore, using pkg-config to link
against libraries on the host system is never what we intend.

To fix this, use linkSystemLibraryName() everywhere instead of
linkSystemLibrary() as the latter integrates with pkg-config while the
former just passes -lfoo to the zig compiler.

In combination with Zig commit 38d6e1d8a8 fixing an std.build bug,
this change fixes the linking of the necessary X11 libraries on my
x86_64 glibc based Void Linux system.
2022-04-12 12:08:30 -07:00
Michal Ziulek
f2ce208aa1
gpu: Added helpers to BindGroup.Entry; make dynamic_offset a const slice (#215)
Helps hexops/mach#
2022-04-11 11:47:02 -07:00
Michal Ziulek
8c8534e609
gpu: Default values for BindGroup.Entry (#214)
simplifies creating BindGroup - all resources are null by default and the user sets only the one needed.

Helps hexops/mach#182
2022-04-10 15:17:20 -07:00
Michal Ziulek
9ed6f6ca8b
Added helper functions to BindGroupLayout.Entry (#213)
* gpu: Added helper functions to BindGroupLayout.Entry
* gpu: Changed default values for *.BindingLayout structures. Added comments for helpers.
2022-04-10 14:28:44 -07:00
Michal Ziulek
a943fbed3e
gpu: make RenderPipeline.fragment optional (#212)
pipeline with vertex stage only is perfectly valid

Helps hexops/mach#182
2022-04-10 10:30:34 -07:00
Michal Ziulek
d0782d24d1 gpu: VertexBufferLayout.attributes field needs to be a pointer to multiple structures. 2022-04-09 12:33:27 -07:00
Release automation
6d8e39a247 gpu-dawn: update to latest binary release 2022-04-09 01:14:08 +00:00
Stephen Gutekanst
ea93eea21f gpu-dawn: use buffered reader (reduce gzip extraction time 76s -> 5.5s)
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-04-08 17:23:12 -07:00
Stephen Gutekanst
eac7efa5d1 gpu: fix regression in example causing it not to compile
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-04-08 16:58:27 -07:00
Stephen Gutekanst
d2d5bdc892 glfw: zig fmt
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-04-08 16:54:37 -07:00
Release automation
5c194cfc07 gpu-dawn: update to latest binary release 2022-04-08 18:45:23 +00:00
Silver
786d8181b4 gpu-dawn: fix formatting of .gitmodules 2022-04-08 11:03:00 -07:00
Silver
6fb3ec6fd8 gpu: make writeBuffer API nicer to use 2022-04-08 11:03:00 -07:00
Silver
5ecb980b5f gpu: fix signature of CommandEncoder.writeBuffer 2022-04-08 11:03:00 -07:00
Silver
614322edc7 gpu: convert Texture.Usage to packed struct 2022-04-08 11:03:00 -07:00
Silver
adf5332969 app: add resize callback function 2022-04-08 11:03:00 -07:00