Skip to content

Commit

Permalink
removed a bunch of debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Vrixyz committed Nov 6, 2024
1 parent 4237f64 commit d79710a
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 35 deletions.
1 change: 0 additions & 1 deletion examples/paint_callback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ impl EguiBevyPaintCallbackImpl for CustomPaintCallback {
.and_then(|cache| cache.get_render_pipeline(comp.pipeline_id))
})
else {
warn!("Could not find pipeline.");
return;
};

Expand Down
2 changes: 0 additions & 2 deletions examples/two_windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ fn ui_first_window_system(
) {
let bevy_texture_id = egui_user_textures.add_image(images.bevy_icon.clone_weak());
let Ok(mut ctx) = egui_ctx.get_single_mut() else {
warn!("Could not find ctx.");
return;
};
egui::Window::new("First Window")
Expand Down Expand Up @@ -101,7 +100,6 @@ fn ui_second_window_system(
) {
let bevy_texture_id = egui_user_textures.add_image(images.bevy_icon.clone_weak());
let Ok(mut ctx) = egui_ctx.get_single_mut() else {
warn!("Could not find ctx(2).");
return;
};
egui::Window::new("Second Window")
Expand Down
3 changes: 0 additions & 3 deletions examples/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ fn main() {
.add_systems(Startup, configure_ui_state_system)
.add_systems(Update, update_ui_scale_factor_system)
.add_systems(Update, ui_example_system)
.add_systems(PreUpdate, || {
info!("new frame:");
})
.run();
}
#[derive(Default, Resource)]
Expand Down
26 changes: 6 additions & 20 deletions src/egui_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use crate::{
};
use bevy::{
ecs::world::{FromWorld, World},
log::{info, warn},
prelude::{Handle, Resource},
render::{
render_asset::RenderAssetUsages,
Expand Down Expand Up @@ -228,13 +227,11 @@ impl EguiNode {

impl Node for EguiNode {
fn update(&mut self, world: &mut World) {
info!("drawing");
let Some(key) = world
.get_resource::<ExtractedWindows>()
.and_then(|windows| windows.windows.get(&self.window_entity_main.id()))
.and_then(EguiPipelineKey::from_extracted_window)
else {
warn!("Could not make EguiPipelineKey.");
return;
};

Expand All @@ -244,16 +241,13 @@ impl Node for EguiNode {
let Ok((egui_settings, window_size, mut render_output)) =
render_target_query.get_mut(world, self.window_entity_render.id())
else {
warn!("Could not find settings.");
return;
};
let window_size = *window_size;
let paint_jobs = std::mem::take(&mut render_output.paint_jobs);

self.pixels_per_point = window_size.scale_factor * egui_settings.scale_factor;
if window_size.physical_width == 0.0 || window_size.physical_height == 0.0 {
warn!("small window");

return;
}

Expand Down Expand Up @@ -291,7 +285,6 @@ impl Node for EguiNode {
))
.is_empty()
{
warn!("empty clip");
continue;
}

Expand Down Expand Up @@ -405,8 +398,6 @@ impl Node for EguiNode {
let swap_chain_texture_view =
match extracted_window.and_then(|v| v.swap_chain_texture_view.as_ref()) {
None => {
warn!("no extracted_window for eguinode");

return Ok(());
}
Some(window) => window,
Expand All @@ -417,7 +408,6 @@ impl Node for EguiNode {
let (vertex_buffer, index_buffer) = match (&self.vertex_buffer, &self.index_buffer) {
(Some(vertex), Some(index)) => (vertex, index),
_ => {
warn!("no vertex or index buffer for eguinode");
return Ok(());
}
};
Expand All @@ -434,8 +424,6 @@ impl Node for EguiNode {
None => unreachable!(),
};
let Some(key) = pipeline_key else {
warn!("no pipeline KEY for eguinode");

return Ok(());
};

Expand Down Expand Up @@ -488,7 +476,6 @@ impl Node for EguiNode {

let pipeline_id = egui_pipelines.get(&self.window_entity_main).unwrap();
let Some(pipeline) = pipeline_cache.get_render_pipeline(*pipeline_id) else {
warn!("no pipeline for eguinode");
return Ok(());
};

Expand Down Expand Up @@ -529,22 +516,21 @@ impl Node for EguiNode {
},
};

let scrissor_rect = clip_urect.intersect(bevy::math::URect::new(
let scissor_rect = clip_urect.intersect(bevy::math::URect::new(
0,
0,
physical_width,
physical_height,
));
if scrissor_rect.is_empty() {
warn!("too small scissor");
if scissor_rect.is_empty() {
continue;
}

render_pass.set_scissor_rect(
scrissor_rect.min.x,
scrissor_rect.min.y,
scrissor_rect.width(),
scrissor_rect.height(),
scissor_rect.min.x,
scissor_rect.min.y,
scissor_rect.width(),
scissor_rect.height(),
);

match &draw_command.primitive {
Expand Down
11 changes: 2 additions & 9 deletions src/render_systems.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ pub fn setup_new_windows_render_system(
entity_index: render_window.index(),
entity_generation: render_window.generation(),
};
dbg!("setup_new_windows_render_system");
let new_node = EguiNode::new(MainEntity::from(window), *render_window);

render_graph.add_node(egui_pass.clone(), new_node);
Expand Down Expand Up @@ -174,7 +173,6 @@ pub fn prepare_egui_transforms_system(
render_queue: Res<RenderQueue>,
egui_pipeline: Res<EguiPipeline>,
) {
info!("prepare_egui_transforms_system");
egui_transforms.buffer.clear();
egui_transforms.offsets.clear();

Expand All @@ -185,7 +183,6 @@ pub fn prepare_egui_transforms_system(
*size,
egui_settings.scale_factor,
));
info!(offset);
if let Some(window_main) = window_main {
egui_transforms.offsets.insert(*window_main, offset);
}
Expand All @@ -199,7 +196,6 @@ pub fn prepare_egui_transforms_system(
match egui_transforms.bind_group {
Some((id, _)) if buffer.id() == id => {}
_ => {
info!("{:?}", buffer.id());
let transform_bind_group = render_device.create_bind_group(
Some("egui transform bind group"),
&egui_pipeline.transform_bind_group_layout,
Expand Down Expand Up @@ -265,29 +261,26 @@ pub fn queue_pipelines_system(
render_to_texture: Query<(&MainEntity, &EguiRenderToTextureHandle)>,
images: Res<RenderAssets<GpuImage>>,
) {
dbg!("queue_pipelines_system");
let mut pipelines: HashMap<MainEntity, CachedRenderPipelineId> = windows
.iter()
.filter_map(|(window_id, window)| {
dbg!("pipeline contd");
let key = EguiPipelineKey::from_extracted_window(window)?;
let pipeline_id =
specialized_pipelines.specialize(&pipeline_cache, &egui_pipeline, key);
Some((dbg!(MainEntity::from(*window_id)), pipeline_id))
Some((MainEntity::from(*window_id), pipeline_id))
})
.collect();

pipelines.extend(
render_to_texture
.iter()
.filter_map(|(main_entity, handle)| {
dbg!("pipeline rtt");
let img = images.get(&handle.0)?;
let key = EguiPipelineKey::from_gpu_image(img);
let pipeline_id =
specialized_pipelines.specialize(&pipeline_cache, &egui_pipeline, key);

Some((dbg!(*main_entity), pipeline_id))
Some((*main_entity, pipeline_id))
}),
);

Expand Down

0 comments on commit d79710a

Please sign in to comment.