intrinsics: Add degrees() and radians()
Fixed: tint:1329 Change-Id: I5fb927268fc9cb8047a2b365d26e813a8546605a Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/75423 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: David Neto <dneto@google.com> Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
parent
4beeaea9da
commit
5c99ed046a
|
@ -12,6 +12,7 @@ The following features have been deprecated and will be removed in M102:
|
|||
### New Features
|
||||
|
||||
* Vector and matrix element type can now be inferred from constructor argument types. [tint:1334](https://crbug.com/tint/1334)
|
||||
* Added builtins `degrees()` and `radians()` for converting between degrees and radians. [tint:1329](https://crbug.com/tint/1329)
|
||||
|
||||
## Changes for M98
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -289,6 +289,8 @@ fn cosh<N: num>(vec<N, f32>) -> vec<N, f32>
|
|||
fn countOneBits<T: iu32>(T) -> T
|
||||
fn countOneBits<N: num, T: iu32>(vec<N, T>) -> vec<N, T>
|
||||
fn cross(vec3<f32>, vec3<f32>) -> vec3<f32>
|
||||
fn degrees(f32) -> f32
|
||||
fn degrees<N: num>(vec<N, f32>) -> vec<N, f32>
|
||||
fn determinant<N: num>(mat<N, N, f32>) -> f32
|
||||
fn distance(f32, f32) -> f32
|
||||
fn distance<N: num>(vec<N, f32>, vec<N, f32>) -> f32
|
||||
|
@ -360,6 +362,8 @@ fn pack4x8snorm(vec4<f32>) -> u32
|
|||
fn pack4x8unorm(vec4<f32>) -> u32
|
||||
fn pow(f32, f32) -> f32
|
||||
fn pow<N: num>(vec<N, f32>, vec<N, f32>) -> vec<N, f32>
|
||||
fn radians(f32) -> f32
|
||||
fn radians<N: num>(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 reverseBits<T: iu32>(T) -> T
|
||||
|
|
|
@ -312,6 +312,8 @@ std::string GetGlslStd450FuncName(uint32_t ext_opcode) {
|
|||
return "cosh";
|
||||
case GLSLstd450Cross:
|
||||
return "cross";
|
||||
case GLSLstd450Degrees:
|
||||
return "degrees";
|
||||
case GLSLstd450Distance:
|
||||
return "distance";
|
||||
case GLSLstd450Exp:
|
||||
|
@ -364,6 +366,8 @@ std::string GetGlslStd450FuncName(uint32_t ext_opcode) {
|
|||
return "pow";
|
||||
case GLSLstd450FSign:
|
||||
return "sign";
|
||||
case GLSLstd450Radians:
|
||||
return "radians";
|
||||
case GLSLstd450Reflect:
|
||||
return "reflect";
|
||||
case GLSLstd450Refract:
|
||||
|
@ -404,8 +408,6 @@ std::string GetGlslStd450FuncName(uint32_t ext_opcode) {
|
|||
|
||||
case GLSLstd450SSign:
|
||||
|
||||
case GLSLstd450Radians:
|
||||
case GLSLstd450Degrees:
|
||||
case GLSLstd450Asinh:
|
||||
case GLSLstd450Acosh:
|
||||
case GLSLstd450Atanh:
|
||||
|
@ -4114,41 +4116,6 @@ TypedExpression FunctionEmitter::EmitGlslStd450ExtInst(
|
|||
}
|
||||
}
|
||||
|
||||
// Some GLSLStd450 builtins don't have a WGSL equivalent. Polyfill them.
|
||||
switch (ext_opcode) {
|
||||
case GLSLstd450Radians: {
|
||||
auto degrees = MakeOperand(inst, 2);
|
||||
TINT_ASSERT(Reader, degrees.type->IsFloatScalarOrVector());
|
||||
|
||||
constexpr auto kPiOver180 = static_cast<float>(3.141592653589793 / 180.0);
|
||||
auto* factor = builder_.Expr(kPiOver180);
|
||||
if (degrees.type->Is<F32>()) {
|
||||
return {degrees.type, builder_.Mul(degrees.expr, factor)};
|
||||
} else {
|
||||
uint32_t size = degrees.type->As<Vector>()->size;
|
||||
return {degrees.type,
|
||||
builder_.Mul(degrees.expr,
|
||||
builder_.vec(builder_.ty.f32(), size, factor))};
|
||||
}
|
||||
}
|
||||
|
||||
case GLSLstd450Degrees: {
|
||||
auto radians = MakeOperand(inst, 2);
|
||||
TINT_ASSERT(Reader, radians.type->IsFloatScalarOrVector());
|
||||
|
||||
constexpr auto k180OverPi = static_cast<float>(180.0 / 3.141592653589793);
|
||||
auto* factor = builder_.Expr(k180OverPi);
|
||||
if (radians.type->Is<F32>()) {
|
||||
return {radians.type, builder_.Mul(radians.expr, factor)};
|
||||
} else {
|
||||
uint32_t size = radians.type->As<Vector>()->size;
|
||||
return {radians.type,
|
||||
builder_.Mul(radians.expr,
|
||||
builder_.vec(builder_.ty.f32(), size, factor))};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const auto name = GetGlslStd450FuncName(ext_opcode);
|
||||
if (name.empty()) {
|
||||
Fail() << "unhandled GLSL.std.450 instruction " << ext_opcode;
|
||||
|
|
|
@ -421,29 +421,31 @@ INSTANTIATE_TEST_SUITE_P(Samples,
|
|||
INSTANTIATE_TEST_SUITE_P(Samples,
|
||||
SpvParserTest_GlslStd450_Floating_Floating,
|
||||
::testing::ValuesIn(std::vector<GlslStd450Case>{
|
||||
{"Acos", "acos"},
|
||||
{"Asin", "asin"},
|
||||
{"Atan", "atan"},
|
||||
{"Ceil", "ceil"},
|
||||
{"Cos", "cos"},
|
||||
{"Cosh", "cosh"},
|
||||
{"Exp", "exp"},
|
||||
{"Exp2", "exp2"},
|
||||
{"FAbs", "abs"},
|
||||
{"FSign", "sign"},
|
||||
{"Floor", "floor"},
|
||||
{"Fract", "fract"},
|
||||
{"InverseSqrt", "inverseSqrt"},
|
||||
{"Log", "log"},
|
||||
{"Log2", "log2"},
|
||||
{"Round", "round"},
|
||||
{"RoundEven", "round"},
|
||||
{"Sin", "sin"},
|
||||
{"Sinh", "sinh"},
|
||||
{"Sqrt", "sqrt"},
|
||||
{"Tan", "tan"},
|
||||
{"Tanh", "tanh"},
|
||||
{"Trunc", "trunc"},
|
||||
{"Acos", "acos"}, //
|
||||
{"Asin", "asin"}, //
|
||||
{"Atan", "atan"}, //
|
||||
{"Ceil", "ceil"}, //
|
||||
{"Cos", "cos"}, //
|
||||
{"Cosh", "cosh"}, //
|
||||
{"Degrees", "degrees"}, //
|
||||
{"Exp", "exp"}, //
|
||||
{"Exp2", "exp2"}, //
|
||||
{"FAbs", "abs"}, //
|
||||
{"FSign", "sign"}, //
|
||||
{"Floor", "floor"}, //
|
||||
{"Fract", "fract"}, //
|
||||
{"InverseSqrt", "inverseSqrt"}, //
|
||||
{"Log", "log"}, //
|
||||
{"Log2", "log2"}, //
|
||||
{"Radians", "radians"}, //
|
||||
{"Round", "round"}, //
|
||||
{"RoundEven", "round"}, //
|
||||
{"Sin", "sin"}, //
|
||||
{"Sinh", "sinh"}, //
|
||||
{"Sqrt", "sqrt"}, //
|
||||
{"Tan", "tan"}, //
|
||||
{"Tanh", "tanh"}, //
|
||||
{"Trunc", "trunc"}, //
|
||||
}));
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(Samples,
|
||||
|
@ -1134,76 +1136,6 @@ let x_1 : vec2<f32> = reflect(x_98, x_99);
|
|||
EXPECT_THAT(body, HasSubstr(expected)) << body;
|
||||
}
|
||||
|
||||
TEST_F(SpvParserTest, GlslStd450_Degrees_Scalar) {
|
||||
const auto assembly = Preamble() + R"(
|
||||
%1 = OpExtInst %float %glsl Degrees %float_50
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
auto fe = p->function_emitter(100);
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto ast_body = fe.ast_body();
|
||||
const auto body = test::ToString(p->program(), ast_body);
|
||||
const auto* expected = "let x_1 : f32 = (50.0 * 57.295780182);";
|
||||
|
||||
EXPECT_THAT(body, HasSubstr(expected)) << body;
|
||||
}
|
||||
|
||||
TEST_F(SpvParserTest, GlslStd450_Degrees_Vector) {
|
||||
const auto assembly = Preamble() + R"(
|
||||
%1 = OpExtInst %v3float %glsl Degrees %v3float_60_70_50
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
auto fe = p->function_emitter(100);
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto ast_body = fe.ast_body();
|
||||
const auto body = test::ToString(p->program(), ast_body);
|
||||
const auto* expected =
|
||||
R"(let x_1 : vec3<f32> = (vec3<f32>(60.0, 70.0, 50.0) * vec3<f32>(57.295780182));)";
|
||||
|
||||
EXPECT_THAT(body, HasSubstr(expected)) << body;
|
||||
}
|
||||
|
||||
TEST_F(SpvParserTest, GlslStd450_Radians_Scalar) {
|
||||
const auto assembly = Preamble() + R"(
|
||||
%1 = OpExtInst %float %glsl Radians %float_50
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
auto fe = p->function_emitter(100);
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto ast_body = fe.ast_body();
|
||||
const auto body = test::ToString(p->program(), ast_body);
|
||||
const auto* expected = "let x_1 : f32 = (50.0 * 0.017453292);";
|
||||
|
||||
EXPECT_THAT(body, HasSubstr(expected)) << body;
|
||||
}
|
||||
|
||||
TEST_F(SpvParserTest, GlslStd450_Radians_Vector) {
|
||||
const auto assembly = Preamble() + R"(
|
||||
%1 = OpExtInst %v3float %glsl Radians %v3float_60_70_50
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
auto fe = p->function_emitter(100);
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto ast_body = fe.ast_body();
|
||||
const auto body = test::ToString(p->program(), ast_body);
|
||||
const auto* expected =
|
||||
R"(let x_1 : vec3<f32> = (vec3<f32>(60.0, 70.0, 50.0) * vec3<f32>(0.017453292));)";
|
||||
|
||||
EXPECT_THAT(body, HasSubstr(expected)) << body;
|
||||
}
|
||||
|
||||
// For ldexp with signed second argument, see above.
|
||||
TEST_F(SpvParserTest, GlslStd450_Ldexp_Scalar_Float_Uint) {
|
||||
const auto assembly = Preamble() + R"(
|
||||
|
|
|
@ -145,6 +145,12 @@ class Intrinsic : public Castable<Intrinsic, CallTarget> {
|
|||
const bool is_deprecated_;
|
||||
};
|
||||
|
||||
/// Constant value used by the degrees() intrinsic
|
||||
static constexpr double kRadToDeg = 57.295779513082322865;
|
||||
|
||||
/// Constant value used by the radians() intrinsic
|
||||
static constexpr double kDegToRad = 0.017453292519943295474;
|
||||
|
||||
} // namespace sem
|
||||
} // namespace tint
|
||||
|
||||
|
|
|
@ -72,6 +72,9 @@ IntrinsicType ParseIntrinsicType(const std::string& name) {
|
|||
if (name == "cross") {
|
||||
return IntrinsicType::kCross;
|
||||
}
|
||||
if (name == "degrees") {
|
||||
return IntrinsicType::kDegrees;
|
||||
}
|
||||
if (name == "determinant") {
|
||||
return IntrinsicType::kDeterminant;
|
||||
}
|
||||
|
@ -192,6 +195,9 @@ IntrinsicType ParseIntrinsicType(const std::string& name) {
|
|||
if (name == "pow") {
|
||||
return IntrinsicType::kPow;
|
||||
}
|
||||
if (name == "radians") {
|
||||
return IntrinsicType::kRadians;
|
||||
}
|
||||
if (name == "reflect") {
|
||||
return IntrinsicType::kReflect;
|
||||
}
|
||||
|
@ -368,6 +374,8 @@ const char* str(IntrinsicType i) {
|
|||
return "countOneBits";
|
||||
case IntrinsicType::kCross:
|
||||
return "cross";
|
||||
case IntrinsicType::kDegrees:
|
||||
return "degrees";
|
||||
case IntrinsicType::kDeterminant:
|
||||
return "determinant";
|
||||
case IntrinsicType::kDistance:
|
||||
|
@ -448,6 +456,8 @@ const char* str(IntrinsicType i) {
|
|||
return "pack4x8unorm";
|
||||
case IntrinsicType::kPow:
|
||||
return "pow";
|
||||
case IntrinsicType::kRadians:
|
||||
return "radians";
|
||||
case IntrinsicType::kReflect:
|
||||
return "reflect";
|
||||
case IntrinsicType::kRefract:
|
||||
|
|
|
@ -48,6 +48,7 @@ enum class IntrinsicType {
|
|||
kCosh,
|
||||
kCountOneBits,
|
||||
kCross,
|
||||
kDegrees,
|
||||
kDeterminant,
|
||||
kDistance,
|
||||
kDot,
|
||||
|
@ -88,6 +89,7 @@ enum class IntrinsicType {
|
|||
kPack4x8snorm,
|
||||
kPack4x8unorm,
|
||||
kPow,
|
||||
kRadians,
|
||||
kReflect,
|
||||
kRefract,
|
||||
kReverseBits,
|
||||
|
|
|
@ -505,6 +505,12 @@ bool GeneratorImpl::EmitIntrinsicCall(std::ostream& out,
|
|||
if (intrinsic->Type() == sem::IntrinsicType::kIsNormal) {
|
||||
return EmitIsNormalCall(out, expr, intrinsic);
|
||||
}
|
||||
if (intrinsic->Type() == sem::IntrinsicType::kDegrees) {
|
||||
return EmitDegreesCall(out, expr, intrinsic);
|
||||
}
|
||||
if (intrinsic->Type() == sem::IntrinsicType::kRadians) {
|
||||
return EmitRadiansCall(out, expr, intrinsic);
|
||||
}
|
||||
if (intrinsic->Type() == sem::IntrinsicType::kIgnore) {
|
||||
return EmitExpression(out, expr->args[0]); // [DEPRECATED]
|
||||
}
|
||||
|
@ -953,6 +959,30 @@ bool GeneratorImpl::EmitIsNormalCall(std::ostream& out,
|
|||
});
|
||||
}
|
||||
|
||||
bool GeneratorImpl::EmitDegreesCall(std::ostream& out,
|
||||
const ast::CallExpression* expr,
|
||||
const sem::Intrinsic* intrinsic) {
|
||||
return CallIntrinsicHelper(
|
||||
out, expr, intrinsic,
|
||||
[&](TextBuffer* b, const std::vector<std::string>& params) {
|
||||
line(b) << "return " << params[0] << " * " << std::setprecision(20)
|
||||
<< sem::kRadToDeg << ";";
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
bool GeneratorImpl::EmitRadiansCall(std::ostream& out,
|
||||
const ast::CallExpression* expr,
|
||||
const sem::Intrinsic* intrinsic) {
|
||||
return CallIntrinsicHelper(
|
||||
out, expr, intrinsic,
|
||||
[&](TextBuffer* b, const std::vector<std::string>& params) {
|
||||
line(b) << "return " << params[0] << " * " << std::setprecision(20)
|
||||
<< sem::kDegToRad << ";";
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
bool GeneratorImpl::EmitDataPackingCall(std::ostream& out,
|
||||
const ast::CallExpression* expr,
|
||||
const sem::Intrinsic* intrinsic) {
|
||||
|
|
|
@ -208,6 +208,22 @@ class GeneratorImpl : public TextGenerator {
|
|||
bool EmitIsNormalCall(std::ostream& out,
|
||||
const ast::CallExpression* expr,
|
||||
const sem::Intrinsic* intrinsic);
|
||||
/// Handles generating a call to the `degrees()` intrinsic
|
||||
/// @param out the output of the expression stream
|
||||
/// @param expr the call expression
|
||||
/// @param intrinsic the semantic information for the intrinsic
|
||||
/// @returns true if the call expression is emitted
|
||||
bool EmitDegreesCall(std::ostream& out,
|
||||
const ast::CallExpression* expr,
|
||||
const sem::Intrinsic* intrinsic);
|
||||
/// Handles generating a call to the `radians()` intrinsic
|
||||
/// @param out the output of the expression stream
|
||||
/// @param expr the call expression
|
||||
/// @param intrinsic the semantic information for the intrinsic
|
||||
/// @returns true if the call expression is emitted
|
||||
bool EmitRadiansCall(std::ostream& out,
|
||||
const ast::CallExpression* expr,
|
||||
const sem::Intrinsic* intrinsic);
|
||||
/// Handles generating a call to data packing intrinsic
|
||||
/// @param out the output of the expression stream
|
||||
/// @param expr the call expression
|
||||
|
|
|
@ -381,7 +381,129 @@ TEST_F(GlslGeneratorImplTest_Intrinsic, IsNormal_Vector) {
|
|||
(tint_isnormal_clamped == tint_isnormal_exponent);
|
||||
)"));
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST_F(GlslGeneratorImplTest_Intrinsic, Degrees_Scalar) {
|
||||
auto* val = Var("val", ty.f32());
|
||||
auto* call = Call("degrees", val);
|
||||
WrapInFunction(val, call);
|
||||
|
||||
GeneratorImpl& gen = SanitizeAndBuild();
|
||||
|
||||
ASSERT_TRUE(gen.Generate()) << gen.error();
|
||||
EXPECT_EQ(gen.result(), R"(#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
float tint_degrees(float param_0) {
|
||||
return param_0 * 57.295779513082322865;
|
||||
}
|
||||
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void test_function() {
|
||||
float val = 0.0f;
|
||||
float tint_symbol = tint_degrees(val);
|
||||
return;
|
||||
}
|
||||
void main() {
|
||||
test_function();
|
||||
}
|
||||
|
||||
|
||||
)");
|
||||
}
|
||||
|
||||
TEST_F(GlslGeneratorImplTest_Intrinsic, Degrees_Vector) {
|
||||
auto* val = Var("val", ty.vec3<f32>());
|
||||
auto* call = Call("degrees", val);
|
||||
WrapInFunction(val, call);
|
||||
|
||||
GeneratorImpl& gen = SanitizeAndBuild();
|
||||
|
||||
ASSERT_TRUE(gen.Generate()) << gen.error();
|
||||
EXPECT_EQ(gen.result(), R"(#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
vec3 tint_degrees(vec3 param_0) {
|
||||
return param_0 * 57.295779513082322865;
|
||||
}
|
||||
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void test_function() {
|
||||
vec3 val = vec3(0.0f, 0.0f, 0.0f);
|
||||
vec3 tint_symbol = tint_degrees(val);
|
||||
return;
|
||||
}
|
||||
void main() {
|
||||
test_function();
|
||||
}
|
||||
|
||||
|
||||
)");
|
||||
}
|
||||
|
||||
TEST_F(GlslGeneratorImplTest_Intrinsic, Radians_Scalar) {
|
||||
auto* val = Var("val", ty.f32());
|
||||
auto* call = Call("radians", val);
|
||||
WrapInFunction(val, call);
|
||||
|
||||
GeneratorImpl& gen = SanitizeAndBuild();
|
||||
|
||||
ASSERT_TRUE(gen.Generate()) << gen.error();
|
||||
EXPECT_EQ(gen.result(), R"(#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
float tint_radians(float param_0) {
|
||||
return param_0 * 0.017453292519943295474;
|
||||
}
|
||||
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void test_function() {
|
||||
float val = 0.0f;
|
||||
float tint_symbol = tint_radians(val);
|
||||
return;
|
||||
}
|
||||
void main() {
|
||||
test_function();
|
||||
}
|
||||
|
||||
|
||||
)");
|
||||
}
|
||||
|
||||
TEST_F(GlslGeneratorImplTest_Intrinsic, Radians_Vector) {
|
||||
auto* val = Var("val", ty.vec3<f32>());
|
||||
auto* call = Call("radians", val);
|
||||
WrapInFunction(val, call);
|
||||
|
||||
GeneratorImpl& gen = SanitizeAndBuild();
|
||||
|
||||
ASSERT_TRUE(gen.Generate()) << gen.error();
|
||||
EXPECT_EQ(gen.result(), R"(#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
vec3 tint_radians(vec3 param_0) {
|
||||
return param_0 * 0.017453292519943295474;
|
||||
}
|
||||
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void test_function() {
|
||||
vec3 val = vec3(0.0f, 0.0f, 0.0f);
|
||||
vec3 tint_symbol = tint_radians(val);
|
||||
return;
|
||||
}
|
||||
void main() {
|
||||
test_function();
|
||||
}
|
||||
|
||||
|
||||
)");
|
||||
}
|
||||
|
||||
#if 0
|
||||
TEST_F(GlslGeneratorImplTest_Intrinsic, Pack4x8Snorm) {
|
||||
auto* call = Call("pack4x8snorm", "p1");
|
||||
Global("p1", ty.vec4<f32>(), ast::StorageClass::kPrivate);
|
||||
|
|
|
@ -1016,6 +1016,12 @@ bool GeneratorImpl::EmitIntrinsicCall(std::ostream& out,
|
|||
if (intrinsic->Type() == sem::IntrinsicType::kIsNormal) {
|
||||
return EmitIsNormalCall(out, expr, intrinsic);
|
||||
}
|
||||
if (intrinsic->Type() == sem::IntrinsicType::kDegrees) {
|
||||
return EmitDegreesCall(out, expr, intrinsic);
|
||||
}
|
||||
if (intrinsic->Type() == sem::IntrinsicType::kRadians) {
|
||||
return EmitRadiansCall(out, expr, intrinsic);
|
||||
}
|
||||
if (intrinsic->Type() == sem::IntrinsicType::kIgnore) {
|
||||
return EmitExpression(out, expr->args[0]); // [DEPRECATED]
|
||||
}
|
||||
|
@ -1031,7 +1037,6 @@ bool GeneratorImpl::EmitIntrinsicCall(std::ostream& out,
|
|||
if (intrinsic->IsAtomic()) {
|
||||
return EmitWorkgroupAtomicCall(out, expr, intrinsic);
|
||||
}
|
||||
|
||||
auto name = generate_builtin_name(intrinsic);
|
||||
if (name.empty()) {
|
||||
return false;
|
||||
|
@ -1927,6 +1932,30 @@ bool GeneratorImpl::EmitIsNormalCall(std::ostream& out,
|
|||
});
|
||||
}
|
||||
|
||||
bool GeneratorImpl::EmitDegreesCall(std::ostream& out,
|
||||
const ast::CallExpression* expr,
|
||||
const sem::Intrinsic* intrinsic) {
|
||||
return CallIntrinsicHelper(
|
||||
out, expr, intrinsic,
|
||||
[&](TextBuffer* b, const std::vector<std::string>& params) {
|
||||
line(b) << "return " << params[0] << " * " << std::setprecision(20)
|
||||
<< sem::kRadToDeg << ";";
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
bool GeneratorImpl::EmitRadiansCall(std::ostream& out,
|
||||
const ast::CallExpression* expr,
|
||||
const sem::Intrinsic* intrinsic) {
|
||||
return CallIntrinsicHelper(
|
||||
out, expr, intrinsic,
|
||||
[&](TextBuffer* b, const std::vector<std::string>& params) {
|
||||
line(b) << "return " << params[0] << " * " << std::setprecision(20)
|
||||
<< sem::kDegToRad << ";";
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
bool GeneratorImpl::EmitDataPackingCall(std::ostream& out,
|
||||
const ast::CallExpression* expr,
|
||||
const sem::Intrinsic* intrinsic) {
|
||||
|
|
|
@ -249,6 +249,22 @@ class GeneratorImpl : public TextGenerator {
|
|||
bool EmitIsNormalCall(std::ostream& out,
|
||||
const ast::CallExpression* expr,
|
||||
const sem::Intrinsic* intrinsic);
|
||||
/// Handles generating a call to the `degrees()` intrinsic
|
||||
/// @param out the output of the expression stream
|
||||
/// @param expr the call expression
|
||||
/// @param intrinsic the semantic information for the intrinsic
|
||||
/// @returns true if the call expression is emitted
|
||||
bool EmitDegreesCall(std::ostream& out,
|
||||
const ast::CallExpression* expr,
|
||||
const sem::Intrinsic* intrinsic);
|
||||
/// Handles generating a call to the `radians()` intrinsic
|
||||
/// @param out the output of the expression stream
|
||||
/// @param expr the call expression
|
||||
/// @param intrinsic the semantic information for the intrinsic
|
||||
/// @returns true if the call expression is emitted
|
||||
bool EmitRadiansCall(std::ostream& out,
|
||||
const ast::CallExpression* expr,
|
||||
const sem::Intrinsic* intrinsic);
|
||||
/// Handles generating a call to data packing intrinsic
|
||||
/// @param out the output of the expression stream
|
||||
/// @param expr the call expression
|
||||
|
|
|
@ -447,6 +447,90 @@ void test_function() {
|
|||
)");
|
||||
}
|
||||
|
||||
TEST_F(HlslGeneratorImplTest_Intrinsic, Degrees_Scalar) {
|
||||
auto* val = Var("val", ty.f32());
|
||||
auto* call = Call("degrees", val);
|
||||
WrapInFunction(val, call);
|
||||
|
||||
GeneratorImpl& gen = SanitizeAndBuild();
|
||||
|
||||
ASSERT_TRUE(gen.Generate()) << gen.error();
|
||||
EXPECT_EQ(gen.result(), R"(float tint_degrees(float param_0) {
|
||||
return param_0 * 57.295779513082322865;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void test_function() {
|
||||
float val = 0.0f;
|
||||
const float tint_symbol = tint_degrees(val);
|
||||
return;
|
||||
}
|
||||
)");
|
||||
}
|
||||
|
||||
TEST_F(HlslGeneratorImplTest_Intrinsic, Degrees_Vector) {
|
||||
auto* val = Var("val", ty.vec3<f32>());
|
||||
auto* call = Call("degrees", val);
|
||||
WrapInFunction(val, call);
|
||||
|
||||
GeneratorImpl& gen = SanitizeAndBuild();
|
||||
|
||||
ASSERT_TRUE(gen.Generate()) << gen.error();
|
||||
EXPECT_EQ(gen.result(), R"(float3 tint_degrees(float3 param_0) {
|
||||
return param_0 * 57.295779513082322865;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void test_function() {
|
||||
float3 val = float3(0.0f, 0.0f, 0.0f);
|
||||
const float3 tint_symbol = tint_degrees(val);
|
||||
return;
|
||||
}
|
||||
)");
|
||||
}
|
||||
|
||||
TEST_F(HlslGeneratorImplTest_Intrinsic, Radians_Scalar) {
|
||||
auto* val = Var("val", ty.f32());
|
||||
auto* call = Call("radians", val);
|
||||
WrapInFunction(val, call);
|
||||
|
||||
GeneratorImpl& gen = SanitizeAndBuild();
|
||||
|
||||
ASSERT_TRUE(gen.Generate()) << gen.error();
|
||||
EXPECT_EQ(gen.result(), R"(float tint_radians(float param_0) {
|
||||
return param_0 * 0.017453292519943295474;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void test_function() {
|
||||
float val = 0.0f;
|
||||
const float tint_symbol = tint_radians(val);
|
||||
return;
|
||||
}
|
||||
)");
|
||||
}
|
||||
|
||||
TEST_F(HlslGeneratorImplTest_Intrinsic, Radians_Vector) {
|
||||
auto* val = Var("val", ty.vec3<f32>());
|
||||
auto* call = Call("radians", val);
|
||||
WrapInFunction(val, call);
|
||||
|
||||
GeneratorImpl& gen = SanitizeAndBuild();
|
||||
|
||||
ASSERT_TRUE(gen.Generate()) << gen.error();
|
||||
EXPECT_EQ(gen.result(), R"(float3 tint_radians(float3 param_0) {
|
||||
return param_0 * 0.017453292519943295474;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void test_function() {
|
||||
float3 val = float3(0.0f, 0.0f, 0.0f);
|
||||
const float3 tint_symbol = tint_radians(val);
|
||||
return;
|
||||
}
|
||||
)");
|
||||
}
|
||||
|
||||
TEST_F(HlslGeneratorImplTest_Intrinsic, Pack4x8Snorm) {
|
||||
auto* call = Call("pack4x8snorm", "p1");
|
||||
Global("p1", ty.vec4<f32>(), ast::StorageClass::kPrivate);
|
||||
|
|
|
@ -594,6 +594,10 @@ bool GeneratorImpl::EmitIntrinsicCall(std::ostream& out,
|
|||
return EmitModfCall(out, expr, intrinsic);
|
||||
case sem::IntrinsicType::kFrexp:
|
||||
return EmitFrexpCall(out, expr, intrinsic);
|
||||
case sem::IntrinsicType::kDegrees:
|
||||
return EmitDegreesCall(out, expr, intrinsic);
|
||||
case sem::IntrinsicType::kRadians:
|
||||
return EmitRadiansCall(out, expr, intrinsic);
|
||||
|
||||
case sem::IntrinsicType::kPack2x16float:
|
||||
case sem::IntrinsicType::kUnpack2x16float: {
|
||||
|
@ -1253,6 +1257,30 @@ bool GeneratorImpl::EmitFrexpCall(std::ostream& out,
|
|||
});
|
||||
}
|
||||
|
||||
bool GeneratorImpl::EmitDegreesCall(std::ostream& out,
|
||||
const ast::CallExpression* expr,
|
||||
const sem::Intrinsic* intrinsic) {
|
||||
return CallIntrinsicHelper(
|
||||
out, expr, intrinsic,
|
||||
[&](TextBuffer* b, const std::vector<std::string>& params) {
|
||||
line(b) << "return " << params[0] << " * " << std::setprecision(20)
|
||||
<< sem::kRadToDeg << ";";
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
bool GeneratorImpl::EmitRadiansCall(std::ostream& out,
|
||||
const ast::CallExpression* expr,
|
||||
const sem::Intrinsic* intrinsic) {
|
||||
return CallIntrinsicHelper(
|
||||
out, expr, intrinsic,
|
||||
[&](TextBuffer* b, const std::vector<std::string>& params) {
|
||||
line(b) << "return " << params[0] << " * " << std::setprecision(20)
|
||||
<< sem::kDegToRad << ";";
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
std::string GeneratorImpl::generate_builtin_name(
|
||||
const sem::Intrinsic* intrinsic) {
|
||||
std::string out = "";
|
||||
|
|
|
@ -217,6 +217,22 @@ class GeneratorImpl : public TextGenerator {
|
|||
bool EmitFrexpCall(std::ostream& out,
|
||||
const ast::CallExpression* expr,
|
||||
const sem::Intrinsic* intrinsic);
|
||||
/// Handles generating a call to the `degrees()` intrinsic
|
||||
/// @param out the output of the expression stream
|
||||
/// @param expr the call expression
|
||||
/// @param intrinsic the semantic information for the intrinsic
|
||||
/// @returns true if the call expression is emitted
|
||||
bool EmitDegreesCall(std::ostream& out,
|
||||
const ast::CallExpression* expr,
|
||||
const sem::Intrinsic* intrinsic);
|
||||
/// Handles generating a call to the `radians()` intrinsic
|
||||
/// @param out the output of the expression stream
|
||||
/// @param expr the call expression
|
||||
/// @param intrinsic the semantic information for the intrinsic
|
||||
/// @returns true if the call expression is emitted
|
||||
bool EmitRadiansCall(std::ostream& out,
|
||||
const ast::CallExpression* expr,
|
||||
const sem::Intrinsic* intrinsic);
|
||||
/// Handles a case statement
|
||||
/// @param stmt the statement
|
||||
/// @returns true if the statement was emitted successfully
|
||||
|
|
|
@ -319,6 +319,106 @@ TEST_F(MslGeneratorImplTest, WorkgroupBarrier) {
|
|||
EXPECT_EQ(out.str(), "threadgroup_barrier(mem_flags::mem_threadgroup)");
|
||||
}
|
||||
|
||||
TEST_F(MslGeneratorImplTest, Degrees_Scalar) {
|
||||
auto* val = Var("val", ty.f32());
|
||||
auto* call = Call("degrees", val);
|
||||
WrapInFunction(val, call);
|
||||
|
||||
GeneratorImpl& gen = Build();
|
||||
|
||||
ASSERT_TRUE(gen.Generate()) << gen.error();
|
||||
EXPECT_EQ(gen.result(), R"(#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
float tint_degrees(float param_0) {
|
||||
return param_0 * 57.295779513082322865;
|
||||
}
|
||||
|
||||
kernel void test_function() {
|
||||
float val = 0.0f;
|
||||
float const tint_symbol = tint_degrees(val);
|
||||
return;
|
||||
}
|
||||
|
||||
)");
|
||||
}
|
||||
|
||||
TEST_F(MslGeneratorImplTest, Degrees_Vector) {
|
||||
auto* val = Var("val", ty.vec3<f32>());
|
||||
auto* call = Call("degrees", val);
|
||||
WrapInFunction(val, call);
|
||||
|
||||
GeneratorImpl& gen = Build();
|
||||
|
||||
ASSERT_TRUE(gen.Generate()) << gen.error();
|
||||
EXPECT_EQ(gen.result(), R"(#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
float3 tint_degrees(float3 param_0) {
|
||||
return param_0 * 57.295779513082322865;
|
||||
}
|
||||
|
||||
kernel void test_function() {
|
||||
float3 val = 0.0f;
|
||||
float3 const tint_symbol = tint_degrees(val);
|
||||
return;
|
||||
}
|
||||
|
||||
)");
|
||||
}
|
||||
|
||||
TEST_F(MslGeneratorImplTest, Radians_Scalar) {
|
||||
auto* val = Var("val", ty.f32());
|
||||
auto* call = Call("radians", val);
|
||||
WrapInFunction(val, call);
|
||||
|
||||
GeneratorImpl& gen = Build();
|
||||
|
||||
ASSERT_TRUE(gen.Generate()) << gen.error();
|
||||
EXPECT_EQ(gen.result(), R"(#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
float tint_radians(float param_0) {
|
||||
return param_0 * 0.017453292519943295474;
|
||||
}
|
||||
|
||||
kernel void test_function() {
|
||||
float val = 0.0f;
|
||||
float const tint_symbol = tint_radians(val);
|
||||
return;
|
||||
}
|
||||
|
||||
)");
|
||||
}
|
||||
|
||||
TEST_F(MslGeneratorImplTest, Radians_Vector) {
|
||||
auto* val = Var("val", ty.vec3<f32>());
|
||||
auto* call = Call("radians", val);
|
||||
WrapInFunction(val, call);
|
||||
|
||||
GeneratorImpl& gen = Build();
|
||||
|
||||
ASSERT_TRUE(gen.Generate()) << gen.error();
|
||||
EXPECT_EQ(gen.result(), R"(#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
float3 tint_radians(float3 param_0) {
|
||||
return param_0 * 0.017453292519943295474;
|
||||
}
|
||||
|
||||
kernel void test_function() {
|
||||
float3 val = 0.0f;
|
||||
float3 const tint_symbol = tint_radians(val);
|
||||
return;
|
||||
}
|
||||
|
||||
)");
|
||||
}
|
||||
|
||||
TEST_F(MslGeneratorImplTest, Pack2x16Float) {
|
||||
auto* call = Call("pack2x16float", "p1");
|
||||
Global("p1", ty.vec2<f32>(), ast::StorageClass::kPrivate);
|
||||
|
|
|
@ -133,6 +133,8 @@ uint32_t intrinsic_to_glsl_method(const sem::Intrinsic* intrinsic) {
|
|||
return GLSLstd450Cosh;
|
||||
case IntrinsicType::kCross:
|
||||
return GLSLstd450Cross;
|
||||
case IntrinsicType::kDegrees:
|
||||
return GLSLstd450Degrees;
|
||||
case IntrinsicType::kDeterminant:
|
||||
return GLSLstd450Determinant;
|
||||
case IntrinsicType::kDistance:
|
||||
|
@ -195,6 +197,8 @@ uint32_t intrinsic_to_glsl_method(const sem::Intrinsic* intrinsic) {
|
|||
return GLSLstd450PackHalf2x16;
|
||||
case IntrinsicType::kPow:
|
||||
return GLSLstd450Pow;
|
||||
case IntrinsicType::kRadians:
|
||||
return GLSLstd450Radians;
|
||||
case IntrinsicType::kReflect:
|
||||
return GLSLstd450Reflect;
|
||||
case IntrinsicType::kRefract:
|
||||
|
|
|
@ -829,6 +829,7 @@ INSTANTIATE_TEST_SUITE_P(IntrinsicBuilderTest,
|
|||
IntrinsicData{"ceil", "Ceil"},
|
||||
IntrinsicData{"cos", "Cos"},
|
||||
IntrinsicData{"cosh", "Cosh"},
|
||||
IntrinsicData{"degrees", "Degrees"},
|
||||
IntrinsicData{"exp", "Exp"},
|
||||
IntrinsicData{"exp2", "Exp2"},
|
||||
IntrinsicData{"floor", "Floor"},
|
||||
|
@ -837,6 +838,7 @@ INSTANTIATE_TEST_SUITE_P(IntrinsicBuilderTest,
|
|||
"InverseSqrt"},
|
||||
IntrinsicData{"log", "Log"},
|
||||
IntrinsicData{"log2", "Log2"},
|
||||
IntrinsicData{"radians", "Radians"},
|
||||
IntrinsicData{"round", "RoundEven"},
|
||||
IntrinsicData{"sign", "FSign"},
|
||||
IntrinsicData{"sin", "Sin"},
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
float tint_degrees(float param_0) {
|
||||
return param_0 * 57.295779513082322865;
|
||||
}
|
||||
|
||||
|
||||
void main_1() {
|
||||
float a = 0.0f;
|
||||
float b = 0.0f;
|
||||
a = 42.0f;
|
||||
b = (a * 57.295780182f);
|
||||
b = tint_degrees(a);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
float tint_degrees(float param_0) {
|
||||
return param_0 * 57.295779513082322865;
|
||||
}
|
||||
|
||||
void main_1() {
|
||||
float a = 0.0f;
|
||||
float b = 0.0f;
|
||||
a = 42.0f;
|
||||
b = (a * 57.295780182f);
|
||||
b = tint_degrees(a);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,17 @@
|
|||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
float tint_degrees(float param_0) {
|
||||
return param_0 * 57.295779513082322865;
|
||||
}
|
||||
|
||||
void main_1() {
|
||||
float a = 0.0f;
|
||||
float b = 0.0f;
|
||||
a = 42.0f;
|
||||
float const x_11 = a;
|
||||
b = (x_11 * 57.295780182f);
|
||||
b = tint_degrees(x_11);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
; Bound: 17
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%13 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
|
@ -17,15 +18,14 @@
|
|||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%8 = OpConstantNull %float
|
||||
%float_42 = OpConstant %float 42
|
||||
%float_57_2957802 = OpConstant %float 57.2957802
|
||||
%main_1 = OpFunction %void None %1
|
||||
%4 = OpLabel
|
||||
%a = OpVariable %_ptr_Function_float Function %8
|
||||
%b = OpVariable %_ptr_Function_float Function %8
|
||||
OpStore %a %float_42
|
||||
%11 = OpLoad %float %a
|
||||
%13 = OpFMul %float %11 %float_57_2957802
|
||||
OpStore %b %13
|
||||
%12 = OpExtInst %float %13 Degrees %11
|
||||
OpStore %b %12
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%main = OpFunction %void None %1
|
||||
|
|
|
@ -3,7 +3,7 @@ fn main_1() {
|
|||
var b : f32;
|
||||
a = 42.0;
|
||||
let x_11 : f32 = a;
|
||||
b = (x_11 * 57.295780182);
|
||||
b = degrees(x_11);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
// 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 degrees(vec<4, f32>) -> vec<4, f32>
|
||||
fn degrees_0d170c() {
|
||||
var res: vec4<f32> = degrees(vec4<f32>());
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
degrees_0d170c();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
degrees_0d170c();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
degrees_0d170c();
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
vec4 tint_degrees(vec4 param_0) {
|
||||
return param_0 * 57.295779513082322865;
|
||||
}
|
||||
|
||||
|
||||
void degrees_0d170c() {
|
||||
vec4 res = tint_degrees(vec4(0.0f, 0.0f, 0.0f, 0.0f));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
vec4 value;
|
||||
};
|
||||
|
||||
vec4 vertex_main_inner() {
|
||||
degrees_0d170c();
|
||||
return vec4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
vec4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = tint_symbol(vec4(0.0f, 0.0f, 0.0f, 0.0f));
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
void main() {
|
||||
tint_symbol outputs;
|
||||
outputs = vertex_main();
|
||||
gl_Position = outputs.value;
|
||||
gl_Position.y = -gl_Position.y;
|
||||
}
|
||||
|
||||
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
vec4 tint_degrees(vec4 param_0) {
|
||||
return param_0 * 57.295779513082322865;
|
||||
}
|
||||
|
||||
|
||||
void degrees_0d170c() {
|
||||
vec4 res = tint_degrees(vec4(0.0f, 0.0f, 0.0f, 0.0f));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
vec4 value;
|
||||
};
|
||||
|
||||
void fragment_main() {
|
||||
degrees_0d170c();
|
||||
return;
|
||||
}
|
||||
void main() {
|
||||
fragment_main();
|
||||
}
|
||||
|
||||
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
vec4 tint_degrees(vec4 param_0) {
|
||||
return param_0 * 57.295779513082322865;
|
||||
}
|
||||
|
||||
|
||||
void degrees_0d170c() {
|
||||
vec4 res = tint_degrees(vec4(0.0f, 0.0f, 0.0f, 0.0f));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
vec4 value;
|
||||
};
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void compute_main() {
|
||||
degrees_0d170c();
|
||||
return;
|
||||
}
|
||||
void main() {
|
||||
compute_main();
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
float4 tint_degrees(float4 param_0) {
|
||||
return param_0 * 57.295779513082322865;
|
||||
}
|
||||
|
||||
void degrees_0d170c() {
|
||||
float4 res = tint_degrees(float4(0.0f, 0.0f, 0.0f, 0.0f));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
degrees_0d170c();
|
||||
return float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
degrees_0d170c();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
degrees_0d170c();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
float4 tint_degrees(float4 param_0) {
|
||||
return param_0 * 57.295779513082322865;
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value [[position]];
|
||||
};
|
||||
|
||||
void degrees_0d170c() {
|
||||
float4 res = tint_degrees(float4());
|
||||
}
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
degrees_0d170c();
|
||||
return float4();
|
||||
}
|
||||
|
||||
vertex tint_symbol vertex_main() {
|
||||
float4 const inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = {};
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
fragment void fragment_main() {
|
||||
degrees_0d170c();
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void compute_main() {
|
||||
degrees_0d170c();
|
||||
return;
|
||||
}
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 31
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%14 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %value "value"
|
||||
OpName %vertex_point_size "vertex_point_size"
|
||||
OpName %degrees_0d170c "degrees_0d170c"
|
||||
OpName %res "res"
|
||||
OpName %vertex_main_inner "vertex_main_inner"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %value BuiltIn Position
|
||||
OpDecorate %vertex_point_size BuiltIn PointSize
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%5 = OpConstantNull %v4float
|
||||
%value = OpVariable %_ptr_Output_v4float Output %5
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%8 = OpConstantNull %float
|
||||
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
|
||||
%void = OpTypeVoid
|
||||
%9 = OpTypeFunction %void
|
||||
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||
%17 = OpTypeFunction %v4float
|
||||
%float_1 = OpConstant %float 1
|
||||
%degrees_0d170c = OpFunction %void None %9
|
||||
%12 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_v4float Function %5
|
||||
%13 = OpExtInst %v4float %14 Degrees %5
|
||||
OpStore %res %13
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_inner = OpFunction %v4float None %17
|
||||
%19 = OpLabel
|
||||
%20 = OpFunctionCall %void %degrees_0d170c
|
||||
OpReturnValue %5
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %9
|
||||
%22 = OpLabel
|
||||
%23 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %23
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %9
|
||||
%26 = OpLabel
|
||||
%27 = OpFunctionCall %void %degrees_0d170c
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %9
|
||||
%29 = OpLabel
|
||||
%30 = OpFunctionCall %void %degrees_0d170c
|
||||
OpReturn
|
||||
OpFunctionEnd
|
|
@ -0,0 +1,19 @@
|
|||
fn degrees_0d170c() {
|
||||
var res : vec4<f32> = degrees(vec4<f32>());
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
degrees_0d170c();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
degrees_0d170c();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
degrees_0d170c();
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
// 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 degrees(vec<2, f32>) -> vec<2, f32>
|
||||
fn degrees_1ad5df() {
|
||||
var res: vec2<f32> = degrees(vec2<f32>());
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
degrees_1ad5df();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
degrees_1ad5df();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
degrees_1ad5df();
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
vec2 tint_degrees(vec2 param_0) {
|
||||
return param_0 * 57.295779513082322865;
|
||||
}
|
||||
|
||||
|
||||
void degrees_1ad5df() {
|
||||
vec2 res = tint_degrees(vec2(0.0f, 0.0f));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
vec4 value;
|
||||
};
|
||||
|
||||
vec4 vertex_main_inner() {
|
||||
degrees_1ad5df();
|
||||
return vec4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
vec4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = tint_symbol(vec4(0.0f, 0.0f, 0.0f, 0.0f));
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
void main() {
|
||||
tint_symbol outputs;
|
||||
outputs = vertex_main();
|
||||
gl_Position = outputs.value;
|
||||
gl_Position.y = -gl_Position.y;
|
||||
}
|
||||
|
||||
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
vec2 tint_degrees(vec2 param_0) {
|
||||
return param_0 * 57.295779513082322865;
|
||||
}
|
||||
|
||||
|
||||
void degrees_1ad5df() {
|
||||
vec2 res = tint_degrees(vec2(0.0f, 0.0f));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
vec4 value;
|
||||
};
|
||||
|
||||
void fragment_main() {
|
||||
degrees_1ad5df();
|
||||
return;
|
||||
}
|
||||
void main() {
|
||||
fragment_main();
|
||||
}
|
||||
|
||||
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
vec2 tint_degrees(vec2 param_0) {
|
||||
return param_0 * 57.295779513082322865;
|
||||
}
|
||||
|
||||
|
||||
void degrees_1ad5df() {
|
||||
vec2 res = tint_degrees(vec2(0.0f, 0.0f));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
vec4 value;
|
||||
};
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void compute_main() {
|
||||
degrees_1ad5df();
|
||||
return;
|
||||
}
|
||||
void main() {
|
||||
compute_main();
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
float2 tint_degrees(float2 param_0) {
|
||||
return param_0 * 57.295779513082322865;
|
||||
}
|
||||
|
||||
void degrees_1ad5df() {
|
||||
float2 res = tint_degrees(float2(0.0f, 0.0f));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
degrees_1ad5df();
|
||||
return float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
degrees_1ad5df();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
degrees_1ad5df();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
float2 tint_degrees(float2 param_0) {
|
||||
return param_0 * 57.295779513082322865;
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value [[position]];
|
||||
};
|
||||
|
||||
void degrees_1ad5df() {
|
||||
float2 res = tint_degrees(float2());
|
||||
}
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
degrees_1ad5df();
|
||||
return float4();
|
||||
}
|
||||
|
||||
vertex tint_symbol vertex_main() {
|
||||
float4 const inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = {};
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
fragment void fragment_main() {
|
||||
degrees_1ad5df();
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void compute_main() {
|
||||
degrees_1ad5df();
|
||||
return;
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 33
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%15 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %value "value"
|
||||
OpName %vertex_point_size "vertex_point_size"
|
||||
OpName %degrees_1ad5df "degrees_1ad5df"
|
||||
OpName %res "res"
|
||||
OpName %vertex_main_inner "vertex_main_inner"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %value BuiltIn Position
|
||||
OpDecorate %vertex_point_size BuiltIn PointSize
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%5 = OpConstantNull %v4float
|
||||
%value = OpVariable %_ptr_Output_v4float Output %5
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%8 = OpConstantNull %float
|
||||
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
|
||||
%void = OpTypeVoid
|
||||
%9 = OpTypeFunction %void
|
||||
%v2float = OpTypeVector %float 2
|
||||
%16 = OpConstantNull %v2float
|
||||
%_ptr_Function_v2float = OpTypePointer Function %v2float
|
||||
%19 = OpTypeFunction %v4float
|
||||
%float_1 = OpConstant %float 1
|
||||
%degrees_1ad5df = OpFunction %void None %9
|
||||
%12 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_v2float Function %16
|
||||
%13 = OpExtInst %v2float %15 Degrees %16
|
||||
OpStore %res %13
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_inner = OpFunction %v4float None %19
|
||||
%21 = OpLabel
|
||||
%22 = OpFunctionCall %void %degrees_1ad5df
|
||||
OpReturnValue %5
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %9
|
||||
%24 = OpLabel
|
||||
%25 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %25
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %9
|
||||
%28 = OpLabel
|
||||
%29 = OpFunctionCall %void %degrees_1ad5df
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %9
|
||||
%31 = OpLabel
|
||||
%32 = OpFunctionCall %void %degrees_1ad5df
|
||||
OpReturn
|
||||
OpFunctionEnd
|
|
@ -0,0 +1,19 @@
|
|||
fn degrees_1ad5df() {
|
||||
var res : vec2<f32> = degrees(vec2<f32>());
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
degrees_1ad5df();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
degrees_1ad5df();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
degrees_1ad5df();
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
// 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 degrees(vec<3, f32>) -> vec<3, f32>
|
||||
fn degrees_2af623() {
|
||||
var res: vec3<f32> = degrees(vec3<f32>());
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
degrees_2af623();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
degrees_2af623();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
degrees_2af623();
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
vec3 tint_degrees(vec3 param_0) {
|
||||
return param_0 * 57.295779513082322865;
|
||||
}
|
||||
|
||||
|
||||
void degrees_2af623() {
|
||||
vec3 res = tint_degrees(vec3(0.0f, 0.0f, 0.0f));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
vec4 value;
|
||||
};
|
||||
|
||||
vec4 vertex_main_inner() {
|
||||
degrees_2af623();
|
||||
return vec4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
vec4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = tint_symbol(vec4(0.0f, 0.0f, 0.0f, 0.0f));
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
void main() {
|
||||
tint_symbol outputs;
|
||||
outputs = vertex_main();
|
||||
gl_Position = outputs.value;
|
||||
gl_Position.y = -gl_Position.y;
|
||||
}
|
||||
|
||||
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
vec3 tint_degrees(vec3 param_0) {
|
||||
return param_0 * 57.295779513082322865;
|
||||
}
|
||||
|
||||
|
||||
void degrees_2af623() {
|
||||
vec3 res = tint_degrees(vec3(0.0f, 0.0f, 0.0f));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
vec4 value;
|
||||
};
|
||||
|
||||
void fragment_main() {
|
||||
degrees_2af623();
|
||||
return;
|
||||
}
|
||||
void main() {
|
||||
fragment_main();
|
||||
}
|
||||
|
||||
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
vec3 tint_degrees(vec3 param_0) {
|
||||
return param_0 * 57.295779513082322865;
|
||||
}
|
||||
|
||||
|
||||
void degrees_2af623() {
|
||||
vec3 res = tint_degrees(vec3(0.0f, 0.0f, 0.0f));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
vec4 value;
|
||||
};
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void compute_main() {
|
||||
degrees_2af623();
|
||||
return;
|
||||
}
|
||||
void main() {
|
||||
compute_main();
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
float3 tint_degrees(float3 param_0) {
|
||||
return param_0 * 57.295779513082322865;
|
||||
}
|
||||
|
||||
void degrees_2af623() {
|
||||
float3 res = tint_degrees(float3(0.0f, 0.0f, 0.0f));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
degrees_2af623();
|
||||
return float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
degrees_2af623();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
degrees_2af623();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
float3 tint_degrees(float3 param_0) {
|
||||
return param_0 * 57.295779513082322865;
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value [[position]];
|
||||
};
|
||||
|
||||
void degrees_2af623() {
|
||||
float3 res = tint_degrees(float3());
|
||||
}
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
degrees_2af623();
|
||||
return float4();
|
||||
}
|
||||
|
||||
vertex tint_symbol vertex_main() {
|
||||
float4 const inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = {};
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
fragment void fragment_main() {
|
||||
degrees_2af623();
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void compute_main() {
|
||||
degrees_2af623();
|
||||
return;
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 33
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%15 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %value "value"
|
||||
OpName %vertex_point_size "vertex_point_size"
|
||||
OpName %degrees_2af623 "degrees_2af623"
|
||||
OpName %res "res"
|
||||
OpName %vertex_main_inner "vertex_main_inner"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %value BuiltIn Position
|
||||
OpDecorate %vertex_point_size BuiltIn PointSize
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%5 = OpConstantNull %v4float
|
||||
%value = OpVariable %_ptr_Output_v4float Output %5
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%8 = OpConstantNull %float
|
||||
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
|
||||
%void = OpTypeVoid
|
||||
%9 = OpTypeFunction %void
|
||||
%v3float = OpTypeVector %float 3
|
||||
%16 = OpConstantNull %v3float
|
||||
%_ptr_Function_v3float = OpTypePointer Function %v3float
|
||||
%19 = OpTypeFunction %v4float
|
||||
%float_1 = OpConstant %float 1
|
||||
%degrees_2af623 = OpFunction %void None %9
|
||||
%12 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_v3float Function %16
|
||||
%13 = OpExtInst %v3float %15 Degrees %16
|
||||
OpStore %res %13
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_inner = OpFunction %v4float None %19
|
||||
%21 = OpLabel
|
||||
%22 = OpFunctionCall %void %degrees_2af623
|
||||
OpReturnValue %5
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %9
|
||||
%24 = OpLabel
|
||||
%25 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %25
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %9
|
||||
%28 = OpLabel
|
||||
%29 = OpFunctionCall %void %degrees_2af623
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %9
|
||||
%31 = OpLabel
|
||||
%32 = OpFunctionCall %void %degrees_2af623
|
||||
OpReturn
|
||||
OpFunctionEnd
|
|
@ -0,0 +1,19 @@
|
|||
fn degrees_2af623() {
|
||||
var res : vec3<f32> = degrees(vec3<f32>());
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
degrees_2af623();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
degrees_2af623();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
degrees_2af623();
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
// 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 degrees(f32) -> f32
|
||||
fn degrees_51f705() {
|
||||
var res: f32 = degrees(1.0);
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
degrees_51f705();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
degrees_51f705();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
degrees_51f705();
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
float tint_degrees(float param_0) {
|
||||
return param_0 * 57.295779513082322865;
|
||||
}
|
||||
|
||||
|
||||
void degrees_51f705() {
|
||||
float res = tint_degrees(1.0f);
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
vec4 value;
|
||||
};
|
||||
|
||||
vec4 vertex_main_inner() {
|
||||
degrees_51f705();
|
||||
return vec4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
vec4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = tint_symbol(vec4(0.0f, 0.0f, 0.0f, 0.0f));
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
void main() {
|
||||
tint_symbol outputs;
|
||||
outputs = vertex_main();
|
||||
gl_Position = outputs.value;
|
||||
gl_Position.y = -gl_Position.y;
|
||||
}
|
||||
|
||||
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
float tint_degrees(float param_0) {
|
||||
return param_0 * 57.295779513082322865;
|
||||
}
|
||||
|
||||
|
||||
void degrees_51f705() {
|
||||
float res = tint_degrees(1.0f);
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
vec4 value;
|
||||
};
|
||||
|
||||
void fragment_main() {
|
||||
degrees_51f705();
|
||||
return;
|
||||
}
|
||||
void main() {
|
||||
fragment_main();
|
||||
}
|
||||
|
||||
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
float tint_degrees(float param_0) {
|
||||
return param_0 * 57.295779513082322865;
|
||||
}
|
||||
|
||||
|
||||
void degrees_51f705() {
|
||||
float res = tint_degrees(1.0f);
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
vec4 value;
|
||||
};
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void compute_main() {
|
||||
degrees_51f705();
|
||||
return;
|
||||
}
|
||||
void main() {
|
||||
compute_main();
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
float tint_degrees(float param_0) {
|
||||
return param_0 * 57.295779513082322865;
|
||||
}
|
||||
|
||||
void degrees_51f705() {
|
||||
float res = tint_degrees(1.0f);
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
degrees_51f705();
|
||||
return float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
degrees_51f705();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
degrees_51f705();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
float tint_degrees(float param_0) {
|
||||
return param_0 * 57.295779513082322865;
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value [[position]];
|
||||
};
|
||||
|
||||
void degrees_51f705() {
|
||||
float res = tint_degrees(1.0f);
|
||||
}
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
degrees_51f705();
|
||||
return float4();
|
||||
}
|
||||
|
||||
vertex tint_symbol vertex_main() {
|
||||
float4 const inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = {};
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
fragment void fragment_main() {
|
||||
degrees_51f705();
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void compute_main() {
|
||||
degrees_51f705();
|
||||
return;
|
||||
}
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 31
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%14 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %value "value"
|
||||
OpName %vertex_point_size "vertex_point_size"
|
||||
OpName %degrees_51f705 "degrees_51f705"
|
||||
OpName %res "res"
|
||||
OpName %vertex_main_inner "vertex_main_inner"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %value BuiltIn Position
|
||||
OpDecorate %vertex_point_size BuiltIn PointSize
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%5 = OpConstantNull %v4float
|
||||
%value = OpVariable %_ptr_Output_v4float Output %5
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%8 = OpConstantNull %float
|
||||
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
|
||||
%void = OpTypeVoid
|
||||
%9 = OpTypeFunction %void
|
||||
%float_1 = OpConstant %float 1
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%18 = OpTypeFunction %v4float
|
||||
%degrees_51f705 = OpFunction %void None %9
|
||||
%12 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_float Function %8
|
||||
%13 = OpExtInst %float %14 Degrees %float_1
|
||||
OpStore %res %13
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_inner = OpFunction %v4float None %18
|
||||
%20 = OpLabel
|
||||
%21 = OpFunctionCall %void %degrees_51f705
|
||||
OpReturnValue %5
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %9
|
||||
%23 = OpLabel
|
||||
%24 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %24
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %9
|
||||
%26 = OpLabel
|
||||
%27 = OpFunctionCall %void %degrees_51f705
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %9
|
||||
%29 = OpLabel
|
||||
%30 = OpFunctionCall %void %degrees_51f705
|
||||
OpReturn
|
||||
OpFunctionEnd
|
|
@ -0,0 +1,19 @@
|
|||
fn degrees_51f705() {
|
||||
var res : f32 = degrees(1.0);
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
degrees_51f705();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
degrees_51f705();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
degrees_51f705();
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
// 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 radians(vec<4, f32>) -> vec<4, f32>
|
||||
fn radians_09b7fc() {
|
||||
var res: vec4<f32> = radians(vec4<f32>());
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
radians_09b7fc();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
radians_09b7fc();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
radians_09b7fc();
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
vec4 tint_radians(vec4 param_0) {
|
||||
return param_0 * 0.017453292519943295474;
|
||||
}
|
||||
|
||||
|
||||
void radians_09b7fc() {
|
||||
vec4 res = tint_radians(vec4(0.0f, 0.0f, 0.0f, 0.0f));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
vec4 value;
|
||||
};
|
||||
|
||||
vec4 vertex_main_inner() {
|
||||
radians_09b7fc();
|
||||
return vec4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
vec4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = tint_symbol(vec4(0.0f, 0.0f, 0.0f, 0.0f));
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
void main() {
|
||||
tint_symbol outputs;
|
||||
outputs = vertex_main();
|
||||
gl_Position = outputs.value;
|
||||
gl_Position.y = -gl_Position.y;
|
||||
}
|
||||
|
||||
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
vec4 tint_radians(vec4 param_0) {
|
||||
return param_0 * 0.017453292519943295474;
|
||||
}
|
||||
|
||||
|
||||
void radians_09b7fc() {
|
||||
vec4 res = tint_radians(vec4(0.0f, 0.0f, 0.0f, 0.0f));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
vec4 value;
|
||||
};
|
||||
|
||||
void fragment_main() {
|
||||
radians_09b7fc();
|
||||
return;
|
||||
}
|
||||
void main() {
|
||||
fragment_main();
|
||||
}
|
||||
|
||||
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
vec4 tint_radians(vec4 param_0) {
|
||||
return param_0 * 0.017453292519943295474;
|
||||
}
|
||||
|
||||
|
||||
void radians_09b7fc() {
|
||||
vec4 res = tint_radians(vec4(0.0f, 0.0f, 0.0f, 0.0f));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
vec4 value;
|
||||
};
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void compute_main() {
|
||||
radians_09b7fc();
|
||||
return;
|
||||
}
|
||||
void main() {
|
||||
compute_main();
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
float4 tint_radians(float4 param_0) {
|
||||
return param_0 * 0.017453292519943295474;
|
||||
}
|
||||
|
||||
void radians_09b7fc() {
|
||||
float4 res = tint_radians(float4(0.0f, 0.0f, 0.0f, 0.0f));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
radians_09b7fc();
|
||||
return float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
radians_09b7fc();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
radians_09b7fc();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
float4 tint_radians(float4 param_0) {
|
||||
return param_0 * 0.017453292519943295474;
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value [[position]];
|
||||
};
|
||||
|
||||
void radians_09b7fc() {
|
||||
float4 res = tint_radians(float4());
|
||||
}
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
radians_09b7fc();
|
||||
return float4();
|
||||
}
|
||||
|
||||
vertex tint_symbol vertex_main() {
|
||||
float4 const inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = {};
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
fragment void fragment_main() {
|
||||
radians_09b7fc();
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void compute_main() {
|
||||
radians_09b7fc();
|
||||
return;
|
||||
}
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 31
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%14 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %value "value"
|
||||
OpName %vertex_point_size "vertex_point_size"
|
||||
OpName %radians_09b7fc "radians_09b7fc"
|
||||
OpName %res "res"
|
||||
OpName %vertex_main_inner "vertex_main_inner"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %value BuiltIn Position
|
||||
OpDecorate %vertex_point_size BuiltIn PointSize
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%5 = OpConstantNull %v4float
|
||||
%value = OpVariable %_ptr_Output_v4float Output %5
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%8 = OpConstantNull %float
|
||||
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
|
||||
%void = OpTypeVoid
|
||||
%9 = OpTypeFunction %void
|
||||
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||
%17 = OpTypeFunction %v4float
|
||||
%float_1 = OpConstant %float 1
|
||||
%radians_09b7fc = OpFunction %void None %9
|
||||
%12 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_v4float Function %5
|
||||
%13 = OpExtInst %v4float %14 Radians %5
|
||||
OpStore %res %13
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_inner = OpFunction %v4float None %17
|
||||
%19 = OpLabel
|
||||
%20 = OpFunctionCall %void %radians_09b7fc
|
||||
OpReturnValue %5
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %9
|
||||
%22 = OpLabel
|
||||
%23 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %23
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %9
|
||||
%26 = OpLabel
|
||||
%27 = OpFunctionCall %void %radians_09b7fc
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %9
|
||||
%29 = OpLabel
|
||||
%30 = OpFunctionCall %void %radians_09b7fc
|
||||
OpReturn
|
||||
OpFunctionEnd
|
|
@ -0,0 +1,19 @@
|
|||
fn radians_09b7fc() {
|
||||
var res : vec4<f32> = radians(vec4<f32>());
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
radians_09b7fc();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
radians_09b7fc();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
radians_09b7fc();
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
// 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 radians(vec<2, f32>) -> vec<2, f32>
|
||||
fn radians_61687a() {
|
||||
var res: vec2<f32> = radians(vec2<f32>());
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
radians_61687a();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
radians_61687a();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
radians_61687a();
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
vec2 tint_radians(vec2 param_0) {
|
||||
return param_0 * 0.017453292519943295474;
|
||||
}
|
||||
|
||||
|
||||
void radians_61687a() {
|
||||
vec2 res = tint_radians(vec2(0.0f, 0.0f));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
vec4 value;
|
||||
};
|
||||
|
||||
vec4 vertex_main_inner() {
|
||||
radians_61687a();
|
||||
return vec4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
vec4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = tint_symbol(vec4(0.0f, 0.0f, 0.0f, 0.0f));
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
void main() {
|
||||
tint_symbol outputs;
|
||||
outputs = vertex_main();
|
||||
gl_Position = outputs.value;
|
||||
gl_Position.y = -gl_Position.y;
|
||||
}
|
||||
|
||||
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
vec2 tint_radians(vec2 param_0) {
|
||||
return param_0 * 0.017453292519943295474;
|
||||
}
|
||||
|
||||
|
||||
void radians_61687a() {
|
||||
vec2 res = tint_radians(vec2(0.0f, 0.0f));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
vec4 value;
|
||||
};
|
||||
|
||||
void fragment_main() {
|
||||
radians_61687a();
|
||||
return;
|
||||
}
|
||||
void main() {
|
||||
fragment_main();
|
||||
}
|
||||
|
||||
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
vec2 tint_radians(vec2 param_0) {
|
||||
return param_0 * 0.017453292519943295474;
|
||||
}
|
||||
|
||||
|
||||
void radians_61687a() {
|
||||
vec2 res = tint_radians(vec2(0.0f, 0.0f));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
vec4 value;
|
||||
};
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void compute_main() {
|
||||
radians_61687a();
|
||||
return;
|
||||
}
|
||||
void main() {
|
||||
compute_main();
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
float2 tint_radians(float2 param_0) {
|
||||
return param_0 * 0.017453292519943295474;
|
||||
}
|
||||
|
||||
void radians_61687a() {
|
||||
float2 res = tint_radians(float2(0.0f, 0.0f));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
radians_61687a();
|
||||
return float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
radians_61687a();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
radians_61687a();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
float2 tint_radians(float2 param_0) {
|
||||
return param_0 * 0.017453292519943295474;
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value [[position]];
|
||||
};
|
||||
|
||||
void radians_61687a() {
|
||||
float2 res = tint_radians(float2());
|
||||
}
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
radians_61687a();
|
||||
return float4();
|
||||
}
|
||||
|
||||
vertex tint_symbol vertex_main() {
|
||||
float4 const inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = {};
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
fragment void fragment_main() {
|
||||
radians_61687a();
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void compute_main() {
|
||||
radians_61687a();
|
||||
return;
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 33
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%15 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %value "value"
|
||||
OpName %vertex_point_size "vertex_point_size"
|
||||
OpName %radians_61687a "radians_61687a"
|
||||
OpName %res "res"
|
||||
OpName %vertex_main_inner "vertex_main_inner"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %value BuiltIn Position
|
||||
OpDecorate %vertex_point_size BuiltIn PointSize
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%5 = OpConstantNull %v4float
|
||||
%value = OpVariable %_ptr_Output_v4float Output %5
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%8 = OpConstantNull %float
|
||||
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
|
||||
%void = OpTypeVoid
|
||||
%9 = OpTypeFunction %void
|
||||
%v2float = OpTypeVector %float 2
|
||||
%16 = OpConstantNull %v2float
|
||||
%_ptr_Function_v2float = OpTypePointer Function %v2float
|
||||
%19 = OpTypeFunction %v4float
|
||||
%float_1 = OpConstant %float 1
|
||||
%radians_61687a = OpFunction %void None %9
|
||||
%12 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_v2float Function %16
|
||||
%13 = OpExtInst %v2float %15 Radians %16
|
||||
OpStore %res %13
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_inner = OpFunction %v4float None %19
|
||||
%21 = OpLabel
|
||||
%22 = OpFunctionCall %void %radians_61687a
|
||||
OpReturnValue %5
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %9
|
||||
%24 = OpLabel
|
||||
%25 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %25
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %9
|
||||
%28 = OpLabel
|
||||
%29 = OpFunctionCall %void %radians_61687a
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %9
|
||||
%31 = OpLabel
|
||||
%32 = OpFunctionCall %void %radians_61687a
|
||||
OpReturn
|
||||
OpFunctionEnd
|
|
@ -0,0 +1,19 @@
|
|||
fn radians_61687a() {
|
||||
var res : vec2<f32> = radians(vec2<f32>());
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
radians_61687a();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
radians_61687a();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
radians_61687a();
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
// 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 radians(f32) -> f32
|
||||
fn radians_6b0ff2() {
|
||||
var res: f32 = radians(1.0);
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
radians_6b0ff2();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
radians_6b0ff2();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
radians_6b0ff2();
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
float tint_radians(float param_0) {
|
||||
return param_0 * 0.017453292519943295474;
|
||||
}
|
||||
|
||||
|
||||
void radians_6b0ff2() {
|
||||
float res = tint_radians(1.0f);
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
vec4 value;
|
||||
};
|
||||
|
||||
vec4 vertex_main_inner() {
|
||||
radians_6b0ff2();
|
||||
return vec4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
vec4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = tint_symbol(vec4(0.0f, 0.0f, 0.0f, 0.0f));
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
void main() {
|
||||
tint_symbol outputs;
|
||||
outputs = vertex_main();
|
||||
gl_Position = outputs.value;
|
||||
gl_Position.y = -gl_Position.y;
|
||||
}
|
||||
|
||||
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
float tint_radians(float param_0) {
|
||||
return param_0 * 0.017453292519943295474;
|
||||
}
|
||||
|
||||
|
||||
void radians_6b0ff2() {
|
||||
float res = tint_radians(1.0f);
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
vec4 value;
|
||||
};
|
||||
|
||||
void fragment_main() {
|
||||
radians_6b0ff2();
|
||||
return;
|
||||
}
|
||||
void main() {
|
||||
fragment_main();
|
||||
}
|
||||
|
||||
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
float tint_radians(float param_0) {
|
||||
return param_0 * 0.017453292519943295474;
|
||||
}
|
||||
|
||||
|
||||
void radians_6b0ff2() {
|
||||
float res = tint_radians(1.0f);
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
vec4 value;
|
||||
};
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void compute_main() {
|
||||
radians_6b0ff2();
|
||||
return;
|
||||
}
|
||||
void main() {
|
||||
compute_main();
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
float tint_radians(float param_0) {
|
||||
return param_0 * 0.017453292519943295474;
|
||||
}
|
||||
|
||||
void radians_6b0ff2() {
|
||||
float res = tint_radians(1.0f);
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
radians_6b0ff2();
|
||||
return float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
radians_6b0ff2();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
radians_6b0ff2();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
float tint_radians(float param_0) {
|
||||
return param_0 * 0.017453292519943295474;
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value [[position]];
|
||||
};
|
||||
|
||||
void radians_6b0ff2() {
|
||||
float res = tint_radians(1.0f);
|
||||
}
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
radians_6b0ff2();
|
||||
return float4();
|
||||
}
|
||||
|
||||
vertex tint_symbol vertex_main() {
|
||||
float4 const inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = {};
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
fragment void fragment_main() {
|
||||
radians_6b0ff2();
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void compute_main() {
|
||||
radians_6b0ff2();
|
||||
return;
|
||||
}
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 31
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%14 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %value "value"
|
||||
OpName %vertex_point_size "vertex_point_size"
|
||||
OpName %radians_6b0ff2 "radians_6b0ff2"
|
||||
OpName %res "res"
|
||||
OpName %vertex_main_inner "vertex_main_inner"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %value BuiltIn Position
|
||||
OpDecorate %vertex_point_size BuiltIn PointSize
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%5 = OpConstantNull %v4float
|
||||
%value = OpVariable %_ptr_Output_v4float Output %5
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%8 = OpConstantNull %float
|
||||
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
|
||||
%void = OpTypeVoid
|
||||
%9 = OpTypeFunction %void
|
||||
%float_1 = OpConstant %float 1
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%18 = OpTypeFunction %v4float
|
||||
%radians_6b0ff2 = OpFunction %void None %9
|
||||
%12 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_float Function %8
|
||||
%13 = OpExtInst %float %14 Radians %float_1
|
||||
OpStore %res %13
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_inner = OpFunction %v4float None %18
|
||||
%20 = OpLabel
|
||||
%21 = OpFunctionCall %void %radians_6b0ff2
|
||||
OpReturnValue %5
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %9
|
||||
%23 = OpLabel
|
||||
%24 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %24
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %9
|
||||
%26 = OpLabel
|
||||
%27 = OpFunctionCall %void %radians_6b0ff2
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %9
|
||||
%29 = OpLabel
|
||||
%30 = OpFunctionCall %void %radians_6b0ff2
|
||||
OpReturn
|
||||
OpFunctionEnd
|
|
@ -0,0 +1,19 @@
|
|||
fn radians_6b0ff2() {
|
||||
var res : f32 = radians(1.0);
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
radians_6b0ff2();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
radians_6b0ff2();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
radians_6b0ff2();
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
// 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 radians(vec<3, f32>) -> vec<3, f32>
|
||||
fn radians_f96258() {
|
||||
var res: vec3<f32> = radians(vec3<f32>());
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
radians_f96258();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
radians_f96258();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
radians_f96258();
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
vec3 tint_radians(vec3 param_0) {
|
||||
return param_0 * 0.017453292519943295474;
|
||||
}
|
||||
|
||||
|
||||
void radians_f96258() {
|
||||
vec3 res = tint_radians(vec3(0.0f, 0.0f, 0.0f));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
vec4 value;
|
||||
};
|
||||
|
||||
vec4 vertex_main_inner() {
|
||||
radians_f96258();
|
||||
return vec4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
vec4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = tint_symbol(vec4(0.0f, 0.0f, 0.0f, 0.0f));
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
void main() {
|
||||
tint_symbol outputs;
|
||||
outputs = vertex_main();
|
||||
gl_Position = outputs.value;
|
||||
gl_Position.y = -gl_Position.y;
|
||||
}
|
||||
|
||||
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
vec3 tint_radians(vec3 param_0) {
|
||||
return param_0 * 0.017453292519943295474;
|
||||
}
|
||||
|
||||
|
||||
void radians_f96258() {
|
||||
vec3 res = tint_radians(vec3(0.0f, 0.0f, 0.0f));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
vec4 value;
|
||||
};
|
||||
|
||||
void fragment_main() {
|
||||
radians_f96258();
|
||||
return;
|
||||
}
|
||||
void main() {
|
||||
fragment_main();
|
||||
}
|
||||
|
||||
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
vec3 tint_radians(vec3 param_0) {
|
||||
return param_0 * 0.017453292519943295474;
|
||||
}
|
||||
|
||||
|
||||
void radians_f96258() {
|
||||
vec3 res = tint_radians(vec3(0.0f, 0.0f, 0.0f));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
vec4 value;
|
||||
};
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void compute_main() {
|
||||
radians_f96258();
|
||||
return;
|
||||
}
|
||||
void main() {
|
||||
compute_main();
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
float3 tint_radians(float3 param_0) {
|
||||
return param_0 * 0.017453292519943295474;
|
||||
}
|
||||
|
||||
void radians_f96258() {
|
||||
float3 res = tint_radians(float3(0.0f, 0.0f, 0.0f));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
radians_f96258();
|
||||
return float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
radians_f96258();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
radians_f96258();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
float3 tint_radians(float3 param_0) {
|
||||
return param_0 * 0.017453292519943295474;
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value [[position]];
|
||||
};
|
||||
|
||||
void radians_f96258() {
|
||||
float3 res = tint_radians(float3());
|
||||
}
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
radians_f96258();
|
||||
return float4();
|
||||
}
|
||||
|
||||
vertex tint_symbol vertex_main() {
|
||||
float4 const inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = {};
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
fragment void fragment_main() {
|
||||
radians_f96258();
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void compute_main() {
|
||||
radians_f96258();
|
||||
return;
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 33
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%15 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %value "value"
|
||||
OpName %vertex_point_size "vertex_point_size"
|
||||
OpName %radians_f96258 "radians_f96258"
|
||||
OpName %res "res"
|
||||
OpName %vertex_main_inner "vertex_main_inner"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %value BuiltIn Position
|
||||
OpDecorate %vertex_point_size BuiltIn PointSize
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%5 = OpConstantNull %v4float
|
||||
%value = OpVariable %_ptr_Output_v4float Output %5
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%8 = OpConstantNull %float
|
||||
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
|
||||
%void = OpTypeVoid
|
||||
%9 = OpTypeFunction %void
|
||||
%v3float = OpTypeVector %float 3
|
||||
%16 = OpConstantNull %v3float
|
||||
%_ptr_Function_v3float = OpTypePointer Function %v3float
|
||||
%19 = OpTypeFunction %v4float
|
||||
%float_1 = OpConstant %float 1
|
||||
%radians_f96258 = OpFunction %void None %9
|
||||
%12 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_v3float Function %16
|
||||
%13 = OpExtInst %v3float %15 Radians %16
|
||||
OpStore %res %13
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_inner = OpFunction %v4float None %19
|
||||
%21 = OpLabel
|
||||
%22 = OpFunctionCall %void %radians_f96258
|
||||
OpReturnValue %5
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %9
|
||||
%24 = OpLabel
|
||||
%25 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %25
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %9
|
||||
%28 = OpLabel
|
||||
%29 = OpFunctionCall %void %radians_f96258
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %9
|
||||
%31 = OpLabel
|
||||
%32 = OpFunctionCall %void %radians_f96258
|
||||
OpReturn
|
||||
OpFunctionEnd
|
|
@ -0,0 +1,19 @@
|
|||
fn radians_f96258() {
|
||||
var res : vec3<f32> = radians(vec3<f32>());
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
radians_f96258();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
radians_f96258();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
radians_f96258();
|
||||
}
|
|
@ -1,11 +1,16 @@
|
|||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
float tint_radians(float param_0) {
|
||||
return param_0 * 0.017453292519943295474;
|
||||
}
|
||||
|
||||
|
||||
void main_1() {
|
||||
float a = 0.0f;
|
||||
float b = 0.0f;
|
||||
a = 42.0f;
|
||||
b = (a * 0.017453292f);
|
||||
b = tint_radians(a);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
float tint_radians(float param_0) {
|
||||
return param_0 * 0.017453292519943295474;
|
||||
}
|
||||
|
||||
void main_1() {
|
||||
float a = 0.0f;
|
||||
float b = 0.0f;
|
||||
a = 42.0f;
|
||||
b = (a * 0.017453292f);
|
||||
b = tint_radians(a);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,17 @@
|
|||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
float tint_radians(float param_0) {
|
||||
return param_0 * 0.017453292519943295474;
|
||||
}
|
||||
|
||||
void main_1() {
|
||||
float a = 0.0f;
|
||||
float b = 0.0f;
|
||||
a = 42.0f;
|
||||
float const x_11 = a;
|
||||
b = (x_11 * 0.017453292f);
|
||||
b = tint_radians(x_11);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
; Bound: 17
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%13 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
|
@ -17,15 +18,14 @@
|
|||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%8 = OpConstantNull %float
|
||||
%float_42 = OpConstant %float 42
|
||||
%float_0_0174532924 = OpConstant %float 0.0174532924
|
||||
%main_1 = OpFunction %void None %1
|
||||
%4 = OpLabel
|
||||
%a = OpVariable %_ptr_Function_float Function %8
|
||||
%b = OpVariable %_ptr_Function_float Function %8
|
||||
OpStore %a %float_42
|
||||
%11 = OpLoad %float %a
|
||||
%13 = OpFMul %float %11 %float_0_0174532924
|
||||
OpStore %b %13
|
||||
%12 = OpExtInst %float %13 Radians %11
|
||||
OpStore %b %12
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%main = OpFunction %void None %1
|
||||
|
|
|
@ -3,7 +3,7 @@ fn main_1() {
|
|||
var b : f32;
|
||||
a = 42.0;
|
||||
let x_11 : f32 = a;
|
||||
b = (x_11 * 0.017453292);
|
||||
b = radians(x_11);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue