Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ defaults:
run:
shell: bash

env:
# Headless OpenGL EGL: render without an X server / display surface, and force
# the llvmpipe software rasterizer (CI runners have no GPU). Harmless for the
# other backends.
EGL_PLATFORM: surfaceless
LIBGL_ALWAYS_SOFTWARE: "1"

jobs:
lint:
name: Lint
Expand Down Expand Up @@ -94,6 +101,10 @@ jobs:
backend: vulkan
precompiled: 0
amalgam: 0
- runs-on: ubuntu-latest
backend: glx
precompiled: 0
amalgam: 0
- runs-on: ubuntu-latest
backend: vulkan
precompiled: 1 # also cover the prebuilt amalgam path
Expand Down Expand Up @@ -139,11 +150,11 @@ jobs:
echo "VK_ICD_FILENAMES=$(brew --prefix molten-vk)/etc/vulkan/icd.d/MoltenVK_icd.json" >> $GITHUB_ENV
echo "DYLD_LIBRARY_PATH=$(brew --prefix vulkan-loader)/lib" >> $GITHUB_ENV
- run: rustup update stable && rustup default stable
- name: Run CI tests (Linux OpenGL via Xvfb)
if: startsWith(matrix.runs-on, 'ubuntu') && matrix.backend == 'opengl'
- name: Run CI tests (Linux OpenGL GLX via Xvfb)
if: startsWith(matrix.runs-on, 'ubuntu') && matrix.backend == 'glx'
run: xvfb-run -a --server-args="-screen 0 1280x1024x24" just ci-test ${{ matrix.backend }}
- name: Run CI tests
if: ${{ !(startsWith(matrix.runs-on, 'ubuntu') && matrix.backend == 'opengl') }}
if: ${{ !(startsWith(matrix.runs-on, 'ubuntu') && matrix.backend == 'glx') }}
run: just ci-test ${{ matrix.backend }}

build-msrv:
Expand Down
6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,15 @@ metal = []
opengl = []
vulkan = []
wgpu = ["dep:webgpu-shim", "dep:wgpu"]

# Use a GLX context for OpenGL (Linux)
glx = ["opengl"]

# Enables parsing style-spec layer JSON via `AnyLayer::from_json_str`/`from_json_value`.
json = ["dep:serde_json"]
# Interoperate with the `geojson` crate
geojson = ["dep:geojson"]
# Logging via the `log` crate.
log = ["dep:log"]

[dependencies]
Expand Down
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@ Instructions for this are below.
This crate supports multiple rendering backends:

- `vulkan` (default on Linux/Windows): `cargo build --features vulkan`
- `opengl` (cross-platform): `cargo build --features opengl`
- `metal` (default on macOS/iOS): `cargo build --features metal`
- `opengl` (Linux/Windows): `cargo build --features opengl`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since our dependencys no longer install anything for this, should it remain a feature?
We should remove dead features..

@ciscorn ciscorn Jun 7, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks dead but it's needed as the platform selector.

I actually thought the same and considered opengl-egl / opengl-glx features, but stopped because we still need to select Windows + OpenGL.


If no feature is specified, the crate will automatically select the platform-appropriate default backend.
On Linux, OpenGL uses EGL by default for headless rendering. Use the `glx` feature only when you explicitly need rendering through GLX/X11.

We also support the following other features:
We also support the following other features (all enabled by default):

- `log` logging via the [`log` library](https://lib.rs/log)
- `json`: load styles and layers from JSON via [`serde_json`](https://lib.rs/serde_json)
- `geojson`: interoperate with the [`geojson`](https://lib.rs/geojson) crate
- `log`: logging via the [`log`](https://lib.rs/log) crate

At its core, we work as follows:

Expand Down Expand Up @@ -75,7 +77,7 @@ The following platform and rendering-API combinations are supported and tested i
### Dependencies

This command will install the required dependencies on Linux or macOS for the `vulkan` backend.
You may also use it with `opengl` parameter on Linux.
You may also use it with the `opengl` or `glx` parameter on Linux.
It is OK to run this command multiple times for each backend.

```shell
Expand Down
Loading
Loading