From d7975a9de591a57b265c2d62078a65ffb9209696 Mon Sep 17 00:00:00 2001 From: Tilmann Meyer Date: Sun, 1 Aug 2021 20:38:34 +0200 Subject: wgpu: Use the preferred texture format of the surface Signed-off-by: Tilmann Meyer --- wgpu/src/backend.rs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'wgpu/src/backend.rs') diff --git a/wgpu/src/backend.rs b/wgpu/src/backend.rs index 783079f3..4f34045b 100644 --- a/wgpu/src/backend.rs +++ b/wgpu/src/backend.rs @@ -30,23 +30,24 @@ pub struct Backend { impl Backend { /// Creates a new [`Backend`]. - pub fn new(device: &wgpu::Device, settings: Settings) -> Self { + pub fn new( + device: &wgpu::Device, + settings: Settings, + format: wgpu::TextureFormat, + ) -> Self { let text_pipeline = text::Pipeline::new( device, - settings.format, + format, settings.default_font, settings.text_multithreading, ); - let quad_pipeline = quad::Pipeline::new(device, settings.format); - let triangle_pipeline = triangle::Pipeline::new( - device, - settings.format, - settings.antialiasing, - ); + let quad_pipeline = quad::Pipeline::new(device, format); + let triangle_pipeline = + triangle::Pipeline::new(device, format, settings.antialiasing); #[cfg(any(feature = "image_rs", feature = "svg"))] - let image_pipeline = image::Pipeline::new(device, settings.format); + let image_pipeline = image::Pipeline::new(device, format); Self { quad_pipeline, -- cgit