summaryrefslogtreecommitdiffstats
path: root/wgpu
diff options
context:
space:
mode:
authorLibravatar Bingus <shankern@protonmail.com>2023-06-08 10:17:53 -0700
committerLibravatar Bingus <shankern@protonmail.com>2023-06-08 10:29:38 -0700
commitaf099fa6d72d9c3e23c85a36aee14904526d02f0 (patch)
treeba48471edaa57c81ee1ad69b00ec31d4dbc9ad89 /wgpu
parent05e238e9ed5f0c6cade87228f8f3044ee26df756 (diff)
downloadiced-af099fa6d72d9c3e23c85a36aee14904526d02f0.tar.gz
iced-af099fa6d72d9c3e23c85a36aee14904526d02f0.tar.bz2
iced-af099fa6d72d9c3e23c85a36aee14904526d02f0.zip
Added in check for web-colors.
Diffstat (limited to '')
-rw-r--r--wgpu/src/offscreen.rs23
1 files changed, 16 insertions, 7 deletions
diff --git a/wgpu/src/offscreen.rs b/wgpu/src/offscreen.rs
index d0758b66..baa069e8 100644
--- a/wgpu/src/offscreen.rs
+++ b/wgpu/src/offscreen.rs
@@ -1,3 +1,4 @@
+use crate::graphics::color;
use std::borrow::Cow;
use wgpu::util::DeviceExt;
use wgpu::vertex_attr_array;
@@ -16,7 +17,7 @@ pub struct Pipeline {
#[repr(C)]
struct Vertex {
ndc: [f32; 2],
- texel: [f32; 2],
+ uv: [f32; 2],
}
impl Pipeline {
@@ -36,22 +37,22 @@ impl Pipeline {
//bottom left
Vertex {
ndc: [-1.0, -1.0],
- texel: [0.0, 1.0],
+ uv: [0.0, 1.0],
},
//bottom right
Vertex {
ndc: [1.0, -1.0],
- texel: [1.0, 1.0],
+ uv: [1.0, 1.0],
},
//top right
Vertex {
ndc: [1.0, 1.0],
- texel: [1.0, 0.0],
+ uv: [1.0, 0.0],
},
//top left
Vertex {
ndc: [-1.0, 1.0],
- texel: [0.0, 0.0],
+ uv: [0.0, 0.0],
},
]),
usage: wgpu::BufferUsages::VERTEX,
@@ -123,7 +124,11 @@ impl Pipeline {
module: &shader,
entry_point: "fs_main",
targets: &[Some(wgpu::ColorTargetState {
- format: wgpu::TextureFormat::Rgba8UnormSrgb,
+ format: if color::GAMMA_CORRECTION {
+ wgpu::TextureFormat::Rgba8UnormSrgb
+ } else {
+ wgpu::TextureFormat::Rgba8Unorm
+ },
blend: Some(wgpu::BlendState {
color: wgpu::BlendComponent {
src_factor: wgpu::BlendFactor::SrcAlpha,
@@ -171,7 +176,11 @@ impl Pipeline {
mip_level_count: 1,
sample_count: 1,
dimension: wgpu::TextureDimension::D2,
- format: wgpu::TextureFormat::Rgba8UnormSrgb,
+ format: if color::GAMMA_CORRECTION {
+ wgpu::TextureFormat::Rgba8UnormSrgb
+ } else {
+ wgpu::TextureFormat::Rgba8Unorm
+ },
usage: wgpu::TextureUsages::RENDER_ATTACHMENT
| wgpu::TextureUsages::COPY_SRC,
view_formats: &[],