Skip to content

Commit b7baa4d

Browse files
committed
Added in check for web-colors.
1 parent 05e238e commit b7baa4d

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

wgpu/src/offscreen.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use crate::graphics::color;
12
use std::borrow::Cow;
23
use wgpu::util::DeviceExt;
34
use wgpu::vertex_attr_array;
@@ -123,7 +124,11 @@ impl Pipeline {
123124
module: &shader,
124125
entry_point: "fs_main",
125126
targets: &[Some(wgpu::ColorTargetState {
126-
format: wgpu::TextureFormat::Rgba8UnormSrgb,
127+
format: if color::GAMMA_CORRECTION {
128+
wgpu::TextureFormat::Rgba8UnormSrgb
129+
} else {
130+
wgpu::TextureFormat::Rgba8Unorm
131+
},
127132
blend: Some(wgpu::BlendState {
128133
color: wgpu::BlendComponent {
129134
src_factor: wgpu::BlendFactor::SrcAlpha,
@@ -171,7 +176,11 @@ impl Pipeline {
171176
mip_level_count: 1,
172177
sample_count: 1,
173178
dimension: wgpu::TextureDimension::D2,
174-
format: wgpu::TextureFormat::Rgba8UnormSrgb,
179+
format: if color::GAMMA_CORRECTION {
180+
wgpu::TextureFormat::Rgba8UnormSrgb
181+
} else {
182+
wgpu::TextureFormat::Rgba8Unorm
183+
},
175184
usage: wgpu::TextureUsages::RENDER_ATTACHMENT
176185
| wgpu::TextureUsages::COPY_SRC,
177186
view_formats: &[],

0 commit comments

Comments
 (0)