emilk / egui

egui: an easy-to-use immediate mode GUI in Rust that runs on both web and native
https://www.egui.rs/
Apache License 2.0
21.88k stars 1.58k forks source link

TextureHandle.set_partial( ) panics in wgpu #5026

Closed tsinjue closed 1 month ago

tsinjue commented 1 month ago

Can anyone help for this issue? Many thanks.

Describe the bug TextureHandle.set_partil panics in wgpu. here is detailed info: size: [ 3248, 2432, ]thread 'main' panicked at wgpu-22.1.0/src/backend/wgpu_core.rs:3411:5: wgpu error: Validation Error

Caused by: In Queue::write_texture Copy of X 100..3348 would end up overrunning the bounds of the Destination texture of X size 3248

To Reproduce Steps to reproduce the behavior:

if let Some(handle) = self.texture_handle.as_mut() {
        let image_data = self.image_data.clone().unwrap();
        handle.set_partial([100usize, 200], image_data, self.texture_options);
        ui.image(SizedTexture::from_handle(&handle));
emilk commented 1 month ago

You are writing outside the bounds of the texture. The first argument is a position, not a size.