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

Fix max_texture_dimension_2d for rpis. #50

Merged
merged 1 commit into from
Mar 14, 2024
Merged
Changes from all commits
Commits
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: 15 additions & 1 deletion crates/re_renderer/src/config.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::process::Command;

/// Hardware tiers `re_renderer` distinguishes.
///
/// To reduce complexity, we don't do fine-grained feature checks,
Expand Down Expand Up @@ -57,11 +59,23 @@ impl HardwareTier {

/// Wgpu limits required by the given hardware tier.
pub fn limits(self) -> wgpu::Limits {
// RPI are a specific platform where we know max texture size is 4096.
let mut is_rpi = false;
if cfg!(unix) {
if let Ok(cat_out) = Command::new("cat")
.arg("/sys/firmware/devicetree/base/model")
.output()
{
if let Ok(stdout) = String::from_utf8(cat_out.stdout) {
is_rpi = stdout.find("Raspberry Pi").is_some();
}
}
}
wgpu::Limits {
// In any scenario require high texture resolution to facilitate rendering into large surfaces
// (important for 4k screens and beyond)
// 8192 is widely supported by now.
max_texture_dimension_2d: 8192,
max_texture_dimension_2d: if is_rpi { 4096 } else { 8192 },
..wgpu::Limits::downlevel_webgl2_defaults()
}
}
Expand Down
Loading