Skip to content

Commit f09e1e7

Browse files
committed
Follow the suggestion
1 parent 416e525 commit f09e1e7

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

wgpu-core/src/device/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -852,7 +852,7 @@ impl<A: HalApi> Device<A> {
852852
));
853853
}
854854

855-
let mut hal_view_formats = vec![desc.format];
855+
let mut hal_view_formats = vec![];
856856
for format in desc.view_formats.iter() {
857857
if desc.format == *format {
858858
continue;

wgpu-hal/src/vulkan/device.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -895,8 +895,9 @@ impl crate::Device<super::Api> for super::Device {
895895
raw_flags |= vk::ImageCreateFlags::CUBE_COMPATIBLE;
896896
}
897897

898+
let original_format = self.shared.private_caps.map_texture_format(desc.format);
898899
let mut hal_view_formats: Vec<vk::Format> = vec![];
899-
if !desc.view_formats.len() > 1 {
900+
if !desc.view_formats.is_empty() {
900901
raw_flags |= vk::ImageCreateFlags::MUTABLE_FORMAT;
901902
if self.shared_instance().driver_api_version >= vk::API_VERSION_1_2
902903
|| self
@@ -908,13 +909,14 @@ impl crate::Device<super::Api> for super::Device {
908909
.iter()
909910
.map(|f| self.shared.private_caps.map_texture_format(*f))
910911
.collect();
912+
hal_view_formats.push(original_format)
911913
}
912914
}
913915

914916
let mut vk_info = vk::ImageCreateInfo::builder()
915917
.flags(raw_flags)
916918
.image_type(conv::map_texture_dimension(desc.dimension))
917-
.format(self.shared.private_caps.map_texture_format(desc.format))
919+
.format(original_format)
918920
.extent(vk::Extent3D {
919921
width: copy_size.width,
920922
height: copy_size.height,

0 commit comments

Comments
 (0)