Skip to content

Commit

Permalink
wip: remove image format list
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaopengli89 committed Dec 5, 2023
1 parent 537f656 commit 09ab788
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
18 changes: 1 addition & 17 deletions wgpu-hal/src/vulkan/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -973,24 +973,14 @@ impl crate::Device<super::Api> for super::Device {
}

let original_format = self.shared.private_caps.map_texture_format(desc.format);
let mut vk_view_formats = vec![];
let mut wgt_view_formats = vec![];
if !desc.view_formats.is_empty() {
raw_flags |= vk::ImageCreateFlags::MUTABLE_FORMAT;
wgt_view_formats = desc.view_formats.clone();
wgt_view_formats.push(desc.format);

if self.shared.private_caps.image_format_list {
vk_view_formats = desc
.view_formats
.iter()
.map(|f| self.shared.private_caps.map_texture_format(*f))
.collect();
vk_view_formats.push(original_format)
}
}

let mut vk_info = vk::ImageCreateInfo::builder()
let vk_info = vk::ImageCreateInfo::builder()
.flags(raw_flags)
.image_type(conv::map_texture_dimension(desc.dimension))
.format(original_format)
Expand All @@ -1003,12 +993,6 @@ impl crate::Device<super::Api> for super::Device {
.sharing_mode(vk::SharingMode::EXCLUSIVE)
.initial_layout(vk::ImageLayout::UNDEFINED);

let mut format_list_info = vk::ImageFormatListCreateInfo::builder();
if !vk_view_formats.is_empty() {
format_list_info = format_list_info.view_formats(&vk_view_formats);
vk_info = vk_info.push_next(&mut format_list_info);
}

let raw = unsafe { self.shared.raw.create_image(&vk_info, None)? };
let req = unsafe { self.shared.raw.get_image_memory_requirements(raw) };

Expand Down
1 change: 1 addition & 0 deletions wgpu-hal/src/vulkan/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ struct PrivateCapabilities {
robust_buffer_access2: bool,
robust_image_access2: bool,
zero_initialize_workgroup_memory: bool,
#[allow(dead_code)]
image_format_list: bool,
}

Expand Down

0 comments on commit 09ab788

Please sign in to comment.