Skip to content

Commit

Permalink
Kill current render pass only when custom pipelines are present in layer
Browse files Browse the repository at this point in the history
  • Loading branch information
hecrj committed Nov 14, 2023
1 parent 34b5cb7 commit fee3bf0
Showing 1 changed file with 20 additions and 22 deletions.
42 changes: 20 additions & 22 deletions wgpu/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,10 +323,9 @@ impl Backend {
text_layer += 1;
}

// kill render pass to let custom shaders get mut access to encoder
let _ = ManuallyDrop::into_inner(render_pass);

if !layer.pipelines.is_empty() {
let _ = ManuallyDrop::into_inner(render_pass);

for pipeline in &layer.pipelines {
let bounds = (pipeline.bounds * scale_factor).snap();

Expand All @@ -342,27 +341,26 @@ impl Backend {
encoder,
);
}
}

// recreate and continue processing layers
render_pass = ManuallyDrop::new(encoder.begin_render_pass(
&wgpu::RenderPassDescriptor {
label: Some("iced_wgpu::quad render pass"),
color_attachments: &[Some(
wgpu::RenderPassColorAttachment {
view: target,
resolve_target: None,
ops: wgpu::Operations {
load: wgpu::LoadOp::Load,
store: wgpu::StoreOp::Store,
render_pass = ManuallyDrop::new(encoder.begin_render_pass(
&wgpu::RenderPassDescriptor {
label: Some("iced_wgpu::quad render pass"),
color_attachments: &[Some(
wgpu::RenderPassColorAttachment {
view: target,
resolve_target: None,
ops: wgpu::Operations {
load: wgpu::LoadOp::Load,
store: wgpu::StoreOp::Store,
},
},
},
)],
depth_stencil_attachment: None,
timestamp_writes: None,
occlusion_query_set: None,
},
));
)],
depth_stencil_attachment: None,
timestamp_writes: None,
occlusion_query_set: None,
},
));
}
}

let _ = ManuallyDrop::into_inner(render_pass);
Expand Down

0 comments on commit fee3bf0

Please sign in to comment.