Skip to content

Instantly share code, notes, and snippets.

@mzyy94
Created March 7, 2022 11:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mzyy94/f67284fa865f6b4d965a4215ad788b5c to your computer and use it in GitHub Desktop.
Save mzyy94/f67284fa865f6b4d965a4215ad788b5c to your computer and use it in GitHub Desktop.
Check wgpu Vulkan limits on Raspberry Pi 4
[package]
name = "check-adapter-limit"
version = "0.1.0"
edition = "2021"
[dependencies]
wgpu = { git = "https://github.com/gfx-rs/wgpu", rev = "0ac9ce002656565ccd05b889f5856f4e2c38fa73" }
async-std = { version = "1.10.0", features = ["attributes"] }
[[bin]]
name = "check"
path = "main.rs"
fn check_limits(target: &wgpu::Limits, base: &wgpu::Limits, label: &str) {
let mut count = 0;
println!("{}", label);
target.check_limits_with_fail_fn(base, false, |name, requested, allowed| {
println!(" {}: {} should be {}", name, requested, allowed);
count += 1;
});
println!("number of failures: {}\n", count);
}
#[async_std::main]
async fn main() {
let backend = wgpu::Backends::VULKAN;
let instance = wgpu::Instance::new(backend);
let adapter = wgpu::util::initialize_adapter_from_env_or_default(&instance, backend, None)
.await
.expect("No suitable GPU adapters found on the system!");
let limits = wgpu::Limits::default();
check_limits(&limits, &adapter.limits(), "wgpu::Limits::default()");
let limits = wgpu::Limits::downlevel_defaults();
check_limits(
&limits,
&adapter.limits(),
"wgpu::Limits::downlevel_defaults()",
);
}
pi@raspberrypi:~/Desktop/check $ cargo run
Compiling check-adapter-limit v0.1.0 (/home/pi/Desktop/check)
Finished dev [unoptimized + debuginfo] target(s) in 15.76s
Running `target/debug/check`
WARNING: v3dv is neither a complete nor a conformant Vulkan implementation. Testing use only.
wgpu::Limits::default()
max_texture_dimension_1d: 8192 should be 4096
max_texture_dimension_2d: 8192 should be 4096
max_storage_textures_per_shader_stage: 8 should be 4
number of failures: 3
wgpu::Limits::downlevel_defaults()
number of failures: 0
pi@raspberrypi:~/Desktop/check $
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment