GLSL: implement inverseSqrt() and update test expectations.

Bug: tint:1447
Change-Id: I521d021a9177c75badd52ad39ce4db6def48b6ab
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/82144
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
This commit is contained in:
Stephen White
2022-02-28 18:23:17 +00:00
committed by Tint LUCI CQ
parent 2a02b68453
commit 7028077a6a
12 changed files with 48 additions and 194 deletions

View File

@@ -1625,7 +1625,7 @@ std::string GeneratorImpl::generate_builtin_name(const sem::Builtin* builtin) {
case sem::BuiltinType::kFwidthFine:
return "fwidth";
case sem::BuiltinType::kInverseSqrt:
return "rsqrt";
return "inversesqrt";
case sem::BuiltinType::kIsFinite:
return "isfinite";
case sem::BuiltinType::kIsInf:

View File

@@ -218,7 +218,7 @@ INSTANTIATE_TEST_SUITE_P(
BuiltinData{BuiltinType::kFwidth, ParamType::kF32, "fwidth"},
BuiltinData{BuiltinType::kFwidthCoarse, ParamType::kF32, "fwidth"},
BuiltinData{BuiltinType::kFwidthFine, ParamType::kF32, "fwidth"},
BuiltinData{BuiltinType::kInverseSqrt, ParamType::kF32, "rsqrt"},
BuiltinData{BuiltinType::kInverseSqrt, ParamType::kF32, "inversesqrt"},
BuiltinData{BuiltinType::kIsFinite, ParamType::kF32, "isfinite"},
BuiltinData{BuiltinType::kIsInf, ParamType::kF32, "isinf"},
BuiltinData{BuiltinType::kIsNan, ParamType::kF32, "isnan"},

View File

@@ -57,7 +57,8 @@ INSTANTIATE_TEST_SUITE_P(GlslGeneratorImplTest_Import,
GlslImportData{"exp2", "exp2"},
GlslImportData{"floor", "floor"},
GlslImportData{"fract", "fract"},
GlslImportData{"inverseSqrt", "rsqrt"},
GlslImportData{"inverseSqrt",
"inversesqrt"},
GlslImportData{"length", "length"},
GlslImportData{"log", "log"},
GlslImportData{"log2", "log2"},
@@ -102,33 +103,33 @@ TEST_P(GlslImportData_SingleVectorParamTest, FloatVector) {
EXPECT_EQ(out.str(),
std::string(param.glsl_name) + "(vec3(1.0f, 2.0f, 3.0f))");
}
INSTANTIATE_TEST_SUITE_P(GlslGeneratorImplTest_Import,
GlslImportData_SingleVectorParamTest,
testing::Values(GlslImportData{"abs", "abs"},
GlslImportData{"acos", "acos"},
GlslImportData{"asin", "asin"},
GlslImportData{"atan", "atan"},
GlslImportData{"cos", "cos"},
GlslImportData{"cosh", "cosh"},
GlslImportData{"ceil", "ceil"},
GlslImportData{"exp", "exp"},
GlslImportData{"exp2", "exp2"},
GlslImportData{"floor", "floor"},
GlslImportData{"fract", "fract"},
GlslImportData{"inverseSqrt", "rsqrt"},
GlslImportData{"length", "length"},
GlslImportData{"log", "log"},
GlslImportData{"log2", "log2"},
GlslImportData{"normalize",
"normalize"},
GlslImportData{"round", "round"},
GlslImportData{"sign", "sign"},
GlslImportData{"sin", "sin"},
GlslImportData{"sinh", "sinh"},
GlslImportData{"sqrt", "sqrt"},
GlslImportData{"tan", "tan"},
GlslImportData{"tanh", "tanh"},
GlslImportData{"trunc", "trunc"}));
INSTANTIATE_TEST_SUITE_P(
GlslGeneratorImplTest_Import,
GlslImportData_SingleVectorParamTest,
testing::Values(GlslImportData{"abs", "abs"},
GlslImportData{"acos", "acos"},
GlslImportData{"asin", "asin"},
GlslImportData{"atan", "atan"},
GlslImportData{"cos", "cos"},
GlslImportData{"cosh", "cosh"},
GlslImportData{"ceil", "ceil"},
GlslImportData{"exp", "exp"},
GlslImportData{"exp2", "exp2"},
GlslImportData{"floor", "floor"},
GlslImportData{"fract", "fract"},
GlslImportData{"inverseSqrt", "inversesqrt"},
GlslImportData{"length", "length"},
GlslImportData{"log", "log"},
GlslImportData{"log2", "log2"},
GlslImportData{"normalize", "normalize"},
GlslImportData{"round", "round"},
GlslImportData{"sign", "sign"},
GlslImportData{"sin", "sin"},
GlslImportData{"sinh", "sinh"},
GlslImportData{"sqrt", "sqrt"},
GlslImportData{"tan", "tan"},
GlslImportData{"tanh", "tanh"},
GlslImportData{"trunc", "trunc"}));
using GlslImportData_DualParam_ScalarTest = TestParamHelper<GlslImportData>;
TEST_P(GlslImportData_DualParam_ScalarTest, Float) {