Kill current render pass only when custom pipelines are present in layer

This commit is contained in:
Héctor Ramón Jiménez 2023-11-14 14:47:29 +01:00
parent 34b5cb75ef
commit fee3bf0df4
No known key found for this signature in database
GPG key ID: 7CC46565708259A7

View file

@ -323,10 +323,9 @@ impl Backend {
text_layer += 1; 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() { if !layer.pipelines.is_empty() {
let _ = ManuallyDrop::into_inner(render_pass);
for pipeline in &layer.pipelines { for pipeline in &layer.pipelines {
let bounds = (pipeline.bounds * scale_factor).snap(); let bounds = (pipeline.bounds * scale_factor).snap();
@ -342,27 +341,26 @@ impl Backend {
encoder, encoder,
); );
} }
}
// recreate and continue processing layers render_pass = ManuallyDrop::new(encoder.begin_render_pass(
render_pass = ManuallyDrop::new(encoder.begin_render_pass( &wgpu::RenderPassDescriptor {
&wgpu::RenderPassDescriptor { label: Some("iced_wgpu::quad render pass"),
label: Some("iced_wgpu::quad render pass"), color_attachments: &[Some(
color_attachments: &[Some( wgpu::RenderPassColorAttachment {
wgpu::RenderPassColorAttachment { view: target,
view: target, resolve_target: None,
resolve_target: None, ops: wgpu::Operations {
ops: wgpu::Operations { load: wgpu::LoadOp::Load,
load: wgpu::LoadOp::Load, store: wgpu::StoreOp::Store,
store: wgpu::StoreOp::Store, },
}, },
}, )],
)], depth_stencil_attachment: None,
depth_stencil_attachment: None, timestamp_writes: None,
timestamp_writes: None, occlusion_query_set: None,
occlusion_query_set: None, },
}, ));
)); }
} }
let _ = ManuallyDrop::into_inner(render_pass); let _ = ManuallyDrop::into_inner(render_pass);