Use Oklab color interpolation only with color::GAMMA_CORRECTION

This commit is contained in:
Héctor Ramón Jiménez 2023-09-07 07:24:32 +02:00
parent 2b746c7b25
commit 10d0b257f9
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
11 changed files with 544 additions and 489 deletions

View file

@ -1,3 +1,4 @@
use crate::graphics::color;
use crate::graphics::gradient;
use crate::quad::{self, Quad};
use crate::Buffer;
@ -78,7 +79,23 @@ impl Pipeline {
device.create_shader_module(wgpu::ShaderModuleDescriptor {
label: Some("iced_wgpu.quad.gradient.shader"),
source: wgpu::ShaderSource::Wgsl(std::borrow::Cow::Borrowed(
include_str!("../shader/quad.wgsl"),
if color::GAMMA_CORRECTION {
concat!(
include_str!("../shader/quad.wgsl"),
"\n",
include_str!("../shader/quad/gradient.wgsl"),
"\n",
include_str!("../shader/color/oklab.wgsl")
)
} else {
concat!(
include_str!("../shader/quad.wgsl"),
"\n",
include_str!("../shader/quad/gradient.wgsl"),
"\n",
include_str!("../shader/color/linear_rgb.wgsl")
)
},
)),
});