mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-19 14:01:08 +01:00
Properly detect timestamp query feature on vulkan
This commit is contained in:
1 parent
621919ca84
commit
ea792d30fe
1 file changed
+26
-15
@@ -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,
|
||||
@@ -1807,8 +1812,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
|
||||
@@ -1823,15 +1826,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 {
|
||||
@@ -1875,12 +1869,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),
|
||||
|
||||
Reference in new issue
Block a user