Skip to content

Commit

Permalink
Adjusted pipeline to be created after the texture format check.
Browse files Browse the repository at this point in the history
  • Loading branch information
bungoboingo committed Apr 10, 2023
1 parent 3b5df3d commit 4d30cae
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions wgpu/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ pub struct Backend {
quad_pipeline: quad::Pipeline,
text_pipeline: text::Pipeline,
triangle_pipeline: triangle::Pipeline,
offscreen_pipeline: offscreen::Pipeline,

#[cfg(any(feature = "image", feature = "svg"))]
image_pipeline: image::Pipeline,
Expand All @@ -44,7 +43,6 @@ impl Backend {
let quad_pipeline = quad::Pipeline::new(device, format);
let triangle_pipeline =
triangle::Pipeline::new(device, format, settings.antialiasing);
let offscreen_pipeline = offscreen::Pipeline::new(device);

#[cfg(any(feature = "image", feature = "svg"))]
let image_pipeline = image::Pipeline::new(device, format);
Expand All @@ -53,7 +51,6 @@ impl Backend {
quad_pipeline,
text_pipeline,
triangle_pipeline,
offscreen_pipeline,

#[cfg(any(feature = "image", feature = "svg"))]
image_pipeline,
Expand Down Expand Up @@ -158,6 +155,7 @@ impl Backend {

if format != wgpu::TextureFormat::Rgba8UnormSrgb {
log::info!("Texture format is {format:?}; performing conversion to rgba8..");
let pipeline = offscreen::Pipeline::new(device);

let texture = device.create_texture(&wgpu::TextureDescriptor {
label: Some("iced_wgpu::offscreen rgba8 source texture"),
Expand All @@ -173,13 +171,7 @@ impl Backend {
let view =
texture.create_view(&wgpu::TextureViewDescriptor::default());

self.offscreen_pipeline.convert(
device,
texture_extent,
frame,
&view,
encoder,
);
pipeline.convert(device, texture_extent, frame, &view, encoder);

return Some(texture);
}
Expand Down

0 comments on commit 4d30cae

Please sign in to comment.