validation: fix error msg: textureSample*() offset must be a const_expr

Bug: tint:1016
Change-Id: I631ac820f3174ec7ad12e51396b7584df55b27f1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/59001
Auto-Submit: Sarah Mashayekhi <sarahmashay@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
Sarah 2021-07-21 03:34:34 +00:00 committed by Sarah Mashayekhi
parent 0c7332b2ba
commit 36b49e8834
2 changed files with 8 additions and 12 deletions

View File

@ -223,8 +223,7 @@ TEST_P(IntrinsicTextureSamplerValidationTest, GlobalConst) {
EXPECT_FALSE(r()->Resolve());
std::stringstream err;
err << "12:34 error: '" << param.function
<< "' offset parameter must be provided as"
<< " a literal or const_expr expression";
<< "' offset parameter must be a const_expression";
EXPECT_EQ(r()->error(), err.str());
}
@ -253,8 +252,7 @@ TEST_P(IntrinsicTextureSamplerValidationTest, ScalarConst) {
EXPECT_FALSE(r()->Resolve());
std::stringstream err;
err << "12:34 error: '" << param.function
<< "' offset parameter must be provided as"
<< " a literal or const_expr expression";
<< "' offset parameter must be a const_expression";
EXPECT_EQ(r()->error(), err.str());
}

View File

@ -2479,10 +2479,9 @@ bool Resolver::ValidateTextureIntrinsicFunction(
if (param->Is<ast::TypeConstructorExpression>()) {
auto values = ConstantValueOf(param);
if (!values.IsValid()) {
AddError("'" + func_name +
"' offset parameter must be provided as a literal or "
"const_expr expression",
param->source());
AddError(
"'" + func_name + "' offset parameter must be a const_expression",
param->source());
return false;
}
if (!values.Type()->Is<sem::Vector>() ||
@ -2503,10 +2502,9 @@ bool Resolver::ValidateTextureIntrinsicFunction(
}
}
} else {
AddError("'" + func_name +
"' offset parameter must be provided as a literal or "
"const_expr expression",
param->source());
AddError(
"'" + func_name + "' offset parameter must be a const_expression",
param->source());
return false;
}
}