diff --git a/src/tint/writer/msl/generator_impl.cc b/src/tint/writer/msl/generator_impl.cc index df9ff4bf55..0435918537 100644 --- a/src/tint/writer/msl/generator_impl.cc +++ b/src/tint/writer/msl/generator_impl.cc @@ -347,7 +347,7 @@ bool GeneratorImpl::Generate() { // WGSL can ignore the invariant attribute on pre MSL 2.1 devices. // See: https://github.com/gpuweb/gpuweb/issues/893#issuecomment-745537465 line(&helpers_) << "#if __METAL_VERSION__ >= 210"; - line(&helpers_) << "#define " << invariant_define_name_ << " @invariant"; + line(&helpers_) << "#define " << invariant_define_name_ << " [[invariant]]"; line(&helpers_) << "#else"; line(&helpers_) << "#define " << invariant_define_name_; line(&helpers_) << "#endif"; diff --git a/src/tint/writer/msl/generator_impl_test.cc b/src/tint/writer/msl/generator_impl_test.cc index 4772d469d6..41333dbab9 100644 --- a/src/tint/writer/msl/generator_impl_test.cc +++ b/src/tint/writer/msl/generator_impl_test.cc @@ -119,7 +119,7 @@ TEST_F(MslGeneratorImplTest, HasInvariantAttribute_True) { using namespace metal; #if __METAL_VERSION__ >= 210 -#define TINT_INVARIANT @invariant +#define TINT_INVARIANT [[invariant]] #else #define TINT_INVARIANT #endif diff --git a/test/tint/shader_io/invariant.wgsl.expected.msl b/test/tint/shader_io/invariant.wgsl.expected.msl index 4f6e6f5645..78a68446ef 100644 --- a/test/tint/shader_io/invariant.wgsl.expected.msl +++ b/test/tint/shader_io/invariant.wgsl.expected.msl @@ -3,7 +3,7 @@ using namespace metal; #if __METAL_VERSION__ >= 210 -#define TINT_INVARIANT @invariant +#define TINT_INVARIANT [[invariant]] #else #define TINT_INVARIANT #endif diff --git a/test/tint/shader_io/invariant_struct_member.wgsl.expected.msl b/test/tint/shader_io/invariant_struct_member.wgsl.expected.msl index 1af16da6f6..1ffeca1c20 100644 --- a/test/tint/shader_io/invariant_struct_member.wgsl.expected.msl +++ b/test/tint/shader_io/invariant_struct_member.wgsl.expected.msl @@ -3,7 +3,7 @@ using namespace metal; #if __METAL_VERSION__ >= 210 -#define TINT_INVARIANT @invariant +#define TINT_INVARIANT [[invariant]] #else #define TINT_INVARIANT #endif