[intrinsics] rm f32 overloads of reflect, faceForward

These were removed from the spec in:
https://github.com/gpuweb/gpuweb/pull/1914

Bug: tint:921
Change-Id: I4e584fdee9cf540a192f12d1208595056e081410
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/57300
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: James Price <jrprice@google.com>
This commit is contained in:
Ben Clayton 2021-07-08 15:08:53 +00:00 committed by Tint LUCI CQ
parent 99a78ad72f
commit 70a3fa1ee9
17 changed files with 1688 additions and 2037 deletions

File diff suppressed because it is too large Load Diff

View File

@ -301,7 +301,6 @@ fn exp(f32) -> f32
fn exp<N: num>(vec<N, f32>) -> vec<N, f32> fn exp<N: num>(vec<N, f32>) -> vec<N, f32>
fn exp2(f32) -> f32 fn exp2(f32) -> f32
fn exp2<N: num>(vec<N, f32>) -> vec<N, f32> fn exp2<N: num>(vec<N, f32>) -> vec<N, f32>
fn faceForward(f32, f32, f32) -> f32
fn faceForward<N: num>(vec<N, f32>, vec<N, f32>, vec<N, f32>) -> vec<N, f32> fn faceForward<N: num>(vec<N, f32>, vec<N, f32>, vec<N, f32>) -> vec<N, f32>
fn floor(f32) -> f32 fn floor(f32) -> f32
fn floor<N: num>(vec<N, f32>) -> vec<N, f32> fn floor<N: num>(vec<N, f32>) -> vec<N, f32>
@ -352,7 +351,6 @@ fn pack4x8snorm(vec4<f32>) -> u32
fn pack4x8unorm(vec4<f32>) -> u32 fn pack4x8unorm(vec4<f32>) -> u32
fn pow(f32, f32) -> f32 fn pow(f32, f32) -> f32
fn pow<N: num>(vec<N, f32>, vec<N, f32>) -> vec<N, f32> fn pow<N: num>(vec<N, f32>, vec<N, f32>) -> vec<N, f32>
fn reflect(f32, f32) -> f32
fn reflect<N: num>(vec<N, f32>, vec<N, f32>) -> vec<N, f32> fn reflect<N: num>(vec<N, f32>, vec<N, f32>) -> vec<N, f32>
fn refract<N: num>(vec<N, f32>, vec<N, f32>, f32) -> vec<N, f32> fn refract<N: num>(vec<N, f32>, vec<N, f32>, f32) -> vec<N, f32>
fn reverseBits<T: iu32>(T) -> T fn reverseBits<T: iu32>(T) -> T

View File

@ -962,7 +962,6 @@ INSTANTIATE_TEST_SUITE_P(ResolverBuiltinsValidationTest,
std::make_tuple("dpdyFine", 1), std::make_tuple("dpdyFine", 1),
std::make_tuple("exp", 1), std::make_tuple("exp", 1),
std::make_tuple("exp2", 1), std::make_tuple("exp2", 1),
std::make_tuple("faceForward", 3),
std::make_tuple("floor", 1), std::make_tuple("floor", 1),
std::make_tuple("fma", 3), std::make_tuple("fma", 3),
std::make_tuple("fract", 1), std::make_tuple("fract", 1),
@ -976,7 +975,6 @@ INSTANTIATE_TEST_SUITE_P(ResolverBuiltinsValidationTest,
std::make_tuple("min", 2), std::make_tuple("min", 2),
std::make_tuple("mix", 3), std::make_tuple("mix", 3),
std::make_tuple("pow", 2), std::make_tuple("pow", 2),
std::make_tuple("reflect", 2),
std::make_tuple("round", 1), std::make_tuple("round", 1),
std::make_tuple("sign", 1), std::make_tuple("sign", 1),
std::make_tuple("sin", 1), std::make_tuple("sin", 1),

View File

@ -1190,8 +1190,7 @@ INSTANTIATE_TEST_SUITE_P(
ResolverIntrinsicTest_TwoParam, ResolverIntrinsicTest_TwoParam,
testing::Values(IntrinsicData{"atan2", IntrinsicType::kAtan2}, testing::Values(IntrinsicData{"atan2", IntrinsicType::kAtan2},
IntrinsicData{"pow", IntrinsicType::kPow}, IntrinsicData{"pow", IntrinsicType::kPow},
IntrinsicData{"step", IntrinsicType::kStep}, IntrinsicData{"step", IntrinsicType::kStep}));
IntrinsicData{"reflect", IntrinsicType::kReflect}));
TEST_F(ResolverIntrinsicTest, Distance_Scalar) { TEST_F(ResolverIntrinsicTest, Distance_Scalar) {
auto* call = Call("distance", 1.f, 1.f); auto* call = Call("distance", 1.f, 1.f);
@ -1369,8 +1368,7 @@ INSTANTIATE_TEST_SUITE_P(
ResolverIntrinsicTest_ThreeParam, ResolverIntrinsicTest_ThreeParam,
testing::Values(IntrinsicData{"mix", IntrinsicType::kMix}, testing::Values(IntrinsicData{"mix", IntrinsicType::kMix},
IntrinsicData{"smoothStep", IntrinsicType::kSmoothStep}, IntrinsicData{"smoothStep", IntrinsicType::kSmoothStep},
IntrinsicData{"fma", IntrinsicType::kFma}, IntrinsicData{"fma", IntrinsicType::kFma}));
IntrinsicData{"faceForward", IntrinsicType::kFaceForward}));
using ResolverIntrinsicTest_ThreeParam_FloatOrInt = using ResolverIntrinsicTest_ThreeParam_FloatOrInt =
ResolverTestWithParam<IntrinsicData>; ResolverTestWithParam<IntrinsicData>;

View File

@ -130,8 +130,8 @@ INSTANTIATE_TEST_SUITE_P(HlslGeneratorImplTest_Import,
HlslImportData{"tanh", "tanh"}, HlslImportData{"tanh", "tanh"},
HlslImportData{"trunc", "trunc"})); HlslImportData{"trunc", "trunc"}));
using HlslImportData_DualParamTest = TestParamHelper<HlslImportData>; using HlslImportData_DualParam_ScalarTest = TestParamHelper<HlslImportData>;
TEST_P(HlslImportData_DualParamTest, FloatScalar) { TEST_P(HlslImportData_DualParam_ScalarTest, Float) {
auto param = GetParam(); auto param = GetParam();
auto* expr = Call(param.name, 1.f, 2.f); auto* expr = Call(param.name, 1.f, 2.f);
@ -144,17 +144,16 @@ TEST_P(HlslImportData_DualParamTest, FloatScalar) {
EXPECT_EQ(out.str(), std::string(param.hlsl_name) + "(1.0f, 2.0f)"); EXPECT_EQ(out.str(), std::string(param.hlsl_name) + "(1.0f, 2.0f)");
} }
INSTANTIATE_TEST_SUITE_P(HlslGeneratorImplTest_Import, INSTANTIATE_TEST_SUITE_P(HlslGeneratorImplTest_Import,
HlslImportData_DualParamTest, HlslImportData_DualParam_ScalarTest,
testing::Values(HlslImportData{"atan2", "atan2"}, testing::Values(HlslImportData{"atan2", "atan2"},
HlslImportData{"distance", "distance"}, HlslImportData{"distance", "distance"},
HlslImportData{"max", "max"}, HlslImportData{"max", "max"},
HlslImportData{"min", "min"}, HlslImportData{"min", "min"},
HlslImportData{"pow", "pow"}, HlslImportData{"pow", "pow"},
HlslImportData{"reflect", "reflect"},
HlslImportData{"step", "step"})); HlslImportData{"step", "step"}));
using HlslImportData_DualParam_VectorTest = TestParamHelper<HlslImportData>; using HlslImportData_DualParam_VectorTest = TestParamHelper<HlslImportData>;
TEST_P(HlslImportData_DualParam_VectorTest, FloatVector) { TEST_P(HlslImportData_DualParam_VectorTest, Float) {
auto param = GetParam(); auto param = GetParam();
auto* expr = auto* expr =
@ -171,7 +170,14 @@ TEST_P(HlslImportData_DualParam_VectorTest, FloatVector) {
} }
INSTANTIATE_TEST_SUITE_P(HlslGeneratorImplTest_Import, INSTANTIATE_TEST_SUITE_P(HlslGeneratorImplTest_Import,
HlslImportData_DualParam_VectorTest, HlslImportData_DualParam_VectorTest,
testing::Values(HlslImportData{"cross", "cross"})); testing::Values(HlslImportData{"atan2", "atan2"},
HlslImportData{"cross", "cross"},
HlslImportData{"distance", "distance"},
HlslImportData{"max", "max"},
HlslImportData{"min", "min"},
HlslImportData{"pow", "pow"},
HlslImportData{"reflect", "reflect"},
HlslImportData{"step", "step"}));
using HlslImportData_DualParam_Int_Test = TestParamHelper<HlslImportData>; using HlslImportData_DualParam_Int_Test = TestParamHelper<HlslImportData>;
TEST_P(HlslImportData_DualParam_Int_Test, IntScalar) { TEST_P(HlslImportData_DualParam_Int_Test, IntScalar) {
@ -191,8 +197,8 @@ INSTANTIATE_TEST_SUITE_P(HlslGeneratorImplTest_Import,
testing::Values(HlslImportData{"max", "max"}, testing::Values(HlslImportData{"max", "max"},
HlslImportData{"min", "min"})); HlslImportData{"min", "min"}));
using HlslImportData_TripleParamTest = TestParamHelper<HlslImportData>; using HlslImportData_TripleParam_ScalarTest = TestParamHelper<HlslImportData>;
TEST_P(HlslImportData_TripleParamTest, FloatScalar) { TEST_P(HlslImportData_TripleParam_ScalarTest, Float) {
auto param = GetParam(); auto param = GetParam();
auto* expr = Call(param.name, 1.f, 2.f, 3.f); auto* expr = Call(param.name, 1.f, 2.f, 3.f);
@ -204,9 +210,34 @@ TEST_P(HlslImportData_TripleParamTest, FloatScalar) {
ASSERT_TRUE(gen.EmitCall(out, expr)) << gen.error(); ASSERT_TRUE(gen.EmitCall(out, expr)) << gen.error();
EXPECT_EQ(out.str(), std::string(param.hlsl_name) + "(1.0f, 2.0f, 3.0f)"); EXPECT_EQ(out.str(), std::string(param.hlsl_name) + "(1.0f, 2.0f, 3.0f)");
} }
INSTANTIATE_TEST_SUITE_P(HlslGeneratorImplTest_Import,
HlslImportData_TripleParam_ScalarTest,
testing::Values(HlslImportData{"fma", "mad"},
HlslImportData{"mix", "lerp"},
HlslImportData{"clamp", "clamp"},
HlslImportData{"smoothStep",
"smoothstep"}));
using HlslImportData_TripleParam_VectorTest = TestParamHelper<HlslImportData>;
TEST_P(HlslImportData_TripleParam_VectorTest, Float) {
auto param = GetParam();
auto* expr = Call(param.name, vec3<f32>(1.f, 2.f, 3.f),
vec3<f32>(4.f, 5.f, 6.f), vec3<f32>(7.f, 8.f, 9.f));
WrapInFunction(expr);
GeneratorImpl& gen = Build();
std::stringstream out;
ASSERT_TRUE(gen.EmitCall(out, expr)) << gen.error();
EXPECT_EQ(
out.str(),
std::string(param.hlsl_name) +
R"((float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f)))");
}
INSTANTIATE_TEST_SUITE_P( INSTANTIATE_TEST_SUITE_P(
HlslGeneratorImplTest_Import, HlslGeneratorImplTest_Import,
HlslImportData_TripleParamTest, HlslImportData_TripleParam_VectorTest,
testing::Values(HlslImportData{"faceForward", "faceforward"}, testing::Values(HlslImportData{"faceForward", "faceforward"},
HlslImportData{"fma", "mad"}, HlslImportData{"fma", "mad"},
HlslImportData{"clamp", "clamp"}, HlslImportData{"clamp", "clamp"},

View File

@ -86,8 +86,8 @@ TEST_F(MslGeneratorImplTest, MslImportData_SingleParamTest_IntScalar) {
EXPECT_EQ(out.str(), R"(abs(1))"); EXPECT_EQ(out.str(), R"(abs(1))");
} }
using MslImportData_DualParamTest = TestParamHelper<MslImportData>; using MslImportData_DualParam_ScalarTest = TestParamHelper<MslImportData>;
TEST_P(MslImportData_DualParamTest, FloatScalar) { TEST_P(MslImportData_DualParam_ScalarTest, Float) {
auto param = GetParam(); auto param = GetParam();
auto* expr = Call(param.name, 1.0f, 2.0f); auto* expr = Call(param.name, 1.0f, 2.0f);
@ -100,17 +100,16 @@ TEST_P(MslImportData_DualParamTest, FloatScalar) {
EXPECT_EQ(out.str(), std::string(param.msl_name) + "(1.0f, 2.0f)"); EXPECT_EQ(out.str(), std::string(param.msl_name) + "(1.0f, 2.0f)");
} }
INSTANTIATE_TEST_SUITE_P(MslGeneratorImplTest, INSTANTIATE_TEST_SUITE_P(MslGeneratorImplTest,
MslImportData_DualParamTest, MslImportData_DualParam_ScalarTest,
testing::Values(MslImportData{"atan2", "atan2"}, testing::Values(MslImportData{"atan2", "atan2"},
MslImportData{"distance", "distance"}, MslImportData{"distance", "distance"},
MslImportData{"max", "fmax"}, MslImportData{"max", "fmax"},
MslImportData{"min", "fmin"}, MslImportData{"min", "fmin"},
MslImportData{"pow", "pow"}, MslImportData{"pow", "pow"},
MslImportData{"reflect", "reflect"},
MslImportData{"step", "step"})); MslImportData{"step", "step"}));
using MslImportData_DualParam_VectorTest = TestParamHelper<MslImportData>; using MslImportData_DualParam_VectorTest = TestParamHelper<MslImportData>;
TEST_P(MslImportData_DualParam_VectorTest, FloatVector) { TEST_P(MslImportData_DualParam_VectorTest, Float) {
auto param = GetParam(); auto param = GetParam();
auto* expr = auto* expr =
@ -121,13 +120,20 @@ TEST_P(MslImportData_DualParam_VectorTest, FloatVector) {
std::stringstream out; std::stringstream out;
ASSERT_TRUE(gen.EmitCall(out, expr)) << gen.error(); ASSERT_TRUE(gen.EmitCall(out, expr)) << gen.error();
EXPECT_EQ(out.str(), std::string(param.msl_name) + EXPECT_EQ(out.str(),
"(float3(1.0f, 2.0f, 3.0f), " std::string(param.msl_name) +
"float3(4.0f, 5.0f, 6.0f))"); R"((float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f)))");
} }
INSTANTIATE_TEST_SUITE_P(MslGeneratorImplTest, INSTANTIATE_TEST_SUITE_P(MslGeneratorImplTest,
MslImportData_DualParam_VectorTest, MslImportData_DualParam_VectorTest,
testing::Values(MslImportData{"cross", "cross"})); testing::Values(MslImportData{"atan2", "atan2"},
MslImportData{"cross", "cross"},
MslImportData{"distance", "distance"},
MslImportData{"max", "fmax"},
MslImportData{"min", "fmin"},
MslImportData{"pow", "pow"},
MslImportData{"reflect", "reflect"},
MslImportData{"step", "step"}));
using MslImportData_DualParam_Int_Test = TestParamHelper<MslImportData>; using MslImportData_DualParam_Int_Test = TestParamHelper<MslImportData>;
TEST_P(MslImportData_DualParam_Int_Test, IntScalar) { TEST_P(MslImportData_DualParam_Int_Test, IntScalar) {
@ -147,8 +153,8 @@ INSTANTIATE_TEST_SUITE_P(MslGeneratorImplTest,
testing::Values(MslImportData{"max", "max"}, testing::Values(MslImportData{"max", "max"},
MslImportData{"min", "min"})); MslImportData{"min", "min"}));
using MslImportData_TripleParamTest = TestParamHelper<MslImportData>; using MslImportData_TripleParam_ScalarTest = TestParamHelper<MslImportData>;
TEST_P(MslImportData_TripleParamTest, FloatScalar) { TEST_P(MslImportData_TripleParam_ScalarTest, Float) {
auto param = GetParam(); auto param = GetParam();
auto* expr = Call(param.name, 1.f, 2.f, 3.f); auto* expr = Call(param.name, 1.f, 2.f, 3.f);
@ -160,12 +166,36 @@ TEST_P(MslImportData_TripleParamTest, FloatScalar) {
ASSERT_TRUE(gen.EmitCall(out, expr)) << gen.error(); ASSERT_TRUE(gen.EmitCall(out, expr)) << gen.error();
EXPECT_EQ(out.str(), std::string(param.msl_name) + "(1.0f, 2.0f, 3.0f)"); EXPECT_EQ(out.str(), std::string(param.msl_name) + "(1.0f, 2.0f, 3.0f)");
} }
INSTANTIATE_TEST_SUITE_P(MslGeneratorImplTest,
MslImportData_TripleParam_ScalarTest,
testing::Values(MslImportData{"fma", "fma"},
MslImportData{"mix", "mix"},
MslImportData{"clamp", "clamp"},
MslImportData{"smoothStep",
"smoothstep"}));
using MslImportData_TripleParam_VectorTest = TestParamHelper<MslImportData>;
TEST_P(MslImportData_TripleParam_VectorTest, Float) {
auto param = GetParam();
auto* expr = Call(param.name, vec3<f32>(1.f, 2.f, 3.f),
vec3<f32>(4.f, 5.f, 6.f), vec3<f32>(7.f, 8.f, 9.f));
WrapInFunction(expr);
GeneratorImpl& gen = Build();
std::stringstream out;
ASSERT_TRUE(gen.EmitCall(out, expr)) << gen.error();
EXPECT_EQ(
out.str(),
std::string(param.msl_name) +
R"((float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f)))");
}
INSTANTIATE_TEST_SUITE_P( INSTANTIATE_TEST_SUITE_P(
MslGeneratorImplTest, MslGeneratorImplTest,
MslImportData_TripleParamTest, MslImportData_TripleParam_VectorTest,
testing::Values(MslImportData{"faceForward", "faceforward"}, testing::Values(MslImportData{"faceForward", "faceforward"},
MslImportData{"fma", "fma"}, MslImportData{"fma", "fma"},
MslImportData{"mix", "mix"},
MslImportData{"clamp", "clamp"}, MslImportData{"clamp", "clamp"},
MslImportData{"smoothStep", "smoothstep"})); MslImportData{"smoothStep", "smoothstep"}));

View File

@ -849,9 +849,37 @@ INSTANTIATE_TEST_SUITE_P(IntrinsicBuilderTest,
IntrinsicData{"max", "NMax"}, IntrinsicData{"max", "NMax"},
IntrinsicData{"min", "NMin"}, IntrinsicData{"min", "NMin"},
IntrinsicData{"pow", "Pow"}, IntrinsicData{"pow", "Pow"},
IntrinsicData{"reflect", "Reflect"},
IntrinsicData{"step", "Step"})); IntrinsicData{"step", "Step"}));
TEST_F(IntrinsicBuilderTest, Call_Reflect_Vector) {
auto* expr = Call("reflect", vec2<f32>(1.0f, 1.0f), vec2<f32>(1.0f, 1.0f));
WrapInFunction(expr);
auto* func = Func("a_func", ast::VariableList{}, ty.void_(),
ast::StatementList{}, ast::DecorationList{});
spirv::Builder& b = Build();
ASSERT_TRUE(b.GenerateFunction(func)) << b.error();
EXPECT_EQ(b.GenerateCallExpression(expr), 5u) << b.error();
EXPECT_EQ(DumpBuilder(b), R"(%8 = OpExtInstImport "GLSL.std.450"
OpName %3 "a_func"
%2 = OpTypeVoid
%1 = OpTypeFunction %2
%7 = OpTypeFloat 32
%6 = OpTypeVector %7 2
%9 = OpConstant %7 1
%10 = OpConstantComposite %6 %9 %9
%3 = OpFunction %2 None %1
%4 = OpLabel
%5 = OpExtInst %6 %8 Reflect %10 %10
OpReturn
OpFunctionEnd
)");
}
TEST_F(IntrinsicBuilderTest, Call_Distance_Scalar) { TEST_F(IntrinsicBuilderTest, Call_Distance_Scalar) {
auto* expr = Call("distance", 1.0f, 1.0f); auto* expr = Call("distance", 1.0f, 1.0f);
@ -1001,15 +1029,44 @@ OpReturn
OpFunctionEnd OpFunctionEnd
)"); )");
} }
INSTANTIATE_TEST_SUITE_P( INSTANTIATE_TEST_SUITE_P(IntrinsicBuilderTest,
IntrinsicBuilderTest,
Intrinsic_Builtin_ThreeParam_Float_Test, Intrinsic_Builtin_ThreeParam_Float_Test,
testing::Values(IntrinsicData{"clamp", "NClamp"}, testing::Values(IntrinsicData{"clamp", "NClamp"},
IntrinsicData{"faceForward", "FaceForward"},
IntrinsicData{"fma", "Fma"}, IntrinsicData{"fma", "Fma"},
IntrinsicData{"mix", "FMix"}, IntrinsicData{"mix", "FMix"},
IntrinsicData{"smoothStep", "SmoothStep"})); IntrinsicData{"smoothStep",
"SmoothStep"}));
TEST_F(IntrinsicBuilderTest, Call_FaceForward_Vector) {
auto* expr = Call("faceForward", vec2<f32>(1.0f, 1.0f), vec2<f32>(1.0f, 1.0f),
vec2<f32>(1.0f, 1.0f));
WrapInFunction(expr);
auto* func = Func("a_func", ast::VariableList{}, ty.void_(),
ast::StatementList{}, ast::DecorationList{});
spirv::Builder& b = Build();
ASSERT_TRUE(b.GenerateFunction(func)) << b.error();
EXPECT_EQ(b.GenerateCallExpression(expr), 5u) << b.error();
EXPECT_EQ(DumpBuilder(b), R"(%8 = OpExtInstImport "GLSL.std.450"
OpName %3 "a_func"
%2 = OpTypeVoid
%1 = OpTypeFunction %2
%7 = OpTypeFloat 32
%6 = OpTypeVector %7 2
%9 = OpConstant %7 1
%10 = OpConstantComposite %6 %9 %9
%3 = OpFunction %2 None %1
%4 = OpLabel
%5 = OpExtInst %6 %8 FaceForward %10 %10 %10
OpReturn
OpFunctionEnd
)");
}
using Intrinsic_Builtin_SingleParam_Sint_Test = using Intrinsic_Builtin_SingleParam_Sint_Test =
IntrinsicBuilderTestWithParam<IntrinsicData>; IntrinsicBuilderTestWithParam<IntrinsicData>;

View File

@ -1,45 +0,0 @@
// Copyright 2021 The Tint Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
////////////////////////////////////////////////////////////////////////////////
// File generated by tools/intrinsic-gen
// using the template:
// test/intrinsics/intrinsics.wgsl.tmpl
// and the intrinsic defintion file:
// src/intrinsics.def
//
// Do not modify this file directly
////////////////////////////////////////////////////////////////////////////////
// fn faceForward(f32, f32, f32) -> f32
fn faceForward_fc994b() {
var res: f32 = faceForward(1.0, 1.0, 1.0);
}
[[stage(vertex)]]
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
faceForward_fc994b();
return vec4<f32>();
}
[[stage(fragment)]]
fn fragment_main() {
faceForward_fc994b();
}
[[stage(compute), workgroup_size(1)]]
fn compute_main() {
faceForward_fc994b();
}

View File

@ -1,24 +0,0 @@
void faceForward_fc994b() {
float res = faceforward(1.0f, 1.0f, 1.0f);
}
struct tint_symbol {
float4 value : SV_Position;
};
tint_symbol vertex_main() {
faceForward_fc994b();
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
return tint_symbol_1;
}
void fragment_main() {
faceForward_fc994b();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
faceForward_fc994b();
return;
}

View File

@ -1,50 +0,0 @@
SKIP: FAILED
Validation Failure:
#include <metal_stdlib>
using namespace metal;
void faceForward_fc994b() {
float res = faceforward(1.0f, 1.0f, 1.0f);
}
vertex void vertex_main() {
faceForward_fc994b();
return;
}
fragment void fragment_main() {
faceForward_fc994b();
return;
}
kernel void compute_main() {
faceForward_fc994b();
return;
}
tint_2Q1ua3.metal:5:17: error: call to 'faceforward' is ambiguous
float res = faceforward(1.0f, 1.0f, 1.0f);
^~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/metal/macos/lib/clang/902.14/include/metal/metal_geometric:311:18: note: candidate function
METAL_FUNC half2 faceforward(half2 n, half2 i, half2 nref)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/metal/macos/lib/clang/902.14/include/metal/metal_geometric:342:18: note: candidate function
METAL_FUNC half3 faceforward(half3 n, half3 i, half3 nref)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/metal/macos/lib/clang/902.14/include/metal/metal_geometric:373:18: note: candidate function
METAL_FUNC half4 faceforward(half4 n, half4 i, half4 nref)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/metal/macos/lib/clang/902.14/include/metal/metal_geometric:416:19: note: candidate function
METAL_FUNC float2 faceforward(float2 n, float2 i, float2 nref)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/metal/macos/lib/clang/902.14/include/metal/metal_geometric:459:19: note: candidate function
METAL_FUNC float3 faceforward(float3 n, float3 i, float3 nref)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/metal/macos/lib/clang/902.14/include/metal/metal_geometric:502:19: note: candidate function
METAL_FUNC float4 faceforward(float4 n, float4 i, float4 nref)
^
1 error generated.

View File

@ -1,67 +0,0 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 32
; Schema: 0
OpCapability Shader
%14 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize %tint_symbol_1
OpEntryPoint Fragment %fragment_main "fragment_main"
OpEntryPoint GLCompute %compute_main "compute_main"
OpExecutionMode %fragment_main OriginUpperLeft
OpExecutionMode %compute_main LocalSize 1 1 1
OpName %tint_pointsize "tint_pointsize"
OpName %tint_symbol_1 "tint_symbol_1"
OpName %faceForward_fc994b "faceForward_fc994b"
OpName %res "res"
OpName %tint_symbol_2 "tint_symbol_2"
OpName %tint_symbol "tint_symbol"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %tint_pointsize BuiltIn PointSize
OpDecorate %tint_symbol_1 BuiltIn Position
%float = OpTypeFloat 32
%_ptr_Output_float = OpTypePointer Output %float
%4 = OpConstantNull %float
%tint_pointsize = OpVariable %_ptr_Output_float Output %4
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%8 = OpConstantNull %v4float
%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8
%void = OpTypeVoid
%9 = OpTypeFunction %void
%float_1 = OpConstant %float 1
%_ptr_Function_float = OpTypePointer Function %float
%18 = OpTypeFunction %void %v4float
%faceForward_fc994b = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_float Function %4
%13 = OpExtInst %float %14 FaceForward %float_1 %float_1 %float_1
OpStore %res %13
OpReturn
OpFunctionEnd
%tint_symbol_2 = OpFunction %void None %18
%tint_symbol = OpFunctionParameter %v4float
%21 = OpLabel
OpStore %tint_symbol_1 %tint_symbol
OpReturn
OpFunctionEnd
%vertex_main = OpFunction %void None %9
%23 = OpLabel
OpStore %tint_pointsize %float_1
%24 = OpFunctionCall %void %faceForward_fc994b
%25 = OpFunctionCall %void %tint_symbol_2 %8
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %9
%27 = OpLabel
%28 = OpFunctionCall %void %faceForward_fc994b
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%30 = OpLabel
%31 = OpFunctionCall %void %faceForward_fc994b
OpReturn
OpFunctionEnd

View File

@ -1,19 +0,0 @@
fn faceForward_fc994b() {
var res : f32 = faceForward(1.0, 1.0, 1.0);
}
[[stage(vertex)]]
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
faceForward_fc994b();
return vec4<f32>();
}
[[stage(fragment)]]
fn fragment_main() {
faceForward_fc994b();
}
[[stage(compute), workgroup_size(1)]]
fn compute_main() {
faceForward_fc994b();
}

View File

@ -1,45 +0,0 @@
// Copyright 2021 The Tint Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
////////////////////////////////////////////////////////////////////////////////
// File generated by tools/intrinsic-gen
// using the template:
// test/intrinsics/intrinsics.wgsl.tmpl
// and the intrinsic defintion file:
// src/intrinsics.def
//
// Do not modify this file directly
////////////////////////////////////////////////////////////////////////////////
// fn reflect(f32, f32) -> f32
fn reflect_feae90() {
var res: f32 = reflect(1.0, 1.0);
}
[[stage(vertex)]]
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
reflect_feae90();
return vec4<f32>();
}
[[stage(fragment)]]
fn fragment_main() {
reflect_feae90();
}
[[stage(compute), workgroup_size(1)]]
fn compute_main() {
reflect_feae90();
}

View File

@ -1,24 +0,0 @@
void reflect_feae90() {
float res = reflect(1.0f, 1.0f);
}
struct tint_symbol {
float4 value : SV_Position;
};
tint_symbol vertex_main() {
reflect_feae90();
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
return tint_symbol_1;
}
void fragment_main() {
reflect_feae90();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
reflect_feae90();
return;
}

View File

@ -1,50 +0,0 @@
SKIP: FAILED
Validation Failure:
#include <metal_stdlib>
using namespace metal;
void reflect_feae90() {
float res = reflect(1.0f, 1.0f);
}
vertex void vertex_main() {
reflect_feae90();
return;
}
fragment void fragment_main() {
reflect_feae90();
return;
}
kernel void compute_main() {
reflect_feae90();
return;
}
tint_ib1Pi6.metal:5:17: error: call to 'reflect' is ambiguous
float res = reflect(1.0f, 1.0f);
^~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/metal/macos/lib/clang/902.14/include/metal/metal_geometric:315:18: note: candidate function
METAL_FUNC half2 reflect(half2 i, half2 n)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/metal/macos/lib/clang/902.14/include/metal/metal_geometric:346:18: note: candidate function
METAL_FUNC half3 reflect(half3 i, half3 n)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/metal/macos/lib/clang/902.14/include/metal/metal_geometric:377:18: note: candidate function
METAL_FUNC half4 reflect(half4 i, half4 n)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/metal/macos/lib/clang/902.14/include/metal/metal_geometric:420:19: note: candidate function
METAL_FUNC float2 reflect(float2 i, float2 n)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/metal/macos/lib/clang/902.14/include/metal/metal_geometric:463:19: note: candidate function
METAL_FUNC float3 reflect(float3 i, float3 n)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/metal/macos/lib/clang/902.14/include/metal/metal_geometric:506:19: note: candidate function
METAL_FUNC float4 reflect(float4 i, float4 n)
^
1 error generated.

View File

@ -1,67 +0,0 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 32
; Schema: 0
OpCapability Shader
%14 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize %tint_symbol_1
OpEntryPoint Fragment %fragment_main "fragment_main"
OpEntryPoint GLCompute %compute_main "compute_main"
OpExecutionMode %fragment_main OriginUpperLeft
OpExecutionMode %compute_main LocalSize 1 1 1
OpName %tint_pointsize "tint_pointsize"
OpName %tint_symbol_1 "tint_symbol_1"
OpName %reflect_feae90 "reflect_feae90"
OpName %res "res"
OpName %tint_symbol_2 "tint_symbol_2"
OpName %tint_symbol "tint_symbol"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %tint_pointsize BuiltIn PointSize
OpDecorate %tint_symbol_1 BuiltIn Position
%float = OpTypeFloat 32
%_ptr_Output_float = OpTypePointer Output %float
%4 = OpConstantNull %float
%tint_pointsize = OpVariable %_ptr_Output_float Output %4
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%8 = OpConstantNull %v4float
%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8
%void = OpTypeVoid
%9 = OpTypeFunction %void
%float_1 = OpConstant %float 1
%_ptr_Function_float = OpTypePointer Function %float
%18 = OpTypeFunction %void %v4float
%reflect_feae90 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_float Function %4
%13 = OpExtInst %float %14 Reflect %float_1 %float_1
OpStore %res %13
OpReturn
OpFunctionEnd
%tint_symbol_2 = OpFunction %void None %18
%tint_symbol = OpFunctionParameter %v4float
%21 = OpLabel
OpStore %tint_symbol_1 %tint_symbol
OpReturn
OpFunctionEnd
%vertex_main = OpFunction %void None %9
%23 = OpLabel
OpStore %tint_pointsize %float_1
%24 = OpFunctionCall %void %reflect_feae90
%25 = OpFunctionCall %void %tint_symbol_2 %8
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %9
%27 = OpLabel
%28 = OpFunctionCall %void %reflect_feae90
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%30 = OpLabel
%31 = OpFunctionCall %void %reflect_feae90
OpReturn
OpFunctionEnd

View File

@ -1,19 +0,0 @@
fn reflect_feae90() {
var res : f32 = reflect(1.0, 1.0);
}
[[stage(vertex)]]
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
reflect_feae90();
return vec4<f32>();
}
[[stage(fragment)]]
fn fragment_main() {
reflect_feae90();
}
[[stage(compute), workgroup_size(1)]]
fn compute_main() {
reflect_feae90();
}