Fixup return of HLSL sign to match WGSL.
The HLSL `sign` method returns an `int` result (scalar or vector). The WGSL `sign` expects the result to be the same type as the argument. This CL injects a cast to the correct type after the `sign` call in the HLSL generated source. Bug: tint:1795 Change-Id: I51fed24b5b8b752b6b27fdfb5dd47eb803902793 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116692 Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
parent
5dd9d1dee8
commit
7092786f31
|
@ -959,6 +959,9 @@ bool GeneratorImpl::EmitBuiltinCall(std::ostream& out,
|
||||||
if (type == sem::BuiltinType::kRadians) {
|
if (type == sem::BuiltinType::kRadians) {
|
||||||
return EmitRadiansCall(out, expr, builtin);
|
return EmitRadiansCall(out, expr, builtin);
|
||||||
}
|
}
|
||||||
|
if (type == sem::BuiltinType::kSign) {
|
||||||
|
return EmitSignCall(out, call, builtin);
|
||||||
|
}
|
||||||
if (type == sem::BuiltinType::kQuantizeToF16) {
|
if (type == sem::BuiltinType::kQuantizeToF16) {
|
||||||
return EmitQuantizeToF16Call(out, expr, builtin);
|
return EmitQuantizeToF16Call(out, expr, builtin);
|
||||||
}
|
}
|
||||||
|
@ -2065,6 +2068,22 @@ bool GeneratorImpl::EmitRadiansCall(std::ostream& out,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The HLSL `sign` method always returns an `int` result (scalar or vector). In WGSL the result is
|
||||||
|
// expected to be the same type as the argument. This injects a cast to the expected WGSL result
|
||||||
|
// type after the call to `sign`.
|
||||||
|
bool GeneratorImpl::EmitSignCall(std::ostream& out, const sem::Call* call, const sem::Builtin*) {
|
||||||
|
auto* arg = call->Arguments()[0];
|
||||||
|
if (!EmitType(out, arg->Type(), ast::AddressSpace::kNone, ast::Access::kReadWrite, "")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
out << "(sign(";
|
||||||
|
if (!EmitExpression(out, arg->Declaration())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
out << "))";
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool GeneratorImpl::EmitQuantizeToF16Call(std::ostream& out,
|
bool GeneratorImpl::EmitQuantizeToF16Call(std::ostream& out,
|
||||||
const ast::CallExpression* expr,
|
const ast::CallExpression* expr,
|
||||||
const sem::Builtin* builtin) {
|
const sem::Builtin* builtin) {
|
||||||
|
@ -2662,7 +2681,6 @@ std::string GeneratorImpl::generate_builtin_name(const sem::Builtin* builtin) {
|
||||||
case sem::BuiltinType::kRefract:
|
case sem::BuiltinType::kRefract:
|
||||||
case sem::BuiltinType::kRound:
|
case sem::BuiltinType::kRound:
|
||||||
case sem::BuiltinType::kSaturate:
|
case sem::BuiltinType::kSaturate:
|
||||||
case sem::BuiltinType::kSign:
|
|
||||||
case sem::BuiltinType::kSin:
|
case sem::BuiltinType::kSin:
|
||||||
case sem::BuiltinType::kSinh:
|
case sem::BuiltinType::kSinh:
|
||||||
case sem::BuiltinType::kSqrt:
|
case sem::BuiltinType::kSqrt:
|
||||||
|
|
|
@ -244,6 +244,12 @@ class GeneratorImpl : public TextGenerator {
|
||||||
bool EmitRadiansCall(std::ostream& out,
|
bool EmitRadiansCall(std::ostream& out,
|
||||||
const ast::CallExpression* expr,
|
const ast::CallExpression* expr,
|
||||||
const sem::Builtin* builtin);
|
const sem::Builtin* builtin);
|
||||||
|
/// Handles generating a call to the `sign()` builtin
|
||||||
|
/// @param out the output of the expression stream
|
||||||
|
/// @param call the call semantic node
|
||||||
|
/// @param builtin the semantic information for the builtin
|
||||||
|
/// @returns true if the call expression is emitted
|
||||||
|
bool EmitSignCall(std::ostream& out, const sem::Call* call, const sem::Builtin* builtin);
|
||||||
/// Handles generating a call to data packing builtin
|
/// Handles generating a call to data packing builtin
|
||||||
/// @param out the output of the expression stream
|
/// @param out the output of the expression stream
|
||||||
/// @param expr the call expression
|
/// @param expr the call expression
|
||||||
|
|
|
@ -98,7 +98,6 @@ const ast::CallExpression* GenerateCall(BuiltinType builtin,
|
||||||
case BuiltinType::kTan:
|
case BuiltinType::kTan:
|
||||||
case BuiltinType::kTanh:
|
case BuiltinType::kTanh:
|
||||||
case BuiltinType::kTrunc:
|
case BuiltinType::kTrunc:
|
||||||
case BuiltinType::kSign:
|
|
||||||
if (type == CallParamType::kF16) {
|
if (type == CallParamType::kF16) {
|
||||||
return builder->Call(str.str(), "h2");
|
return builder->Call(str.str(), "h2");
|
||||||
} else {
|
} else {
|
||||||
|
@ -294,8 +293,6 @@ INSTANTIATE_TEST_SUITE_P(
|
||||||
BuiltinData{BuiltinType::kPow, CallParamType::kF16, "pow"},
|
BuiltinData{BuiltinType::kPow, CallParamType::kF16, "pow"},
|
||||||
BuiltinData{BuiltinType::kReflect, CallParamType::kF32, "reflect"},
|
BuiltinData{BuiltinType::kReflect, CallParamType::kF32, "reflect"},
|
||||||
BuiltinData{BuiltinType::kReflect, CallParamType::kF16, "reflect"},
|
BuiltinData{BuiltinType::kReflect, CallParamType::kF16, "reflect"},
|
||||||
BuiltinData{BuiltinType::kSign, CallParamType::kF32, "sign"},
|
|
||||||
BuiltinData{BuiltinType::kSign, CallParamType::kF16, "sign"},
|
|
||||||
BuiltinData{BuiltinType::kSin, CallParamType::kF32, "sin"},
|
BuiltinData{BuiltinType::kSin, CallParamType::kF32, "sin"},
|
||||||
BuiltinData{BuiltinType::kSin, CallParamType::kF16, "sin"},
|
BuiltinData{BuiltinType::kSin, CallParamType::kF16, "sin"},
|
||||||
BuiltinData{BuiltinType::kSinh, CallParamType::kF32, "sinh"},
|
BuiltinData{BuiltinType::kSinh, CallParamType::kF32, "sinh"},
|
||||||
|
@ -1002,6 +999,112 @@ void test_function() {
|
||||||
)");
|
)");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(HlslGeneratorImplTest_Builtin, Sign_Scalar_i32) {
|
||||||
|
auto* val = Var("val", ty.i32());
|
||||||
|
auto* call = Call("sign", val);
|
||||||
|
WrapInFunction(val, call);
|
||||||
|
|
||||||
|
GeneratorImpl& gen = SanitizeAndBuild();
|
||||||
|
|
||||||
|
ASSERT_TRUE(gen.Generate()) << gen.error();
|
||||||
|
EXPECT_EQ(gen.result(), R"([numthreads(1, 1, 1)]
|
||||||
|
void test_function() {
|
||||||
|
int val = 0;
|
||||||
|
const int tint_symbol = int(sign(val));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
)");
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(HlslGeneratorImplTest_Builtin, Sign_Vector_i32) {
|
||||||
|
auto* val = Var("val", ty.vec3<i32>());
|
||||||
|
auto* call = Call("sign", val);
|
||||||
|
WrapInFunction(val, call);
|
||||||
|
|
||||||
|
GeneratorImpl& gen = SanitizeAndBuild();
|
||||||
|
|
||||||
|
ASSERT_TRUE(gen.Generate()) << gen.error();
|
||||||
|
EXPECT_EQ(gen.result(), R"([numthreads(1, 1, 1)]
|
||||||
|
void test_function() {
|
||||||
|
int3 val = int3(0, 0, 0);
|
||||||
|
const int3 tint_symbol = int3(sign(val));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
)");
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(HlslGeneratorImplTest_Builtin, Sign_Scalar_f32) {
|
||||||
|
auto* val = Var("val", ty.f32());
|
||||||
|
auto* call = Call("sign", val);
|
||||||
|
WrapInFunction(val, call);
|
||||||
|
|
||||||
|
GeneratorImpl& gen = SanitizeAndBuild();
|
||||||
|
|
||||||
|
ASSERT_TRUE(gen.Generate()) << gen.error();
|
||||||
|
EXPECT_EQ(gen.result(), R"([numthreads(1, 1, 1)]
|
||||||
|
void test_function() {
|
||||||
|
float val = 0.0f;
|
||||||
|
const float tint_symbol = float(sign(val));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
)");
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(HlslGeneratorImplTest_Builtin, Sign_Vector_f32) {
|
||||||
|
auto* val = Var("val", ty.vec3<f32>());
|
||||||
|
auto* call = Call("sign", val);
|
||||||
|
WrapInFunction(val, call);
|
||||||
|
|
||||||
|
GeneratorImpl& gen = SanitizeAndBuild();
|
||||||
|
|
||||||
|
ASSERT_TRUE(gen.Generate()) << gen.error();
|
||||||
|
EXPECT_EQ(gen.result(), R"([numthreads(1, 1, 1)]
|
||||||
|
void test_function() {
|
||||||
|
float3 val = float3(0.0f, 0.0f, 0.0f);
|
||||||
|
const float3 tint_symbol = float3(sign(val));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
)");
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(HlslGeneratorImplTest_Builtin, Sign_Scalar_f16) {
|
||||||
|
Enable(ast::Extension::kF16);
|
||||||
|
|
||||||
|
auto* val = Var("val", ty.f16());
|
||||||
|
auto* call = Call("sign", val);
|
||||||
|
WrapInFunction(val, call);
|
||||||
|
|
||||||
|
GeneratorImpl& gen = SanitizeAndBuild();
|
||||||
|
|
||||||
|
ASSERT_TRUE(gen.Generate()) << gen.error();
|
||||||
|
EXPECT_EQ(gen.result(), R"([numthreads(1, 1, 1)]
|
||||||
|
void test_function() {
|
||||||
|
float16_t val = float16_t(0.0h);
|
||||||
|
const float16_t tint_symbol = float16_t(sign(val));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
)");
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(HlslGeneratorImplTest_Builtin, Sign_Vector_f16) {
|
||||||
|
Enable(ast::Extension::kF16);
|
||||||
|
|
||||||
|
auto* val = Var("val", ty.vec3<f16>());
|
||||||
|
auto* call = Call("sign", val);
|
||||||
|
WrapInFunction(val, call);
|
||||||
|
|
||||||
|
GeneratorImpl& gen = SanitizeAndBuild();
|
||||||
|
|
||||||
|
ASSERT_TRUE(gen.Generate()) << gen.error();
|
||||||
|
EXPECT_EQ(gen.result(), R"([numthreads(1, 1, 1)]
|
||||||
|
void test_function() {
|
||||||
|
vector<float16_t, 3> val = vector<float16_t, 3>(float16_t(0.0h), float16_t(0.0h), float16_t(0.0h));
|
||||||
|
const vector<float16_t, 3> tint_symbol = vector<float16_t, 3>(sign(val));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
)");
|
||||||
|
}
|
||||||
|
|
||||||
TEST_F(HlslGeneratorImplTest_Builtin, Pack4x8Snorm) {
|
TEST_F(HlslGeneratorImplTest_Builtin, Pack4x8Snorm) {
|
||||||
auto* call = Call("pack4x8snorm", "p1");
|
auto* call = Call("pack4x8snorm", "p1");
|
||||||
GlobalVar("p1", ty.vec4<f32>(), ast::AddressSpace::kPrivate);
|
GlobalVar("p1", ty.vec4<f32>(), ast::AddressSpace::kPrivate);
|
||||||
|
|
|
@ -62,7 +62,6 @@ INSTANTIATE_TEST_SUITE_P(HlslGeneratorImplTest_Import,
|
||||||
HlslImportData{"log", "log"},
|
HlslImportData{"log", "log"},
|
||||||
HlslImportData{"log2", "log2"},
|
HlslImportData{"log2", "log2"},
|
||||||
HlslImportData{"round", "round"},
|
HlslImportData{"round", "round"},
|
||||||
HlslImportData{"sign", "sign"},
|
|
||||||
HlslImportData{"sin", "sin"},
|
HlslImportData{"sin", "sin"},
|
||||||
HlslImportData{"sinh", "sinh"},
|
HlslImportData{"sinh", "sinh"},
|
||||||
HlslImportData{"sqrt", "sqrt"},
|
HlslImportData{"sqrt", "sqrt"},
|
||||||
|
@ -121,7 +120,6 @@ INSTANTIATE_TEST_SUITE_P(HlslGeneratorImplTest_Import,
|
||||||
HlslImportData{"log2", "log2"},
|
HlslImportData{"log2", "log2"},
|
||||||
HlslImportData{"normalize", "normalize"},
|
HlslImportData{"normalize", "normalize"},
|
||||||
HlslImportData{"round", "round"},
|
HlslImportData{"round", "round"},
|
||||||
HlslImportData{"sign", "sign"},
|
|
||||||
HlslImportData{"sin", "sin"},
|
HlslImportData{"sin", "sin"},
|
||||||
HlslImportData{"sinh", "sinh"},
|
HlslImportData{"sinh", "sinh"},
|
||||||
HlslImportData{"sqrt", "sqrt"},
|
HlslImportData{"sqrt", "sqrt"},
|
||||||
|
|
|
@ -31,8 +31,8 @@ RWTexture2D<float4> outImage : register(u1, space0);
|
||||||
|
|
||||||
float3 gammaCorrection(float3 v, GammaTransferParams params) {
|
float3 gammaCorrection(float3 v, GammaTransferParams params) {
|
||||||
const bool3 cond = (abs(v) < float3((params.D).xxx));
|
const bool3 cond = (abs(v) < float3((params.D).xxx));
|
||||||
const float3 t_1 = (sign(v) * ((params.C * abs(v)) + params.F));
|
const float3 t_1 = (float3(sign(v)) * ((params.C * abs(v)) + params.F));
|
||||||
const float3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), float3((params.G).xxx)) + params.E));
|
const float3 f = (float3(sign(v)) * (pow(((params.A * abs(v)) + params.B), float3((params.G).xxx)) + params.E));
|
||||||
return (cond ? t_1 : f);
|
return (cond ? t_1 : f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,8 +31,8 @@ RWTexture2D<float4> outImage : register(u1, space0);
|
||||||
|
|
||||||
float3 gammaCorrection(float3 v, GammaTransferParams params) {
|
float3 gammaCorrection(float3 v, GammaTransferParams params) {
|
||||||
const bool3 cond = (abs(v) < float3((params.D).xxx));
|
const bool3 cond = (abs(v) < float3((params.D).xxx));
|
||||||
const float3 t_1 = (sign(v) * ((params.C * abs(v)) + params.F));
|
const float3 t_1 = (float3(sign(v)) * ((params.C * abs(v)) + params.F));
|
||||||
const float3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), float3((params.G).xxx)) + params.E));
|
const float3 f = (float3(sign(v)) * (pow(((params.A * abs(v)) + params.B), float3((params.G).xxx)) + params.E));
|
||||||
return (cond ? t_1 : f);
|
return (cond ? t_1 : f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ float binaryOperation_f1_f1_(inout float a, inout float b) {
|
||||||
const float x_34 = a;
|
const float x_34 = a;
|
||||||
const float x_36 = a;
|
const float x_36 = a;
|
||||||
const float x_38 = b;
|
const float x_38 = b;
|
||||||
x_26 = (sign(x_34) * pow(abs(x_36), x_38));
|
x_26 = (float(sign(x_34)) * pow(abs(x_36), x_38));
|
||||||
}
|
}
|
||||||
const float x_41 = x_26;
|
const float x_41 = x_26;
|
||||||
return x_41;
|
return x_41;
|
||||||
|
|
|
@ -21,7 +21,7 @@ float binaryOperation_f1_f1_(inout float a, inout float b) {
|
||||||
const float x_34 = a;
|
const float x_34 = a;
|
||||||
const float x_36 = a;
|
const float x_36 = a;
|
||||||
const float x_38 = b;
|
const float x_38 = b;
|
||||||
x_26 = (sign(x_34) * pow(abs(x_36), x_38));
|
x_26 = (float(sign(x_34)) * pow(abs(x_36), x_38));
|
||||||
}
|
}
|
||||||
const float x_41 = x_26;
|
const float x_41 = x_26;
|
||||||
return x_41;
|
return x_41;
|
||||||
|
|
|
@ -4,7 +4,7 @@ void set_float3(inout float3 vec, int idx, float val) {
|
||||||
|
|
||||||
float3 Bad(uint index, float3 rd) {
|
float3 Bad(uint index, float3 rd) {
|
||||||
float3 normal = (0.0f).xxx;
|
float3 normal = (0.0f).xxx;
|
||||||
set_float3(normal, index, -(sign(rd[index])));
|
set_float3(normal, index, -(float(sign(rd[index]))));
|
||||||
return normalize(normal);
|
return normalize(normal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ void set_float3(inout float3 vec, int idx, float val) {
|
||||||
|
|
||||||
float3 Bad(uint index, float3 rd) {
|
float3 Bad(uint index, float3 rd) {
|
||||||
float3 normal = (0.0f).xxx;
|
float3 normal = (0.0f).xxx;
|
||||||
set_float3(normal, index, -(sign(rd[index])));
|
set_float3(normal, index, -(float(sign(rd[index]))));
|
||||||
return normalize(normal);
|
return normalize(normal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,8 +26,8 @@ Texture2D<float4> arg_0 : register(t0, space1);
|
||||||
|
|
||||||
float3 gammaCorrection(float3 v, GammaTransferParams params) {
|
float3 gammaCorrection(float3 v, GammaTransferParams params) {
|
||||||
const bool3 cond = (abs(v) < float3((params.D).xxx));
|
const bool3 cond = (abs(v) < float3((params.D).xxx));
|
||||||
const float3 t = (sign(v) * ((params.C * abs(v)) + params.F));
|
const float3 t = (float3(sign(v)) * ((params.C * abs(v)) + params.F));
|
||||||
const float3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), float3((params.G).xxx)) + params.E));
|
const float3 f = (float3(sign(v)) * (pow(((params.A * abs(v)) + params.B), float3((params.G).xxx)) + params.E));
|
||||||
return (cond ? t : f);
|
return (cond ? t : f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,8 +26,8 @@ Texture2D<float4> arg_0 : register(t0, space1);
|
||||||
|
|
||||||
float3 gammaCorrection(float3 v, GammaTransferParams params) {
|
float3 gammaCorrection(float3 v, GammaTransferParams params) {
|
||||||
const bool3 cond = (abs(v) < float3((params.D).xxx));
|
const bool3 cond = (abs(v) < float3((params.D).xxx));
|
||||||
const float3 t = (sign(v) * ((params.C * abs(v)) + params.F));
|
const float3 t = (float3(sign(v)) * ((params.C * abs(v)) + params.F));
|
||||||
const float3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), float3((params.G).xxx)) + params.E));
|
const float3 f = (float3(sign(v)) * (pow(((params.A * abs(v)) + params.B), float3((params.G).xxx)) + params.E));
|
||||||
return (cond ? t : f);
|
return (cond ? t : f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,8 +26,8 @@ Texture2D<float4> arg_0 : register(t0, space1);
|
||||||
|
|
||||||
float3 gammaCorrection(float3 v, GammaTransferParams params) {
|
float3 gammaCorrection(float3 v, GammaTransferParams params) {
|
||||||
const bool3 cond = (abs(v) < float3((params.D).xxx));
|
const bool3 cond = (abs(v) < float3((params.D).xxx));
|
||||||
const float3 t = (sign(v) * ((params.C * abs(v)) + params.F));
|
const float3 t = (float3(sign(v)) * ((params.C * abs(v)) + params.F));
|
||||||
const float3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), float3((params.G).xxx)) + params.E));
|
const float3 f = (float3(sign(v)) * (pow(((params.A * abs(v)) + params.B), float3((params.G).xxx)) + params.E));
|
||||||
return (cond ? t : f);
|
return (cond ? t : f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,8 +26,8 @@ Texture2D<float4> arg_0 : register(t0, space1);
|
||||||
|
|
||||||
float3 gammaCorrection(float3 v, GammaTransferParams params) {
|
float3 gammaCorrection(float3 v, GammaTransferParams params) {
|
||||||
const bool3 cond = (abs(v) < float3((params.D).xxx));
|
const bool3 cond = (abs(v) < float3((params.D).xxx));
|
||||||
const float3 t = (sign(v) * ((params.C * abs(v)) + params.F));
|
const float3 t = (float3(sign(v)) * ((params.C * abs(v)) + params.F));
|
||||||
const float3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), float3((params.G).xxx)) + params.E));
|
const float3 f = (float3(sign(v)) * (pow(((params.A * abs(v)) + params.B), float3((params.G).xxx)) + params.E));
|
||||||
return (cond ? t : f);
|
return (cond ? t : f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,8 +27,8 @@ SamplerState arg_1 : register(s1, space1);
|
||||||
|
|
||||||
float3 gammaCorrection(float3 v, GammaTransferParams params) {
|
float3 gammaCorrection(float3 v, GammaTransferParams params) {
|
||||||
const bool3 cond = (abs(v) < float3((params.D).xxx));
|
const bool3 cond = (abs(v) < float3((params.D).xxx));
|
||||||
const float3 t = (sign(v) * ((params.C * abs(v)) + params.F));
|
const float3 t = (float3(sign(v)) * ((params.C * abs(v)) + params.F));
|
||||||
const float3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), float3((params.G).xxx)) + params.E));
|
const float3 f = (float3(sign(v)) * (pow(((params.A * abs(v)) + params.B), float3((params.G).xxx)) + params.E));
|
||||||
return (cond ? t : f);
|
return (cond ? t : f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,8 +27,8 @@ SamplerState arg_1 : register(s1, space1);
|
||||||
|
|
||||||
float3 gammaCorrection(float3 v, GammaTransferParams params) {
|
float3 gammaCorrection(float3 v, GammaTransferParams params) {
|
||||||
const bool3 cond = (abs(v) < float3((params.D).xxx));
|
const bool3 cond = (abs(v) < float3((params.D).xxx));
|
||||||
const float3 t = (sign(v) * ((params.C * abs(v)) + params.F));
|
const float3 t = (float3(sign(v)) * ((params.C * abs(v)) + params.F));
|
||||||
const float3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), float3((params.G).xxx)) + params.E));
|
const float3 f = (float3(sign(v)) * (pow(((params.A * abs(v)) + params.B), float3((params.G).xxx)) + params.E));
|
||||||
return (cond ? t : f);
|
return (cond ? t : f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
void sign_159665() {
|
void sign_159665() {
|
||||||
float3 arg_0 = (1.0f).xxx;
|
float3 arg_0 = (1.0f).xxx;
|
||||||
float3 res = sign(arg_0);
|
float3 res = float3(sign(arg_0));
|
||||||
}
|
}
|
||||||
|
|
||||||
struct tint_symbol {
|
struct tint_symbol {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
void sign_159665() {
|
void sign_159665() {
|
||||||
float3 arg_0 = (1.0f).xxx;
|
float3 arg_0 = (1.0f).xxx;
|
||||||
float3 res = sign(arg_0);
|
float3 res = float3(sign(arg_0));
|
||||||
}
|
}
|
||||||
|
|
||||||
struct tint_symbol {
|
struct tint_symbol {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
void sign_160933() {
|
void sign_160933() {
|
||||||
vector<float16_t, 4> arg_0 = (float16_t(1.0h)).xxxx;
|
vector<float16_t, 4> arg_0 = (float16_t(1.0h)).xxxx;
|
||||||
vector<float16_t, 4> res = sign(arg_0);
|
vector<float16_t, 4> res = vector<float16_t, 4>(sign(arg_0));
|
||||||
}
|
}
|
||||||
|
|
||||||
struct tint_symbol {
|
struct tint_symbol {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
void sign_3233fa() {
|
void sign_3233fa() {
|
||||||
int arg_0 = 1;
|
int arg_0 = 1;
|
||||||
int res = sign(arg_0);
|
int res = int(sign(arg_0));
|
||||||
}
|
}
|
||||||
|
|
||||||
struct tint_symbol {
|
struct tint_symbol {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
void sign_3233fa() {
|
void sign_3233fa() {
|
||||||
int arg_0 = 1;
|
int arg_0 = 1;
|
||||||
int res = sign(arg_0);
|
int res = int(sign(arg_0));
|
||||||
}
|
}
|
||||||
|
|
||||||
struct tint_symbol {
|
struct tint_symbol {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
void sign_58d779() {
|
void sign_58d779() {
|
||||||
int4 arg_0 = (1).xxxx;
|
int4 arg_0 = (1).xxxx;
|
||||||
int4 res = sign(arg_0);
|
int4 res = int4(sign(arg_0));
|
||||||
}
|
}
|
||||||
|
|
||||||
struct tint_symbol {
|
struct tint_symbol {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
void sign_58d779() {
|
void sign_58d779() {
|
||||||
int4 arg_0 = (1).xxxx;
|
int4 arg_0 = (1).xxxx;
|
||||||
int4 res = sign(arg_0);
|
int4 res = int4(sign(arg_0));
|
||||||
}
|
}
|
||||||
|
|
||||||
struct tint_symbol {
|
struct tint_symbol {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
void sign_5d283a() {
|
void sign_5d283a() {
|
||||||
vector<float16_t, 3> arg_0 = (float16_t(1.0h)).xxx;
|
vector<float16_t, 3> arg_0 = (float16_t(1.0h)).xxx;
|
||||||
vector<float16_t, 3> res = sign(arg_0);
|
vector<float16_t, 3> res = vector<float16_t, 3>(sign(arg_0));
|
||||||
}
|
}
|
||||||
|
|
||||||
struct tint_symbol {
|
struct tint_symbol {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
void sign_7c85ea() {
|
void sign_7c85ea() {
|
||||||
float16_t arg_0 = float16_t(1.0h);
|
float16_t arg_0 = float16_t(1.0h);
|
||||||
float16_t res = sign(arg_0);
|
float16_t res = float16_t(sign(arg_0));
|
||||||
}
|
}
|
||||||
|
|
||||||
struct tint_symbol {
|
struct tint_symbol {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
void sign_926015() {
|
void sign_926015() {
|
||||||
int2 arg_0 = (1).xx;
|
int2 arg_0 = (1).xx;
|
||||||
int2 res = sign(arg_0);
|
int2 res = int2(sign(arg_0));
|
||||||
}
|
}
|
||||||
|
|
||||||
struct tint_symbol {
|
struct tint_symbol {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
void sign_926015() {
|
void sign_926015() {
|
||||||
int2 arg_0 = (1).xx;
|
int2 arg_0 = (1).xx;
|
||||||
int2 res = sign(arg_0);
|
int2 res = int2(sign(arg_0));
|
||||||
}
|
}
|
||||||
|
|
||||||
struct tint_symbol {
|
struct tint_symbol {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
void sign_9603b1() {
|
void sign_9603b1() {
|
||||||
int3 arg_0 = (1).xxx;
|
int3 arg_0 = (1).xxx;
|
||||||
int3 res = sign(arg_0);
|
int3 res = int3(sign(arg_0));
|
||||||
}
|
}
|
||||||
|
|
||||||
struct tint_symbol {
|
struct tint_symbol {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
void sign_9603b1() {
|
void sign_9603b1() {
|
||||||
int3 arg_0 = (1).xxx;
|
int3 arg_0 = (1).xxx;
|
||||||
int3 res = sign(arg_0);
|
int3 res = int3(sign(arg_0));
|
||||||
}
|
}
|
||||||
|
|
||||||
struct tint_symbol {
|
struct tint_symbol {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
void sign_b8f634() {
|
void sign_b8f634() {
|
||||||
float4 arg_0 = (1.0f).xxxx;
|
float4 arg_0 = (1.0f).xxxx;
|
||||||
float4 res = sign(arg_0);
|
float4 res = float4(sign(arg_0));
|
||||||
}
|
}
|
||||||
|
|
||||||
struct tint_symbol {
|
struct tint_symbol {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
void sign_b8f634() {
|
void sign_b8f634() {
|
||||||
float4 arg_0 = (1.0f).xxxx;
|
float4 arg_0 = (1.0f).xxxx;
|
||||||
float4 res = sign(arg_0);
|
float4 res = float4(sign(arg_0));
|
||||||
}
|
}
|
||||||
|
|
||||||
struct tint_symbol {
|
struct tint_symbol {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
void sign_ccdb3c() {
|
void sign_ccdb3c() {
|
||||||
vector<float16_t, 2> arg_0 = (float16_t(1.0h)).xx;
|
vector<float16_t, 2> arg_0 = (float16_t(1.0h)).xx;
|
||||||
vector<float16_t, 2> res = sign(arg_0);
|
vector<float16_t, 2> res = vector<float16_t, 2>(sign(arg_0));
|
||||||
}
|
}
|
||||||
|
|
||||||
struct tint_symbol {
|
struct tint_symbol {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
void sign_d065d8() {
|
void sign_d065d8() {
|
||||||
float2 arg_0 = (1.0f).xx;
|
float2 arg_0 = (1.0f).xx;
|
||||||
float2 res = sign(arg_0);
|
float2 res = float2(sign(arg_0));
|
||||||
}
|
}
|
||||||
|
|
||||||
struct tint_symbol {
|
struct tint_symbol {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
void sign_d065d8() {
|
void sign_d065d8() {
|
||||||
float2 arg_0 = (1.0f).xx;
|
float2 arg_0 = (1.0f).xx;
|
||||||
float2 res = sign(arg_0);
|
float2 res = float2(sign(arg_0));
|
||||||
}
|
}
|
||||||
|
|
||||||
struct tint_symbol {
|
struct tint_symbol {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
void sign_dd790e() {
|
void sign_dd790e() {
|
||||||
float arg_0 = 1.0f;
|
float arg_0 = 1.0f;
|
||||||
float res = sign(arg_0);
|
float res = float(sign(arg_0));
|
||||||
}
|
}
|
||||||
|
|
||||||
struct tint_symbol {
|
struct tint_symbol {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
void sign_dd790e() {
|
void sign_dd790e() {
|
||||||
float arg_0 = 1.0f;
|
float arg_0 = 1.0f;
|
||||||
float res = sign(arg_0);
|
float res = float(sign(arg_0));
|
||||||
}
|
}
|
||||||
|
|
||||||
struct tint_symbol {
|
struct tint_symbol {
|
||||||
|
|
|
@ -26,8 +26,8 @@ Texture2D<float4> arg_0 : register(t0, space1);
|
||||||
|
|
||||||
float3 gammaCorrection(float3 v, GammaTransferParams params) {
|
float3 gammaCorrection(float3 v, GammaTransferParams params) {
|
||||||
const bool3 cond = (abs(v) < float3((params.D).xxx));
|
const bool3 cond = (abs(v) < float3((params.D).xxx));
|
||||||
const float3 t = (sign(v) * ((params.C * abs(v)) + params.F));
|
const float3 t = (float3(sign(v)) * ((params.C * abs(v)) + params.F));
|
||||||
const float3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), float3((params.G).xxx)) + params.E));
|
const float3 f = (float3(sign(v)) * (pow(((params.A * abs(v)) + params.B), float3((params.G).xxx)) + params.E));
|
||||||
return (cond ? t : f);
|
return (cond ? t : f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,8 +26,8 @@ Texture2D<float4> arg_0 : register(t0, space1);
|
||||||
|
|
||||||
float3 gammaCorrection(float3 v, GammaTransferParams params) {
|
float3 gammaCorrection(float3 v, GammaTransferParams params) {
|
||||||
const bool3 cond = (abs(v) < float3((params.D).xxx));
|
const bool3 cond = (abs(v) < float3((params.D).xxx));
|
||||||
const float3 t = (sign(v) * ((params.C * abs(v)) + params.F));
|
const float3 t = (float3(sign(v)) * ((params.C * abs(v)) + params.F));
|
||||||
const float3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), float3((params.G).xxx)) + params.E));
|
const float3 f = (float3(sign(v)) * (pow(((params.A * abs(v)) + params.B), float3((params.G).xxx)) + params.E));
|
||||||
return (cond ? t : f);
|
return (cond ? t : f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,8 +26,8 @@ Texture2D<float4> arg_0 : register(t0, space1);
|
||||||
|
|
||||||
float3 gammaCorrection(float3 v, GammaTransferParams params) {
|
float3 gammaCorrection(float3 v, GammaTransferParams params) {
|
||||||
const bool3 cond = (abs(v) < float3((params.D).xxx));
|
const bool3 cond = (abs(v) < float3((params.D).xxx));
|
||||||
const float3 t = (sign(v) * ((params.C * abs(v)) + params.F));
|
const float3 t = (float3(sign(v)) * ((params.C * abs(v)) + params.F));
|
||||||
const float3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), float3((params.G).xxx)) + params.E));
|
const float3 f = (float3(sign(v)) * (pow(((params.A * abs(v)) + params.B), float3((params.G).xxx)) + params.E));
|
||||||
return (cond ? t : f);
|
return (cond ? t : f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,8 +26,8 @@ Texture2D<float4> arg_0 : register(t0, space1);
|
||||||
|
|
||||||
float3 gammaCorrection(float3 v, GammaTransferParams params) {
|
float3 gammaCorrection(float3 v, GammaTransferParams params) {
|
||||||
const bool3 cond = (abs(v) < float3((params.D).xxx));
|
const bool3 cond = (abs(v) < float3((params.D).xxx));
|
||||||
const float3 t = (sign(v) * ((params.C * abs(v)) + params.F));
|
const float3 t = (float3(sign(v)) * ((params.C * abs(v)) + params.F));
|
||||||
const float3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), float3((params.G).xxx)) + params.E));
|
const float3 f = (float3(sign(v)) * (pow(((params.A * abs(v)) + params.B), float3((params.G).xxx)) + params.E));
|
||||||
return (cond ? t : f);
|
return (cond ? t : f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,8 +27,8 @@ SamplerState arg_1 : register(s1, space1);
|
||||||
|
|
||||||
float3 gammaCorrection(float3 v, GammaTransferParams params) {
|
float3 gammaCorrection(float3 v, GammaTransferParams params) {
|
||||||
const bool3 cond = (abs(v) < float3((params.D).xxx));
|
const bool3 cond = (abs(v) < float3((params.D).xxx));
|
||||||
const float3 t = (sign(v) * ((params.C * abs(v)) + params.F));
|
const float3 t = (float3(sign(v)) * ((params.C * abs(v)) + params.F));
|
||||||
const float3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), float3((params.G).xxx)) + params.E));
|
const float3 f = (float3(sign(v)) * (pow(((params.A * abs(v)) + params.B), float3((params.G).xxx)) + params.E));
|
||||||
return (cond ? t : f);
|
return (cond ? t : f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,8 +27,8 @@ SamplerState arg_1 : register(s1, space1);
|
||||||
|
|
||||||
float3 gammaCorrection(float3 v, GammaTransferParams params) {
|
float3 gammaCorrection(float3 v, GammaTransferParams params) {
|
||||||
const bool3 cond = (abs(v) < float3((params.D).xxx));
|
const bool3 cond = (abs(v) < float3((params.D).xxx));
|
||||||
const float3 t = (sign(v) * ((params.C * abs(v)) + params.F));
|
const float3 t = (float3(sign(v)) * ((params.C * abs(v)) + params.F));
|
||||||
const float3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), float3((params.G).xxx)) + params.E));
|
const float3 f = (float3(sign(v)) * (pow(((params.A * abs(v)) + params.B), float3((params.G).xxx)) + params.E));
|
||||||
return (cond ? t : f);
|
return (cond ? t : f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,8 +26,8 @@ Texture2D<float4> arg_0 : register(t0, space1);
|
||||||
|
|
||||||
float3 gammaCorrection(float3 v, GammaTransferParams params) {
|
float3 gammaCorrection(float3 v, GammaTransferParams params) {
|
||||||
const bool3 cond = (abs(v) < float3((params.D).xxx));
|
const bool3 cond = (abs(v) < float3((params.D).xxx));
|
||||||
const float3 t = (sign(v) * ((params.C * abs(v)) + params.F));
|
const float3 t = (float3(sign(v)) * ((params.C * abs(v)) + params.F));
|
||||||
const float3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), float3((params.G).xxx)) + params.E));
|
const float3 f = (float3(sign(v)) * (pow(((params.A * abs(v)) + params.B), float3((params.G).xxx)) + params.E));
|
||||||
return (cond ? t : f);
|
return (cond ? t : f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,8 +26,8 @@ Texture2D<float4> arg_0 : register(t0, space1);
|
||||||
|
|
||||||
float3 gammaCorrection(float3 v, GammaTransferParams params) {
|
float3 gammaCorrection(float3 v, GammaTransferParams params) {
|
||||||
const bool3 cond = (abs(v) < float3((params.D).xxx));
|
const bool3 cond = (abs(v) < float3((params.D).xxx));
|
||||||
const float3 t = (sign(v) * ((params.C * abs(v)) + params.F));
|
const float3 t = (float3(sign(v)) * ((params.C * abs(v)) + params.F));
|
||||||
const float3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), float3((params.G).xxx)) + params.E));
|
const float3 f = (float3(sign(v)) * (pow(((params.A * abs(v)) + params.B), float3((params.G).xxx)) + params.E));
|
||||||
return (cond ? t : f);
|
return (cond ? t : f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -250,18 +250,6 @@ crbug.com/tint/1794 [ intel-gen-9 ubuntu ] webgpu:shader,execution,expression,ca
|
||||||
crbug.com/tint/1794 [ intel-gen-9 ubuntu ] webgpu:shader,execution,expression,call,builtin,firstTrailingBit:u32:inputSource="uniform";vectorize=2 [ Failure ]
|
crbug.com/tint/1794 [ intel-gen-9 ubuntu ] webgpu:shader,execution,expression,call,builtin,firstTrailingBit:u32:inputSource="uniform";vectorize=2 [ Failure ]
|
||||||
crbug.com/tint/1794 [ intel-gen-9 ubuntu ] webgpu:shader,execution,expression,call,builtin,firstTrailingBit:u32:inputSource="uniform";vectorize=3 [ Failure ]
|
crbug.com/tint/1794 [ intel-gen-9 ubuntu ] webgpu:shader,execution,expression,call,builtin,firstTrailingBit:u32:inputSource="uniform";vectorize=3 [ Failure ]
|
||||||
crbug.com/tint/1794 [ intel-gen-9 ubuntu ] webgpu:shader,execution,expression,call,builtin,firstTrailingBit:u32:inputSource="uniform";vectorize=4 [ Failure ]
|
crbug.com/tint/1794 [ intel-gen-9 ubuntu ] webgpu:shader,execution,expression,call,builtin,firstTrailingBit:u32:inputSource="uniform";vectorize=4 [ Failure ]
|
||||||
crbug.com/tint/1795 [ win10 ] webgpu:shader,execution,expression,call,builtin,sign:f32:inputSource="storage_r";vectorize="_undef_" [ Failure ]
|
|
||||||
crbug.com/tint/1795 [ win10 ] webgpu:shader,execution,expression,call,builtin,sign:f32:inputSource="storage_r";vectorize=2 [ Failure ]
|
|
||||||
crbug.com/tint/1795 [ win10 ] webgpu:shader,execution,expression,call,builtin,sign:f32:inputSource="storage_r";vectorize=3 [ Failure ]
|
|
||||||
crbug.com/tint/1795 [ win10 ] webgpu:shader,execution,expression,call,builtin,sign:f32:inputSource="storage_r";vectorize=4 [ Failure ]
|
|
||||||
crbug.com/tint/1795 [ win10 ] webgpu:shader,execution,expression,call,builtin,sign:f32:inputSource="storage_rw";vectorize="_undef_" [ Failure ]
|
|
||||||
crbug.com/tint/1795 [ win10 ] webgpu:shader,execution,expression,call,builtin,sign:f32:inputSource="storage_rw";vectorize=2 [ Failure ]
|
|
||||||
crbug.com/tint/1795 [ win10 ] webgpu:shader,execution,expression,call,builtin,sign:f32:inputSource="storage_rw";vectorize=3 [ Failure ]
|
|
||||||
crbug.com/tint/1795 [ win10 ] webgpu:shader,execution,expression,call,builtin,sign:f32:inputSource="storage_rw";vectorize=4 [ Failure ]
|
|
||||||
crbug.com/tint/1795 [ win10 ] webgpu:shader,execution,expression,call,builtin,sign:f32:inputSource="uniform";vectorize="_undef_" [ Failure ]
|
|
||||||
crbug.com/tint/1795 [ win10 ] webgpu:shader,execution,expression,call,builtin,sign:f32:inputSource="uniform";vectorize=2 [ Failure ]
|
|
||||||
crbug.com/tint/1795 [ win10 ] webgpu:shader,execution,expression,call,builtin,sign:f32:inputSource="uniform";vectorize=3 [ Failure ]
|
|
||||||
crbug.com/tint/1795 [ win10 ] webgpu:shader,execution,expression,call,builtin,sign:f32:inputSource="uniform";vectorize=4 [ Failure ]
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# webgpu:shader,execution,memory_model
|
# webgpu:shader,execution,memory_model
|
||||||
|
|
Loading…
Reference in New Issue