@@ -71,6 +71,31 @@ impl super::CommandEncoder {
71
71
}
72
72
} )
73
73
}
74
+
75
+ fn make_temp_texture_view (
76
+ & mut self ,
77
+ key : super :: TempTextureViewKey ,
78
+ ) -> Result < vk:: ImageView , crate :: DeviceError > {
79
+ Ok ( match self . temp_texture_views . entry ( key) {
80
+ Entry :: Occupied ( e) => * e. get ( ) ,
81
+ Entry :: Vacant ( e) => {
82
+ let vk_info = vk:: ImageViewCreateInfo :: default ( )
83
+ . image ( e. key ( ) . texture )
84
+ . view_type ( vk:: ImageViewType :: TYPE_2D )
85
+ . format ( e. key ( ) . format )
86
+ . subresource_range ( vk:: ImageSubresourceRange {
87
+ aspect_mask : vk:: ImageAspectFlags :: COLOR ,
88
+ base_mip_level : e. key ( ) . mip_level ,
89
+ level_count : 1 ,
90
+ base_array_layer : e. key ( ) . depth_slice ,
91
+ layer_count : 1 ,
92
+ } ) ;
93
+ let raw = unsafe { self . device . raw . create_image_view ( & vk_info, None ) }
94
+ . map_err ( super :: map_host_device_oom_and_ioca_err) ?;
95
+ * e. insert ( raw)
96
+ }
97
+ } )
98
+ }
74
99
}
75
100
76
101
impl crate :: CommandEncoder for super :: CommandEncoder {
@@ -747,6 +772,18 @@ impl crate::CommandEncoder for super::CommandEncoder {
747
772
748
773
for cat in desc. color_attachments {
749
774
if let Some ( cat) = cat. as_ref ( ) {
775
+ let color_view = if cat. target . view . dimension == wgt:: TextureViewDimension :: D3 {
776
+ let key = super :: TempTextureViewKey {
777
+ texture : cat. target . view . raw_texture ,
778
+ format : cat. target . view . raw_format ,
779
+ mip_level : cat. target . view . base_mip_level ,
780
+ depth_slice : cat. depth_slice . unwrap ( ) ,
781
+ } ;
782
+ self . make_temp_texture_view ( key) ?
783
+ } else {
784
+ cat. target . view . raw
785
+ } ;
786
+
750
787
vk_clear_values. push ( vk:: ClearValue {
751
788
color : unsafe { cat. make_vk_clear_color ( ) } ,
752
789
} ) ;
@@ -759,7 +796,7 @@ impl crate::CommandEncoder for super::CommandEncoder {
759
796
} ;
760
797
761
798
rp_key. colors . push ( Some ( color) ) ;
762
- fb_key. attachments . push ( cat . target . view . raw ) ;
799
+ fb_key. attachments . push ( color_view ) ;
763
800
if let Some ( ref at) = cat. resolve_target {
764
801
vk_clear_values. push ( unsafe { mem:: zeroed ( ) } ) ;
765
802
fb_key. attachments . push ( at. view . raw ) ;
0 commit comments