diff --git a/Cargo.toml b/Cargo.toml index 4602a8b5f14..74e16e0309f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -75,8 +75,10 @@ wgpu = { version = "27.0.0", path = "./wgpu", default-features = false, features "gles", "dx12", "metal", + "vulkan-portability", + "angle", "static-dxc", - "noop", # This should be removed if we ever have non-test crates that depend on wgpu + "noop", # This should be removed if we ever have non-test crates that depend on wgpu ] } wgpu-core = { version = "27.0.0", path = "./wgpu-core" } wgpu-hal = { version = "27.0.0", path = "./wgpu-hal" } diff --git a/examples/features/src/boids/mod.rs b/examples/features/src/boids/mod.rs index f48d02033d0..a0c827c8612 100644 --- a/examples/features/src/boids/mod.rs +++ b/examples/features/src/boids/mod.rs @@ -332,9 +332,7 @@ pub static TEST: crate::framework::ExampleTestParams = crate::framework::Example optional_features: wgpu::Features::default(), base_test_parameters: wgpu_test::TestParameters::default() .downlevel_flags(wgpu::DownlevelFlags::COMPUTE_SHADERS) - .limits(wgpu::Limits::downlevel_defaults()) - // Lots of validation errors, maybe related to https://github.com/gfx-rs/wgpu/issues/3160 - .expect_fail(wgpu_test::FailureCase::molten_vk()), + .limits(wgpu::Limits::downlevel_defaults()), comparisons: &[wgpu_test::ComparisonType::Mean(0.005)], _phantom: std::marker::PhantomData::, }; diff --git a/wgpu-hal/src/vulkan/adapter.rs b/wgpu-hal/src/vulkan/adapter.rs index f0069b768ef..06dd016bcfb 100644 --- a/wgpu-hal/src/vulkan/adapter.rs +++ b/wgpu-hal/src/vulkan/adapter.rs @@ -586,6 +586,7 @@ impl PhysicalDeviceFeatures { instance: &ash::Instance, phd: vk::PhysicalDevice, caps: &PhysicalDeviceProperties, + queue_props: &vk::QueueFamilyProperties, ) -> (wgt::Features, wgt::DownlevelFlags) { use wgt::{DownlevelFlags as Df, Features as F}; let mut features = F::empty() @@ -593,9 +594,6 @@ impl PhysicalDeviceFeatures { | F::IMMEDIATES | F::ADDRESS_MODE_CLAMP_TO_BORDER | F::ADDRESS_MODE_CLAMP_TO_ZERO - | F::TIMESTAMP_QUERY - | F::TIMESTAMP_QUERY_INSIDE_ENCODERS - | F::TIMESTAMP_QUERY_INSIDE_PASSES | F::TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES | F::CLEAR_TEXTURE | F::PIPELINE_CACHE @@ -637,6 +635,13 @@ impl PhysicalDeviceFeatures { ); dl_flags.set(Df::DEPTH_BIAS_CLAMP, self.core.depth_bias_clamp != 0); + features.set( + F::TIMESTAMP_QUERY + | F::TIMESTAMP_QUERY_INSIDE_ENCODERS + | F::TIMESTAMP_QUERY_INSIDE_PASSES, + // Vulkan strictly defines this as either 36-64, or zero. + queue_props.timestamp_valid_bits >= 36, + ); features.set( F::INDIRECT_FIRST_INSTANCE, self.core.draw_indirect_first_instance != 0, @@ -1813,8 +1818,6 @@ impl super::Instance { .unwrap_or(wgt::MAXIMUM_SUBGROUP_MAX_SIZE), transient_saves_memory: supports_lazily_allocated, }; - let (available_features, mut downlevel_flags) = - phd_features.to_wgpu(&self.shared.raw, phd, &phd_capabilities); let mut workarounds = super::Workarounds::empty(); { // TODO: only enable for particular devices @@ -1829,15 +1832,6 @@ impl super::Instance { ); }; - if info.driver == "llvmpipe" { - // The `F16_IN_F32` instructions do not normally require native `F16` support, but on - // llvmpipe, they do. - downlevel_flags.set( - wgt::DownlevelFlags::SHADER_F16_IN_F32, - available_features.contains(wgt::Features::SHADER_F16), - ); - } - if let Some(driver) = phd_capabilities.driver { if driver.conformance_version.major == 0 { if driver.driver_id == vk::DriverId::MOLTENVK { @@ -1881,12 +1875,29 @@ impl super::Instance { .raw .get_physical_device_queue_family_properties(phd) }; - let queue_flags = queue_families.first()?.queue_flags; + let queue_family_properties = queue_families.first()?; + let queue_flags = queue_family_properties.queue_flags; if !queue_flags.contains(vk::QueueFlags::GRAPHICS) { log::debug!("The first queue only exposes {queue_flags:?}"); return None; } + let (available_features, mut downlevel_flags) = phd_features.to_wgpu( + &self.shared.raw, + phd, + &phd_capabilities, + queue_family_properties, + ); + + if info.driver == "llvmpipe" { + // The `F16_IN_F32` instructions do not normally require native `F16` support, but on + // llvmpipe, they do. + downlevel_flags.set( + wgt::DownlevelFlags::SHADER_F16_IN_F32, + available_features.contains(wgt::Features::SHADER_F16), + ); + } + let private_caps = super::PrivateCapabilities { image_view_usage: phd_capabilities.device_api_version >= vk::API_VERSION_1_1 || phd_capabilities.supports_extension(khr::maintenance2::NAME),