tint/spirv-reader: add support for GLSLstd450MatrixInverse

Bug: tint:1670
Change-Id: I2faaec03117a00f55624c9a51419eb79cc6da40f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/102261
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Arman Uguray <armansito@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
Antonio Maiorano 2022-09-15 17:22:25 +00:00 committed by Dawn LUCI CQ
parent ee1996ba9e
commit 6ab02659de
10 changed files with 1436 additions and 4 deletions

View File

@ -415,8 +415,6 @@ std::string GetGlslStd450FuncName(uint32_t ext_opcode) {
case GLSLstd450Acosh: case GLSLstd450Acosh:
case GLSLstd450Atanh: case GLSLstd450Atanh:
case GLSLstd450MatrixInverse:
case GLSLstd450Modf: case GLSLstd450Modf:
case GLSLstd450ModfStruct: case GLSLstd450ModfStruct:
case GLSLstd450IMix: case GLSLstd450IMix:
@ -4043,6 +4041,11 @@ TypedExpression FunctionEmitter::EmitGlslStd450ExtInst(const spvtools::opt::Inst
default: default:
break; break;
} }
} else {
switch (ext_opcode) {
case GLSLstd450MatrixInverse:
return EmitGlslStd450MatrixInverse(inst);
}
} }
const auto name = GetGlslStd450FuncName(ext_opcode); const auto name = GetGlslStd450FuncName(ext_opcode);
@ -4067,6 +4070,196 @@ TypedExpression FunctionEmitter::EmitGlslStd450ExtInst(const spvtools::opt::Inst
return parser_impl_.RectifyForcedResultType(call_expr, inst, first_operand_type); return parser_impl_.RectifyForcedResultType(call_expr, inst, first_operand_type);
} }
TypedExpression FunctionEmitter::EmitGlslStd450MatrixInverse(
const spvtools::opt::Instruction& inst) {
auto mat = MakeOperand(inst, 2);
auto* mat_ty = mat.type->As<Matrix>();
TINT_ASSERT(Reader, mat_ty);
TINT_ASSERT(Reader, mat_ty->columns == mat_ty->rows);
auto& pb = builder_;
auto idx = [&](size_t row, size_t col) {
return pb.IndexAccessor(pb.IndexAccessor(mat.expr, u32(row)), u32(col));
};
// Compute and save determinant to a let
auto* det = pb.Div(1.0_f, pb.Call(Source{}, "determinant", mat.expr));
auto s = pb.Symbols().New("s");
AddStatement(pb.Decl(pb.Let(s, det)));
// Returns (a * b) - (c * d)
auto sub_mul2 = [&](auto* a, auto* b, auto* c, auto* d) {
return pb.Sub(pb.Mul(a, b), pb.Mul(c, d));
};
// Returns (a * b) - (c * d) + (e * f)
auto sub_add_mul3 = [&](auto* a, auto* b, auto* c, auto* d, auto* e, auto* f) {
return pb.Add(pb.Sub(pb.Mul(a, b), pb.Mul(c, d)), pb.Mul(e, f));
};
// Returns (a * b) + (c * d) - (e * f)
auto add_sub_mul3 = [&](auto* a, auto* b, auto* c, auto* d, auto* e, auto* f) {
return pb.Sub(pb.Add(pb.Mul(a, b), pb.Mul(c, d)), pb.Mul(e, f));
};
// Returns -a
auto neg = [&](auto&& a) { return pb.Negation(a); };
switch (mat_ty->columns) {
case 2: {
// a, b
// c, d
auto* a = idx(0, 0);
auto* b = idx(0, 1);
auto* c = idx(1, 0);
auto* d = idx(1, 1);
// s * d, -s * b, -s * c, s * a
auto* r = pb.mat2x2<f32>( //
pb.vec2<f32>(pb.Mul(s, d), pb.Mul(neg(s), b)),
pb.vec2<f32>(pb.Mul(neg(s), c), pb.Mul(s, a)));
return {mat.type, r};
}
case 3: {
// a, b, c,
// d, e, f,
// g, h, i
auto* a = idx(0, 0);
auto* b = idx(0, 1);
auto* c = idx(0, 2);
auto* d = idx(1, 0);
auto* e = idx(1, 1);
auto* f = idx(1, 2);
auto* g = idx(2, 0);
auto* h = idx(2, 1);
auto* i = idx(2, 2);
auto r = pb.Mul(s, //
pb.mat3x3<f32>( //
pb.vec3<f32>(
// e * i - f * h
sub_mul2(e, i, f, h),
// c * h - b * i
sub_mul2(c, h, b, i),
// b * f - c * e
sub_mul2(b, f, c, e)),
pb.vec3<f32>(
// f * g - d * i
sub_mul2(f, g, d, i),
// a * i - c * g
sub_mul2(a, i, c, g),
// c * d - a * f
sub_mul2(c, d, a, f)),
pb.vec3<f32>(
// d * h - e * g
sub_mul2(d, h, e, g),
// b * g - a * h
sub_mul2(b, g, a, h),
// a * e - b * d
sub_mul2(a, e, b, d))));
return {mat.type, r};
}
case 4: {
// a, b, c, d,
// e, f, g, h,
// i, j, k, l,
// m, n, o, p
auto* a = idx(0, 0);
auto* b = idx(0, 1);
auto* c = idx(0, 2);
auto* d = idx(0, 3);
auto* e = idx(1, 0);
auto* f = idx(1, 1);
auto* g = idx(1, 2);
auto* h = idx(1, 3);
auto* i = idx(2, 0);
auto* j = idx(2, 1);
auto* k = idx(2, 2);
auto* l = idx(2, 3);
auto* m = idx(3, 0);
auto* n = idx(3, 1);
auto* o = idx(3, 2);
auto* p = idx(3, 3);
// kplo = k * p - l * o, jpln = j * p - l * n, jokn = j * o - k * n;
auto* kplo = sub_mul2(k, p, l, o);
auto* jpln = sub_mul2(j, p, l, n);
auto* jokn = sub_mul2(j, o, k, n);
// gpho = g * p - h * o, fphn = f * p - h * n, fogn = f * o - g * n;
auto* gpho = sub_mul2(g, p, h, o);
auto* fphn = sub_mul2(f, p, h, n);
auto* fogn = sub_mul2(f, o, g, n);
// glhk = g * l - h * k, flhj = f * l - h * j, fkgj = f * k - g * j;
auto* glhk = sub_mul2(g, l, h, k);
auto* flhj = sub_mul2(f, l, h, j);
auto* fkgj = sub_mul2(f, k, g, j);
// iplm = i * p - l * m, iokm = i * o - k * m, ephm = e * p - h * m;
auto* iplm = sub_mul2(i, p, l, m);
auto* iokm = sub_mul2(i, o, k, m);
auto* ephm = sub_mul2(e, p, h, m);
// eogm = e * o - g * m, elhi = e * l - h * i, ekgi = e * k - g * i;
auto* eogm = sub_mul2(e, o, g, m);
auto* elhi = sub_mul2(e, l, h, i);
auto* ekgi = sub_mul2(e, k, g, i);
// injm = i * n - j * m, enfm = e * n - f * m, ejfi = e * j - f * i;
auto* injm = sub_mul2(i, n, j, m);
auto* enfm = sub_mul2(e, n, f, m);
auto* ejfi = sub_mul2(e, j, f, i);
auto r = pb.Mul(s, //
pb.mat4x4<f32>( //
pb.vec4<f32>(
// f * kplo - g * jpln + h * jokn
sub_add_mul3(f, kplo, g, jpln, h, jokn),
// -b * kplo + c * jpln - d * jokn
add_sub_mul3(neg(b), kplo, c, jpln, d, jokn),
// b * gpho - c * fphn + d * fogn
sub_add_mul3(b, gpho, c, fphn, d, fogn),
// -b * glhk + c * flhj - d * fkgj
add_sub_mul3(neg(b), glhk, c, flhj, d, fkgj)),
pb.vec4<f32>(
// -e * kplo + g * iplm - h * iokm
add_sub_mul3(neg(e), kplo, g, iplm, h, iokm),
// a * kplo - c * iplm + d * iokm
sub_add_mul3(a, kplo, c, iplm, d, iokm),
// -a * gpho + c * ephm - d * eogm
add_sub_mul3(neg(a), gpho, c, ephm, d, eogm),
// a * glhk - c * elhi + d * ekgi
sub_add_mul3(a, glhk, c, elhi, d, ekgi)),
pb.vec4<f32>(
// e * jpln - f * iplm + h * injm
sub_add_mul3(e, jpln, f, iplm, h, injm),
// -a * jpln + b * iplm - d * injm
add_sub_mul3(neg(a), jpln, b, iplm, d, injm),
// a * fphn - b * ephm + d * enfm
sub_add_mul3(a, fphn, b, ephm, d, enfm),
// -a * flhj + b * elhi - d * ejfi
add_sub_mul3(neg(a), flhj, b, elhi, d, ejfi)),
pb.vec4<f32>(
// -e * jokn + f * iokm - g * injm
add_sub_mul3(neg(e), jokn, f, iokm, g, injm),
// a * jokn - b * iokm + c * injm
sub_add_mul3(a, jokn, b, iokm, c, injm),
// -a * fogn + b * eogm - c * enfm
add_sub_mul3(neg(a), fogn, b, eogm, c, enfm),
// a * fkgj - b * ekgi + c * ejfi
sub_add_mul3(a, fkgj, b, ekgi, c, ejfi))));
return {mat.type, r};
}
}
const auto ext_opcode = inst.GetSingleWordInOperand(1);
Fail() << "invalid matrix size for " << GetGlslStd450FuncName(ext_opcode);
return {};
}
ast::IdentifierExpression* FunctionEmitter::Swizzle(uint32_t i) { ast::IdentifierExpression* FunctionEmitter::Swizzle(uint32_t i) {
if (i >= kMaxVectorLen) { if (i >= kMaxVectorLen) {
Fail() << "vector component index is larger than " << kMaxVectorLen - 1 << ": " << i; Fail() << "vector component index is larger than " << kMaxVectorLen - 1 << ": " << i;

View File

@ -804,6 +804,11 @@ class FunctionEmitter {
/// @returns an AST expression for the instruction, or nullptr. /// @returns an AST expression for the instruction, or nullptr.
TypedExpression EmitGlslStd450ExtInst(const spvtools::opt::Instruction& inst); TypedExpression EmitGlslStd450ExtInst(const spvtools::opt::Instruction& inst);
/// Creates an expression for the GLSL.std.450 matrix `inverse` extended instruction.
/// @param inst a SPIR-V OpExtInst instruction from GLSL.std.450
/// @returns an AST expression for the instruction, or nullptr.
TypedExpression EmitGlslStd450MatrixInverse(const spvtools::opt::Instruction& inst);
/// Creates an expression for OpCompositeExtract /// Creates an expression for OpCompositeExtract
/// @param inst an OpCompositeExtract instruction. /// @param inst an OpCompositeExtract instruction.
/// @returns an AST expression for the instruction, or nullptr. /// @returns an AST expression for the instruction, or nullptr.

View File

@ -98,8 +98,8 @@ std::string Preamble() {
%v4float_50_50_50_50 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50 %v4float_50_50_50_50 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
%mat2v2float_50_60 = OpConstantComposite %mat2v2float %v2float_50_60 %v2float_50_60 %mat2v2float_50_60 = OpConstantComposite %mat2v2float %v2float_50_60 %v2float_50_60
%mat3v3float_50_60_70 = OpConstantComposite %mat2v2float %v3float_50_60_70 %v3float_50_60_70 %v3float_50_60_70 %mat3v3float_50_60_70 = OpConstantComposite %mat3v3float %v3float_50_60_70 %v3float_50_60_70 %v3float_50_60_70
%mat4v4float_50_50_50_50 = OpConstantComposite %mat2v2float %v4float_50_50_50_50 %v4float_50_50_50_50 %v4float_50_50_50_50 %v4float_50_50_50_50 %mat4v4float_50_50_50_50 = OpConstantComposite %mat4v4float %v4float_50_50_50_50 %v4float_50_50_50_50 %v4float_50_50_50_50 %v4float_50_50_50_50
%100 = OpFunction %void None %voidfn %100 = OpFunction %void None %voidfn
%entry = OpLabel %entry = OpLabel
@ -1158,5 +1158,159 @@ INSTANTIATE_TEST_SUITE_P(Test,
GlslStd450_Determinant, GlslStd450_Determinant,
::testing::Values("m2x2f1", "m3x3f1", "m4x4f1")); ::testing::Values("m2x2f1", "m3x3f1", "m4x4f1"));
TEST_F(SpvParserTest, GlslStd450_MatrixInverse_mat2x2) {
const auto assembly = Preamble() + R"(
%1 = OpExtInst %mat2v2float %glsl MatrixInverse %m2x2f1
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);
std::string expected =
"let s = (1.0f / determinant(m2x2f1));\n"
"let x_1 : mat2x2<f32> = mat2x2<f32>(vec2<f32>((s * m2x2f1[1u][1u]), (-(s) * "
"m2x2f1[0u][1u])), vec2<f32>((-(s) * m2x2f1[1u][0u]), (s * m2x2f1[0u][0u])));";
EXPECT_THAT(body, HasSubstr(expected)) << body;
}
TEST_F(SpvParserTest, GlslStd450_MatrixInverse_mat3x3) {
const auto assembly = Preamble() + R"(
%1 = OpExtInst %mat3v3float %glsl MatrixInverse %m3x3f1
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);
std::string expected =
"let s = (1.0f / determinant(m3x3f1));\n"
"let x_1 : mat3x3<f32> = (s * mat3x3<f32>(vec3<f32>(((m3x3f1[1u][1u] * m3x3f1[2u][2u]) - "
"(m3x3f1[1u][2u] * m3x3f1[2u][1u])), ((m3x3f1[0u][2u] * m3x3f1[2u][1u]) - (m3x3f1[0u][1u] "
"* m3x3f1[2u][2u])), ((m3x3f1[0u][1u] * m3x3f1[1u][2u]) - (m3x3f1[0u][2u] * "
"m3x3f1[1u][1u]))), vec3<f32>(((m3x3f1[1u][2u] * m3x3f1[2u][0u]) - (m3x3f1[1u][0u] * "
"m3x3f1[2u][2u])), ((m3x3f1[0u][0u] * m3x3f1[2u][2u]) - (m3x3f1[0u][2u] * "
"m3x3f1[2u][0u])), ((m3x3f1[0u][2u] * m3x3f1[1u][0u]) - (m3x3f1[0u][0u] * "
"m3x3f1[1u][2u]))), vec3<f32>(((m3x3f1[1u][0u] * m3x3f1[2u][1u]) - (m3x3f1[1u][1u] * "
"m3x3f1[2u][0u])), ((m3x3f1[0u][1u] * m3x3f1[2u][0u]) - (m3x3f1[0u][0u] * "
"m3x3f1[2u][1u])), ((m3x3f1[0u][0u] * m3x3f1[1u][1u]) - (m3x3f1[0u][1u] * "
"m3x3f1[1u][0u])))));";
EXPECT_THAT(body, HasSubstr(expected)) << body;
}
TEST_F(SpvParserTest, GlslStd450_MatrixInverse_mat4x4) {
const auto assembly = Preamble() + R"(
%1 = OpExtInst %mat4v4float %glsl MatrixInverse %m4x4f1
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);
std::string expected =
"let s = (1.0f / determinant(m4x4f1));\n"
"let x_1 : mat4x4<f32> = (s * mat4x4<f32>(vec4<f32>((((m4x4f1[1u][1u] * ((m4x4f1[2u][2u] * "
"m4x4f1[3u][3u]) - (m4x4f1[2u][3u] * m4x4f1[3u][2u]))) - (m4x4f1[1u][2u] * "
"((m4x4f1[2u][1u] * m4x4f1[3u][3u]) - (m4x4f1[2u][3u] * m4x4f1[3u][1u])))) + "
"(m4x4f1[1u][3u] * ((m4x4f1[2u][1u] * m4x4f1[3u][2u]) - (m4x4f1[2u][2u] * "
"m4x4f1[3u][1u])))), (((-(m4x4f1[0u][1u]) * ((m4x4f1[2u][2u] * m4x4f1[3u][3u]) - "
"(m4x4f1[2u][3u] * m4x4f1[3u][2u]))) + (m4x4f1[0u][2u] * ((m4x4f1[2u][1u] * "
"m4x4f1[3u][3u]) - (m4x4f1[2u][3u] * m4x4f1[3u][1u])))) - (m4x4f1[0u][3u] * "
"((m4x4f1[2u][1u] * m4x4f1[3u][2u]) - (m4x4f1[2u][2u] * m4x4f1[3u][1u])))), "
"(((m4x4f1[0u][1u] * ((m4x4f1[1u][2u] * m4x4f1[3u][3u]) - (m4x4f1[1u][3u] * "
"m4x4f1[3u][2u]))) - (m4x4f1[0u][2u] * ((m4x4f1[1u][1u] * m4x4f1[3u][3u]) - "
"(m4x4f1[1u][3u] * m4x4f1[3u][1u])))) + (m4x4f1[0u][3u] * ((m4x4f1[1u][1u] * "
"m4x4f1[3u][2u]) - (m4x4f1[1u][2u] * m4x4f1[3u][1u])))), (((-(m4x4f1[0u][1u]) * "
"((m4x4f1[1u][2u] * m4x4f1[2u][3u]) - (m4x4f1[1u][3u] * m4x4f1[2u][2u]))) + "
"(m4x4f1[0u][2u] * ((m4x4f1[1u][1u] * m4x4f1[2u][3u]) - (m4x4f1[1u][3u] * "
"m4x4f1[2u][1u])))) - (m4x4f1[0u][3u] * ((m4x4f1[1u][1u] * m4x4f1[2u][2u]) - "
"(m4x4f1[1u][2u] * m4x4f1[2u][1u]))))), vec4<f32>((((-(m4x4f1[1u][0u]) * ((m4x4f1[2u][2u] "
"* m4x4f1[3u][3u]) - (m4x4f1[2u][3u] * m4x4f1[3u][2u]))) + (m4x4f1[1u][2u] * "
"((m4x4f1[2u][0u] * m4x4f1[3u][3u]) - (m4x4f1[2u][3u] * m4x4f1[3u][0u])))) - "
"(m4x4f1[1u][3u] * ((m4x4f1[2u][0u] * m4x4f1[3u][2u]) - (m4x4f1[2u][2u] * "
"m4x4f1[3u][0u])))), (((m4x4f1[0u][0u] * ((m4x4f1[2u][2u] * m4x4f1[3u][3u]) - "
"(m4x4f1[2u][3u] * m4x4f1[3u][2u]))) - (m4x4f1[0u][2u] * ((m4x4f1[2u][0u] * "
"m4x4f1[3u][3u]) - (m4x4f1[2u][3u] * m4x4f1[3u][0u])))) + (m4x4f1[0u][3u] * "
"((m4x4f1[2u][0u] * m4x4f1[3u][2u]) - (m4x4f1[2u][2u] * m4x4f1[3u][0u])))), "
"(((-(m4x4f1[0u][0u]) * ((m4x4f1[1u][2u] * m4x4f1[3u][3u]) - (m4x4f1[1u][3u] * "
"m4x4f1[3u][2u]))) + (m4x4f1[0u][2u] * ((m4x4f1[1u][0u] * m4x4f1[3u][3u]) - "
"(m4x4f1[1u][3u] * m4x4f1[3u][0u])))) - (m4x4f1[0u][3u] * ((m4x4f1[1u][0u] * "
"m4x4f1[3u][2u]) - (m4x4f1[1u][2u] * m4x4f1[3u][0u])))), (((m4x4f1[0u][0u] * "
"((m4x4f1[1u][2u] * m4x4f1[2u][3u]) - (m4x4f1[1u][3u] * m4x4f1[2u][2u]))) - "
"(m4x4f1[0u][2u] * ((m4x4f1[1u][0u] * m4x4f1[2u][3u]) - (m4x4f1[1u][3u] * "
"m4x4f1[2u][0u])))) + (m4x4f1[0u][3u] * ((m4x4f1[1u][0u] * m4x4f1[2u][2u]) - "
"(m4x4f1[1u][2u] * m4x4f1[2u][0u]))))), vec4<f32>((((m4x4f1[1u][0u] * ((m4x4f1[2u][1u] * "
"m4x4f1[3u][3u]) - (m4x4f1[2u][3u] * m4x4f1[3u][1u]))) - (m4x4f1[1u][1u] * "
"((m4x4f1[2u][0u] * m4x4f1[3u][3u]) - (m4x4f1[2u][3u] * m4x4f1[3u][0u])))) + "
"(m4x4f1[1u][3u] * ((m4x4f1[2u][0u] * m4x4f1[3u][1u]) - (m4x4f1[2u][1u] * "
"m4x4f1[3u][0u])))), (((-(m4x4f1[0u][0u]) * ((m4x4f1[2u][1u] * m4x4f1[3u][3u]) - "
"(m4x4f1[2u][3u] * m4x4f1[3u][1u]))) + (m4x4f1[0u][1u] * ((m4x4f1[2u][0u] * "
"m4x4f1[3u][3u]) - (m4x4f1[2u][3u] * m4x4f1[3u][0u])))) - (m4x4f1[0u][3u] * "
"((m4x4f1[2u][0u] * m4x4f1[3u][1u]) - (m4x4f1[2u][1u] * m4x4f1[3u][0u])))), "
"(((m4x4f1[0u][0u] * ((m4x4f1[1u][1u] * m4x4f1[3u][3u]) - (m4x4f1[1u][3u] * "
"m4x4f1[3u][1u]))) - (m4x4f1[0u][1u] * ((m4x4f1[1u][0u] * m4x4f1[3u][3u]) - "
"(m4x4f1[1u][3u] * m4x4f1[3u][0u])))) + (m4x4f1[0u][3u] * ((m4x4f1[1u][0u] * "
"m4x4f1[3u][1u]) - (m4x4f1[1u][1u] * m4x4f1[3u][0u])))), (((-(m4x4f1[0u][0u]) * "
"((m4x4f1[1u][1u] * m4x4f1[2u][3u]) - (m4x4f1[1u][3u] * m4x4f1[2u][1u]))) + "
"(m4x4f1[0u][1u] * ((m4x4f1[1u][0u] * m4x4f1[2u][3u]) - (m4x4f1[1u][3u] * "
"m4x4f1[2u][0u])))) - (m4x4f1[0u][3u] * ((m4x4f1[1u][0u] * m4x4f1[2u][1u]) - "
"(m4x4f1[1u][1u] * m4x4f1[2u][0u]))))), vec4<f32>((((-(m4x4f1[1u][0u]) * ((m4x4f1[2u][1u] "
"* m4x4f1[3u][2u]) - (m4x4f1[2u][2u] * m4x4f1[3u][1u]))) + (m4x4f1[1u][1u] * "
"((m4x4f1[2u][0u] * m4x4f1[3u][2u]) - (m4x4f1[2u][2u] * m4x4f1[3u][0u])))) - "
"(m4x4f1[1u][2u] * ((m4x4f1[2u][0u] * m4x4f1[3u][1u]) - (m4x4f1[2u][1u] * "
"m4x4f1[3u][0u])))), (((m4x4f1[0u][0u] * ((m4x4f1[2u][1u] * m4x4f1[3u][2u]) - "
"(m4x4f1[2u][2u] * m4x4f1[3u][1u]))) - (m4x4f1[0u][1u] * ((m4x4f1[2u][0u] * "
"m4x4f1[3u][2u]) - (m4x4f1[2u][2u] * m4x4f1[3u][0u])))) + (m4x4f1[0u][2u] * "
"((m4x4f1[2u][0u] * m4x4f1[3u][1u]) - (m4x4f1[2u][1u] * m4x4f1[3u][0u])))), "
"(((-(m4x4f1[0u][0u]) * ((m4x4f1[1u][1u] * m4x4f1[3u][2u]) - (m4x4f1[1u][2u] * "
"m4x4f1[3u][1u]))) + (m4x4f1[0u][1u] * ((m4x4f1[1u][0u] * m4x4f1[3u][2u]) - "
"(m4x4f1[1u][2u] * m4x4f1[3u][0u])))) - (m4x4f1[0u][2u] * ((m4x4f1[1u][0u] * "
"m4x4f1[3u][1u]) - (m4x4f1[1u][1u] * m4x4f1[3u][0u])))), (((m4x4f1[0u][0u] * "
"((m4x4f1[1u][1u] * m4x4f1[2u][2u]) - (m4x4f1[1u][2u] * m4x4f1[2u][1u]))) - "
"(m4x4f1[0u][1u] * ((m4x4f1[1u][0u] * m4x4f1[2u][2u]) - (m4x4f1[1u][2u] * "
"m4x4f1[2u][0u])))) + (m4x4f1[0u][2u] * ((m4x4f1[1u][0u] * m4x4f1[2u][1u]) - "
"(m4x4f1[1u][1u] * m4x4f1[2u][0u])))))));";
EXPECT_THAT(body, HasSubstr(expected)) << body;
}
TEST_F(SpvParserTest, GlslStd450_MatrixInverse_MultipleInScope) {
const auto assembly = Preamble() + R"(
%1 = OpExtInst %mat2v2float %glsl MatrixInverse %m2x2f1
%2 = OpExtInst %mat2v2float %glsl MatrixInverse %m2x2f1
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);
std::string expected =
"let s = (1.0f / determinant(m2x2f1));\n"
"let x_1 : mat2x2<f32> = mat2x2<f32>(vec2<f32>((s * m2x2f1[1u][1u]), (-(s) * "
"m2x2f1[0u][1u])), vec2<f32>((-(s) * m2x2f1[1u][0u]), (s * m2x2f1[0u][0u])));\n"
"let s_1 = (1.0f / determinant(m2x2f1));\n"
"let x_2 : mat2x2<f32> = mat2x2<f32>(vec2<f32>((s_1 * m2x2f1[1u][1u]), (-(s_1) * "
"m2x2f1[0u][1u])), vec2<f32>((-(s_1) * m2x2f1[1u][0u]), (s_1 * m2x2f1[0u][0u])));";
EXPECT_THAT(body, HasSubstr(expected)) << body;
}
} // namespace } // namespace
} // namespace tint::reader::spirv } // namespace tint::reader::spirv

View File

@ -0,0 +1,49 @@
; SPIR-V
; Version: 1.0
; Generator: Khronos Glslang Reference Front End; 10
; Bound: 28
; Schema: 0
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main"
OpExecutionMode %main OriginUpperLeft
OpSource GLSL 460
OpName %main "main"
OpName %m2i "m2i"
OpName %m2 "m2"
OpName %m3i "m3i"
OpName %m3 "m3"
OpName %m4i "m4i"
OpName %m4 "m4"
%void = OpTypeVoid
%3 = OpTypeFunction %void
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%mat2v2float = OpTypeMatrix %v2float 2
%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float
%v3float = OpTypeVector %float 3
%mat3v3float = OpTypeMatrix %v3float 3
%_ptr_Function_mat3v3float = OpTypePointer Function %mat3v3float
%v4float = OpTypeVector %float 4
%mat4v4float = OpTypeMatrix %v4float 4
%_ptr_Function_mat4v4float = OpTypePointer Function %mat4v4float
%main = OpFunction %void None %3
%5 = OpLabel
%m2i = OpVariable %_ptr_Function_mat2v2float Function
%m2 = OpVariable %_ptr_Function_mat2v2float Function
%m3i = OpVariable %_ptr_Function_mat3v3float Function
%m3 = OpVariable %_ptr_Function_mat3v3float Function
%m4i = OpVariable %_ptr_Function_mat4v4float Function
%m4 = OpVariable %_ptr_Function_mat4v4float Function
%12 = OpLoad %mat2v2float %m2
%13 = OpExtInst %mat2v2float %1 MatrixInverse %12
OpStore %m2i %13
%19 = OpLoad %mat3v3float %m3
%20 = OpExtInst %mat3v3float %1 MatrixInverse %19
OpStore %m3i %20
%26 = OpLoad %mat4v4float %m4
%27 = OpExtInst %mat4v4float %1 MatrixInverse %26
OpStore %m4i %27
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,23 @@
void main_1() {
float2x2 m2i = float2x2(0.0f, 0.0f, 0.0f, 0.0f);
float2x2 m2 = float2x2(0.0f, 0.0f, 0.0f, 0.0f);
float3x3 m3i = float3x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
float3x3 m3 = float3x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
float4x4 m4i = float4x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
float4x4 m4 = float4x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
const float2x2 x_12 = m2;
const float s = (1.0f / determinant(x_12));
m2i = float2x2(float2((s * x_12[1u][1u]), (-(s) * x_12[0u][1u])), float2((-(s) * x_12[1u][0u]), (s * x_12[0u][0u])));
const float3x3 x_19 = m3;
const float s_1 = (1.0f / determinant(x_19));
m3i = (s_1 * float3x3(float3(((x_19[1u][1u] * x_19[2u][2u]) - (x_19[1u][2u] * x_19[2u][1u])), ((x_19[0u][2u] * x_19[2u][1u]) - (x_19[0u][1u] * x_19[2u][2u])), ((x_19[0u][1u] * x_19[1u][2u]) - (x_19[0u][2u] * x_19[1u][1u]))), float3(((x_19[1u][2u] * x_19[2u][0u]) - (x_19[1u][0u] * x_19[2u][2u])), ((x_19[0u][0u] * x_19[2u][2u]) - (x_19[0u][2u] * x_19[2u][0u])), ((x_19[0u][2u] * x_19[1u][0u]) - (x_19[0u][0u] * x_19[1u][2u]))), float3(((x_19[1u][0u] * x_19[2u][1u]) - (x_19[1u][1u] * x_19[2u][0u])), ((x_19[0u][1u] * x_19[2u][0u]) - (x_19[0u][0u] * x_19[2u][1u])), ((x_19[0u][0u] * x_19[1u][1u]) - (x_19[0u][1u] * x_19[1u][0u])))));
const float4x4 x_26 = m4;
const float s_2 = (1.0f / determinant(x_26));
m4i = (s_2 * float4x4(float4((((x_26[1u][1u] * ((x_26[2u][2u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][2u]))) - (x_26[1u][2u] * ((x_26[2u][1u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][1u])))) + (x_26[1u][3u] * ((x_26[2u][1u] * x_26[3u][2u]) - (x_26[2u][2u] * x_26[3u][1u])))), (((-(x_26[0u][1u]) * ((x_26[2u][2u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][2u]))) + (x_26[0u][2u] * ((x_26[2u][1u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][1u])))) - (x_26[0u][3u] * ((x_26[2u][1u] * x_26[3u][2u]) - (x_26[2u][2u] * x_26[3u][1u])))), (((x_26[0u][1u] * ((x_26[1u][2u] * x_26[3u][3u]) - (x_26[1u][3u] * x_26[3u][2u]))) - (x_26[0u][2u] * ((x_26[1u][1u] * x_26[3u][3u]) - (x_26[1u][3u] * x_26[3u][1u])))) + (x_26[0u][3u] * ((x_26[1u][1u] * x_26[3u][2u]) - (x_26[1u][2u] * x_26[3u][1u])))), (((-(x_26[0u][1u]) * ((x_26[1u][2u] * x_26[2u][3u]) - (x_26[1u][3u] * x_26[2u][2u]))) + (x_26[0u][2u] * ((x_26[1u][1u] * x_26[2u][3u]) - (x_26[1u][3u] * x_26[2u][1u])))) - (x_26[0u][3u] * ((x_26[1u][1u] * x_26[2u][2u]) - (x_26[1u][2u] * x_26[2u][1u]))))), float4((((-(x_26[1u][0u]) * ((x_26[2u][2u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][2u]))) + (x_26[1u][2u] * ((x_26[2u][0u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][0u])))) - (x_26[1u][3u] * ((x_26[2u][0u] * x_26[3u][2u]) - (x_26[2u][2u] * x_26[3u][0u])))), (((x_26[0u][0u] * ((x_26[2u][2u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][2u]))) - (x_26[0u][2u] * ((x_26[2u][0u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][0u])))) + (x_26[0u][3u] * ((x_26[2u][0u] * x_26[3u][2u]) - (x_26[2u][2u] * x_26[3u][0u])))), (((-(x_26[0u][0u]) * ((x_26[1u][2u] * x_26[3u][3u]) - (x_26[1u][3u] * x_26[3u][2u]))) + (x_26[0u][2u] * ((x_26[1u][0u] * x_26[3u][3u]) - (x_26[1u][3u] * x_26[3u][0u])))) - (x_26[0u][3u] * ((x_26[1u][0u] * x_26[3u][2u]) - (x_26[1u][2u] * x_26[3u][0u])))), (((x_26[0u][0u] * ((x_26[1u][2u] * x_26[2u][3u]) - (x_26[1u][3u] * x_26[2u][2u]))) - (x_26[0u][2u] * ((x_26[1u][0u] * x_26[2u][3u]) - (x_26[1u][3u] * x_26[2u][0u])))) + (x_26[0u][3u] * ((x_26[1u][0u] * x_26[2u][2u]) - (x_26[1u][2u] * x_26[2u][0u]))))), float4((((x_26[1u][0u] * ((x_26[2u][1u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][1u]))) - (x_26[1u][1u] * ((x_26[2u][0u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][0u])))) + (x_26[1u][3u] * ((x_26[2u][0u] * x_26[3u][1u]) - (x_26[2u][1u] * x_26[3u][0u])))), (((-(x_26[0u][0u]) * ((x_26[2u][1u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][1u]))) + (x_26[0u][1u] * ((x_26[2u][0u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][0u])))) - (x_26[0u][3u] * ((x_26[2u][0u] * x_26[3u][1u]) - (x_26[2u][1u] * x_26[3u][0u])))), (((x_26[0u][0u] * ((x_26[1u][1u] * x_26[3u][3u]) - (x_26[1u][3u] * x_26[3u][1u]))) - (x_26[0u][1u] * ((x_26[1u][0u] * x_26[3u][3u]) - (x_26[1u][3u] * x_26[3u][0u])))) + (x_26[0u][3u] * ((x_26[1u][0u] * x_26[3u][1u]) - (x_26[1u][1u] * x_26[3u][0u])))), (((-(x_26[0u][0u]) * ((x_26[1u][1u] * x_26[2u][3u]) - (x_26[1u][3u] * x_26[2u][1u]))) + (x_26[0u][1u] * ((x_26[1u][0u] * x_26[2u][3u]) - (x_26[1u][3u] * x_26[2u][0u])))) - (x_26[0u][3u] * ((x_26[1u][0u] * x_26[2u][1u]) - (x_26[1u][1u] * x_26[2u][0u]))))), float4((((-(x_26[1u][0u]) * ((x_26[2u][1u] * x_26[3u][2u]) - (x_26[2u][2u] * x_26[3u][1u]))) + (x_26[1u][1u] * ((x_26[2u][0u] * x_26[3u][2u]) - (x_26[2u][2u] * x_26[3u][0u])))) - (x_26[1u][2u] * ((x_26[2u][0u] * x_26[3u][1u]) - (x_26[2u][1u] * x_26[3u][0u])))), (((x_26[0u][0u] * ((x_26[2u][1u] * x_26[3u][2u]) - (x_26[2u][2u] * x_26[3u][1u]))) - (x_26[0u][1u] * ((x_26[2u][0u] * x_26[3u][2u]) - (x_26[2u][2u] * x_26[3u][0u])))) + (x_26[0u][2u] * ((x_26[2u][0u] * x_26[3u][1u]) - (x_26[2u][1u] * x_26[3u][0u])))), (((-(x_26[0u][0u]) * ((x_26[1u][1u] * x_26[3u][2u]) - (x_26[1u][2u] * x_26[3u][1u]))) + (x_26[0u][1u] * ((x_26[1u][0u] * x_26[3u][2u]) - (x_26[1u][2u] * x_26[3u][0u])))) - (x_26[0u][2u] * ((x_26[1u][0u] * x_26[3u][1u]) - (x_26[1u][1u] * x_26[3u][0u])))), (((x_26[0u][0u] * ((x_26[1u][1u] * x_26[2u][2u]) - (x_26[1u][2u] * x_26[2u][1u]))) - (x_26[0u][1u] * ((x_26[1u][0u] * x_26[2u][2u]) - (x_26[1u][2u] * x_26[2u][0u])))) + (x_26[0u][2u] * ((x_26[1u][0u] * x_26[2u][1u]) - (x_26[1u][1u] * x_26[2u][0u])))))));
return;
}
void main() {
main_1();
return;
}

View File

@ -0,0 +1,23 @@
void main_1() {
float2x2 m2i = float2x2(0.0f, 0.0f, 0.0f, 0.0f);
float2x2 m2 = float2x2(0.0f, 0.0f, 0.0f, 0.0f);
float3x3 m3i = float3x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
float3x3 m3 = float3x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
float4x4 m4i = float4x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
float4x4 m4 = float4x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
const float2x2 x_12 = m2;
const float s = (1.0f / determinant(x_12));
m2i = float2x2(float2((s * x_12[1u][1u]), (-(s) * x_12[0u][1u])), float2((-(s) * x_12[1u][0u]), (s * x_12[0u][0u])));
const float3x3 x_19 = m3;
const float s_1 = (1.0f / determinant(x_19));
m3i = (s_1 * float3x3(float3(((x_19[1u][1u] * x_19[2u][2u]) - (x_19[1u][2u] * x_19[2u][1u])), ((x_19[0u][2u] * x_19[2u][1u]) - (x_19[0u][1u] * x_19[2u][2u])), ((x_19[0u][1u] * x_19[1u][2u]) - (x_19[0u][2u] * x_19[1u][1u]))), float3(((x_19[1u][2u] * x_19[2u][0u]) - (x_19[1u][0u] * x_19[2u][2u])), ((x_19[0u][0u] * x_19[2u][2u]) - (x_19[0u][2u] * x_19[2u][0u])), ((x_19[0u][2u] * x_19[1u][0u]) - (x_19[0u][0u] * x_19[1u][2u]))), float3(((x_19[1u][0u] * x_19[2u][1u]) - (x_19[1u][1u] * x_19[2u][0u])), ((x_19[0u][1u] * x_19[2u][0u]) - (x_19[0u][0u] * x_19[2u][1u])), ((x_19[0u][0u] * x_19[1u][1u]) - (x_19[0u][1u] * x_19[1u][0u])))));
const float4x4 x_26 = m4;
const float s_2 = (1.0f / determinant(x_26));
m4i = (s_2 * float4x4(float4((((x_26[1u][1u] * ((x_26[2u][2u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][2u]))) - (x_26[1u][2u] * ((x_26[2u][1u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][1u])))) + (x_26[1u][3u] * ((x_26[2u][1u] * x_26[3u][2u]) - (x_26[2u][2u] * x_26[3u][1u])))), (((-(x_26[0u][1u]) * ((x_26[2u][2u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][2u]))) + (x_26[0u][2u] * ((x_26[2u][1u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][1u])))) - (x_26[0u][3u] * ((x_26[2u][1u] * x_26[3u][2u]) - (x_26[2u][2u] * x_26[3u][1u])))), (((x_26[0u][1u] * ((x_26[1u][2u] * x_26[3u][3u]) - (x_26[1u][3u] * x_26[3u][2u]))) - (x_26[0u][2u] * ((x_26[1u][1u] * x_26[3u][3u]) - (x_26[1u][3u] * x_26[3u][1u])))) + (x_26[0u][3u] * ((x_26[1u][1u] * x_26[3u][2u]) - (x_26[1u][2u] * x_26[3u][1u])))), (((-(x_26[0u][1u]) * ((x_26[1u][2u] * x_26[2u][3u]) - (x_26[1u][3u] * x_26[2u][2u]))) + (x_26[0u][2u] * ((x_26[1u][1u] * x_26[2u][3u]) - (x_26[1u][3u] * x_26[2u][1u])))) - (x_26[0u][3u] * ((x_26[1u][1u] * x_26[2u][2u]) - (x_26[1u][2u] * x_26[2u][1u]))))), float4((((-(x_26[1u][0u]) * ((x_26[2u][2u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][2u]))) + (x_26[1u][2u] * ((x_26[2u][0u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][0u])))) - (x_26[1u][3u] * ((x_26[2u][0u] * x_26[3u][2u]) - (x_26[2u][2u] * x_26[3u][0u])))), (((x_26[0u][0u] * ((x_26[2u][2u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][2u]))) - (x_26[0u][2u] * ((x_26[2u][0u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][0u])))) + (x_26[0u][3u] * ((x_26[2u][0u] * x_26[3u][2u]) - (x_26[2u][2u] * x_26[3u][0u])))), (((-(x_26[0u][0u]) * ((x_26[1u][2u] * x_26[3u][3u]) - (x_26[1u][3u] * x_26[3u][2u]))) + (x_26[0u][2u] * ((x_26[1u][0u] * x_26[3u][3u]) - (x_26[1u][3u] * x_26[3u][0u])))) - (x_26[0u][3u] * ((x_26[1u][0u] * x_26[3u][2u]) - (x_26[1u][2u] * x_26[3u][0u])))), (((x_26[0u][0u] * ((x_26[1u][2u] * x_26[2u][3u]) - (x_26[1u][3u] * x_26[2u][2u]))) - (x_26[0u][2u] * ((x_26[1u][0u] * x_26[2u][3u]) - (x_26[1u][3u] * x_26[2u][0u])))) + (x_26[0u][3u] * ((x_26[1u][0u] * x_26[2u][2u]) - (x_26[1u][2u] * x_26[2u][0u]))))), float4((((x_26[1u][0u] * ((x_26[2u][1u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][1u]))) - (x_26[1u][1u] * ((x_26[2u][0u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][0u])))) + (x_26[1u][3u] * ((x_26[2u][0u] * x_26[3u][1u]) - (x_26[2u][1u] * x_26[3u][0u])))), (((-(x_26[0u][0u]) * ((x_26[2u][1u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][1u]))) + (x_26[0u][1u] * ((x_26[2u][0u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][0u])))) - (x_26[0u][3u] * ((x_26[2u][0u] * x_26[3u][1u]) - (x_26[2u][1u] * x_26[3u][0u])))), (((x_26[0u][0u] * ((x_26[1u][1u] * x_26[3u][3u]) - (x_26[1u][3u] * x_26[3u][1u]))) - (x_26[0u][1u] * ((x_26[1u][0u] * x_26[3u][3u]) - (x_26[1u][3u] * x_26[3u][0u])))) + (x_26[0u][3u] * ((x_26[1u][0u] * x_26[3u][1u]) - (x_26[1u][1u] * x_26[3u][0u])))), (((-(x_26[0u][0u]) * ((x_26[1u][1u] * x_26[2u][3u]) - (x_26[1u][3u] * x_26[2u][1u]))) + (x_26[0u][1u] * ((x_26[1u][0u] * x_26[2u][3u]) - (x_26[1u][3u] * x_26[2u][0u])))) - (x_26[0u][3u] * ((x_26[1u][0u] * x_26[2u][1u]) - (x_26[1u][1u] * x_26[2u][0u]))))), float4((((-(x_26[1u][0u]) * ((x_26[2u][1u] * x_26[3u][2u]) - (x_26[2u][2u] * x_26[3u][1u]))) + (x_26[1u][1u] * ((x_26[2u][0u] * x_26[3u][2u]) - (x_26[2u][2u] * x_26[3u][0u])))) - (x_26[1u][2u] * ((x_26[2u][0u] * x_26[3u][1u]) - (x_26[2u][1u] * x_26[3u][0u])))), (((x_26[0u][0u] * ((x_26[2u][1u] * x_26[3u][2u]) - (x_26[2u][2u] * x_26[3u][1u]))) - (x_26[0u][1u] * ((x_26[2u][0u] * x_26[3u][2u]) - (x_26[2u][2u] * x_26[3u][0u])))) + (x_26[0u][2u] * ((x_26[2u][0u] * x_26[3u][1u]) - (x_26[2u][1u] * x_26[3u][0u])))), (((-(x_26[0u][0u]) * ((x_26[1u][1u] * x_26[3u][2u]) - (x_26[1u][2u] * x_26[3u][1u]))) + (x_26[0u][1u] * ((x_26[1u][0u] * x_26[3u][2u]) - (x_26[1u][2u] * x_26[3u][0u])))) - (x_26[0u][2u] * ((x_26[1u][0u] * x_26[3u][1u]) - (x_26[1u][1u] * x_26[3u][0u])))), (((x_26[0u][0u] * ((x_26[1u][1u] * x_26[2u][2u]) - (x_26[1u][2u] * x_26[2u][1u]))) - (x_26[0u][1u] * ((x_26[1u][0u] * x_26[2u][2u]) - (x_26[1u][2u] * x_26[2u][0u])))) + (x_26[0u][2u] * ((x_26[1u][0u] * x_26[2u][1u]) - (x_26[1u][1u] * x_26[2u][0u])))))));
return;
}
void main() {
main_1();
return;
}

View File

@ -0,0 +1,30 @@
#version 310 es
precision mediump float;
void main_1() {
mat2 m2i = mat2(0.0f, 0.0f, 0.0f, 0.0f);
mat2 m2 = mat2(0.0f, 0.0f, 0.0f, 0.0f);
mat3 m3i = mat3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
mat3 m3 = mat3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
mat4 m4i = mat4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
mat4 m4 = mat4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
mat2 x_12 = m2;
float s = (1.0f / determinant(x_12));
m2i = mat2(vec2((s * x_12[1u][1u]), (-(s) * x_12[0u][1u])), vec2((-(s) * x_12[1u][0u]), (s * x_12[0u][0u])));
mat3 x_19 = m3;
float s_1 = (1.0f / determinant(x_19));
m3i = (s_1 * mat3(vec3(((x_19[1u][1u] * x_19[2u][2u]) - (x_19[1u][2u] * x_19[2u][1u])), ((x_19[0u][2u] * x_19[2u][1u]) - (x_19[0u][1u] * x_19[2u][2u])), ((x_19[0u][1u] * x_19[1u][2u]) - (x_19[0u][2u] * x_19[1u][1u]))), vec3(((x_19[1u][2u] * x_19[2u][0u]) - (x_19[1u][0u] * x_19[2u][2u])), ((x_19[0u][0u] * x_19[2u][2u]) - (x_19[0u][2u] * x_19[2u][0u])), ((x_19[0u][2u] * x_19[1u][0u]) - (x_19[0u][0u] * x_19[1u][2u]))), vec3(((x_19[1u][0u] * x_19[2u][1u]) - (x_19[1u][1u] * x_19[2u][0u])), ((x_19[0u][1u] * x_19[2u][0u]) - (x_19[0u][0u] * x_19[2u][1u])), ((x_19[0u][0u] * x_19[1u][1u]) - (x_19[0u][1u] * x_19[1u][0u])))));
mat4 x_26 = m4;
float s_2 = (1.0f / determinant(x_26));
m4i = (s_2 * mat4(vec4((((x_26[1u][1u] * ((x_26[2u][2u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][2u]))) - (x_26[1u][2u] * ((x_26[2u][1u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][1u])))) + (x_26[1u][3u] * ((x_26[2u][1u] * x_26[3u][2u]) - (x_26[2u][2u] * x_26[3u][1u])))), (((-(x_26[0u][1u]) * ((x_26[2u][2u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][2u]))) + (x_26[0u][2u] * ((x_26[2u][1u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][1u])))) - (x_26[0u][3u] * ((x_26[2u][1u] * x_26[3u][2u]) - (x_26[2u][2u] * x_26[3u][1u])))), (((x_26[0u][1u] * ((x_26[1u][2u] * x_26[3u][3u]) - (x_26[1u][3u] * x_26[3u][2u]))) - (x_26[0u][2u] * ((x_26[1u][1u] * x_26[3u][3u]) - (x_26[1u][3u] * x_26[3u][1u])))) + (x_26[0u][3u] * ((x_26[1u][1u] * x_26[3u][2u]) - (x_26[1u][2u] * x_26[3u][1u])))), (((-(x_26[0u][1u]) * ((x_26[1u][2u] * x_26[2u][3u]) - (x_26[1u][3u] * x_26[2u][2u]))) + (x_26[0u][2u] * ((x_26[1u][1u] * x_26[2u][3u]) - (x_26[1u][3u] * x_26[2u][1u])))) - (x_26[0u][3u] * ((x_26[1u][1u] * x_26[2u][2u]) - (x_26[1u][2u] * x_26[2u][1u]))))), vec4((((-(x_26[1u][0u]) * ((x_26[2u][2u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][2u]))) + (x_26[1u][2u] * ((x_26[2u][0u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][0u])))) - (x_26[1u][3u] * ((x_26[2u][0u] * x_26[3u][2u]) - (x_26[2u][2u] * x_26[3u][0u])))), (((x_26[0u][0u] * ((x_26[2u][2u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][2u]))) - (x_26[0u][2u] * ((x_26[2u][0u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][0u])))) + (x_26[0u][3u] * ((x_26[2u][0u] * x_26[3u][2u]) - (x_26[2u][2u] * x_26[3u][0u])))), (((-(x_26[0u][0u]) * ((x_26[1u][2u] * x_26[3u][3u]) - (x_26[1u][3u] * x_26[3u][2u]))) + (x_26[0u][2u] * ((x_26[1u][0u] * x_26[3u][3u]) - (x_26[1u][3u] * x_26[3u][0u])))) - (x_26[0u][3u] * ((x_26[1u][0u] * x_26[3u][2u]) - (x_26[1u][2u] * x_26[3u][0u])))), (((x_26[0u][0u] * ((x_26[1u][2u] * x_26[2u][3u]) - (x_26[1u][3u] * x_26[2u][2u]))) - (x_26[0u][2u] * ((x_26[1u][0u] * x_26[2u][3u]) - (x_26[1u][3u] * x_26[2u][0u])))) + (x_26[0u][3u] * ((x_26[1u][0u] * x_26[2u][2u]) - (x_26[1u][2u] * x_26[2u][0u]))))), vec4((((x_26[1u][0u] * ((x_26[2u][1u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][1u]))) - (x_26[1u][1u] * ((x_26[2u][0u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][0u])))) + (x_26[1u][3u] * ((x_26[2u][0u] * x_26[3u][1u]) - (x_26[2u][1u] * x_26[3u][0u])))), (((-(x_26[0u][0u]) * ((x_26[2u][1u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][1u]))) + (x_26[0u][1u] * ((x_26[2u][0u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][0u])))) - (x_26[0u][3u] * ((x_26[2u][0u] * x_26[3u][1u]) - (x_26[2u][1u] * x_26[3u][0u])))), (((x_26[0u][0u] * ((x_26[1u][1u] * x_26[3u][3u]) - (x_26[1u][3u] * x_26[3u][1u]))) - (x_26[0u][1u] * ((x_26[1u][0u] * x_26[3u][3u]) - (x_26[1u][3u] * x_26[3u][0u])))) + (x_26[0u][3u] * ((x_26[1u][0u] * x_26[3u][1u]) - (x_26[1u][1u] * x_26[3u][0u])))), (((-(x_26[0u][0u]) * ((x_26[1u][1u] * x_26[2u][3u]) - (x_26[1u][3u] * x_26[2u][1u]))) + (x_26[0u][1u] * ((x_26[1u][0u] * x_26[2u][3u]) - (x_26[1u][3u] * x_26[2u][0u])))) - (x_26[0u][3u] * ((x_26[1u][0u] * x_26[2u][1u]) - (x_26[1u][1u] * x_26[2u][0u]))))), vec4((((-(x_26[1u][0u]) * ((x_26[2u][1u] * x_26[3u][2u]) - (x_26[2u][2u] * x_26[3u][1u]))) + (x_26[1u][1u] * ((x_26[2u][0u] * x_26[3u][2u]) - (x_26[2u][2u] * x_26[3u][0u])))) - (x_26[1u][2u] * ((x_26[2u][0u] * x_26[3u][1u]) - (x_26[2u][1u] * x_26[3u][0u])))), (((x_26[0u][0u] * ((x_26[2u][1u] * x_26[3u][2u]) - (x_26[2u][2u] * x_26[3u][1u]))) - (x_26[0u][1u] * ((x_26[2u][0u] * x_26[3u][2u]) - (x_26[2u][2u] * x_26[3u][0u])))) + (x_26[0u][2u] * ((x_26[2u][0u] * x_26[3u][1u]) - (x_26[2u][1u] * x_26[3u][0u])))), (((-(x_26[0u][0u]) * ((x_26[1u][1u] * x_26[3u][2u]) - (x_26[1u][2u] * x_26[3u][1u]))) + (x_26[0u][1u] * ((x_26[1u][0u] * x_26[3u][2u]) - (x_26[1u][2u] * x_26[3u][0u])))) - (x_26[0u][2u] * ((x_26[1u][0u] * x_26[3u][1u]) - (x_26[1u][1u] * x_26[3u][0u])))), (((x_26[0u][0u] * ((x_26[1u][1u] * x_26[2u][2u]) - (x_26[1u][2u] * x_26[2u][1u]))) - (x_26[0u][1u] * ((x_26[1u][0u] * x_26[2u][2u]) - (x_26[1u][2u] * x_26[2u][0u])))) + (x_26[0u][2u] * ((x_26[1u][0u] * x_26[2u][1u]) - (x_26[1u][1u] * x_26[2u][0u])))))));
return;
}
void tint_symbol() {
main_1();
}
void main() {
tint_symbol();
return;
}

View File

@ -0,0 +1,27 @@
#include <metal_stdlib>
using namespace metal;
void main_1() {
float2x2 m2i = float2x2(0.0f);
float2x2 m2 = float2x2(0.0f);
float3x3 m3i = float3x3(0.0f);
float3x3 m3 = float3x3(0.0f);
float4x4 m4i = float4x4(0.0f);
float4x4 m4 = float4x4(0.0f);
float2x2 const x_12 = m2;
float const s = (1.0f / determinant(x_12));
m2i = float2x2(float2((s * x_12[1u][1u]), (-(s) * x_12[0u][1u])), float2((-(s) * x_12[1u][0u]), (s * x_12[0u][0u])));
float3x3 const x_19 = m3;
float const s_1 = (1.0f / determinant(x_19));
m3i = (s_1 * float3x3(float3(((x_19[1u][1u] * x_19[2u][2u]) - (x_19[1u][2u] * x_19[2u][1u])), ((x_19[0u][2u] * x_19[2u][1u]) - (x_19[0u][1u] * x_19[2u][2u])), ((x_19[0u][1u] * x_19[1u][2u]) - (x_19[0u][2u] * x_19[1u][1u]))), float3(((x_19[1u][2u] * x_19[2u][0u]) - (x_19[1u][0u] * x_19[2u][2u])), ((x_19[0u][0u] * x_19[2u][2u]) - (x_19[0u][2u] * x_19[2u][0u])), ((x_19[0u][2u] * x_19[1u][0u]) - (x_19[0u][0u] * x_19[1u][2u]))), float3(((x_19[1u][0u] * x_19[2u][1u]) - (x_19[1u][1u] * x_19[2u][0u])), ((x_19[0u][1u] * x_19[2u][0u]) - (x_19[0u][0u] * x_19[2u][1u])), ((x_19[0u][0u] * x_19[1u][1u]) - (x_19[0u][1u] * x_19[1u][0u])))));
float4x4 const x_26 = m4;
float const s_2 = (1.0f / determinant(x_26));
m4i = (s_2 * float4x4(float4((((x_26[1u][1u] * ((x_26[2u][2u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][2u]))) - (x_26[1u][2u] * ((x_26[2u][1u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][1u])))) + (x_26[1u][3u] * ((x_26[2u][1u] * x_26[3u][2u]) - (x_26[2u][2u] * x_26[3u][1u])))), (((-(x_26[0u][1u]) * ((x_26[2u][2u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][2u]))) + (x_26[0u][2u] * ((x_26[2u][1u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][1u])))) - (x_26[0u][3u] * ((x_26[2u][1u] * x_26[3u][2u]) - (x_26[2u][2u] * x_26[3u][1u])))), (((x_26[0u][1u] * ((x_26[1u][2u] * x_26[3u][3u]) - (x_26[1u][3u] * x_26[3u][2u]))) - (x_26[0u][2u] * ((x_26[1u][1u] * x_26[3u][3u]) - (x_26[1u][3u] * x_26[3u][1u])))) + (x_26[0u][3u] * ((x_26[1u][1u] * x_26[3u][2u]) - (x_26[1u][2u] * x_26[3u][1u])))), (((-(x_26[0u][1u]) * ((x_26[1u][2u] * x_26[2u][3u]) - (x_26[1u][3u] * x_26[2u][2u]))) + (x_26[0u][2u] * ((x_26[1u][1u] * x_26[2u][3u]) - (x_26[1u][3u] * x_26[2u][1u])))) - (x_26[0u][3u] * ((x_26[1u][1u] * x_26[2u][2u]) - (x_26[1u][2u] * x_26[2u][1u]))))), float4((((-(x_26[1u][0u]) * ((x_26[2u][2u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][2u]))) + (x_26[1u][2u] * ((x_26[2u][0u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][0u])))) - (x_26[1u][3u] * ((x_26[2u][0u] * x_26[3u][2u]) - (x_26[2u][2u] * x_26[3u][0u])))), (((x_26[0u][0u] * ((x_26[2u][2u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][2u]))) - (x_26[0u][2u] * ((x_26[2u][0u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][0u])))) + (x_26[0u][3u] * ((x_26[2u][0u] * x_26[3u][2u]) - (x_26[2u][2u] * x_26[3u][0u])))), (((-(x_26[0u][0u]) * ((x_26[1u][2u] * x_26[3u][3u]) - (x_26[1u][3u] * x_26[3u][2u]))) + (x_26[0u][2u] * ((x_26[1u][0u] * x_26[3u][3u]) - (x_26[1u][3u] * x_26[3u][0u])))) - (x_26[0u][3u] * ((x_26[1u][0u] * x_26[3u][2u]) - (x_26[1u][2u] * x_26[3u][0u])))), (((x_26[0u][0u] * ((x_26[1u][2u] * x_26[2u][3u]) - (x_26[1u][3u] * x_26[2u][2u]))) - (x_26[0u][2u] * ((x_26[1u][0u] * x_26[2u][3u]) - (x_26[1u][3u] * x_26[2u][0u])))) + (x_26[0u][3u] * ((x_26[1u][0u] * x_26[2u][2u]) - (x_26[1u][2u] * x_26[2u][0u]))))), float4((((x_26[1u][0u] * ((x_26[2u][1u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][1u]))) - (x_26[1u][1u] * ((x_26[2u][0u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][0u])))) + (x_26[1u][3u] * ((x_26[2u][0u] * x_26[3u][1u]) - (x_26[2u][1u] * x_26[3u][0u])))), (((-(x_26[0u][0u]) * ((x_26[2u][1u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][1u]))) + (x_26[0u][1u] * ((x_26[2u][0u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][0u])))) - (x_26[0u][3u] * ((x_26[2u][0u] * x_26[3u][1u]) - (x_26[2u][1u] * x_26[3u][0u])))), (((x_26[0u][0u] * ((x_26[1u][1u] * x_26[3u][3u]) - (x_26[1u][3u] * x_26[3u][1u]))) - (x_26[0u][1u] * ((x_26[1u][0u] * x_26[3u][3u]) - (x_26[1u][3u] * x_26[3u][0u])))) + (x_26[0u][3u] * ((x_26[1u][0u] * x_26[3u][1u]) - (x_26[1u][1u] * x_26[3u][0u])))), (((-(x_26[0u][0u]) * ((x_26[1u][1u] * x_26[2u][3u]) - (x_26[1u][3u] * x_26[2u][1u]))) + (x_26[0u][1u] * ((x_26[1u][0u] * x_26[2u][3u]) - (x_26[1u][3u] * x_26[2u][0u])))) - (x_26[0u][3u] * ((x_26[1u][0u] * x_26[2u][1u]) - (x_26[1u][1u] * x_26[2u][0u]))))), float4((((-(x_26[1u][0u]) * ((x_26[2u][1u] * x_26[3u][2u]) - (x_26[2u][2u] * x_26[3u][1u]))) + (x_26[1u][1u] * ((x_26[2u][0u] * x_26[3u][2u]) - (x_26[2u][2u] * x_26[3u][0u])))) - (x_26[1u][2u] * ((x_26[2u][0u] * x_26[3u][1u]) - (x_26[2u][1u] * x_26[3u][0u])))), (((x_26[0u][0u] * ((x_26[2u][1u] * x_26[3u][2u]) - (x_26[2u][2u] * x_26[3u][1u]))) - (x_26[0u][1u] * ((x_26[2u][0u] * x_26[3u][2u]) - (x_26[2u][2u] * x_26[3u][0u])))) + (x_26[0u][2u] * ((x_26[2u][0u] * x_26[3u][1u]) - (x_26[2u][1u] * x_26[3u][0u])))), (((-(x_26[0u][0u]) * ((x_26[1u][1u] * x_26[3u][2u]) - (x_26[1u][2u] * x_26[3u][1u]))) + (x_26[0u][1u] * ((x_26[1u][0u] * x_26[3u][2u]) - (x_26[1u][2u] * x_26[3u][0u])))) - (x_26[0u][2u] * ((x_26[1u][0u] * x_26[3u][1u]) - (x_26[1u][1u] * x_26[3u][0u])))), (((x_26[0u][0u] * ((x_26[1u][1u] * x_26[2u][2u]) - (x_26[1u][2u] * x_26[2u][1u]))) - (x_26[0u][1u] * ((x_26[1u][0u] * x_26[2u][2u]) - (x_26[1u][2u] * x_26[2u][0u])))) + (x_26[0u][2u] * ((x_26[1u][0u] * x_26[2u][1u]) - (x_26[1u][1u] * x_26[2u][0u])))))));
return;
}
fragment void tint_symbol() {
main_1();
return;
}

View File

@ -0,0 +1,905 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 882
; Schema: 0
OpCapability Shader
%27 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main"
OpExecutionMode %main OriginUpperLeft
OpName %main_1 "main_1"
OpName %m2i "m2i"
OpName %m2 "m2"
OpName %m3i "m3i"
OpName %m3 "m3"
OpName %m4i "m4i"
OpName %m4 "m4"
OpName %main "main"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%mat2v2float = OpTypeMatrix %v2float 2
%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float
%10 = OpConstantNull %mat2v2float
%v3float = OpTypeVector %float 3
%mat3v3float = OpTypeMatrix %v3float 3
%_ptr_Function_mat3v3float = OpTypePointer Function %mat3v3float
%16 = OpConstantNull %mat3v3float
%v4float = OpTypeVector %float 4
%mat4v4float = OpTypeMatrix %v4float 4
%_ptr_Function_mat4v4float = OpTypePointer Function %mat4v4float
%22 = OpConstantNull %mat4v4float
%float_1 = OpConstant %float 1
%uint = OpTypeInt 32 0
%uint_1 = OpConstant %uint 1
%35 = OpConstantNull %uint
%uint_2 = OpConstant %uint 2
%uint_3 = OpConstant %uint 3
%main_1 = OpFunction %void None %1
%4 = OpLabel
%m2i = OpVariable %_ptr_Function_mat2v2float Function %10
%m2 = OpVariable %_ptr_Function_mat2v2float Function %10
%m3i = OpVariable %_ptr_Function_mat3v3float Function %16
%m3 = OpVariable %_ptr_Function_mat3v3float Function %16
%m4i = OpVariable %_ptr_Function_mat4v4float Function %22
%m4 = OpVariable %_ptr_Function_mat4v4float Function %22
%24 = OpLoad %mat2v2float %m2
%26 = OpExtInst %float %27 Determinant %24
%28 = OpFDiv %float %float_1 %26
%31 = OpCompositeExtract %v2float %24 1
%32 = OpCompositeExtract %float %31 1
%33 = OpFMul %float %28 %32
%34 = OpFNegate %float %28
%36 = OpCompositeExtract %v2float %24 0
%37 = OpCompositeExtract %float %36 1
%38 = OpFMul %float %34 %37
%39 = OpCompositeConstruct %v2float %33 %38
%40 = OpFNegate %float %28
%41 = OpCompositeExtract %v2float %24 1
%42 = OpCompositeExtract %float %41 0
%43 = OpFMul %float %40 %42
%44 = OpCompositeExtract %v2float %24 0
%45 = OpCompositeExtract %float %44 0
%46 = OpFMul %float %28 %45
%47 = OpCompositeConstruct %v2float %43 %46
%48 = OpCompositeConstruct %mat2v2float %39 %47
OpStore %m2i %48
%49 = OpLoad %mat3v3float %m3
%50 = OpExtInst %float %27 Determinant %49
%51 = OpFDiv %float %float_1 %50
%52 = OpCompositeExtract %v3float %49 1
%53 = OpCompositeExtract %float %52 1
%55 = OpCompositeExtract %v3float %49 2
%56 = OpCompositeExtract %float %55 2
%57 = OpFMul %float %53 %56
%58 = OpCompositeExtract %v3float %49 1
%59 = OpCompositeExtract %float %58 2
%60 = OpCompositeExtract %v3float %49 2
%61 = OpCompositeExtract %float %60 1
%62 = OpFMul %float %59 %61
%63 = OpFSub %float %57 %62
%64 = OpCompositeExtract %v3float %49 0
%65 = OpCompositeExtract %float %64 2
%66 = OpCompositeExtract %v3float %49 2
%67 = OpCompositeExtract %float %66 1
%68 = OpFMul %float %65 %67
%69 = OpCompositeExtract %v3float %49 0
%70 = OpCompositeExtract %float %69 1
%71 = OpCompositeExtract %v3float %49 2
%72 = OpCompositeExtract %float %71 2
%73 = OpFMul %float %70 %72
%74 = OpFSub %float %68 %73
%75 = OpCompositeExtract %v3float %49 0
%76 = OpCompositeExtract %float %75 1
%77 = OpCompositeExtract %v3float %49 1
%78 = OpCompositeExtract %float %77 2
%79 = OpFMul %float %76 %78
%80 = OpCompositeExtract %v3float %49 0
%81 = OpCompositeExtract %float %80 2
%82 = OpCompositeExtract %v3float %49 1
%83 = OpCompositeExtract %float %82 1
%84 = OpFMul %float %81 %83
%85 = OpFSub %float %79 %84
%86 = OpCompositeConstruct %v3float %63 %74 %85
%87 = OpCompositeExtract %v3float %49 1
%88 = OpCompositeExtract %float %87 2
%89 = OpCompositeExtract %v3float %49 2
%90 = OpCompositeExtract %float %89 0
%91 = OpFMul %float %88 %90
%92 = OpCompositeExtract %v3float %49 1
%93 = OpCompositeExtract %float %92 0
%94 = OpCompositeExtract %v3float %49 2
%95 = OpCompositeExtract %float %94 2
%96 = OpFMul %float %93 %95
%97 = OpFSub %float %91 %96
%98 = OpCompositeExtract %v3float %49 0
%99 = OpCompositeExtract %float %98 0
%100 = OpCompositeExtract %v3float %49 2
%101 = OpCompositeExtract %float %100 2
%102 = OpFMul %float %99 %101
%103 = OpCompositeExtract %v3float %49 0
%104 = OpCompositeExtract %float %103 2
%105 = OpCompositeExtract %v3float %49 2
%106 = OpCompositeExtract %float %105 0
%107 = OpFMul %float %104 %106
%108 = OpFSub %float %102 %107
%109 = OpCompositeExtract %v3float %49 0
%110 = OpCompositeExtract %float %109 2
%111 = OpCompositeExtract %v3float %49 1
%112 = OpCompositeExtract %float %111 0
%113 = OpFMul %float %110 %112
%114 = OpCompositeExtract %v3float %49 0
%115 = OpCompositeExtract %float %114 0
%116 = OpCompositeExtract %v3float %49 1
%117 = OpCompositeExtract %float %116 2
%118 = OpFMul %float %115 %117
%119 = OpFSub %float %113 %118
%120 = OpCompositeConstruct %v3float %97 %108 %119
%121 = OpCompositeExtract %v3float %49 1
%122 = OpCompositeExtract %float %121 0
%123 = OpCompositeExtract %v3float %49 2
%124 = OpCompositeExtract %float %123 1
%125 = OpFMul %float %122 %124
%126 = OpCompositeExtract %v3float %49 1
%127 = OpCompositeExtract %float %126 1
%128 = OpCompositeExtract %v3float %49 2
%129 = OpCompositeExtract %float %128 0
%130 = OpFMul %float %127 %129
%131 = OpFSub %float %125 %130
%132 = OpCompositeExtract %v3float %49 0
%133 = OpCompositeExtract %float %132 1
%134 = OpCompositeExtract %v3float %49 2
%135 = OpCompositeExtract %float %134 0
%136 = OpFMul %float %133 %135
%137 = OpCompositeExtract %v3float %49 0
%138 = OpCompositeExtract %float %137 0
%139 = OpCompositeExtract %v3float %49 2
%140 = OpCompositeExtract %float %139 1
%141 = OpFMul %float %138 %140
%142 = OpFSub %float %136 %141
%143 = OpCompositeExtract %v3float %49 0
%144 = OpCompositeExtract %float %143 0
%145 = OpCompositeExtract %v3float %49 1
%146 = OpCompositeExtract %float %145 1
%147 = OpFMul %float %144 %146
%148 = OpCompositeExtract %v3float %49 0
%149 = OpCompositeExtract %float %148 1
%150 = OpCompositeExtract %v3float %49 1
%151 = OpCompositeExtract %float %150 0
%152 = OpFMul %float %149 %151
%153 = OpFSub %float %147 %152
%154 = OpCompositeConstruct %v3float %131 %142 %153
%155 = OpCompositeConstruct %mat3v3float %86 %120 %154
%156 = OpMatrixTimesScalar %mat3v3float %155 %51
OpStore %m3i %156
%157 = OpLoad %mat4v4float %m4
%158 = OpExtInst %float %27 Determinant %157
%159 = OpFDiv %float %float_1 %158
%160 = OpCompositeExtract %v4float %157 1
%161 = OpCompositeExtract %float %160 1
%162 = OpCompositeExtract %v4float %157 2
%163 = OpCompositeExtract %float %162 2
%165 = OpCompositeExtract %v4float %157 3
%166 = OpCompositeExtract %float %165 3
%167 = OpFMul %float %163 %166
%168 = OpCompositeExtract %v4float %157 2
%169 = OpCompositeExtract %float %168 3
%170 = OpCompositeExtract %v4float %157 3
%171 = OpCompositeExtract %float %170 2
%172 = OpFMul %float %169 %171
%173 = OpFSub %float %167 %172
%174 = OpFMul %float %161 %173
%175 = OpCompositeExtract %v4float %157 1
%176 = OpCompositeExtract %float %175 2
%177 = OpCompositeExtract %v4float %157 2
%178 = OpCompositeExtract %float %177 1
%179 = OpCompositeExtract %v4float %157 3
%180 = OpCompositeExtract %float %179 3
%181 = OpFMul %float %178 %180
%182 = OpCompositeExtract %v4float %157 2
%183 = OpCompositeExtract %float %182 3
%184 = OpCompositeExtract %v4float %157 3
%185 = OpCompositeExtract %float %184 1
%186 = OpFMul %float %183 %185
%187 = OpFSub %float %181 %186
%188 = OpFMul %float %176 %187
%189 = OpFSub %float %174 %188
%190 = OpCompositeExtract %v4float %157 1
%191 = OpCompositeExtract %float %190 3
%192 = OpCompositeExtract %v4float %157 2
%193 = OpCompositeExtract %float %192 1
%194 = OpCompositeExtract %v4float %157 3
%195 = OpCompositeExtract %float %194 2
%196 = OpFMul %float %193 %195
%197 = OpCompositeExtract %v4float %157 2
%198 = OpCompositeExtract %float %197 2
%199 = OpCompositeExtract %v4float %157 3
%200 = OpCompositeExtract %float %199 1
%201 = OpFMul %float %198 %200
%202 = OpFSub %float %196 %201
%203 = OpFMul %float %191 %202
%204 = OpFAdd %float %189 %203
%206 = OpCompositeExtract %v4float %157 0
%207 = OpCompositeExtract %float %206 1
%205 = OpFNegate %float %207
%208 = OpCompositeExtract %v4float %157 2
%209 = OpCompositeExtract %float %208 2
%210 = OpCompositeExtract %v4float %157 3
%211 = OpCompositeExtract %float %210 3
%212 = OpFMul %float %209 %211
%213 = OpCompositeExtract %v4float %157 2
%214 = OpCompositeExtract %float %213 3
%215 = OpCompositeExtract %v4float %157 3
%216 = OpCompositeExtract %float %215 2
%217 = OpFMul %float %214 %216
%218 = OpFSub %float %212 %217
%219 = OpFMul %float %205 %218
%220 = OpCompositeExtract %v4float %157 0
%221 = OpCompositeExtract %float %220 2
%222 = OpCompositeExtract %v4float %157 2
%223 = OpCompositeExtract %float %222 1
%224 = OpCompositeExtract %v4float %157 3
%225 = OpCompositeExtract %float %224 3
%226 = OpFMul %float %223 %225
%227 = OpCompositeExtract %v4float %157 2
%228 = OpCompositeExtract %float %227 3
%229 = OpCompositeExtract %v4float %157 3
%230 = OpCompositeExtract %float %229 1
%231 = OpFMul %float %228 %230
%232 = OpFSub %float %226 %231
%233 = OpFMul %float %221 %232
%234 = OpFAdd %float %219 %233
%235 = OpCompositeExtract %v4float %157 0
%236 = OpCompositeExtract %float %235 3
%237 = OpCompositeExtract %v4float %157 2
%238 = OpCompositeExtract %float %237 1
%239 = OpCompositeExtract %v4float %157 3
%240 = OpCompositeExtract %float %239 2
%241 = OpFMul %float %238 %240
%242 = OpCompositeExtract %v4float %157 2
%243 = OpCompositeExtract %float %242 2
%244 = OpCompositeExtract %v4float %157 3
%245 = OpCompositeExtract %float %244 1
%246 = OpFMul %float %243 %245
%247 = OpFSub %float %241 %246
%248 = OpFMul %float %236 %247
%249 = OpFSub %float %234 %248
%250 = OpCompositeExtract %v4float %157 0
%251 = OpCompositeExtract %float %250 1
%252 = OpCompositeExtract %v4float %157 1
%253 = OpCompositeExtract %float %252 2
%254 = OpCompositeExtract %v4float %157 3
%255 = OpCompositeExtract %float %254 3
%256 = OpFMul %float %253 %255
%257 = OpCompositeExtract %v4float %157 1
%258 = OpCompositeExtract %float %257 3
%259 = OpCompositeExtract %v4float %157 3
%260 = OpCompositeExtract %float %259 2
%261 = OpFMul %float %258 %260
%262 = OpFSub %float %256 %261
%263 = OpFMul %float %251 %262
%264 = OpCompositeExtract %v4float %157 0
%265 = OpCompositeExtract %float %264 2
%266 = OpCompositeExtract %v4float %157 1
%267 = OpCompositeExtract %float %266 1
%268 = OpCompositeExtract %v4float %157 3
%269 = OpCompositeExtract %float %268 3
%270 = OpFMul %float %267 %269
%271 = OpCompositeExtract %v4float %157 1
%272 = OpCompositeExtract %float %271 3
%273 = OpCompositeExtract %v4float %157 3
%274 = OpCompositeExtract %float %273 1
%275 = OpFMul %float %272 %274
%276 = OpFSub %float %270 %275
%277 = OpFMul %float %265 %276
%278 = OpFSub %float %263 %277
%279 = OpCompositeExtract %v4float %157 0
%280 = OpCompositeExtract %float %279 3
%281 = OpCompositeExtract %v4float %157 1
%282 = OpCompositeExtract %float %281 1
%283 = OpCompositeExtract %v4float %157 3
%284 = OpCompositeExtract %float %283 2
%285 = OpFMul %float %282 %284
%286 = OpCompositeExtract %v4float %157 1
%287 = OpCompositeExtract %float %286 2
%288 = OpCompositeExtract %v4float %157 3
%289 = OpCompositeExtract %float %288 1
%290 = OpFMul %float %287 %289
%291 = OpFSub %float %285 %290
%292 = OpFMul %float %280 %291
%293 = OpFAdd %float %278 %292
%295 = OpCompositeExtract %v4float %157 0
%296 = OpCompositeExtract %float %295 1
%294 = OpFNegate %float %296
%297 = OpCompositeExtract %v4float %157 1
%298 = OpCompositeExtract %float %297 2
%299 = OpCompositeExtract %v4float %157 2
%300 = OpCompositeExtract %float %299 3
%301 = OpFMul %float %298 %300
%302 = OpCompositeExtract %v4float %157 1
%303 = OpCompositeExtract %float %302 3
%304 = OpCompositeExtract %v4float %157 2
%305 = OpCompositeExtract %float %304 2
%306 = OpFMul %float %303 %305
%307 = OpFSub %float %301 %306
%308 = OpFMul %float %294 %307
%309 = OpCompositeExtract %v4float %157 0
%310 = OpCompositeExtract %float %309 2
%311 = OpCompositeExtract %v4float %157 1
%312 = OpCompositeExtract %float %311 1
%313 = OpCompositeExtract %v4float %157 2
%314 = OpCompositeExtract %float %313 3
%315 = OpFMul %float %312 %314
%316 = OpCompositeExtract %v4float %157 1
%317 = OpCompositeExtract %float %316 3
%318 = OpCompositeExtract %v4float %157 2
%319 = OpCompositeExtract %float %318 1
%320 = OpFMul %float %317 %319
%321 = OpFSub %float %315 %320
%322 = OpFMul %float %310 %321
%323 = OpFAdd %float %308 %322
%324 = OpCompositeExtract %v4float %157 0
%325 = OpCompositeExtract %float %324 3
%326 = OpCompositeExtract %v4float %157 1
%327 = OpCompositeExtract %float %326 1
%328 = OpCompositeExtract %v4float %157 2
%329 = OpCompositeExtract %float %328 2
%330 = OpFMul %float %327 %329
%331 = OpCompositeExtract %v4float %157 1
%332 = OpCompositeExtract %float %331 2
%333 = OpCompositeExtract %v4float %157 2
%334 = OpCompositeExtract %float %333 1
%335 = OpFMul %float %332 %334
%336 = OpFSub %float %330 %335
%337 = OpFMul %float %325 %336
%338 = OpFSub %float %323 %337
%339 = OpCompositeConstruct %v4float %204 %249 %293 %338
%341 = OpCompositeExtract %v4float %157 1
%342 = OpCompositeExtract %float %341 0
%340 = OpFNegate %float %342
%343 = OpCompositeExtract %v4float %157 2
%344 = OpCompositeExtract %float %343 2
%345 = OpCompositeExtract %v4float %157 3
%346 = OpCompositeExtract %float %345 3
%347 = OpFMul %float %344 %346
%348 = OpCompositeExtract %v4float %157 2
%349 = OpCompositeExtract %float %348 3
%350 = OpCompositeExtract %v4float %157 3
%351 = OpCompositeExtract %float %350 2
%352 = OpFMul %float %349 %351
%353 = OpFSub %float %347 %352
%354 = OpFMul %float %340 %353
%355 = OpCompositeExtract %v4float %157 1
%356 = OpCompositeExtract %float %355 2
%357 = OpCompositeExtract %v4float %157 2
%358 = OpCompositeExtract %float %357 0
%359 = OpCompositeExtract %v4float %157 3
%360 = OpCompositeExtract %float %359 3
%361 = OpFMul %float %358 %360
%362 = OpCompositeExtract %v4float %157 2
%363 = OpCompositeExtract %float %362 3
%364 = OpCompositeExtract %v4float %157 3
%365 = OpCompositeExtract %float %364 0
%366 = OpFMul %float %363 %365
%367 = OpFSub %float %361 %366
%368 = OpFMul %float %356 %367
%369 = OpFAdd %float %354 %368
%370 = OpCompositeExtract %v4float %157 1
%371 = OpCompositeExtract %float %370 3
%372 = OpCompositeExtract %v4float %157 2
%373 = OpCompositeExtract %float %372 0
%374 = OpCompositeExtract %v4float %157 3
%375 = OpCompositeExtract %float %374 2
%376 = OpFMul %float %373 %375
%377 = OpCompositeExtract %v4float %157 2
%378 = OpCompositeExtract %float %377 2
%379 = OpCompositeExtract %v4float %157 3
%380 = OpCompositeExtract %float %379 0
%381 = OpFMul %float %378 %380
%382 = OpFSub %float %376 %381
%383 = OpFMul %float %371 %382
%384 = OpFSub %float %369 %383
%385 = OpCompositeExtract %v4float %157 0
%386 = OpCompositeExtract %float %385 0
%387 = OpCompositeExtract %v4float %157 2
%388 = OpCompositeExtract %float %387 2
%389 = OpCompositeExtract %v4float %157 3
%390 = OpCompositeExtract %float %389 3
%391 = OpFMul %float %388 %390
%392 = OpCompositeExtract %v4float %157 2
%393 = OpCompositeExtract %float %392 3
%394 = OpCompositeExtract %v4float %157 3
%395 = OpCompositeExtract %float %394 2
%396 = OpFMul %float %393 %395
%397 = OpFSub %float %391 %396
%398 = OpFMul %float %386 %397
%399 = OpCompositeExtract %v4float %157 0
%400 = OpCompositeExtract %float %399 2
%401 = OpCompositeExtract %v4float %157 2
%402 = OpCompositeExtract %float %401 0
%403 = OpCompositeExtract %v4float %157 3
%404 = OpCompositeExtract %float %403 3
%405 = OpFMul %float %402 %404
%406 = OpCompositeExtract %v4float %157 2
%407 = OpCompositeExtract %float %406 3
%408 = OpCompositeExtract %v4float %157 3
%409 = OpCompositeExtract %float %408 0
%410 = OpFMul %float %407 %409
%411 = OpFSub %float %405 %410
%412 = OpFMul %float %400 %411
%413 = OpFSub %float %398 %412
%414 = OpCompositeExtract %v4float %157 0
%415 = OpCompositeExtract %float %414 3
%416 = OpCompositeExtract %v4float %157 2
%417 = OpCompositeExtract %float %416 0
%418 = OpCompositeExtract %v4float %157 3
%419 = OpCompositeExtract %float %418 2
%420 = OpFMul %float %417 %419
%421 = OpCompositeExtract %v4float %157 2
%422 = OpCompositeExtract %float %421 2
%423 = OpCompositeExtract %v4float %157 3
%424 = OpCompositeExtract %float %423 0
%425 = OpFMul %float %422 %424
%426 = OpFSub %float %420 %425
%427 = OpFMul %float %415 %426
%428 = OpFAdd %float %413 %427
%430 = OpCompositeExtract %v4float %157 0
%431 = OpCompositeExtract %float %430 0
%429 = OpFNegate %float %431
%432 = OpCompositeExtract %v4float %157 1
%433 = OpCompositeExtract %float %432 2
%434 = OpCompositeExtract %v4float %157 3
%435 = OpCompositeExtract %float %434 3
%436 = OpFMul %float %433 %435
%437 = OpCompositeExtract %v4float %157 1
%438 = OpCompositeExtract %float %437 3
%439 = OpCompositeExtract %v4float %157 3
%440 = OpCompositeExtract %float %439 2
%441 = OpFMul %float %438 %440
%442 = OpFSub %float %436 %441
%443 = OpFMul %float %429 %442
%444 = OpCompositeExtract %v4float %157 0
%445 = OpCompositeExtract %float %444 2
%446 = OpCompositeExtract %v4float %157 1
%447 = OpCompositeExtract %float %446 0
%448 = OpCompositeExtract %v4float %157 3
%449 = OpCompositeExtract %float %448 3
%450 = OpFMul %float %447 %449
%451 = OpCompositeExtract %v4float %157 1
%452 = OpCompositeExtract %float %451 3
%453 = OpCompositeExtract %v4float %157 3
%454 = OpCompositeExtract %float %453 0
%455 = OpFMul %float %452 %454
%456 = OpFSub %float %450 %455
%457 = OpFMul %float %445 %456
%458 = OpFAdd %float %443 %457
%459 = OpCompositeExtract %v4float %157 0
%460 = OpCompositeExtract %float %459 3
%461 = OpCompositeExtract %v4float %157 1
%462 = OpCompositeExtract %float %461 0
%463 = OpCompositeExtract %v4float %157 3
%464 = OpCompositeExtract %float %463 2
%465 = OpFMul %float %462 %464
%466 = OpCompositeExtract %v4float %157 1
%467 = OpCompositeExtract %float %466 2
%468 = OpCompositeExtract %v4float %157 3
%469 = OpCompositeExtract %float %468 0
%470 = OpFMul %float %467 %469
%471 = OpFSub %float %465 %470
%472 = OpFMul %float %460 %471
%473 = OpFSub %float %458 %472
%474 = OpCompositeExtract %v4float %157 0
%475 = OpCompositeExtract %float %474 0
%476 = OpCompositeExtract %v4float %157 1
%477 = OpCompositeExtract %float %476 2
%478 = OpCompositeExtract %v4float %157 2
%479 = OpCompositeExtract %float %478 3
%480 = OpFMul %float %477 %479
%481 = OpCompositeExtract %v4float %157 1
%482 = OpCompositeExtract %float %481 3
%483 = OpCompositeExtract %v4float %157 2
%484 = OpCompositeExtract %float %483 2
%485 = OpFMul %float %482 %484
%486 = OpFSub %float %480 %485
%487 = OpFMul %float %475 %486
%488 = OpCompositeExtract %v4float %157 0
%489 = OpCompositeExtract %float %488 2
%490 = OpCompositeExtract %v4float %157 1
%491 = OpCompositeExtract %float %490 0
%492 = OpCompositeExtract %v4float %157 2
%493 = OpCompositeExtract %float %492 3
%494 = OpFMul %float %491 %493
%495 = OpCompositeExtract %v4float %157 1
%496 = OpCompositeExtract %float %495 3
%497 = OpCompositeExtract %v4float %157 2
%498 = OpCompositeExtract %float %497 0
%499 = OpFMul %float %496 %498
%500 = OpFSub %float %494 %499
%501 = OpFMul %float %489 %500
%502 = OpFSub %float %487 %501
%503 = OpCompositeExtract %v4float %157 0
%504 = OpCompositeExtract %float %503 3
%505 = OpCompositeExtract %v4float %157 1
%506 = OpCompositeExtract %float %505 0
%507 = OpCompositeExtract %v4float %157 2
%508 = OpCompositeExtract %float %507 2
%509 = OpFMul %float %506 %508
%510 = OpCompositeExtract %v4float %157 1
%511 = OpCompositeExtract %float %510 2
%512 = OpCompositeExtract %v4float %157 2
%513 = OpCompositeExtract %float %512 0
%514 = OpFMul %float %511 %513
%515 = OpFSub %float %509 %514
%516 = OpFMul %float %504 %515
%517 = OpFAdd %float %502 %516
%518 = OpCompositeConstruct %v4float %384 %428 %473 %517
%519 = OpCompositeExtract %v4float %157 1
%520 = OpCompositeExtract %float %519 0
%521 = OpCompositeExtract %v4float %157 2
%522 = OpCompositeExtract %float %521 1
%523 = OpCompositeExtract %v4float %157 3
%524 = OpCompositeExtract %float %523 3
%525 = OpFMul %float %522 %524
%526 = OpCompositeExtract %v4float %157 2
%527 = OpCompositeExtract %float %526 3
%528 = OpCompositeExtract %v4float %157 3
%529 = OpCompositeExtract %float %528 1
%530 = OpFMul %float %527 %529
%531 = OpFSub %float %525 %530
%532 = OpFMul %float %520 %531
%533 = OpCompositeExtract %v4float %157 1
%534 = OpCompositeExtract %float %533 1
%535 = OpCompositeExtract %v4float %157 2
%536 = OpCompositeExtract %float %535 0
%537 = OpCompositeExtract %v4float %157 3
%538 = OpCompositeExtract %float %537 3
%539 = OpFMul %float %536 %538
%540 = OpCompositeExtract %v4float %157 2
%541 = OpCompositeExtract %float %540 3
%542 = OpCompositeExtract %v4float %157 3
%543 = OpCompositeExtract %float %542 0
%544 = OpFMul %float %541 %543
%545 = OpFSub %float %539 %544
%546 = OpFMul %float %534 %545
%547 = OpFSub %float %532 %546
%548 = OpCompositeExtract %v4float %157 1
%549 = OpCompositeExtract %float %548 3
%550 = OpCompositeExtract %v4float %157 2
%551 = OpCompositeExtract %float %550 0
%552 = OpCompositeExtract %v4float %157 3
%553 = OpCompositeExtract %float %552 1
%554 = OpFMul %float %551 %553
%555 = OpCompositeExtract %v4float %157 2
%556 = OpCompositeExtract %float %555 1
%557 = OpCompositeExtract %v4float %157 3
%558 = OpCompositeExtract %float %557 0
%559 = OpFMul %float %556 %558
%560 = OpFSub %float %554 %559
%561 = OpFMul %float %549 %560
%562 = OpFAdd %float %547 %561
%564 = OpCompositeExtract %v4float %157 0
%565 = OpCompositeExtract %float %564 0
%563 = OpFNegate %float %565
%566 = OpCompositeExtract %v4float %157 2
%567 = OpCompositeExtract %float %566 1
%568 = OpCompositeExtract %v4float %157 3
%569 = OpCompositeExtract %float %568 3
%570 = OpFMul %float %567 %569
%571 = OpCompositeExtract %v4float %157 2
%572 = OpCompositeExtract %float %571 3
%573 = OpCompositeExtract %v4float %157 3
%574 = OpCompositeExtract %float %573 1
%575 = OpFMul %float %572 %574
%576 = OpFSub %float %570 %575
%577 = OpFMul %float %563 %576
%578 = OpCompositeExtract %v4float %157 0
%579 = OpCompositeExtract %float %578 1
%580 = OpCompositeExtract %v4float %157 2
%581 = OpCompositeExtract %float %580 0
%582 = OpCompositeExtract %v4float %157 3
%583 = OpCompositeExtract %float %582 3
%584 = OpFMul %float %581 %583
%585 = OpCompositeExtract %v4float %157 2
%586 = OpCompositeExtract %float %585 3
%587 = OpCompositeExtract %v4float %157 3
%588 = OpCompositeExtract %float %587 0
%589 = OpFMul %float %586 %588
%590 = OpFSub %float %584 %589
%591 = OpFMul %float %579 %590
%592 = OpFAdd %float %577 %591
%593 = OpCompositeExtract %v4float %157 0
%594 = OpCompositeExtract %float %593 3
%595 = OpCompositeExtract %v4float %157 2
%596 = OpCompositeExtract %float %595 0
%597 = OpCompositeExtract %v4float %157 3
%598 = OpCompositeExtract %float %597 1
%599 = OpFMul %float %596 %598
%600 = OpCompositeExtract %v4float %157 2
%601 = OpCompositeExtract %float %600 1
%602 = OpCompositeExtract %v4float %157 3
%603 = OpCompositeExtract %float %602 0
%604 = OpFMul %float %601 %603
%605 = OpFSub %float %599 %604
%606 = OpFMul %float %594 %605
%607 = OpFSub %float %592 %606
%608 = OpCompositeExtract %v4float %157 0
%609 = OpCompositeExtract %float %608 0
%610 = OpCompositeExtract %v4float %157 1
%611 = OpCompositeExtract %float %610 1
%612 = OpCompositeExtract %v4float %157 3
%613 = OpCompositeExtract %float %612 3
%614 = OpFMul %float %611 %613
%615 = OpCompositeExtract %v4float %157 1
%616 = OpCompositeExtract %float %615 3
%617 = OpCompositeExtract %v4float %157 3
%618 = OpCompositeExtract %float %617 1
%619 = OpFMul %float %616 %618
%620 = OpFSub %float %614 %619
%621 = OpFMul %float %609 %620
%622 = OpCompositeExtract %v4float %157 0
%623 = OpCompositeExtract %float %622 1
%624 = OpCompositeExtract %v4float %157 1
%625 = OpCompositeExtract %float %624 0
%626 = OpCompositeExtract %v4float %157 3
%627 = OpCompositeExtract %float %626 3
%628 = OpFMul %float %625 %627
%629 = OpCompositeExtract %v4float %157 1
%630 = OpCompositeExtract %float %629 3
%631 = OpCompositeExtract %v4float %157 3
%632 = OpCompositeExtract %float %631 0
%633 = OpFMul %float %630 %632
%634 = OpFSub %float %628 %633
%635 = OpFMul %float %623 %634
%636 = OpFSub %float %621 %635
%637 = OpCompositeExtract %v4float %157 0
%638 = OpCompositeExtract %float %637 3
%639 = OpCompositeExtract %v4float %157 1
%640 = OpCompositeExtract %float %639 0
%641 = OpCompositeExtract %v4float %157 3
%642 = OpCompositeExtract %float %641 1
%643 = OpFMul %float %640 %642
%644 = OpCompositeExtract %v4float %157 1
%645 = OpCompositeExtract %float %644 1
%646 = OpCompositeExtract %v4float %157 3
%647 = OpCompositeExtract %float %646 0
%648 = OpFMul %float %645 %647
%649 = OpFSub %float %643 %648
%650 = OpFMul %float %638 %649
%651 = OpFAdd %float %636 %650
%653 = OpCompositeExtract %v4float %157 0
%654 = OpCompositeExtract %float %653 0
%652 = OpFNegate %float %654
%655 = OpCompositeExtract %v4float %157 1
%656 = OpCompositeExtract %float %655 1
%657 = OpCompositeExtract %v4float %157 2
%658 = OpCompositeExtract %float %657 3
%659 = OpFMul %float %656 %658
%660 = OpCompositeExtract %v4float %157 1
%661 = OpCompositeExtract %float %660 3
%662 = OpCompositeExtract %v4float %157 2
%663 = OpCompositeExtract %float %662 1
%664 = OpFMul %float %661 %663
%665 = OpFSub %float %659 %664
%666 = OpFMul %float %652 %665
%667 = OpCompositeExtract %v4float %157 0
%668 = OpCompositeExtract %float %667 1
%669 = OpCompositeExtract %v4float %157 1
%670 = OpCompositeExtract %float %669 0
%671 = OpCompositeExtract %v4float %157 2
%672 = OpCompositeExtract %float %671 3
%673 = OpFMul %float %670 %672
%674 = OpCompositeExtract %v4float %157 1
%675 = OpCompositeExtract %float %674 3
%676 = OpCompositeExtract %v4float %157 2
%677 = OpCompositeExtract %float %676 0
%678 = OpFMul %float %675 %677
%679 = OpFSub %float %673 %678
%680 = OpFMul %float %668 %679
%681 = OpFAdd %float %666 %680
%682 = OpCompositeExtract %v4float %157 0
%683 = OpCompositeExtract %float %682 3
%684 = OpCompositeExtract %v4float %157 1
%685 = OpCompositeExtract %float %684 0
%686 = OpCompositeExtract %v4float %157 2
%687 = OpCompositeExtract %float %686 1
%688 = OpFMul %float %685 %687
%689 = OpCompositeExtract %v4float %157 1
%690 = OpCompositeExtract %float %689 1
%691 = OpCompositeExtract %v4float %157 2
%692 = OpCompositeExtract %float %691 0
%693 = OpFMul %float %690 %692
%694 = OpFSub %float %688 %693
%695 = OpFMul %float %683 %694
%696 = OpFSub %float %681 %695
%697 = OpCompositeConstruct %v4float %562 %607 %651 %696
%699 = OpCompositeExtract %v4float %157 1
%700 = OpCompositeExtract %float %699 0
%698 = OpFNegate %float %700
%701 = OpCompositeExtract %v4float %157 2
%702 = OpCompositeExtract %float %701 1
%703 = OpCompositeExtract %v4float %157 3
%704 = OpCompositeExtract %float %703 2
%705 = OpFMul %float %702 %704
%706 = OpCompositeExtract %v4float %157 2
%707 = OpCompositeExtract %float %706 2
%708 = OpCompositeExtract %v4float %157 3
%709 = OpCompositeExtract %float %708 1
%710 = OpFMul %float %707 %709
%711 = OpFSub %float %705 %710
%712 = OpFMul %float %698 %711
%713 = OpCompositeExtract %v4float %157 1
%714 = OpCompositeExtract %float %713 1
%715 = OpCompositeExtract %v4float %157 2
%716 = OpCompositeExtract %float %715 0
%717 = OpCompositeExtract %v4float %157 3
%718 = OpCompositeExtract %float %717 2
%719 = OpFMul %float %716 %718
%720 = OpCompositeExtract %v4float %157 2
%721 = OpCompositeExtract %float %720 2
%722 = OpCompositeExtract %v4float %157 3
%723 = OpCompositeExtract %float %722 0
%724 = OpFMul %float %721 %723
%725 = OpFSub %float %719 %724
%726 = OpFMul %float %714 %725
%727 = OpFAdd %float %712 %726
%728 = OpCompositeExtract %v4float %157 1
%729 = OpCompositeExtract %float %728 2
%730 = OpCompositeExtract %v4float %157 2
%731 = OpCompositeExtract %float %730 0
%732 = OpCompositeExtract %v4float %157 3
%733 = OpCompositeExtract %float %732 1
%734 = OpFMul %float %731 %733
%735 = OpCompositeExtract %v4float %157 2
%736 = OpCompositeExtract %float %735 1
%737 = OpCompositeExtract %v4float %157 3
%738 = OpCompositeExtract %float %737 0
%739 = OpFMul %float %736 %738
%740 = OpFSub %float %734 %739
%741 = OpFMul %float %729 %740
%742 = OpFSub %float %727 %741
%743 = OpCompositeExtract %v4float %157 0
%744 = OpCompositeExtract %float %743 0
%745 = OpCompositeExtract %v4float %157 2
%746 = OpCompositeExtract %float %745 1
%747 = OpCompositeExtract %v4float %157 3
%748 = OpCompositeExtract %float %747 2
%749 = OpFMul %float %746 %748
%750 = OpCompositeExtract %v4float %157 2
%751 = OpCompositeExtract %float %750 2
%752 = OpCompositeExtract %v4float %157 3
%753 = OpCompositeExtract %float %752 1
%754 = OpFMul %float %751 %753
%755 = OpFSub %float %749 %754
%756 = OpFMul %float %744 %755
%757 = OpCompositeExtract %v4float %157 0
%758 = OpCompositeExtract %float %757 1
%759 = OpCompositeExtract %v4float %157 2
%760 = OpCompositeExtract %float %759 0
%761 = OpCompositeExtract %v4float %157 3
%762 = OpCompositeExtract %float %761 2
%763 = OpFMul %float %760 %762
%764 = OpCompositeExtract %v4float %157 2
%765 = OpCompositeExtract %float %764 2
%766 = OpCompositeExtract %v4float %157 3
%767 = OpCompositeExtract %float %766 0
%768 = OpFMul %float %765 %767
%769 = OpFSub %float %763 %768
%770 = OpFMul %float %758 %769
%771 = OpFSub %float %756 %770
%772 = OpCompositeExtract %v4float %157 0
%773 = OpCompositeExtract %float %772 2
%774 = OpCompositeExtract %v4float %157 2
%775 = OpCompositeExtract %float %774 0
%776 = OpCompositeExtract %v4float %157 3
%777 = OpCompositeExtract %float %776 1
%778 = OpFMul %float %775 %777
%779 = OpCompositeExtract %v4float %157 2
%780 = OpCompositeExtract %float %779 1
%781 = OpCompositeExtract %v4float %157 3
%782 = OpCompositeExtract %float %781 0
%783 = OpFMul %float %780 %782
%784 = OpFSub %float %778 %783
%785 = OpFMul %float %773 %784
%786 = OpFAdd %float %771 %785
%788 = OpCompositeExtract %v4float %157 0
%789 = OpCompositeExtract %float %788 0
%787 = OpFNegate %float %789
%790 = OpCompositeExtract %v4float %157 1
%791 = OpCompositeExtract %float %790 1
%792 = OpCompositeExtract %v4float %157 3
%793 = OpCompositeExtract %float %792 2
%794 = OpFMul %float %791 %793
%795 = OpCompositeExtract %v4float %157 1
%796 = OpCompositeExtract %float %795 2
%797 = OpCompositeExtract %v4float %157 3
%798 = OpCompositeExtract %float %797 1
%799 = OpFMul %float %796 %798
%800 = OpFSub %float %794 %799
%801 = OpFMul %float %787 %800
%802 = OpCompositeExtract %v4float %157 0
%803 = OpCompositeExtract %float %802 1
%804 = OpCompositeExtract %v4float %157 1
%805 = OpCompositeExtract %float %804 0
%806 = OpCompositeExtract %v4float %157 3
%807 = OpCompositeExtract %float %806 2
%808 = OpFMul %float %805 %807
%809 = OpCompositeExtract %v4float %157 1
%810 = OpCompositeExtract %float %809 2
%811 = OpCompositeExtract %v4float %157 3
%812 = OpCompositeExtract %float %811 0
%813 = OpFMul %float %810 %812
%814 = OpFSub %float %808 %813
%815 = OpFMul %float %803 %814
%816 = OpFAdd %float %801 %815
%817 = OpCompositeExtract %v4float %157 0
%818 = OpCompositeExtract %float %817 2
%819 = OpCompositeExtract %v4float %157 1
%820 = OpCompositeExtract %float %819 0
%821 = OpCompositeExtract %v4float %157 3
%822 = OpCompositeExtract %float %821 1
%823 = OpFMul %float %820 %822
%824 = OpCompositeExtract %v4float %157 1
%825 = OpCompositeExtract %float %824 1
%826 = OpCompositeExtract %v4float %157 3
%827 = OpCompositeExtract %float %826 0
%828 = OpFMul %float %825 %827
%829 = OpFSub %float %823 %828
%830 = OpFMul %float %818 %829
%831 = OpFSub %float %816 %830
%832 = OpCompositeExtract %v4float %157 0
%833 = OpCompositeExtract %float %832 0
%834 = OpCompositeExtract %v4float %157 1
%835 = OpCompositeExtract %float %834 1
%836 = OpCompositeExtract %v4float %157 2
%837 = OpCompositeExtract %float %836 2
%838 = OpFMul %float %835 %837
%839 = OpCompositeExtract %v4float %157 1
%840 = OpCompositeExtract %float %839 2
%841 = OpCompositeExtract %v4float %157 2
%842 = OpCompositeExtract %float %841 1
%843 = OpFMul %float %840 %842
%844 = OpFSub %float %838 %843
%845 = OpFMul %float %833 %844
%846 = OpCompositeExtract %v4float %157 0
%847 = OpCompositeExtract %float %846 1
%848 = OpCompositeExtract %v4float %157 1
%849 = OpCompositeExtract %float %848 0
%850 = OpCompositeExtract %v4float %157 2
%851 = OpCompositeExtract %float %850 2
%852 = OpFMul %float %849 %851
%853 = OpCompositeExtract %v4float %157 1
%854 = OpCompositeExtract %float %853 2
%855 = OpCompositeExtract %v4float %157 2
%856 = OpCompositeExtract %float %855 0
%857 = OpFMul %float %854 %856
%858 = OpFSub %float %852 %857
%859 = OpFMul %float %847 %858
%860 = OpFSub %float %845 %859
%861 = OpCompositeExtract %v4float %157 0
%862 = OpCompositeExtract %float %861 2
%863 = OpCompositeExtract %v4float %157 1
%864 = OpCompositeExtract %float %863 0
%865 = OpCompositeExtract %v4float %157 2
%866 = OpCompositeExtract %float %865 1
%867 = OpFMul %float %864 %866
%868 = OpCompositeExtract %v4float %157 1
%869 = OpCompositeExtract %float %868 1
%870 = OpCompositeExtract %v4float %157 2
%871 = OpCompositeExtract %float %870 0
%872 = OpFMul %float %869 %871
%873 = OpFSub %float %867 %872
%874 = OpFMul %float %862 %873
%875 = OpFAdd %float %860 %874
%876 = OpCompositeConstruct %v4float %742 %786 %831 %875
%877 = OpCompositeConstruct %mat4v4float %339 %518 %697 %876
%878 = OpMatrixTimesScalar %mat4v4float %877 %159
OpStore %m4i %878
OpReturn
OpFunctionEnd
%main = OpFunction %void None %1
%880 = OpLabel
%881 = OpFunctionCall %void %main_1
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,23 @@
fn main_1() {
var m2i : mat2x2<f32>;
var m2 : mat2x2<f32>;
var m3i : mat3x3<f32>;
var m3 : mat3x3<f32>;
var m4i : mat4x4<f32>;
var m4 : mat4x4<f32>;
let x_12 : mat2x2<f32> = m2;
let s = (1.0f / determinant(x_12));
m2i = mat2x2<f32>(vec2<f32>((s * x_12[1u][1u]), (-(s) * x_12[0u][1u])), vec2<f32>((-(s) * x_12[1u][0u]), (s * x_12[0u][0u])));
let x_19 : mat3x3<f32> = m3;
let s_1 = (1.0f / determinant(x_19));
m3i = (s_1 * mat3x3<f32>(vec3<f32>(((x_19[1u][1u] * x_19[2u][2u]) - (x_19[1u][2u] * x_19[2u][1u])), ((x_19[0u][2u] * x_19[2u][1u]) - (x_19[0u][1u] * x_19[2u][2u])), ((x_19[0u][1u] * x_19[1u][2u]) - (x_19[0u][2u] * x_19[1u][1u]))), vec3<f32>(((x_19[1u][2u] * x_19[2u][0u]) - (x_19[1u][0u] * x_19[2u][2u])), ((x_19[0u][0u] * x_19[2u][2u]) - (x_19[0u][2u] * x_19[2u][0u])), ((x_19[0u][2u] * x_19[1u][0u]) - (x_19[0u][0u] * x_19[1u][2u]))), vec3<f32>(((x_19[1u][0u] * x_19[2u][1u]) - (x_19[1u][1u] * x_19[2u][0u])), ((x_19[0u][1u] * x_19[2u][0u]) - (x_19[0u][0u] * x_19[2u][1u])), ((x_19[0u][0u] * x_19[1u][1u]) - (x_19[0u][1u] * x_19[1u][0u])))));
let x_26 : mat4x4<f32> = m4;
let s_2 = (1.0f / determinant(x_26));
m4i = (s_2 * mat4x4<f32>(vec4<f32>((((x_26[1u][1u] * ((x_26[2u][2u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][2u]))) - (x_26[1u][2u] * ((x_26[2u][1u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][1u])))) + (x_26[1u][3u] * ((x_26[2u][1u] * x_26[3u][2u]) - (x_26[2u][2u] * x_26[3u][1u])))), (((-(x_26[0u][1u]) * ((x_26[2u][2u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][2u]))) + (x_26[0u][2u] * ((x_26[2u][1u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][1u])))) - (x_26[0u][3u] * ((x_26[2u][1u] * x_26[3u][2u]) - (x_26[2u][2u] * x_26[3u][1u])))), (((x_26[0u][1u] * ((x_26[1u][2u] * x_26[3u][3u]) - (x_26[1u][3u] * x_26[3u][2u]))) - (x_26[0u][2u] * ((x_26[1u][1u] * x_26[3u][3u]) - (x_26[1u][3u] * x_26[3u][1u])))) + (x_26[0u][3u] * ((x_26[1u][1u] * x_26[3u][2u]) - (x_26[1u][2u] * x_26[3u][1u])))), (((-(x_26[0u][1u]) * ((x_26[1u][2u] * x_26[2u][3u]) - (x_26[1u][3u] * x_26[2u][2u]))) + (x_26[0u][2u] * ((x_26[1u][1u] * x_26[2u][3u]) - (x_26[1u][3u] * x_26[2u][1u])))) - (x_26[0u][3u] * ((x_26[1u][1u] * x_26[2u][2u]) - (x_26[1u][2u] * x_26[2u][1u]))))), vec4<f32>((((-(x_26[1u][0u]) * ((x_26[2u][2u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][2u]))) + (x_26[1u][2u] * ((x_26[2u][0u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][0u])))) - (x_26[1u][3u] * ((x_26[2u][0u] * x_26[3u][2u]) - (x_26[2u][2u] * x_26[3u][0u])))), (((x_26[0u][0u] * ((x_26[2u][2u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][2u]))) - (x_26[0u][2u] * ((x_26[2u][0u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][0u])))) + (x_26[0u][3u] * ((x_26[2u][0u] * x_26[3u][2u]) - (x_26[2u][2u] * x_26[3u][0u])))), (((-(x_26[0u][0u]) * ((x_26[1u][2u] * x_26[3u][3u]) - (x_26[1u][3u] * x_26[3u][2u]))) + (x_26[0u][2u] * ((x_26[1u][0u] * x_26[3u][3u]) - (x_26[1u][3u] * x_26[3u][0u])))) - (x_26[0u][3u] * ((x_26[1u][0u] * x_26[3u][2u]) - (x_26[1u][2u] * x_26[3u][0u])))), (((x_26[0u][0u] * ((x_26[1u][2u] * x_26[2u][3u]) - (x_26[1u][3u] * x_26[2u][2u]))) - (x_26[0u][2u] * ((x_26[1u][0u] * x_26[2u][3u]) - (x_26[1u][3u] * x_26[2u][0u])))) + (x_26[0u][3u] * ((x_26[1u][0u] * x_26[2u][2u]) - (x_26[1u][2u] * x_26[2u][0u]))))), vec4<f32>((((x_26[1u][0u] * ((x_26[2u][1u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][1u]))) - (x_26[1u][1u] * ((x_26[2u][0u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][0u])))) + (x_26[1u][3u] * ((x_26[2u][0u] * x_26[3u][1u]) - (x_26[2u][1u] * x_26[3u][0u])))), (((-(x_26[0u][0u]) * ((x_26[2u][1u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][1u]))) + (x_26[0u][1u] * ((x_26[2u][0u] * x_26[3u][3u]) - (x_26[2u][3u] * x_26[3u][0u])))) - (x_26[0u][3u] * ((x_26[2u][0u] * x_26[3u][1u]) - (x_26[2u][1u] * x_26[3u][0u])))), (((x_26[0u][0u] * ((x_26[1u][1u] * x_26[3u][3u]) - (x_26[1u][3u] * x_26[3u][1u]))) - (x_26[0u][1u] * ((x_26[1u][0u] * x_26[3u][3u]) - (x_26[1u][3u] * x_26[3u][0u])))) + (x_26[0u][3u] * ((x_26[1u][0u] * x_26[3u][1u]) - (x_26[1u][1u] * x_26[3u][0u])))), (((-(x_26[0u][0u]) * ((x_26[1u][1u] * x_26[2u][3u]) - (x_26[1u][3u] * x_26[2u][1u]))) + (x_26[0u][1u] * ((x_26[1u][0u] * x_26[2u][3u]) - (x_26[1u][3u] * x_26[2u][0u])))) - (x_26[0u][3u] * ((x_26[1u][0u] * x_26[2u][1u]) - (x_26[1u][1u] * x_26[2u][0u]))))), vec4<f32>((((-(x_26[1u][0u]) * ((x_26[2u][1u] * x_26[3u][2u]) - (x_26[2u][2u] * x_26[3u][1u]))) + (x_26[1u][1u] * ((x_26[2u][0u] * x_26[3u][2u]) - (x_26[2u][2u] * x_26[3u][0u])))) - (x_26[1u][2u] * ((x_26[2u][0u] * x_26[3u][1u]) - (x_26[2u][1u] * x_26[3u][0u])))), (((x_26[0u][0u] * ((x_26[2u][1u] * x_26[3u][2u]) - (x_26[2u][2u] * x_26[3u][1u]))) - (x_26[0u][1u] * ((x_26[2u][0u] * x_26[3u][2u]) - (x_26[2u][2u] * x_26[3u][0u])))) + (x_26[0u][2u] * ((x_26[2u][0u] * x_26[3u][1u]) - (x_26[2u][1u] * x_26[3u][0u])))), (((-(x_26[0u][0u]) * ((x_26[1u][1u] * x_26[3u][2u]) - (x_26[1u][2u] * x_26[3u][1u]))) + (x_26[0u][1u] * ((x_26[1u][0u] * x_26[3u][2u]) - (x_26[1u][2u] * x_26[3u][0u])))) - (x_26[0u][2u] * ((x_26[1u][0u] * x_26[3u][1u]) - (x_26[1u][1u] * x_26[3u][0u])))), (((x_26[0u][0u] * ((x_26[1u][1u] * x_26[2u][2u]) - (x_26[1u][2u] * x_26[2u][1u]))) - (x_26[0u][1u] * ((x_26[1u][0u] * x_26[2u][2u]) - (x_26[1u][2u] * x_26[2u][0u])))) + (x_26[0u][2u] * ((x_26[1u][0u] * x_26[2u][1u]) - (x_26[1u][1u] * x_26[2u][0u])))))));
return;
}
@fragment
fn main() {
main_1();
}