feat: add take-screenshots flake app for headless capture
Expose a `nix run .#take-screenshots` app that runs a binary inside an Xvfb display with lavapipe software Vulkan and captures PNG snapshots via ImageMagick. Useful for smoke-testing the Bevy renderer in environments without a GPU (CI, sandboxed shells, agents). Usage: nix run .#take-screenshots -- EXE NUM DELAY_START PAUSE_INBETWEEN [OUTPUT_DIR] The script picks the first free :N >= 99, locates the lavapipe ICD via pkgs.mesa with a fallback to /run/opengl-driver (NixOS), reuses the dev shell's runtimeLibs in LD_LIBRARY_PATH, and traps EXIT for cleanup. README updated with usage and a worked example.
This commit is contained in:
parent
68e3051f77
commit
c6dcf9d728
2 changed files with 122 additions and 0 deletions
25
README.md
25
README.md
|
|
@ -34,3 +34,28 @@ nix develop --command bash -c "cargo build"
|
|||
2. Clone the repository.
|
||||
3. Navigate to the project directory.
|
||||
4. Run the game using the command: `nix develop --command bash -c "cargo run"`
|
||||
|
||||
## Headless Screenshots
|
||||
|
||||
The flake exposes a `take-screenshots` app that launches a binary inside an
|
||||
Xvfb display backed by lavapipe (software Vulkan), waits, and captures one or
|
||||
more PNG screenshots. Useful for smoke-testing rendering without a real GPU.
|
||||
|
||||
```
|
||||
nix run .#take-screenshots -- EXE NUM DELAY_START PAUSE_INBETWEEN [OUTPUT_DIR]
|
||||
```
|
||||
|
||||
* `EXE` — path to the executable to launch
|
||||
* `NUM` — number of screenshots to take
|
||||
* `DELAY_START` — seconds to wait after launch before the first shot
|
||||
* `PAUSE_INBETWEEN` — seconds between consecutive shots
|
||||
* `OUTPUT_DIR` — where to write `shot-NNN.png` files (default: current directory)
|
||||
|
||||
Example, capturing three frames of the game one second apart after a six-second
|
||||
warm-up (Bevy + software Vulkan needs roughly that long to render its first
|
||||
frame):
|
||||
|
||||
```
|
||||
cargo build
|
||||
nix run .#take-screenshots -- ./target/debug/bglga 3 6 1 ./shots
|
||||
```
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue