fix: vulkan only uses robust_*_access2 if the driver supports it (#3962)

This commit is contained in:
Schell Carl Scivally
2023-07-23 15:52:44 +12:00
committed by GitHub
parent 9b10afd6b8
commit 8417eff6bc
2 changed files with 15 additions and 3 deletions

View File

@@ -234,11 +234,11 @@ impl PhysicalDeviceFeatures {
robustness2: if enabled_extensions.contains(&vk::ExtRobustness2Fn::name()) {
// Note: enabling `robust_buffer_access2` isn't requires, strictly speaking
// since we can enable `robust_buffer_access` all the time. But it improves
// program portability, so we opt into it anyway.
// program portability, so we opt into it if they are supported.
Some(
vk::PhysicalDeviceRobustness2FeaturesEXT::builder()
.robust_buffer_access2(private_caps.robust_buffer_access)
.robust_image_access2(private_caps.robust_image_access)
.robust_buffer_access2(private_caps.robust_buffer_access2)
.robust_image_access2(private_caps.robust_image_access2)
.build(),
)
} else {
@@ -1063,6 +1063,16 @@ impl super::Instance {
.image_robustness
.map_or(false, |ext| ext.robust_image_access != 0),
},
robust_buffer_access2: phd_features
.robustness2
.as_ref()
.map(|r| r.robust_buffer_access2 == 1)
.unwrap_or_default(),
robust_image_access2: phd_features
.robustness2
.as_ref()
.map(|r| r.robust_image_access2 == 1)
.unwrap_or_default(),
zero_initialize_workgroup_memory: phd_features
.zero_initialize_workgroup_memory
.map_or(false, |ext| {

View File

@@ -189,6 +189,8 @@ struct PrivateCapabilities {
non_coherent_map_mask: wgt::BufferAddress,
robust_buffer_access: bool,
robust_image_access: bool,
robust_buffer_access2: bool,
robust_image_access2: bool,
zero_initialize_workgroup_memory: bool,
}