-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add MULTISAMPLE_ARRAY feature flag.
#8571
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Changes from all commits
5e05a96
2738c96
aa937c8
3bb4c09
af4ba15
cd59b23
0170194
446bc9e
486b3af
4a395a1
fd0cf14
a34c80c
c0229ce
7e83a5b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -130,6 +130,11 @@ pub struct PhysicalDeviceFeatures { | |
|
|
||
| /// Features provided by `VK_KHR_fragment_shader_barycentric` | ||
| shader_barycentrics: Option<vk::PhysicalDeviceFragmentShaderBarycentricFeaturesKHR<'static>>, | ||
|
|
||
| /// Features provided by `VK_KHR_portability_subset`. | ||
| /// | ||
| /// Strictly speaking this tells us what features we *don't* have compared to core. | ||
| portability_subset: Option<vk::PhysicalDevicePortabilitySubsetFeaturesKHR<'static>>, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this need to be added to device creation?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where specifically?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Check for references to other
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah good catch, added to the list. |
||
| } | ||
|
|
||
| impl PhysicalDeviceFeatures { | ||
|
|
@@ -206,6 +211,9 @@ impl PhysicalDeviceFeatures { | |
| if let Some(ref mut feature) = self.shader_barycentrics { | ||
| info = info.push_next(feature); | ||
| } | ||
| if let Some(ref mut feature) = self.portability_subset { | ||
| info = info.push_next(feature); | ||
| } | ||
| info | ||
| } | ||
|
|
||
|
|
@@ -551,6 +559,17 @@ impl PhysicalDeviceFeatures { | |
| } else { | ||
| None | ||
| }, | ||
| portability_subset: if enabled_extensions.contains(&khr::portability_subset::NAME) { | ||
| let multisample_array_needed = | ||
| requested_features.intersects(wgt::Features::MULTISAMPLE_ARRAY); | ||
|
|
||
| Some( | ||
| vk::PhysicalDevicePortabilitySubsetFeaturesKHR::default() | ||
| .multisample_array_image(multisample_array_needed), | ||
| ) | ||
| } else { | ||
| None | ||
| }, | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -927,6 +946,15 @@ impl PhysicalDeviceFeatures { | |
| mesh_shader.multiview_mesh_shader != 0, | ||
| ); | ||
| } | ||
|
|
||
| // Not supported by default by `VK_KHR_portability_subset`, which we use on apple platforms. | ||
| features.set( | ||
| F::MULTISAMPLE_ARRAY, | ||
| self.portability_subset | ||
| .map(|p| p.multisample_array_image == vk::TRUE) | ||
| .unwrap_or(true), | ||
| ); | ||
|
|
||
| (features, dl_flags) | ||
| } | ||
| } | ||
|
|
@@ -1698,6 +1726,13 @@ impl super::InstanceShared { | |
| features2 = features2.push_next(next); | ||
| } | ||
|
|
||
| if capabilities.supports_extension(khr::portability_subset::NAME) { | ||
| let next = features | ||
| .portability_subset | ||
| .insert(vk::PhysicalDevicePortabilitySubsetFeaturesKHR::default()); | ||
| features2 = features2.push_next(next); | ||
| } | ||
|
|
||
| unsafe { get_device_properties.get_physical_device_features2(phd, &mut features2) }; | ||
| features2.features | ||
| } else { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1263,6 +1263,16 @@ bitflags_array! { | |
| /// | ||
| /// This is a native only feature. | ||
| const EXPERIMENTAL_MESH_SHADER_POINTS = 1 << 55; | ||
|
|
||
| /// Enables creating texture arrays that are also multisampled. | ||
| /// | ||
| /// Without this feature, you cannot create a texture that has both a `sample_count` higher | ||
| /// than 1, and a `depth_or_array_layers` higher than 1. | ||
| /// | ||
| /// Supported platforms: | ||
| /// - Vulkan (except VK_KHR_portability_subset if multisampleArrayImage is not available) | ||
| /// - DX12 | ||
| const MULTISAMPLE_ARRAY = 1 << 56; | ||
|
Comment on lines
+1267
to
+1275
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any way we could add support to some Metal platforms in this PR? Especially with Apple Vision Pro this would probably be useful
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be very useful for apple vision pro, but I don't have any apple products to test this on and the support seems to be non-trivial.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about the support is non-trivial? Isn't it just checking if the OS version is high enough?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. According to @teoxoy it would require a few more changes. I have absolutely zero experience with the Metal API.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @LaylBongers Alright. If you'd rather not than can you file an issue for Metal multisample array textures?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added at #8593. |
||
| } | ||
|
|
||
| /// Features that are not guaranteed to be supported. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks very good