1
0
Fork 0
forked from wry/wry

vulkan: apply color space transforms to textures

This commit is contained in:
Julian Orth 2025-03-01 19:19:27 +01:00
parent c4d0fdd4bb
commit 8e65de91f9
12 changed files with 233 additions and 66 deletions

View file

@ -42,6 +42,7 @@ pub(super) struct PipelineCreateInfo {
pub(super) eotf: u32,
pub(super) oetf: u32,
pub(super) descriptor_set_layouts: ArrayVec<Rc<VulkanDescriptorSetLayout>, 2>,
pub(super) has_color_management_data: bool,
}
impl VulkanDevice {
@ -77,8 +78,8 @@ impl VulkanDevice {
};
let destroy_layout =
OnDrop(|| unsafe { self.device.destroy_pipeline_layout(pipeline_layout, None) });
let mut frag_spec_data = ArrayVec::<_, { 4 * 4 }>::new();
let mut frag_spec_entries = ArrayVec::<_, 4>::new();
let mut frag_spec_data = ArrayVec::<_, { 5 * 4 }>::new();
let mut frag_spec_entries = ArrayVec::<_, 5>::new();
let mut frag_spec_entry = |data: &[u8]| {
let entry = SpecializationMapEntry::default()
.constant_id(frag_spec_entries.len() as _)
@ -91,6 +92,7 @@ impl VulkanDevice {
frag_spec_entry(&(info.has_alpha_mult as u32).to_ne_bytes());
frag_spec_entry(&info.eotf.to_ne_bytes());
frag_spec_entry(&info.oetf.to_ne_bytes());
frag_spec_entry(&(info.has_color_management_data as u32).to_ne_bytes());
let frag_spec = SpecializationInfo::default()
.map_entries(&frag_spec_entries)
.data(&frag_spec_data);