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>
`supported` is a better variable name because `supported.limits.foobar` is the actual
way it need be referenced, and `limits.limits.foobar` would be redundant.
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
* gpu-dawn: update to latest version generated-2023-01-12.1673546526
Signed-off-by: Wrench[bot] <wrench@hexops.com>
Co-authored-by: Stephen Gutekanst <stephen@hexops.com>
`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.
This reverts commit a1fe671db8.
Lue suggested reverting #661 because ZLS worked around the issue of @src
being relative in that environment: https://github.com/zigtools/zls/pull/898
This is not a perfect solution (what zls did seems to be a workaround), but
is good enough for us until Zig gets an official package manager.