Failed to load many big images into a virtual list: wgpu Validation Error: Dimension X value exceeds the limit
I'm developing an image-focused application, and I wanted to make sure it can handle a large-ish amount of data.
- I downloaded a 4k wallapper and copy-pasted it until there's 256 of them in a folder, totaling 451.2 MB of data.
- I created a
virtual_listwhich reads every file path in said folder - The virtual list then creates a:
v_stack((
img(move || std::fs::read(path.clone()).unwrap()).style(|s| s.width(64.).height(64.)),
))
For each.
- Ran the application in
--release(happens in debug too).
After loading some images, the application crashes:
Full error trace
Finished `dev` profile [unoptimized + debuginfo] target(s) in 18.12s
Running `target/debug/stickerbox`
File("./resources/many-big-image/4k-wallpaper (208).jpg")
File("./resources/many-big-image/4k-wallpaper (71).jpg")
File("./resources/many-big-image/4k-wallpaper (154).jpg")
File("./resources/many-big-image/4k-wallpaper (23).jpg")
File("./resources/many-big-image/4k-wallpaper (122).jpg")
File("./resources/many-big-image/4k-wallpaper (144).jpg")
File("./resources/many-big-image/4k-wallpaper (118).jpg")
File("./resources/many-big-image/4k-wallpaper (244).jpg")
thread 'main' panicked at /home/gremious/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/wgpu-24.0.5/src/backend/wgpu_core.rs:1423:26:
wgpu error: Validation Error
Caused by:
In Device::create_texture, label = 'atlas_texture'
Dimension X value 10944 exceeds the limit of 8192
stack backtrace:
0: 0x5b2d0d150213 - std::backtrace_rs::backtrace::libunwind::trace::h9c5657dcad2baadd
at /rustc/e16a049adbf94d610787430b6efdf31d896dc5b6/library/std/src/../../backtrace/src/backtrace/libunwind.rs:117:9
1: 0x5b2d0d150213 - std::backtrace_rs::backtrace::trace_unsynchronized::h7d4d77459448a4b2
at /rustc/e16a049adbf94d610787430b6efdf31d896dc5b6/library/std/src/../../backtrace/src/backtrace/mod.rs:66:14
2: 0x5b2d0d150213 - std::sys::backtrace::_print_fmt::h68f0dbe2ea79e49e
at /rustc/e16a049adbf94d610787430b6efdf31d896dc5b6/library/std/src/sys/backtrace.rs:66:9
3: 0x5b2d0d150213 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hd9fc6a39ec3df3d1
at /rustc/e16a049adbf94d610787430b6efdf31d896dc5b6/library/std/src/sys/backtrace.rs:39:26
4: 0x5b2d0d17be33 - core::fmt::rt::Argument::fmt::ha7a928a4731c3c0b
at /rustc/e16a049adbf94d610787430b6efdf31d896dc5b6/library/core/src/fmt/rt.rs:177:76
5: 0x5b2d0d17be33 - core::fmt::write::h73a1e37ddefe0a4f
at /rustc/e16a049adbf94d610787430b6efdf31d896dc5b6/library/core/src/fmt/mod.rs:1449:21
6: 0x5b2d0d14bae3 - std::io::Write::write_fmt::h12f84d1a8e648b12
at /rustc/e16a049adbf94d610787430b6efdf31d896dc5b6/library/std/src/io/mod.rs:1890:15
7: 0x5b2d0d150062 - std::sys::backtrace::BacktraceLock::print::h91fc82fbc6b056a6
at /rustc/e16a049adbf94d610787430b6efdf31d896dc5b6/library/std/src/sys/backtrace.rs:42:9
8: 0x5b2d0d15100a - std::panicking::default_hook::{{closure}}::hebc0ecceade2cd26
at /rustc/e16a049adbf94d610787430b6efdf31d896dc5b6/library/std/src/panicking.rs:298:22
9: 0x5b2d0d150e7a - std::panicking::default_hook::h82ddd3fdf5856794
at /rustc/e16a049adbf94d610787430b6efdf31d896dc5b6/library/std/src/panicking.rs:325:9
10: 0x5b2d0d151a22 - std::panicking::rust_panic_with_hook::hb92b3172308f4e8b
at /rustc/e16a049adbf94d610787430b6efdf31d896dc5b6/library/std/src/panicking.rs:831:13
11: 0x5b2d0d1517aa - std::panicking::begin_panic_handler::{{closure}}::hbf0e4f1d78818dec
at /rustc/e16a049adbf94d610787430b6efdf31d896dc5b6/library/std/src/panicking.rs:704:13
12: 0x5b2d0d150719 - std::sys::backtrace::__rust_end_short_backtrace::hfc58a21f6afae4ae
at /rustc/e16a049adbf94d610787430b6efdf31d896dc5b6/library/std/src/sys/backtrace.rs:168:18
13: 0x5b2d0d15143d - rust_begin_unwind
at /rustc/e16a049adbf94d610787430b6efdf31d896dc5b6/library/std/src/panicking.rs:695:5
14: 0x5b2d0d1790e0 - core::panicking::panic_fmt::h52a3de72b5c008c5
at /rustc/e16a049adbf94d610787430b6efdf31d896dc5b6/library/core/src/panicking.rs:75:14
15: 0x5b2d0ba4c8c1 - wgpu::backend::wgpu_core::default_error_handler::h03e7f04ff020341f
at /home/gremious/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/wgpu-24.0.5/src/backend/wgpu_core.rs:653:5
16: 0x5b2d0ba4c58c - wgpu::backend::wgpu_core::ErrorSinkRaw::handle_error::h404a874cc4d44e13
at /home/gremious/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/wgpu-24.0.5/src/backend/wgpu_core.rs:637:21
17: 0x5b2d0ba49875 - wgpu::backend::wgpu_core::ContextWgpuCore::handle_error_inner::hff1f716d65e43339
at /home/gremious/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/wgpu-24.0.5/src/backend/wgpu_core.rs:298:9
18: 0x5b2d0ba49e7a - wgpu::backend::wgpu_core::ContextWgpuCore::handle_error::h5dd8cbcaf1cecdac
at /home/gremious/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/wgpu-24.0.5/src/backend/wgpu_core.rs:310:9
19: 0x5b2d0ba524d6 - <wgpu::backend::wgpu_core::CoreDevice as wgpu::dispatch::DeviceInterface>::create_texture::haf2d023ad4534f6f
at /home/gremious/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/wgpu-24.0.5/src/backend/wgpu_core.rs:1423:13
20: 0x5b2d0ba8b3b9 - wgpu::api::device::Device::create_texture::hac4a4cf19100ad48
at /home/gremious/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/wgpu-24.0.5/src/api/device.rs:230:23
21: 0x5b2d0b942af4 - floem_vger::atlas::Atlas::get_atlas_texture::hd5e4df8f501334af
at /home/gremious/.cargo/git/checkouts/vger-rs-73875d61103618a1/3206d47/src/atlas.rs:111:9
22: 0x5b2d0b942905 - floem_vger::atlas::Atlas::resize::h1091ac8b8178772f
at /home/gremious/.cargo/git/checkouts/vger-rs-73875d61103618a1/3206d47/src/atlas.rs:80:30
23: 0x5b2d0b943d5b - floem_vger::glyphs::GlyphCache::check_usage::hf30c07e4d8a4e79e
at /home/gremious/.cargo/git/checkouts/vger-rs-73875d61103618a1/3206d47/src/glyphs.rs:155:13
24: 0x5b2d0b9312e5 - floem_vger::Vger::begin::hd4c3d4e6988e10ce
at /home/gremious/.cargo/git/checkouts/vger-rs-73875d61103618a1/3206d47/src/lib.rs:341:12
25: 0x5b2d0b86a381 - <floem_vger_renderer::VgerRenderer as floem_renderer::Renderer>::begin::hbd5f520df3347b82
at /home/gremious/.cargo/git/checkouts/floem-ab9be4e01bb293da/e6f0b5b/vger/src/lib.rs:300:9
26: 0x5b2d0b76b7fa - <floem::renderer::Renderer as floem_renderer::Renderer>::begin::hcfac56938f0d0000
at /home/gremious/.cargo/git/checkouts/floem-ab9be4e01bb293da/e6f0b5b/src/renderer.rs:220:17
27: 0x5b2d0b6f1997 - floem::window_handle::WindowHandle::paint::h9008dc2c81bcd3e9
at /home/gremious/.cargo/git/checkouts/floem-ab9be4e01bb293da/e6f0b5b/src/window_handle.rs:675:9
28: 0x5b2d0b6f221b - floem::window_handle::WindowHandle::capture::h08927aca9b2946e4
at /home/gremious/.cargo/git/checkouts/floem-ab9be4e01bb293da/e6f0b5b/src/window_handle.rs:752:22
29: 0x5b2d0b76174f - floem::app_handle::ApplicationHandle::capture_window::{{closure}}::h9bed68ad34f5c602
at /home/gremious/.cargo/git/checkouts/floem-ab9be4e01bb293da/e6f0b5b/src/app_handle.rs:493:27
30: 0x5b2d0b485acd - core::option::Option<T>::map::h7ae2218a9ac13888
at /home/gremious/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs:1119:29
31: 0x5b2d0b761705 - floem::app_handle::ApplicationHandle::capture_window::h6beeaeac1a49cb9f
at /home/gremious/.cargo/git/checkouts/floem-ab9be4e01bb293da/e6f0b5b/src/app_handle.rs:491:9
32: 0x5b2d0b75f22f - floem::app_handle::ApplicationHandle::handle_update_event::h2242432806591871
at /home/gremious/.cargo/git/checkouts/floem-ab9be4e01bb293da/e6f0b5b/src/app_handle.rs:125:33
33: 0x5b2d0b75e6cc - floem::app_handle::ApplicationHandle::handle_user_event::h9f24f904e898bf52
at /home/gremious/.cargo/git/checkouts/floem-ab9be4e01bb293da/e6f0b5b/src/app_handle.rs:57:17
34: 0x5b2d0b5393d5 - <floem::app::Application as winit::application::ApplicationHandler>::proxy_wake_up::h07bcc0a49f16bf83
at /home/gremious/.cargo/git/checkouts/floem-ab9be4e01bb293da/e6f0b5b/src/app.rs:174:13
35: 0x5b2d0b52da5b - <&mut A as winit::application::ApplicationHandler>::proxy_wake_up::h05a0ef57a2622cd3
at /home/gremious/.cargo/git/checkouts/winit-4d35a78d1599eac3/ee245c5/src/application.rs:378:9
36: 0x5b2d0b5526ef - winit::platform_impl::linux::wayland::event_loop::EventLoop::single_iteration::hc975fad38182bef2
at /home/gremious/.cargo/git/checkouts/winit-4d35a78d1599eac3/ee245c5/src/platform_impl/linux/wayland/event_loop/mod.rs:299:13
37: 0x5b2d0b554ec4 - winit::platform_impl::linux::wayland::event_loop::EventLoop::poll_events_with_timeout::ha31f627a935161b0
at /home/gremious/.cargo/git/checkouts/winit-4d35a78d1599eac3/ee245c5/src/platform_impl/linux/wayland/event_loop/mod.rs:275:9
38: 0x5b2d0b55240a - winit::platform_impl::linux::wayland::event_loop::EventLoop::pump_app_events::hed33e15439041c60
at /home/gremious/.cargo/git/checkouts/winit-4d35a78d1599eac3/ee245c5/src/platform_impl/linux/wayland/event_loop/mod.rs:196:13
39: 0x5b2d0b55489c - winit::platform_impl::linux::wayland::event_loop::EventLoop::run_app_on_demand::h06ba09761cd2b055
at /home/gremious/.cargo/git/checkouts/winit-4d35a78d1599eac3/ee245c5/src/platform_impl/linux/wayland/event_loop/mod.rs:159:19
40: 0x5b2d0b554efa - winit::platform_impl::linux::wayland::event_loop::EventLoop::run_app::h3e4ba4e993d856d1
at /home/gremious/.cargo/git/checkouts/winit-4d35a78d1599eac3/ee245c5/src/platform_impl/linux/wayland/event_loop/mod.rs:150:9
41: 0x5b2d0b78e33b - winit::platform_impl::linux::EventLoop::run_app::hea9cc60ba8a005d7
at /home/gremious/.cargo/git/checkouts/winit-4d35a78d1599eac3/ee245c5/src/platform_impl/linux/mod.rs:334:56
42: 0x5b2d0b5404ba - winit::event_loop::EventLoop::run_app::h7b989c45c8a6be34
at /home/gremious/.cargo/git/checkouts/winit-4d35a78d1599eac3/ee245c5/src/event_loop.rs:230:9
43: 0x5b2d0b539c6d - floem::app::Application::run::h9e59dd9002e9ef6d
at /home/gremious/.cargo/git/checkouts/floem-ab9be4e01bb293da/e6f0b5b/src/app.rs:250:17
44: 0x5b2d0b382202 - stickerbox::main::h0513cbcd26d3a82c
at /home/gremious/dev/personal/stickerbox/src/main.rs:26:5
45: 0x5b2d0b34c05b - core::ops::function::FnOnce::call_once::h0c9dacdb1f19a8d1
at /home/gremious/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5
46: 0x5b2d0b358f0e - std::sys::backtrace::__rust_begin_short_backtrace::h86bf529f4fca6750
at /home/gremious/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/backtrace.rs:152:18
47: 0x5b2d0b35bb41 - std::rt::lang_start::{{closure}}::hac4866ecae22f688
at /home/gremious/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs:199:18
48: 0x5b2d0d145070 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h89f6fe5f9de931e3
at /rustc/e16a049adbf94d610787430b6efdf31d896dc5b6/library/core/src/ops/function.rs:284:13
49: 0x5b2d0d145070 - std::panicking::try::do_call::h8687f2a735d9c59f
at /rustc/e16a049adbf94d610787430b6efdf31d896dc5b6/library/std/src/panicking.rs:587:40
50: 0x5b2d0d145070 - std::panicking::try::h680170d386bcd6df
at /rustc/e16a049adbf94d610787430b6efdf31d896dc5b6/library/std/src/panicking.rs:550:19
51: 0x5b2d0d145070 - std::panic::catch_unwind::hf3fb7b9824a964bc
at /rustc/e16a049adbf94d610787430b6efdf31d896dc5b6/library/std/src/panic.rs:359:14
52: 0x5b2d0d145070 - std::rt::lang_start_internal::{{closure}}::had483d6c459eec2b
at /rustc/e16a049adbf94d610787430b6efdf31d896dc5b6/library/std/src/rt.rs:168:24
53: 0x5b2d0d145070 - std::panicking::try::do_call::hc7088a8b55739753
at /rustc/e16a049adbf94d610787430b6efdf31d896dc5b6/library/std/src/panicking.rs:587:40
54: 0x5b2d0d145070 - std::panicking::try::h0f7a1847d704be0c
at /rustc/e16a049adbf94d610787430b6efdf31d896dc5b6/library/std/src/panicking.rs:550:19
55: 0x5b2d0d145070 - std::panic::catch_unwind::h4da4f58562138f3a
at /rustc/e16a049adbf94d610787430b6efdf31d896dc5b6/library/std/src/panic.rs:359:14
56: 0x5b2d0d145070 - std::rt::lang_start_internal::h71fef5e5f25ac3f5
at /rustc/e16a049adbf94d610787430b6efdf31d896dc5b6/library/std/src/rt.rs:164:5
57: 0x5b2d0b35bb27 - std::rt::lang_start::h48dd79dcd95c2e59
at /home/gremious/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs:198:5
58: 0x5b2d0b38254e - main
59: 0x7e8c731286b5 - <unknown>
60: 0x7e8c73128769 - __libc_start_main
61: 0x5b2d0b34ac85 - _start
62: 0x0 - <unknown>
Current code (not minimal, sorry, but small)
v_stack((
h_stack((
virtual_list(
|| {
std::fs::read_dir("./resources/many-big-image").unwrap()
.into_iter()
.filter_map(|e| e.ok())
.filter_map(|e| {
let path = e.path();
if path.is_dir() {
Some(PathEntry::Dir(path))
} else {
match path.extension().and_then(|ext| ext.to_str()) {
Some("jpg") | Some("png") | Some("webp") | Some("gif") | Some("bmp") => {
Some(PathEntry::File(path))
},
_ => None,
}
}
})
.collect::<im::Vector<PathEntry>>()
},
move |item| item.clone(),
move |item| {
println!("{item:?}");
match item {
PathEntry::Dir(path_entry) => {
v_stack((
label(move || format!("{}", path_entry.display())).style(|s| s.height(20.0)),
))
},
PathEntry::File(path_entry) => {
let path = path_entry.clone();
v_stack((
img(move || std::fs::read(path.clone()).unwrap())
.style(|s| s.width(64.).height(64.)),
label(move || format!("{}", path_entry.display())).style(|s| s.height(20.0))
))
},
}
},
).style(|s| s.width_pct(50.).height_full().border(1)),
)).style(|s| {
s.min_size_full().items_center().justify_center()
}),
)).style(|s| s.size_full().justify_center().items_center())
floem version - main branch, current commit e6f0b5b0b65eab8f56b14f4624e40c3705cae222
features = ["serde", "image-gif", "image-avif", "image-bmp"] }
Linux 6.12.38-1-lts, EndeavourOS (arch-based), KDE wayland
currently the support for images in the vger renderer is targeted at small images as they are cached in an atlas. We probably need to both special case larger images and store them in separate textures with a texture pool as well as improve the ability to use textures directly in the renderer.
Our vello rendering backend might need similar changes but should also be better