docs: document that DISPLAY= ./triangle can be used to force the use of Wayland at runtime #376

Closed
opened 2022-06-28 18:15:56 +00:00 by emidoots · 5 comments
emidoots commented 2022-06-28 18:15:56 +00:00 (Migrated from github.com)

Quoting myself:

BTW, for tests this doesn't help - but in a real application (like Mach apps) GLFW now lets us request a specific platform via glfw.Init hints. glfw.Init(.{.platform = .wayland}) should force Wayland usage (default is .any) - we should add a standard environment variable to select this in any Mach application, similar to how we have GPU_BACKEND=opengl as an option.

We should add a standard env var, maybe PLATFORM=wayland, PLATFORM=x11 to allow choosing.

Related to https://github.com/hexops/mach/pull/374

Quoting myself: > BTW, for tests this doesn't help - but in a real application (like Mach apps) GLFW now lets us request a specific platform via `glfw.Init` hints. `glfw.Init(.{.platform = .wayland})` should force Wayland usage (default is `.any`) - we should add a standard environment variable to select this in any Mach application, similar to how we have `GPU_BACKEND=opengl` as an option. We should add a standard env var, maybe `PLATFORM=wayland`, `PLATFORM=x11` to allow choosing. Related to https://github.com/hexops/mach/pull/374
ifreund commented 2022-06-28 22:25:40 +00:00 (Migrated from github.com)

IMO mach should namespace its environment variables with a MACH_ prefix to avoid conflicts with other programs. It wouldn’t surprise me if some other software also reads $PLATFORM, it’s pretty generic.

IMO mach should namespace its environment variables with a `MACH_` prefix to avoid conflicts with other programs. It wouldn’t surprise me if some other software also reads `$PLATFORM`, it’s pretty generic.
PiergiorgioZagaria commented 2022-06-29 18:36:22 +00:00 (Migrated from github.com)

Shouldn't this also be usable if you just want to use glfw without mach? I think PLATFORM or GLFW_PLATFORM should be the env var

Shouldn't this also be usable if you just want to use glfw without mach? I think `PLATFORM` or `GLFW_PLATFORM` should be the env var
emidoots commented 2022-06-29 18:57:17 +00:00 (Migrated from github.com)

I agree MACH_PLATFORM should be the env var name, and GPU_BACKEND renamed to MACH_GPU_BACKEND.

@PiergiorgioZagaria If you use GLFW, you would pass the option to GLFW via glfw.Init(.{.platform = .wayland}) yourself. If you like, you can use an environment variable of your own. But this code will not live in the GLFW package, it would be in the Mach app abstraction.

I agree `MACH_PLATFORM` should be the env var name, and `GPU_BACKEND` renamed to `MACH_GPU_BACKEND`. @PiergiorgioZagaria If you use GLFW, you would pass the option to GLFW via `glfw.Init(.{.platform = .wayland})` yourself. If you like, you can use an environment variable of your own. But this code will not live in the GLFW package, it would be in the Mach app abstraction.
PiergiorgioZagaria commented 2022-06-29 19:13:43 +00:00 (Migrated from github.com)

Ok, then I will revert the last commit I pushed to the PR

Ok, then I will revert the last commit I pushed to the PR
emidoots commented 2023-07-31 01:56:51 +00:00 (Migrated from github.com)
Fixed in https://github.com/hexops/machengine.org/commit/63f9bbeb1e07915e1057b476c621156f182207ed
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
hexops/mach#376
No description provided.