1
0
Fork 0
forked from wry/wry

color-management: use more consistent naming

This commit is contained in:
Julian Orth 2025-09-05 13:45:09 +02:00
parent 32db933242
commit 83e79b68e6
65 changed files with 439 additions and 510 deletions

View file

@ -3,7 +3,7 @@ use {
async_engine::{AsyncEngine, SpawnedFuture},
cmm::{
cmm_description::{ColorDescription, LinearColorDescription, LinearColorDescriptionId},
cmm_transfer_function::TransferFunction,
cmm_eotf::Eotf,
cmm_transform::ColorMatrix,
},
cpu_worker::PendingJob,
@ -19,6 +19,7 @@ use {
descriptor::VulkanDescriptorSetLayout,
descriptor_buffer::VulkanDescriptorBufferWriter,
device::VulkanDevice,
eotfs::{EOTF_LINEAR, EotfExt},
fence::VulkanFence,
image::{QueueFamily, QueueState, QueueTransfer, VulkanImage, VulkanImageMemory},
pipeline::{PipelineCreateInfo, VulkanPipeline},
@ -30,7 +31,6 @@ use {
OUT_FRAG, OUT_VERT, OutPushConstants, TEX_FRAG, TEX_VERT, TexColorManagementData,
TexPushConstants, TexVertex, VulkanShader,
},
transfer_functions::{TF_LINEAR, TransferFunctionExt},
},
io_uring::IoUring,
rect::{Rect, Region},
@ -78,10 +78,8 @@ pub struct VulkanRenderer {
pub(super) formats: Rc<AHashMap<u32, GfxFormat>>,
pub(super) device: Rc<VulkanDevice>,
pub(super) fill_pipelines: CopyHashMap<vk::Format, FillPipelines>,
pub(super) tex_pipelines:
StaticMap<TransferFunction, CopyHashMap<vk::Format, Rc<TexPipelines>>>,
pub(super) out_pipelines:
StaticMap<TransferFunction, CopyHashMap<OutPipelineKey, Rc<VulkanPipeline>>>,
pub(super) tex_pipelines: StaticMap<Eotf, CopyHashMap<vk::Format, Rc<TexPipelines>>>,
pub(super) out_pipelines: StaticMap<Eotf, CopyHashMap<OutPipelineKey, Rc<VulkanPipeline>>>,
pub(super) gfx_command_buffers: CachedCommandBuffers,
pub(super) transfer_command_buffers: Option<CachedCommandBuffers>,
pub(super) wait_semaphores: Stack<Rc<VulkanSemaphore>>,
@ -247,20 +245,20 @@ type FillPipelines = Rc<StaticMap<TexSourceType, Rc<VulkanPipeline>>>;
struct TexPipelineKey {
tex_copy_type: TexCopyType,
tex_source_type: TexSourceType,
eotf: TransferFunction,
eotf: Eotf,
has_color_management_data: bool,
}
pub(super) struct TexPipelines {
format: vk::Format,
oetf: TransferFunction,
eotf: Eotf,
pipelines: CopyHashMap<TexPipelineKey, Rc<VulkanPipeline>>,
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
pub(super) struct OutPipelineKey {
format: vk::Format,
eotf: TransferFunction,
eotf: Eotf,
}
impl VulkanDevice {
@ -417,8 +415,8 @@ impl VulkanRenderer {
src_has_alpha,
has_alpha_mult: false,
// all transformations are applied in the compositor
eotf: TF_LINEAR,
oetf: TF_LINEAR,
eotf: EOTF_LINEAR,
inv_eotf: EOTF_LINEAR,
descriptor_set_layouts: Default::default(),
has_color_management_data: false,
};
@ -437,13 +435,13 @@ impl VulkanRenderer {
format: vk::Format,
target_cd: &ColorDescription,
) -> Rc<TexPipelines> {
let pipelines = &self.tex_pipelines[target_cd.transfer_function];
let pipelines = &self.tex_pipelines[target_cd.eotf];
match pipelines.get(&format) {
Some(pl) => pl,
_ => {
let pl = Rc::new(TexPipelines {
format,
oetf: target_cd.transfer_function,
eotf: target_cd.eotf,
pipelines: Default::default(),
});
pipelines.set(format, pl.clone());
@ -463,7 +461,7 @@ impl VulkanRenderer {
let key = TexPipelineKey {
tex_copy_type,
tex_source_type,
eotf: tex_cd.transfer_function,
eotf: tex_cd.eotf,
has_color_management_data,
};
if let Some(pl) = pipelines.pipelines.get(&key) {
@ -490,7 +488,7 @@ impl VulkanRenderer {
src_has_alpha,
has_alpha_mult,
eotf: key.eotf.to_vulkan(),
oetf: pipelines.oetf.to_vulkan(),
inv_eotf: pipelines.eotf.to_vulkan(),
descriptor_set_layouts: self.tex_descriptor_set_layouts.clone(),
has_color_management_data,
};
@ -507,9 +505,9 @@ impl VulkanRenderer {
) -> Result<Rc<VulkanPipeline>, VulkanError> {
let key = OutPipelineKey {
format,
eotf: bb_cd.transfer_function,
eotf: bb_cd.eotf,
};
let pipelines = &self.out_pipelines[fb_cd.transfer_function];
let pipelines = &self.out_pipelines[fb_cd.eotf];
if let Some(pl) = pipelines.get(&key) {
return Ok(pl);
}
@ -525,7 +523,7 @@ impl VulkanRenderer {
src_has_alpha: true,
has_alpha_mult: false,
eotf: key.eotf.to_vulkan(),
oetf: fb_cd.transfer_function.to_vulkan(),
inv_eotf: fb_cd.eotf.to_vulkan(),
descriptor_set_layouts,
has_color_management_data: false,
})?;
@ -725,7 +723,7 @@ impl VulkanRenderer {
RenderPass::BlendBuffer => blend_cd,
RenderPass::FrameBuffer => fb_cd,
};
let tf = target_cd.transfer_function;
let tf = target_cd.eotf;
let color = memory
.color_transforms
.apply_to_color(&fr.cd, target_cd, fr.color);
@ -1047,7 +1045,7 @@ impl VulkanRenderer {
.apply_to_color(clear_cd, target_cd, *clear);
let clear_value = ClearValue {
color: ClearColorValue {
float32: color.to_array(target_cd.transfer_function),
float32: color.to_array(target_cd.eotf),
},
};
let use_load_clear = clear_rects.len() == 1 && {