Commit graph

621 commits

Author SHA1 Message Date
Stephen Gutekanst
d6bf154e4c glfw: update system_sdk notes
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-04 16:35:43 -07:00
Stephen Gutekanst
9ff7cd0fdf glfw: system_sdk: add Windows system SDK with updated DirectX headers
This effectively provides all you need to develop & cross compile DirectX 11/12
applications with `mach/glfw` (or just Zig in general, by copying `system_sdk.zig`
into your own project.)

Helps hexops/mach#86
Helps hexops/mach#59

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-04 16:26:58 -07:00
Stephen Gutekanst
d8079d6245 glfw: use lowercase shell32 for Linux
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-04 16:10:51 -07:00
Stephen Gutekanst
d0f625628f glfw: fix x86_64-windows-msvc compilation support
This fixes compilation for msvc ABI. This currently only works under Windows,
I believe because Zig requires the Windows SDK to be present for msvc compilation
/ does not allow cross compilation with MSVC. Still, this is nice to have.

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-04 15:59:36 -07:00
Stephen Gutekanst
60a4e7d0f9 glfw: remove alignment from packed structs / fix compilation with latest Zig
Not sure why we had these here, but alignment on a packed struct seems somewhat
nonsensical (after all, it's fields are packed as closely together as possible
so what would alignment refer to?) removing seems fine and fixes compilation with
latest Zig:

```
/Users/slimsag/Desktop/hexops/mach/gpu-dawn/libs/mach-glfw/src/hat.zig:8:20: error: unable to override alignment of packed struct fields
    up: bool align(@alignOf(u8)) = false,
                   ^
/Users/slimsag/Desktop/hexops/mach/gpu-dawn/libs/mach-glfw/src/mod.zig:10:23: error: unable to override alignment of packed struct fields
    shift: bool align(@alignOf(c_int)) = false,
```                      ^

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-04 15:48:40 -07:00
Stephen Gutekanst
3d6bc6ccd7 glfw: correct getCocoaWindow return type
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-02-26 23:34:17 -07:00
Stephen Gutekanst
d116d8c6a6 glfw: expose Native BackendOptions
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-02-26 23:34:17 -07:00
Stephen Gutekanst
e815084b05 glfw: CI: M1: skip sudo when cleaning up git submodules
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-02-12 00:37:45 -07:00
Stephen Gutekanst
055b48a37c glfw: CI: cleanup git submodules in M1 runner
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-02-11 22:51:35 -07:00
Stephen Gutekanst
d1a06812cb glfw: CI: cleanup git submodules in M1 runner
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-02-11 22:05:09 -07:00
Stephen Gutekanst
48c77f8594 glfw: CI: upgrade to latest Zig nightly
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-02-11 17:24:32 -07:00
Lee Cannon
de6f0e6c40 glfw: use comptime magic to remove InternalUserPointer and associated overhead 2022-02-11 15:13:58 -07:00
Lee Cannon
75c8baddc9 glfw: glfwGetMonitors can return null to signify no monitors 2022-02-11 15:09:09 -07:00
Lee Cannon
28e49c70d3 glfw: document why unreachable is valid 2022-02-11 15:09:09 -07:00
Stephen Gutekanst
507dbefd56 Fix minor regressions introduced in 3e79a12
3e79a12f3d686b67b7962374c7fe5c8f98ff714c

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-02-08 20:21:56 -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
Lee Cannon
c94f5f5ea2 glfw: improve setErrorCallback 2022-02-08 19:54:00 -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
InKryption
7cb001e526 glfw: Tidy up UserPointer access
This change both restricts and clarifies the mutability/nullability of the pointers, and replaces the explicitly-typed pointer usage in setUserPointer with ?*anyopaque, since it now, as of being renamed from c_void, more simply communicates the intent of taking any pointer type.
2022-01-02 18:17:27 -07:00
Ali Chraghi
cdb1d65e61 glfw: repatch undefined behavior in X11 keypress handling (#150)
repatch undefined behavior in GLFW which did not land yet and was accidentally removed when updating GLFW in #136 

See glfw/glfw#1989

Fixes hexops/mach#149
2021-12-28 03:57:08 -07:00
iddev5
5dd918f787 glfw: improve documentation for native.zig
- Added hidden error returns
- Improved return types
- Updated docs to glfw 3.3.6
2021-12-28 03:52:22 -07:00
Ali Chraghi
8f426c56c1 glfw: expose glfwSetErrorCallback for retrieving optional error descriptions 2021-12-25 11:32:12 -07:00
Ali Chraghi
0028045cda add wayland cross-compilation support (#140)
* add wayland-headers include path
* add wayland protocols header to wayland target includes
* move `xkb_unicode.c` to `sources_linux.c`
* glfw: document where wayland generated sources come from
* glfw: update sdk-linux-x86_64 to include Wayland protocol sources

See https://github.com/hexops/sdk-linux-x86_64/pull/2

Co-authored-by: Stephen Gutekanst <stephen@hexops.com>
2021-12-24 01:06:51 -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
iddev5
2d01fce1bc glfw: native.zig: Fix missing casts, incorrect return types and error
handling
2021-12-23 00:57:29 -07:00
iddev5
397a3831ad glfw: Add ziggified API of glfw3native.h 2021-12-23 00:57:29 -07:00
Ali Chraghi
c556044646 glfw: Update glfw to 3.3.6 (#136)
* glfw: update glfw to 3.3.6
* glfw: make Vulkan-Headers clone faster
2021-12-22 11:15:23 -07:00
Ali Chraghi
2d69b1ab22 glfw: make update-upstream.sh clone faster (#132) 2021-12-21 18:25:51 -07:00
InKryption
92b72a329e glfw: update CI to latest Zig master 2021-12-19 16:15:32 -07:00
InKryption
7abe88b224 Run zig fmt
>> Zig master changed `c_void` to `anyopaque`, and zig fmt helps to change code as appropriate
2021-12-19 16:15:32 -07:00
Stephen Gutekanst
bdf74cf422 glfw: mention Matrix chat room
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-12-14 18:16:45 -08:00
Ali Chraghi
7baaa264e4 glfw: replace isize, usize with i32, u32 where appropriate (#126)
Fixes hexops/mach#114
2021-12-14 09:20:14 -07:00
Stephen Gutekanst
a0fc183a20 glfw: reduce compilation units to bring iteration time down to ~90ms
This consistently shaves off about 40ms (~130ms -> ~90ms, 30% reduction) from build times when iterating.

On Windows, I suspect the result will be much greater due to slow filesystem perf there and the fact
that this reduces the # of files read.

This was originally brought to my attention as a possibility by @meshula in hexops/dawn#2, the way this
works is by reducing compilation units so that C headers only need to be read/parsed/interpreted once
rather than once per individual C source file we are compiling.

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-12-10 03:52:41 -08:00
Stephen Gutekanst
59ba9ec476 glfw: improve consecutive build times by 4-12x
This substantially reduces consecutive build times when using mach/glfw.

`system_sdk.getSdkPath` is frequently invoked as part of the build process, and previously it was
doing some fairly involved work (ensuring the native SDK is at the right revision, needless
`git fetch` in native SDKs to check for updates, etc.)

We now do far less work in `getSdkPath`, and additionally cache the result in-memory. This improves
build times substantially, but especially so with consecutive (non-cold-cache) build times:

* For `mach/glfw`: ~2s before, ~160ms after
* For `mach/gpu`: , ~16s before, ~3.6s after

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-12-10 03:40:00 -08:00
InKryption
99c7bfd63d glfw: rename capture appropriately 2021-12-09 19:42:28 -08:00
InKryption
5bd4631939 glfw: replace `glfw.dont_care as sentinel value
Apply same pattern to other hints which can take on the value of `glfw.dont_care`.
2021-12-09 19:42:28 -08:00
InKryption
7c96b182fb glfw: replace glfw.dont_care as sentinel value
Also change logic inside `Hints.set` to account for this special case
2021-12-09 19:42:28 -08:00
InKryption
5771591626 glfw: remove accidental re-addition of TODO 2021-12-09 19:42:28 -08:00
InKryption
6e445e6b1d glfw: add doc-comment
Add comment for new `glfw.Window.SizeOptional` struct

Co-authored-by: Stephen Gutekanst <stephen.gutekanst@gmail.com>
2021-12-09 19:42:28 -08:00
InKryption
7503214a08 glfw: replace usage of glfw.dont_care as sentinel value for parameters in some glfw.Window functions 2021-12-09 19:42:28 -08:00
InKryption
89b3f7823c glfw: remove TODOs 2021-12-08 19:30:01 -08: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
Stephen Gutekanst
56e2560dc6 glfw: update CI to latest Zig master
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-12-06 20:03:38 -08:00
BratishkaErik
1667cbb8ff glfw: update system_sdk.zig to latest Zig master 2021-12-06 20:03:38 -08:00
Stephen Gutekanst
4d75871f40 glfw: make getProcAddress ABI compatible with C implementation
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-12-05 04:22:21 +00:00
Stephen Gutekanst
ef6de0e00f glfw: update Linux SDK (enforce static linkage of libvulkan and libX11-xcb)
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-12-01 04:04:19 +00:00
Stephen Gutekanst
552a6b75ef glfw: update Linux system SDK
Helps hexops/mach#87

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-11-30 16:56:15 -07:00