test: enable WebGPU rendering in headless Chromium - #81
Conversation
|
Also that does not warrant a release... rename your commit to |
d56b8e6 to
b32ed78
Compare
- Replace PIL/pixelmatch screenshot comparison in conftest with vtkmodules.test.Testing.compareImageWithSavedImage. Diff and valid images are written to the result directory via VTK_TEMP_DIR. - Keep only the CI-generated baselines: promote *_github.png to the primary baseline name and *_github_gpu.png to the VTK alternate baseline convention (name_1.png), which RegressionTest tries automatically. Drop the locally generated variants. - Also launch Chromium with platform-specific ANGLE flags for webgpu configs so a real WebGPU adapter is available.
b32ed78 to
60b7922
Compare
Use uv run instead of sourcing the venv activate script, which lives under Scripts/ instead of bin/ on Windows.
|
linux, macos pass with vtkTesting. windows fails because no osmesa is installed. let's install it. |
|
i found a f3d action that we can use https://github.com/f3d-app/install-mesa-windows-action/ |
GitHub windows runners have no GPU-accelerated OpenGL, so vtkWin32OpenGLRenderWindow fails to get a pixel format and VTK falls back to vtkOSOpenGLRenderWindow, which crashes when LoadLibrary cannot find osmesa.dll. Download mesa-dist-win 25.0.7 (last release shipping osmesa.dll) and put its x64 directory on PATH.
|
on windows, we will need to tweak flags to chromium so that it can use webgpu. i will investigate this some time later. |
|
It looks like the mac testing has some screenshot timing issue for volume rendering. I'm wondering what we can do to make those test more robust. |
vtkTesting derives the .diff/.valid output names by splitting the baseline path on "/" only, so a Windows backslash path made it append the whole absolute path to the temp results dir and fail to write the difference image. Pass the baseline as a posix-style path.
On Windows, Dawn's D3D12 backend fails to create a device because the bundled Chromium ships a dxil.dll it cannot load in the sandboxed GPU process (EnsureDXCLibraries -> "DynamicLib.Open: dxil.dll Windows Error: 87"). The adapter is obtained fine; only requestDevice fails. Disabling the use_dxc Dawn feature falls back to the FXC shader compiler, which needs no external DLL. macOS (metal) and Linux (vulkan) do not use DXC, so the flag is applied only on win32.
Pin the cone view to a fixed ref ("cone_view") so the test can address it
regardless of the process-global _vtklocalview_N counter, and assert the
active render window class (webgl vs webgpu) against it.
Run that assertion after every screenshot: getVtkObject() performs a
client-side serialize that currently corrupts the WebGPU render window
permanently (a VTK bug; harmless on webgl), which would blank all later
frames if done mid-sequence. The className comes from static server state,
so ordering it last does not weaken the check.
Fixed asyncio.sleep(0.1) waits were both flaky and masking a real bug: on (re)mount the canvas starts at its 300x150 HTML default and only reaches the container size after the 100ms debounced ResizeObserver calls setSizeAsync, which does not bump the `updated` counter. A short sleep could capture the wrong-sized frame. WebGPU also presents the updated frame a frame later than the `updated` event, so an immediate capture grabs a blank pre-present buffer. Add Utils.wait_for_render, which polls on requestAnimationFrame until every canvas drawing buffer matches its layout size (the same floor(size * dpr + 0.5) formula the component uses) and stays stable for two frames, giving the compositor time to present. Use it in the cone, volume, and multi-view tests in place of every sleep.
this PR adds tests pass locally in windows, we need to still figure out appropriate flags for GHA windows runners lacking a GPU |
|
Ah, pyproject.toml is using vtk 9.6.2 which does not support webgpu correctly. 9.7 wheels not out yet, so we need to use developer release. |
VTK does not support volume rendering on the WebGPU backend
Add vtk 9.7.20260712.dev0 to the dev group, tests need it to pass. That dev wheel is published for Windows only as cp313/cp314 (no cp310 win_amd64), so bump the pytest matrix to Python 3.13 and pin uv to the matrix interpreter via UV_PYTHON, which the workflow previously left to uv's default.
f87f5e0 to
8ab9f2c
Compare
|
we cannot run webgpu tests for linux/windows because ubunut-latest and windows-latest lack real GPUs. This PR atleast gets them to run locally. |
No description provided.