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
10 changes: 10 additions & 0 deletions wgpu-hal/src/metal/adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1107,6 +1107,14 @@ impl super::CapabilitiesQuery {
false
},
shader_per_vertex: family_check && device.supportsFamily(MTLGPUFamily::Apple10),

//https://developer.apple.com/documentation/metal/mtltexturetype/type2dmultisamplearray
supports_multisample_array: available!(
macos = 10.14,
ios = 14.0,
tvos = 16.0,
visionos = 1.0
),
}
}

Expand Down Expand Up @@ -1242,6 +1250,8 @@ impl super::CapabilitiesQuery {

features.set(F::EXPERIMENTAL_RAY_QUERY, self.supports_raytracing);

features.set(F::MULTISAMPLE_ARRAY, self.supports_multisample_array);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docs of this feature need to be expanded to show metal support as well.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cwfitzgerald should be good to go


features
}

Expand Down
14 changes: 12 additions & 2 deletions wgpu-hal/src/metal/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,15 @@ impl crate::Device for super::Device {
wgt::TextureDimension::D2 => {
if desc.sample_count > 1 {
unsafe { descriptor.setSampleCount(desc.sample_count as usize) };
MTLTextureType::Type2DMultisample

if desc.size.depth_or_array_layers > 1 {
unsafe {
descriptor.setArrayLength(desc.size.depth_or_array_layers as usize)
};
MTLTextureType::Type2DMultisampleArray
} else {
MTLTextureType::Type2DMultisample
}
} else if desc.size.depth_or_array_layers > 1 {
unsafe {
descriptor.setArrayLength(desc.size.depth_or_array_layers as usize)
Expand Down Expand Up @@ -557,7 +565,9 @@ impl crate::Device for super::Device {
texture: &super::Texture,
desc: &crate::TextureViewDescriptor,
) -> DeviceResult<super::TextureView> {
let raw_type = if texture.raw_type == MTLTextureType::Type2DMultisample {
let raw_type = if texture.raw_type == MTLTextureType::Type2DMultisample
|| texture.raw_type == MTLTextureType::Type2DMultisampleArray
{
texture.raw_type
} else {
conv::map_texture_view_dimension(desc.dimension)
Expand Down
1 change: 1 addition & 0 deletions wgpu-hal/src/metal/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ struct CapabilitiesQuery {
supports_memoryless_storage: bool,
supports_raytracing: bool,
shader_per_vertex: bool,
supports_multisample_array: bool,
}

#[derive(Debug)]
Expand Down
1 change: 1 addition & 0 deletions wgpu-types/src/features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1360,6 +1360,7 @@ bitflags_array! {
///
/// Supported platforms:
/// - Vulkan (except VK_KHR_portability_subset if multisampleArrayImage is not available)
/// - Metal (with macos 10.14+, ios 14.0+, tvos 16.0+, visionos 1.0+)
#[name("wgpu-multisample-array")]
const MULTISAMPLE_ARRAY = 1 << 56;

Expand Down
Loading