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

@ -487,8 +487,10 @@ mod solid {
device.create_shader_module(wgpu::ShaderModuleDescriptor {
label: Some("iced_wgpu.triangle.solid.shader"),
source: wgpu::ShaderSource::Wgsl(
std::borrow::Cow::Borrowed(include_str!(
"shader/triangle.wgsl"
std::borrow::Cow::Borrowed(concat!(
include_str!("shader/triangle.wgsl"),
"\n",
include_str!("shader/triangle/solid.wgsl"),
)),
),
});
@ -537,6 +539,7 @@ mod solid {
}
mod gradient {
use crate::graphics::color;
use crate::graphics::mesh;
use crate::graphics::Antialiasing;
use crate::triangle;
@ -633,9 +636,31 @@ mod gradient {
device.create_shader_module(wgpu::ShaderModuleDescriptor {
label: Some("iced_wgpu.triangle.gradient.shader"),
source: wgpu::ShaderSource::Wgsl(
std::borrow::Cow::Borrowed(include_str!(
"shader/triangle.wgsl"
)),
std::borrow::Cow::Borrowed(
if color::GAMMA_CORRECTION {
concat!(
include_str!("shader/triangle.wgsl"),
"\n",
include_str!(
"shader/triangle/gradient.wgsl"
),
"\n",
include_str!("shader/color/oklab.wgsl")
)
} else {
concat!(
include_str!("shader/triangle.wgsl"),
"\n",
include_str!(
"shader/triangle/gradient.wgsl"
),
"\n",
include_str!(
"shader/color/linear_rgb.wgsl"
)
)
},
),
),
});