tint/resolver: Make the F16 ban error message show a single SC.

The error message mentioned "'uniform' or 'storage'" and will need to be
updated to also mention 'push_constant' in follow-up commits. Instead
make the error messages show only the storage class of the variable.

Bug: tint:1620
Change-Id: I266a948f8a8fb70d57031d15306a5e82400e4c75
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/96683
Reviewed-by: dan sinclair <dsinclair@google.com>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Corentin Wallez 2022-07-20 14:15:54 +00:00 committed by Dawn LUCI CQ
parent dbf3f4c8c2
commit 633cdf41cc
2 changed files with 21 additions and 27 deletions

View File

@ -134,7 +134,7 @@ TEST_F(ResolverStorageClassValidationTest, StorageBufferF16_TemporallyBan) {
ASSERT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(),
"56:78 error: using f16 types in 'uniform' or 'storage' storage class is not "
"56:78 error: using f16 types in 'storage' storage class is not "
"implemented yet");
}
@ -153,7 +153,7 @@ TEST_F(ResolverStorageClassValidationTest, StorageBufferF16Alias_TemporallyBan)
ASSERT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(),
"56:78 error: using f16 types in 'uniform' or 'storage' storage class is not "
"56:78 error: using f16 types in 'storage' storage class is not "
"implemented yet");
}
@ -169,7 +169,7 @@ TEST_F(ResolverStorageClassValidationTest, StorageBufferVectorF16_TemporallyBan)
ASSERT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(),
"56:78 error: using f16 types in 'uniform' or 'storage' storage class is not "
"56:78 error: using f16 types in 'storage' storage class is not "
"implemented yet");
}
@ -188,8 +188,7 @@ TEST_F(ResolverStorageClassValidationTest, StorageBufferArrayF16_TemporallyBan)
ASSERT_FALSE(r()->Resolve());
EXPECT_THAT(r()->error(),
HasSubstr("56:78 error: using f16 types in 'uniform' or 'storage' storage "
EXPECT_THAT(r()->error(), HasSubstr("56:78 error: using f16 types in 'storage' storage "
"class is not implemented yet"));
}
@ -207,8 +206,7 @@ TEST_F(ResolverStorageClassValidationTest, StorageBufferStructF16_TemporallyBan)
ASSERT_FALSE(r()->Resolve());
EXPECT_THAT(r()->error(),
HasSubstr("12:34 error: using f16 types in 'uniform' or 'storage' storage "
EXPECT_THAT(r()->error(), HasSubstr("12:34 error: using f16 types in 'storage' storage "
"class is not implemented yet"));
}
@ -229,8 +227,7 @@ TEST_F(ResolverStorageClassValidationTest, StorageBufferNoErrorStructF16Aliases_
ASSERT_FALSE(r()->Resolve());
EXPECT_THAT(r()->error(),
HasSubstr("12:34 error: using f16 types in 'uniform' or 'storage' storage "
EXPECT_THAT(r()->error(), HasSubstr("12:34 error: using f16 types in 'storage' storage "
"class is not implemented yet"));
}
@ -421,7 +418,7 @@ TEST_F(ResolverStorageClassValidationTest, UniformBufferF16_TemporallyBan) {
ASSERT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(),
"56:78 error: using f16 types in 'uniform' or 'storage' storage class is not "
"56:78 error: using f16 types in 'uniform' storage class is not "
"implemented yet");
}
@ -440,7 +437,7 @@ TEST_F(ResolverStorageClassValidationTest, UniformBufferF16Alias_TemporallyBan)
ASSERT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(),
"56:78 error: using f16 types in 'uniform' or 'storage' storage class is not "
"56:78 error: using f16 types in 'uniform' storage class is not "
"implemented yet");
}
@ -455,8 +452,7 @@ TEST_F(ResolverStorageClassValidationTest, UniformBufferVectorF16_TemporallyBan)
ASSERT_FALSE(r()->Resolve());
EXPECT_THAT(r()->error(),
HasSubstr("56:78 error: using f16 types in 'uniform' or 'storage' storage "
EXPECT_THAT(r()->error(), HasSubstr("56:78 error: using f16 types in 'uniform' storage "
"class is not implemented yet"));
}
@ -477,8 +473,7 @@ TEST_F(ResolverStorageClassValidationTest, UniformBufferArrayF16_TemporallyBan)
ASSERT_FALSE(r()->Resolve());
EXPECT_THAT(r()->error(),
HasSubstr("56:78 error: using f16 types in 'uniform' or 'storage' storage "
EXPECT_THAT(r()->error(), HasSubstr("56:78 error: using f16 types in 'uniform' storage "
"class is not implemented yet"));
}
@ -496,8 +491,7 @@ TEST_F(ResolverStorageClassValidationTest, UniformBufferStructF16_TemporallyBan)
ASSERT_FALSE(r()->Resolve());
EXPECT_THAT(r()->error(),
HasSubstr("12:34 error: using f16 types in 'uniform' or 'storage' storage "
EXPECT_THAT(r()->error(), HasSubstr("12:34 error: using f16 types in 'uniform' storage "
"class is not implemented yet"));
}
@ -517,8 +511,7 @@ TEST_F(ResolverStorageClassValidationTest, UniformBufferStructF16Aliases_Tempora
ASSERT_FALSE(r()->Resolve());
EXPECT_THAT(r()->error(),
HasSubstr("12:34 error: using f16 types in 'uniform' or 'storage' storage "
EXPECT_THAT(r()->error(), HasSubstr("12:34 error: using f16 types in 'uniform' storage "
"class is not implemented yet"));
}

View File

@ -396,7 +396,8 @@ bool Validator::StorageClassLayout(const sem::Type* store_ty,
// TODO(tint:1473, tint:1502): Remove this error after f16 is supported in "uniform" and
// "storage" storage class.
if (Is<sem::F16>(sem::Type::DeepestElementOf(store_ty))) {
AddError("using f16 types in 'uniform' or 'storage' storage class is not implemented yet",
AddError("using f16 types in '" + std::string(ast::ToString(sc)) +
"' storage class is not implemented yet",
source);
return false;
}