Added in check for web-colors.
This commit is contained in:
parent
05e238e9ed
commit
af099fa6d7
1 changed files with 16 additions and 7 deletions
|
|
@ -1,3 +1,4 @@
|
||||||
|
use crate::graphics::color;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use wgpu::util::DeviceExt;
|
use wgpu::util::DeviceExt;
|
||||||
use wgpu::vertex_attr_array;
|
use wgpu::vertex_attr_array;
|
||||||
|
|
@ -16,7 +17,7 @@ pub struct Pipeline {
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
struct Vertex {
|
struct Vertex {
|
||||||
ndc: [f32; 2],
|
ndc: [f32; 2],
|
||||||
texel: [f32; 2],
|
uv: [f32; 2],
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Pipeline {
|
impl Pipeline {
|
||||||
|
|
@ -36,22 +37,22 @@ impl Pipeline {
|
||||||
//bottom left
|
//bottom left
|
||||||
Vertex {
|
Vertex {
|
||||||
ndc: [-1.0, -1.0],
|
ndc: [-1.0, -1.0],
|
||||||
texel: [0.0, 1.0],
|
uv: [0.0, 1.0],
|
||||||
},
|
},
|
||||||
//bottom right
|
//bottom right
|
||||||
Vertex {
|
Vertex {
|
||||||
ndc: [1.0, -1.0],
|
ndc: [1.0, -1.0],
|
||||||
texel: [1.0, 1.0],
|
uv: [1.0, 1.0],
|
||||||
},
|
},
|
||||||
//top right
|
//top right
|
||||||
Vertex {
|
Vertex {
|
||||||
ndc: [1.0, 1.0],
|
ndc: [1.0, 1.0],
|
||||||
texel: [1.0, 0.0],
|
uv: [1.0, 0.0],
|
||||||
},
|
},
|
||||||
//top left
|
//top left
|
||||||
Vertex {
|
Vertex {
|
||||||
ndc: [-1.0, 1.0],
|
ndc: [-1.0, 1.0],
|
||||||
texel: [0.0, 0.0],
|
uv: [0.0, 0.0],
|
||||||
},
|
},
|
||||||
]),
|
]),
|
||||||
usage: wgpu::BufferUsages::VERTEX,
|
usage: wgpu::BufferUsages::VERTEX,
|
||||||
|
|
@ -123,7 +124,11 @@ impl Pipeline {
|
||||||
module: &shader,
|
module: &shader,
|
||||||
entry_point: "fs_main",
|
entry_point: "fs_main",
|
||||||
targets: &[Some(wgpu::ColorTargetState {
|
targets: &[Some(wgpu::ColorTargetState {
|
||||||
format: wgpu::TextureFormat::Rgba8UnormSrgb,
|
format: if color::GAMMA_CORRECTION {
|
||||||
|
wgpu::TextureFormat::Rgba8UnormSrgb
|
||||||
|
} else {
|
||||||
|
wgpu::TextureFormat::Rgba8Unorm
|
||||||
|
},
|
||||||
blend: Some(wgpu::BlendState {
|
blend: Some(wgpu::BlendState {
|
||||||
color: wgpu::BlendComponent {
|
color: wgpu::BlendComponent {
|
||||||
src_factor: wgpu::BlendFactor::SrcAlpha,
|
src_factor: wgpu::BlendFactor::SrcAlpha,
|
||||||
|
|
@ -171,7 +176,11 @@ impl Pipeline {
|
||||||
mip_level_count: 1,
|
mip_level_count: 1,
|
||||||
sample_count: 1,
|
sample_count: 1,
|
||||||
dimension: wgpu::TextureDimension::D2,
|
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
|
usage: wgpu::TextureUsages::RENDER_ATTACHMENT
|
||||||
| wgpu::TextureUsages::COPY_SRC,
|
| wgpu::TextureUsages::COPY_SRC,
|
||||||
view_formats: &[],
|
view_formats: &[],
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue