Fix screenshots on Wayland + Nvidia (#8701)
# Objective Fix #8604 ## Solution Use `.add_srgb_suffix()` when creating the screenshot texture. Allow converting `Bgra8Unorm` images. Only a two line change for the fix, the `screenshot.rs` changes are just a bit of cleanup.
This commit is contained in:
parent
d628ae808f
commit
5e3ae770ac
@ -199,7 +199,7 @@ impl Image {
|
|||||||
.map(DynamicImage::ImageRgba8),
|
.map(DynamicImage::ImageRgba8),
|
||||||
// This format is commonly used as the format for the swapchain texture
|
// This format is commonly used as the format for the swapchain texture
|
||||||
// This conversion is added here to support screenshots
|
// This conversion is added here to support screenshots
|
||||||
TextureFormat::Bgra8UnormSrgb => ImageBuffer::from_raw(
|
TextureFormat::Bgra8UnormSrgb | TextureFormat::Bgra8Unorm => ImageBuffer::from_raw(
|
||||||
self.texture_descriptor.size.width,
|
self.texture_descriptor.size.width,
|
||||||
self.texture_descriptor.size.height,
|
self.texture_descriptor.size.height,
|
||||||
{
|
{
|
||||||
|
|||||||
@ -377,7 +377,7 @@ pub fn prepare_windows(
|
|||||||
mip_level_count: 1,
|
mip_level_count: 1,
|
||||||
sample_count: 1,
|
sample_count: 1,
|
||||||
dimension: wgpu::TextureDimension::D2,
|
dimension: wgpu::TextureDimension::D2,
|
||||||
format: surface_configuration.format,
|
format: surface_configuration.format.add_srgb_suffix(),
|
||||||
usage: TextureUsages::RENDER_ATTACHMENT
|
usage: TextureUsages::RENDER_ATTACHMENT
|
||||||
| TextureUsages::COPY_SRC
|
| TextureUsages::COPY_SRC
|
||||||
| TextureUsages::TEXTURE_BINDING,
|
| TextureUsages::TEXTURE_BINDING,
|
||||||
|
|||||||
@ -234,16 +234,11 @@ impl SpecializedRenderPipeline for ScreenshotToScreenPipeline {
|
|||||||
shader: SCREENSHOT_SHADER_HANDLE.typed(),
|
shader: SCREENSHOT_SHADER_HANDLE.typed(),
|
||||||
},
|
},
|
||||||
primitive: wgpu::PrimitiveState {
|
primitive: wgpu::PrimitiveState {
|
||||||
topology: wgpu::PrimitiveTopology::TriangleList,
|
|
||||||
strip_index_format: None,
|
|
||||||
front_face: wgpu::FrontFace::Ccw,
|
|
||||||
cull_mode: Some(wgpu::Face::Back),
|
cull_mode: Some(wgpu::Face::Back),
|
||||||
polygon_mode: wgpu::PolygonMode::Fill,
|
..Default::default()
|
||||||
conservative: false,
|
|
||||||
unclipped_depth: false,
|
|
||||||
},
|
},
|
||||||
depth_stencil: None,
|
depth_stencil: None,
|
||||||
multisample: wgpu::MultisampleState::default(),
|
multisample: Default::default(),
|
||||||
fragment: Some(FragmentState {
|
fragment: Some(FragmentState {
|
||||||
shader: SCREENSHOT_SHADER_HANDLE.typed(),
|
shader: SCREENSHOT_SHADER_HANDLE.typed(),
|
||||||
entry_point: Cow::Borrowed("fs_main"),
|
entry_point: Cow::Borrowed("fs_main"),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user