mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-20 18:29:23 +00:00
builtins: Add smoothstep, deprecate smoothStep
Bug: tint:1483 Change-Id: I8702933312a7e46f82745f232214910433485fe5 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/85261 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -382,8 +382,10 @@ fn sin(f32) -> f32
|
||||
fn sin<N: num>(vec<N, f32>) -> vec<N, f32>
|
||||
fn sinh(f32) -> f32
|
||||
fn sinh<N: num>(vec<N, f32>) -> vec<N, f32>
|
||||
fn smoothStep(f32, f32, f32) -> f32
|
||||
fn smoothStep<N: num>(vec<N, f32>, vec<N, f32>, vec<N, f32>) -> vec<N, f32>
|
||||
fn smoothstep(f32, f32, f32) -> f32
|
||||
fn smoothstep<N: num>(vec<N, f32>, vec<N, f32>, vec<N, f32>) -> vec<N, f32>
|
||||
[[deprecated]] fn smoothStep(f32, f32, f32) -> f32
|
||||
[[deprecated]] fn smoothStep<N: num>(vec<N, f32>, vec<N, f32>, vec<N, f32>) -> vec<N, f32>
|
||||
fn sqrt(f32) -> f32
|
||||
fn sqrt<N: num>(vec<N, f32>) -> vec<N, f32>
|
||||
fn step(f32, f32) -> f32
|
||||
|
||||
@@ -1300,6 +1300,7 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
ResolverTest,
|
||||
ResolverBuiltinTest_ThreeParam,
|
||||
testing::Values(BuiltinData{"mix", BuiltinType::kMix},
|
||||
BuiltinData{"smoothstep", BuiltinType::kSmoothstep},
|
||||
BuiltinData{"smoothStep", BuiltinType::kSmoothStep},
|
||||
BuiltinData{"fma", BuiltinType::kFma}));
|
||||
|
||||
|
||||
@@ -92,6 +92,7 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
BuiltinData{"sign", BuiltinType::kSign},
|
||||
BuiltinData{"sin", BuiltinType::kSin},
|
||||
BuiltinData{"sinh", BuiltinType::kSinh},
|
||||
BuiltinData{"smoothstep", BuiltinType::kSmoothstep},
|
||||
BuiltinData{"smoothStep", BuiltinType::kSmoothStep},
|
||||
BuiltinData{"sqrt", BuiltinType::kSqrt},
|
||||
BuiltinData{"step", BuiltinType::kStep},
|
||||
|
||||
@@ -225,6 +225,9 @@ BuiltinType ParseBuiltinType(const std::string& name) {
|
||||
if (name == "sinh") {
|
||||
return BuiltinType::kSinh;
|
||||
}
|
||||
if (name == "smoothstep") {
|
||||
return BuiltinType::kSmoothstep;
|
||||
}
|
||||
if (name == "smoothStep") {
|
||||
return BuiltinType::kSmoothStep;
|
||||
}
|
||||
@@ -479,6 +482,8 @@ const char* str(BuiltinType i) {
|
||||
return "sin";
|
||||
case BuiltinType::kSinh:
|
||||
return "sinh";
|
||||
case BuiltinType::kSmoothstep:
|
||||
return "smoothstep";
|
||||
case BuiltinType::kSmoothStep:
|
||||
return "smoothStep";
|
||||
case BuiltinType::kSqrt:
|
||||
|
||||
@@ -99,6 +99,7 @@ enum class BuiltinType {
|
||||
kSign,
|
||||
kSin,
|
||||
kSinh,
|
||||
kSmoothstep,
|
||||
kSmoothStep,
|
||||
kSqrt,
|
||||
kStep,
|
||||
|
||||
@@ -1602,6 +1602,7 @@ std::string GeneratorImpl::generate_builtin_name(const sem::Builtin* builtin) {
|
||||
return "packUnorm4x8";
|
||||
case sem::BuiltinType::kReverseBits:
|
||||
return "bitfieldReverse";
|
||||
case sem::BuiltinType::kSmoothstep:
|
||||
case sem::BuiltinType::kSmoothStep:
|
||||
return "smoothstep";
|
||||
case sem::BuiltinType::kUnpack2x16float:
|
||||
|
||||
@@ -111,6 +111,7 @@ const ast::CallExpression* GenerateCall(BuiltinType builtin,
|
||||
case BuiltinType::kFma:
|
||||
case BuiltinType::kMix:
|
||||
case BuiltinType::kFaceForward:
|
||||
case BuiltinType::kSmoothstep:
|
||||
case BuiltinType::kSmoothStep:
|
||||
return builder->Call(str.str(), "f2", "f2", "f2");
|
||||
case BuiltinType::kAll:
|
||||
@@ -233,6 +234,7 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
BuiltinData{BuiltinType::kSign, ParamType::kF32, "sign"},
|
||||
BuiltinData{BuiltinType::kSin, ParamType::kF32, "sin"},
|
||||
BuiltinData{BuiltinType::kSinh, ParamType::kF32, "sinh"},
|
||||
BuiltinData{BuiltinType::kSmoothstep, ParamType::kF32, "smoothstep"},
|
||||
BuiltinData{BuiltinType::kSmoothStep, ParamType::kF32, "smoothstep"},
|
||||
BuiltinData{BuiltinType::kSqrt, ParamType::kF32, "sqrt"},
|
||||
BuiltinData{BuiltinType::kStep, ParamType::kF32, "step"},
|
||||
|
||||
@@ -2547,6 +2547,7 @@ std::string GeneratorImpl::generate_builtin_name(const sem::Builtin* builtin) {
|
||||
return "lerp";
|
||||
case sem::BuiltinType::kReverseBits:
|
||||
return "reversebits";
|
||||
case sem::BuiltinType::kSmoothstep:
|
||||
case sem::BuiltinType::kSmoothStep:
|
||||
return "smoothstep";
|
||||
default:
|
||||
|
||||
@@ -111,6 +111,7 @@ const ast::CallExpression* GenerateCall(BuiltinType builtin,
|
||||
case BuiltinType::kFma:
|
||||
case BuiltinType::kMix:
|
||||
case BuiltinType::kFaceForward:
|
||||
case BuiltinType::kSmoothstep:
|
||||
case BuiltinType::kSmoothStep:
|
||||
return builder->Call(str.str(), "f2", "f2", "f2");
|
||||
case BuiltinType::kAll:
|
||||
@@ -232,6 +233,7 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
BuiltinData{BuiltinType::kSign, ParamType::kF32, "sign"},
|
||||
BuiltinData{BuiltinType::kSin, ParamType::kF32, "sin"},
|
||||
BuiltinData{BuiltinType::kSinh, ParamType::kF32, "sinh"},
|
||||
BuiltinData{BuiltinType::kSmoothstep, ParamType::kF32, "smoothstep"},
|
||||
BuiltinData{BuiltinType::kSmoothStep, ParamType::kF32, "smoothstep"},
|
||||
BuiltinData{BuiltinType::kSqrt, ParamType::kF32, "sqrt"},
|
||||
BuiltinData{BuiltinType::kStep, ParamType::kF32, "step"},
|
||||
|
||||
@@ -1423,6 +1423,7 @@ std::string GeneratorImpl::generate_builtin_name(const sem::Builtin* builtin) {
|
||||
case sem::BuiltinType::kRound:
|
||||
out += "rint";
|
||||
break;
|
||||
case sem::BuiltinType::kSmoothstep:
|
||||
case sem::BuiltinType::kSmoothStep:
|
||||
out += "smoothstep";
|
||||
break;
|
||||
|
||||
@@ -109,6 +109,7 @@ const ast::CallExpression* GenerateCall(BuiltinType builtin,
|
||||
case BuiltinType::kFma:
|
||||
case BuiltinType::kMix:
|
||||
case BuiltinType::kFaceForward:
|
||||
case BuiltinType::kSmoothstep:
|
||||
case BuiltinType::kSmoothStep:
|
||||
return builder->Call(str.str(), "f2", "f2", "f2");
|
||||
case BuiltinType::kAll:
|
||||
@@ -264,6 +265,7 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
BuiltinData{BuiltinType::kSign, ParamType::kF32, "sign"},
|
||||
BuiltinData{BuiltinType::kSin, ParamType::kF32, "sin"},
|
||||
BuiltinData{BuiltinType::kSinh, ParamType::kF32, "sinh"},
|
||||
BuiltinData{BuiltinType::kSmoothstep, ParamType::kF32, "smoothstep"},
|
||||
BuiltinData{BuiltinType::kSmoothStep, ParamType::kF32, "smoothstep"},
|
||||
BuiltinData{BuiltinType::kSqrt, ParamType::kF32, "sqrt"},
|
||||
BuiltinData{BuiltinType::kStep, ParamType::kF32, "step"},
|
||||
|
||||
@@ -216,6 +216,7 @@ uint32_t builtin_to_glsl_method(const sem::Builtin* builtin) {
|
||||
return GLSLstd450Sin;
|
||||
case BuiltinType::kSinh:
|
||||
return GLSLstd450Sinh;
|
||||
case BuiltinType::kSmoothstep:
|
||||
case BuiltinType::kSmoothStep:
|
||||
return GLSLstd450SmoothStep;
|
||||
case BuiltinType::kSqrt:
|
||||
|
||||
Reference in New Issue
Block a user