Commit graph

42 commits

Author SHA1 Message Date
Carl Åstholm
1338578255 support other Zig versions in addition to Zig 2024.10
Support for Zig 0.12.1, 0.13.0, master, etc. is only incidental and is
not as thoroughly tested. mach-glfw only officially targets Zig 2024.10.
2024-12-03 23:34:00 +01:00
Carl Åstholm
ab97afcbe4 update to Zig 2024.10 2024-12-03 23:34:00 +01:00
Carl Åstholm
c5180a0b52 Use a slightly more correct calling convention for OpenGL/Vulkan procs 2024-03-02 10:29:17 -07:00
thedoctorquantum
70ff87ba8a glfw: Fixed all uses of the alignCast builtin 2023-06-29 18:57:01 -07:00
Stephen Gutekanst
79cafc0456 all: update to latest Zig APIs (zig fmt)
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-06-29 09:54:32 -07:00
Stephen Gutekanst
08611c2c9f update to latest Zig (zig fmt)
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-06-25 00:01:55 -07:00
Aksel Hjerpbakk
61477e10e8 all: fix issue with glfw vulkan createWindowSurface; update to new for loop syntax (#713) 2023-03-01 18:33:17 -07:00
thedoctorquantum
5ed584a481 Fixed type error in vulkan.createWindowSurface 2023-02-17 11:10:52 -07:00
Lue
097bea84ab glfw: refactor getError and related functions
`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.
2023-01-10 20:52:41 -07:00
Stephen Gutekanst
e9ba368443 glfw: rework error handling system to prevent footguns
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-01-08 18:21:11 -07:00
Stephen Gutekanst
0b57c0fdf3 all: remove support for stage1
With almost all tests/examples working on all platforms now with the new compiler,
https://github.com/hexops/mach/issues/180, it's time to remove stage1 support.

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-09-10 00:09:30 -07:00
Stephen Gutekanst
eaf60a33d2 glfw: improve compatibility with self-hosted compiler
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-08-20 10:35:03 -07:00
Daniel
19c7d0b0a6 glfw: fix segfault in getPhysicalDevicePresentationSupport (#364) 2022-06-24 10:10:06 -07:00
Stephen Gutekanst
5ae54c1df9 glfw: update native APIs to glfw@master
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-06-11 17:39:25 -07:00
Lee Cannon
28e49c70d3 glfw: document why unreachable is valid 2022-02-11 15:09:09 -07:00
Lee Cannon
efb8b5c2e3 glfw: dont use @errSetCast 2022-02-08 19:58:52 -07:00
Lee Cannon
89921e020e glfw: dont call getError unless we need to 2022-02-08 19:57:20 -07:00
InKryption
05bf1df86b glfw: Use anyopaque instead of opaque {}
Update other two instances of `opaque {}`
2022-01-12 18:58:49 -07:00
InKryption
c84f8510bd glfw: Use anyopaque instead of opaque{}
Using an inline `opaque{}` type forces the use of `@typeInfo` to cast to the specific type of the parameter.
2022-01-12 18:58:49 -07:00
iddev5
2d738248e7 glfw: Update function docs in Monitor and vulkan to match glfw 3.3.6 2021-12-23 13:01:45 -07:00
Stephen Gutekanst
8e76a927a5 glfw: correctly @errorSetCast when returning errors from createWindowSurface
Fixes an issue where `createWindowSurface` would not compile (found when
updating https://github.com/hexops/mach-glfw-vulkan-example to latest.)

Introduced in hexops/mach#115

cc @InKryption

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-12-06 22:16:06 -07:00
InKryption
1b57fb13fb glfw: Denormalize errors (#115)
Closes hexops/mach#96

Co-authored-by: Stephen Gutekanst <stephen@hexops.com>
2021-12-06 21:52:15 -07:00
InKryption
58e2632a4e glfw: Fix pointer cast
The GLFW implementation takes a constant pointer to a `VkAllocationCallbacks` struct; casting it to a mutable pointer equivalent here doesn't break anything, but does prevent passing a valid const pointer, which is often what one should prefer to do.
As well, the `@alignOf` builtin takes the alignment expected of the type directly, so `@alignOf(*T)` returns the alignment of `*T`, not `T`, so that has also been corrected.
2021-11-29 12:52:46 -07:00
InKryption
9ec72fdb2c glfw: Eliminate Error.InvalidValue 2021-11-26 20:50:38 -07:00
InKryption
e363bb0840 glfw: Change error unions into normal returns, in accordance with the new guarantee to never encounter 'GLFW_NOT_INITIALIZED', and update tests 2021-11-22 12:59:11 -07:00
InKryption
946c059f10 glfw: amend and update various TODOs pertaining to force-init changes 2021-11-22 12:59:11 -07:00
InKryption
5c93c0fe22 glfw: assert initialized in proc address getter functions 2021-11-22 12:59:11 -07:00
InKryption
c7558b61eb glfw: Revert error denormalization 2021-11-22 12:59:11 -07:00
InKryption
db6b48e9e4 glfw: force init error type work around 2021-11-22 12:59:11 -07:00
InKryption
ea757b077f glfw: force init in vulkan.zig 2021-11-22 12:59:11 -07:00
Silver
f0dd193695 glfw: remove [*c] pointers from api and return lengthed strings when possible 2021-11-16 07:12:02 -07:00
InKryption
82c5079d1d glfw: Update tests in all other files to reflect changes made to glfw.init 2021-11-10 11:42:24 -07:00
Stephen Gutekanst
b87ef62856 glfw: improve ABI compatability with zig-vulkan library
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-31 01:00:02 -07:00
Stephen Gutekanst
cc4595eb37 glfw: improve panic message for glfw.getInstanceProcAddress
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-29 17:13:21 -07:00
Stephen Gutekanst
457c9394ab glfw: make glfw.getInstanceProcAddress conform to GLFW C ABI
Having `glfw.getInstanceProcAddress` conform to the GLFW C ABI is important as it is often
likely to be passed into libraries which expect exactly that ABI, e.g. zig-vulkan.

Fixes hexops/mach#49

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-29 16:15:42 -07:00
Stephen Gutekanst
37e3c492e8 glfw: add glfw.createWindowSurface
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-18 20:52:34 -07:00
Stephen Gutekanst
e3107a6bd2 glfw: add glfw.getPhysicalDevicePresentationSupport
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-18 20:52:34 -07:00
Stephen Gutekanst
6cfc46077f glfw: add glfw.getRequiredInstanceExtensions
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-18 20:52:34 -07:00
Stephen Gutekanst
3182eaa4f7 glfw: update TODOs
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-16 18:39:57 -07:00
Stephen Gutekanst
83d3eed240 glfw: add glfw.vulkanSupported
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-16 18:39:57 -07:00
Stephen Gutekanst
dd7305bd1e glfw: add glfw.getInstanceProcAddress
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-16 18:39:57 -07:00
Stephen Gutekanst
7ba458d25b glfw: add TODOs for tracking 100% GLFW API coverage
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-16 18:39:57 -07:00