reader/spirv: Optimize MakeNullValue()

Constructing a null vector, matrix or array does not need to provide an explicit list of null elements. `T()` is a more efficient and readable equivalent.

Fuzzers like to generate enormous pathological composite types, which has been triggering OOM failures.

Bug: oss-fuzz:38095
Bug: oss-fuzz:39235
Bug: oss-fuzz:39246
Bug: oss-fuzz:39874
Change-Id: I910bb04bdd0e80532c09fc038be895ec37d3d380
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/75426
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
Ben Clayton 2022-01-05 20:24:22 +00:00 committed by Tint LUCI CQ
parent 4a143a40a3
commit 1c4f8de30b
28 changed files with 275 additions and 336 deletions

View File

@ -105,10 +105,10 @@ TEST_F(SpvParserTestMiscInstruction, OpUndef_BeforeFunction_Vector) {
EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_TRUE(fe.EmitBody()) << p->error();
auto ast_body = fe.ast_body(); auto ast_body = fe.ast_body();
EXPECT_THAT(test::ToString(p->program(), ast_body), EXPECT_THAT(test::ToString(p->program(), ast_body),
HasSubstr(R"(let x_14 : vec2<bool> = vec2<bool>(false, false); HasSubstr(R"(let x_14 : vec2<bool> = vec2<bool>();
let x_11 : vec2<u32> = vec2<u32>(0u, 0u); let x_11 : vec2<u32> = vec2<u32>();
let x_12 : vec2<i32> = vec2<i32>(0, 0); let x_12 : vec2<i32> = vec2<i32>();
let x_13 : vec2<f32> = vec2<f32>(0.0, 0.0); let x_13 : vec2<f32> = vec2<f32>();
)")); )"));
} }
@ -161,9 +161,9 @@ TEST_F(SpvParserTestMiscInstruction, OpUndef_InFunction_Vector) {
EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_TRUE(fe.EmitBody()) << p->error();
auto ast_body = fe.ast_body(); auto ast_body = fe.ast_body();
EXPECT_THAT(test::ToString(p->program(), ast_body), EXPECT_THAT(test::ToString(p->program(), ast_body),
HasSubstr(R"(let x_11 : vec2<u32> = vec2<u32>(0u, 0u); HasSubstr(R"(let x_11 : vec2<u32> = vec2<u32>();
let x_12 : vec2<i32> = vec2<i32>(0, 0); let x_12 : vec2<i32> = vec2<i32>();
let x_13 : vec2<f32> = vec2<f32>(0.0, 0.0); let x_13 : vec2<f32> = vec2<f32>();
)")); )"));
} }
@ -185,9 +185,7 @@ TEST_F(SpvParserTestMiscInstruction, OpUndef_InFunction_Matrix) {
EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_TRUE(fe.EmitBody()) << p->error();
auto ast_body = fe.ast_body(); auto ast_body = fe.ast_body();
EXPECT_THAT(test::ToString(p->program(), ast_body), EXPECT_THAT(test::ToString(p->program(), ast_body),
HasSubstr("let x_11 : mat2x2<f32> = mat2x2<f32>(" HasSubstr("let x_11 : mat2x2<f32> = mat2x2<f32>();"));
"vec2<f32>(0.0, 0.0), "
"vec2<f32>(0.0, 0.0));"));
} }
TEST_F(SpvParserTestMiscInstruction, OpUndef_InFunction_Array) { TEST_F(SpvParserTestMiscInstruction, OpUndef_InFunction_Array) {
@ -209,7 +207,7 @@ TEST_F(SpvParserTestMiscInstruction, OpUndef_InFunction_Array) {
EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_TRUE(fe.EmitBody()) << p->error();
auto ast_body = fe.ast_body(); auto ast_body = fe.ast_body();
EXPECT_THAT(test::ToString(p->program(), ast_body), EXPECT_THAT(test::ToString(p->program(), ast_body),
HasSubstr("let x_11 : array<u32, 2u> = array<u32, 2u>(0u, 0u);")); HasSubstr("let x_11 : array<u32, 2u> = array<u32, 2u>();"));
} }
TEST_F(SpvParserTestMiscInstruction, OpUndef_InFunction_Struct) { TEST_F(SpvParserTestMiscInstruction, OpUndef_InFunction_Struct) {

View File

@ -340,7 +340,7 @@ TEST_F(SpvParserFunctionVarTest, EmitFunctionVariables_ArrayInitializer_Null) {
auto ast_body = fe.ast_body(); auto ast_body = fe.ast_body();
EXPECT_THAT( EXPECT_THAT(
test::ToString(p->program(), ast_body), test::ToString(p->program(), ast_body),
HasSubstr("var x_200 : array<u32, 2u> = array<u32, 2u>(0u, 0u);")); HasSubstr("var x_200 : array<u32, 2u> = array<u32, 2u>();"));
} }
TEST_F(SpvParserFunctionVarTest, TEST_F(SpvParserFunctionVarTest,
@ -368,7 +368,7 @@ TEST_F(SpvParserFunctionVarTest,
auto ast_body = fe.ast_body(); auto ast_body = fe.ast_body();
EXPECT_THAT(test::ToString(p->program(), ast_body), EXPECT_THAT(test::ToString(p->program(), ast_body),
HasSubstr("var x_200 : Arr = Arr(0u, 0u);")); HasSubstr("var x_200 : Arr = [[stride(16)]] array<u32, 2u>();"));
} }
TEST_F(SpvParserFunctionVarTest, EmitFunctionVariables_StructInitializer) { TEST_F(SpvParserFunctionVarTest, EmitFunctionVariables_StructInitializer) {
@ -412,7 +412,7 @@ TEST_F(SpvParserFunctionVarTest, EmitFunctionVariables_StructInitializer_Null) {
auto ast_body = fe.ast_body(); auto ast_body = fe.ast_body();
EXPECT_THAT(test::ToString(p->program(), ast_body), EXPECT_THAT(test::ToString(p->program(), ast_body),
HasSubstr("var x_200 : S = S(0u, 0.0, array<u32, 2u>(0u, 0u));")); HasSubstr("var x_200 : S = S(0u, 0.0, array<u32, 2u>());"));
} }
TEST_F(SpvParserFunctionVarTest, TEST_F(SpvParserFunctionVarTest,
@ -1525,7 +1525,7 @@ TEST_F(SpvParserFunctionVarTest, EmitStatement_Hoist_CompositeInsert) {
const auto* expected = R"(var x_200 : vec2<i32>; const auto* expected = R"(var x_200 : vec2<i32>;
if (true) { if (true) {
x_200 = vec2<i32>(0, 0); x_200 = vec2<i32>();
x_200.x = 0; x_200.x = 0;
} else { } else {
return; return;
@ -1568,7 +1568,7 @@ TEST_F(SpvParserFunctionVarTest, EmitStatement_Hoist_VectorInsertDynamic) {
const auto got = test::ToString(p->program(), ast_body); const auto got = test::ToString(p->program(), ast_body);
const auto* expected = R"(var x_200 : vec2<i32>; const auto* expected = R"(var x_200 : vec2<i32>;
if (true) { if (true) {
x_200 = vec2<i32>(0, 0); x_200 = vec2<i32>();
x_200[1] = 3; x_200[1] = 3;
} else { } else {
return; return;

View File

@ -2001,37 +2001,8 @@ const ast::Expression* ParserImpl::MakeNullValue(const Type* type) {
if (type->Is<F32>()) { if (type->Is<F32>()) {
return create<ast::FloatLiteralExpression>(Source{}, 0.0f); return create<ast::FloatLiteralExpression>(Source{}, 0.0f);
} }
if (type->Is<Alias>()) { if (type->IsAnyOf<Vector, Matrix, Array>()) {
// TODO(amaiorano): No type constructor for TypeName (yet?) return builder_.Construct(Source{}, type->Build(builder_));
ast::ExpressionList ast_components;
return builder_.Construct(Source{}, original_type->Build(builder_),
std::move(ast_components));
}
if (auto* vec_ty = type->As<Vector>()) {
ast::ExpressionList ast_components;
for (size_t i = 0; i < vec_ty->size; ++i) {
ast_components.emplace_back(MakeNullValue(vec_ty->type));
}
return builder_.Construct(Source{}, type->Build(builder_),
std::move(ast_components));
}
if (auto* mat_ty = type->As<Matrix>()) {
// Matrix components are columns
auto* column_ty = ty_.Vector(mat_ty->type, mat_ty->rows);
ast::ExpressionList ast_components;
for (size_t i = 0; i < mat_ty->columns; ++i) {
ast_components.emplace_back(MakeNullValue(column_ty));
}
return builder_.Construct(Source{}, type->Build(builder_),
std::move(ast_components));
}
if (auto* arr_ty = type->As<Array>()) {
ast::ExpressionList ast_components;
for (size_t i = 0; i < arr_ty->size; ++i) {
ast_components.emplace_back(MakeNullValue(arr_ty->type));
}
return builder_.Construct(Source{}, original_type->Build(builder_),
std::move(ast_components));
} }
if (auto* struct_ty = type->As<Struct>()) { if (auto* struct_ty = type->As<Struct>()) {
ast::ExpressionList ast_components; ast::ExpressionList ast_components;

View File

@ -3945,8 +3945,8 @@ TEST_F(SpvParserHandleTest,
auto ast_body = fe.ast_body(); auto ast_body = fe.ast_body();
const auto got = test::ToString(p->program(), ast_body); const auto got = test::ToString(p->program(), ast_body);
auto* expect = R"(var var_1 : vec4<f32>; auto* expect = R"(var var_1 : vec4<f32>;
let x_22 : vec4<f32> = textureSample(x_2, x_3, vec2<f32>(0.0, 0.0)); let x_22 : vec4<f32> = textureSample(x_2, x_3, vec2<f32>());
let x_26 : vec4<f32> = textureSample(x_2, x_3, vec2<f32>(0.0, 0.0)); let x_26 : vec4<f32> = textureSample(x_2, x_3, vec2<f32>());
var_1 = (x_22 + x_26); var_1 = (x_22 + x_26);
return; return;
)"; )";

View File

@ -357,8 +357,7 @@ TEST_F(SpvModuleScopeVarParserTest, BuiltinPosition_StorePosition) {
EXPECT_TRUE(p->BuildAndParseInternalModule()); EXPECT_TRUE(p->BuildAndParseInternalModule());
EXPECT_TRUE(p->error().empty()); EXPECT_TRUE(p->error().empty());
const auto module_str = test::ToString(p->program()); const auto module_str = test::ToString(p->program());
EXPECT_THAT(module_str, EXPECT_THAT(module_str, HasSubstr("gl_Position = vec4<f32>();"))
HasSubstr("gl_Position = vec4<f32>(0.0, 0.0, 0.0, 0.0);"))
<< module_str; << module_str;
} }
@ -402,8 +401,7 @@ TEST_F(SpvModuleScopeVarParserTest,
EXPECT_TRUE(p->BuildAndParseInternalModule()); EXPECT_TRUE(p->BuildAndParseInternalModule());
EXPECT_TRUE(p->error().empty()); EXPECT_TRUE(p->error().empty());
const auto module_str = test::ToString(p->program()); const auto module_str = test::ToString(p->program());
EXPECT_THAT(module_str, EXPECT_THAT(module_str, HasSubstr("gl_Position = vec4<f32>();"))
HasSubstr("gl_Position = vec4<f32>(0.0, 0.0, 0.0, 0.0);"))
<< module_str; << module_str;
} }
@ -998,9 +996,8 @@ TEST_F(SpvModuleScopeVarParserTest, VectorBoolNullInitializer) {
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
EXPECT_TRUE(p->error().empty()); EXPECT_TRUE(p->error().empty());
const auto module_str = test::ToString(p->program()); const auto module_str = test::ToString(p->program());
EXPECT_THAT( EXPECT_THAT(module_str,
module_str, HasSubstr("var<private> x_200 : vec2<bool> = vec2<bool>();"));
HasSubstr("var<private> x_200 : vec2<bool> = vec2<bool>(false, false);"));
} }
TEST_F(SpvModuleScopeVarParserTest, VectorBoolUndefInitializer) { TEST_F(SpvModuleScopeVarParserTest, VectorBoolUndefInitializer) {
@ -1012,9 +1009,8 @@ TEST_F(SpvModuleScopeVarParserTest, VectorBoolUndefInitializer) {
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
EXPECT_TRUE(p->error().empty()); EXPECT_TRUE(p->error().empty());
const auto module_str = test::ToString(p->program()); const auto module_str = test::ToString(p->program());
EXPECT_THAT( EXPECT_THAT(module_str,
module_str, HasSubstr("var<private> x_200 : vec2<bool> = vec2<bool>();"));
HasSubstr("var<private> x_200 : vec2<bool> = vec2<bool>(false, false);"));
// This example module emits ok, but is not valid SPIR-V in the first place. // This example module emits ok, but is not valid SPIR-V in the first place.
p->DeliberatelyInvalidSpirv(); p->DeliberatelyInvalidSpirv();
@ -1030,7 +1026,7 @@ TEST_F(SpvModuleScopeVarParserTest, VectorUintNullInitializer) {
EXPECT_TRUE(p->error().empty()); EXPECT_TRUE(p->error().empty());
const auto module_str = test::ToString(p->program()); const auto module_str = test::ToString(p->program());
EXPECT_THAT(module_str, EXPECT_THAT(module_str,
HasSubstr("var<private> x_200 : vec2<u32> = vec2<u32>(0u, 0u);")); HasSubstr("var<private> x_200 : vec2<u32> = vec2<u32>();"));
} }
TEST_F(SpvModuleScopeVarParserTest, VectorUintUndefInitializer) { TEST_F(SpvModuleScopeVarParserTest, VectorUintUndefInitializer) {
@ -1043,7 +1039,7 @@ TEST_F(SpvModuleScopeVarParserTest, VectorUintUndefInitializer) {
EXPECT_TRUE(p->error().empty()); EXPECT_TRUE(p->error().empty());
const auto module_str = test::ToString(p->program()); const auto module_str = test::ToString(p->program());
EXPECT_THAT(module_str, EXPECT_THAT(module_str,
HasSubstr("var<private> x_200 : vec2<u32> = vec2<u32>(0u, 0u);")); HasSubstr("var<private> x_200 : vec2<u32> = vec2<u32>();"));
// This example module emits ok, but is not valid SPIR-V in the first place. // This example module emits ok, but is not valid SPIR-V in the first place.
p->DeliberatelyInvalidSpirv(); p->DeliberatelyInvalidSpirv();
@ -1059,7 +1055,7 @@ TEST_F(SpvModuleScopeVarParserTest, VectorIntNullInitializer) {
EXPECT_TRUE(p->error().empty()); EXPECT_TRUE(p->error().empty());
const auto module_str = test::ToString(p->program()); const auto module_str = test::ToString(p->program());
EXPECT_THAT(module_str, EXPECT_THAT(module_str,
HasSubstr("var<private> x_200 : vec2<i32> = vec2<i32>(0, 0);")); HasSubstr("var<private> x_200 : vec2<i32> = vec2<i32>();"));
} }
TEST_F(SpvModuleScopeVarParserTest, VectorIntUndefInitializer) { TEST_F(SpvModuleScopeVarParserTest, VectorIntUndefInitializer) {
@ -1072,7 +1068,7 @@ TEST_F(SpvModuleScopeVarParserTest, VectorIntUndefInitializer) {
EXPECT_TRUE(p->error().empty()); EXPECT_TRUE(p->error().empty());
const auto module_str = test::ToString(p->program()); const auto module_str = test::ToString(p->program());
EXPECT_THAT(module_str, EXPECT_THAT(module_str,
HasSubstr("var<private> x_200 : vec2<i32> = vec2<i32>(0, 0);")); HasSubstr("var<private> x_200 : vec2<i32> = vec2<i32>();"));
// This example module emits ok, but is not valid SPIR-V in the first place. // This example module emits ok, but is not valid SPIR-V in the first place.
p->DeliberatelyInvalidSpirv(); p->DeliberatelyInvalidSpirv();
@ -1087,9 +1083,8 @@ TEST_F(SpvModuleScopeVarParserTest, VectorFloatNullInitializer) {
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
EXPECT_TRUE(p->error().empty()); EXPECT_TRUE(p->error().empty());
const auto module_str = test::ToString(p->program()); const auto module_str = test::ToString(p->program());
EXPECT_THAT( EXPECT_THAT(module_str,
module_str, HasSubstr("var<private> x_200 : vec2<f32> = vec2<f32>();"));
HasSubstr("var<private> x_200 : vec2<f32> = vec2<f32>(0.0, 0.0);"));
} }
TEST_F(SpvModuleScopeVarParserTest, VectorFloatUndefInitializer) { TEST_F(SpvModuleScopeVarParserTest, VectorFloatUndefInitializer) {
@ -1101,9 +1096,8 @@ TEST_F(SpvModuleScopeVarParserTest, VectorFloatUndefInitializer) {
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
EXPECT_TRUE(p->error().empty()); EXPECT_TRUE(p->error().empty());
const auto module_str = test::ToString(p->program()); const auto module_str = test::ToString(p->program());
EXPECT_THAT( EXPECT_THAT(module_str,
module_str, HasSubstr("var<private> x_200 : vec2<f32> = vec2<f32>();"));
HasSubstr("var<private> x_200 : vec2<f32> = vec2<f32>(0.0, 0.0);"));
// This example module emits ok, but is not valid SPIR-V in the first place. // This example module emits ok, but is not valid SPIR-V in the first place.
p->DeliberatelyInvalidSpirv(); p->DeliberatelyInvalidSpirv();
@ -1141,10 +1135,7 @@ TEST_F(SpvModuleScopeVarParserTest, MatrixNullInitializer) {
EXPECT_TRUE(p->error().empty()); EXPECT_TRUE(p->error().empty());
const auto module_str = test::ToString(p->program()); const auto module_str = test::ToString(p->program());
EXPECT_THAT(module_str, EXPECT_THAT(module_str,
HasSubstr("var<private> x_200 : mat3x2<f32> = mat3x2<f32>(" HasSubstr("var<private> x_200 : mat3x2<f32> = mat3x2<f32>();"));
"vec2<f32>(0.0, 0.0), "
"vec2<f32>(0.0, 0.0), "
"vec2<f32>(0.0, 0.0));"));
} }
TEST_F(SpvModuleScopeVarParserTest, MatrixUndefInitializer) { TEST_F(SpvModuleScopeVarParserTest, MatrixUndefInitializer) {
@ -1157,10 +1148,7 @@ TEST_F(SpvModuleScopeVarParserTest, MatrixUndefInitializer) {
EXPECT_TRUE(p->error().empty()); EXPECT_TRUE(p->error().empty());
const auto module_str = test::ToString(p->program()); const auto module_str = test::ToString(p->program());
EXPECT_THAT(module_str, EXPECT_THAT(module_str,
HasSubstr("var<private> x_200 : mat3x2<f32> = mat3x2<f32>(" HasSubstr("var<private> x_200 : mat3x2<f32> = mat3x2<f32>();"));
"vec2<f32>(0.0, 0.0), "
"vec2<f32>(0.0, 0.0), "
"vec2<f32>(0.0, 0.0));"));
// This example module emits ok, but is not valid SPIR-V in the first place. // This example module emits ok, but is not valid SPIR-V in the first place.
p->DeliberatelyInvalidSpirv(); p->DeliberatelyInvalidSpirv();
@ -1193,8 +1181,7 @@ TEST_F(SpvModuleScopeVarParserTest, ArrayNullInitializer) {
const auto module_str = test::ToString(p->program()); const auto module_str = test::ToString(p->program());
EXPECT_THAT( EXPECT_THAT(
module_str, module_str,
HasSubstr( HasSubstr("var<private> x_200 : array<u32, 2u> = array<u32, 2u>();"));
"var<private> x_200 : array<u32, 2u> = array<u32, 2u>(0u, 0u);"));
} }
TEST_F(SpvModuleScopeVarParserTest, ArrayUndefInitializer) { TEST_F(SpvModuleScopeVarParserTest, ArrayUndefInitializer) {
@ -1208,8 +1195,7 @@ TEST_F(SpvModuleScopeVarParserTest, ArrayUndefInitializer) {
const auto module_str = test::ToString(p->program()); const auto module_str = test::ToString(p->program());
EXPECT_THAT( EXPECT_THAT(
module_str, module_str,
HasSubstr( HasSubstr("var<private> x_200 : array<u32, 2u> = array<u32, 2u>();"));
"var<private> x_200 : array<u32, 2u> = array<u32, 2u>(0u, 0u);"));
// This example module emits ok, but is not valid SPIR-V in the first place. // This example module emits ok, but is not valid SPIR-V in the first place.
p->DeliberatelyInvalidSpirv(); p->DeliberatelyInvalidSpirv();
@ -1245,7 +1231,7 @@ TEST_F(SpvModuleScopeVarParserTest, StructNullInitializer) {
const auto module_str = test::ToString(p->program()); const auto module_str = test::ToString(p->program());
EXPECT_THAT( EXPECT_THAT(
module_str, module_str,
HasSubstr("var<private> x_200 : S = S(0u, 0.0, array<u32, 2u>(0u, 0u));")) HasSubstr("var<private> x_200 : S = S(0u, 0.0, array<u32, 2u>());"))
<< module_str; << module_str;
} }
@ -1262,7 +1248,7 @@ TEST_F(SpvModuleScopeVarParserTest, StructUndefInitializer) {
const auto module_str = test::ToString(p->program()); const auto module_str = test::ToString(p->program());
EXPECT_THAT( EXPECT_THAT(
module_str, module_str,
HasSubstr("var<private> x_200 : S = S(0u, 0.0, array<u32, 2u>(0u, 0u));")) HasSubstr("var<private> x_200 : S = S(0u, 0.0, array<u32, 2u>());"))
<< module_str; << module_str;
// This example module emits ok, but is not valid SPIR-V in the first place. // This example module emits ok, but is not valid SPIR-V in the first place.
@ -3967,7 +3953,7 @@ TEST_F(SpvModuleScopeVarParserTest,
EXPECT_TRUE(p->error().empty()); EXPECT_TRUE(p->error().empty());
const auto got = test::ToString(p->program()); const auto got = test::ToString(p->program());
const std::string expected = const std::string expected =
R"(var<private> x_1 : array<u32, 1u> = array<u32, 1u>(0u); R"(var<private> x_1 : array<u32, 1u> = array<u32, 1u>();
fn main_1() { fn main_1() {
return; return;
@ -4013,7 +3999,7 @@ TEST_F(SpvModuleScopeVarParserTest,
EXPECT_TRUE(p->error().empty()); EXPECT_TRUE(p->error().empty());
const auto got = test::ToString(p->program()); const auto got = test::ToString(p->program());
const std::string expected = const std::string expected =
R"(var<private> x_1 : array<i32, 1u> = array<i32, 1u>(0); R"(var<private> x_1 : array<i32, 1u> = array<i32, 1u>();
fn main_1() { fn main_1() {
return; return;

View File

@ -1,5 +1,5 @@
void main_1() { void main_1() {
float3x3 m = float3x3(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f)); float3x3 m = float3x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
const float3 x_15 = m[1]; const float3 x_15 = m[1];
const float x_16 = x_15.y; const float x_16 = x_15.y;
return; return;

View File

@ -2,7 +2,7 @@
using namespace metal; using namespace metal;
void main_1() { void main_1() {
float3x3 m = float3x3(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f)); float3x3 m = float3x3();
float3 const x_15 = m[1]; float3 const x_15 = m[1];
float const x_16 = x_15[1]; float const x_16 = x_15[1];
return; return;

View File

@ -1,7 +1,7 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 23 ; Bound: 20
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
@ -15,25 +15,22 @@
%float = OpTypeFloat 32 %float = OpTypeFloat 32
%v3float = OpTypeVector %float 3 %v3float = OpTypeVector %float 3
%mat3v3float = OpTypeMatrix %v3float 3 %mat3v3float = OpTypeMatrix %v3float 3
%float_0 = OpConstant %float 0 %8 = OpConstantNull %mat3v3float
%9 = OpConstantComposite %v3float %float_0 %float_0 %float_0
%10 = OpConstantComposite %mat3v3float %9 %9 %9
%_ptr_Function_mat3v3float = OpTypePointer Function %mat3v3float %_ptr_Function_mat3v3float = OpTypePointer Function %mat3v3float
%13 = OpConstantNull %mat3v3float
%int = OpTypeInt 32 1 %int = OpTypeInt 32 1
%int_1 = OpConstant %int 1 %int_1 = OpConstant %int 1
%_ptr_Function_v3float = OpTypePointer Function %v3float %_ptr_Function_v3float = OpTypePointer Function %v3float
%main_1 = OpFunction %void None %1 %main_1 = OpFunction %void None %1
%4 = OpLabel %4 = OpLabel
%m = OpVariable %_ptr_Function_mat3v3float Function %13 %m = OpVariable %_ptr_Function_mat3v3float Function %8
OpStore %m %10 OpStore %m %8
%17 = OpAccessChain %_ptr_Function_v3float %m %int_1 %14 = OpAccessChain %_ptr_Function_v3float %m %int_1
%18 = OpLoad %v3float %17 %15 = OpLoad %v3float %14
%19 = OpCompositeExtract %float %18 1 %16 = OpCompositeExtract %float %15 1
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%main = OpFunction %void None %1 %main = OpFunction %void None %1
%21 = OpLabel %18 = OpLabel
%22 = OpFunctionCall %void %main_1 %19 = OpFunctionCall %void %main_1
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -1,5 +1,5 @@
fn main_1() { fn main_1() {
var m : mat3x3<f32> = mat3x3<f32>(vec3<f32>(0.0, 0.0, 0.0), vec3<f32>(0.0, 0.0, 0.0), vec3<f32>(0.0, 0.0, 0.0)); var m : mat3x3<f32> = mat3x3<f32>();
let x_15 : vec3<f32> = m[1]; let x_15 : vec3<f32> = m[1];
let x_16 : f32 = x_15.y; let x_16 : f32 = x_15.y;
return; return;

View File

@ -2,7 +2,7 @@
using namespace metal; using namespace metal;
void main_1() { void main_1() {
float3 v = float3(0.0f, 0.0f, 0.0f); float3 v = float3();
float const x_14 = v[1]; float const x_14 = v[1];
float3 const x_16 = v; float3 const x_16 = v;
float2 const x_17 = float2(x_16[0], x_16[2]); float2 const x_17 = float2(x_16[0], x_16[2]);

View File

@ -1,7 +1,7 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 30 ; Bound: 28
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
@ -14,33 +14,31 @@
%1 = OpTypeFunction %void %1 = OpTypeFunction %void
%float = OpTypeFloat 32 %float = OpTypeFloat 32
%v3float = OpTypeVector %float 3 %v3float = OpTypeVector %float 3
%float_0 = OpConstant %float 0 %7 = OpConstantNull %v3float
%8 = OpConstantComposite %v3float %float_0 %float_0 %float_0
%_ptr_Function_v3float = OpTypePointer Function %v3float %_ptr_Function_v3float = OpTypePointer Function %v3float
%11 = OpConstantNull %v3float
%uint = OpTypeInt 32 0 %uint = OpTypeInt 32 0
%uint_1 = OpConstant %uint 1 %uint_1 = OpConstant %uint 1
%_ptr_Function_float = OpTypePointer Function %float %_ptr_Function_float = OpTypePointer Function %float
%v2float = OpTypeVector %float 2 %v2float = OpTypeVector %float 2
%main_1 = OpFunction %void None %1 %main_1 = OpFunction %void None %1
%4 = OpLabel %4 = OpLabel
%v = OpVariable %_ptr_Function_v3float Function %11 %v = OpVariable %_ptr_Function_v3float Function %7
OpStore %v %8 OpStore %v %7
%15 = OpAccessChain %_ptr_Function_float %v %uint_1 %13 = OpAccessChain %_ptr_Function_float %v %uint_1
%16 = OpLoad %float %15 %14 = OpLoad %float %13
%17 = OpLoad %v3float %v %15 = OpLoad %v3float %v
%19 = OpCompositeExtract %float %17 0 %17 = OpCompositeExtract %float %15 0
%20 = OpCompositeExtract %float %17 2 %18 = OpCompositeExtract %float %15 2
%21 = OpCompositeConstruct %v2float %19 %20 %19 = OpCompositeConstruct %v2float %17 %18
%22 = OpLoad %v3float %v %20 = OpLoad %v3float %v
%23 = OpCompositeExtract %float %22 0 %21 = OpCompositeExtract %float %20 0
%24 = OpCompositeExtract %float %22 2 %22 = OpCompositeExtract %float %20 2
%25 = OpCompositeExtract %float %22 1 %23 = OpCompositeExtract %float %20 1
%26 = OpCompositeConstruct %v3float %23 %24 %25 %24 = OpCompositeConstruct %v3float %21 %22 %23
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%main = OpFunction %void None %1 %main = OpFunction %void None %1
%28 = OpLabel %26 = OpLabel
%29 = OpFunctionCall %void %main_1 %27 = OpFunctionCall %void %main_1
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -1,5 +1,5 @@
fn main_1() { fn main_1() {
var v : vec3<f32> = vec3<f32>(0.0, 0.0, 0.0); var v : vec3<f32> = vec3<f32>();
let x_14 : f32 = v.y; let x_14 : f32 = v.y;
let x_16 : vec3<f32> = v; let x_16 : vec3<f32> = v;
let x_17 : vec2<f32> = vec2<f32>(x_16.x, x_16.z); let x_17 : vec2<f32> = vec2<f32>(x_16.x, x_16.z);

View File

@ -843,7 +843,7 @@ void main_1(thread QuicksortObject* const tint_symbol_84, thread float4* const t
QuicksortObject const tint_symbol_43 = {.numbers=tint_symbol_42}; QuicksortObject const tint_symbol_43 = {.numbers=tint_symbol_42};
*(tint_symbol_84) = tint_symbol_43; *(tint_symbol_84) = tint_symbol_43;
*(tint_symbol_84) = x_756; *(tint_symbol_84) = x_756;
float2 const x_446 = float2(float2(0.0f, 0.0f)[0], float2(0.0f, 0.0f)[0]); float2 const x_446 = float2(float2()[0], float2()[0]);
int const x_757 = i_2; int const x_757 = i_2;
i_2 = 0; i_2 = 0;
i_2 = x_757; i_2 = x_757;
@ -857,7 +857,7 @@ void main_1(thread QuicksortObject* const tint_symbol_84, thread float4* const t
float2 const x_759 = uv; float2 const x_759 = uv;
uv = float2(0.0f, 0.0f); uv = float2(0.0f, 0.0f);
uv = x_759; uv = x_759;
float2 const x_447 = float2(float2(0.0f, 0.0f)[1], float2(0.0f, 0.0f)[1]); float2 const x_447 = float2(float2()[1], float2()[1]);
float2 const x_760 = uv; float2 const x_760 = uv;
uv = float2(0.0f, 0.0f); uv = float2(0.0f, 0.0f);
uv = x_760; uv = x_760;
@ -956,7 +956,7 @@ void main_1(thread QuicksortObject* const tint_symbol_84, thread float4* const t
int const x_781 = (*(tint_symbol_84)).numbers.arr[0u]; int const x_781 = (*(tint_symbol_84)).numbers.arr[0u];
(*(tint_symbol_84)).numbers.arr[0u] = 0; (*(tint_symbol_84)).numbers.arr[0u] = 0;
(*(tint_symbol_84)).numbers.arr[0u] = x_781; (*(tint_symbol_84)).numbers.arr[0u] = x_781;
float3 const x_456 = float3(float2(0.0f, 0.0f)[1], x_448[1], x_448[1]); float3 const x_456 = float3(float2()[1], x_448[1], x_448[1]);
float const x_782 = uv[0]; float const x_782 = uv[0];
uv[0] = 0.0f; uv[0] = 0.0f;
uv[0] = x_782; uv[0] = x_782;
@ -975,7 +975,7 @@ void main_1(thread QuicksortObject* const tint_symbol_84, thread float4* const t
QuicksortObject const tint_symbol_63 = {.numbers=tint_symbol_62}; QuicksortObject const tint_symbol_63 = {.numbers=tint_symbol_62};
*(tint_symbol_84) = tint_symbol_63; *(tint_symbol_84) = tint_symbol_63;
*(tint_symbol_84) = x_785; *(tint_symbol_84) = x_785;
float2 const x_458 = float2(float3(1.0f, 2.0f, 3.0f)[2], float2(0.0f, 0.0f)[1]); float2 const x_458 = float2(float3(1.0f, 2.0f, 3.0f)[2], float2()[1]);
int const x_786 = i_2; int const x_786 = i_2;
i_2 = 0; i_2 = 0;
i_2 = x_786; i_2 = x_786;
@ -1015,7 +1015,7 @@ void main_1(thread QuicksortObject* const tint_symbol_84, thread float4* const t
float const x_796 = uv[0]; float const x_796 = uv[0];
uv[0] = 0.0f; uv[0] = 0.0f;
uv[0] = x_796; uv[0] = x_796;
float2 const x_461 = float2(float2(0.0f, 0.0f)[1], float2(0.0f, 0.0f)[1]); float2 const x_461 = float2(float2()[1], float2()[1]);
float const x_797 = uv[0]; float const x_797 = uv[0];
uv[0] = 0.0f; uv[0] = 0.0f;
uv[0] = x_797; uv[0] = x_797;
@ -1059,7 +1059,7 @@ void main_1(thread QuicksortObject* const tint_symbol_84, thread float4* const t
int const x_808 = i_2; int const x_808 = i_2;
i_2 = 0; i_2 = 0;
i_2 = x_808; i_2 = x_808;
float2 const x_466 = float2(x_455[1], float2(0.0f, 0.0f)[1]); float2 const x_466 = float2(x_455[1], float2()[1]);
int const x_809 = i_2; int const x_809 = i_2;
i_2 = 0; i_2 = 0;
i_2 = x_809; i_2 = x_809;
@ -1113,7 +1113,7 @@ void main_1(thread QuicksortObject* const tint_symbol_84, thread float4* const t
int const x_822 = (*(tint_symbol_84)).numbers.arr[0u]; int const x_822 = (*(tint_symbol_84)).numbers.arr[0u];
(*(tint_symbol_84)).numbers.arr[0u] = 0; (*(tint_symbol_84)).numbers.arr[0u] = 0;
(*(tint_symbol_84)).numbers.arr[0u] = x_822; (*(tint_symbol_84)).numbers.arr[0u] = x_822;
float2 const x_470 = float2(float2(0.0f, 0.0f)[0], float2(0.0f, 0.0f)[1]); float2 const x_470 = float2(float2()[0], float2()[1]);
float const x_823 = color[2]; float const x_823 = color[2];
color[2] = 0.0f; color[2] = 0.0f;
color[2] = x_823; color[2] = x_823;
@ -1155,7 +1155,7 @@ void main_1(thread QuicksortObject* const tint_symbol_84, thread float4* const t
color[0] = x_832; color[0] = x_832;
float2 const x_476 = float2(x_451[2], x_460[1]); float2 const x_476 = float2(x_451[2], x_460[1]);
color[1] = (x_257 + float(x_254)); color[1] = (x_257 + float(x_254));
float3 const x_477 = float3(float2(0.0f, 0.0f)[0], x_472[0], float2(0.0f, 0.0f)[1]); float3 const x_477 = float3(float2()[0], x_472[0], float2()[1]);
float const x_833 = uv[0]; float const x_833 = uv[0];
uv[0] = 0.0f; uv[0] = 0.0f;
uv[0] = x_833; uv[0] = x_833;
@ -1170,14 +1170,14 @@ void main_1(thread QuicksortObject* const tint_symbol_84, thread float4* const t
int const x_836 = i_2; int const x_836 = i_2;
i_2 = 0; i_2 = 0;
i_2 = x_836; i_2 = x_836;
float3 const x_479 = float3(float2(0.0f, 0.0f)[1], x_454[1], float2(0.0f, 0.0f)[0]); float3 const x_479 = float3(float2()[1], x_454[1], float2()[0]);
int const x_837 = (*(tint_symbol_84)).numbers.arr[0u]; int const x_837 = (*(tint_symbol_84)).numbers.arr[0u];
(*(tint_symbol_84)).numbers.arr[0u] = 0; (*(tint_symbol_84)).numbers.arr[0u] = 0;
(*(tint_symbol_84)).numbers.arr[0u] = x_837; (*(tint_symbol_84)).numbers.arr[0u] = x_837;
float const x_838 = color[1]; float const x_838 = color[1];
color[1] = 0.0f; color[1] = 0.0f;
color[1] = x_838; color[1] = x_838;
float3 const x_480 = float3(x_446[0], x_446[0], float2(0.0f, 0.0f)[1]); float3 const x_480 = float3(x_446[0], x_446[0], float2()[1]);
float const x_839 = uv[0]; float const x_839 = uv[0];
uv[0] = 0.0f; uv[0] = 0.0f;
uv[0] = x_839; uv[0] = x_839;
@ -1384,7 +1384,7 @@ void main_1(thread QuicksortObject* const tint_symbol_84, thread float4* const t
float const x_891 = color[1]; float const x_891 = color[1];
color[1] = 0.0f; color[1] = 0.0f;
color[1] = x_891; color[1] = x_891;
float2 const x_504 = float2(x_453[1], float2(0.0f, 0.0f)[0]); float2 const x_504 = float2(x_453[1], float2()[0]);
float const x_892 = color[0]; float const x_892 = color[0];
color[0] = 0.0f; color[0] = 0.0f;
color[0] = x_892; color[0] = x_892;
@ -1487,7 +1487,7 @@ void main_1(thread QuicksortObject* const tint_symbol_84, thread float4* const t
float const x_918 = uv[0]; float const x_918 = uv[0];
uv[0] = 0.0f; uv[0] = 0.0f;
uv[0] = x_918; uv[0] = x_918;
float3 const x_517 = float3(float2(0.0f, 0.0f)[0], float2(0.0f, 0.0f)[0], float2(0.0f, 0.0f)[1]); float3 const x_517 = float3(float2()[0], float2()[0], float2()[1]);
color[0] = (float(x_317) + x_320); color[0] = (float(x_317) + x_320);
float const x_919 = color[0]; float const x_919 = color[0];
color[0] = 0.0f; color[0] = 0.0f;

View File

@ -1325,8 +1325,8 @@
%893 = OpLoad %QuicksortObject %obj %893 = OpLoad %QuicksortObject %obj
OpStore %obj %103 OpStore %obj %103
OpStore %obj %893 OpStore %obj %893
%894 = OpCompositeExtract %float %876 0 %894 = OpCompositeExtract %float %168 0
%895 = OpCompositeExtract %float %876 0 %895 = OpCompositeExtract %float %168 0
%896 = OpCompositeConstruct %v2float %894 %895 %896 = OpCompositeConstruct %v2float %894 %895
%897 = OpLoad %int %i_2 %897 = OpLoad %int %i_2
OpStore %i_2 %int_0 OpStore %i_2 %int_0
@ -1339,8 +1339,8 @@
%901 = OpLoad %v2float %uv %901 = OpLoad %v2float %uv
OpStore %uv %876 OpStore %uv %876
OpStore %uv %901 OpStore %uv %901
%902 = OpCompositeExtract %float %876 1 %902 = OpCompositeExtract %float %168 1
%903 = OpCompositeExtract %float %876 1 %903 = OpCompositeExtract %float %168 1
%904 = OpCompositeConstruct %v2float %902 %903 %904 = OpCompositeConstruct %v2float %902 %903
%905 = OpLoad %v2float %uv %905 = OpLoad %v2float %uv
OpStore %uv %876 OpStore %uv %876
@ -1473,7 +1473,7 @@
OpStore %988 %int_0 OpStore %988 %int_0
%989 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_0 %989 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_0
OpStore %989 %987 OpStore %989 %987
%990 = OpCompositeExtract %float %876 1 %990 = OpCompositeExtract %float %168 1
%991 = OpCompositeExtract %float %912 1 %991 = OpCompositeExtract %float %912 1
%992 = OpCompositeExtract %float %912 1 %992 = OpCompositeExtract %float %912 1
%993 = OpCompositeConstruct %v3float %990 %991 %992 %993 = OpCompositeConstruct %v3float %990 %991 %992
@ -1498,7 +1498,7 @@
OpStore %obj %103 OpStore %obj %103
OpStore %obj %1005 OpStore %obj %1005
%1006 = OpCompositeExtract %float %38 2 %1006 = OpCompositeExtract %float %38 2
%1007 = OpCompositeExtract %float %876 1 %1007 = OpCompositeExtract %float %168 1
%1008 = OpCompositeConstruct %v2float %1006 %1007 %1008 = OpCompositeConstruct %v2float %1006 %1007
%1009 = OpLoad %int %i_2 %1009 = OpLoad %int %i_2
OpStore %i_2 %int_0 OpStore %i_2 %int_0
@ -1572,8 +1572,8 @@
OpStore %1054 %float_0 OpStore %1054 %float_0
%1055 = OpAccessChain %_ptr_Function_float %uv %uint_0 %1055 = OpAccessChain %_ptr_Function_float %uv %uint_0
OpStore %1055 %1053 OpStore %1055 %1053
%1056 = OpCompositeExtract %float %876 1 %1056 = OpCompositeExtract %float %168 1
%1057 = OpCompositeExtract %float %876 1 %1057 = OpCompositeExtract %float %168 1
%1058 = OpCompositeConstruct %v2float %1056 %1057 %1058 = OpCompositeConstruct %v2float %1056 %1057
%1059 = OpAccessChain %_ptr_Function_float %uv %uint_0 %1059 = OpAccessChain %_ptr_Function_float %uv %uint_0
%1060 = OpLoad %float %1059 %1060 = OpLoad %float %1059
@ -1666,7 +1666,7 @@
OpStore %i_2 %int_0 OpStore %i_2 %int_0
OpStore %i_2 %1125 OpStore %i_2 %1125
%1126 = OpCompositeExtract %float %975 1 %1126 = OpCompositeExtract %float %975 1
%1127 = OpCompositeExtract %float %876 1 %1127 = OpCompositeExtract %float %168 1
%1128 = OpCompositeConstruct %v2float %1126 %1127 %1128 = OpCompositeConstruct %v2float %1126 %1127
%1129 = OpLoad %int %i_2 %1129 = OpLoad %int %i_2
OpStore %i_2 %int_0 OpStore %i_2 %int_0
@ -1764,8 +1764,8 @@
OpStore %1193 %int_0 OpStore %1193 %int_0
%1194 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_0 %1194 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_0
OpStore %1194 %1192 OpStore %1194 %1192
%1195 = OpCompositeExtract %float %876 0 %1195 = OpCompositeExtract %float %168 0
%1196 = OpCompositeExtract %float %876 1 %1196 = OpCompositeExtract %float %168 1
%1197 = OpCompositeConstruct %v2float %1195 %1196 %1197 = OpCompositeConstruct %v2float %1195 %1196
%1198 = OpAccessChain %_ptr_Function_float %color %uint_2 %1198 = OpAccessChain %_ptr_Function_float %color %uint_2
%1199 = OpLoad %float %1198 %1199 = OpLoad %float %1198
@ -1855,9 +1855,9 @@
%1261 = OpConvertSToF %float %1219 %1261 = OpConvertSToF %float %1219
%1262 = OpFAdd %float %1241 %1261 %1262 = OpFAdd %float %1241 %1261
OpStore %1260 %1262 OpStore %1260 %1262
%1263 = OpCompositeExtract %float %876 0 %1263 = OpCompositeExtract %float %168 0
%1264 = OpCompositeExtract %float %1216 0 %1264 = OpCompositeExtract %float %1216 0
%1265 = OpCompositeExtract %float %876 1 %1265 = OpCompositeExtract %float %168 1
%1266 = OpCompositeConstruct %v3float %1263 %1264 %1265 %1266 = OpCompositeConstruct %v3float %1263 %1264 %1265
%1267 = OpAccessChain %_ptr_Function_float %uv %uint_0 %1267 = OpAccessChain %_ptr_Function_float %uv %uint_0
%1268 = OpLoad %float %1267 %1268 = OpLoad %float %1267
@ -1885,9 +1885,9 @@
%1284 = OpLoad %int %i_2 %1284 = OpLoad %int %i_2
OpStore %i_2 %int_0 OpStore %i_2 %int_0
OpStore %i_2 %1284 OpStore %i_2 %1284
%1285 = OpCompositeExtract %float %876 1 %1285 = OpCompositeExtract %float %168 1
%1286 = OpCompositeExtract %float %970 1 %1286 = OpCompositeExtract %float %970 1
%1287 = OpCompositeExtract %float %876 0 %1287 = OpCompositeExtract %float %168 0
%1288 = OpCompositeConstruct %v3float %1285 %1286 %1287 %1288 = OpCompositeConstruct %v3float %1285 %1286 %1287
%1289 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_0 %1289 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_0
%1290 = OpLoad %int %1289 %1290 = OpLoad %int %1289
@ -1903,7 +1903,7 @@
OpStore %1296 %1294 OpStore %1296 %1294
%1297 = OpCompositeExtract %float %896 0 %1297 = OpCompositeExtract %float %896 0
%1298 = OpCompositeExtract %float %896 0 %1298 = OpCompositeExtract %float %896 0
%1299 = OpCompositeExtract %float %876 1 %1299 = OpCompositeExtract %float %168 1
%1300 = OpCompositeConstruct %v3float %1297 %1298 %1299 %1300 = OpCompositeConstruct %v3float %1297 %1298 %1299
%1301 = OpAccessChain %_ptr_Function_float %uv %uint_0 %1301 = OpAccessChain %_ptr_Function_float %uv %uint_0
%1302 = OpLoad %float %1301 %1302 = OpLoad %float %1301
@ -2308,7 +2308,7 @@
%1588 = OpAccessChain %_ptr_Function_float %color %uint_1 %1588 = OpAccessChain %_ptr_Function_float %color %uint_1
OpStore %1588 %1586 OpStore %1588 %1586
%1589 = OpCompositeExtract %float %962 1 %1589 = OpCompositeExtract %float %962 1
%1590 = OpCompositeExtract %float %876 0 %1590 = OpCompositeExtract %float %168 0
%1591 = OpCompositeConstruct %v2float %1589 %1590 %1591 = OpCompositeConstruct %v2float %1589 %1590
%1592 = OpAccessChain %_ptr_Function_float %color %uint_0 %1592 = OpAccessChain %_ptr_Function_float %color %uint_0
%1593 = OpLoad %float %1592 %1593 = OpLoad %float %1592
@ -2517,9 +2517,9 @@
OpStore %1743 %float_0 OpStore %1743 %float_0
%1744 = OpAccessChain %_ptr_Function_float %uv %uint_0 %1744 = OpAccessChain %_ptr_Function_float %uv %uint_0
OpStore %1744 %1742 OpStore %1744 %1742
%1745 = OpCompositeExtract %float %876 0 %1745 = OpCompositeExtract %float %168 0
%1746 = OpCompositeExtract %float %876 0 %1746 = OpCompositeExtract %float %168 0
%1747 = OpCompositeExtract %float %876 1 %1747 = OpCompositeExtract %float %168 1
%1748 = OpCompositeConstruct %v3float %1745 %1746 %1747 %1748 = OpCompositeConstruct %v3float %1745 %1746 %1747
%1749 = OpAccessChain %_ptr_Function_float %color %uint_0 %1749 = OpAccessChain %_ptr_Function_float %color %uint_0
%1750 = OpConvertSToF %float %1714 %1750 = OpConvertSToF %float %1714

View File

@ -800,7 +800,7 @@ fn main_1() {
let x_756 : QuicksortObject = obj; let x_756 : QuicksortObject = obj;
obj = QuicksortObject(array<i32, 10u>(0, 0, 0, 0, 0, 0, 0, 0, 0, 0)); obj = QuicksortObject(array<i32, 10u>(0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
obj = x_756; obj = x_756;
let x_446 : vec2<f32> = vec2<f32>(vec2<f32>(0.0, 0.0).x, vec2<f32>(0.0, 0.0).x); let x_446 : vec2<f32> = vec2<f32>(vec2<f32>().x, vec2<f32>().x);
let x_757 : i32 = i_2; let x_757 : i32 = i_2;
i_2 = 0; i_2 = 0;
i_2 = x_757; i_2 = x_757;
@ -812,7 +812,7 @@ fn main_1() {
let x_759 : vec2<f32> = uv; let x_759 : vec2<f32> = uv;
uv = vec2<f32>(0.0, 0.0); uv = vec2<f32>(0.0, 0.0);
uv = x_759; uv = x_759;
let x_447 : vec2<f32> = vec2<f32>(vec2<f32>(0.0, 0.0).y, vec2<f32>(0.0, 0.0).y); let x_447 : vec2<f32> = vec2<f32>(vec2<f32>().y, vec2<f32>().y);
let x_760 : vec2<f32> = uv; let x_760 : vec2<f32> = uv;
uv = vec2<f32>(0.0, 0.0); uv = vec2<f32>(0.0, 0.0);
uv = x_760; uv = x_760;
@ -898,7 +898,7 @@ fn main_1() {
let x_781 : i32 = *(x_200); let x_781 : i32 = *(x_200);
*(x_200) = 0; *(x_200) = 0;
*(x_200) = x_781; *(x_200) = x_781;
let x_456 : vec3<f32> = vec3<f32>(vec2<f32>(0.0, 0.0).y, x_448.y, x_448.y); let x_456 : vec3<f32> = vec3<f32>(vec2<f32>().y, x_448.y, x_448.y);
let x_782 : f32 = uv.x; let x_782 : f32 = uv.x;
uv.x = 0.0; uv.x = 0.0;
uv.x = x_782; uv.x = x_782;
@ -913,7 +913,7 @@ fn main_1() {
let x_785 : QuicksortObject = obj; let x_785 : QuicksortObject = obj;
obj = QuicksortObject(array<i32, 10u>(0, 0, 0, 0, 0, 0, 0, 0, 0, 0)); obj = QuicksortObject(array<i32, 10u>(0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
obj = x_785; obj = x_785;
let x_458 : vec2<f32> = vec2<f32>(vec3<f32>(1.0, 2.0, 3.0).z, vec2<f32>(0.0, 0.0).y); let x_458 : vec2<f32> = vec2<f32>(vec3<f32>(1.0, 2.0, 3.0).z, vec2<f32>().y);
let x_786 : i32 = i_2; let x_786 : i32 = i_2;
i_2 = 0; i_2 = 0;
i_2 = x_786; i_2 = x_786;
@ -953,7 +953,7 @@ fn main_1() {
let x_796 : f32 = uv.x; let x_796 : f32 = uv.x;
uv.x = 0.0; uv.x = 0.0;
uv.x = x_796; uv.x = x_796;
let x_461 : vec2<f32> = vec2<f32>(vec2<f32>(0.0, 0.0).y, vec2<f32>(0.0, 0.0).y); let x_461 : vec2<f32> = vec2<f32>(vec2<f32>().y, vec2<f32>().y);
let x_797 : f32 = uv.x; let x_797 : f32 = uv.x;
uv.x = 0.0; uv.x = 0.0;
uv.x = x_797; uv.x = x_797;
@ -998,7 +998,7 @@ fn main_1() {
let x_808 : i32 = i_2; let x_808 : i32 = i_2;
i_2 = 0; i_2 = 0;
i_2 = x_808; i_2 = x_808;
let x_466 : vec2<f32> = vec2<f32>(x_455.y, vec2<f32>(0.0, 0.0).y); let x_466 : vec2<f32> = vec2<f32>(x_455.y, vec2<f32>().y);
let x_809 : i32 = i_2; let x_809 : i32 = i_2;
i_2 = 0; i_2 = 0;
i_2 = x_809; i_2 = x_809;
@ -1050,7 +1050,7 @@ fn main_1() {
let x_822 : i32 = *(x_200); let x_822 : i32 = *(x_200);
*(x_200) = 0; *(x_200) = 0;
*(x_200) = x_822; *(x_200) = x_822;
let x_470 : vec2<f32> = vec2<f32>(vec2<f32>(0.0, 0.0).x, vec2<f32>(0.0, 0.0).y); let x_470 : vec2<f32> = vec2<f32>(vec2<f32>().x, vec2<f32>().y);
let x_823 : f32 = color.z; let x_823 : f32 = color.z;
color.z = 0.0; color.z = 0.0;
color.z = x_823; color.z = x_823;
@ -1093,7 +1093,7 @@ fn main_1() {
color.x = x_832; color.x = x_832;
let x_476 : vec2<f32> = vec2<f32>(x_451.z, x_460.y); let x_476 : vec2<f32> = vec2<f32>(x_451.z, x_460.y);
color.y = (x_257 + f32(x_254)); color.y = (x_257 + f32(x_254));
let x_477 : vec3<f32> = vec3<f32>(vec2<f32>(0.0, 0.0).x, x_472.x, vec2<f32>(0.0, 0.0).y); let x_477 : vec3<f32> = vec3<f32>(vec2<f32>().x, x_472.x, vec2<f32>().y);
let x_833 : f32 = uv.x; let x_833 : f32 = uv.x;
uv.x = 0.0; uv.x = 0.0;
uv.x = x_833; uv.x = x_833;
@ -1108,14 +1108,14 @@ fn main_1() {
let x_836 : i32 = i_2; let x_836 : i32 = i_2;
i_2 = 0; i_2 = 0;
i_2 = x_836; i_2 = x_836;
let x_479 : vec3<f32> = vec3<f32>(vec2<f32>(0.0, 0.0).y, x_454.y, vec2<f32>(0.0, 0.0).x); let x_479 : vec3<f32> = vec3<f32>(vec2<f32>().y, x_454.y, vec2<f32>().x);
let x_837 : i32 = *(x_200); let x_837 : i32 = *(x_200);
*(x_200) = 0; *(x_200) = 0;
*(x_200) = x_837; *(x_200) = x_837;
let x_838 : f32 = color.y; let x_838 : f32 = color.y;
color.y = 0.0; color.y = 0.0;
color.y = x_838; color.y = x_838;
let x_480 : vec3<f32> = vec3<f32>(x_446.x, x_446.x, vec2<f32>(0.0, 0.0).y); let x_480 : vec3<f32> = vec3<f32>(x_446.x, x_446.x, vec2<f32>().y);
let x_839 : f32 = uv.x; let x_839 : f32 = uv.x;
uv.x = 0.0; uv.x = 0.0;
uv.x = x_839; uv.x = x_839;
@ -1318,7 +1318,7 @@ fn main_1() {
let x_891 : f32 = color.y; let x_891 : f32 = color.y;
color.y = 0.0; color.y = 0.0;
color.y = x_891; color.y = x_891;
let x_504 : vec2<f32> = vec2<f32>(x_453.y, vec2<f32>(0.0, 0.0).x); let x_504 : vec2<f32> = vec2<f32>(x_453.y, vec2<f32>().x);
let x_892 : f32 = color.x; let x_892 : f32 = color.x;
color.x = 0.0; color.x = 0.0;
color.x = x_892; color.x = x_892;
@ -1419,7 +1419,7 @@ fn main_1() {
let x_918 : f32 = uv.x; let x_918 : f32 = uv.x;
uv.x = 0.0; uv.x = 0.0;
uv.x = x_918; uv.x = x_918;
let x_517 : vec3<f32> = vec3<f32>(vec2<f32>(0.0, 0.0).x, vec2<f32>(0.0, 0.0).x, vec2<f32>(0.0, 0.0).y); let x_517 : vec3<f32> = vec3<f32>(vec2<f32>().x, vec2<f32>().x, vec2<f32>().y);
color.x = (f32(x_317) + x_320); color.x = (f32(x_317) + x_320);
let x_919 : f32 = color.x; let x_919 : f32 = color.x;
color.x = 0.0; color.x = 0.0;

View File

@ -9,7 +9,7 @@ struct tint_symbol_3 {
}; };
void textureDimensions_f60bdb(depth2d_ms<float, access::read> tint_symbol_5) { void textureDimensions_f60bdb(depth2d_ms<float, access::read> tint_symbol_5) {
int2 res = int2(0, 0); int2 res = int2();
int2 const x_16 = int2(int2(tint_symbol_5.get_width(), tint_symbol_5.get_height())); int2 const x_16 = int2(int2(tint_symbol_5.get_width(), tint_symbol_5.get_height()));
res = x_16; res = x_16;
return; return;
@ -22,7 +22,7 @@ void tint_symbol_2(float4 tint_symbol, thread float4* const tint_symbol_6) {
void vertex_main_1(depth2d_ms<float, access::read> tint_symbol_7, thread float4* const tint_symbol_8) { void vertex_main_1(depth2d_ms<float, access::read> tint_symbol_7, thread float4* const tint_symbol_8) {
textureDimensions_f60bdb(tint_symbol_7); textureDimensions_f60bdb(tint_symbol_7);
tint_symbol_2(float4(0.0f, 0.0f, 0.0f, 0.0f), tint_symbol_8); tint_symbol_2(float4(), tint_symbol_8);
return; return;
} }
@ -33,7 +33,7 @@ vertex_main_out vertex_main_inner(depth2d_ms<float, access::read> tint_symbol_9,
} }
vertex tint_symbol_3 vertex_main(depth2d_ms<float, access::read> tint_symbol_11 [[texture(0)]]) { vertex tint_symbol_3 vertex_main(depth2d_ms<float, access::read> tint_symbol_11 [[texture(0)]]) {
thread float4 tint_symbol_12 = float4(0.0f, 0.0f, 0.0f, 0.0f); thread float4 tint_symbol_12 = float4();
vertex_main_out const inner_result = vertex_main_inner(tint_symbol_11, &(tint_symbol_12)); vertex_main_out const inner_result = vertex_main_inner(tint_symbol_11, &(tint_symbol_12));
tint_symbol_3 wrapper_result = {}; tint_symbol_3 wrapper_result = {};
wrapper_result.tint_symbol_1_1 = inner_result.tint_symbol_1_1; wrapper_result.tint_symbol_1_1 = inner_result.tint_symbol_1_1;

View File

@ -1,7 +1,7 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 62 ; Bound: 58
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpCapability ImageQuery OpCapability ImageQuery
@ -44,75 +44,71 @@
%11 = OpTypeImage %float 2D 1 0 1 1 Unknown %11 = OpTypeImage %float 2D 1 0 1 1 Unknown
%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 %_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
%arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
%float_0 = OpConstant %float 0
%13 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0
%_ptr_Private_v4float = OpTypePointer Private %v4float %_ptr_Private_v4float = OpTypePointer Private %v4float
%tint_symbol_1 = OpVariable %_ptr_Private_v4float Private %13 %tint_symbol_1 = OpVariable %_ptr_Private_v4float Private %5
%void = OpTypeVoid %void = OpTypeVoid
%16 = OpTypeFunction %void %14 = OpTypeFunction %void
%int = OpTypeInt 32 1 %int = OpTypeInt 32 1
%v2int = OpTypeVector %int 2 %v2int = OpTypeVector %int 2
%int_0 = OpConstant %int 0 %20 = OpConstantNull %v2int
%23 = OpConstantComposite %v2int %int_0 %int_0
%_ptr_Function_v2int = OpTypePointer Function %v2int %_ptr_Function_v2int = OpTypePointer Function %v2int
%26 = OpConstantNull %v2int %26 = OpTypeFunction %void %v4float
%30 = OpTypeFunction %void %v4float
%vertex_main_out = OpTypeStruct %v4float %vertex_main_out = OpTypeStruct %v4float
%38 = OpTypeFunction %vertex_main_out %34 = OpTypeFunction %vertex_main_out
%float_1 = OpConstant %float 1 %float_1 = OpConstant %float 1
%textureDimensions_f60bdb = OpFunction %void None %16 %textureDimensions_f60bdb = OpFunction %void None %14
%19 = OpLabel %17 = OpLabel
%res = OpVariable %_ptr_Function_v2int Function %26 %res = OpVariable %_ptr_Function_v2int Function %20
OpStore %res %23 OpStore %res %20
%29 = OpLoad %11 %arg_0 %25 = OpLoad %11 %arg_0
%28 = OpImageQuerySize %v2int %29 %24 = OpImageQuerySize %v2int %25
OpStore %res %28 OpStore %res %24
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%tint_symbol_2 = OpFunction %void None %30 %tint_symbol_2 = OpFunction %void None %26
%tint_symbol = OpFunctionParameter %v4float %tint_symbol = OpFunctionParameter %v4float
%33 = OpLabel %29 = OpLabel
OpStore %tint_symbol_1 %tint_symbol OpStore %tint_symbol_1 %tint_symbol
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%vertex_main_1 = OpFunction %void None %16 %vertex_main_1 = OpFunction %void None %14
%35 = OpLabel %31 = OpLabel
%36 = OpFunctionCall %void %textureDimensions_f60bdb %32 = OpFunctionCall %void %textureDimensions_f60bdb
%37 = OpFunctionCall %void %tint_symbol_2 %13 %33 = OpFunctionCall %void %tint_symbol_2 %5
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%vertex_main_inner = OpFunction %vertex_main_out None %38 %vertex_main_inner = OpFunction %vertex_main_out None %34
%41 = OpLabel %37 = OpLabel
%42 = OpFunctionCall %void %vertex_main_1 %38 = OpFunctionCall %void %vertex_main_1
%43 = OpLoad %v4float %tint_symbol_1 %39 = OpLoad %v4float %tint_symbol_1
%44 = OpCompositeConstruct %vertex_main_out %43 %40 = OpCompositeConstruct %vertex_main_out %39
OpReturnValue %44 OpReturnValue %40
OpFunctionEnd OpFunctionEnd
%vertex_main = OpFunction %void None %16 %vertex_main = OpFunction %void None %14
%46 = OpLabel %42 = OpLabel
%47 = OpFunctionCall %vertex_main_out %vertex_main_inner %43 = OpFunctionCall %vertex_main_out %vertex_main_inner
%48 = OpCompositeExtract %v4float %47 0 %44 = OpCompositeExtract %v4float %43 0
OpStore %tint_symbol_1_1_1 %48 OpStore %tint_symbol_1_1_1 %44
OpStore %vertex_point_size %float_1 OpStore %vertex_point_size %float_1
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%fragment_main_1 = OpFunction %void None %16 %fragment_main_1 = OpFunction %void None %14
%51 = OpLabel %47 = OpLabel
%52 = OpFunctionCall %void %textureDimensions_f60bdb %48 = OpFunctionCall %void %textureDimensions_f60bdb
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%fragment_main = OpFunction %void None %16 %fragment_main = OpFunction %void None %14
%54 = OpLabel %50 = OpLabel
%55 = OpFunctionCall %void %fragment_main_1 %51 = OpFunctionCall %void %fragment_main_1
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%compute_main_1 = OpFunction %void None %16 %compute_main_1 = OpFunction %void None %14
%57 = OpLabel %53 = OpLabel
%58 = OpFunctionCall %void %textureDimensions_f60bdb %54 = OpFunctionCall %void %textureDimensions_f60bdb
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%compute_main = OpFunction %void None %16 %compute_main = OpFunction %void None %14
%60 = OpLabel %56 = OpLabel
%61 = OpFunctionCall %void %compute_main_1 %57 = OpFunctionCall %void %compute_main_1
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -1,9 +1,9 @@
[[group(1), binding(0)]] var arg_0 : texture_depth_multisampled_2d; [[group(1), binding(0)]] var arg_0 : texture_depth_multisampled_2d;
var<private> tint_symbol_1 : vec4<f32> = vec4<f32>(0.0, 0.0, 0.0, 0.0); var<private> tint_symbol_1 : vec4<f32> = vec4<f32>();
fn textureDimensions_f60bdb() { fn textureDimensions_f60bdb() {
var res : vec2<i32> = vec2<i32>(0, 0); var res : vec2<i32> = vec2<i32>();
let x_16 : vec2<i32> = vec2<i32>(textureDimensions(arg_0)); let x_16 : vec2<i32> = vec2<i32>(textureDimensions(arg_0));
res = x_16; res = x_16;
return; return;
@ -16,7 +16,7 @@ fn tint_symbol_2(tint_symbol : vec4<f32>) {
fn vertex_main_1() { fn vertex_main_1() {
textureDimensions_f60bdb(); textureDimensions_f60bdb();
tint_symbol_2(vec4<f32>(0.0, 0.0, 0.0, 0.0)); tint_symbol_2(vec4<f32>());
return; return;
} }

View File

@ -10,7 +10,7 @@ struct tint_symbol_3 {
void textureLoad_6273b1(depth2d_ms<float, access::read> tint_symbol_5) { void textureLoad_6273b1(depth2d_ms<float, access::read> tint_symbol_5) {
float res = 0.0f; float res = 0.0f;
float4 const x_17 = float4(tint_symbol_5.read(uint2(int2(0, 0)), 1), 0.0f, 0.0f, 0.0f); float4 const x_17 = float4(tint_symbol_5.read(uint2(int2()), 1), 0.0f, 0.0f, 0.0f);
res = x_17[0]; res = x_17[0];
return; return;
} }
@ -22,7 +22,7 @@ void tint_symbol_2(float4 tint_symbol, thread float4* const tint_symbol_6) {
void vertex_main_1(depth2d_ms<float, access::read> tint_symbol_7, thread float4* const tint_symbol_8) { void vertex_main_1(depth2d_ms<float, access::read> tint_symbol_7, thread float4* const tint_symbol_8) {
textureLoad_6273b1(tint_symbol_7); textureLoad_6273b1(tint_symbol_7);
tint_symbol_2(float4(0.0f, 0.0f, 0.0f, 0.0f), tint_symbol_8); tint_symbol_2(float4(), tint_symbol_8);
return; return;
} }
@ -33,7 +33,7 @@ vertex_main_out vertex_main_inner(depth2d_ms<float, access::read> tint_symbol_9,
} }
vertex tint_symbol_3 vertex_main(depth2d_ms<float, access::read> tint_symbol_11 [[texture(0)]]) { vertex tint_symbol_3 vertex_main(depth2d_ms<float, access::read> tint_symbol_11 [[texture(0)]]) {
thread float4 tint_symbol_12 = float4(0.0f, 0.0f, 0.0f, 0.0f); thread float4 tint_symbol_12 = float4();
vertex_main_out const inner_result = vertex_main_inner(tint_symbol_11, &(tint_symbol_12)); vertex_main_out const inner_result = vertex_main_inner(tint_symbol_11, &(tint_symbol_12));
tint_symbol_3 wrapper_result = {}; tint_symbol_3 wrapper_result = {};
wrapper_result.tint_symbol_1_1 = inner_result.tint_symbol_1_1; wrapper_result.tint_symbol_1_1 = inner_result.tint_symbol_1_1;

View File

@ -1,7 +1,7 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 64 ; Bound: 62
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
@ -43,78 +43,76 @@
%11 = OpTypeImage %float 2D 1 0 1 1 Unknown %11 = OpTypeImage %float 2D 1 0 1 1 Unknown
%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 %_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
%arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
%float_0 = OpConstant %float 0
%13 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0
%_ptr_Private_v4float = OpTypePointer Private %v4float %_ptr_Private_v4float = OpTypePointer Private %v4float
%tint_symbol_1 = OpVariable %_ptr_Private_v4float Private %13 %tint_symbol_1 = OpVariable %_ptr_Private_v4float Private %5
%void = OpTypeVoid %void = OpTypeVoid
%16 = OpTypeFunction %void %14 = OpTypeFunction %void
%float_0 = OpConstant %float 0
%_ptr_Function_float = OpTypePointer Function %float %_ptr_Function_float = OpTypePointer Function %float
%int = OpTypeInt 32 1 %int = OpTypeInt 32 1
%v2int = OpTypeVector %int 2 %v2int = OpTypeVector %int 2
%int_0 = OpConstant %int 0 %26 = OpConstantNull %v2int
%28 = OpConstantComposite %v2int %int_0 %int_0
%int_1 = OpConstant %int 1 %int_1 = OpConstant %int 1
%32 = OpTypeFunction %void %v4float %30 = OpTypeFunction %void %v4float
%vertex_main_out = OpTypeStruct %v4float %vertex_main_out = OpTypeStruct %v4float
%40 = OpTypeFunction %vertex_main_out %38 = OpTypeFunction %vertex_main_out
%float_1 = OpConstant %float 1 %float_1 = OpConstant %float 1
%textureLoad_6273b1 = OpFunction %void None %16 %textureLoad_6273b1 = OpFunction %void None %14
%19 = OpLabel %17 = OpLabel
%res = OpVariable %_ptr_Function_float Function %8 %res = OpVariable %_ptr_Function_float Function %8
OpStore %res %float_0 OpStore %res %float_0
%24 = OpLoad %11 %arg_0 %23 = OpLoad %11 %arg_0
%23 = OpImageFetch %v4float %24 %28 Sample %int_1 %22 = OpImageFetch %v4float %23 %26 Sample %int_1
%22 = OpCompositeExtract %float %23 0 %21 = OpCompositeExtract %float %22 0
%30 = OpCompositeConstruct %v4float %22 %float_0 %float_0 %float_0 %28 = OpCompositeConstruct %v4float %21 %float_0 %float_0 %float_0
%31 = OpCompositeExtract %float %30 0 %29 = OpCompositeExtract %float %28 0
OpStore %res %31 OpStore %res %29
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%tint_symbol_2 = OpFunction %void None %32 %tint_symbol_2 = OpFunction %void None %30
%tint_symbol = OpFunctionParameter %v4float %tint_symbol = OpFunctionParameter %v4float
%35 = OpLabel %33 = OpLabel
OpStore %tint_symbol_1 %tint_symbol OpStore %tint_symbol_1 %tint_symbol
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%vertex_main_1 = OpFunction %void None %16 %vertex_main_1 = OpFunction %void None %14
%37 = OpLabel %35 = OpLabel
%38 = OpFunctionCall %void %textureLoad_6273b1 %36 = OpFunctionCall %void %textureLoad_6273b1
%39 = OpFunctionCall %void %tint_symbol_2 %13 %37 = OpFunctionCall %void %tint_symbol_2 %5
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%vertex_main_inner = OpFunction %vertex_main_out None %40 %vertex_main_inner = OpFunction %vertex_main_out None %38
%43 = OpLabel %41 = OpLabel
%44 = OpFunctionCall %void %vertex_main_1 %42 = OpFunctionCall %void %vertex_main_1
%45 = OpLoad %v4float %tint_symbol_1 %43 = OpLoad %v4float %tint_symbol_1
%46 = OpCompositeConstruct %vertex_main_out %45 %44 = OpCompositeConstruct %vertex_main_out %43
OpReturnValue %46 OpReturnValue %44
OpFunctionEnd OpFunctionEnd
%vertex_main = OpFunction %void None %16 %vertex_main = OpFunction %void None %14
%48 = OpLabel %46 = OpLabel
%49 = OpFunctionCall %vertex_main_out %vertex_main_inner %47 = OpFunctionCall %vertex_main_out %vertex_main_inner
%50 = OpCompositeExtract %v4float %49 0 %48 = OpCompositeExtract %v4float %47 0
OpStore %tint_symbol_1_1_1 %50 OpStore %tint_symbol_1_1_1 %48
OpStore %vertex_point_size %float_1 OpStore %vertex_point_size %float_1
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%fragment_main_1 = OpFunction %void None %16 %fragment_main_1 = OpFunction %void None %14
%53 = OpLabel %51 = OpLabel
%54 = OpFunctionCall %void %textureLoad_6273b1 %52 = OpFunctionCall %void %textureLoad_6273b1
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%fragment_main = OpFunction %void None %16 %fragment_main = OpFunction %void None %14
%56 = OpLabel %54 = OpLabel
%57 = OpFunctionCall %void %fragment_main_1 %55 = OpFunctionCall %void %fragment_main_1
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%compute_main_1 = OpFunction %void None %16 %compute_main_1 = OpFunction %void None %14
%59 = OpLabel %57 = OpLabel
%60 = OpFunctionCall %void %textureLoad_6273b1 %58 = OpFunctionCall %void %textureLoad_6273b1
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%compute_main = OpFunction %void None %16 %compute_main = OpFunction %void None %14
%62 = OpLabel %60 = OpLabel
%63 = OpFunctionCall %void %compute_main_1 %61 = OpFunctionCall %void %compute_main_1
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -1,10 +1,10 @@
[[group(1), binding(0)]] var arg_0 : texture_depth_multisampled_2d; [[group(1), binding(0)]] var arg_0 : texture_depth_multisampled_2d;
var<private> tint_symbol_1 : vec4<f32> = vec4<f32>(0.0, 0.0, 0.0, 0.0); var<private> tint_symbol_1 : vec4<f32> = vec4<f32>();
fn textureLoad_6273b1() { fn textureLoad_6273b1() {
var res : f32 = 0.0; var res : f32 = 0.0;
let x_17 : vec4<f32> = vec4<f32>(textureLoad(arg_0, vec2<i32>(0, 0), 1), 0.0, 0.0, 0.0); let x_17 : vec4<f32> = vec4<f32>(textureLoad(arg_0, vec2<i32>(), 1), 0.0, 0.0, 0.0);
res = x_17.x; res = x_17.x;
return; return;
} }
@ -16,7 +16,7 @@ fn tint_symbol_2(tint_symbol : vec4<f32>) {
fn vertex_main_1() { fn vertex_main_1() {
textureLoad_6273b1(); textureLoad_6273b1();
tint_symbol_2(vec4<f32>(0.0, 0.0, 0.0, 0.0)); tint_symbol_2(vec4<f32>());
return; return;
} }

View File

@ -22,7 +22,7 @@ void tint_symbol_2(float4 tint_symbol, thread float4* const tint_symbol_6) {
void vertex_main_1(depth2d_ms<float, access::read> tint_symbol_7, thread float4* const tint_symbol_8) { void vertex_main_1(depth2d_ms<float, access::read> tint_symbol_7, thread float4* const tint_symbol_8) {
textureNumSamples_a3c8a0(tint_symbol_7); textureNumSamples_a3c8a0(tint_symbol_7);
tint_symbol_2(float4(0.0f, 0.0f, 0.0f, 0.0f), tint_symbol_8); tint_symbol_2(float4(), tint_symbol_8);
return; return;
} }
@ -33,7 +33,7 @@ vertex_main_out vertex_main_inner(depth2d_ms<float, access::read> tint_symbol_9,
} }
vertex tint_symbol_3 vertex_main(depth2d_ms<float, access::read> tint_symbol_11 [[texture(0)]]) { vertex tint_symbol_3 vertex_main(depth2d_ms<float, access::read> tint_symbol_11 [[texture(0)]]) {
thread float4 tint_symbol_12 = float4(0.0f, 0.0f, 0.0f, 0.0f); thread float4 tint_symbol_12 = float4();
vertex_main_out const inner_result = vertex_main_inner(tint_symbol_11, &(tint_symbol_12)); vertex_main_out const inner_result = vertex_main_inner(tint_symbol_11, &(tint_symbol_12));
tint_symbol_3 wrapper_result = {}; tint_symbol_3 wrapper_result = {};
wrapper_result.tint_symbol_1_1 = inner_result.tint_symbol_1_1; wrapper_result.tint_symbol_1_1 = inner_result.tint_symbol_1_1;

View File

@ -1,7 +1,7 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 59 ; Bound: 57
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpCapability ImageQuery OpCapability ImageQuery
@ -44,73 +44,71 @@
%11 = OpTypeImage %float 2D 1 0 1 1 Unknown %11 = OpTypeImage %float 2D 1 0 1 1 Unknown
%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 %_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
%arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
%float_0 = OpConstant %float 0
%13 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0
%_ptr_Private_v4float = OpTypePointer Private %v4float %_ptr_Private_v4float = OpTypePointer Private %v4float
%tint_symbol_1 = OpVariable %_ptr_Private_v4float Private %13 %tint_symbol_1 = OpVariable %_ptr_Private_v4float Private %5
%void = OpTypeVoid %void = OpTypeVoid
%16 = OpTypeFunction %void %14 = OpTypeFunction %void
%int = OpTypeInt 32 1 %int = OpTypeInt 32 1
%int_0 = OpConstant %int 0 %int_0 = OpConstant %int 0
%_ptr_Function_int = OpTypePointer Function %int %_ptr_Function_int = OpTypePointer Function %int
%24 = OpConstantNull %int %22 = OpConstantNull %int
%27 = OpTypeFunction %void %v4float %25 = OpTypeFunction %void %v4float
%vertex_main_out = OpTypeStruct %v4float %vertex_main_out = OpTypeStruct %v4float
%35 = OpTypeFunction %vertex_main_out %33 = OpTypeFunction %vertex_main_out
%float_1 = OpConstant %float 1 %float_1 = OpConstant %float 1
%textureNumSamples_a3c8a0 = OpFunction %void None %16 %textureNumSamples_a3c8a0 = OpFunction %void None %14
%19 = OpLabel %17 = OpLabel
%res = OpVariable %_ptr_Function_int Function %24 %res = OpVariable %_ptr_Function_int Function %22
OpStore %res %int_0 OpStore %res %int_0
%26 = OpLoad %11 %arg_0 %24 = OpLoad %11 %arg_0
%25 = OpImageQuerySamples %int %26 %23 = OpImageQuerySamples %int %24
OpStore %res %25 OpStore %res %23
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%tint_symbol_2 = OpFunction %void None %27 %tint_symbol_2 = OpFunction %void None %25
%tint_symbol = OpFunctionParameter %v4float %tint_symbol = OpFunctionParameter %v4float
%30 = OpLabel %28 = OpLabel
OpStore %tint_symbol_1 %tint_symbol OpStore %tint_symbol_1 %tint_symbol
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%vertex_main_1 = OpFunction %void None %16 %vertex_main_1 = OpFunction %void None %14
%32 = OpLabel %30 = OpLabel
%33 = OpFunctionCall %void %textureNumSamples_a3c8a0 %31 = OpFunctionCall %void %textureNumSamples_a3c8a0
%34 = OpFunctionCall %void %tint_symbol_2 %13 %32 = OpFunctionCall %void %tint_symbol_2 %5
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%vertex_main_inner = OpFunction %vertex_main_out None %35 %vertex_main_inner = OpFunction %vertex_main_out None %33
%38 = OpLabel %36 = OpLabel
%39 = OpFunctionCall %void %vertex_main_1 %37 = OpFunctionCall %void %vertex_main_1
%40 = OpLoad %v4float %tint_symbol_1 %38 = OpLoad %v4float %tint_symbol_1
%41 = OpCompositeConstruct %vertex_main_out %40 %39 = OpCompositeConstruct %vertex_main_out %38
OpReturnValue %41 OpReturnValue %39
OpFunctionEnd OpFunctionEnd
%vertex_main = OpFunction %void None %16 %vertex_main = OpFunction %void None %14
%43 = OpLabel %41 = OpLabel
%44 = OpFunctionCall %vertex_main_out %vertex_main_inner %42 = OpFunctionCall %vertex_main_out %vertex_main_inner
%45 = OpCompositeExtract %v4float %44 0 %43 = OpCompositeExtract %v4float %42 0
OpStore %tint_symbol_1_1_1 %45 OpStore %tint_symbol_1_1_1 %43
OpStore %vertex_point_size %float_1 OpStore %vertex_point_size %float_1
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%fragment_main_1 = OpFunction %void None %16 %fragment_main_1 = OpFunction %void None %14
%48 = OpLabel %46 = OpLabel
%49 = OpFunctionCall %void %textureNumSamples_a3c8a0 %47 = OpFunctionCall %void %textureNumSamples_a3c8a0
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%fragment_main = OpFunction %void None %16 %fragment_main = OpFunction %void None %14
%51 = OpLabel %49 = OpLabel
%52 = OpFunctionCall %void %fragment_main_1 %50 = OpFunctionCall %void %fragment_main_1
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%compute_main_1 = OpFunction %void None %16 %compute_main_1 = OpFunction %void None %14
%54 = OpLabel %52 = OpLabel
%55 = OpFunctionCall %void %textureNumSamples_a3c8a0 %53 = OpFunctionCall %void %textureNumSamples_a3c8a0
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%compute_main = OpFunction %void None %16 %compute_main = OpFunction %void None %14
%57 = OpLabel %55 = OpLabel
%58 = OpFunctionCall %void %compute_main_1 %56 = OpFunctionCall %void %compute_main_1
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -1,6 +1,6 @@
[[group(1), binding(0)]] var arg_0 : texture_depth_multisampled_2d; [[group(1), binding(0)]] var arg_0 : texture_depth_multisampled_2d;
var<private> tint_symbol_1 : vec4<f32> = vec4<f32>(0.0, 0.0, 0.0, 0.0); var<private> tint_symbol_1 : vec4<f32> = vec4<f32>();
fn textureNumSamples_a3c8a0() { fn textureNumSamples_a3c8a0() {
var res : i32 = 0; var res : i32 = 0;
@ -16,7 +16,7 @@ fn tint_symbol_2(tint_symbol : vec4<f32>) {
fn vertex_main_1() { fn vertex_main_1() {
textureNumSamples_a3c8a0(); textureNumSamples_a3c8a0();
tint_symbol_2(vec4<f32>(0.0, 0.0, 0.0, 0.0)); tint_symbol_2(vec4<f32>());
return; return;
} }

View File

@ -1,5 +1,5 @@
void main_1() { void main_1() {
float3x3 m = float3x3(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f)); float3x3 m = float3x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
m = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f)); m = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f));
m[1] = float3(5.0f, 5.0f, 5.0f); m[1] = float3(5.0f, 5.0f, 5.0f);
return; return;

View File

@ -2,7 +2,7 @@
using namespace metal; using namespace metal;
void main_1() { void main_1() {
float3x3 m = float3x3(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f)); float3x3 m = float3x3();
m = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f)); m = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f));
m[1] = float3(5.0f, 5.0f, 5.0f); m[1] = float3(5.0f, 5.0f, 5.0f);
return; return;

View File

@ -1,7 +1,7 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 35 ; Bound: 32
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
@ -15,39 +15,36 @@
%float = OpTypeFloat 32 %float = OpTypeFloat 32
%v3float = OpTypeVector %float 3 %v3float = OpTypeVector %float 3
%mat3v3float = OpTypeMatrix %v3float 3 %mat3v3float = OpTypeMatrix %v3float 3
%float_0 = OpConstant %float 0 %8 = OpConstantNull %mat3v3float
%9 = OpConstantComposite %v3float %float_0 %float_0 %float_0
%10 = OpConstantComposite %mat3v3float %9 %9 %9
%_ptr_Function_mat3v3float = OpTypePointer Function %mat3v3float %_ptr_Function_mat3v3float = OpTypePointer Function %mat3v3float
%13 = OpConstantNull %mat3v3float
%float_1 = OpConstant %float 1 %float_1 = OpConstant %float 1
%float_2 = OpConstant %float 2 %float_2 = OpConstant %float 2
%float_3 = OpConstant %float 3 %float_3 = OpConstant %float 3
%17 = OpConstantComposite %v3float %float_1 %float_2 %float_3 %14 = OpConstantComposite %v3float %float_1 %float_2 %float_3
%float_4 = OpConstant %float 4 %float_4 = OpConstant %float 4
%float_5 = OpConstant %float 5 %float_5 = OpConstant %float 5
%float_6 = OpConstant %float 6 %float_6 = OpConstant %float 6
%21 = OpConstantComposite %v3float %float_4 %float_5 %float_6 %18 = OpConstantComposite %v3float %float_4 %float_5 %float_6
%float_7 = OpConstant %float 7 %float_7 = OpConstant %float 7
%float_8 = OpConstant %float 8 %float_8 = OpConstant %float 8
%float_9 = OpConstant %float 9 %float_9 = OpConstant %float 9
%25 = OpConstantComposite %v3float %float_7 %float_8 %float_9 %22 = OpConstantComposite %v3float %float_7 %float_8 %float_9
%26 = OpConstantComposite %mat3v3float %17 %21 %25 %23 = OpConstantComposite %mat3v3float %14 %18 %22
%int = OpTypeInt 32 1 %int = OpTypeInt 32 1
%int_1 = OpConstant %int 1 %int_1 = OpConstant %int 1
%_ptr_Function_v3float = OpTypePointer Function %v3float %_ptr_Function_v3float = OpTypePointer Function %v3float
%31 = OpConstantComposite %v3float %float_5 %float_5 %float_5 %28 = OpConstantComposite %v3float %float_5 %float_5 %float_5
%main_1 = OpFunction %void None %1 %main_1 = OpFunction %void None %1
%4 = OpLabel %4 = OpLabel
%m = OpVariable %_ptr_Function_mat3v3float Function %13 %m = OpVariable %_ptr_Function_mat3v3float Function %8
OpStore %m %10 OpStore %m %8
OpStore %m %26 OpStore %m %23
%30 = OpAccessChain %_ptr_Function_v3float %m %int_1 %27 = OpAccessChain %_ptr_Function_v3float %m %int_1
OpStore %30 %31 OpStore %27 %28
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%main = OpFunction %void None %1 %main = OpFunction %void None %1
%33 = OpLabel %30 = OpLabel
%34 = OpFunctionCall %void %main_1 %31 = OpFunctionCall %void %main_1
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -1,5 +1,5 @@
fn main_1() { fn main_1() {
var m : mat3x3<f32> = mat3x3<f32>(vec3<f32>(0.0, 0.0, 0.0), vec3<f32>(0.0, 0.0, 0.0), vec3<f32>(0.0, 0.0, 0.0)); var m : mat3x3<f32> = mat3x3<f32>();
m = mat3x3<f32>(vec3<f32>(1.0, 2.0, 3.0), vec3<f32>(4.0, 5.0, 6.0), vec3<f32>(7.0, 8.0, 9.0)); m = mat3x3<f32>(vec3<f32>(1.0, 2.0, 3.0), vec3<f32>(4.0, 5.0, 6.0), vec3<f32>(7.0, 8.0, 9.0));
m[1] = vec3<f32>(5.0, 5.0, 5.0); m[1] = vec3<f32>(5.0, 5.0, 5.0);
return; return;