vulkan-tutorial-rs icon indicating copy to clipboard operation
vulkan-tutorial-rs copied to clipboard

26 depth buffering

Open matthew-russo opened this issue 6 years ago • 1 comments

matthew-russo avatar Feb 10 '19 17:02 matthew-russo

The properties of a format can be access using the properties method on a format object, hence one can in fact query for supported formats with something like this:

fn find_depth_format(physical_device: &PhysicalDevice) -> Format {          
         // Check for availablility of these formats                             
         let formats = vec![Format::D32Sfloat, Format::D32Sfloat_S8Uint, Format::D24Unorm_S8Uint];
                                                                                 
         for format in formats.iter() {                                          
             let properties = format.properties(*physical_device);               
                                                                                 
            if properties.optimal_tiling_features.depth_stencil_attachment {    
                return *format;                                                 
            }                                                                   
       }                                                                       
                                                                               
       return Format::D16Unorm                                                 
}

mortzdk avatar Mar 24 '21 07:03 mortzdk