mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
hal/vk: require storage buffer class as the device extension, not instance
This commit is contained in:
@@ -557,6 +557,9 @@ impl PhysicalDeviceCapabilities {
|
||||
extensions.push(vk::KhrMaintenance1Fn::name());
|
||||
extensions.push(vk::KhrMaintenance2Fn::name());
|
||||
|
||||
// `VK_KHR_storage_buffer_storage_class` required for Naga on Vulkan 1.0 devices
|
||||
extensions.push(vk::KhrStorageBufferStorageClassFn::name());
|
||||
|
||||
// Below Vulkan 1.1 we can get multiview from an extension
|
||||
if requested_features.contains(wgt::Features::MULTIVIEW) {
|
||||
extensions.push(vk::KhrMultiviewFn::name());
|
||||
@@ -904,9 +907,18 @@ impl super::Instance {
|
||||
workarounds |= super::Workarounds::SEPARATE_ENTRY_POINTS;
|
||||
};
|
||||
|
||||
if phd_capabilities.properties.api_version == vk::API_VERSION_1_0
|
||||
&& !phd_capabilities.supports_extension(vk::KhrStorageBufferStorageClassFn::name())
|
||||
{
|
||||
log::warn!(
|
||||
"SPIR-V storage buffer class is not supported, hiding adapter: {}",
|
||||
info.name
|
||||
);
|
||||
return None;
|
||||
}
|
||||
if phd_features.core.sample_rate_shading == 0 {
|
||||
log::error!(
|
||||
"sample_rate_shading feature is not supported, hiding the adapter: {}",
|
||||
log::warn!(
|
||||
"sample_rate_shading feature is not supported, hiding adapter: {}",
|
||||
info.name
|
||||
);
|
||||
return None;
|
||||
@@ -915,8 +927,8 @@ impl super::Instance {
|
||||
&& !phd_capabilities.supports_extension(vk::KhrMaintenance1Fn::name())
|
||||
&& phd_capabilities.properties.api_version < vk::API_VERSION_1_2
|
||||
{
|
||||
log::error!(
|
||||
"viewport Y-flip is not supported, hiding the adapter: {}",
|
||||
log::warn!(
|
||||
"viewport Y-flip is not supported, hiding adapter: {}",
|
||||
info.name
|
||||
);
|
||||
return None;
|
||||
|
||||
@@ -121,7 +121,6 @@ impl super::Swapchain {
|
||||
impl super::Instance {
|
||||
pub fn required_extensions(
|
||||
entry: &ash::Entry,
|
||||
driver_api_version: u32,
|
||||
flags: crate::InstanceFlags,
|
||||
) -> Result<Vec<&'static CStr>, crate::InstanceError> {
|
||||
let instance_extensions = entry
|
||||
@@ -161,11 +160,6 @@ impl super::Instance {
|
||||
|
||||
extensions.push(vk::KhrGetPhysicalDeviceProperties2Fn::name());
|
||||
|
||||
// VK_KHR_storage_buffer_storage_class required for `Naga` on Vulkan 1.0 devices
|
||||
if driver_api_version == vk::API_VERSION_1_0 {
|
||||
extensions.push(vk::KhrStorageBufferStorageClassFn::name());
|
||||
}
|
||||
|
||||
// Only keep available extensions.
|
||||
extensions.retain(|&ext| {
|
||||
if instance_extensions
|
||||
@@ -190,19 +184,11 @@ impl super::Instance {
|
||||
pub unsafe fn from_raw(
|
||||
entry: ash::Entry,
|
||||
raw_instance: ash::Instance,
|
||||
driver_api_version: u32,
|
||||
extensions: Vec<&'static CStr>,
|
||||
flags: crate::InstanceFlags,
|
||||
has_nv_optimus: bool,
|
||||
drop_guard: Option<super::DropGuard>,
|
||||
) -> Result<Self, crate::InstanceError> {
|
||||
if driver_api_version == vk::API_VERSION_1_0
|
||||
&& !extensions.contains(&vk::KhrStorageBufferStorageClassFn::name())
|
||||
{
|
||||
log::warn!("Required VK_KHR_storage_buffer_storage_class extension is not supported");
|
||||
return Err(crate::InstanceError);
|
||||
}
|
||||
|
||||
let debug_utils = if extensions.contains(&ext::DebugUtils::name()) {
|
||||
let extension = ext::DebugUtils::new(&entry, &raw_instance);
|
||||
let vk_info = vk::DebugUtilsMessengerCreateInfoEXT::builder()
|
||||
@@ -473,7 +459,7 @@ impl crate::Instance<super::Api> for super::Instance {
|
||||
})
|
||||
});
|
||||
|
||||
let extensions = Self::required_extensions(&entry, driver_api_version, desc.flags)?;
|
||||
let extensions = Self::required_extensions(&entry, desc.flags)?;
|
||||
|
||||
let instance_layers = entry.enumerate_instance_layer_properties().map_err(|e| {
|
||||
log::info!("enumerate_instance_layer_properties: {:?}", e);
|
||||
@@ -532,7 +518,6 @@ impl crate::Instance<super::Api> for super::Instance {
|
||||
Self::from_raw(
|
||||
entry,
|
||||
vk_instance,
|
||||
driver_api_version,
|
||||
extensions,
|
||||
desc.flags,
|
||||
has_nv_optimus,
|
||||
|
||||
Reference in New Issue
Block a user