Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run Linux & Windows screenshot tests via lavapipe software rasterizer #8620

Open
wants to merge 43 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
0525ccb
enable screenshot tests on all platforms
Wumpf Jan 8, 2025
38de20e
wgpu setup in test context is now mandatory
Wumpf Jan 8, 2025
4873ebd
install llvmpipe on Linux & Windows for testing
Wumpf Jan 8, 2025
2974284
prefer software rasterizers, only use Vulkan & Metal for testing
Wumpf Jan 8, 2025
95d7619
fix temp ci guard being in wrong place
Wumpf Jan 8, 2025
dd52225
fix clippy warning
Wumpf Jan 8, 2025
bbbe8ae
move pixi setup to the right place
Wumpf Jan 8, 2025
a1d0835
temp comment out rs-checks
Wumpf Jan 8, 2025
78ff583
allow non-compliant adapters
Wumpf Jan 8, 2025
bdd32bb
try with installing vulkan sdk, don't install gallium etc.
Wumpf Jan 8, 2025
7e5b353
enable trace logging
Wumpf Jan 8, 2025
cc06340
more diagnostics by default on ci
Wumpf Jan 9, 2025
594f050
debug vk_driver_files
Wumpf Jan 9, 2025
19558ec
re-enable run via pixi
Wumpf Jan 9, 2025
73c067e
disable all ci but rust for temporarily
Wumpf Jan 9, 2025
798e8c9
more diagnostic hacks
Wumpf Jan 9, 2025
8363b12
install vulkan sdk the wgpu way
Wumpf Jan 9, 2025
cd2d205
more random log things
Wumpf Jan 9, 2025
c3f5f83
run vulkan info on setup_software_rasterizer
Wumpf Jan 9, 2025
401fff6
enable lfs, even more limited tests
Wumpf Jan 9, 2025
55514ef
set env vars for setup script process
Wumpf Jan 9, 2025
7440453
focus linux test as well
Wumpf Jan 9, 2025
9fb8f82
make sure env vars in setup_software_rasterizer are set
Wumpf Jan 9, 2025
e9b653b
try direct vulkan sdk install again
Wumpf Jan 9, 2025
817a4d8
improved vulkaninfo
Wumpf Jan 9, 2025
33771e1
newer vulkan sdk version
Wumpf Jan 9, 2025
5059b7c
poke poke
Wumpf Jan 9, 2025
7ae5270
add env info to `run`
Wumpf Jan 9, 2025
4e80dcd
print icd file on windows
Wumpf Jan 9, 2025
4ab5190
poke poke
Wumpf Jan 9, 2025
863f5ac
don't do summary on vulkaninfo, try vulkaninfoSDK
Wumpf Jan 9, 2025
3227d35
explicit icd file passing, enable loader debug
Wumpf Jan 9, 2025
12912f8
copy icd file to one of the presumed search paths
Wumpf Jan 9, 2025
3f52f18
more logging, add vulkan runtime to PATH
Wumpf Jan 9, 2025
9480efd
start cleaning up a little bit
Wumpf Jan 9, 2025
0672127
fix picking wrong folder for vulkan runtime
Wumpf Jan 9, 2025
e02bf87
more cleanup of things that work already
Wumpf Jan 9, 2025
62da1b0
write windows registry key for finding icd
Wumpf Jan 9, 2025
0f0aa44
import winreg only on windows
Wumpf Jan 9, 2025
9f705ea
undo all sort of hacks, getting this ready for shiping
Wumpf Jan 9, 2025
5eb2294
fix missing download test assets
Wumpf Jan 9, 2025
9d84f7e
python fmt
Wumpf Jan 9, 2025
25206ca
Add sanity check that setup_kittest_for_rendering is called when needed
Wumpf Jan 9, 2025
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
16 changes: 16 additions & 0 deletions .github/workflows/contrib_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ env:
# these incremental artifacts when running on CI.
CARGO_INCREMENTAL: "0"

# Sourced from https://vulkan.lunarg.com/sdk/home#linux
VULKAN_SDK_VERSION: "1.3.296.0"

defaults:
run:
shell: bash
Expand Down Expand Up @@ -97,6 +100,19 @@ jobs:
with:
pixi-version: v0.39.0

# Install the Vulkan SDK, so we can use the software rasterizer.
# TODO(andreas): It would be nice if `setup_software_rasterizer.py` could do that for us as well (note though that this action here is very fast when cached!)
- name: Install Vulkan SDK
uses: jakoch/install-vulkan-sdk-action@v1.0.5
with:
vulkan_version: ${{ env.VULKAN_SDK_VERSION }}
install_runtime: true
cache: false
stripdown: true

- name: Setup software rasterizer
run: pixi run python ./scripts/ci/setup_software_rasterizer.py

- name: Rust checks & tests
run: pixi run rs-check --skip individual_crates docs_slow

Expand Down
65 changes: 56 additions & 9 deletions .github/workflows/reusable_checks_rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ concurrency:
cancel-in-progress: true

env:
PYTHON_VERSION: "3.8"
# web_sys_unstable_apis is required to enable the web_sys clipboard API which egui_web uses
# https://rustwasm.github.io/wasm-bindgen/api/web_sys/struct.Clipboard.html
# https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html
Expand All @@ -34,6 +33,12 @@ env:
# these incremental artifacts when running on CI.
CARGO_INCREMENTAL: "0"

# Improve diagnostics for crashes.
RUST_BACKTRACE: full

# Sourced from https://vulkan.lunarg.com/sdk/home#linux
VULKAN_SDK_VERSION: "1.3.296.0"

defaults:
run:
shell: bash
Expand All @@ -52,6 +57,7 @@ jobs:
- uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || '' }}
lfs: true

- name: Set up Rust
uses: ./.github/actions/setup-rust
Expand All @@ -65,11 +71,32 @@ jobs:
with:
pixi-version: v0.39.0

- name: Rust checks & tests
# Install the Vulkan SDK, so we can use the software rasterizer.
# TODO(andreas): It would be nice if `setup_software_rasterizer.py` could do that for us as well (note though that this action here is very fast when cached!)
- name: Install Vulkan SDK
uses: jakoch/install-vulkan-sdk-action@v1.0.5
with:
vulkan_version: ${{ env.VULKAN_SDK_VERSION }}
install_runtime: true
cache: false
stripdown: true

- name: Setup software rasterizer
run: pixi run python ./scripts/ci/setup_software_rasterizer.py

- name: Rust checks (PR subset)
if: ${{ inputs.CHANNEL == 'pr' }}
run: pixi run rs-check --skip individual_crates tests docs_slow
run: pixi run rs-check --only base_checks sdk_variations cargo_deny wasm docs

- name: Rust checks & tests
- name: Download test assets
run: pixi run python ./tests/assets/download_test_assets.py

- name: Run tests (`cargo test --all-targets --all-features`)
if: ${{ inputs.CHANNEL == 'pr' }}
# Need to use pixi due to NASM dependency.
run: pixi run cargo test --all-targets --all-features

- name: Rust most checks & tests
if: ${{ inputs.CHANNEL == 'main' }}
run: pixi run rs-check --skip individual_crates docs_slow

Expand All @@ -83,10 +110,10 @@ jobs:
strategy:
matrix:
include:
# TODO(#8245): we run mac tests on `main` because that's the only platform where UI snapshot tests are covered.
# When the linux runners are able to run these tests (with a software renderer), we can move that back to all nightly.
- os: ${{ inputs.CHANNEL == 'main' && 'macos-latest' || 'windows-latest-8-cores' }}
name: ${{ inputs.CHANNEL == 'main' && 'macos' || 'windows' }}
- os: "macos-latest"
name: "macos"
- os: "windows-latest-8-cores"
name: "windows"

# Note: we can't use `matrix.os` here because its evaluated before the matrix stuff.
if: ${{ inputs.CHANNEL == 'main' || inputs.CHANNEL == 'nightly' }}
Expand All @@ -109,8 +136,28 @@ jobs:
with:
pixi-version: v0.39.0

# Install the Vulkan SDK, so we can use the software rasterizer.
# TODO(andreas): It would be nice if `setup_software_rasterizer.py` could do that for us as well (note though that this action here is very fast when cached!)
- name: Install Vulkan SDK
if: ${{ matrix.name != 'macos' }}
uses: jakoch/install-vulkan-sdk-action@v1.0.5
with:
vulkan_version: ${{ env.VULKAN_SDK_VERSION }}
install_runtime: true
cache: true
stripdown: true

- name: Setup software rasterizer
run: pixi run python ./scripts/ci/setup_software_rasterizer.py

- name: Download test assets
run: pixi run python ./tests/assets/download_test_assets.py

- name: pixi run cargo test --all-targets --all-features
- name: Run tests (`cargo test --all-targets --all-features`)
if: ${{ inputs.CHANNEL != 'nightly' }}
# Need to use pixi due to NASM dependency.
run: pixi run cargo test --all-targets --all-features

- name: Rust all checks & tests
if: ${{ inputs.CHANNEL == 'nightly' }}
run: pixi run rs-check
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ wheels
**/tests/snapshots/**/*.diff.png
**/tests/snapshots/**/*.new.png

# Mesa install
mesa
mesa.7z
mesa.tar.xz
icd.json

*.rrd

/meilisearch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,13 +227,7 @@ fn test_single_component_ui_as_list_item(
});

harness.run();

//TODO(#8245): enable this everywhere when we have a software renderer setup
if cfg!(target_os = "macos") {
harness.try_snapshot_options(&format!("{test_case}"), _snapshot_options)
} else {
Ok(())
}
harness.try_snapshot_options(&format!("{test_case}"), _snapshot_options)
}

// ---
Expand Down
5 changes: 5 additions & 0 deletions crates/viewer/re_renderer/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ impl RenderContext {
before_view_builder_encoder: Mutex::new(FrameGlobalCommandEncoder::new(&device)),
frame_index: STARTUP_FRAME_IDX,
top_level_error_scope,
num_view_builders_created: AtomicU64::new(0),
};

// Register shader workarounds for the current device.
Expand Down Expand Up @@ -316,6 +317,7 @@ This means, either a call to RenderContext::before_submit was omitted, or the pr
before_view_builder_encoder: Mutex::new(FrameGlobalCommandEncoder::new(&self.device)),
frame_index: self.active_frame.frame_index.wrapping_add(1),
top_level_error_scope: Some(WgpuErrorScope::start(&self.device)),
num_view_builders_created: AtomicU64::new(0),
};
let frame_index = self.active_frame.frame_index;

Expand Down Expand Up @@ -485,6 +487,9 @@ pub struct ActiveFrameContext {
///
/// The only time this is allowed to be `None` is during shutdown and when closing an old and opening a new scope.
top_level_error_scope: Option<WgpuErrorScope>,

/// Number of view builders created in this frame so far.
pub num_view_builders_created: AtomicU64,
}

fn log_adapter_info(info: &wgpu::AdapterInfo) {
Expand Down
4 changes: 4 additions & 0 deletions crates/viewer/re_renderer/src/view_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,10 @@ impl ViewBuilder {
frame_uniform_buffer_content,
};

ctx.active_frame
.num_view_builders_created
.fetch_add(1, std::sync::atomic::Ordering::Release);

Self {
setup,
queued_draws: vec![composition_draw.into()],
Expand Down
3 changes: 0 additions & 3 deletions crates/viewer/re_time_panel/tests/time_panel_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,5 @@ fn run_time_panel_and_save_snapshot(mut test_context: TestContext, _snapshot_nam
});

harness.run();

//TODO(#8245): enable this everywhere when we have a software renderer setup
#[cfg(target_os = "macos")]
harness.snapshot(_snapshot_name);
}
3 changes: 0 additions & 3 deletions crates/viewer/re_ui/tests/arrow_ui_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ pub fn test_arrow_ui() {
harness.fit_contents();

harness.run();

//TODO(#8245): enable this everywhere when we have a software renderer setup
#[cfg(target_os = "macos")]
harness.snapshot("arrow_ui");
}

Expand Down
3 changes: 0 additions & 3 deletions crates/viewer/re_ui/tests/list_item_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,5 @@ pub fn test_list_items_should_match_snapshot() {
});

harness.run();

//TODO(#8245): enable this everywhere when we have a software renderer setup
#[cfg(target_os = "macos")]
harness.snapshot("list_items");
}
3 changes: 0 additions & 3 deletions crates/viewer/re_ui/tests/modal_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,5 @@ fn run_modal_test(
});

harness.run();

//TODO(#8245): enable this everywhere when we have a software renderer setup
#[cfg(target_os = "macos")]
harness.snapshot(_test_name);
}
3 changes: 0 additions & 3 deletions crates/viewer/re_view_graph/tests/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,6 @@ fn run_graph_view_and_save_snapshot(
});

harness.run();

//TODO(#8245): enable this everywhere when we have a software renderer setup
#[cfg(target_os = "macos")]
harness.snapshot(_name);

Ok(())
Expand Down
Loading
Loading