Skip to content
Open
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
16 changes: 16 additions & 0 deletions wgpu-hal/src/metal/adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1081,6 +1081,20 @@ impl super::CapabilitiesQuery {
} else {
false
},

supports_multisample_array: {
//https://developer.apple.com/documentation/metal/mtltexturetype/type2dmultisamplearray
// According to Metal Feature Set Tables:
// Multisample 2D Array textures are supported on:
// - Apple Family 3 and higher (A10 chips/iPhone 7 and newer)
// - Mac Family 1 and higher (All Intel/AMD/Apple Silicon Macs)
Comment on lines +1088 to +1090
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'm not seeing anything in the metal feature set tables about multisample 2D array textures. What is the exact feature called?

Also, the metal feature set tables have scrubbed all references of "Mac Family 1" a while ago, so are you looking at some older version of this on the internet archive?

if available!(macos = 10.14, ios = 14.0, tvos = 16.0, visionos = 1.0) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This should also require family_check or supportsFamily will crash.

device.supportsFamily(MTLGPUFamily::Apple3)
|| device.supportsFamily(MTLGPUFamily::Mac1)
} else {
false
}
},
}
}

Expand Down Expand Up @@ -1207,6 +1221,8 @@ impl super::CapabilitiesQuery {

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

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

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 @@ -473,7 +473,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 @@ -540,7 +548,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 @@ -316,6 +316,7 @@ struct CapabilitiesQuery {
shader_barycentrics: bool,
supports_memoryless_storage: bool,
supports_raytracing: bool,
supports_multisample_array: bool,
}

#[derive(Debug)]
Expand Down
Loading