Skip to content

Commit f114138

Browse files
authored
Support STORAGE_RESOURCE_BINDING_ARRAY on Metal (#8464)
1 parent fa4c8e8 commit f114138

File tree

4 files changed

+17
-9
lines changed

4 files changed

+17
-9
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ By @SupaMaggie70Incorporated in [#8206](https://github.com/gfx-rs/wgpu/pull/8206
110110

111111
- Added support for transient textures on Vulkan and Metal. By @opstic in [#8247](https://github.com/gfx-rs/wgpu/pull/8247)
112112
- Implement shader triangle barycentric coordinate builtins. By @atlv24 in [#8320](https://github.com/gfx-rs/wgpu/pull/8320).
113+
- Added support for binding arrays of storage textures on Metal. By @msvbg in [#8464](https://github.com/gfx-rs/wgpu/pull/8464)
113114

114115
### Changes
115116

naga/src/back/msl/writer.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7140,9 +7140,11 @@ template <typename A>
71407140
}
71417141
}
71427142
crate::ImageClass::Storage { .. } => {
7143-
return Err(Error::UnsupportedArrayOf(
7144-
"read-write textures".to_string(),
7145-
));
7143+
if options.lang_version < (3, 0) {
7144+
return Err(Error::UnsupportedArrayOf(
7145+
"read-write textures".to_string(),
7146+
));
7147+
}
71467148
}
71477149
crate::ImageClass::External => {
71487150
return Err(Error::UnsupportedArrayOf(

tests/tests/wgpu-gpu/binding_array/storage_textures.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ use std::num::NonZeroU32;
22

33
use wgpu::*;
44
use wgpu_test::{
5-
gpu_test, image::ReadbackBuffers, FailureCase, GpuTestConfiguration, GpuTestInitializer,
6-
TestParameters, TestingContext,
5+
gpu_test, image::ReadbackBuffers, GpuTestConfiguration, GpuTestInitializer, TestParameters,
6+
TestingContext,
77
};
88

99
pub fn all_tests(tests: &mut Vec<GpuTestInitializer>) {
@@ -26,8 +26,7 @@ static BINDING_ARRAY_STORAGE_TEXTURES: GpuTestConfiguration = GpuTestConfigurati
2626
.limits(Limits {
2727
max_binding_array_elements_per_shader_stage: 17,
2828
..Limits::default()
29-
})
30-
.expect_fail(FailureCase::backend(Backends::METAL)),
29+
}),
3130
)
3231
.run_async(|ctx| async move { binding_array_storage_textures(ctx, false).await });
3332

@@ -45,8 +44,7 @@ static PARTIAL_BINDING_ARRAY_STORAGE_TEXTURES: GpuTestConfiguration = GpuTestCon
4544
.limits(Limits {
4645
max_binding_array_elements_per_shader_stage: 33,
4746
..Limits::default()
48-
})
49-
.expect_fail(FailureCase::backend(Backends::METAL)),
47+
}),
5048
)
5149
.run_async(|ctx| async move { binding_array_storage_textures(ctx, true).await });
5250

wgpu-hal/src/metal/adapter.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -993,6 +993,13 @@ impl super::PrivateCapabilities {
993993
&& self.supports_arrays_of_textures
994994
&& self.argument_buffers as u64 >= MTLArgumentBuffersTier::Tier2 as u64,
995995
);
996+
features.set(
997+
F::STORAGE_RESOURCE_BINDING_ARRAY,
998+
self.msl_version >= MTLLanguageVersion::V3_0
999+
&& self.supports_arrays_of_textures
1000+
&& self.supports_arrays_of_textures_write
1001+
&& self.argument_buffers as u64 >= MTLArgumentBuffersTier::Tier2 as u64,
1002+
);
9961003
features.set(
9971004
F::SHADER_INT64,
9981005
self.int64 && self.msl_version >= MTLLanguageVersion::V2_3,

0 commit comments

Comments
 (0)