attackgoat / screen-13

Screen 13 is an easy-to-use Vulkan rendering engine in the spirit of QBasic.
Apache License 2.0
252 stars 12 forks source link

egui crashing on debug_assert!(res.end > res.start) of buffer_image_copy_subresource #50

Closed qianzhang5 closed 1 year ago

qianzhang5 commented 1 year ago

could you remove debug_assert!(res.end > res.start)? the Text plotting in plot crashes in debug build.

sample code: use {screen_13::prelude::, screen_13_egui::prelude::}; use egui::{text::{LayoutJob, TextFormat}, Color32}; use egui::epaint::text::{FontId, FontFamily}; use egui::widgets::plot::*; fn main() -> Result<(), DisplayError> { pretty_env_logger::init();

let event_loop = EventLoop::new()
    .desired_swapchain_image_count(2)
    .window(|window| window.with_transparent(false))
    .build()?;
let mut egui = Egui::new(&event_loop.device, event_loop.as_ref());

let mut cache = LazyPool::new(&event_loop.device);
let mut count = 0;
event_loop.run(|frame| {
    egui.run(
        frame.window,
        frame.events,
        frame.swapchain_image,
        frame.render_graph,
        |ui| {
            egui::Window::new("Test")
                .resizable(true)
                .vscroll(true)
                .default_size([900., 900.])
                .show(ui, |ui| {
                    egui::widgets::plot::Plot::new("plot")
                    .width(400.)
                    .height(400.)
                    .show(ui, |plot_ui| {
                        let mut text = LayoutJob::default();
                        text.append(
                            &format!("{}", count),
                            0.0,
                            TextFormat {
                                font_id: FontId {size: 30 as f32, family: FontFamily::Proportional},
                                color:  Color32::from_rgb(0x0c, 0xfc, 0x0c),
                                ..Default::default()
                            },
                        );
                        plot_ui.text(Text::new(PlotPoint::new(0.0, 0.0), text));
                        count += 1;
                    });
                });
        },
    );
})

}

attackgoat commented 1 year ago

Thank you for the example! I was able to reproduce the same issue quickly with this. 💯🙏

A fix was pushed specifying buffer_row_length and buffer_image_height parameters in the screen-13-egui crate. These were zero and that is not valid input.