Skip to content

Commit

Permalink
Fix render pass being dropped too late
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasmerlin committed Dec 12, 2024
1 parent a8e8e93 commit 40f0999
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 18 deletions.
2 changes: 1 addition & 1 deletion crates/eframe/src/web/web_painter_wgpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::sync::{mpsc, Arc};

use super::web_painter::WebPainter;
use crate::epaint::ColorImage;
use crate::{epaint, WebOptions};
use crate::WebOptions;
use egui::{Event, UserData, ViewportId};
use egui_wgpu::capture::CaptureState;
use egui_wgpu::{RenderState, SurfaceErrorAction, WgpuSetup};
Expand Down
36 changes: 19 additions & 17 deletions crates/egui-wgpu/src/capture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,24 +178,26 @@ impl CaptureState {
tex_extent,
);

let mut pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
label: Some("blit"),
color_attachments: &[Some(wgpu::RenderPassColorAttachment {
view: &output_frame.texture.create_view(&Default::default()),
resolve_target: None,
ops: wgpu::Operations {
load: wgpu::LoadOp::Clear(wgpu::Color::TRANSPARENT),
store: StoreOp::Store,
},
})],
depth_stencil_attachment: None,
occlusion_query_set: None,
timestamp_writes: None,
});
{
let mut pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
label: Some("blit"),
color_attachments: &[Some(wgpu::RenderPassColorAttachment {
view: &output_frame.texture.create_view(&Default::default()),
resolve_target: None,
ops: wgpu::Operations {
load: wgpu::LoadOp::Clear(wgpu::Color::TRANSPARENT),
store: StoreOp::Store,
},
})],
depth_stencil_attachment: None,
occlusion_query_set: None,
timestamp_writes: None,
});

pass.set_pipeline(&self.pipeline);
pass.set_bind_group(0, &self.bind_group, &[]);
pass.draw(0..3, 0..1);
pass.set_pipeline(&self.pipeline);
pass.set_bind_group(0, &self.bind_group, &[]);
pass.draw(0..3, 0..1);
}

let id = queue.submit(Some(encoder.finish()));
let buffer_clone = buffer.clone();
Expand Down

0 comments on commit 40f0999

Please sign in to comment.