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,9 +188,8 @@ 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 "
"class is not implemented yet"));
EXPECT_THAT(r()->error(), HasSubstr("56:78 error: using f16 types in 'storage' storage "
"class is not implemented yet"));
}
TEST_F(ResolverStorageClassValidationTest, StorageBufferStructF16_TemporallyBan) {
@ -207,9 +206,8 @@ 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 "
"class is not implemented yet"));
EXPECT_THAT(r()->error(), HasSubstr("12:34 error: using f16 types in 'storage' storage "
"class is not implemented yet"));
}
TEST_F(ResolverStorageClassValidationTest, StorageBufferNoErrorStructF16Aliases_TemporallyBan) {
@ -229,9 +227,8 @@ TEST_F(ResolverStorageClassValidationTest, StorageBufferNoErrorStructF16Aliases_
ASSERT_FALSE(r()->Resolve());
EXPECT_THAT(r()->error(),
HasSubstr("12:34 error: using f16 types in 'uniform' or 'storage' storage "
"class is not implemented yet"));
EXPECT_THAT(r()->error(), HasSubstr("12:34 error: using f16 types in 'storage' storage "
"class is not implemented yet"));
}
TEST_F(ResolverStorageClassValidationTest, StorageBufferPointer) {
@ -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,9 +452,8 @@ 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 "
"class is not implemented yet"));
EXPECT_THAT(r()->error(), HasSubstr("56:78 error: using f16 types in 'uniform' storage "
"class is not implemented yet"));
}
TEST_F(ResolverStorageClassValidationTest, UniformBufferArrayF16_TemporallyBan) {
@ -477,9 +473,8 @@ 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 "
"class is not implemented yet"));
EXPECT_THAT(r()->error(), HasSubstr("56:78 error: using f16 types in 'uniform' storage "
"class is not implemented yet"));
}
TEST_F(ResolverStorageClassValidationTest, UniformBufferStructF16_TemporallyBan) {
@ -496,9 +491,8 @@ 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 "
"class is not implemented yet"));
EXPECT_THAT(r()->error(), HasSubstr("12:34 error: using f16 types in 'uniform' storage "
"class is not implemented yet"));
}
TEST_F(ResolverStorageClassValidationTest, UniformBufferStructF16Aliases_TemporallyBan) {
@ -517,9 +511,8 @@ 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 "
"class is not implemented yet"));
EXPECT_THAT(r()->error(), HasSubstr("12:34 error: using f16 types in 'uniform' storage "
"class is not implemented yet"));
}
TEST_F(ResolverStorageClassValidationTest, UniformBufferPointer) {

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;
}