Commit graph

1373 commits

Author SHA1 Message Date
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
Silver
c62b5ba52f gpu: replace &slice[0] with slice.ptr
This avoids UB if the slice is empty
2022-04-08 11:03:00 -07:00
Silver
f4c8a1908d gpu: fix BindGroup.Entry so that optional things are optional 2022-04-08 11:03:00 -07:00
Silver
35b38dfa96 gpu: fix typo in writeBuffer and writeTexture 2022-04-08 11:03:00 -07:00
Silver
47cd84f8ff gpu: use packed structs to wrap WebGPU's bitfield enums 2022-04-08 11:03:00 -07:00
Silver
232d0dc5ad gpu: rename BlendFactor.oneMinusSrcAlpha to match Zig naming style 2022-04-08 11:03:00 -07:00
Silver
d82b3f6cbb publicize gpu and glfw from toplevel build.zig 2022-04-07 18:42:15 -07:00
Silver
04da4565c1 gpu: add type to pkg def in build.zig 2022-04-07 18:42:15 -07:00
Silver
017ca6dd08 glfw: add type to pkg def in build.zig 2022-04-07 18:42:15 -07:00
Silver
6ec499cf70 clean up build.zig and add type to pkg def 2022-04-07 18:42:15 -07:00
Stephen Gutekanst
8b2ae06121 CI: temporarily disable macOS 11 test
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-04-05 00:16:51 -07:00
Stephen Gutekanst
f7cea5f304 CI: use macos-latest runners (macos-12 runners rarely available)
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-04-05 00:16:51 -07:00
Stephen Gutekanst
3bf471ccf9 CI: fix x86_64-windows -> macOS build
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-04-05 00:16:51 -07:00
Stephen Gutekanst
51b1f36d0a CI: correct build for macOS 12
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-04-05 00:16:51 -07:00
Stephen Gutekanst
d3d17ec570 CI: build on macos-12 not 11
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-04-05 00:16:51 -07:00
Stephen Gutekanst
c3f8f9a4d5 correct glfw package dependency
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-04-05 00:16:51 -07:00
Stephen Gutekanst
d0c55db017 CI: more explicitly denote cross-compilation targets
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-04-05 00:16:51 -07:00
Stephen Gutekanst
49f80de6ab add higher-level app library
Fixes hexops/mach#190

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-04-05 00:16:51 -07:00
Stephen Gutekanst
38095942d9 gpu: make Options public
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-04-05 00:16:51 -07:00
Stephen Gutekanst
451b437322 gpu: add std.build.Pkg definition
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-04-05 00:16:51 -07:00
Stephen Gutekanst
0161ccef37 glfw: add std.build.Pkg definition
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-04-05 00:16:51 -07:00
Stephen Gutekanst
cd88057edd gpu: add gpu.link to make using library elsewhere easier
Helps hexops/mach#189

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-04-05 00:16:51 -07:00
Roman Frołow
73c145819a
README: fix URL to build-an-ecs blog series (#204) 2022-04-04 22:09:39 -07:00
Release automation
3d0be5ad53 gpu-dawn: update to latest binary release 2022-03-31 17:58:16 +00:00
Stephen Gutekanst
f321651c62 gpu-dawn: fix bad merge
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-31 17:18:08 +00:00