vulkan-tutorial-rs
vulkan-tutorial-rs copied to clipboard
26 depth buffering
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
}