Skip to content

Commit

Permalink
Fix max_texture_size_2d for rpis.
Browse files Browse the repository at this point in the history
  • Loading branch information
zrezke committed Mar 14, 2024
1 parent a96e80d commit 07d208d
Showing 1 changed file with 15 additions and 1 deletion.
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

0 comments on commit 07d208d

Please sign in to comment.