Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
78ca539
Build with plain CMake against a pinned, prebuilt Dawn
bv7dev Oct 5, 2026
5c13188
Keep native windows alive until the GPU is done with them
bv7dev Oct 5, 2026
a3b8ffa
Add LAB_EXIT_AFTER_FRAMES to run samples unattended
bv7dev Oct 5, 2026
3fc8fa1
Fix compiler warnings in the samples
bv7dev Oct 5, 2026
29c85aa
Make the editor setup work on Linux as well as Windows
bv7dev Oct 5, 2026
d8bb0d6
Add CI: build on Linux (GCC, Clang) and Windows (MSVC)
bv7dev Oct 5, 2026
78c7c2d
Update the build instructions in the README
bv7dev Oct 5, 2026
904c30a
Fix uniform buffer binding index and indexed draw arguments
bv7dev Oct 5, 2026
a4b8744
Make Buffer own its label and require trivially copyable elements
bv7dev Oct 5, 2026
2ca5725
Report a shader file that cannot be opened as an error
bv7dev Oct 5, 2026
d36d949
Stop injecting std::chrono_literals into every user of <lab>
bv7dev Oct 5, 2026
d6c5fdd
Fall back to a software adapter when there is no GPU
bv7dev Oct 5, 2026
331ac43
Fix samples that could not exit or destroyed objects twice
bv7dev Oct 5, 2026
b12002d
Add tests: unit tests, offscreen render tests, sample smoke tests
bv7dev Oct 5, 2026
7b32464
Fetch Dawn's sources as an archive and time out stalled downloads
bv7dev Oct 5, 2026
28b4920
Bump version to 0.3.0
bv7dev Oct 5, 2026
304e5f5
Separate the public headers from the implementation
bv7dev Oct 5, 2026
c3bb1f5
Redesign the API around immutable pipelines and composable passes
bv7dev Oct 5, 2026
b928e0a
Document the new API: README and migration notes from 0.2
bv7dev Oct 5, 2026
cf7ffb9
Add depth buffers and samplers
bv7dev Oct 5, 2026
d47797b
Add compute pipelines
bv7dev Oct 5, 2026
22321bc
Add samples for 3D, compute and offscreen rendering
bv7dev Oct 5, 2026
1e17e5f
Add changelog, contributing notes and screenshots, bump version to 0.4.0
bv7dev Oct 5, 2026
b263fda
Keep the depth buffer in step with a resized surface
bv7dev Oct 5, 2026
05b4a65
Write the unaligned tail of a buffer without a temporary copy
bv7dev Oct 5, 2026
994f508
Build the samples for the web and publish them as a gallery
bv7dev Oct 6, 2026
c6f59f9
Link the live samples from the README
bv7dev Oct 6, 2026
bd6df68
Put the DLLs Dawn needs next to the executables on Windows
bv7dev Oct 6, 2026
1a9e2d1
Mention the Windows run time DLLs in the changelog
bv7dev Oct 6, 2026
395e3e7
Close the file before deleting it in the save_png test
bv7dev Oct 6, 2026
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
3 changes: 3 additions & 0 deletions .clangd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# clangd reads the compile commands of the "dev" preset (run `cmake --preset dev` once)
CompileFlags:
CompilationDatabase: build/dev
73 changes: 73 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: CI

on:
push:
branches: [main, cleanroom]
pull_request:

jobs:
# the same clang-format version as in CONTRIBUTING.md, other versions format slightly differently
format:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Check formatting
run: |
git ls-files 'include/*' 'src/*.cpp' 'src/*.h' 'src/platform/*' 'samples/*.cpp' 'tests/*.cpp' 'tests/*.h' \
| xargs pipx run clang-format==23.1.1 --dry-run --Werror

build:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- { name: ubuntu-gcc, os: ubuntu-24.04, cc: gcc-14, cxx: g++-14 }
- { name: ubuntu-clang, os: ubuntu-24.04, cc: clang-18, cxx: clang++-18 }
- { name: windows-msvc, os: windows-latest }

steps:
- uses: actions/checkout@v4

# GLFW is built from source on the runner and needs its build dependencies.
# The runners have no GPU: mesa-vulkan-drivers provides lavapipe, a software Vulkan driver.
- name: Install dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y ninja-build libwayland-dev libxkbcommon-dev xorg-dev mesa-vulkan-drivers

- name: Select compiler (Linux)
if: runner.os == 'Linux'
run: |
echo "CC=${{ matrix.cc }}" >> "$GITHUB_ENV"
echo "CXX=${{ matrix.cxx }}" >> "$GITHUB_ENV"

# puts cl.exe on the PATH so that the Ninja generator of the presets finds MSVC
- name: Set up MSVC (Windows)
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1

- name: Configure
run: cmake --preset release

- name: Build
run: cmake --build --preset release

# tests that open a window are skipped, everything else renders offscreen
- name: Test
run: ctest --preset release -LE display

# the samples as web pages, built like the gallery on GitHub Pages
web:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: mymindstorm/setup-emsdk@v14
with:
version: 6.0.10
- name: Configure
run: emcmake cmake --preset web
- name: Build
run: cmake --build --preset web
43 changes: 43 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Builds the samples for the web and publishes them as a gallery on GitHub Pages.
# Needs Pages enabled for the repository with "GitHub Actions" as the source.
name: Pages

on:
push:
branches: [main]
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: pages
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: mymindstorm/setup-emsdk@v14
with:
version: 6.0.10
- name: Configure
run: emcmake cmake --preset web
- name: Build
run: cmake --build --preset web
- uses: actions/upload-pages-artifact@v3
with:
path: build/web/site

deploy:
needs: build
runs-on: ubuntu-24.04
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v4
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
build*/
**/__pycache__/
.cache/
__pycache__/
CMakeUserPresets.json
18 changes: 0 additions & 18 deletions .vscode/c_cpp_properties.json

This file was deleted.

11 changes: 11 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@
"configureAll": false,
"clean": false,
},
{
// launch cmake target based on exe source file active in editor
"name": "(linux) launch",
"program": "${command:cmake.launchTargetDirectory}/${fileBasenameNoExtension}",
"cwd": "${workspaceFolder}/samples",
"request": "launch",
"type": "cppdbg",
"MIMode": "gdb",
"stopAtEntry": false,
"args": [],
},
{
// launch cmake target based on exe source file active in editor
"name": "(win) launch",
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"cmake.generator": "Ninja",
"cmake.useCMakePresets": "always",
"cmake.configureOnOpen": false,
"files.associations": {
"lab": "cpp"
Expand Down
89 changes: 89 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Changelog

## 0.5.0

### Added
- The samples run in the browser: `emcmake cmake --preset web` builds a page per sample
and a gallery, which a GitHub Pages workflow publishes. The lab uses Dawn's Emscripten
port of the same Dawn release as the native build, and the contrib.glfw3 port for
windows. `while (lab::tick())` stays as it is: on the web, `tick()` waits for the
browser's next animation frame.
- `LAB_WINDOW_SYSTEM=x11|wayland` on Linux.

### Fixed
- The depth buffer of a surface lagged a frame behind after the window was resized.
- On Windows, the shader compiler DLLs that Dawn loads from the directory of the executable
are downloaded and copied next to every executable (`lab_copy_runtime_dlls()` does it for
executables of other projects).

## 0.4.0

The API was redesigned. [docs/migrating-from-0.2.md](docs/migrating-from-0.2.md) explains
what changed and how to carry code over.

### Added
- `lab::RenderPass` and `lab::Frame`: any number of draw calls per pass and passes per frame,
onto a window or into a texture.
- `lab::Draw`: the buffers, bind groups and counts of a draw call, reusable every frame.
- `lab::ComputePipeline` and `lab::ComputePass`.
- Depth buffers (`SurfaceOptions::depth`, `PassOptions::depth`) and samplers (`lab::sampler`).
- `Buffer::read()`, `Buffer::read_async()`, `Texture::read()`, `Texture::save_png()`.
- Mouse input, and polling for keyboard and mouse state next to the callbacks.
- `lab::Error`: mistakes are reported as exceptions that name the object, where they are made.
- `lab::log` with levels and a replaceable sink, `LAB_LOG`.
- `lab::find_file()`, `lab::delta_seconds()`.
- `LAB_CAPTURE_DIR`: every window saves one frame as a PNG.
- Samples `10_house` (3D model, depth, camera), `11_boids` (compute) and `12_offscreen`.
- Tests that render into textures and compare pixels.

### Changed
- `lab::Webgpu` is now `lab::Gpu`, and it is the first argument wherever one is needed.
- `lab::Pipeline` is immutable and built for one render target. Vertex layouts are described
with `lab::vertex<T>()` and `lab::instance<T>()`, bind groups are made by `pipeline.bind_group()`.
- Every object gives access to the WebGPU object it wraps through `handle()`.
- Objects can be moved, and destroyed in any order.
- A surface follows the size of its window on its own and prefers an 8-bit format.
- Shaders are compiled when they are created and found from the working directory or from next
to the executable.
- The samples are a numbered sequence, one concept each.
- Public headers live in `include/`, flat: `<lab>`, or single ones such as `<lab_buffer.h>`.

### Removed
- `Pipeline::finalize()`, `add_vertex_buffer()`, `add_uniform_buffer()` and the other `add_*` functions,
`Pipeline::config`, `render_config` and `render_func`.
- `MappedVRAM` and the thread based `to_device()` / `from_device()`.
- `lab::init_lab()`, `lab::state`, `Webgpu::capabilities`.

## 0.3.0

wgpu-lab builds again, and for the first time on Linux.

### Added
- Linux support, on Wayland and X11.
- CMake presets, tests (`ctest`), CI on Linux and Windows.
- `LAB_EXIT_AFTER_FRAMES` to run a program unattended.

### Changed
- Dawn is pinned to a release from October 2026 and downloaded as a prebuilt library by default
(`-DLAB_DAWN=prebuilt|source|system`). The Python scripts are gone, as is the long first build.
- C++23 and CMake 3.28 are required.
- `<lab>` no longer injects `using namespace std::chrono_literals`.
- A missing shader file is an error.
- Without a GPU, a software adapter is used.

### Fixed
- Crash at exit on Wayland: the display connection was closed while the GPU still used it.
- `Pipeline::add_uniform_buffer()` ignored its binding index.
- Wrong arguments for indexed drawing.
- Vertex format sizes were looked up with outdated enum values.
- The surface was sized in window coordinates instead of pixels (wrong on scaled displays).
- `Buffer` kept a dangling label pointer and accepted element types that are not plain data.
- `sample_uniform_buffer` never exited, `test_windows` destroyed objects twice.

## 0.2.0

Dependencies are fetched automatically when CMake configures the project.

## 0.1.0-alpha

First public release.
Loading
Loading