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

View File

@ -340,7 +340,7 @@ TEST_F(SpvParserFunctionVarTest, EmitFunctionVariables_ArrayInitializer_Null) {
auto ast_body = fe.ast_body();
EXPECT_THAT(
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,
@ -368,7 +368,7 @@ TEST_F(SpvParserFunctionVarTest,
auto ast_body = fe.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) {
@ -412,7 +412,7 @@ TEST_F(SpvParserFunctionVarTest, EmitFunctionVariables_StructInitializer_Null) {
auto ast_body = fe.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,
@ -1525,7 +1525,7 @@ TEST_F(SpvParserFunctionVarTest, EmitStatement_Hoist_CompositeInsert) {
const auto* expected = R"(var x_200 : vec2<i32>;
if (true) {
x_200 = vec2<i32>(0, 0);
x_200 = vec2<i32>();
x_200.x = 0;
} else {
return;
@ -1568,7 +1568,7 @@ TEST_F(SpvParserFunctionVarTest, EmitStatement_Hoist_VectorInsertDynamic) {
const auto got = test::ToString(p->program(), ast_body);
const auto* expected = R"(var x_200 : vec2<i32>;
if (true) {
x_200 = vec2<i32>(0, 0);
x_200 = vec2<i32>();
x_200[1] = 3;
} else {
return;

View File

@ -2001,37 +2001,8 @@ const ast::Expression* ParserImpl::MakeNullValue(const Type* type) {
if (type->Is<F32>()) {
return create<ast::FloatLiteralExpression>(Source{}, 0.0f);
}
if (type->Is<Alias>()) {
// TODO(amaiorano): No type constructor for TypeName (yet?)
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 (type->IsAnyOf<Vector, Matrix, Array>()) {
return builder_.Construct(Source{}, type->Build(builder_));
}
if (auto* struct_ty = type->As<Struct>()) {
ast::ExpressionList ast_components;

View File

@ -3945,8 +3945,8 @@ TEST_F(SpvParserHandleTest,
auto ast_body = fe.ast_body();
const auto got = test::ToString(p->program(), ast_body);
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_26 : 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>());
var_1 = (x_22 + x_26);
return;
)";

View File

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

View File

@ -1,5 +1,5 @@
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 float x_16 = x_15.y;
return;

View File

@ -2,7 +2,7 @@
using namespace metal;
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];
float const x_16 = x_15[1];
return;

View File

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

View File

@ -1,5 +1,5 @@
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_16 : f32 = x_15.y;
return;

View File

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

View File

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

View File

@ -1,5 +1,5 @@
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_16 : vec3<f32> = v;
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};
*(tint_symbol_84) = tint_symbol_43;
*(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;
i_2 = 0;
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;
uv = float2(0.0f, 0.0f);
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;
uv = float2(0.0f, 0.0f);
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];
(*(tint_symbol_84)).numbers.arr[0u] = 0;
(*(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];
uv[0] = 0.0f;
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};
*(tint_symbol_84) = tint_symbol_63;
*(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;
i_2 = 0;
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];
uv[0] = 0.0f;
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];
uv[0] = 0.0f;
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;
i_2 = 0;
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;
i_2 = 0;
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];
(*(tint_symbol_84)).numbers.arr[0u] = 0;
(*(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];
color[2] = 0.0f;
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;
float2 const x_476 = float2(x_451[2], x_460[1]);
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];
uv[0] = 0.0f;
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;
i_2 = 0;
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];
(*(tint_symbol_84)).numbers.arr[0u] = 0;
(*(tint_symbol_84)).numbers.arr[0u] = x_837;
float const x_838 = color[1];
color[1] = 0.0f;
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];
uv[0] = 0.0f;
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];
color[1] = 0.0f;
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];
color[0] = 0.0f;
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];
uv[0] = 0.0f;
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);
float const x_919 = color[0];
color[0] = 0.0f;

View File

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

View File

@ -800,7 +800,7 @@ fn main_1() {
let x_756 : QuicksortObject = obj;
obj = QuicksortObject(array<i32, 10u>(0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
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;
i_2 = 0;
i_2 = x_757;
@ -812,7 +812,7 @@ fn main_1() {
let x_759 : vec2<f32> = uv;
uv = vec2<f32>(0.0, 0.0);
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;
uv = vec2<f32>(0.0, 0.0);
uv = x_760;
@ -898,7 +898,7 @@ fn main_1() {
let x_781 : i32 = *(x_200);
*(x_200) = 0;
*(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;
uv.x = 0.0;
uv.x = x_782;
@ -913,7 +913,7 @@ fn main_1() {
let x_785 : QuicksortObject = obj;
obj = QuicksortObject(array<i32, 10u>(0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
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;
i_2 = 0;
i_2 = x_786;
@ -953,7 +953,7 @@ fn main_1() {
let x_796 : f32 = uv.x;
uv.x = 0.0;
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;
uv.x = 0.0;
uv.x = x_797;
@ -998,7 +998,7 @@ fn main_1() {
let x_808 : i32 = i_2;
i_2 = 0;
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;
i_2 = 0;
i_2 = x_809;
@ -1050,7 +1050,7 @@ fn main_1() {
let x_822 : i32 = *(x_200);
*(x_200) = 0;
*(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;
color.z = 0.0;
color.z = x_823;
@ -1093,7 +1093,7 @@ fn main_1() {
color.x = x_832;
let x_476 : vec2<f32> = vec2<f32>(x_451.z, x_460.y);
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;
uv.x = 0.0;
uv.x = x_833;
@ -1108,14 +1108,14 @@ fn main_1() {
let x_836 : i32 = i_2;
i_2 = 0;
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);
*(x_200) = 0;
*(x_200) = x_837;
let x_838 : f32 = color.y;
color.y = 0.0;
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;
uv.x = 0.0;
uv.x = x_839;
@ -1318,7 +1318,7 @@ fn main_1() {
let x_891 : f32 = color.y;
color.y = 0.0;
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;
color.x = 0.0;
color.x = x_892;
@ -1419,7 +1419,7 @@ fn main_1() {
let x_918 : f32 = uv.x;
uv.x = 0.0;
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);
let x_919 : f32 = color.x;
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) {
int2 res = int2(0, 0);
int2 res = int2();
int2 const x_16 = int2(int2(tint_symbol_5.get_width(), tint_symbol_5.get_height()));
res = x_16;
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) {
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;
}
@ -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)]]) {
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));
tint_symbol_3 wrapper_result = {};
wrapper_result.tint_symbol_1_1 = inner_result.tint_symbol_1_1;

View File

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

View File

@ -1,9 +1,9 @@
[[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() {
var res : vec2<i32> = vec2<i32>(0, 0);
var res : vec2<i32> = vec2<i32>();
let x_16 : vec2<i32> = vec2<i32>(textureDimensions(arg_0));
res = x_16;
return;
@ -16,7 +16,7 @@ fn tint_symbol_2(tint_symbol : vec4<f32>) {
fn vertex_main_1() {
textureDimensions_f60bdb();
tint_symbol_2(vec4<f32>(0.0, 0.0, 0.0, 0.0));
tint_symbol_2(vec4<f32>());
return;
}

View File

@ -10,7 +10,7 @@ struct tint_symbol_3 {
void textureLoad_6273b1(depth2d_ms<float, access::read> tint_symbol_5) {
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];
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) {
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;
}
@ -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)]]) {
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));
tint_symbol_3 wrapper_result = {};
wrapper_result.tint_symbol_1_1 = inner_result.tint_symbol_1_1;

View File

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

View File

@ -1,10 +1,10 @@
[[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() {
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;
return;
}
@ -16,7 +16,7 @@ fn tint_symbol_2(tint_symbol : vec4<f32>) {
fn vertex_main_1() {
textureLoad_6273b1();
tint_symbol_2(vec4<f32>(0.0, 0.0, 0.0, 0.0));
tint_symbol_2(vec4<f32>());
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) {
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;
}
@ -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)]]) {
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));
tint_symbol_3 wrapper_result = {};
wrapper_result.tint_symbol_1_1 = inner_result.tint_symbol_1_1;

View File

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

View File

@ -1,6 +1,6 @@
[[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() {
var res : i32 = 0;
@ -16,7 +16,7 @@ fn tint_symbol_2(tint_symbol : vec4<f32>) {
fn vertex_main_1() {
textureNumSamples_a3c8a0();
tint_symbol_2(vec4<f32>(0.0, 0.0, 0.0, 0.0));
tint_symbol_2(vec4<f32>());
return;
}

View File

@ -1,5 +1,5 @@
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[1] = float3(5.0f, 5.0f, 5.0f);
return;

View File

@ -2,7 +2,7 @@
using namespace metal;
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[1] = float3(5.0f, 5.0f, 5.0f);
return;

View File

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

View File

@ -1,5 +1,5 @@
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[1] = vec3<f32>(5.0, 5.0, 5.0);
return;