From e838982d1abe4134f83a3f4e9db0a3bfb8ebc926 Mon Sep 17 00:00:00 2001 From: Micha White Date: Sat, 4 Feb 2023 11:41:22 -0500 Subject: Fix colors --- alligator_render/src/config.rs | 6 +++--- alligator_render/src/renderer.rs | 3 ++- alligator_render/src/texture.rs | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) (limited to 'alligator_render/src') diff --git a/alligator_render/src/config.rs b/alligator_render/src/config.rs index b289212..952e885 100644 --- a/alligator_render/src/config.rs +++ b/alligator_render/src/config.rs @@ -166,7 +166,7 @@ impl<'a> RenderWindowConfig<'a> { &self, supported_present_modes: &[wgpu::PresentMode], supported_alpha_modes: &[wgpu::CompositeAlphaMode], - texture_format: wgpu::TextureFormat, + supported_texture_formats: Vec, ) -> wgpu::SurfaceConfiguration { let present_mode = Self::present_mode(self.vsync, supported_present_modes); let alpha_mode = Self::alpha_mode(supported_alpha_modes); @@ -174,12 +174,12 @@ impl<'a> RenderWindowConfig<'a> { // configuration for the surface wgpu::SurfaceConfiguration { usage: wgpu::TextureUsages::RENDER_ATTACHMENT, - format: texture_format, + format: supported_texture_formats[0], width: self.default_width.get(), height: self.default_height.get(), alpha_mode, present_mode, - view_formats: vec![texture_format], + view_formats: supported_texture_formats, } } diff --git a/alligator_render/src/renderer.rs b/alligator_render/src/renderer.rs index 98c772a..a7d952a 100644 --- a/alligator_render/src/renderer.rs +++ b/alligator_render/src/renderer.rs @@ -184,10 +184,11 @@ impl Renderer { let capabilities = surface.get_capabilities(&adapter); let supported_present_modes = capabilities.present_modes.into_boxed_slice(); let supported_alpha_modes = capabilities.alpha_modes.into_boxed_slice(); + let supported_texture_formats = capabilities.formats; let surface_config = config.to_surface_configuration( &supported_present_modes, &supported_alpha_modes, - capabilities.formats[0], + supported_texture_formats, ); surface.configure(&device, &surface_config); diff --git a/alligator_render/src/texture.rs b/alligator_render/src/texture.rs index e2021f8..b60eade 100644 --- a/alligator_render/src/texture.rs +++ b/alligator_render/src/texture.rs @@ -116,7 +116,7 @@ impl TextureAtlas { mip_level_count: 1, sample_count: 1, dimension: wgpu::TextureDimension::D2, - format: wgpu::TextureFormat::Rgba8UnormSrgb, + format: wgpu::TextureFormat::Rgba8Unorm, usage: wgpu::TextureUsages::TEXTURE_BINDING | wgpu::TextureUsages::COPY_DST, view_formats: &[wgpu::TextureFormat::Rgba8UnormSrgb], }); -- cgit v1.2.3