[spirv-reader] Use builtin matrix aliases
This makes the generated WGSL more concise and readable. Change-Id: I78a722b9a86264d3bbf219445628dc5597cbfd62 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132141 Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: James Price <jrprice@google.com> Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
parent
114bae24b0
commit
f91b77dd6d
|
@ -4136,7 +4136,7 @@ TypedExpression FunctionEmitter::EmitGlslStd450MatrixInverse(
|
|||
auto* d = idx(1, 1);
|
||||
|
||||
// s * d, -s * b, -s * c, s * a
|
||||
auto* r = pb.mat2x2<f32>( //
|
||||
auto* r = pb.Call("mat2x2f", //
|
||||
pb.Call("vec2f", pb.Mul(s, d), pb.Mul(neg(s), b)),
|
||||
pb.Call("vec2f", pb.Mul(neg(s), c), pb.Mul(s, a)));
|
||||
return {mat.type, r};
|
||||
|
@ -4157,7 +4157,7 @@ TypedExpression FunctionEmitter::EmitGlslStd450MatrixInverse(
|
|||
auto* i = idx(2, 2);
|
||||
|
||||
auto r = pb.Mul(s, //
|
||||
pb.mat3x3<f32>( //
|
||||
pb.Call("mat3x3f", //
|
||||
pb.Call("vec3f",
|
||||
// e * i - f * h
|
||||
sub_mul2(e, i, f, h),
|
||||
|
@ -4235,7 +4235,7 @@ TypedExpression FunctionEmitter::EmitGlslStd450MatrixInverse(
|
|||
auto* ejfi = sub_mul2(e, j, f, i);
|
||||
|
||||
auto r = pb.Mul(s, //
|
||||
pb.mat4x4<f32>( //
|
||||
pb.Call("mat4x4f", //
|
||||
pb.Call("vec4f",
|
||||
// f * kplo - g * jpln + h * jokn
|
||||
sub_add_mul3(f, kplo, g, jpln, h, jokn),
|
||||
|
|
|
@ -741,7 +741,7 @@ TEST_F(SpvBinaryArithTestBasic, MatrixTimesScalar) {
|
|||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto ast_body = fe.ast_body();
|
||||
EXPECT_THAT(test::ToString(p->program(), ast_body),
|
||||
HasSubstr("let x_10 : mat2x2<f32> = (x_1 * x_2);"));
|
||||
HasSubstr("let x_10 : mat2x2f = (x_1 * x_2);"));
|
||||
}
|
||||
|
||||
TEST_F(SpvBinaryArithTestBasic, VectorTimesMatrix) {
|
||||
|
@ -798,7 +798,7 @@ TEST_F(SpvBinaryArithTestBasic, MatrixTimesMatrix) {
|
|||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto ast_body = fe.ast_body();
|
||||
EXPECT_THAT(test::ToString(p->program(), ast_body),
|
||||
HasSubstr("let x_10 : mat2x2<f32> = (x_1 * x_2);"));
|
||||
HasSubstr("let x_10 : mat2x2f = (x_1 * x_2);"));
|
||||
}
|
||||
|
||||
TEST_F(SpvBinaryArithTestBasic, Dot) {
|
||||
|
@ -838,7 +838,7 @@ TEST_F(SpvBinaryArithTestBasic, OuterProduct) {
|
|||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto ast_body = fe.ast_body();
|
||||
auto got = test::ToString(p->program(), ast_body);
|
||||
EXPECT_THAT(got, HasSubstr("let x_3 : mat2x3<f32> = mat2x3<f32>("
|
||||
EXPECT_THAT(got, HasSubstr("let x_3 : mat2x3f = mat2x3f("
|
||||
"vec3f((x_2.x * x_1.x), (x_2.x * x_1.y), (x_2.x * x_1.z)), "
|
||||
"vec3f((x_2.y * x_1.x), (x_2.y * x_1.y), (x_2.y * x_1.z)));"))
|
||||
<< got;
|
||||
|
@ -920,7 +920,7 @@ TEST_F(SpvUnaryArithTest, Transpose_2x2) {
|
|||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error() << "\n" << assembly;
|
||||
auto fe = p->function_emitter(100);
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
const auto* expected = "let x_2 : mat2x2<f32> = transpose(x_1);";
|
||||
const auto* expected = "let x_2 : mat2x2f = transpose(x_1);";
|
||||
auto ast_body = fe.ast_body();
|
||||
const auto got = test::ToString(p->program(), ast_body);
|
||||
EXPECT_THAT(got, HasSubstr(expected)) << got;
|
||||
|
@ -942,7 +942,7 @@ TEST_F(SpvUnaryArithTest, Transpose_2x3) {
|
|||
// Note, in the AST dump mat_2_3 means 2 rows and 3 columns.
|
||||
// So the column vectors have 2 elements.
|
||||
// That is, %m3v2float is __mat_2_3f32.
|
||||
const auto* expected = "let x_2 : mat3x2<f32> = transpose(x_1);";
|
||||
const auto* expected = "let x_2 : mat3x2f = transpose(x_1);";
|
||||
auto ast_body = fe.ast_body();
|
||||
const auto got = test::ToString(p->program(), ast_body);
|
||||
EXPECT_THAT(got, HasSubstr(expected)) << got;
|
||||
|
@ -961,7 +961,7 @@ TEST_F(SpvUnaryArithTest, Transpose_3x2) {
|
|||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error() << "\n" << assembly;
|
||||
auto fe = p->function_emitter(100);
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
const auto* expected = "let x_2 : mat2x3<f32> = transpose(x_1);";
|
||||
const auto* expected = "let x_2 : mat2x3f = transpose(x_1);";
|
||||
auto ast_body = fe.ast_body();
|
||||
const auto got = test::ToString(p->program(), ast_body);
|
||||
EXPECT_THAT(got, HasSubstr(expected)) << got;
|
||||
|
|
|
@ -115,8 +115,7 @@ TEST_F(SpvParserTest_Composite_Construct, Matrix) {
|
|||
auto fe = p->function_emitter(100);
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto ast_body = fe.ast_body();
|
||||
EXPECT_THAT(test::ToString(p->program(), ast_body),
|
||||
HasSubstr("let x_1 : mat3x2<f32> = mat3x2<f32>("
|
||||
EXPECT_THAT(test::ToString(p->program(), ast_body), HasSubstr("let x_1 : mat3x2f = mat3x2f("
|
||||
"vec2f(50.0f, 60.0f), "
|
||||
"vec2f(60.0f, 50.0f), "
|
||||
"vec2f(70.0f, 70.0f));"));
|
||||
|
@ -490,9 +489,9 @@ TEST_F(SpvParserTest_CompositeInsert, Matrix) {
|
|||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto ast_body = fe.ast_body();
|
||||
auto body_str = test::ToString(p->program(), ast_body);
|
||||
EXPECT_THAT(body_str, HasSubstr(R"(var x_2_1 : mat3x2<f32> = x_1;
|
||||
EXPECT_THAT(body_str, HasSubstr(R"(var x_2_1 : mat3x2f = x_1;
|
||||
x_2_1[2u] = vec2f(50.0f, 60.0f);
|
||||
let x_2 : mat3x2<f32> = x_2_1;
|
||||
let x_2 : mat3x2f = x_2_1;
|
||||
)")) << body_str;
|
||||
}
|
||||
|
||||
|
@ -535,9 +534,9 @@ TEST_F(SpvParserTest_CompositeInsert, Matrix_Vector) {
|
|||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto ast_body = fe.ast_body();
|
||||
auto body_str = test::ToString(p->program(), ast_body);
|
||||
EXPECT_THAT(body_str, HasSubstr(R"(var x_2_1 : mat3x2<f32> = x_1;
|
||||
EXPECT_THAT(body_str, HasSubstr(R"(var x_2_1 : mat3x2f = x_1;
|
||||
x_2_1[2u] = vec2f(50.0f, 60.0f);
|
||||
let x_2 : mat3x2<f32> = x_2_1;
|
||||
let x_2 : mat3x2f = x_2_1;
|
||||
return;
|
||||
)")) << body_str;
|
||||
}
|
||||
|
|
|
@ -1420,7 +1420,7 @@ TEST_F(SpvParserTest, GlslStd450_MatrixInverse_mat2x2) {
|
|||
|
||||
std::string expected =
|
||||
"let s = (1.0f / determinant(m2x2f1));\n"
|
||||
"let x_1 : mat2x2<f32> = mat2x2<f32>(vec2f((s * m2x2f1[1u][1u]), (-(s) * "
|
||||
"let x_1 : mat2x2f = mat2x2f(vec2f((s * m2x2f1[1u][1u]), (-(s) * "
|
||||
"m2x2f1[0u][1u])), vec2f((-(s) * m2x2f1[1u][0u]), (s * m2x2f1[0u][0u])));";
|
||||
|
||||
EXPECT_THAT(body, HasSubstr(expected)) << body;
|
||||
|
@ -1441,7 +1441,7 @@ TEST_F(SpvParserTest, GlslStd450_MatrixInverse_mat3x3) {
|
|||
|
||||
std::string expected =
|
||||
"let s = (1.0f / determinant(m3x3f1));\n"
|
||||
"let x_1 : mat3x3<f32> = (s * mat3x3<f32>(vec3f(((m3x3f1[1u][1u] * m3x3f1[2u][2u]) - "
|
||||
"let x_1 : mat3x3f = (s * mat3x3f(vec3f(((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]))), vec3f(((m3x3f1[1u][2u] * m3x3f1[2u][0u]) - (m3x3f1[1u][0u] * "
|
||||
|
@ -1470,7 +1470,7 @@ TEST_F(SpvParserTest, GlslStd450_MatrixInverse_mat4x4) {
|
|||
|
||||
std::string expected =
|
||||
"let s = (1.0f / determinant(m4x4f1));\n"
|
||||
"let x_1 : mat4x4<f32> = (s * mat4x4<f32>(vec4f((((m4x4f1[1u][1u] * ((m4x4f1[2u][2u] * "
|
||||
"let x_1 : mat4x4f = (s * mat4x4f(vec4f((((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] * "
|
||||
|
@ -1551,10 +1551,10 @@ TEST_F(SpvParserTest, GlslStd450_MatrixInverse_MultipleInScope) {
|
|||
|
||||
std::string expected =
|
||||
"let s = (1.0f / determinant(m2x2f1));\n"
|
||||
"let x_1 : mat2x2<f32> = mat2x2<f32>(vec2f((s * m2x2f1[1u][1u]), (-(s) * "
|
||||
"let x_1 : mat2x2f = mat2x2f(vec2f((s * m2x2f1[1u][1u]), (-(s) * "
|
||||
"m2x2f1[0u][1u])), vec2f((-(s) * m2x2f1[1u][0u]), (s * m2x2f1[0u][0u])));\n"
|
||||
"let s_1 = (1.0f / determinant(m2x2f1));\n"
|
||||
"let x_2 : mat2x2<f32> = mat2x2<f32>(vec2f((s_1 * m2x2f1[1u][1u]), (-(s_1) * "
|
||||
"let x_2 : mat2x2f = mat2x2f(vec2f((s_1 * m2x2f1[1u][1u]), (-(s_1) * "
|
||||
"m2x2f1[0u][1u])), vec2f((-(s_1) * m2x2f1[1u][0u]), (s_1 * m2x2f1[0u][0u])));";
|
||||
|
||||
EXPECT_THAT(body, HasSubstr(expected)) << body;
|
||||
|
|
|
@ -182,7 +182,7 @@ TEST_F(SpvParserTestMiscInstruction, OpUndef_InFunction_Matrix) {
|
|||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto ast_body = fe.ast_body();
|
||||
EXPECT_THAT(test::ToString(p->program(), ast_body),
|
||||
HasSubstr("let x_11 : mat2x2<f32> = mat2x2<f32>();"));
|
||||
HasSubstr("let x_11 : mat2x2f = mat2x2f();"));
|
||||
}
|
||||
|
||||
TEST_F(SpvParserTestMiscInstruction, OpUndef_InFunction_Array) {
|
||||
|
|
|
@ -260,8 +260,7 @@ TEST_F(SpvParserFunctionVarTest, EmitFunctionVariables_MatrixInitializer) {
|
|||
EXPECT_TRUE(fe.EmitFunctionVariables());
|
||||
|
||||
auto ast_body = fe.ast_body();
|
||||
EXPECT_THAT(test::ToString(p->program(), ast_body),
|
||||
HasSubstr("var x_200 : mat3x2<f32> = mat3x2<f32>("
|
||||
EXPECT_THAT(test::ToString(p->program(), ast_body), HasSubstr("var x_200 : mat3x2f = mat3x2f("
|
||||
"vec2f(1.5f, 2.0f), "
|
||||
"vec2f(2.0f, 3.0f), "
|
||||
"vec2f(3.0f, 4.0f));"));
|
||||
|
|
|
@ -1082,7 +1082,7 @@ TEST_F(SpvModuleScopeVarParserTest, MatrixInitializer) {
|
|||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str = test::ToString(p->program());
|
||||
EXPECT_THAT(module_str, HasSubstr("var<private> x_200 : mat3x2<f32> = mat3x2<f32>("
|
||||
EXPECT_THAT(module_str, HasSubstr("var<private> x_200 : mat3x2f = mat3x2f("
|
||||
"vec2f(1.5f, 2.0f), "
|
||||
"vec2f(2.0f, 3.0f), "
|
||||
"vec2f(3.0f, 4.0f));"));
|
||||
|
@ -1097,7 +1097,7 @@ TEST_F(SpvModuleScopeVarParserTest, MatrixNullInitializer) {
|
|||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str = test::ToString(p->program());
|
||||
EXPECT_THAT(module_str, HasSubstr("var<private> x_200 : mat3x2<f32> = mat3x2<f32>();"));
|
||||
EXPECT_THAT(module_str, HasSubstr("var<private> x_200 : mat3x2f = mat3x2f();"));
|
||||
}
|
||||
|
||||
TEST_F(SpvModuleScopeVarParserTest, MatrixUndefInitializer) {
|
||||
|
@ -1109,7 +1109,7 @@ TEST_F(SpvModuleScopeVarParserTest, MatrixUndefInitializer) {
|
|||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str = test::ToString(p->program());
|
||||
EXPECT_THAT(module_str, HasSubstr("var<private> x_200 : mat3x2<f32> = mat3x2<f32>();"));
|
||||
EXPECT_THAT(module_str, HasSubstr("var<private> x_200 : mat3x2f = mat3x2f();"));
|
||||
|
||||
// This example module emits ok, but is not valid SPIR-V in the first place.
|
||||
p->DeliberatelyInvalidSpirv();
|
||||
|
@ -1290,7 +1290,7 @@ TEST_F(SpvModuleScopeVarParserTest, ColMajorDecoration_Dropped) {
|
|||
const auto module_str = test::ToString(p->program());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(struct S {
|
||||
/* @offset(0) */
|
||||
field0 : mat3x2<f32>,
|
||||
field0 : mat3x2f,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<storage, read_write> myvar : S;
|
||||
|
@ -1321,7 +1321,7 @@ TEST_F(SpvModuleScopeVarParserTest, MatrixStrideDecoration_Natural_Dropped) {
|
|||
const auto module_str = test::ToString(p->program());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(struct S {
|
||||
/* @offset(0) */
|
||||
field0 : mat3x2<f32>,
|
||||
field0 : mat3x2f,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<storage, read_write> myvar : S;
|
||||
|
@ -1353,7 +1353,7 @@ TEST_F(SpvModuleScopeVarParserTest, MatrixStrideDecoration) {
|
|||
EXPECT_THAT(module_str, HasSubstr(R"(struct S {
|
||||
/* @offset(0) */
|
||||
@stride(64) @internal(disable_validation__ignore_stride)
|
||||
field0 : mat3x2<f32>,
|
||||
field0 : mat3x2f,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<storage, read_write> myvar : S;
|
||||
|
@ -4254,7 +4254,7 @@ TEST_F(SpvModuleScopeVarParserTest, Input_FlattenMatrix) {
|
|||
EXPECT_TRUE(p->error().empty());
|
||||
|
||||
const auto got = test::ToString(p->program());
|
||||
const std::string expected = R"(var<private> x_1 : mat2x4<f32>;
|
||||
const std::string expected = R"(var<private> x_1 : mat2x4f;
|
||||
|
||||
var<private> x_2 : vec4f;
|
||||
|
||||
|
@ -4380,7 +4380,7 @@ TEST_F(SpvModuleScopeVarParserTest, Input_FlattenNested) {
|
|||
EXPECT_TRUE(p->error().empty());
|
||||
|
||||
const auto got = test::ToString(p->program());
|
||||
const std::string expected = R"(var<private> x_1 : array<mat2x4<f32>, 2u>;
|
||||
const std::string expected = R"(var<private> x_1 : array<mat2x4f, 2u>;
|
||||
|
||||
var<private> x_2 : vec4f;
|
||||
|
||||
|
@ -4502,7 +4502,7 @@ TEST_F(SpvModuleScopeVarParserTest, Output_FlattenMatrix) {
|
|||
EXPECT_TRUE(p->error().empty());
|
||||
|
||||
const auto got = test::ToString(p->program());
|
||||
const std::string expected = R"(var<private> x_1 : mat2x4<f32>;
|
||||
const std::string expected = R"(var<private> x_1 : mat2x4f;
|
||||
|
||||
var<private> x_2 : vec4f;
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
#include "src/tint/reader/spirv/parser_type.h"
|
||||
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <utility>
|
||||
|
@ -216,6 +217,11 @@ Matrix::Matrix(const Type* t, uint32_t c, uint32_t r) : type(t), columns(c), row
|
|||
Matrix::Matrix(const Matrix&) = default;
|
||||
|
||||
ast::Type Matrix::Build(ProgramBuilder& b) const {
|
||||
if (type->Is<F32>()) {
|
||||
std::ostringstream ss;
|
||||
ss << "mat" << columns << "x" << rows << "f";
|
||||
return b.ty(ss.str());
|
||||
}
|
||||
return b.ty.mat(type->Build(b), columns, rows);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
fn main_1() {
|
||||
let x_24 : f32 = mat3x3<f32>(vec3f(1.0f, 2.0f, 3.0f), vec3f(4.0f, 5.0f, 6.0f), vec3f(7.0f, 8.0f, 9.0f))[1u].y;
|
||||
let x_24 : f32 = mat3x3f(vec3f(1.0f, 2.0f, 3.0f), vec3f(4.0f, 5.0f, 6.0f), vec3f(7.0f, 8.0f, 9.0f))[1u].y;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
fn main_1() {
|
||||
var m : mat3x3<f32> = mat3x3<f32>();
|
||||
var m : mat3x3f = mat3x3f();
|
||||
let x_15 : vec3f = m[1i];
|
||||
let x_16 : f32 = x_15.y;
|
||||
return;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
struct S {
|
||||
field0 : mat3x3<f32>,
|
||||
field0 : mat3x3f,
|
||||
}
|
||||
|
||||
struct S_1 {
|
||||
|
@ -32,9 +32,9 @@ struct S_7 {
|
|||
|
||||
const x_72 = vec4f(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
const x_73 = mat4x4<f32>(x_72, x_72, x_72, x_72);
|
||||
const x_73 = mat4x4f(x_72, x_72, x_72, x_72);
|
||||
|
||||
var<private> x_75 : array<mat4x4<f32>, 58u> = array<mat4x4<f32>, 58u>(x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73);
|
||||
var<private> x_75 : array<mat4x4f, 58u> = array<mat4x4f, 58u>(x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73, x_73);
|
||||
|
||||
const x_77 = vec3f(0.0f, 0.0f, 0.0f);
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ var<private> x_GLF_color : vec4f;
|
|||
fn main_1() {
|
||||
var f : f32;
|
||||
var v : vec4f;
|
||||
f = determinant(mat3x3<f32>(vec3f(1.0f, 0.0f, 0.0f), vec3f(0.0f, 1.0f, 0.0f), vec3f(0.0f, 0.0f, 1.0f)));
|
||||
f = determinant(mat3x3f(vec3f(1.0f, 0.0f, 0.0f), vec3f(0.0f, 1.0f, 0.0f), vec3f(0.0f, 0.0f, 1.0f)));
|
||||
let x_33 : f32 = f;
|
||||
let x_35 : f32 = f;
|
||||
let x_37 : f32 = f;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
alias Arr = array<mat4x4<f32>, 2u>;
|
||||
alias Arr = array<mat4x4f, 2u>;
|
||||
|
||||
struct strided_arr {
|
||||
@size(16)
|
||||
|
@ -9,7 +9,7 @@ alias Arr_1 = array<strided_arr, 4u>;
|
|||
|
||||
struct LeftOver {
|
||||
/* @offset(0) */
|
||||
worldViewProjection : mat4x4<f32>,
|
||||
worldViewProjection : mat4x4f,
|
||||
/* @offset(64) */
|
||||
time : f32,
|
||||
/* @offset(80) */
|
||||
|
@ -45,7 +45,7 @@ fn main_1() {
|
|||
let x_55 : f32 = p.y;
|
||||
let x_57 : f32 = x_14.time;
|
||||
p.y = (x_55 + sin((x_57 + 4.0f)));
|
||||
let x_69 : mat4x4<f32> = x_14.worldViewProjection;
|
||||
let x_69 : mat4x4f = x_14.worldViewProjection;
|
||||
let x_70 : vec3f = p;
|
||||
gl_Position = (x_69 * vec4f(x_70.x, x_70.y, x_70.z, 1.0f));
|
||||
let x_83 : vec2f = uv;
|
||||
|
|
|
@ -8,7 +8,7 @@ struct UniformBuffer {
|
|||
/* @offset(48) */
|
||||
ucolorGreen_S1_c0 : vec4f,
|
||||
/* @offset(64) */
|
||||
umatrix_S1 : mat3x3<f32>,
|
||||
umatrix_S1 : mat3x3f,
|
||||
}
|
||||
|
||||
@binding(0) @group(0) var<uniform> x_4 : UniformBuffer;
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
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;
|
||||
var m2i : mat2x2f;
|
||||
var m2 : mat2x2f;
|
||||
var m3i : mat3x3f;
|
||||
var m3 : mat3x3f;
|
||||
var m4i : mat4x4f;
|
||||
var m4 : mat4x4f;
|
||||
let x_12 : mat2x2f = m2;
|
||||
let s = (1.0f / determinant(x_12));
|
||||
m2i = mat2x2<f32>(vec2f((s * x_12[1u][1u]), (-(s) * x_12[0u][1u])), vec2f((-(s) * x_12[1u][0u]), (s * x_12[0u][0u])));
|
||||
let x_19 : mat3x3<f32> = m3;
|
||||
m2i = mat2x2f(vec2f((s * x_12[1u][1u]), (-(s) * x_12[0u][1u])), vec2f((-(s) * x_12[1u][0u]), (s * x_12[0u][0u])));
|
||||
let x_19 : mat3x3f = m3;
|
||||
let s_1 = (1.0f / determinant(x_19));
|
||||
m3i = (s_1 * mat3x3<f32>(vec3f(((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]))), vec3f(((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]))), vec3f(((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;
|
||||
m3i = (s_1 * mat3x3f(vec3f(((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]))), vec3f(((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]))), vec3f(((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 : mat4x4f = m4;
|
||||
let s_2 = (1.0f / determinant(x_26));
|
||||
m4i = (s_2 * mat4x4<f32>(vec4f((((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]))))), vec4f((((-(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]))))), vec4f((((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]))))), vec4f((((-(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])))))));
|
||||
m4i = (s_2 * mat4x4f(vec4f((((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]))))), vec4f((((-(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]))))), vec4f((((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]))))), vec4f((((-(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;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ fn mat2x2_stride_16_to_arr(m : mat2x2<f32>) -> array<strided_arr, 2u> {
|
|||
}
|
||||
|
||||
fn f_1() {
|
||||
let x_15 : mat2x2<f32> = arr_to_mat2x2_stride_16(ssbo.m);
|
||||
let x_15 : mat2x2f = arr_to_mat2x2_stride_16(ssbo.m);
|
||||
ssbo.m = mat2x2_stride_16_to_arr(x_15);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
fn main_1() {
|
||||
var m : mat3x3<f32> = mat3x3<f32>();
|
||||
m = mat3x3<f32>(vec3f(1.0f, 2.0f, 3.0f), vec3f(4.0f, 5.0f, 6.0f), vec3f(7.0f, 8.0f, 9.0f));
|
||||
var m : mat3x3f = mat3x3f();
|
||||
m = mat3x3f(vec3f(1.0f, 2.0f, 3.0f), vec3f(4.0f, 5.0f, 6.0f), vec3f(7.0f, 8.0f, 9.0f));
|
||||
m[1i] = vec3f(5.0f, 5.0f, 5.0f);
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue