Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
4 changes: 1 addition & 3 deletions examples/features/src/boids/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Example>,
};
41 changes: 26 additions & 15 deletions wgpu-hal/src/vulkan/adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -586,16 +586,14 @@ 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()
| F::MAPPABLE_PRIMARY_BUFFERS
| 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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand All @@ -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 {
Expand Down Expand Up @@ -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),
Expand Down