Note that on e.g. web platform, swapbuffers is not an explicit call.
We also need a signal that the frame has been submitted and finished,
and this is it.
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
* `@import("mach").core.gpu` has been renamed to `@import("mach").gpu`
* `pub const SYSGPUInterface` now has a default value (i.e. you do not need to write it in your main.zig, if you were.)
* You can now check `if (comptime mach.use_sysgpu)` for any conditional code you might have that should only run with sysgpu.
This (old):
```
pub const mach_core_options = core.ComptimeOptions{
.use_wgpu = false,
.use_sysgpu = true,
};
```
Has been replaced by this:
```
pub const use_sysgpu = true;
```
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
Prior to this change `mach.Core.init` would heap allocate the structure, returning `*Core`:
```zig
app.core = try mach.Core.init(allocator, .{});
```
This was obviously not ideal, but wasn't possible to eliminate before due to how Core was
entangled with the platform abstraction. Now that it has been removed, we can reduce Core
initialization to take a `*Core` to initialize. In practice this means initialization looks
something like this:
```zig
try mach.Core.init(&app.core, alloctor, .{});
```
Or more simply:
```zig
try app.core.init(allocator, .{});
```
And we eliminate the `*Core` allocation entirely in most cases.
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This correctly sets presentation modes for vsync, both at startup and at runtime via
a `setOptions` request.
Note: There may still be platforms where setting vsync is not enough, and a frame rate
limiter is needed to achieve proper synchronization. This is tracked in hexops/mach#444
and not fixed by this change.
Fixeshexops/mach#307
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>