Fix MSL invariant translation.
When `invariant` is enabled on MSL was was incorrectly setting `@invariant` instead of `[[invariant]]`. We test with metal1.2 which does not have invariant, so this only showed up when using metal2.1 or higher. Bug: chromium:1439273 Change-Id: Iab866608195e697b0370d465f350b25277d904a3 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128880 Commit-Queue: Ben Clayton <bclayton@google.com> Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
parent
c5c2fce3ed
commit
bdc2d24900
|
@ -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";
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
using namespace metal;
|
||||
|
||||
#if __METAL_VERSION__ >= 210
|
||||
#define TINT_INVARIANT @invariant
|
||||
#define TINT_INVARIANT [[invariant]]
|
||||
#else
|
||||
#define TINT_INVARIANT
|
||||
#endif
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
using namespace metal;
|
||||
|
||||
#if __METAL_VERSION__ >= 210
|
||||
#define TINT_INVARIANT @invariant
|
||||
#define TINT_INVARIANT [[invariant]]
|
||||
#else
|
||||
#define TINT_INVARIANT
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue