Add GLSL Trunc support.
This CL adds type determination for the Trunc method. Bug: tint:5 Change-Id: I4f23dad7725f1f076fbbc7da8687de42a02cc482 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19941 Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
parent
ca1723e990
commit
fa5a66f192
|
@ -576,7 +576,7 @@ ast::type::Type* TypeDeterminer::GetImportData(
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name == "round" || name == "roundeven") {
|
if (name == "round" || name == "roundeven" || name == "trunc") {
|
||||||
if (params.size() != 1) {
|
if (params.size() != 1) {
|
||||||
error_ = "incorrect number of parameters for " + name +
|
error_ = "incorrect number of parameters for " + name +
|
||||||
". Expected 1 got " + std::to_string(params.size());
|
". Expected 1 got " + std::to_string(params.size());
|
||||||
|
@ -592,7 +592,10 @@ ast::type::Type* TypeDeterminer::GetImportData(
|
||||||
*id = GLSLstd450Round;
|
*id = GLSLstd450Round;
|
||||||
} else if (name == "roundeven") {
|
} else if (name == "roundeven") {
|
||||||
*id = GLSLstd450RoundEven;
|
*id = GLSLstd450RoundEven;
|
||||||
|
} else if (name == "trunc") {
|
||||||
|
*id = GLSLstd450Trunc;
|
||||||
}
|
}
|
||||||
|
|
||||||
return params[0]->result_type();
|
return params[0]->result_type();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1589,7 +1589,8 @@ INSTANTIATE_TEST_SUITE_P(TypeDeterminerTest,
|
||||||
ImportData_FloatTest,
|
ImportData_FloatTest,
|
||||||
testing::Values(GLSLData{"round", GLSLstd450Round},
|
testing::Values(GLSLData{"round", GLSLstd450Round},
|
||||||
GLSLData{"roundeven",
|
GLSLData{"roundeven",
|
||||||
GLSLstd450RoundEven}));
|
GLSLstd450RoundEven},
|
||||||
|
GLSLData{"trunc", GLSLstd450Trunc}));
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace tint
|
} // namespace tint
|
||||||
|
|
Loading…
Reference in New Issue