tint: Add PreservePadding transform

This is used to ensure that assignments to host-visible memory do not
modify padding bytes in structures and arrays. We decompose
assignments of whole structure and array types into member-wise or
element-wise copies, using helper functions.

This is used in all backends except HLSL, which already decomposes
memory accesses.

Bug: tint:1571
Change-Id: Id6de2f917fb80151cc654a7e1c8413ae956f0d61
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112720
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
This commit is contained in:
James Price 2022-12-06 18:32:19 +00:00 committed by Dawn LUCI CQ
parent f2b8d2b1ab
commit 8753796aac
90 changed files with 5411 additions and 1972 deletions

View File

@ -526,6 +526,9 @@ std::string AlignDeco(uint32_t value) {
// Test different types used as a struct member // Test different types used as a struct member
TEST_P(ComputeLayoutMemoryBufferTests, StructMember) { TEST_P(ComputeLayoutMemoryBufferTests, StructMember) {
// TODO(crbug.com/dawn/1606): find out why these tests fail on Windows for OpenGL.
DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES() && IsWindows());
// Sentinel value markers codes used to check that the start and end of // Sentinel value markers codes used to check that the start and end of
// structures are correctly aligned. Each of these codes are distinct and // structures are correctly aligned. Each of these codes are distinct and
// are not likely to be confused with data. // are not likely to be confused with data.
@ -694,6 +697,9 @@ fn main() {
// Test different types that used directly as buffer type // Test different types that used directly as buffer type
TEST_P(ComputeLayoutMemoryBufferTests, NonStructMember) { TEST_P(ComputeLayoutMemoryBufferTests, NonStructMember) {
// TODO(crbug.com/dawn/1606): find out why these tests fail on Windows for OpenGL.
DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES() && IsWindows());
auto params = GetParam(); auto params = GetParam();
Field& field = params.mField; Field& field = params.mField;

View File

@ -529,6 +529,8 @@ libtint_source_set("libtint_core_all_src") {
"transform/packed_vec3.h", "transform/packed_vec3.h",
"transform/pad_structs.cc", "transform/pad_structs.cc",
"transform/pad_structs.h", "transform/pad_structs.h",
"transform/preserve_padding.cc",
"transform/preserve_padding.h",
"transform/promote_initializers_to_let.cc", "transform/promote_initializers_to_let.cc",
"transform/promote_initializers_to_let.h", "transform/promote_initializers_to_let.h",
"transform/promote_side_effects_to_decl.cc", "transform/promote_side_effects_to_decl.cc",
@ -1244,6 +1246,7 @@ if (tint_build_unittests) {
"transform/num_workgroups_from_uniform_test.cc", "transform/num_workgroups_from_uniform_test.cc",
"transform/packed_vec3_test.cc", "transform/packed_vec3_test.cc",
"transform/pad_structs_test.cc", "transform/pad_structs_test.cc",
"transform/preserve_padding_test.cc",
"transform/promote_initializers_to_let_test.cc", "transform/promote_initializers_to_let_test.cc",
"transform/promote_side_effects_to_decl_test.cc", "transform/promote_side_effects_to_decl_test.cc",
"transform/remove_continue_in_switch_test.cc", "transform/remove_continue_in_switch_test.cc",

View File

@ -453,6 +453,8 @@ list(APPEND TINT_LIB_SRCS
transform/packed_vec3.h transform/packed_vec3.h
transform/pad_structs.cc transform/pad_structs.cc
transform/pad_structs.h transform/pad_structs.h
transform/preserve_padding.cc
transform/preserve_padding.h
transform/promote_initializers_to_let.cc transform/promote_initializers_to_let.cc
transform/promote_initializers_to_let.h transform/promote_initializers_to_let.h
transform/promote_side_effects_to_decl.cc transform/promote_side_effects_to_decl.cc
@ -1212,6 +1214,7 @@ if(TINT_BUILD_TESTS)
transform/num_workgroups_from_uniform_test.cc transform/num_workgroups_from_uniform_test.cc
transform/packed_vec3_test.cc transform/packed_vec3_test.cc
transform/pad_structs_test.cc transform/pad_structs_test.cc
transform/preserve_padding_test.cc
transform/promote_initializers_to_let_test.cc transform/promote_initializers_to_let_test.cc
transform/promote_side_effects_to_decl_test.cc transform/promote_side_effects_to_decl_test.cc
transform/remove_continue_in_switch_test.cc transform/remove_continue_in_switch_test.cc

View File

@ -0,0 +1,226 @@
// Copyright 2022 The Tint Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "src/tint/transform/preserve_padding.h"
#include <unordered_set>
#include <utility>
#include "src/tint/program_builder.h"
#include "src/tint/sem/reference.h"
#include "src/tint/sem/struct.h"
#include "src/tint/utils/map.h"
#include "src/tint/utils/vector.h"
TINT_INSTANTIATE_TYPEINFO(tint::transform::PreservePadding);
using namespace tint::number_suffixes; // NOLINT
namespace tint::transform {
PreservePadding::PreservePadding() = default;
PreservePadding::~PreservePadding() = default;
/// The PIMPL state for the PreservePadding transform
struct PreservePadding::State {
/// Constructor
/// @param src the source Program
explicit State(const Program* src) : ctx{&b, src, /* auto_clone_symbols */ true} {}
/// The main function for the transform.
/// @returns the ApplyResult
ApplyResult Run() {
// Gather a list of assignments that need to be transformed.
std::unordered_set<const ast::AssignmentStatement*> assignments_to_transform;
for (auto* node : ctx.src->ASTNodes().Objects()) {
Switch(
node, //
[&](const ast::AssignmentStatement* assign) {
auto* ty = sem.Get(assign->lhs)->Type();
if (assign->lhs->Is<ast::PhonyExpression>()) {
// Ignore phony assignment.
return;
}
if (ty->As<sem::Reference>()->AddressSpace() != ast::AddressSpace::kStorage) {
// We only care about assignments that write to variables in the storage
// address space, as nothing else is host-visible.
return;
}
if (HasPadding(ty->UnwrapRef())) {
// The assigned type has padding bytes, so we need to decompose the writes.
assignments_to_transform.insert(assign);
}
},
[&](const ast::Enable* enable) {
// Check if the full pointer parameters extension is already enabled.
if (enable->extension ==
ast::Extension::kChromiumExperimentalFullPtrParameters) {
ext_enabled = true;
}
});
}
if (assignments_to_transform.empty()) {
return SkipTransform;
}
// Replace all assignments that include padding with decomposed versions.
ctx.ReplaceAll([&](const ast::AssignmentStatement* assign) -> const ast::Statement* {
if (!assignments_to_transform.count(assign)) {
return nullptr;
}
auto* ty = sem.Get(assign->lhs)->Type()->UnwrapRef();
return MakeAssignment(ty, ctx.Clone(assign->lhs), ctx.Clone(assign->rhs));
});
ctx.Clone();
return Program(std::move(b));
}
/// Create a statement that will perform the assignment `lhs = rhs`, creating and using helper
/// functions to decompose the assignment into element-wise copies if needed.
/// @param ty the type of the assignment
/// @param lhs the lhs expression (in the destination program)
/// @param rhs the rhs expression (in the destination program)
/// @returns the statement that performs the assignment
const ast::Statement* MakeAssignment(const sem::Type* ty,
const ast::Expression* lhs,
const ast::Expression* rhs) {
if (!HasPadding(ty)) {
// No padding - use a regular assignment.
return b.Assign(lhs, rhs);
}
// Call (and create if necessary) a helper function that assigns a composite using the
// statements in `body`. The helper will have the form:
// fn assign_helper_T(dest : ptr<storage, T, read_write>, value : T) {
// <body>
// }
// It will be called by passing a pointer to the original LHS:
// assign_helper_T(&lhs, rhs);
//
// Since this requires passing pointers to the storage address space, this will also enable
// the chromium_experimental_full_ptr_parameters extension.
constexpr const char* kDestParamName = "dest";
constexpr const char* kValueParamName = "value";
auto call_helper = [&](auto&& body) {
EnableExtension();
auto helper = helpers.GetOrCreate(ty, [&]() {
auto helper_name = b.Symbols().New("assign_and_preserve_padding");
utils::Vector<const ast::Parameter*, 2> params = {
b.Param(kDestParamName,
b.ty.pointer(CreateASTTypeFor(ctx, ty), ast::AddressSpace::kStorage,
ast::Access::kReadWrite)),
b.Param(kValueParamName, CreateASTTypeFor(ctx, ty)),
};
b.Func(helper_name, params, b.ty.void_(), body());
return helper_name;
});
return b.CallStmt(b.Call(helper, b.AddressOf(lhs), rhs));
};
return Switch(
ty, //
[&](const sem::Array* arr) {
// Call a helper function that uses a loop to assigns each element separately.
return call_helper([&]() {
utils::Vector<const ast::Statement*, 8> body;
auto* idx = b.Var("i", b.Expr(0_u));
body.Push(
b.For(b.Decl(idx), b.LessThan(idx, u32(arr->ConstantCount().value())),
b.Assign(idx, b.Add(idx, 1_u)),
b.Block(MakeAssignment(arr->ElemType(),
b.IndexAccessor(b.Deref(kDestParamName), idx),
b.IndexAccessor(kValueParamName, idx)))));
return body;
});
},
[&](const sem::Struct* str) {
// Call a helper function that assigns each member separately.
return call_helper([&]() {
utils::Vector<const ast::Statement*, 8> body;
for (auto member : str->Members()) {
auto name = sym.NameFor(member->Declaration()->symbol);
body.Push(MakeAssignment(member->Type(),
b.MemberAccessor(b.Deref(kDestParamName), name),
b.MemberAccessor(kValueParamName, name)));
}
return body;
});
},
[&](Default) {
TINT_ICE(Transform, b.Diagnostics()) << "unhandled type with padding";
return nullptr;
});
}
/// Checks if a type contains padding bytes.
/// @param ty the type to check
/// @returns true if `ty` (or any of its contained types) have padding bytes
bool HasPadding(const sem::Type* ty) {
return Switch(
ty, //
[&](const sem::Array* arr) {
auto* elem_ty = arr->ElemType();
if (elem_ty->Size() % elem_ty->Align() > 0) {
return true;
}
return HasPadding(elem_ty);
},
[&](const sem::Struct* str) {
uint32_t current_offset = 0;
for (auto* member : str->Members()) {
if (member->Offset() > current_offset) {
return true;
}
if (HasPadding(member->Type())) {
return true;
}
current_offset += member->Type()->Size();
}
return (current_offset < str->Size());
},
[&](Default) { return false; });
}
/// Enable the full pointer parameters extension, if we have not already done so.
void EnableExtension() {
if (!ext_enabled) {
b.Enable(ast::Extension::kChromiumExperimentalFullPtrParameters);
ext_enabled = true;
}
}
private:
/// The program builder
ProgramBuilder b;
/// The clone context
CloneContext ctx;
/// Alias to the semantic info in ctx.src
const sem::Info& sem = ctx.src->Sem();
/// Alias to the symbols in ctx.src
const SymbolTable& sym = ctx.src->Symbols();
/// Flag to track whether we have already enabled the full pointer parameters extension.
bool ext_enabled = false;
/// Map of semantic types to their assignment helper functions.
utils::Hashmap<const sem::Type*, Symbol, 8> helpers;
};
Transform::ApplyResult PreservePadding::Apply(const Program* program,
const DataMap&,
DataMap&) const {
return State(program).Run();
}
} // namespace tint::transform

View File

@ -0,0 +1,47 @@
// Copyright 2022 The Tint Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef SRC_TINT_TRANSFORM_PRESERVE_PADDING_H_
#define SRC_TINT_TRANSFORM_PRESERVE_PADDING_H_
#include "src/tint/transform/transform.h"
namespace tint::transform {
/// Decompose assignments of whole structure and array types to preserve padding bytes.
///
/// WGSL states that memory operations on structures and arrays will not access padding bytes. To
/// avoid overwriting padding bytes when writing to buffers, this transform decomposes those
/// assignments into element-wise assignments via helper functions.
///
/// @note Assumes that the DirectVariableTransform will be run afterwards for backends that need it.
class PreservePadding final : public Castable<PreservePadding, Transform> {
public:
/// Constructor
PreservePadding();
/// Destructor
~PreservePadding() override;
/// @copydoc Transform::Apply
ApplyResult Apply(const Program* program,
const DataMap& inputs,
DataMap& outputs) const override;
private:
struct State;
};
} // namespace tint::transform
#endif // SRC_TINT_TRANSFORM_PRESERVE_PADDING_H_

View File

@ -0,0 +1,677 @@
// Copyright 2022 The Tint Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "src/tint/transform/preserve_padding.h"
#include <utility>
#include "src/tint/transform/test_helper.h"
namespace tint::transform {
namespace {
using PreservePaddingTest = TransformTest;
TEST_F(PreservePaddingTest, ShouldRun_EmptyModule) {
auto* src = R"()";
EXPECT_FALSE(ShouldRun<PreservePadding>(src));
}
TEST_F(PreservePaddingTest, ShouldRun_NonStructVec3) {
auto* src = R"(
@group(0) @binding(0) var<storage, read_write> v : vec3<u32>;
@compute @workgroup_size(1)
fn foo() {
v = vec3<u32>();
}
)";
EXPECT_FALSE(ShouldRun<PreservePadding>(src));
}
TEST_F(PreservePaddingTest, ShouldRun_StructWithoutPadding) {
auto* src = R"(
struct S {
a : u32,
b : u32,
c : u32,
d : u32,
e : vec3<u32>,
f : u32,
}
@group(0) @binding(0) var<storage, read_write> v : S;
@compute @workgroup_size(1)
fn foo() {
v = S();
}
)";
EXPECT_FALSE(ShouldRun<PreservePadding>(src));
}
TEST_F(PreservePaddingTest, ShouldRun_ArrayWithoutPadding) {
auto* src = R"(
@group(0) @binding(0) var<storage, read_write> v : array<vec4<u32>, 4>;
@compute @workgroup_size(1)
fn foo() {
v = array<vec4<u32>, 4>();
}
)";
EXPECT_FALSE(ShouldRun<PreservePadding>(src));
}
TEST_F(PreservePaddingTest, EmptyModule) {
auto* src = R"()";
auto* expect = src;
auto got = Run<PreservePadding>(src);
EXPECT_EQ(expect, str(got));
}
TEST_F(PreservePaddingTest, StructTrailingPadding) {
auto* src = R"(
struct S {
a : u32,
b : u32,
c : u32,
d : u32,
e : vec3<u32>,
}
@group(0) @binding(0) var<storage, read_write> v : S;
@compute @workgroup_size(1)
fn foo() {
v = S();
}
)";
auto* expect = R"(
enable chromium_experimental_full_ptr_parameters;
struct S {
a : u32,
b : u32,
c : u32,
d : u32,
e : vec3<u32>,
}
@group(0) @binding(0) var<storage, read_write> v : S;
fn assign_and_preserve_padding(dest : ptr<storage, S, read_write>, value : S) {
(*(dest)).a = value.a;
(*(dest)).b = value.b;
(*(dest)).c = value.c;
(*(dest)).d = value.d;
(*(dest)).e = value.e;
}
@compute @workgroup_size(1)
fn foo() {
assign_and_preserve_padding(&(v), S());
}
)";
auto got = Run<PreservePadding>(src);
EXPECT_EQ(expect, str(got));
}
TEST_F(PreservePaddingTest, StructInternalPadding) {
auto* src = R"(
struct S {
a : u32,
b : vec4<u32>,
}
@group(0) @binding(0) var<storage, read_write> v : S;
@compute @workgroup_size(1)
fn foo() {
v = S();
}
)";
auto* expect = R"(
enable chromium_experimental_full_ptr_parameters;
struct S {
a : u32,
b : vec4<u32>,
}
@group(0) @binding(0) var<storage, read_write> v : S;
fn assign_and_preserve_padding(dest : ptr<storage, S, read_write>, value : S) {
(*(dest)).a = value.a;
(*(dest)).b = value.b;
}
@compute @workgroup_size(1)
fn foo() {
assign_and_preserve_padding(&(v), S());
}
)";
auto got = Run<PreservePadding>(src);
EXPECT_EQ(expect, str(got));
}
TEST_F(PreservePaddingTest, StructExplicitSize_TrailingPadding) {
auto* src = R"(
struct S {
@size(16) a : u32,
}
@group(0) @binding(0) var<storage, read_write> v : S;
@compute @workgroup_size(1)
fn foo() {
v = S();
}
)";
auto* expect = R"(
enable chromium_experimental_full_ptr_parameters;
struct S {
@size(16)
a : u32,
}
@group(0) @binding(0) var<storage, read_write> v : S;
fn assign_and_preserve_padding(dest : ptr<storage, S, read_write>, value : S) {
(*(dest)).a = value.a;
}
@compute @workgroup_size(1)
fn foo() {
assign_and_preserve_padding(&(v), S());
}
)";
auto got = Run<PreservePadding>(src);
EXPECT_EQ(expect, str(got));
}
TEST_F(PreservePaddingTest, StructExplicitSize_InternalPadding) {
auto* src = R"(
struct S {
@size(16) a : u32,
b : u32,
}
@group(0) @binding(0) var<storage, read_write> v : S;
@compute @workgroup_size(1)
fn foo() {
v = S();
}
)";
auto* expect = R"(
enable chromium_experimental_full_ptr_parameters;
struct S {
@size(16)
a : u32,
b : u32,
}
@group(0) @binding(0) var<storage, read_write> v : S;
fn assign_and_preserve_padding(dest : ptr<storage, S, read_write>, value : S) {
(*(dest)).a = value.a;
(*(dest)).b = value.b;
}
@compute @workgroup_size(1)
fn foo() {
assign_and_preserve_padding(&(v), S());
}
)";
auto got = Run<PreservePadding>(src);
EXPECT_EQ(expect, str(got));
}
TEST_F(PreservePaddingTest, NestedStructs) {
auto* src = R"(
struct S1 {
a1 : u32,
b1 : vec3<u32>,
c1 : u32,
}
struct S2 {
a2 : u32,
b2 : S1,
c2 : S1,
}
struct S3 {
a3 : S1,
b3 : S2,
c3 : S2,
}
@group(0) @binding(0) var<storage, read_write> v : S3;
@compute @workgroup_size(1)
fn foo() {
v = S3();
}
)";
auto* expect = R"(
enable chromium_experimental_full_ptr_parameters;
struct S1 {
a1 : u32,
b1 : vec3<u32>,
c1 : u32,
}
struct S2 {
a2 : u32,
b2 : S1,
c2 : S1,
}
struct S3 {
a3 : S1,
b3 : S2,
c3 : S2,
}
@group(0) @binding(0) var<storage, read_write> v : S3;
fn assign_and_preserve_padding_1(dest : ptr<storage, S1, read_write>, value : S1) {
(*(dest)).a1 = value.a1;
(*(dest)).b1 = value.b1;
(*(dest)).c1 = value.c1;
}
fn assign_and_preserve_padding_2(dest : ptr<storage, S2, read_write>, value : S2) {
(*(dest)).a2 = value.a2;
assign_and_preserve_padding_1(&((*(dest)).b2), value.b2);
assign_and_preserve_padding_1(&((*(dest)).c2), value.c2);
}
fn assign_and_preserve_padding(dest : ptr<storage, S3, read_write>, value : S3) {
assign_and_preserve_padding_1(&((*(dest)).a3), value.a3);
assign_and_preserve_padding_2(&((*(dest)).b3), value.b3);
assign_and_preserve_padding_2(&((*(dest)).c3), value.c3);
}
@compute @workgroup_size(1)
fn foo() {
assign_and_preserve_padding(&(v), S3());
}
)";
auto got = Run<PreservePadding>(src);
EXPECT_EQ(expect, str(got));
}
TEST_F(PreservePaddingTest, ArrayOfVec3) {
auto* src = R"(
@group(0) @binding(0) var<storage, read_write> v : array<vec3<u32>, 4>;
@compute @workgroup_size(1)
fn foo() {
v = array<vec3<u32>, 4>();
}
)";
auto* expect = R"(
enable chromium_experimental_full_ptr_parameters;
@group(0) @binding(0) var<storage, read_write> v : array<vec3<u32>, 4>;
fn assign_and_preserve_padding(dest : ptr<storage, array<vec3<u32>, 4u>, read_write>, value : array<vec3<u32>, 4u>) {
for(var i = 0u; (i < 4u); i = (i + 1u)) {
(*(dest))[i] = value[i];
}
}
@compute @workgroup_size(1)
fn foo() {
assign_and_preserve_padding(&(v), array<vec3<u32>, 4>());
}
)";
auto got = Run<PreservePadding>(src);
EXPECT_EQ(expect, str(got));
}
TEST_F(PreservePaddingTest, ArrayOfArray) {
auto* src = R"(
type Array = array<array<vec3<u32>, 4>, 3>;
@group(0) @binding(0) var<storage, read_write> v : Array;
@compute @workgroup_size(1)
fn foo() {
v = Array();
}
)";
auto* expect = R"(
enable chromium_experimental_full_ptr_parameters;
type Array = array<array<vec3<u32>, 4>, 3>;
@group(0) @binding(0) var<storage, read_write> v : Array;
fn assign_and_preserve_padding_1(dest : ptr<storage, array<vec3<u32>, 4u>, read_write>, value : array<vec3<u32>, 4u>) {
for(var i = 0u; (i < 4u); i = (i + 1u)) {
(*(dest))[i] = value[i];
}
}
fn assign_and_preserve_padding(dest : ptr<storage, array<array<vec3<u32>, 4u>, 3u>, read_write>, value : array<array<vec3<u32>, 4u>, 3u>) {
for(var i = 0u; (i < 3u); i = (i + 1u)) {
assign_and_preserve_padding_1(&((*(dest))[i]), value[i]);
}
}
@compute @workgroup_size(1)
fn foo() {
assign_and_preserve_padding(&(v), Array());
}
)";
auto got = Run<PreservePadding>(src);
EXPECT_EQ(expect, str(got));
}
TEST_F(PreservePaddingTest, ArrayOfStructOfArray) {
auto* src = R"(
struct S {
a : u32,
b : array<vec3<u32>, 4>,
}
@group(0) @binding(0) var<storage, read_write> v : array<S, 3>;
@compute @workgroup_size(1)
fn foo() {
v = array<S, 3>();
}
)";
auto* expect = R"(
enable chromium_experimental_full_ptr_parameters;
struct S {
a : u32,
b : array<vec3<u32>, 4>,
}
@group(0) @binding(0) var<storage, read_write> v : array<S, 3>;
fn assign_and_preserve_padding_2(dest : ptr<storage, array<vec3<u32>, 4u>, read_write>, value : array<vec3<u32>, 4u>) {
for(var i = 0u; (i < 4u); i = (i + 1u)) {
(*(dest))[i] = value[i];
}
}
fn assign_and_preserve_padding_1(dest : ptr<storage, S, read_write>, value : S) {
(*(dest)).a = value.a;
assign_and_preserve_padding_2(&((*(dest)).b), value.b);
}
fn assign_and_preserve_padding(dest : ptr<storage, array<S, 3u>, read_write>, value : array<S, 3u>) {
for(var i = 0u; (i < 3u); i = (i + 1u)) {
assign_and_preserve_padding_1(&((*(dest))[i]), value[i]);
}
}
@compute @workgroup_size(1)
fn foo() {
assign_and_preserve_padding(&(v), array<S, 3>());
}
)";
auto got = Run<PreservePadding>(src);
EXPECT_EQ(expect, str(got));
}
TEST_F(PreservePaddingTest, NoModify_Vec3) {
auto* src = R"(
@group(0) @binding(0) var<storage, read_write> v : vec3<u32>;
@compute @workgroup_size(1)
fn foo() {
v = vec3<u32>();
}
)";
auto* expect = src;
auto got = Run<PreservePadding>(src);
EXPECT_EQ(expect, str(got));
}
TEST_F(PreservePaddingTest, AvoidDuplicateEnables) {
auto* src = R"(
enable chromium_experimental_full_ptr_parameters;
struct S {
@size(16) a : u32,
}
@group(0) @binding(0) var<storage, read_write> v : S;
@compute @workgroup_size(1)
fn foo() {
v = S();
}
)";
auto* expect = R"(
enable chromium_experimental_full_ptr_parameters;
struct S {
@size(16)
a : u32,
}
@group(0) @binding(0) var<storage, read_write> v : S;
fn assign_and_preserve_padding(dest : ptr<storage, S, read_write>, value : S) {
(*(dest)).a = value.a;
}
@compute @workgroup_size(1)
fn foo() {
assign_and_preserve_padding(&(v), S());
}
)";
auto got = Run<PreservePadding>(src);
EXPECT_EQ(expect, str(got));
}
TEST_F(PreservePaddingTest, NoModify_Mat3x3) {
auto* src = R"(
@group(0) @binding(0) var<storage, read_write> v : mat3x3<f32>;
@compute @workgroup_size(1)
fn foo() {
v = mat3x3<f32>();
}
)";
auto* expect = src;
auto got = Run<PreservePadding>(src);
EXPECT_EQ(expect, str(got));
}
TEST_F(PreservePaddingTest, NoModify_StructNoPadding) {
auto* src = R"(
struct S {
a : u32,
b : u32,
c : u32,
d : u32,
e : vec4<u32>,
}
@group(0) @binding(0) var<storage, read_write> v : S;
@compute @workgroup_size(1)
fn foo() {
v = S();
}
)";
auto* expect = src;
auto got = Run<PreservePadding>(src);
EXPECT_EQ(expect, str(got));
}
TEST_F(PreservePaddingTest, NoModify_ArrayNoPadding) {
auto* src = R"(
@group(0) @binding(0) var<storage, read_write> v : array<vec4<u32>, 4>;
@compute @workgroup_size(1)
fn foo() {
v = array<vec4<u32>, 4>();
}
)";
auto* expect = src;
auto got = Run<PreservePadding>(src);
EXPECT_EQ(expect, str(got));
}
TEST_F(PreservePaddingTest, NoModify_ArrayOfStructNoPadding) {
auto* src = R"(
struct S {
a : u32,
b : u32,
c : u32,
d : u32,
e : vec4<u32>,
}
@group(0) @binding(0) var<storage, read_write> v : array<S, 4>;
@compute @workgroup_size(1)
fn foo() {
v = array<S, 4>();
}
)";
auto* expect = src;
auto got = Run<PreservePadding>(src);
EXPECT_EQ(expect, str(got));
}
TEST_F(PreservePaddingTest, NoModify_Workgroup) {
auto* src = R"(
struct S {
a : u32,
b : vec3<u32>,
}
var<workgroup> v : S;
@compute @workgroup_size(1)
fn foo() {
v = S();
}
)";
auto* expect = src;
auto got = Run<PreservePadding>(src);
EXPECT_EQ(expect, str(got));
}
TEST_F(PreservePaddingTest, NoModify_Private) {
auto* src = R"(
struct S {
a : u32,
b : vec3<u32>,
}
var<private> v : S;
@compute @workgroup_size(1)
fn foo() {
v = S();
}
)";
auto* expect = src;
auto got = Run<PreservePadding>(src);
EXPECT_EQ(expect, str(got));
}
TEST_F(PreservePaddingTest, NoModify_Function) {
auto* src = R"(
struct S {
a : u32,
b : vec3<u32>,
}
@compute @workgroup_size(1)
fn foo() {
var<function> v : S;
v = S();
}
)";
auto* expect = src;
auto got = Run<PreservePadding>(src);
EXPECT_EQ(expect, str(got));
}
} // namespace
} // namespace tint::transform

View File

@ -59,6 +59,7 @@
#include "src/tint/transform/expand_compound_assignment.h" #include "src/tint/transform/expand_compound_assignment.h"
#include "src/tint/transform/manager.h" #include "src/tint/transform/manager.h"
#include "src/tint/transform/pad_structs.h" #include "src/tint/transform/pad_structs.h"
#include "src/tint/transform/preserve_padding.h"
#include "src/tint/transform/promote_initializers_to_let.h" #include "src/tint/transform/promote_initializers_to_let.h"
#include "src/tint/transform/promote_side_effects_to_decl.h" #include "src/tint/transform/promote_side_effects_to_decl.h"
#include "src/tint/transform/remove_phonies.h" #include "src/tint/transform/remove_phonies.h"
@ -210,6 +211,9 @@ SanitizedResult Sanitize(const Program* in,
manager.Add<transform::Renamer>(); manager.Add<transform::Renamer>();
data.Add<transform::Renamer::Config>(transform::Renamer::Target::kGlslKeywords, data.Add<transform::Renamer::Config>(transform::Renamer::Target::kGlslKeywords,
/* preserve_unicode */ false); /* preserve_unicode */ false);
manager.Add<transform::PreservePadding>(); // Must come before DirectVariableAccess
manager.Add<transform::Unshadow>(); // Must come before DirectVariableAccess manager.Add<transform::Unshadow>(); // Must come before DirectVariableAccess
manager.Add<transform::DirectVariableAccess>(); manager.Add<transform::DirectVariableAccess>();

View File

@ -67,6 +67,7 @@
#include "src/tint/transform/manager.h" #include "src/tint/transform/manager.h"
#include "src/tint/transform/module_scope_var_to_entry_point_param.h" #include "src/tint/transform/module_scope_var_to_entry_point_param.h"
#include "src/tint/transform/packed_vec3.h" #include "src/tint/transform/packed_vec3.h"
#include "src/tint/transform/preserve_padding.h"
#include "src/tint/transform/promote_initializers_to_let.h" #include "src/tint/transform/promote_initializers_to_let.h"
#include "src/tint/transform/promote_side_effects_to_decl.h" #include "src/tint/transform/promote_side_effects_to_decl.h"
#include "src/tint/transform/remove_phonies.h" #include "src/tint/transform/remove_phonies.h"
@ -219,6 +220,8 @@ SanitizedResult Sanitize(const Program* in, const Options& options) {
} }
manager.Add<transform::MultiplanarExternalTexture>(); manager.Add<transform::MultiplanarExternalTexture>();
manager.Add<transform::PreservePadding>();
manager.Add<transform::Unshadow>(); manager.Add<transform::Unshadow>();
if (!options.disable_workgroup_init) { if (!options.disable_workgroup_init) {

View File

@ -28,6 +28,7 @@
#include "src/tint/transform/for_loop_to_loop.h" #include "src/tint/transform/for_loop_to_loop.h"
#include "src/tint/transform/manager.h" #include "src/tint/transform/manager.h"
#include "src/tint/transform/merge_return.h" #include "src/tint/transform/merge_return.h"
#include "src/tint/transform/preserve_padding.h"
#include "src/tint/transform/promote_side_effects_to_decl.h" #include "src/tint/transform/promote_side_effects_to_decl.h"
#include "src/tint/transform/remove_phonies.h" #include "src/tint/transform/remove_phonies.h"
#include "src/tint/transform/remove_unreachable_statements.h" #include "src/tint/transform/remove_unreachable_statements.h"
@ -78,6 +79,8 @@ SanitizedResult Sanitize(const Program* in, const Options& options) {
} }
manager.Add<transform::MultiplanarExternalTexture>(); manager.Add<transform::MultiplanarExternalTexture>();
manager.Add<transform::PreservePadding>(); // Must come before DirectVariableAccess
manager.Add<transform::Unshadow>(); // Must come before DirectVariableAccess manager.Add<transform::Unshadow>(); // Must come before DirectVariableAccess
bool disable_workgroup_init_in_sanitizer = bool disable_workgroup_init_in_sanitizer =
options.disable_workgroup_init || options.use_zero_initialize_workgroup_memory_extension; options.disable_workgroup_init || options.use_zero_initialize_workgroup_memory_extension;

View File

@ -37,13 +37,49 @@ layout(binding = 0, std430) buffer s_block_ssbo {
S inner; S inner;
} s; } s;
void assign_and_preserve_padding_4_s_a_X_el_X_X(uint dest[3], strided_arr value) {
s.inner.a[dest[0]].el[dest[0]][dest[0]].el = value.el;
}
void assign_and_preserve_padding_3_s_a_X_el_X(uint dest[2], strided_arr value[2]) {
{
for(uint i = 0u; (i < 2u); i = (i + 1u)) {
uint tint_symbol[3] = uint[3](dest[0u], dest[1u], i);
assign_and_preserve_padding_4_s_a_X_el_X_X(tint_symbol, value[i]);
}
}
}
void assign_and_preserve_padding_2_s_a_X_el(uint dest[1], strided_arr value[3][2]) {
{
for(uint i = 0u; (i < 3u); i = (i + 1u)) {
uint tint_symbol_1[2] = uint[2](dest[0u], i);
assign_and_preserve_padding_3_s_a_X_el_X(tint_symbol_1, value[i]);
}
}
}
void assign_and_preserve_padding_1_s_a_X(uint dest[1], strided_arr_1 value) {
uint tint_symbol_2[1] = uint[1](dest[0u]);
assign_and_preserve_padding_2_s_a_X_el(tint_symbol_2, value.el);
}
void assign_and_preserve_padding_s_a(strided_arr_1 value[4]) {
{
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
uint tint_symbol_3[1] = uint[1](i);
assign_and_preserve_padding_1_s_a_X(tint_symbol_3, value[i]);
}
}
}
void f_1() { void f_1() {
strided_arr_1 x_19[4] = s.inner.a; strided_arr_1 x_19[4] = s.inner.a;
strided_arr x_24[3][2] = s.inner.a[3].el; strided_arr x_24[3][2] = s.inner.a[3].el;
strided_arr x_28[2] = s.inner.a[3].el[2]; strided_arr x_28[2] = s.inner.a[3].el[2];
float x_32 = s.inner.a[3].el[2][1].el; float x_32 = s.inner.a[3].el[2][1].el;
strided_arr_1 tint_symbol[4] = strided_arr_1[4](strided_arr_1(strided_arr[3][2](strided_arr[2](strided_arr(0.0f, 0u), strided_arr(0.0f, 0u)), strided_arr[2](strided_arr(0.0f, 0u), strided_arr(0.0f, 0u)), strided_arr[2](strided_arr(0.0f, 0u), strided_arr(0.0f, 0u))), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u), strided_arr_1(strided_arr[3][2](strided_arr[2](strided_arr(0.0f, 0u), strided_arr(0.0f, 0u)), strided_arr[2](strided_arr(0.0f, 0u), strided_arr(0.0f, 0u)), strided_arr[2](strided_arr(0.0f, 0u), strided_arr(0.0f, 0u))), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u), strided_arr_1(strided_arr[3][2](strided_arr[2](strided_arr(0.0f, 0u), strided_arr(0.0f, 0u)), strided_arr[2](strided_arr(0.0f, 0u), strided_arr(0.0f, 0u)), strided_arr[2](strided_arr(0.0f, 0u), strided_arr(0.0f, 0u))), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u), strided_arr_1(strided_arr[3][2](strided_arr[2](strided_arr(0.0f, 0u), strided_arr(0.0f, 0u)), strided_arr[2](strided_arr(0.0f, 0u), strided_arr(0.0f, 0u)), strided_arr[2](strided_arr(0.0f, 0u), strided_arr(0.0f, 0u))), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u)); strided_arr_1 tint_symbol_4[4] = strided_arr_1[4](strided_arr_1(strided_arr[3][2](strided_arr[2](strided_arr(0.0f, 0u), strided_arr(0.0f, 0u)), strided_arr[2](strided_arr(0.0f, 0u), strided_arr(0.0f, 0u)), strided_arr[2](strided_arr(0.0f, 0u), strided_arr(0.0f, 0u))), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u), strided_arr_1(strided_arr[3][2](strided_arr[2](strided_arr(0.0f, 0u), strided_arr(0.0f, 0u)), strided_arr[2](strided_arr(0.0f, 0u), strided_arr(0.0f, 0u)), strided_arr[2](strided_arr(0.0f, 0u), strided_arr(0.0f, 0u))), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u), strided_arr_1(strided_arr[3][2](strided_arr[2](strided_arr(0.0f, 0u), strided_arr(0.0f, 0u)), strided_arr[2](strided_arr(0.0f, 0u), strided_arr(0.0f, 0u)), strided_arr[2](strided_arr(0.0f, 0u), strided_arr(0.0f, 0u))), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u), strided_arr_1(strided_arr[3][2](strided_arr[2](strided_arr(0.0f, 0u), strided_arr(0.0f, 0u)), strided_arr[2](strided_arr(0.0f, 0u), strided_arr(0.0f, 0u)), strided_arr[2](strided_arr(0.0f, 0u), strided_arr(0.0f, 0u))), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u));
s.inner.a = tint_symbol; assign_and_preserve_padding_s_a(tint_symbol_4);
s.inner.a[3].el[2][1].el = 5.0f; s.inner.a[3].el[2][1].el = 5.0f;
return; return;
} }

View File

@ -28,13 +28,39 @@ struct S {
/* 0x0000 */ tint_array<strided_arr_1, 4> a; /* 0x0000 */ tint_array<strided_arr_1, 4> a;
}; };
void assign_and_preserve_padding_4(device strided_arr* const dest, strided_arr value) {
(*(dest)).el = value.el;
}
void assign_and_preserve_padding_3(device tint_array<strided_arr, 2>* const dest, tint_array<strided_arr, 2> value) {
for(uint i = 0u; (i < 2u); i = (i + 1u)) {
assign_and_preserve_padding_4(&((*(dest))[i]), value[i]);
}
}
void assign_and_preserve_padding_2(device tint_array<tint_array<strided_arr, 2>, 3>* const dest, tint_array<tint_array<strided_arr, 2>, 3> value) {
for(uint i = 0u; (i < 3u); i = (i + 1u)) {
assign_and_preserve_padding_3(&((*(dest))[i]), value[i]);
}
}
void assign_and_preserve_padding_1(device strided_arr_1* const dest, strided_arr_1 value) {
assign_and_preserve_padding_2(&((*(dest)).el), value.el);
}
void assign_and_preserve_padding(device tint_array<strided_arr_1, 4>* const dest, tint_array<strided_arr_1, 4> value) {
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
assign_and_preserve_padding_1(&((*(dest))[i]), value[i]);
}
}
void f_1(device S* const tint_symbol_1) { void f_1(device S* const tint_symbol_1) {
tint_array<strided_arr_1, 4> const x_19 = (*(tint_symbol_1)).a; tint_array<strided_arr_1, 4> const x_19 = (*(tint_symbol_1)).a;
tint_array<tint_array<strided_arr, 2>, 3> const x_24 = (*(tint_symbol_1)).a[3].el; tint_array<tint_array<strided_arr, 2>, 3> const x_24 = (*(tint_symbol_1)).a[3].el;
tint_array<strided_arr, 2> const x_28 = (*(tint_symbol_1)).a[3].el[2]; tint_array<strided_arr, 2> const x_28 = (*(tint_symbol_1)).a[3].el[2];
float const x_32 = (*(tint_symbol_1)).a[3].el[2][1].el; float const x_32 = (*(tint_symbol_1)).a[3].el[2][1].el;
tint_array<strided_arr_1, 4> const tint_symbol = tint_array<strided_arr_1, 4>{}; tint_array<strided_arr_1, 4> const tint_symbol = tint_array<strided_arr_1, 4>{};
(*(tint_symbol_1)).a = tint_symbol; assign_and_preserve_padding(&((*(tint_symbol_1)).a), tint_symbol);
(*(tint_symbol_1)).a[3].el[2][1].el = 5.0f; (*(tint_symbol_1)).a[3].el[2][1].el = 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: 43 ; Bound: 151
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
@ -16,6 +16,26 @@
OpName %strided_arr "strided_arr" OpName %strided_arr "strided_arr"
OpMemberName %strided_arr 0 "el" OpMemberName %strided_arr 0 "el"
OpName %s "s" OpName %s "s"
OpName %assign_and_preserve_padding_4_s_a_X_el_X_X "assign_and_preserve_padding_4_s_a_X_el_X_X"
OpName %dest "dest"
OpName %value "value"
OpName %assign_and_preserve_padding_3_s_a_X_el_X "assign_and_preserve_padding_3_s_a_X_el_X"
OpName %dest_0 "dest"
OpName %value_0 "value"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %assign_and_preserve_padding_2_s_a_X_el "assign_and_preserve_padding_2_s_a_X_el"
OpName %dest_1 "dest"
OpName %value_1 "value"
OpName %i_0 "i"
OpName %var_for_index_1 "var_for_index_1"
OpName %assign_and_preserve_padding_1_s_a_X "assign_and_preserve_padding_1_s_a_X"
OpName %dest_2 "dest"
OpName %value_2 "value"
OpName %assign_and_preserve_padding_s_a "assign_and_preserve_padding_s_a"
OpName %value_3 "value"
OpName %i_1 "i"
OpName %var_for_index_2 "var_for_index_2"
OpName %f_1 "f_1" OpName %f_1 "f_1"
OpName %f "f" OpName %f "f"
OpDecorate %s_block Block OpDecorate %s_block Block
@ -28,6 +48,9 @@
OpDecorate %_arr_strided_arr_1_uint_4 ArrayStride 128 OpDecorate %_arr_strided_arr_1_uint_4 ArrayStride 128
OpDecorate %s DescriptorSet 0 OpDecorate %s DescriptorSet 0
OpDecorate %s Binding 0 OpDecorate %s Binding 0
OpDecorate %_arr_uint_uint_3 ArrayStride 4
OpDecorate %_arr_uint_uint_2 ArrayStride 4
OpDecorate %_arr_uint_uint_1 ArrayStride 4
%float = OpTypeFloat 32 %float = OpTypeFloat 32
%strided_arr = OpTypeStruct %float %strided_arr = OpTypeStruct %float
%uint = OpTypeInt 32 0 %uint = OpTypeInt 32 0
@ -43,36 +66,187 @@
%_ptr_StorageBuffer_s_block = OpTypePointer StorageBuffer %s_block %_ptr_StorageBuffer_s_block = OpTypePointer StorageBuffer %s_block
%s = OpVariable %_ptr_StorageBuffer_s_block StorageBuffer %s = OpVariable %_ptr_StorageBuffer_s_block StorageBuffer
%void = OpTypeVoid %void = OpTypeVoid
%15 = OpTypeFunction %void %_arr_uint_uint_3 = OpTypeArray %uint %uint_3
%15 = OpTypeFunction %void %_arr_uint_uint_3 %strided_arr
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer__arr_strided_arr_1_uint_4 = OpTypePointer StorageBuffer %_arr_strided_arr_1_uint_4
%int = OpTypeInt 32 1 %int = OpTypeInt 32 1
%24 = OpConstantNull %int
%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
%31 = OpTypeFunction %void %_arr_uint_uint_2 %_arr_strided_arr_uint_2
%37 = OpConstantNull %uint
%_ptr_Function_uint = OpTypePointer Function %uint
%bool = OpTypeBool
%_ptr_Function__arr_strided_arr_uint_2 = OpTypePointer Function %_arr_strided_arr_uint_2
%52 = OpConstantNull %_arr_strided_arr_uint_2
%uint_1 = OpConstant %uint 1
%_ptr_Function_strided_arr = OpTypePointer Function %strided_arr
%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
%65 = OpTypeFunction %void %_arr_uint_uint_1 %_arr__arr_strided_arr_uint_2_uint_3
%_ptr_Function__arr__arr_strided_arr_uint_2_uint_3 = OpTypePointer Function %_arr__arr_strided_arr_uint_2_uint_3
%83 = OpConstantNull %_arr__arr_strided_arr_uint_2_uint_3
%93 = OpTypeFunction %void %_arr_uint_uint_1 %strided_arr_1
%102 = OpTypeFunction %void %_arr_strided_arr_1_uint_4
%_ptr_Function__arr_strided_arr_1_uint_4 = OpTypePointer Function %_arr_strided_arr_1_uint_4
%118 = OpConstantNull %_arr_strided_arr_1_uint_4
%_ptr_Function_strided_arr_1 = OpTypePointer Function %strided_arr_1
%128 = OpTypeFunction %void
%_ptr_StorageBuffer__arr_strided_arr_1_uint_4 = OpTypePointer StorageBuffer %_arr_strided_arr_1_uint_4
%int_3 = OpConstant %int 3 %int_3 = OpConstant %int 3
%_ptr_StorageBuffer__arr__arr_strided_arr_uint_2_uint_3 = OpTypePointer StorageBuffer %_arr__arr_strided_arr_uint_2_uint_3 %_ptr_StorageBuffer__arr__arr_strided_arr_uint_2_uint_3 = OpTypePointer StorageBuffer %_arr__arr_strided_arr_uint_2_uint_3
%int_2 = OpConstant %int 2 %int_2 = OpConstant %int 2
%_ptr_StorageBuffer__arr_strided_arr_uint_2 = OpTypePointer StorageBuffer %_arr_strided_arr_uint_2 %_ptr_StorageBuffer__arr_strided_arr_uint_2 = OpTypePointer StorageBuffer %_arr_strided_arr_uint_2
%int_1 = OpConstant %int 1 %int_1 = OpConstant %int 1
%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
%37 = OpConstantNull %_arr_strided_arr_1_uint_4
%float_5 = OpConstant %float 5 %float_5 = OpConstant %float 5
%f_1 = OpFunction %void None %15 %assign_and_preserve_padding_4_s_a_X_el_X_X = OpFunction %void None %15
%18 = OpLabel %dest = OpFunctionParameter %_arr_uint_uint_3
%21 = OpAccessChain %_ptr_StorageBuffer__arr_strided_arr_1_uint_4 %s %uint_0 %uint_0 %value = OpFunctionParameter %strided_arr
%22 = OpLoad %_arr_strided_arr_1_uint_4 %21 %21 = OpLabel
%26 = OpAccessChain %_ptr_StorageBuffer__arr__arr_strided_arr_uint_2_uint_3 %s %uint_0 %uint_0 %int_3 %uint_0 %25 = OpCompositeExtract %uint %dest 0
%27 = OpLoad %_arr__arr_strided_arr_uint_2_uint_3 %26 %26 = OpCompositeExtract %uint %dest 0
%30 = OpAccessChain %_ptr_StorageBuffer__arr_strided_arr_uint_2 %s %uint_0 %uint_0 %int_3 %uint_0 %int_2 %27 = OpCompositeExtract %uint %dest 0
%31 = OpLoad %_arr_strided_arr_uint_2 %30 %29 = OpAccessChain %_ptr_StorageBuffer_float %s %uint_0 %uint_0 %25 %uint_0 %26 %27 %uint_0
%34 = OpAccessChain %_ptr_StorageBuffer_float %s %uint_0 %uint_0 %int_3 %uint_0 %int_2 %int_1 %uint_0 %30 = OpCompositeExtract %float %value 0
%35 = OpLoad %float %34 OpStore %29 %30
%36 = OpAccessChain %_ptr_StorageBuffer__arr_strided_arr_1_uint_4 %s %uint_0 %uint_0
OpStore %36 %37
%38 = OpAccessChain %_ptr_StorageBuffer_float %s %uint_0 %uint_0 %int_3 %uint_0 %int_2 %int_1 %uint_0
OpStore %38 %float_5
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%f = OpFunction %void None %15 %assign_and_preserve_padding_3_s_a_X_el_X = OpFunction %void None %31
%dest_0 = OpFunctionParameter %_arr_uint_uint_2
%value_0 = OpFunctionParameter %_arr_strided_arr_uint_2
%36 = OpLabel
%i = OpVariable %_ptr_Function_uint Function %37
%var_for_index = OpVariable %_ptr_Function__arr_strided_arr_uint_2 Function %52
OpStore %i %37
OpBranch %40
%40 = OpLabel
OpLoopMerge %41 %42 None
OpBranch %43
%43 = OpLabel
%45 = OpLoad %uint %i
%46 = OpULessThan %bool %45 %uint_2
%44 = OpLogicalNot %bool %46
OpSelectionMerge %48 None
OpBranchConditional %44 %49 %48
%49 = OpLabel
OpBranch %41
%48 = OpLabel
OpStore %var_for_index %value_0
%54 = OpCompositeExtract %uint %dest_0 0
%56 = OpCompositeExtract %uint %dest_0 1
%57 = OpLoad %uint %i
%58 = OpCompositeConstruct %_arr_uint_uint_3 %54 %56 %57
%59 = OpLoad %uint %i
%61 = OpAccessChain %_ptr_Function_strided_arr %var_for_index %59
%62 = OpLoad %strided_arr %61
%53 = OpFunctionCall %void %assign_and_preserve_padding_4_s_a_X_el_X_X %58 %62
OpBranch %42
%42 = OpLabel
%63 = OpLoad %uint %i
%64 = OpIAdd %uint %63 %uint_1
OpStore %i %64
OpBranch %40
%41 = OpLabel %41 = OpLabel
%42 = OpFunctionCall %void %f_1 OpReturn
OpFunctionEnd
%assign_and_preserve_padding_2_s_a_X_el = OpFunction %void None %65
%dest_1 = OpFunctionParameter %_arr_uint_uint_1
%value_1 = OpFunctionParameter %_arr__arr_strided_arr_uint_2_uint_3
%70 = OpLabel
%i_0 = OpVariable %_ptr_Function_uint Function %37
%var_for_index_1 = OpVariable %_ptr_Function__arr__arr_strided_arr_uint_2_uint_3 Function %83
OpStore %i_0 %37
OpBranch %72
%72 = OpLabel
OpLoopMerge %73 %74 None
OpBranch %75
%75 = OpLabel
%77 = OpLoad %uint %i_0
%78 = OpULessThan %bool %77 %uint_3
%76 = OpLogicalNot %bool %78
OpSelectionMerge %79 None
OpBranchConditional %76 %80 %79
%80 = OpLabel
OpBranch %73
%79 = OpLabel
OpStore %var_for_index_1 %value_1
%85 = OpCompositeExtract %uint %dest_1 0
%86 = OpLoad %uint %i_0
%87 = OpCompositeConstruct %_arr_uint_uint_2 %85 %86
%88 = OpLoad %uint %i_0
%89 = OpAccessChain %_ptr_Function__arr_strided_arr_uint_2 %var_for_index_1 %88
%90 = OpLoad %_arr_strided_arr_uint_2 %89
%84 = OpFunctionCall %void %assign_and_preserve_padding_3_s_a_X_el_X %87 %90
OpBranch %74
%74 = OpLabel
%91 = OpLoad %uint %i_0
%92 = OpIAdd %uint %91 %uint_1
OpStore %i_0 %92
OpBranch %72
%73 = OpLabel
OpReturn
OpFunctionEnd
%assign_and_preserve_padding_1_s_a_X = OpFunction %void None %93
%dest_2 = OpFunctionParameter %_arr_uint_uint_1
%value_2 = OpFunctionParameter %strided_arr_1
%97 = OpLabel
%99 = OpCompositeExtract %uint %dest_2 0
%100 = OpCompositeConstruct %_arr_uint_uint_1 %99
%101 = OpCompositeExtract %_arr__arr_strided_arr_uint_2_uint_3 %value_2 0
%98 = OpFunctionCall %void %assign_and_preserve_padding_2_s_a_X_el %100 %101
OpReturn
OpFunctionEnd
%assign_and_preserve_padding_s_a = OpFunction %void None %102
%value_3 = OpFunctionParameter %_arr_strided_arr_1_uint_4
%105 = OpLabel
%i_1 = OpVariable %_ptr_Function_uint Function %37
%var_for_index_2 = OpVariable %_ptr_Function__arr_strided_arr_1_uint_4 Function %118
OpStore %i_1 %37
OpBranch %107
%107 = OpLabel
OpLoopMerge %108 %109 None
OpBranch %110
%110 = OpLabel
%112 = OpLoad %uint %i_1
%113 = OpULessThan %bool %112 %uint_4
%111 = OpLogicalNot %bool %113
OpSelectionMerge %114 None
OpBranchConditional %111 %115 %114
%115 = OpLabel
OpBranch %108
%114 = OpLabel
OpStore %var_for_index_2 %value_3
%120 = OpLoad %uint %i_1
%121 = OpCompositeConstruct %_arr_uint_uint_1 %120
%122 = OpLoad %uint %i_1
%124 = OpAccessChain %_ptr_Function_strided_arr_1 %var_for_index_2 %122
%125 = OpLoad %strided_arr_1 %124
%119 = OpFunctionCall %void %assign_and_preserve_padding_1_s_a_X %121 %125
OpBranch %109
%109 = OpLabel
%126 = OpLoad %uint %i_1
%127 = OpIAdd %uint %126 %uint_1
OpStore %i_1 %127
OpBranch %107
%108 = OpLabel
OpReturn
OpFunctionEnd
%f_1 = OpFunction %void None %128
%130 = OpLabel
%132 = OpAccessChain %_ptr_StorageBuffer__arr_strided_arr_1_uint_4 %s %uint_0 %uint_0
%133 = OpLoad %_arr_strided_arr_1_uint_4 %132
%136 = OpAccessChain %_ptr_StorageBuffer__arr__arr_strided_arr_uint_2_uint_3 %s %uint_0 %uint_0 %int_3 %uint_0
%137 = OpLoad %_arr__arr_strided_arr_uint_2_uint_3 %136
%140 = OpAccessChain %_ptr_StorageBuffer__arr_strided_arr_uint_2 %s %uint_0 %uint_0 %int_3 %uint_0 %int_2
%141 = OpLoad %_arr_strided_arr_uint_2 %140
%143 = OpAccessChain %_ptr_StorageBuffer_float %s %uint_0 %uint_0 %int_3 %uint_0 %int_2 %int_1 %uint_0
%144 = OpLoad %float %143
%145 = OpFunctionCall %void %assign_and_preserve_padding_s_a %118
%146 = OpAccessChain %_ptr_StorageBuffer_float %s %uint_0 %uint_0 %int_3 %uint_0 %int_2 %int_1 %uint_0
OpStore %146 %float_5
OpReturn
OpFunctionEnd
%f = OpFunction %void None %128
%149 = OpLabel
%150 = OpFunctionCall %void %f_1
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -37,6 +37,14 @@ layout(binding = 0, std430) buffer S_ssbo {
Inner arr[]; Inner arr[];
} sb; } sb;
void assign_and_preserve_padding_sb_arr_X_arr2_vec3_f32(uint dest[1], vec3 value[2]) {
{
for(uint i = 0u; (i < 2u); i = (i + 1u)) {
sb.arr[dest[0]].arr2_vec3_f32[i] = value[i];
}
}
}
void tint_symbol(uint idx) { void tint_symbol(uint idx) {
sb.arr[idx].scalar_f32 = 0.0f; sb.arr[idx].scalar_f32 = 0.0f;
sb.arr[idx].scalar_i32 = 0; sb.arr[idx].scalar_i32 = 0;
@ -59,8 +67,9 @@ void tint_symbol(uint idx) {
sb.arr[idx].mat4x2_f32 = mat4x2(vec2(0.0f), vec2(0.0f), vec2(0.0f), vec2(0.0f)); sb.arr[idx].mat4x2_f32 = mat4x2(vec2(0.0f), vec2(0.0f), vec2(0.0f), vec2(0.0f));
sb.arr[idx].mat4x3_f32 = mat4x3(vec3(0.0f), vec3(0.0f), vec3(0.0f), vec3(0.0f)); sb.arr[idx].mat4x3_f32 = mat4x3(vec3(0.0f), vec3(0.0f), vec3(0.0f), vec3(0.0f));
sb.arr[idx].mat4x4_f32 = mat4(vec4(0.0f), vec4(0.0f), vec4(0.0f), vec4(0.0f)); sb.arr[idx].mat4x4_f32 = mat4(vec4(0.0f), vec4(0.0f), vec4(0.0f), vec4(0.0f));
vec3 tint_symbol_1[2] = vec3[2](vec3(0.0f), vec3(0.0f)); uint tint_symbol_1[1] = uint[1](idx);
sb.arr[idx].arr2_vec3_f32 = tint_symbol_1; vec3 tint_symbol_2[2] = vec3[2](vec3(0.0f), vec3(0.0f));
assign_and_preserve_padding_sb_arr_X_arr2_vec3_f32(tint_symbol_1, tint_symbol_2);
} }
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;

View File

@ -49,6 +49,12 @@ struct S {
/* 0x0000 */ tint_array<Inner, 1> arr; /* 0x0000 */ tint_array<Inner, 1> arr;
}; };
void assign_and_preserve_padding(device tint_array<float3, 2>* const dest, tint_array<float3, 2> value) {
for(uint i = 0u; (i < 2u); i = (i + 1u)) {
(*(dest))[i] = value[i];
}
}
void tint_symbol_inner(uint idx, device S* const tint_symbol_2) { void tint_symbol_inner(uint idx, device S* const tint_symbol_2) {
(*(tint_symbol_2)).arr[idx].scalar_f32 = 0.0f; (*(tint_symbol_2)).arr[idx].scalar_f32 = 0.0f;
(*(tint_symbol_2)).arr[idx].scalar_i32 = 0; (*(tint_symbol_2)).arr[idx].scalar_i32 = 0;
@ -72,7 +78,7 @@ void tint_symbol_inner(uint idx, device S* const tint_symbol_2) {
(*(tint_symbol_2)).arr[idx].mat4x3_f32 = float4x3(float3(0.0f), float3(0.0f), float3(0.0f), float3(0.0f)); (*(tint_symbol_2)).arr[idx].mat4x3_f32 = float4x3(float3(0.0f), float3(0.0f), float3(0.0f), float3(0.0f));
(*(tint_symbol_2)).arr[idx].mat4x4_f32 = float4x4(float4(0.0f), float4(0.0f), float4(0.0f), float4(0.0f)); (*(tint_symbol_2)).arr[idx].mat4x4_f32 = float4x4(float4(0.0f), float4(0.0f), float4(0.0f), float4(0.0f));
tint_array<float3, 2> const tint_symbol_1 = tint_array<float3, 2>{}; tint_array<float3, 2> const tint_symbol_1 = tint_array<float3, 2>{};
(*(tint_symbol_2)).arr[idx].arr2_vec3_f32 = tint_symbol_1; assign_and_preserve_padding(&((*(tint_symbol_2)).arr[idx].arr2_vec3_f32), tint_symbol_1);
} }
kernel void tint_symbol(device S* tint_symbol_3 [[buffer(0)]], uint idx [[thread_index_in_threadgroup]]) { kernel void tint_symbol(device S* tint_symbol_3 [[buffer(0)]], uint idx [[thread_index_in_threadgroup]]) {

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: 128 ; Bound: 157
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
@ -34,6 +34,11 @@
OpMemberName %Inner 20 "mat4x4_f32" OpMemberName %Inner 20 "mat4x4_f32"
OpMemberName %Inner 21 "arr2_vec3_f32" OpMemberName %Inner 21 "arr2_vec3_f32"
OpName %sb "sb" OpName %sb "sb"
OpName %assign_and_preserve_padding_sb_arr_X_arr2_vec3_f32 "assign_and_preserve_padding_sb_arr_X_arr2_vec3_f32"
OpName %dest "dest"
OpName %value "value"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %main_inner "main_inner" OpName %main_inner "main_inner"
OpName %idx "idx" OpName %idx "idx"
OpName %main "main" OpName %main "main"
@ -84,6 +89,7 @@
OpDecorate %_runtimearr_Inner ArrayStride 544 OpDecorate %_runtimearr_Inner ArrayStride 544
OpDecorate %sb Binding 0 OpDecorate %sb Binding 0
OpDecorate %sb DescriptorSet 0 OpDecorate %sb DescriptorSet 0
OpDecorate %_arr_uint_uint_1 ArrayStride 4
%uint = OpTypeInt 32 0 %uint = OpTypeInt 32 0
%_ptr_Input_uint = OpTypePointer Input %uint %_ptr_Input_uint = OpTypePointer Input %uint
%idx_1 = OpVariable %_ptr_Input_uint Input %idx_1 = OpVariable %_ptr_Input_uint Input
@ -115,125 +121,167 @@
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S %_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
%sb = OpVariable %_ptr_StorageBuffer_S StorageBuffer %sb = OpVariable %_ptr_StorageBuffer_S StorageBuffer
%void = OpTypeVoid %void = OpTypeVoid
%31 = OpTypeFunction %void %uint
%uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
%39 = OpConstantNull %float
%uint_1 = OpConstant %uint 1 %uint_1 = OpConstant %uint 1
%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
%31 = OpTypeFunction %void %_arr_uint_uint_1 %_arr_v3float_uint_2
%39 = OpConstantNull %uint
%_ptr_Function_uint = OpTypePointer Function %uint
%bool = OpTypeBool
%_ptr_Function__arr_v3float_uint_2 = OpTypePointer Function %_arr_v3float_uint_2
%54 = OpConstantNull %_arr_v3float_uint_2
%uint_0 = OpConstant %uint 0
%56 = OpConstantNull %int
%uint_21 = OpConstant %uint 21
%_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float
%_ptr_Function_v3float = OpTypePointer Function %v3float
%68 = OpTypeFunction %void %uint
%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
%74 = OpConstantNull %float
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%43 = OpConstantNull %int
%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
%46 = OpConstantNull %uint
%uint_3 = OpConstant %uint 3 %uint_3 = OpConstant %uint 3
%_ptr_StorageBuffer_v2float = OpTypePointer StorageBuffer %v2float %_ptr_StorageBuffer_v2float = OpTypePointer StorageBuffer %v2float
%50 = OpConstantNull %v2float %82 = OpConstantNull %v2float
%uint_4 = OpConstant %uint 4 %uint_4 = OpConstant %uint 4
%_ptr_StorageBuffer_v2int = OpTypePointer StorageBuffer %v2int %_ptr_StorageBuffer_v2int = OpTypePointer StorageBuffer %v2int
%54 = OpConstantNull %v2int %86 = OpConstantNull %v2int
%uint_5 = OpConstant %uint 5 %uint_5 = OpConstant %uint 5
%_ptr_StorageBuffer_v2uint = OpTypePointer StorageBuffer %v2uint %_ptr_StorageBuffer_v2uint = OpTypePointer StorageBuffer %v2uint
%58 = OpConstantNull %v2uint %90 = OpConstantNull %v2uint
%uint_6 = OpConstant %uint 6 %uint_6 = OpConstant %uint 6
%_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float %93 = OpConstantNull %v3float
%62 = OpConstantNull %v3float
%uint_7 = OpConstant %uint 7 %uint_7 = OpConstant %uint 7
%_ptr_StorageBuffer_v3int = OpTypePointer StorageBuffer %v3int %_ptr_StorageBuffer_v3int = OpTypePointer StorageBuffer %v3int
%66 = OpConstantNull %v3int %97 = OpConstantNull %v3int
%uint_8 = OpConstant %uint 8 %uint_8 = OpConstant %uint 8
%_ptr_StorageBuffer_v3uint = OpTypePointer StorageBuffer %v3uint %_ptr_StorageBuffer_v3uint = OpTypePointer StorageBuffer %v3uint
%70 = OpConstantNull %v3uint %101 = OpConstantNull %v3uint
%uint_9 = OpConstant %uint 9 %uint_9 = OpConstant %uint 9
%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float %_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float
%74 = OpConstantNull %v4float %105 = OpConstantNull %v4float
%uint_10 = OpConstant %uint 10 %uint_10 = OpConstant %uint 10
%_ptr_StorageBuffer_v4int = OpTypePointer StorageBuffer %v4int %_ptr_StorageBuffer_v4int = OpTypePointer StorageBuffer %v4int
%78 = OpConstantNull %v4int %109 = OpConstantNull %v4int
%uint_11 = OpConstant %uint 11 %uint_11 = OpConstant %uint 11
%_ptr_StorageBuffer_v4uint = OpTypePointer StorageBuffer %v4uint %_ptr_StorageBuffer_v4uint = OpTypePointer StorageBuffer %v4uint
%82 = OpConstantNull %v4uint %113 = OpConstantNull %v4uint
%uint_12 = OpConstant %uint 12 %uint_12 = OpConstant %uint 12
%_ptr_StorageBuffer_mat2v2float = OpTypePointer StorageBuffer %mat2v2float %_ptr_StorageBuffer_mat2v2float = OpTypePointer StorageBuffer %mat2v2float
%86 = OpConstantNull %mat2v2float %117 = OpConstantNull %mat2v2float
%uint_13 = OpConstant %uint 13 %uint_13 = OpConstant %uint 13
%_ptr_StorageBuffer_mat2v3float = OpTypePointer StorageBuffer %mat2v3float %_ptr_StorageBuffer_mat2v3float = OpTypePointer StorageBuffer %mat2v3float
%90 = OpConstantNull %mat2v3float %121 = OpConstantNull %mat2v3float
%uint_14 = OpConstant %uint 14 %uint_14 = OpConstant %uint 14
%_ptr_StorageBuffer_mat2v4float = OpTypePointer StorageBuffer %mat2v4float %_ptr_StorageBuffer_mat2v4float = OpTypePointer StorageBuffer %mat2v4float
%94 = OpConstantNull %mat2v4float %125 = OpConstantNull %mat2v4float
%uint_15 = OpConstant %uint 15 %uint_15 = OpConstant %uint 15
%_ptr_StorageBuffer_mat3v2float = OpTypePointer StorageBuffer %mat3v2float %_ptr_StorageBuffer_mat3v2float = OpTypePointer StorageBuffer %mat3v2float
%98 = OpConstantNull %mat3v2float %129 = OpConstantNull %mat3v2float
%uint_16 = OpConstant %uint 16 %uint_16 = OpConstant %uint 16
%_ptr_StorageBuffer_mat3v3float = OpTypePointer StorageBuffer %mat3v3float %_ptr_StorageBuffer_mat3v3float = OpTypePointer StorageBuffer %mat3v3float
%102 = OpConstantNull %mat3v3float %133 = OpConstantNull %mat3v3float
%uint_17 = OpConstant %uint 17 %uint_17 = OpConstant %uint 17
%_ptr_StorageBuffer_mat3v4float = OpTypePointer StorageBuffer %mat3v4float %_ptr_StorageBuffer_mat3v4float = OpTypePointer StorageBuffer %mat3v4float
%106 = OpConstantNull %mat3v4float %137 = OpConstantNull %mat3v4float
%uint_18 = OpConstant %uint 18 %uint_18 = OpConstant %uint 18
%_ptr_StorageBuffer_mat4v2float = OpTypePointer StorageBuffer %mat4v2float %_ptr_StorageBuffer_mat4v2float = OpTypePointer StorageBuffer %mat4v2float
%110 = OpConstantNull %mat4v2float %141 = OpConstantNull %mat4v2float
%uint_19 = OpConstant %uint 19 %uint_19 = OpConstant %uint 19
%_ptr_StorageBuffer_mat4v3float = OpTypePointer StorageBuffer %mat4v3float %_ptr_StorageBuffer_mat4v3float = OpTypePointer StorageBuffer %mat4v3float
%114 = OpConstantNull %mat4v3float %145 = OpConstantNull %mat4v3float
%uint_20 = OpConstant %uint 20 %uint_20 = OpConstant %uint 20
%_ptr_StorageBuffer_mat4v4float = OpTypePointer StorageBuffer %mat4v4float %_ptr_StorageBuffer_mat4v4float = OpTypePointer StorageBuffer %mat4v4float
%118 = OpConstantNull %mat4v4float %149 = OpConstantNull %mat4v4float
%uint_21 = OpConstant %uint 21 %152 = OpTypeFunction %void
%_ptr_StorageBuffer__arr_v3float_uint_2 = OpTypePointer StorageBuffer %_arr_v3float_uint_2 %assign_and_preserve_padding_sb_arr_X_arr2_vec3_f32 = OpFunction %void None %31
%122 = OpConstantNull %_arr_v3float_uint_2 %dest = OpFunctionParameter %_arr_uint_uint_1
%123 = OpTypeFunction %void %value = OpFunctionParameter %_arr_v3float_uint_2
%main_inner = OpFunction %void None %31 %38 = OpLabel
%i = OpVariable %_ptr_Function_uint Function %39
%var_for_index = OpVariable %_ptr_Function__arr_v3float_uint_2 Function %54
OpStore %i %39
OpBranch %42
%42 = OpLabel
OpLoopMerge %43 %44 None
OpBranch %45
%45 = OpLabel
%47 = OpLoad %uint %i
%48 = OpULessThan %bool %47 %uint_2
%46 = OpLogicalNot %bool %48
OpSelectionMerge %50 None
OpBranchConditional %46 %51 %50
%51 = OpLabel
OpBranch %43
%50 = OpLabel
OpStore %var_for_index %value
%57 = OpCompositeExtract %uint %dest 0
%59 = OpLoad %uint %i
%61 = OpAccessChain %_ptr_StorageBuffer_v3float %sb %uint_0 %57 %uint_21 %59
%62 = OpLoad %uint %i
%64 = OpAccessChain %_ptr_Function_v3float %var_for_index %62
%65 = OpLoad %v3float %64
OpStore %61 %65
OpBranch %44
%44 = OpLabel
%66 = OpLoad %uint %i
%67 = OpIAdd %uint %66 %uint_1
OpStore %i %67
OpBranch %42
%43 = OpLabel
OpReturn
OpFunctionEnd
%main_inner = OpFunction %void None %68
%idx = OpFunctionParameter %uint %idx = OpFunctionParameter %uint
%35 = OpLabel %71 = OpLabel
%38 = OpAccessChain %_ptr_StorageBuffer_float %sb %uint_0 %idx %uint_0 %73 = OpAccessChain %_ptr_StorageBuffer_float %sb %uint_0 %idx %uint_0
OpStore %38 %39
%42 = OpAccessChain %_ptr_StorageBuffer_int %sb %uint_0 %idx %uint_1
OpStore %42 %43
%45 = OpAccessChain %_ptr_StorageBuffer_uint %sb %uint_0 %idx %uint_2
OpStore %45 %46
%49 = OpAccessChain %_ptr_StorageBuffer_v2float %sb %uint_0 %idx %uint_3
OpStore %49 %50
%53 = OpAccessChain %_ptr_StorageBuffer_v2int %sb %uint_0 %idx %uint_4
OpStore %53 %54
%57 = OpAccessChain %_ptr_StorageBuffer_v2uint %sb %uint_0 %idx %uint_5
OpStore %57 %58
%61 = OpAccessChain %_ptr_StorageBuffer_v3float %sb %uint_0 %idx %uint_6
OpStore %61 %62
%65 = OpAccessChain %_ptr_StorageBuffer_v3int %sb %uint_0 %idx %uint_7
OpStore %65 %66
%69 = OpAccessChain %_ptr_StorageBuffer_v3uint %sb %uint_0 %idx %uint_8
OpStore %69 %70
%73 = OpAccessChain %_ptr_StorageBuffer_v4float %sb %uint_0 %idx %uint_9
OpStore %73 %74 OpStore %73 %74
%77 = OpAccessChain %_ptr_StorageBuffer_v4int %sb %uint_0 %idx %uint_10 %76 = OpAccessChain %_ptr_StorageBuffer_int %sb %uint_0 %idx %uint_1
OpStore %77 %78 OpStore %76 %56
%81 = OpAccessChain %_ptr_StorageBuffer_v4uint %sb %uint_0 %idx %uint_11 %78 = OpAccessChain %_ptr_StorageBuffer_uint %sb %uint_0 %idx %uint_2
OpStore %78 %39
%81 = OpAccessChain %_ptr_StorageBuffer_v2float %sb %uint_0 %idx %uint_3
OpStore %81 %82 OpStore %81 %82
%85 = OpAccessChain %_ptr_StorageBuffer_mat2v2float %sb %uint_0 %idx %uint_12 %85 = OpAccessChain %_ptr_StorageBuffer_v2int %sb %uint_0 %idx %uint_4
OpStore %85 %86 OpStore %85 %86
%89 = OpAccessChain %_ptr_StorageBuffer_mat2v3float %sb %uint_0 %idx %uint_13 %89 = OpAccessChain %_ptr_StorageBuffer_v2uint %sb %uint_0 %idx %uint_5
OpStore %89 %90 OpStore %89 %90
%93 = OpAccessChain %_ptr_StorageBuffer_mat2v4float %sb %uint_0 %idx %uint_14 %92 = OpAccessChain %_ptr_StorageBuffer_v3float %sb %uint_0 %idx %uint_6
OpStore %93 %94 OpStore %92 %93
%97 = OpAccessChain %_ptr_StorageBuffer_mat3v2float %sb %uint_0 %idx %uint_15 %96 = OpAccessChain %_ptr_StorageBuffer_v3int %sb %uint_0 %idx %uint_7
OpStore %97 %98 OpStore %96 %97
%101 = OpAccessChain %_ptr_StorageBuffer_mat3v3float %sb %uint_0 %idx %uint_16 %100 = OpAccessChain %_ptr_StorageBuffer_v3uint %sb %uint_0 %idx %uint_8
OpStore %101 %102 OpStore %100 %101
%105 = OpAccessChain %_ptr_StorageBuffer_mat3v4float %sb %uint_0 %idx %uint_17 %104 = OpAccessChain %_ptr_StorageBuffer_v4float %sb %uint_0 %idx %uint_9
OpStore %105 %106 OpStore %104 %105
%109 = OpAccessChain %_ptr_StorageBuffer_mat4v2float %sb %uint_0 %idx %uint_18 %108 = OpAccessChain %_ptr_StorageBuffer_v4int %sb %uint_0 %idx %uint_10
OpStore %109 %110 OpStore %108 %109
%113 = OpAccessChain %_ptr_StorageBuffer_mat4v3float %sb %uint_0 %idx %uint_19 %112 = OpAccessChain %_ptr_StorageBuffer_v4uint %sb %uint_0 %idx %uint_11
OpStore %113 %114 OpStore %112 %113
%117 = OpAccessChain %_ptr_StorageBuffer_mat4v4float %sb %uint_0 %idx %uint_20 %116 = OpAccessChain %_ptr_StorageBuffer_mat2v2float %sb %uint_0 %idx %uint_12
OpStore %117 %118 OpStore %116 %117
%121 = OpAccessChain %_ptr_StorageBuffer__arr_v3float_uint_2 %sb %uint_0 %idx %uint_21 %120 = OpAccessChain %_ptr_StorageBuffer_mat2v3float %sb %uint_0 %idx %uint_13
OpStore %121 %122 OpStore %120 %121
%124 = OpAccessChain %_ptr_StorageBuffer_mat2v4float %sb %uint_0 %idx %uint_14
OpStore %124 %125
%128 = OpAccessChain %_ptr_StorageBuffer_mat3v2float %sb %uint_0 %idx %uint_15
OpStore %128 %129
%132 = OpAccessChain %_ptr_StorageBuffer_mat3v3float %sb %uint_0 %idx %uint_16
OpStore %132 %133
%136 = OpAccessChain %_ptr_StorageBuffer_mat3v4float %sb %uint_0 %idx %uint_17
OpStore %136 %137
%140 = OpAccessChain %_ptr_StorageBuffer_mat4v2float %sb %uint_0 %idx %uint_18
OpStore %140 %141
%144 = OpAccessChain %_ptr_StorageBuffer_mat4v3float %sb %uint_0 %idx %uint_19
OpStore %144 %145
%148 = OpAccessChain %_ptr_StorageBuffer_mat4v4float %sb %uint_0 %idx %uint_20
OpStore %148 %149
%151 = OpCompositeConstruct %_arr_uint_uint_1 %idx
%150 = OpFunctionCall %void %assign_and_preserve_padding_sb_arr_X_arr2_vec3_f32 %151 %54
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%main = OpFunction %void None %123 %main = OpFunction %void None %152
%125 = OpLabel %154 = OpLabel
%127 = OpLoad %uint %idx_1 %156 = OpLoad %uint %idx_1
%126 = OpFunctionCall %void %main_inner %127 %155 = OpFunctionCall %void %main_inner %156
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -57,6 +57,14 @@ layout(binding = 0, std430) buffer S_ssbo {
Inner arr[]; Inner arr[];
} sb; } sb;
void assign_and_preserve_padding_sb_arr_X_arr2_vec3_f32(uint dest[1], vec3 value[2]) {
{
for(uint i = 0u; (i < 2u); i = (i + 1u)) {
sb.arr[dest[0]].arr2_vec3_f32[i] = value[i];
}
}
}
void tint_symbol(uint idx) { void tint_symbol(uint idx) {
sb.arr[idx].scalar_f32 = 0.0f; sb.arr[idx].scalar_f32 = 0.0f;
sb.arr[idx].scalar_i32 = 0; sb.arr[idx].scalar_i32 = 0;
@ -92,10 +100,11 @@ void tint_symbol(uint idx) {
sb.arr[idx].mat4x2_f16 = f16mat4x2(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf)); sb.arr[idx].mat4x2_f16 = f16mat4x2(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf));
sb.arr[idx].mat4x3_f16 = f16mat4x3(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf)); sb.arr[idx].mat4x3_f16 = f16mat4x3(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf));
sb.arr[idx].mat4x4_f16 = f16mat4(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf)); sb.arr[idx].mat4x4_f16 = f16mat4(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf));
vec3 tint_symbol_1[2] = vec3[2](vec3(0.0f), vec3(0.0f)); uint tint_symbol_1[1] = uint[1](idx);
sb.arr[idx].arr2_vec3_f32 = tint_symbol_1; vec3 tint_symbol_2[2] = vec3[2](vec3(0.0f), vec3(0.0f));
f16mat4x2 tint_symbol_2[2] = f16mat4x2[2](f16mat4x2(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf)), f16mat4x2(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf))); assign_and_preserve_padding_sb_arr_X_arr2_vec3_f32(tint_symbol_1, tint_symbol_2);
sb.arr[idx].arr2_mat4x2_f16 = tint_symbol_2; f16mat4x2 tint_symbol_3[2] = f16mat4x2[2](f16mat4x2(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf)), f16mat4x2(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf)));
sb.arr[idx].arr2_mat4x2_f16 = tint_symbol_3;
} }
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;

View File

@ -67,6 +67,12 @@ struct S {
/* 0x0000 */ tint_array<Inner, 1> arr; /* 0x0000 */ tint_array<Inner, 1> arr;
}; };
void assign_and_preserve_padding(device tint_array<float3, 2>* const dest, tint_array<float3, 2> value) {
for(uint i = 0u; (i < 2u); i = (i + 1u)) {
(*(dest))[i] = value[i];
}
}
void tint_symbol_inner(uint idx, device S* const tint_symbol_3) { void tint_symbol_inner(uint idx, device S* const tint_symbol_3) {
(*(tint_symbol_3)).arr[idx].scalar_f32 = 0.0f; (*(tint_symbol_3)).arr[idx].scalar_f32 = 0.0f;
(*(tint_symbol_3)).arr[idx].scalar_i32 = 0; (*(tint_symbol_3)).arr[idx].scalar_i32 = 0;
@ -103,7 +109,7 @@ void tint_symbol_inner(uint idx, device S* const tint_symbol_3) {
(*(tint_symbol_3)).arr[idx].mat4x3_f16 = half4x3(half3(0.0h), half3(0.0h), half3(0.0h), half3(0.0h)); (*(tint_symbol_3)).arr[idx].mat4x3_f16 = half4x3(half3(0.0h), half3(0.0h), half3(0.0h), half3(0.0h));
(*(tint_symbol_3)).arr[idx].mat4x4_f16 = half4x4(half4(0.0h), half4(0.0h), half4(0.0h), half4(0.0h)); (*(tint_symbol_3)).arr[idx].mat4x4_f16 = half4x4(half4(0.0h), half4(0.0h), half4(0.0h), half4(0.0h));
tint_array<float3, 2> const tint_symbol_1 = tint_array<float3, 2>{}; tint_array<float3, 2> const tint_symbol_1 = tint_array<float3, 2>{};
(*(tint_symbol_3)).arr[idx].arr2_vec3_f32 = tint_symbol_1; assign_and_preserve_padding(&((*(tint_symbol_3)).arr[idx].arr2_vec3_f32), tint_symbol_1);
tint_array<half4x2, 2> const tint_symbol_2 = tint_array<half4x2, 2>{}; tint_array<half4x2, 2> const tint_symbol_2 = tint_array<half4x2, 2>{};
(*(tint_symbol_3)).arr[idx].arr2_mat4x2_f16 = tint_symbol_2; (*(tint_symbol_3)).arr[idx].arr2_mat4x2_f16 = tint_symbol_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: 198 ; Bound: 227
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpCapability Float16 OpCapability Float16
@ -52,6 +52,11 @@
OpMemberName %Inner 34 "arr2_vec3_f32" OpMemberName %Inner 34 "arr2_vec3_f32"
OpMemberName %Inner 35 "arr2_mat4x2_f16" OpMemberName %Inner 35 "arr2_mat4x2_f16"
OpName %sb "sb" OpName %sb "sb"
OpName %assign_and_preserve_padding_sb_arr_X_arr2_vec3_f32 "assign_and_preserve_padding_sb_arr_X_arr2_vec3_f32"
OpName %dest "dest"
OpName %value "value"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %main_inner "main_inner" OpName %main_inner "main_inner"
OpName %idx "idx" OpName %idx "idx"
OpName %main "main" OpName %main "main"
@ -137,6 +142,7 @@
OpDecorate %_runtimearr_Inner ArrayStride 800 OpDecorate %_runtimearr_Inner ArrayStride 800
OpDecorate %sb Binding 0 OpDecorate %sb Binding 0
OpDecorate %sb DescriptorSet 0 OpDecorate %sb DescriptorSet 0
OpDecorate %_arr_uint_uint_1 ArrayStride 4
%uint = OpTypeInt 32 0 %uint = OpTypeInt 32 0
%_ptr_Input_uint = OpTypePointer Input %uint %_ptr_Input_uint = OpTypePointer Input %uint
%idx_1 = OpVariable %_ptr_Input_uint Input %idx_1 = OpVariable %_ptr_Input_uint Input
@ -182,195 +188,237 @@
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S %_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
%sb = OpVariable %_ptr_StorageBuffer_S StorageBuffer %sb = OpVariable %_ptr_StorageBuffer_S StorageBuffer
%void = OpTypeVoid %void = OpTypeVoid
%45 = OpTypeFunction %void %uint
%uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
%53 = OpConstantNull %float
%uint_1 = OpConstant %uint 1 %uint_1 = OpConstant %uint 1
%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
%45 = OpTypeFunction %void %_arr_uint_uint_1 %_arr_v3float_uint_2
%53 = OpConstantNull %uint
%_ptr_Function_uint = OpTypePointer Function %uint
%bool = OpTypeBool
%_ptr_Function__arr_v3float_uint_2 = OpTypePointer Function %_arr_v3float_uint_2
%68 = OpConstantNull %_arr_v3float_uint_2
%uint_0 = OpConstant %uint 0
%70 = OpConstantNull %int
%uint_34 = OpConstant %uint 34
%_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float
%_ptr_Function_v3float = OpTypePointer Function %v3float
%82 = OpTypeFunction %void %uint
%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
%88 = OpConstantNull %float
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%57 = OpConstantNull %int
%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
%60 = OpConstantNull %uint
%uint_3 = OpConstant %uint 3 %uint_3 = OpConstant %uint 3
%_ptr_StorageBuffer_half = OpTypePointer StorageBuffer %half %_ptr_StorageBuffer_half = OpTypePointer StorageBuffer %half
%64 = OpConstantNull %half %96 = OpConstantNull %half
%uint_4 = OpConstant %uint 4 %uint_4 = OpConstant %uint 4
%_ptr_StorageBuffer_v2float = OpTypePointer StorageBuffer %v2float %_ptr_StorageBuffer_v2float = OpTypePointer StorageBuffer %v2float
%68 = OpConstantNull %v2float %100 = OpConstantNull %v2float
%uint_5 = OpConstant %uint 5 %uint_5 = OpConstant %uint 5
%_ptr_StorageBuffer_v2int = OpTypePointer StorageBuffer %v2int %_ptr_StorageBuffer_v2int = OpTypePointer StorageBuffer %v2int
%72 = OpConstantNull %v2int %104 = OpConstantNull %v2int
%uint_6 = OpConstant %uint 6 %uint_6 = OpConstant %uint 6
%_ptr_StorageBuffer_v2uint = OpTypePointer StorageBuffer %v2uint %_ptr_StorageBuffer_v2uint = OpTypePointer StorageBuffer %v2uint
%76 = OpConstantNull %v2uint %108 = OpConstantNull %v2uint
%uint_7 = OpConstant %uint 7 %uint_7 = OpConstant %uint 7
%_ptr_StorageBuffer_v2half = OpTypePointer StorageBuffer %v2half %_ptr_StorageBuffer_v2half = OpTypePointer StorageBuffer %v2half
%80 = OpConstantNull %v2half %112 = OpConstantNull %v2half
%uint_8 = OpConstant %uint 8 %uint_8 = OpConstant %uint 8
%_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float %115 = OpConstantNull %v3float
%84 = OpConstantNull %v3float
%uint_9 = OpConstant %uint 9 %uint_9 = OpConstant %uint 9
%_ptr_StorageBuffer_v3int = OpTypePointer StorageBuffer %v3int %_ptr_StorageBuffer_v3int = OpTypePointer StorageBuffer %v3int
%88 = OpConstantNull %v3int %119 = OpConstantNull %v3int
%uint_10 = OpConstant %uint 10 %uint_10 = OpConstant %uint 10
%_ptr_StorageBuffer_v3uint = OpTypePointer StorageBuffer %v3uint %_ptr_StorageBuffer_v3uint = OpTypePointer StorageBuffer %v3uint
%92 = OpConstantNull %v3uint %123 = OpConstantNull %v3uint
%uint_11 = OpConstant %uint 11 %uint_11 = OpConstant %uint 11
%_ptr_StorageBuffer_v3half = OpTypePointer StorageBuffer %v3half %_ptr_StorageBuffer_v3half = OpTypePointer StorageBuffer %v3half
%96 = OpConstantNull %v3half %127 = OpConstantNull %v3half
%uint_12 = OpConstant %uint 12 %uint_12 = OpConstant %uint 12
%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float %_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float
%100 = OpConstantNull %v4float %131 = OpConstantNull %v4float
%uint_13 = OpConstant %uint 13 %uint_13 = OpConstant %uint 13
%_ptr_StorageBuffer_v4int = OpTypePointer StorageBuffer %v4int %_ptr_StorageBuffer_v4int = OpTypePointer StorageBuffer %v4int
%104 = OpConstantNull %v4int %135 = OpConstantNull %v4int
%uint_14 = OpConstant %uint 14 %uint_14 = OpConstant %uint 14
%_ptr_StorageBuffer_v4uint = OpTypePointer StorageBuffer %v4uint %_ptr_StorageBuffer_v4uint = OpTypePointer StorageBuffer %v4uint
%108 = OpConstantNull %v4uint %139 = OpConstantNull %v4uint
%uint_15 = OpConstant %uint 15 %uint_15 = OpConstant %uint 15
%_ptr_StorageBuffer_v4half = OpTypePointer StorageBuffer %v4half %_ptr_StorageBuffer_v4half = OpTypePointer StorageBuffer %v4half
%112 = OpConstantNull %v4half %143 = OpConstantNull %v4half
%uint_16 = OpConstant %uint 16 %uint_16 = OpConstant %uint 16
%_ptr_StorageBuffer_mat2v2float = OpTypePointer StorageBuffer %mat2v2float %_ptr_StorageBuffer_mat2v2float = OpTypePointer StorageBuffer %mat2v2float
%116 = OpConstantNull %mat2v2float %147 = OpConstantNull %mat2v2float
%uint_17 = OpConstant %uint 17 %uint_17 = OpConstant %uint 17
%_ptr_StorageBuffer_mat2v3float = OpTypePointer StorageBuffer %mat2v3float %_ptr_StorageBuffer_mat2v3float = OpTypePointer StorageBuffer %mat2v3float
%120 = OpConstantNull %mat2v3float %151 = OpConstantNull %mat2v3float
%uint_18 = OpConstant %uint 18 %uint_18 = OpConstant %uint 18
%_ptr_StorageBuffer_mat2v4float = OpTypePointer StorageBuffer %mat2v4float %_ptr_StorageBuffer_mat2v4float = OpTypePointer StorageBuffer %mat2v4float
%124 = OpConstantNull %mat2v4float %155 = OpConstantNull %mat2v4float
%uint_19 = OpConstant %uint 19 %uint_19 = OpConstant %uint 19
%_ptr_StorageBuffer_mat3v2float = OpTypePointer StorageBuffer %mat3v2float %_ptr_StorageBuffer_mat3v2float = OpTypePointer StorageBuffer %mat3v2float
%128 = OpConstantNull %mat3v2float %159 = OpConstantNull %mat3v2float
%uint_20 = OpConstant %uint 20 %uint_20 = OpConstant %uint 20
%_ptr_StorageBuffer_mat3v3float = OpTypePointer StorageBuffer %mat3v3float %_ptr_StorageBuffer_mat3v3float = OpTypePointer StorageBuffer %mat3v3float
%132 = OpConstantNull %mat3v3float %163 = OpConstantNull %mat3v3float
%uint_21 = OpConstant %uint 21 %uint_21 = OpConstant %uint 21
%_ptr_StorageBuffer_mat3v4float = OpTypePointer StorageBuffer %mat3v4float %_ptr_StorageBuffer_mat3v4float = OpTypePointer StorageBuffer %mat3v4float
%136 = OpConstantNull %mat3v4float %167 = OpConstantNull %mat3v4float
%uint_22 = OpConstant %uint 22 %uint_22 = OpConstant %uint 22
%_ptr_StorageBuffer_mat4v2float = OpTypePointer StorageBuffer %mat4v2float %_ptr_StorageBuffer_mat4v2float = OpTypePointer StorageBuffer %mat4v2float
%140 = OpConstantNull %mat4v2float %171 = OpConstantNull %mat4v2float
%uint_23 = OpConstant %uint 23 %uint_23 = OpConstant %uint 23
%_ptr_StorageBuffer_mat4v3float = OpTypePointer StorageBuffer %mat4v3float %_ptr_StorageBuffer_mat4v3float = OpTypePointer StorageBuffer %mat4v3float
%144 = OpConstantNull %mat4v3float %175 = OpConstantNull %mat4v3float
%uint_24 = OpConstant %uint 24 %uint_24 = OpConstant %uint 24
%_ptr_StorageBuffer_mat4v4float = OpTypePointer StorageBuffer %mat4v4float %_ptr_StorageBuffer_mat4v4float = OpTypePointer StorageBuffer %mat4v4float
%148 = OpConstantNull %mat4v4float %179 = OpConstantNull %mat4v4float
%uint_25 = OpConstant %uint 25 %uint_25 = OpConstant %uint 25
%_ptr_StorageBuffer_mat2v2half = OpTypePointer StorageBuffer %mat2v2half %_ptr_StorageBuffer_mat2v2half = OpTypePointer StorageBuffer %mat2v2half
%152 = OpConstantNull %mat2v2half %183 = OpConstantNull %mat2v2half
%uint_26 = OpConstant %uint 26 %uint_26 = OpConstant %uint 26
%_ptr_StorageBuffer_mat2v3half = OpTypePointer StorageBuffer %mat2v3half %_ptr_StorageBuffer_mat2v3half = OpTypePointer StorageBuffer %mat2v3half
%156 = OpConstantNull %mat2v3half %187 = OpConstantNull %mat2v3half
%uint_27 = OpConstant %uint 27 %uint_27 = OpConstant %uint 27
%_ptr_StorageBuffer_mat2v4half = OpTypePointer StorageBuffer %mat2v4half %_ptr_StorageBuffer_mat2v4half = OpTypePointer StorageBuffer %mat2v4half
%160 = OpConstantNull %mat2v4half %191 = OpConstantNull %mat2v4half
%uint_28 = OpConstant %uint 28 %uint_28 = OpConstant %uint 28
%_ptr_StorageBuffer_mat3v2half = OpTypePointer StorageBuffer %mat3v2half %_ptr_StorageBuffer_mat3v2half = OpTypePointer StorageBuffer %mat3v2half
%164 = OpConstantNull %mat3v2half %195 = OpConstantNull %mat3v2half
%uint_29 = OpConstant %uint 29 %uint_29 = OpConstant %uint 29
%_ptr_StorageBuffer_mat3v3half = OpTypePointer StorageBuffer %mat3v3half %_ptr_StorageBuffer_mat3v3half = OpTypePointer StorageBuffer %mat3v3half
%168 = OpConstantNull %mat3v3half %199 = OpConstantNull %mat3v3half
%uint_30 = OpConstant %uint 30 %uint_30 = OpConstant %uint 30
%_ptr_StorageBuffer_mat3v4half = OpTypePointer StorageBuffer %mat3v4half %_ptr_StorageBuffer_mat3v4half = OpTypePointer StorageBuffer %mat3v4half
%172 = OpConstantNull %mat3v4half %203 = OpConstantNull %mat3v4half
%uint_31 = OpConstant %uint 31 %uint_31 = OpConstant %uint 31
%_ptr_StorageBuffer_mat4v2half = OpTypePointer StorageBuffer %mat4v2half %_ptr_StorageBuffer_mat4v2half = OpTypePointer StorageBuffer %mat4v2half
%176 = OpConstantNull %mat4v2half %207 = OpConstantNull %mat4v2half
%uint_32 = OpConstant %uint 32 %uint_32 = OpConstant %uint 32
%_ptr_StorageBuffer_mat4v3half = OpTypePointer StorageBuffer %mat4v3half %_ptr_StorageBuffer_mat4v3half = OpTypePointer StorageBuffer %mat4v3half
%180 = OpConstantNull %mat4v3half %211 = OpConstantNull %mat4v3half
%uint_33 = OpConstant %uint 33 %uint_33 = OpConstant %uint 33
%_ptr_StorageBuffer_mat4v4half = OpTypePointer StorageBuffer %mat4v4half %_ptr_StorageBuffer_mat4v4half = OpTypePointer StorageBuffer %mat4v4half
%184 = OpConstantNull %mat4v4half %215 = OpConstantNull %mat4v4half
%uint_34 = OpConstant %uint 34
%_ptr_StorageBuffer__arr_v3float_uint_2 = OpTypePointer StorageBuffer %_arr_v3float_uint_2
%188 = OpConstantNull %_arr_v3float_uint_2
%uint_35 = OpConstant %uint 35 %uint_35 = OpConstant %uint 35
%_ptr_StorageBuffer__arr_mat4v2half_uint_2 = OpTypePointer StorageBuffer %_arr_mat4v2half_uint_2 %_ptr_StorageBuffer__arr_mat4v2half_uint_2 = OpTypePointer StorageBuffer %_arr_mat4v2half_uint_2
%192 = OpConstantNull %_arr_mat4v2half_uint_2 %221 = OpConstantNull %_arr_mat4v2half_uint_2
%193 = OpTypeFunction %void %222 = OpTypeFunction %void
%main_inner = OpFunction %void None %45 %assign_and_preserve_padding_sb_arr_X_arr2_vec3_f32 = OpFunction %void None %45
%dest = OpFunctionParameter %_arr_uint_uint_1
%value = OpFunctionParameter %_arr_v3float_uint_2
%52 = OpLabel
%i = OpVariable %_ptr_Function_uint Function %53
%var_for_index = OpVariable %_ptr_Function__arr_v3float_uint_2 Function %68
OpStore %i %53
OpBranch %56
%56 = OpLabel
OpLoopMerge %57 %58 None
OpBranch %59
%59 = OpLabel
%61 = OpLoad %uint %i
%62 = OpULessThan %bool %61 %uint_2
%60 = OpLogicalNot %bool %62
OpSelectionMerge %64 None
OpBranchConditional %60 %65 %64
%65 = OpLabel
OpBranch %57
%64 = OpLabel
OpStore %var_for_index %value
%71 = OpCompositeExtract %uint %dest 0
%73 = OpLoad %uint %i
%75 = OpAccessChain %_ptr_StorageBuffer_v3float %sb %uint_0 %71 %uint_34 %73
%76 = OpLoad %uint %i
%78 = OpAccessChain %_ptr_Function_v3float %var_for_index %76
%79 = OpLoad %v3float %78
OpStore %75 %79
OpBranch %58
%58 = OpLabel
%80 = OpLoad %uint %i
%81 = OpIAdd %uint %80 %uint_1
OpStore %i %81
OpBranch %56
%57 = OpLabel
OpReturn
OpFunctionEnd
%main_inner = OpFunction %void None %82
%idx = OpFunctionParameter %uint %idx = OpFunctionParameter %uint
%49 = OpLabel %85 = OpLabel
%52 = OpAccessChain %_ptr_StorageBuffer_float %sb %uint_0 %idx %uint_0 %87 = OpAccessChain %_ptr_StorageBuffer_float %sb %uint_0 %idx %uint_0
OpStore %52 %53
%56 = OpAccessChain %_ptr_StorageBuffer_int %sb %uint_0 %idx %uint_1
OpStore %56 %57
%59 = OpAccessChain %_ptr_StorageBuffer_uint %sb %uint_0 %idx %uint_2
OpStore %59 %60
%63 = OpAccessChain %_ptr_StorageBuffer_half %sb %uint_0 %idx %uint_3
OpStore %63 %64
%67 = OpAccessChain %_ptr_StorageBuffer_v2float %sb %uint_0 %idx %uint_4
OpStore %67 %68
%71 = OpAccessChain %_ptr_StorageBuffer_v2int %sb %uint_0 %idx %uint_5
OpStore %71 %72
%75 = OpAccessChain %_ptr_StorageBuffer_v2uint %sb %uint_0 %idx %uint_6
OpStore %75 %76
%79 = OpAccessChain %_ptr_StorageBuffer_v2half %sb %uint_0 %idx %uint_7
OpStore %79 %80
%83 = OpAccessChain %_ptr_StorageBuffer_v3float %sb %uint_0 %idx %uint_8
OpStore %83 %84
%87 = OpAccessChain %_ptr_StorageBuffer_v3int %sb %uint_0 %idx %uint_9
OpStore %87 %88 OpStore %87 %88
%91 = OpAccessChain %_ptr_StorageBuffer_v3uint %sb %uint_0 %idx %uint_10 %90 = OpAccessChain %_ptr_StorageBuffer_int %sb %uint_0 %idx %uint_1
OpStore %91 %92 OpStore %90 %70
%95 = OpAccessChain %_ptr_StorageBuffer_v3half %sb %uint_0 %idx %uint_11 %92 = OpAccessChain %_ptr_StorageBuffer_uint %sb %uint_0 %idx %uint_2
OpStore %92 %53
%95 = OpAccessChain %_ptr_StorageBuffer_half %sb %uint_0 %idx %uint_3
OpStore %95 %96 OpStore %95 %96
%99 = OpAccessChain %_ptr_StorageBuffer_v4float %sb %uint_0 %idx %uint_12 %99 = OpAccessChain %_ptr_StorageBuffer_v2float %sb %uint_0 %idx %uint_4
OpStore %99 %100 OpStore %99 %100
%103 = OpAccessChain %_ptr_StorageBuffer_v4int %sb %uint_0 %idx %uint_13 %103 = OpAccessChain %_ptr_StorageBuffer_v2int %sb %uint_0 %idx %uint_5
OpStore %103 %104 OpStore %103 %104
%107 = OpAccessChain %_ptr_StorageBuffer_v4uint %sb %uint_0 %idx %uint_14 %107 = OpAccessChain %_ptr_StorageBuffer_v2uint %sb %uint_0 %idx %uint_6
OpStore %107 %108 OpStore %107 %108
%111 = OpAccessChain %_ptr_StorageBuffer_v4half %sb %uint_0 %idx %uint_15 %111 = OpAccessChain %_ptr_StorageBuffer_v2half %sb %uint_0 %idx %uint_7
OpStore %111 %112 OpStore %111 %112
%115 = OpAccessChain %_ptr_StorageBuffer_mat2v2float %sb %uint_0 %idx %uint_16 %114 = OpAccessChain %_ptr_StorageBuffer_v3float %sb %uint_0 %idx %uint_8
OpStore %115 %116 OpStore %114 %115
%119 = OpAccessChain %_ptr_StorageBuffer_mat2v3float %sb %uint_0 %idx %uint_17 %118 = OpAccessChain %_ptr_StorageBuffer_v3int %sb %uint_0 %idx %uint_9
OpStore %119 %120 OpStore %118 %119
%123 = OpAccessChain %_ptr_StorageBuffer_mat2v4float %sb %uint_0 %idx %uint_18 %122 = OpAccessChain %_ptr_StorageBuffer_v3uint %sb %uint_0 %idx %uint_10
OpStore %123 %124 OpStore %122 %123
%127 = OpAccessChain %_ptr_StorageBuffer_mat3v2float %sb %uint_0 %idx %uint_19 %126 = OpAccessChain %_ptr_StorageBuffer_v3half %sb %uint_0 %idx %uint_11
OpStore %127 %128 OpStore %126 %127
%131 = OpAccessChain %_ptr_StorageBuffer_mat3v3float %sb %uint_0 %idx %uint_20 %130 = OpAccessChain %_ptr_StorageBuffer_v4float %sb %uint_0 %idx %uint_12
OpStore %131 %132 OpStore %130 %131
%135 = OpAccessChain %_ptr_StorageBuffer_mat3v4float %sb %uint_0 %idx %uint_21 %134 = OpAccessChain %_ptr_StorageBuffer_v4int %sb %uint_0 %idx %uint_13
OpStore %135 %136 OpStore %134 %135
%139 = OpAccessChain %_ptr_StorageBuffer_mat4v2float %sb %uint_0 %idx %uint_22 %138 = OpAccessChain %_ptr_StorageBuffer_v4uint %sb %uint_0 %idx %uint_14
OpStore %139 %140 OpStore %138 %139
%143 = OpAccessChain %_ptr_StorageBuffer_mat4v3float %sb %uint_0 %idx %uint_23 %142 = OpAccessChain %_ptr_StorageBuffer_v4half %sb %uint_0 %idx %uint_15
OpStore %143 %144 OpStore %142 %143
%147 = OpAccessChain %_ptr_StorageBuffer_mat4v4float %sb %uint_0 %idx %uint_24 %146 = OpAccessChain %_ptr_StorageBuffer_mat2v2float %sb %uint_0 %idx %uint_16
OpStore %147 %148 OpStore %146 %147
%151 = OpAccessChain %_ptr_StorageBuffer_mat2v2half %sb %uint_0 %idx %uint_25 %150 = OpAccessChain %_ptr_StorageBuffer_mat2v3float %sb %uint_0 %idx %uint_17
OpStore %151 %152 OpStore %150 %151
%155 = OpAccessChain %_ptr_StorageBuffer_mat2v3half %sb %uint_0 %idx %uint_26 %154 = OpAccessChain %_ptr_StorageBuffer_mat2v4float %sb %uint_0 %idx %uint_18
OpStore %155 %156 OpStore %154 %155
%159 = OpAccessChain %_ptr_StorageBuffer_mat2v4half %sb %uint_0 %idx %uint_27 %158 = OpAccessChain %_ptr_StorageBuffer_mat3v2float %sb %uint_0 %idx %uint_19
OpStore %159 %160 OpStore %158 %159
%163 = OpAccessChain %_ptr_StorageBuffer_mat3v2half %sb %uint_0 %idx %uint_28 %162 = OpAccessChain %_ptr_StorageBuffer_mat3v3float %sb %uint_0 %idx %uint_20
OpStore %163 %164 OpStore %162 %163
%167 = OpAccessChain %_ptr_StorageBuffer_mat3v3half %sb %uint_0 %idx %uint_29 %166 = OpAccessChain %_ptr_StorageBuffer_mat3v4float %sb %uint_0 %idx %uint_21
OpStore %167 %168 OpStore %166 %167
%171 = OpAccessChain %_ptr_StorageBuffer_mat3v4half %sb %uint_0 %idx %uint_30 %170 = OpAccessChain %_ptr_StorageBuffer_mat4v2float %sb %uint_0 %idx %uint_22
OpStore %171 %172 OpStore %170 %171
%175 = OpAccessChain %_ptr_StorageBuffer_mat4v2half %sb %uint_0 %idx %uint_31 %174 = OpAccessChain %_ptr_StorageBuffer_mat4v3float %sb %uint_0 %idx %uint_23
OpStore %175 %176 OpStore %174 %175
%179 = OpAccessChain %_ptr_StorageBuffer_mat4v3half %sb %uint_0 %idx %uint_32 %178 = OpAccessChain %_ptr_StorageBuffer_mat4v4float %sb %uint_0 %idx %uint_24
OpStore %179 %180 OpStore %178 %179
%183 = OpAccessChain %_ptr_StorageBuffer_mat4v4half %sb %uint_0 %idx %uint_33 %182 = OpAccessChain %_ptr_StorageBuffer_mat2v2half %sb %uint_0 %idx %uint_25
OpStore %183 %184 OpStore %182 %183
%187 = OpAccessChain %_ptr_StorageBuffer__arr_v3float_uint_2 %sb %uint_0 %idx %uint_34 %186 = OpAccessChain %_ptr_StorageBuffer_mat2v3half %sb %uint_0 %idx %uint_26
OpStore %187 %188 OpStore %186 %187
%191 = OpAccessChain %_ptr_StorageBuffer__arr_mat4v2half_uint_2 %sb %uint_0 %idx %uint_35 %190 = OpAccessChain %_ptr_StorageBuffer_mat2v4half %sb %uint_0 %idx %uint_27
OpStore %191 %192 OpStore %190 %191
%194 = OpAccessChain %_ptr_StorageBuffer_mat3v2half %sb %uint_0 %idx %uint_28
OpStore %194 %195
%198 = OpAccessChain %_ptr_StorageBuffer_mat3v3half %sb %uint_0 %idx %uint_29
OpStore %198 %199
%202 = OpAccessChain %_ptr_StorageBuffer_mat3v4half %sb %uint_0 %idx %uint_30
OpStore %202 %203
%206 = OpAccessChain %_ptr_StorageBuffer_mat4v2half %sb %uint_0 %idx %uint_31
OpStore %206 %207
%210 = OpAccessChain %_ptr_StorageBuffer_mat4v3half %sb %uint_0 %idx %uint_32
OpStore %210 %211
%214 = OpAccessChain %_ptr_StorageBuffer_mat4v4half %sb %uint_0 %idx %uint_33
OpStore %214 %215
%217 = OpCompositeConstruct %_arr_uint_uint_1 %idx
%216 = OpFunctionCall %void %assign_and_preserve_padding_sb_arr_X_arr2_vec3_f32 %217 %68
%220 = OpAccessChain %_ptr_StorageBuffer__arr_mat4v2half_uint_2 %sb %uint_0 %idx %uint_35
OpStore %220 %221
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%main = OpFunction %void None %193 %main = OpFunction %void None %222
%195 = OpLabel %224 = OpLabel
%197 = OpLoad %uint %idx_1 %226 = OpLoad %uint %idx_1
%196 = OpFunctionCall %void %main_inner %197 %225 = OpFunctionCall %void %main_inner %226
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -46,6 +46,14 @@ layout(binding = 0, std430) buffer sb_block_ssbo {
S inner; S inner;
} sb; } sb;
void assign_and_preserve_padding_sb_arr2_vec3_f32(vec3 value[2]) {
{
for(uint i = 0u; (i < 2u); i = (i + 1u)) {
sb.inner.arr2_vec3_f32[i] = value[i];
}
}
}
void tint_symbol() { void tint_symbol() {
sb.inner.scalar_f32 = 0.0f; sb.inner.scalar_f32 = 0.0f;
sb.inner.scalar_i32 = 0; sb.inner.scalar_i32 = 0;
@ -69,7 +77,7 @@ void tint_symbol() {
sb.inner.mat4x3_f32 = mat4x3(vec3(0.0f), vec3(0.0f), vec3(0.0f), vec3(0.0f)); sb.inner.mat4x3_f32 = mat4x3(vec3(0.0f), vec3(0.0f), vec3(0.0f), vec3(0.0f));
sb.inner.mat4x4_f32 = mat4(vec4(0.0f), vec4(0.0f), vec4(0.0f), vec4(0.0f)); sb.inner.mat4x4_f32 = mat4(vec4(0.0f), vec4(0.0f), vec4(0.0f), vec4(0.0f));
vec3 tint_symbol_1[2] = vec3[2](vec3(0.0f), vec3(0.0f)); vec3 tint_symbol_1[2] = vec3[2](vec3(0.0f), vec3(0.0f));
sb.inner.arr2_vec3_f32 = tint_symbol_1; assign_and_preserve_padding_sb_arr2_vec3_f32(tint_symbol_1);
Inner tint_symbol_2 = Inner(0, 0.0f); Inner tint_symbol_2 = Inner(0, 0.0f);
sb.inner.struct_inner = tint_symbol_2; sb.inner.struct_inner = tint_symbol_2;
Inner tint_symbol_3[4] = Inner[4](Inner(0, 0.0f), Inner(0, 0.0f), Inner(0, 0.0f), Inner(0, 0.0f)); Inner tint_symbol_3[4] = Inner[4](Inner(0, 0.0f), Inner(0, 0.0f), Inner(0, 0.0f), Inner(0, 0.0f));

View File

@ -53,6 +53,12 @@ struct S {
/* 0x0248 */ tint_array<int8_t, 8> tint_pad_6; /* 0x0248 */ tint_array<int8_t, 8> tint_pad_6;
}; };
void assign_and_preserve_padding(device tint_array<float3, 2>* const dest, tint_array<float3, 2> value) {
for(uint i = 0u; (i < 2u); i = (i + 1u)) {
(*(dest))[i] = value[i];
}
}
kernel void tint_symbol(device S* tint_symbol_4 [[buffer(0)]]) { kernel void tint_symbol(device S* tint_symbol_4 [[buffer(0)]]) {
(*(tint_symbol_4)).scalar_f32 = 0.0f; (*(tint_symbol_4)).scalar_f32 = 0.0f;
(*(tint_symbol_4)).scalar_i32 = 0; (*(tint_symbol_4)).scalar_i32 = 0;
@ -76,7 +82,7 @@ kernel void tint_symbol(device S* tint_symbol_4 [[buffer(0)]]) {
(*(tint_symbol_4)).mat4x3_f32 = float4x3(float3(0.0f), float3(0.0f), float3(0.0f), float3(0.0f)); (*(tint_symbol_4)).mat4x3_f32 = float4x3(float3(0.0f), float3(0.0f), float3(0.0f), float3(0.0f));
(*(tint_symbol_4)).mat4x4_f32 = float4x4(float4(0.0f), float4(0.0f), float4(0.0f), float4(0.0f)); (*(tint_symbol_4)).mat4x4_f32 = float4x4(float4(0.0f), float4(0.0f), float4(0.0f), float4(0.0f));
tint_array<float3, 2> const tint_symbol_1 = tint_array<float3, 2>{}; tint_array<float3, 2> const tint_symbol_1 = tint_array<float3, 2>{};
(*(tint_symbol_4)).arr2_vec3_f32 = tint_symbol_1; assign_and_preserve_padding(&((*(tint_symbol_4)).arr2_vec3_f32), tint_symbol_1);
Inner const tint_symbol_2 = Inner{}; Inner const tint_symbol_2 = Inner{};
(*(tint_symbol_4)).struct_inner = tint_symbol_2; (*(tint_symbol_4)).struct_inner = tint_symbol_2;
tint_array<Inner, 4> const tint_symbol_3 = tint_array<Inner, 4>{}; tint_array<Inner, 4> const tint_symbol_3 = tint_array<Inner, 4>{};

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: 129 ; Bound: 154
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
@ -38,6 +38,10 @@
OpMemberName %Inner 1 "scalar_f32" OpMemberName %Inner 1 "scalar_f32"
OpMemberName %S 23 "array_struct_inner" OpMemberName %S 23 "array_struct_inner"
OpName %sb "sb" OpName %sb "sb"
OpName %assign_and_preserve_padding_sb_arr2_vec3_f32 "assign_and_preserve_padding_sb_arr2_vec3_f32"
OpName %value "value"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %main "main" OpName %main "main"
OpDecorate %sb_block Block OpDecorate %sb_block Block
OpMemberDecorate %sb_block 0 Offset 0 OpMemberDecorate %sb_block 0 Offset 0
@ -120,126 +124,164 @@
%_ptr_StorageBuffer_sb_block = OpTypePointer StorageBuffer %sb_block %_ptr_StorageBuffer_sb_block = OpTypePointer StorageBuffer %sb_block
%sb = OpVariable %_ptr_StorageBuffer_sb_block StorageBuffer %sb = OpVariable %_ptr_StorageBuffer_sb_block StorageBuffer
%void = OpTypeVoid %void = OpTypeVoid
%31 = OpTypeFunction %void %31 = OpTypeFunction %void %_arr_v3float_uint_2
%36 = OpConstantNull %uint
%_ptr_Function_uint = OpTypePointer Function %uint
%bool = OpTypeBool
%_ptr_Function__arr_v3float_uint_2 = OpTypePointer Function %_arr_v3float_uint_2
%51 = OpConstantNull %_arr_v3float_uint_2
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float %uint_21 = OpConstant %uint 21
%38 = OpConstantNull %float %_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float
%_ptr_Function_v3float = OpTypePointer Function %v3float
%uint_1 = OpConstant %uint 1 %uint_1 = OpConstant %uint 1
%64 = OpTypeFunction %void
%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
%69 = OpConstantNull %float
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%42 = OpConstantNull %int %72 = OpConstantNull %int
%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
%45 = OpConstantNull %uint
%uint_3 = OpConstant %uint 3 %uint_3 = OpConstant %uint 3
%_ptr_StorageBuffer_v2float = OpTypePointer StorageBuffer %v2float %_ptr_StorageBuffer_v2float = OpTypePointer StorageBuffer %v2float
%49 = OpConstantNull %v2float %78 = OpConstantNull %v2float
%_ptr_StorageBuffer_v2int = OpTypePointer StorageBuffer %v2int %_ptr_StorageBuffer_v2int = OpTypePointer StorageBuffer %v2int
%52 = OpConstantNull %v2int %81 = OpConstantNull %v2int
%uint_5 = OpConstant %uint 5 %uint_5 = OpConstant %uint 5
%_ptr_StorageBuffer_v2uint = OpTypePointer StorageBuffer %v2uint %_ptr_StorageBuffer_v2uint = OpTypePointer StorageBuffer %v2uint
%56 = OpConstantNull %v2uint %85 = OpConstantNull %v2uint
%uint_6 = OpConstant %uint 6 %uint_6 = OpConstant %uint 6
%_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float %88 = OpConstantNull %v3float
%60 = OpConstantNull %v3float
%uint_7 = OpConstant %uint 7 %uint_7 = OpConstant %uint 7
%_ptr_StorageBuffer_v3int = OpTypePointer StorageBuffer %v3int %_ptr_StorageBuffer_v3int = OpTypePointer StorageBuffer %v3int
%64 = OpConstantNull %v3int %92 = OpConstantNull %v3int
%uint_8 = OpConstant %uint 8 %uint_8 = OpConstant %uint 8
%_ptr_StorageBuffer_v3uint = OpTypePointer StorageBuffer %v3uint %_ptr_StorageBuffer_v3uint = OpTypePointer StorageBuffer %v3uint
%68 = OpConstantNull %v3uint %96 = OpConstantNull %v3uint
%uint_9 = OpConstant %uint 9 %uint_9 = OpConstant %uint 9
%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float %_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float
%72 = OpConstantNull %v4float %100 = OpConstantNull %v4float
%uint_10 = OpConstant %uint 10 %uint_10 = OpConstant %uint 10
%_ptr_StorageBuffer_v4int = OpTypePointer StorageBuffer %v4int %_ptr_StorageBuffer_v4int = OpTypePointer StorageBuffer %v4int
%76 = OpConstantNull %v4int %104 = OpConstantNull %v4int
%uint_11 = OpConstant %uint 11 %uint_11 = OpConstant %uint 11
%_ptr_StorageBuffer_v4uint = OpTypePointer StorageBuffer %v4uint %_ptr_StorageBuffer_v4uint = OpTypePointer StorageBuffer %v4uint
%80 = OpConstantNull %v4uint %108 = OpConstantNull %v4uint
%uint_12 = OpConstant %uint 12 %uint_12 = OpConstant %uint 12
%_ptr_StorageBuffer_mat2v2float = OpTypePointer StorageBuffer %mat2v2float %_ptr_StorageBuffer_mat2v2float = OpTypePointer StorageBuffer %mat2v2float
%84 = OpConstantNull %mat2v2float %112 = OpConstantNull %mat2v2float
%uint_13 = OpConstant %uint 13 %uint_13 = OpConstant %uint 13
%_ptr_StorageBuffer_mat2v3float = OpTypePointer StorageBuffer %mat2v3float %_ptr_StorageBuffer_mat2v3float = OpTypePointer StorageBuffer %mat2v3float
%88 = OpConstantNull %mat2v3float %116 = OpConstantNull %mat2v3float
%uint_14 = OpConstant %uint 14 %uint_14 = OpConstant %uint 14
%_ptr_StorageBuffer_mat2v4float = OpTypePointer StorageBuffer %mat2v4float %_ptr_StorageBuffer_mat2v4float = OpTypePointer StorageBuffer %mat2v4float
%92 = OpConstantNull %mat2v4float %120 = OpConstantNull %mat2v4float
%uint_15 = OpConstant %uint 15 %uint_15 = OpConstant %uint 15
%_ptr_StorageBuffer_mat3v2float = OpTypePointer StorageBuffer %mat3v2float %_ptr_StorageBuffer_mat3v2float = OpTypePointer StorageBuffer %mat3v2float
%96 = OpConstantNull %mat3v2float %124 = OpConstantNull %mat3v2float
%uint_16 = OpConstant %uint 16 %uint_16 = OpConstant %uint 16
%_ptr_StorageBuffer_mat3v3float = OpTypePointer StorageBuffer %mat3v3float %_ptr_StorageBuffer_mat3v3float = OpTypePointer StorageBuffer %mat3v3float
%100 = OpConstantNull %mat3v3float %128 = OpConstantNull %mat3v3float
%uint_17 = OpConstant %uint 17 %uint_17 = OpConstant %uint 17
%_ptr_StorageBuffer_mat3v4float = OpTypePointer StorageBuffer %mat3v4float %_ptr_StorageBuffer_mat3v4float = OpTypePointer StorageBuffer %mat3v4float
%104 = OpConstantNull %mat3v4float %132 = OpConstantNull %mat3v4float
%uint_18 = OpConstant %uint 18 %uint_18 = OpConstant %uint 18
%_ptr_StorageBuffer_mat4v2float = OpTypePointer StorageBuffer %mat4v2float %_ptr_StorageBuffer_mat4v2float = OpTypePointer StorageBuffer %mat4v2float
%108 = OpConstantNull %mat4v2float %136 = OpConstantNull %mat4v2float
%uint_19 = OpConstant %uint 19 %uint_19 = OpConstant %uint 19
%_ptr_StorageBuffer_mat4v3float = OpTypePointer StorageBuffer %mat4v3float %_ptr_StorageBuffer_mat4v3float = OpTypePointer StorageBuffer %mat4v3float
%112 = OpConstantNull %mat4v3float %140 = OpConstantNull %mat4v3float
%uint_20 = OpConstant %uint 20 %uint_20 = OpConstant %uint 20
%_ptr_StorageBuffer_mat4v4float = OpTypePointer StorageBuffer %mat4v4float %_ptr_StorageBuffer_mat4v4float = OpTypePointer StorageBuffer %mat4v4float
%116 = OpConstantNull %mat4v4float %144 = OpConstantNull %mat4v4float
%uint_21 = OpConstant %uint 21
%_ptr_StorageBuffer__arr_v3float_uint_2 = OpTypePointer StorageBuffer %_arr_v3float_uint_2
%120 = OpConstantNull %_arr_v3float_uint_2
%uint_22 = OpConstant %uint 22 %uint_22 = OpConstant %uint 22
%_ptr_StorageBuffer_Inner = OpTypePointer StorageBuffer %Inner %_ptr_StorageBuffer_Inner = OpTypePointer StorageBuffer %Inner
%124 = OpConstantNull %Inner %149 = OpConstantNull %Inner
%uint_23 = OpConstant %uint 23 %uint_23 = OpConstant %uint 23
%_ptr_StorageBuffer__arr_Inner_uint_4 = OpTypePointer StorageBuffer %_arr_Inner_uint_4 %_ptr_StorageBuffer__arr_Inner_uint_4 = OpTypePointer StorageBuffer %_arr_Inner_uint_4
%128 = OpConstantNull %_arr_Inner_uint_4 %153 = OpConstantNull %_arr_Inner_uint_4
%main = OpFunction %void None %31 %assign_and_preserve_padding_sb_arr2_vec3_f32 = OpFunction %void None %31
%34 = OpLabel %value = OpFunctionParameter %_arr_v3float_uint_2
%37 = OpAccessChain %_ptr_StorageBuffer_float %sb %uint_0 %uint_0 %35 = OpLabel
OpStore %37 %38 %i = OpVariable %_ptr_Function_uint Function %36
%41 = OpAccessChain %_ptr_StorageBuffer_int %sb %uint_0 %uint_1 %var_for_index = OpVariable %_ptr_Function__arr_v3float_uint_2 Function %51
OpStore %41 %42 OpStore %i %36
%44 = OpAccessChain %_ptr_StorageBuffer_uint %sb %uint_0 %uint_2 OpBranch %39
OpStore %44 %45 %39 = OpLabel
%48 = OpAccessChain %_ptr_StorageBuffer_v2float %sb %uint_0 %uint_3 OpLoopMerge %40 %41 None
OpStore %48 %49 OpBranch %42
%51 = OpAccessChain %_ptr_StorageBuffer_v2int %sb %uint_0 %uint_4 %42 = OpLabel
OpStore %51 %52 %44 = OpLoad %uint %i
%55 = OpAccessChain %_ptr_StorageBuffer_v2uint %sb %uint_0 %uint_5 %45 = OpULessThan %bool %44 %uint_2
OpStore %55 %56 %43 = OpLogicalNot %bool %45
%59 = OpAccessChain %_ptr_StorageBuffer_v3float %sb %uint_0 %uint_6 OpSelectionMerge %47 None
OpStore %59 %60 OpBranchConditional %43 %48 %47
%63 = OpAccessChain %_ptr_StorageBuffer_v3int %sb %uint_0 %uint_7 %48 = OpLabel
OpStore %63 %64 OpBranch %40
%67 = OpAccessChain %_ptr_StorageBuffer_v3uint %sb %uint_0 %uint_8 %47 = OpLabel
OpStore %67 %68 OpStore %var_for_index %value
%71 = OpAccessChain %_ptr_StorageBuffer_v4float %sb %uint_0 %uint_9 %54 = OpLoad %uint %i
OpStore %71 %72 %56 = OpAccessChain %_ptr_StorageBuffer_v3float %sb %uint_0 %uint_21 %54
%75 = OpAccessChain %_ptr_StorageBuffer_v4int %sb %uint_0 %uint_10 %57 = OpLoad %uint %i
OpStore %75 %76 %59 = OpAccessChain %_ptr_Function_v3float %var_for_index %57
%79 = OpAccessChain %_ptr_StorageBuffer_v4uint %sb %uint_0 %uint_11 %60 = OpLoad %v3float %59
OpStore %79 %80 OpStore %56 %60
%83 = OpAccessChain %_ptr_StorageBuffer_mat2v2float %sb %uint_0 %uint_12 OpBranch %41
OpStore %83 %84 %41 = OpLabel
%87 = OpAccessChain %_ptr_StorageBuffer_mat2v3float %sb %uint_0 %uint_13 %61 = OpLoad %uint %i
OpStore %87 %88 %63 = OpIAdd %uint %61 %uint_1
%91 = OpAccessChain %_ptr_StorageBuffer_mat2v4float %sb %uint_0 %uint_14 OpStore %i %63
OpStore %91 %92 OpBranch %39
%95 = OpAccessChain %_ptr_StorageBuffer_mat3v2float %sb %uint_0 %uint_15 %40 = OpLabel
OpStore %95 %96 OpReturn
%99 = OpAccessChain %_ptr_StorageBuffer_mat3v3float %sb %uint_0 %uint_16 OpFunctionEnd
OpStore %99 %100 %main = OpFunction %void None %64
%103 = OpAccessChain %_ptr_StorageBuffer_mat3v4float %sb %uint_0 %uint_17 %66 = OpLabel
OpStore %103 %104 %68 = OpAccessChain %_ptr_StorageBuffer_float %sb %uint_0 %uint_0
%107 = OpAccessChain %_ptr_StorageBuffer_mat4v2float %sb %uint_0 %uint_18 OpStore %68 %69
OpStore %107 %108 %71 = OpAccessChain %_ptr_StorageBuffer_int %sb %uint_0 %uint_1
%111 = OpAccessChain %_ptr_StorageBuffer_mat4v3float %sb %uint_0 %uint_19 OpStore %71 %72
OpStore %111 %112 %74 = OpAccessChain %_ptr_StorageBuffer_uint %sb %uint_0 %uint_2
%115 = OpAccessChain %_ptr_StorageBuffer_mat4v4float %sb %uint_0 %uint_20 OpStore %74 %36
OpStore %115 %116 %77 = OpAccessChain %_ptr_StorageBuffer_v2float %sb %uint_0 %uint_3
%119 = OpAccessChain %_ptr_StorageBuffer__arr_v3float_uint_2 %sb %uint_0 %uint_21 OpStore %77 %78
OpStore %119 %120 %80 = OpAccessChain %_ptr_StorageBuffer_v2int %sb %uint_0 %uint_4
%123 = OpAccessChain %_ptr_StorageBuffer_Inner %sb %uint_0 %uint_22 OpStore %80 %81
OpStore %123 %124 %84 = OpAccessChain %_ptr_StorageBuffer_v2uint %sb %uint_0 %uint_5
%127 = OpAccessChain %_ptr_StorageBuffer__arr_Inner_uint_4 %sb %uint_0 %uint_23 OpStore %84 %85
OpStore %127 %128 %87 = OpAccessChain %_ptr_StorageBuffer_v3float %sb %uint_0 %uint_6
OpStore %87 %88
%91 = OpAccessChain %_ptr_StorageBuffer_v3int %sb %uint_0 %uint_7
OpStore %91 %92
%95 = OpAccessChain %_ptr_StorageBuffer_v3uint %sb %uint_0 %uint_8
OpStore %95 %96
%99 = OpAccessChain %_ptr_StorageBuffer_v4float %sb %uint_0 %uint_9
OpStore %99 %100
%103 = OpAccessChain %_ptr_StorageBuffer_v4int %sb %uint_0 %uint_10
OpStore %103 %104
%107 = OpAccessChain %_ptr_StorageBuffer_v4uint %sb %uint_0 %uint_11
OpStore %107 %108
%111 = OpAccessChain %_ptr_StorageBuffer_mat2v2float %sb %uint_0 %uint_12
OpStore %111 %112
%115 = OpAccessChain %_ptr_StorageBuffer_mat2v3float %sb %uint_0 %uint_13
OpStore %115 %116
%119 = OpAccessChain %_ptr_StorageBuffer_mat2v4float %sb %uint_0 %uint_14
OpStore %119 %120
%123 = OpAccessChain %_ptr_StorageBuffer_mat3v2float %sb %uint_0 %uint_15
OpStore %123 %124
%127 = OpAccessChain %_ptr_StorageBuffer_mat3v3float %sb %uint_0 %uint_16
OpStore %127 %128
%131 = OpAccessChain %_ptr_StorageBuffer_mat3v4float %sb %uint_0 %uint_17
OpStore %131 %132
%135 = OpAccessChain %_ptr_StorageBuffer_mat4v2float %sb %uint_0 %uint_18
OpStore %135 %136
%139 = OpAccessChain %_ptr_StorageBuffer_mat4v3float %sb %uint_0 %uint_19
OpStore %139 %140
%143 = OpAccessChain %_ptr_StorageBuffer_mat4v4float %sb %uint_0 %uint_20
OpStore %143 %144
%145 = OpFunctionCall %void %assign_and_preserve_padding_sb_arr2_vec3_f32 %51
%148 = OpAccessChain %_ptr_StorageBuffer_Inner %sb %uint_0 %uint_22
OpStore %148 %149
%152 = OpAccessChain %_ptr_StorageBuffer__arr_Inner_uint_4 %sb %uint_0 %uint_23
OpStore %152 %153
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -66,6 +66,35 @@ layout(binding = 0, std430) buffer sb_block_ssbo {
S inner; S inner;
} sb; } sb;
void assign_and_preserve_padding_sb_arr2_vec3_f32(vec3 value[2]) {
{
for(uint i = 0u; (i < 2u); i = (i + 1u)) {
sb.inner.arr2_vec3_f32[i] = value[i];
}
}
}
void assign_and_preserve_padding_1_sb_struct_inner(Inner value) {
sb.inner.struct_inner.scalar_i32 = value.scalar_i32;
sb.inner.struct_inner.scalar_f32 = value.scalar_f32;
sb.inner.struct_inner.scalar_f16 = value.scalar_f16;
}
void assign_and_preserve_padding_1_sb_array_struct_inner_X(uint dest[1], Inner value) {
sb.inner.array_struct_inner[dest[0]].scalar_i32 = value.scalar_i32;
sb.inner.array_struct_inner[dest[0]].scalar_f32 = value.scalar_f32;
sb.inner.array_struct_inner[dest[0]].scalar_f16 = value.scalar_f16;
}
void assign_and_preserve_padding_2_sb_array_struct_inner(Inner value[4]) {
{
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
uint tint_symbol_1[1] = uint[1](i);
assign_and_preserve_padding_1_sb_array_struct_inner_X(tint_symbol_1, value[i]);
}
}
}
void tint_symbol() { void tint_symbol() {
sb.inner.scalar_f32 = 0.0f; sb.inner.scalar_f32 = 0.0f;
sb.inner.scalar_i32 = 0; sb.inner.scalar_i32 = 0;
@ -101,14 +130,14 @@ void tint_symbol() {
sb.inner.mat4x2_f16 = f16mat4x2(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf)); sb.inner.mat4x2_f16 = f16mat4x2(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf));
sb.inner.mat4x3_f16 = f16mat4x3(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf)); sb.inner.mat4x3_f16 = f16mat4x3(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf));
sb.inner.mat4x4_f16 = f16mat4(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf)); sb.inner.mat4x4_f16 = f16mat4(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf));
vec3 tint_symbol_1[2] = vec3[2](vec3(0.0f), vec3(0.0f)); vec3 tint_symbol_2[2] = vec3[2](vec3(0.0f), vec3(0.0f));
sb.inner.arr2_vec3_f32 = tint_symbol_1; assign_and_preserve_padding_sb_arr2_vec3_f32(tint_symbol_2);
f16mat4x2 tint_symbol_2[2] = f16mat4x2[2](f16mat4x2(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf)), f16mat4x2(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf))); f16mat4x2 tint_symbol_3[2] = f16mat4x2[2](f16mat4x2(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf)), f16mat4x2(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf)));
sb.inner.arr2_mat4x2_f16 = tint_symbol_2; sb.inner.arr2_mat4x2_f16 = tint_symbol_3;
Inner tint_symbol_3 = Inner(0, 0.0f, 0.0hf); Inner tint_symbol_4 = Inner(0, 0.0f, 0.0hf);
sb.inner.struct_inner = tint_symbol_3; assign_and_preserve_padding_1_sb_struct_inner(tint_symbol_4);
Inner tint_symbol_4[4] = Inner[4](Inner(0, 0.0f, 0.0hf), Inner(0, 0.0f, 0.0hf), Inner(0, 0.0f, 0.0hf), Inner(0, 0.0f, 0.0hf)); Inner tint_symbol_5[4] = Inner[4](Inner(0, 0.0f, 0.0hf), Inner(0, 0.0f, 0.0hf), Inner(0, 0.0f, 0.0hf), Inner(0, 0.0f, 0.0hf));
sb.inner.array_struct_inner = tint_symbol_4; assign_and_preserve_padding_2_sb_array_struct_inner(tint_symbol_5);
} }
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;

View File

@ -73,6 +73,24 @@ struct S {
/* 0x035c */ tint_array<int8_t, 4> tint_pad_11; /* 0x035c */ tint_array<int8_t, 4> tint_pad_11;
}; };
void assign_and_preserve_padding(device tint_array<float3, 2>* const dest, tint_array<float3, 2> value) {
for(uint i = 0u; (i < 2u); i = (i + 1u)) {
(*(dest))[i] = value[i];
}
}
void assign_and_preserve_padding_1(device Inner* const dest, Inner value) {
(*(dest)).scalar_i32 = value.scalar_i32;
(*(dest)).scalar_f32 = value.scalar_f32;
(*(dest)).scalar_f16 = value.scalar_f16;
}
void assign_and_preserve_padding_2(device tint_array<Inner, 4>* const dest, tint_array<Inner, 4> value) {
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
assign_and_preserve_padding_1(&((*(dest))[i]), value[i]);
}
}
kernel void tint_symbol(device S* tint_symbol_5 [[buffer(0)]]) { kernel void tint_symbol(device S* tint_symbol_5 [[buffer(0)]]) {
(*(tint_symbol_5)).scalar_f32 = 0.0f; (*(tint_symbol_5)).scalar_f32 = 0.0f;
(*(tint_symbol_5)).scalar_i32 = 0; (*(tint_symbol_5)).scalar_i32 = 0;
@ -109,13 +127,13 @@ kernel void tint_symbol(device S* tint_symbol_5 [[buffer(0)]]) {
(*(tint_symbol_5)).mat4x3_f16 = half4x3(half3(0.0h), half3(0.0h), half3(0.0h), half3(0.0h)); (*(tint_symbol_5)).mat4x3_f16 = half4x3(half3(0.0h), half3(0.0h), half3(0.0h), half3(0.0h));
(*(tint_symbol_5)).mat4x4_f16 = half4x4(half4(0.0h), half4(0.0h), half4(0.0h), half4(0.0h)); (*(tint_symbol_5)).mat4x4_f16 = half4x4(half4(0.0h), half4(0.0h), half4(0.0h), half4(0.0h));
tint_array<float3, 2> const tint_symbol_1 = tint_array<float3, 2>{}; tint_array<float3, 2> const tint_symbol_1 = tint_array<float3, 2>{};
(*(tint_symbol_5)).arr2_vec3_f32 = tint_symbol_1; assign_and_preserve_padding(&((*(tint_symbol_5)).arr2_vec3_f32), tint_symbol_1);
tint_array<half4x2, 2> const tint_symbol_2 = tint_array<half4x2, 2>{}; tint_array<half4x2, 2> const tint_symbol_4 = tint_array<half4x2, 2>{};
(*(tint_symbol_5)).arr2_mat4x2_f16 = tint_symbol_2; (*(tint_symbol_5)).arr2_mat4x2_f16 = tint_symbol_4;
Inner const tint_symbol_3 = Inner{}; Inner const tint_symbol_2 = Inner{};
(*(tint_symbol_5)).struct_inner = tint_symbol_3; assign_and_preserve_padding_1(&((*(tint_symbol_5)).struct_inner), tint_symbol_2);
tint_array<Inner, 4> const tint_symbol_4 = tint_array<Inner, 4>{}; tint_array<Inner, 4> const tint_symbol_3 = tint_array<Inner, 4>{};
(*(tint_symbol_5)).array_struct_inner = tint_symbol_4; assign_and_preserve_padding_2(&((*(tint_symbol_5)).array_struct_inner), tint_symbol_3);
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: 199 ; Bound: 272
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpCapability Float16 OpCapability Float16
@ -57,6 +57,19 @@
OpMemberName %Inner 2 "scalar_f16" OpMemberName %Inner 2 "scalar_f16"
OpMemberName %S 37 "array_struct_inner" OpMemberName %S 37 "array_struct_inner"
OpName %sb "sb" OpName %sb "sb"
OpName %assign_and_preserve_padding_sb_arr2_vec3_f32 "assign_and_preserve_padding_sb_arr2_vec3_f32"
OpName %value "value"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %assign_and_preserve_padding_1_sb_struct_inner "assign_and_preserve_padding_1_sb_struct_inner"
OpName %value_0 "value"
OpName %assign_and_preserve_padding_1_sb_array_struct_inner_X "assign_and_preserve_padding_1_sb_array_struct_inner_X"
OpName %dest "dest"
OpName %value_1 "value"
OpName %assign_and_preserve_padding_2_sb_array_struct_inner "assign_and_preserve_padding_2_sb_array_struct_inner"
OpName %value_2 "value"
OpName %i_0 "i"
OpName %var_for_index_1 "var_for_index_1"
OpName %main "main" OpName %main "main"
OpDecorate %sb_block Block OpDecorate %sb_block Block
OpMemberDecorate %sb_block 0 Offset 0 OpMemberDecorate %sb_block 0 Offset 0
@ -144,6 +157,7 @@
OpDecorate %_arr_Inner_uint_4 ArrayStride 12 OpDecorate %_arr_Inner_uint_4 ArrayStride 12
OpDecorate %sb Binding 0 OpDecorate %sb Binding 0
OpDecorate %sb DescriptorSet 0 OpDecorate %sb DescriptorSet 0
OpDecorate %_arr_uint_uint_1 ArrayStride 4
%float = OpTypeFloat 32 %float = OpTypeFloat 32
%int = OpTypeInt 32 1 %int = OpTypeInt 32 1
%uint = OpTypeInt 32 0 %uint = OpTypeInt 32 0
@ -189,196 +203,303 @@
%_ptr_StorageBuffer_sb_block = OpTypePointer StorageBuffer %sb_block %_ptr_StorageBuffer_sb_block = OpTypePointer StorageBuffer %sb_block
%sb = OpVariable %_ptr_StorageBuffer_sb_block StorageBuffer %sb = OpVariable %_ptr_StorageBuffer_sb_block StorageBuffer
%void = OpTypeVoid %void = OpTypeVoid
%45 = OpTypeFunction %void %45 = OpTypeFunction %void %_arr_v3float_uint_2
%50 = OpConstantNull %uint
%_ptr_Function_uint = OpTypePointer Function %uint
%bool = OpTypeBool
%_ptr_Function__arr_v3float_uint_2 = OpTypePointer Function %_arr_v3float_uint_2
%65 = OpConstantNull %_arr_v3float_uint_2
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float %uint_34 = OpConstant %uint 34
%52 = OpConstantNull %float %_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float
%_ptr_Function_v3float = OpTypePointer Function %v3float
%uint_1 = OpConstant %uint 1 %uint_1 = OpConstant %uint 1
%78 = OpTypeFunction %void %Inner
%uint_36 = OpConstant %uint 36
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%56 = OpConstantNull %int %_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
%59 = OpConstantNull %uint
%uint_3 = OpConstant %uint 3
%_ptr_StorageBuffer_half = OpTypePointer StorageBuffer %half %_ptr_StorageBuffer_half = OpTypePointer StorageBuffer %half
%63 = OpConstantNull %half %_arr_uint_uint_1 = OpTypeArray %uint %uint_1
%92 = OpTypeFunction %void %_arr_uint_uint_1 %Inner
%uint_37 = OpConstant %uint 37
%99 = OpConstantNull %int
%109 = OpTypeFunction %void %_arr_Inner_uint_4
%_ptr_Function__arr_Inner_uint_4 = OpTypePointer Function %_arr_Inner_uint_4
%125 = OpConstantNull %_arr_Inner_uint_4
%_ptr_Function_Inner = OpTypePointer Function %Inner
%135 = OpTypeFunction %void
%139 = OpConstantNull %float
%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
%uint_3 = OpConstant %uint 3
%145 = OpConstantNull %half
%_ptr_StorageBuffer_v2float = OpTypePointer StorageBuffer %v2float %_ptr_StorageBuffer_v2float = OpTypePointer StorageBuffer %v2float
%66 = OpConstantNull %v2float %148 = OpConstantNull %v2float
%uint_5 = OpConstant %uint 5 %uint_5 = OpConstant %uint 5
%_ptr_StorageBuffer_v2int = OpTypePointer StorageBuffer %v2int %_ptr_StorageBuffer_v2int = OpTypePointer StorageBuffer %v2int
%70 = OpConstantNull %v2int %152 = OpConstantNull %v2int
%uint_6 = OpConstant %uint 6 %uint_6 = OpConstant %uint 6
%_ptr_StorageBuffer_v2uint = OpTypePointer StorageBuffer %v2uint %_ptr_StorageBuffer_v2uint = OpTypePointer StorageBuffer %v2uint
%74 = OpConstantNull %v2uint %156 = OpConstantNull %v2uint
%uint_7 = OpConstant %uint 7 %uint_7 = OpConstant %uint 7
%_ptr_StorageBuffer_v2half = OpTypePointer StorageBuffer %v2half %_ptr_StorageBuffer_v2half = OpTypePointer StorageBuffer %v2half
%78 = OpConstantNull %v2half %160 = OpConstantNull %v2half
%uint_8 = OpConstant %uint 8 %uint_8 = OpConstant %uint 8
%_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float %163 = OpConstantNull %v3float
%82 = OpConstantNull %v3float
%uint_9 = OpConstant %uint 9 %uint_9 = OpConstant %uint 9
%_ptr_StorageBuffer_v3int = OpTypePointer StorageBuffer %v3int %_ptr_StorageBuffer_v3int = OpTypePointer StorageBuffer %v3int
%86 = OpConstantNull %v3int %167 = OpConstantNull %v3int
%uint_10 = OpConstant %uint 10 %uint_10 = OpConstant %uint 10
%_ptr_StorageBuffer_v3uint = OpTypePointer StorageBuffer %v3uint %_ptr_StorageBuffer_v3uint = OpTypePointer StorageBuffer %v3uint
%90 = OpConstantNull %v3uint %171 = OpConstantNull %v3uint
%uint_11 = OpConstant %uint 11 %uint_11 = OpConstant %uint 11
%_ptr_StorageBuffer_v3half = OpTypePointer StorageBuffer %v3half %_ptr_StorageBuffer_v3half = OpTypePointer StorageBuffer %v3half
%94 = OpConstantNull %v3half %175 = OpConstantNull %v3half
%uint_12 = OpConstant %uint 12 %uint_12 = OpConstant %uint 12
%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float %_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float
%98 = OpConstantNull %v4float %179 = OpConstantNull %v4float
%uint_13 = OpConstant %uint 13 %uint_13 = OpConstant %uint 13
%_ptr_StorageBuffer_v4int = OpTypePointer StorageBuffer %v4int %_ptr_StorageBuffer_v4int = OpTypePointer StorageBuffer %v4int
%102 = OpConstantNull %v4int %183 = OpConstantNull %v4int
%uint_14 = OpConstant %uint 14 %uint_14 = OpConstant %uint 14
%_ptr_StorageBuffer_v4uint = OpTypePointer StorageBuffer %v4uint %_ptr_StorageBuffer_v4uint = OpTypePointer StorageBuffer %v4uint
%106 = OpConstantNull %v4uint %187 = OpConstantNull %v4uint
%uint_15 = OpConstant %uint 15 %uint_15 = OpConstant %uint 15
%_ptr_StorageBuffer_v4half = OpTypePointer StorageBuffer %v4half %_ptr_StorageBuffer_v4half = OpTypePointer StorageBuffer %v4half
%110 = OpConstantNull %v4half %191 = OpConstantNull %v4half
%uint_16 = OpConstant %uint 16 %uint_16 = OpConstant %uint 16
%_ptr_StorageBuffer_mat2v2float = OpTypePointer StorageBuffer %mat2v2float %_ptr_StorageBuffer_mat2v2float = OpTypePointer StorageBuffer %mat2v2float
%114 = OpConstantNull %mat2v2float %195 = OpConstantNull %mat2v2float
%uint_17 = OpConstant %uint 17 %uint_17 = OpConstant %uint 17
%_ptr_StorageBuffer_mat2v3float = OpTypePointer StorageBuffer %mat2v3float %_ptr_StorageBuffer_mat2v3float = OpTypePointer StorageBuffer %mat2v3float
%118 = OpConstantNull %mat2v3float %199 = OpConstantNull %mat2v3float
%uint_18 = OpConstant %uint 18 %uint_18 = OpConstant %uint 18
%_ptr_StorageBuffer_mat2v4float = OpTypePointer StorageBuffer %mat2v4float %_ptr_StorageBuffer_mat2v4float = OpTypePointer StorageBuffer %mat2v4float
%122 = OpConstantNull %mat2v4float %203 = OpConstantNull %mat2v4float
%uint_19 = OpConstant %uint 19 %uint_19 = OpConstant %uint 19
%_ptr_StorageBuffer_mat3v2float = OpTypePointer StorageBuffer %mat3v2float %_ptr_StorageBuffer_mat3v2float = OpTypePointer StorageBuffer %mat3v2float
%126 = OpConstantNull %mat3v2float %207 = OpConstantNull %mat3v2float
%uint_20 = OpConstant %uint 20 %uint_20 = OpConstant %uint 20
%_ptr_StorageBuffer_mat3v3float = OpTypePointer StorageBuffer %mat3v3float %_ptr_StorageBuffer_mat3v3float = OpTypePointer StorageBuffer %mat3v3float
%130 = OpConstantNull %mat3v3float %211 = OpConstantNull %mat3v3float
%uint_21 = OpConstant %uint 21 %uint_21 = OpConstant %uint 21
%_ptr_StorageBuffer_mat3v4float = OpTypePointer StorageBuffer %mat3v4float %_ptr_StorageBuffer_mat3v4float = OpTypePointer StorageBuffer %mat3v4float
%134 = OpConstantNull %mat3v4float %215 = OpConstantNull %mat3v4float
%uint_22 = OpConstant %uint 22 %uint_22 = OpConstant %uint 22
%_ptr_StorageBuffer_mat4v2float = OpTypePointer StorageBuffer %mat4v2float %_ptr_StorageBuffer_mat4v2float = OpTypePointer StorageBuffer %mat4v2float
%138 = OpConstantNull %mat4v2float %219 = OpConstantNull %mat4v2float
%uint_23 = OpConstant %uint 23 %uint_23 = OpConstant %uint 23
%_ptr_StorageBuffer_mat4v3float = OpTypePointer StorageBuffer %mat4v3float %_ptr_StorageBuffer_mat4v3float = OpTypePointer StorageBuffer %mat4v3float
%142 = OpConstantNull %mat4v3float %223 = OpConstantNull %mat4v3float
%uint_24 = OpConstant %uint 24 %uint_24 = OpConstant %uint 24
%_ptr_StorageBuffer_mat4v4float = OpTypePointer StorageBuffer %mat4v4float %_ptr_StorageBuffer_mat4v4float = OpTypePointer StorageBuffer %mat4v4float
%146 = OpConstantNull %mat4v4float %227 = OpConstantNull %mat4v4float
%uint_25 = OpConstant %uint 25 %uint_25 = OpConstant %uint 25
%_ptr_StorageBuffer_mat2v2half = OpTypePointer StorageBuffer %mat2v2half %_ptr_StorageBuffer_mat2v2half = OpTypePointer StorageBuffer %mat2v2half
%150 = OpConstantNull %mat2v2half %231 = OpConstantNull %mat2v2half
%uint_26 = OpConstant %uint 26 %uint_26 = OpConstant %uint 26
%_ptr_StorageBuffer_mat2v3half = OpTypePointer StorageBuffer %mat2v3half %_ptr_StorageBuffer_mat2v3half = OpTypePointer StorageBuffer %mat2v3half
%154 = OpConstantNull %mat2v3half %235 = OpConstantNull %mat2v3half
%uint_27 = OpConstant %uint 27 %uint_27 = OpConstant %uint 27
%_ptr_StorageBuffer_mat2v4half = OpTypePointer StorageBuffer %mat2v4half %_ptr_StorageBuffer_mat2v4half = OpTypePointer StorageBuffer %mat2v4half
%158 = OpConstantNull %mat2v4half %239 = OpConstantNull %mat2v4half
%uint_28 = OpConstant %uint 28 %uint_28 = OpConstant %uint 28
%_ptr_StorageBuffer_mat3v2half = OpTypePointer StorageBuffer %mat3v2half %_ptr_StorageBuffer_mat3v2half = OpTypePointer StorageBuffer %mat3v2half
%162 = OpConstantNull %mat3v2half %243 = OpConstantNull %mat3v2half
%uint_29 = OpConstant %uint 29 %uint_29 = OpConstant %uint 29
%_ptr_StorageBuffer_mat3v3half = OpTypePointer StorageBuffer %mat3v3half %_ptr_StorageBuffer_mat3v3half = OpTypePointer StorageBuffer %mat3v3half
%166 = OpConstantNull %mat3v3half %247 = OpConstantNull %mat3v3half
%uint_30 = OpConstant %uint 30 %uint_30 = OpConstant %uint 30
%_ptr_StorageBuffer_mat3v4half = OpTypePointer StorageBuffer %mat3v4half %_ptr_StorageBuffer_mat3v4half = OpTypePointer StorageBuffer %mat3v4half
%170 = OpConstantNull %mat3v4half %251 = OpConstantNull %mat3v4half
%uint_31 = OpConstant %uint 31 %uint_31 = OpConstant %uint 31
%_ptr_StorageBuffer_mat4v2half = OpTypePointer StorageBuffer %mat4v2half %_ptr_StorageBuffer_mat4v2half = OpTypePointer StorageBuffer %mat4v2half
%174 = OpConstantNull %mat4v2half %255 = OpConstantNull %mat4v2half
%uint_32 = OpConstant %uint 32 %uint_32 = OpConstant %uint 32
%_ptr_StorageBuffer_mat4v3half = OpTypePointer StorageBuffer %mat4v3half %_ptr_StorageBuffer_mat4v3half = OpTypePointer StorageBuffer %mat4v3half
%178 = OpConstantNull %mat4v3half %259 = OpConstantNull %mat4v3half
%uint_33 = OpConstant %uint 33 %uint_33 = OpConstant %uint 33
%_ptr_StorageBuffer_mat4v4half = OpTypePointer StorageBuffer %mat4v4half %_ptr_StorageBuffer_mat4v4half = OpTypePointer StorageBuffer %mat4v4half
%182 = OpConstantNull %mat4v4half %263 = OpConstantNull %mat4v4half
%uint_34 = OpConstant %uint 34
%_ptr_StorageBuffer__arr_v3float_uint_2 = OpTypePointer StorageBuffer %_arr_v3float_uint_2
%186 = OpConstantNull %_arr_v3float_uint_2
%uint_35 = OpConstant %uint 35 %uint_35 = OpConstant %uint 35
%_ptr_StorageBuffer__arr_mat4v2half_uint_2 = OpTypePointer StorageBuffer %_arr_mat4v2half_uint_2 %_ptr_StorageBuffer__arr_mat4v2half_uint_2 = OpTypePointer StorageBuffer %_arr_mat4v2half_uint_2
%190 = OpConstantNull %_arr_mat4v2half_uint_2 %268 = OpConstantNull %_arr_mat4v2half_uint_2
%uint_36 = OpConstant %uint 36 %270 = OpConstantNull %Inner
%_ptr_StorageBuffer_Inner = OpTypePointer StorageBuffer %Inner %assign_and_preserve_padding_sb_arr2_vec3_f32 = OpFunction %void None %45
%194 = OpConstantNull %Inner %value = OpFunctionParameter %_arr_v3float_uint_2
%uint_37 = OpConstant %uint 37 %49 = OpLabel
%_ptr_StorageBuffer__arr_Inner_uint_4 = OpTypePointer StorageBuffer %_arr_Inner_uint_4 %i = OpVariable %_ptr_Function_uint Function %50
%198 = OpConstantNull %_arr_Inner_uint_4 %var_for_index = OpVariable %_ptr_Function__arr_v3float_uint_2 Function %65
%main = OpFunction %void None %45 OpStore %i %50
%48 = OpLabel OpBranch %53
%51 = OpAccessChain %_ptr_StorageBuffer_float %sb %uint_0 %uint_0 %53 = OpLabel
OpStore %51 %52 OpLoopMerge %54 %55 None
%55 = OpAccessChain %_ptr_StorageBuffer_int %sb %uint_0 %uint_1 OpBranch %56
OpStore %55 %56 %56 = OpLabel
%58 = OpAccessChain %_ptr_StorageBuffer_uint %sb %uint_0 %uint_2 %58 = OpLoad %uint %i
OpStore %58 %59 %59 = OpULessThan %bool %58 %uint_2
%62 = OpAccessChain %_ptr_StorageBuffer_half %sb %uint_0 %uint_3 %57 = OpLogicalNot %bool %59
OpStore %62 %63 OpSelectionMerge %61 None
%65 = OpAccessChain %_ptr_StorageBuffer_v2float %sb %uint_0 %uint_4 OpBranchConditional %57 %62 %61
OpStore %65 %66 %62 = OpLabel
%69 = OpAccessChain %_ptr_StorageBuffer_v2int %sb %uint_0 %uint_5 OpBranch %54
OpStore %69 %70 %61 = OpLabel
%73 = OpAccessChain %_ptr_StorageBuffer_v2uint %sb %uint_0 %uint_6 OpStore %var_for_index %value
OpStore %73 %74 %68 = OpLoad %uint %i
%77 = OpAccessChain %_ptr_StorageBuffer_v2half %sb %uint_0 %uint_7 %70 = OpAccessChain %_ptr_StorageBuffer_v3float %sb %uint_0 %uint_34 %68
OpStore %77 %78 %71 = OpLoad %uint %i
%81 = OpAccessChain %_ptr_StorageBuffer_v3float %sb %uint_0 %uint_8 %73 = OpAccessChain %_ptr_Function_v3float %var_for_index %71
OpStore %81 %82 %74 = OpLoad %v3float %73
%85 = OpAccessChain %_ptr_StorageBuffer_v3int %sb %uint_0 %uint_9 OpStore %70 %74
OpStore %85 %86 OpBranch %55
%89 = OpAccessChain %_ptr_StorageBuffer_v3uint %sb %uint_0 %uint_10 %55 = OpLabel
OpStore %89 %90 %75 = OpLoad %uint %i
%93 = OpAccessChain %_ptr_StorageBuffer_v3half %sb %uint_0 %uint_11 %77 = OpIAdd %uint %75 %uint_1
OpStore %93 %94 OpStore %i %77
%97 = OpAccessChain %_ptr_StorageBuffer_v4float %sb %uint_0 %uint_12 OpBranch %53
OpStore %97 %98 %54 = OpLabel
%101 = OpAccessChain %_ptr_StorageBuffer_v4int %sb %uint_0 %uint_13 OpReturn
OpStore %101 %102 OpFunctionEnd
%105 = OpAccessChain %_ptr_StorageBuffer_v4uint %sb %uint_0 %uint_14 %assign_and_preserve_padding_1_sb_struct_inner = OpFunction %void None %78
OpStore %105 %106 %value_0 = OpFunctionParameter %Inner
%109 = OpAccessChain %_ptr_StorageBuffer_v4half %sb %uint_0 %uint_15 %81 = OpLabel
OpStore %109 %110 %84 = OpAccessChain %_ptr_StorageBuffer_int %sb %uint_0 %uint_36 %uint_0
%113 = OpAccessChain %_ptr_StorageBuffer_mat2v2float %sb %uint_0 %uint_16 %85 = OpCompositeExtract %int %value_0 0
OpStore %113 %114 OpStore %84 %85
%117 = OpAccessChain %_ptr_StorageBuffer_mat2v3float %sb %uint_0 %uint_17 %87 = OpAccessChain %_ptr_StorageBuffer_float %sb %uint_0 %uint_36 %uint_1
OpStore %117 %118 %88 = OpCompositeExtract %float %value_0 1
%121 = OpAccessChain %_ptr_StorageBuffer_mat2v4float %sb %uint_0 %uint_18 OpStore %87 %88
OpStore %121 %122 %90 = OpAccessChain %_ptr_StorageBuffer_half %sb %uint_0 %uint_36 %uint_2
%125 = OpAccessChain %_ptr_StorageBuffer_mat3v2float %sb %uint_0 %uint_19 %91 = OpCompositeExtract %half %value_0 2
OpStore %125 %126 OpStore %90 %91
%129 = OpAccessChain %_ptr_StorageBuffer_mat3v3float %sb %uint_0 %uint_20 OpReturn
OpStore %129 %130 OpFunctionEnd
%133 = OpAccessChain %_ptr_StorageBuffer_mat3v4float %sb %uint_0 %uint_21 %assign_and_preserve_padding_1_sb_array_struct_inner_X = OpFunction %void None %92
OpStore %133 %134 %dest = OpFunctionParameter %_arr_uint_uint_1
%137 = OpAccessChain %_ptr_StorageBuffer_mat4v2float %sb %uint_0 %uint_22 %value_1 = OpFunctionParameter %Inner
OpStore %137 %138 %97 = OpLabel
%141 = OpAccessChain %_ptr_StorageBuffer_mat4v3float %sb %uint_0 %uint_23 %100 = OpCompositeExtract %uint %dest 0
OpStore %141 %142 %101 = OpAccessChain %_ptr_StorageBuffer_int %sb %uint_0 %uint_37 %100 %uint_0
%145 = OpAccessChain %_ptr_StorageBuffer_mat4v4float %sb %uint_0 %uint_24 %102 = OpCompositeExtract %int %value_1 0
OpStore %145 %146 OpStore %101 %102
%149 = OpAccessChain %_ptr_StorageBuffer_mat2v2half %sb %uint_0 %uint_25 %103 = OpCompositeExtract %uint %dest 0
OpStore %149 %150 %104 = OpAccessChain %_ptr_StorageBuffer_float %sb %uint_0 %uint_37 %103 %uint_1
%153 = OpAccessChain %_ptr_StorageBuffer_mat2v3half %sb %uint_0 %uint_26 %105 = OpCompositeExtract %float %value_1 1
OpStore %153 %154 OpStore %104 %105
%157 = OpAccessChain %_ptr_StorageBuffer_mat2v4half %sb %uint_0 %uint_27 %106 = OpCompositeExtract %uint %dest 0
OpStore %157 %158 %107 = OpAccessChain %_ptr_StorageBuffer_half %sb %uint_0 %uint_37 %106 %uint_2
%161 = OpAccessChain %_ptr_StorageBuffer_mat3v2half %sb %uint_0 %uint_28 %108 = OpCompositeExtract %half %value_1 2
OpStore %161 %162 OpStore %107 %108
%165 = OpAccessChain %_ptr_StorageBuffer_mat3v3half %sb %uint_0 %uint_29 OpReturn
OpStore %165 %166 OpFunctionEnd
%169 = OpAccessChain %_ptr_StorageBuffer_mat3v4half %sb %uint_0 %uint_30 %assign_and_preserve_padding_2_sb_array_struct_inner = OpFunction %void None %109
OpStore %169 %170 %value_2 = OpFunctionParameter %_arr_Inner_uint_4
%173 = OpAccessChain %_ptr_StorageBuffer_mat4v2half %sb %uint_0 %uint_31 %112 = OpLabel
OpStore %173 %174 %i_0 = OpVariable %_ptr_Function_uint Function %50
%177 = OpAccessChain %_ptr_StorageBuffer_mat4v3half %sb %uint_0 %uint_32 %var_for_index_1 = OpVariable %_ptr_Function__arr_Inner_uint_4 Function %125
OpStore %177 %178 OpStore %i_0 %50
%181 = OpAccessChain %_ptr_StorageBuffer_mat4v4half %sb %uint_0 %uint_33 OpBranch %114
OpStore %181 %182 %114 = OpLabel
%185 = OpAccessChain %_ptr_StorageBuffer__arr_v3float_uint_2 %sb %uint_0 %uint_34 OpLoopMerge %115 %116 None
OpStore %185 %186 OpBranch %117
%189 = OpAccessChain %_ptr_StorageBuffer__arr_mat4v2half_uint_2 %sb %uint_0 %uint_35 %117 = OpLabel
OpStore %189 %190 %119 = OpLoad %uint %i_0
%193 = OpAccessChain %_ptr_StorageBuffer_Inner %sb %uint_0 %uint_36 %120 = OpULessThan %bool %119 %uint_4
OpStore %193 %194 %118 = OpLogicalNot %bool %120
%197 = OpAccessChain %_ptr_StorageBuffer__arr_Inner_uint_4 %sb %uint_0 %uint_37 OpSelectionMerge %121 None
OpStore %197 %198 OpBranchConditional %118 %122 %121
%122 = OpLabel
OpBranch %115
%121 = OpLabel
OpStore %var_for_index_1 %value_2
%127 = OpLoad %uint %i_0
%128 = OpCompositeConstruct %_arr_uint_uint_1 %127
%129 = OpLoad %uint %i_0
%131 = OpAccessChain %_ptr_Function_Inner %var_for_index_1 %129
%132 = OpLoad %Inner %131
%126 = OpFunctionCall %void %assign_and_preserve_padding_1_sb_array_struct_inner_X %128 %132
OpBranch %116
%116 = OpLabel
%133 = OpLoad %uint %i_0
%134 = OpIAdd %uint %133 %uint_1
OpStore %i_0 %134
OpBranch %114
%115 = OpLabel
OpReturn
OpFunctionEnd
%main = OpFunction %void None %135
%137 = OpLabel
%138 = OpAccessChain %_ptr_StorageBuffer_float %sb %uint_0 %uint_0
OpStore %138 %139
%140 = OpAccessChain %_ptr_StorageBuffer_int %sb %uint_0 %uint_1
OpStore %140 %99
%142 = OpAccessChain %_ptr_StorageBuffer_uint %sb %uint_0 %uint_2
OpStore %142 %50
%144 = OpAccessChain %_ptr_StorageBuffer_half %sb %uint_0 %uint_3
OpStore %144 %145
%147 = OpAccessChain %_ptr_StorageBuffer_v2float %sb %uint_0 %uint_4
OpStore %147 %148
%151 = OpAccessChain %_ptr_StorageBuffer_v2int %sb %uint_0 %uint_5
OpStore %151 %152
%155 = OpAccessChain %_ptr_StorageBuffer_v2uint %sb %uint_0 %uint_6
OpStore %155 %156
%159 = OpAccessChain %_ptr_StorageBuffer_v2half %sb %uint_0 %uint_7
OpStore %159 %160
%162 = OpAccessChain %_ptr_StorageBuffer_v3float %sb %uint_0 %uint_8
OpStore %162 %163
%166 = OpAccessChain %_ptr_StorageBuffer_v3int %sb %uint_0 %uint_9
OpStore %166 %167
%170 = OpAccessChain %_ptr_StorageBuffer_v3uint %sb %uint_0 %uint_10
OpStore %170 %171
%174 = OpAccessChain %_ptr_StorageBuffer_v3half %sb %uint_0 %uint_11
OpStore %174 %175
%178 = OpAccessChain %_ptr_StorageBuffer_v4float %sb %uint_0 %uint_12
OpStore %178 %179
%182 = OpAccessChain %_ptr_StorageBuffer_v4int %sb %uint_0 %uint_13
OpStore %182 %183
%186 = OpAccessChain %_ptr_StorageBuffer_v4uint %sb %uint_0 %uint_14
OpStore %186 %187
%190 = OpAccessChain %_ptr_StorageBuffer_v4half %sb %uint_0 %uint_15
OpStore %190 %191
%194 = OpAccessChain %_ptr_StorageBuffer_mat2v2float %sb %uint_0 %uint_16
OpStore %194 %195
%198 = OpAccessChain %_ptr_StorageBuffer_mat2v3float %sb %uint_0 %uint_17
OpStore %198 %199
%202 = OpAccessChain %_ptr_StorageBuffer_mat2v4float %sb %uint_0 %uint_18
OpStore %202 %203
%206 = OpAccessChain %_ptr_StorageBuffer_mat3v2float %sb %uint_0 %uint_19
OpStore %206 %207
%210 = OpAccessChain %_ptr_StorageBuffer_mat3v3float %sb %uint_0 %uint_20
OpStore %210 %211
%214 = OpAccessChain %_ptr_StorageBuffer_mat3v4float %sb %uint_0 %uint_21
OpStore %214 %215
%218 = OpAccessChain %_ptr_StorageBuffer_mat4v2float %sb %uint_0 %uint_22
OpStore %218 %219
%222 = OpAccessChain %_ptr_StorageBuffer_mat4v3float %sb %uint_0 %uint_23
OpStore %222 %223
%226 = OpAccessChain %_ptr_StorageBuffer_mat4v4float %sb %uint_0 %uint_24
OpStore %226 %227
%230 = OpAccessChain %_ptr_StorageBuffer_mat2v2half %sb %uint_0 %uint_25
OpStore %230 %231
%234 = OpAccessChain %_ptr_StorageBuffer_mat2v3half %sb %uint_0 %uint_26
OpStore %234 %235
%238 = OpAccessChain %_ptr_StorageBuffer_mat2v4half %sb %uint_0 %uint_27
OpStore %238 %239
%242 = OpAccessChain %_ptr_StorageBuffer_mat3v2half %sb %uint_0 %uint_28
OpStore %242 %243
%246 = OpAccessChain %_ptr_StorageBuffer_mat3v3half %sb %uint_0 %uint_29
OpStore %246 %247
%250 = OpAccessChain %_ptr_StorageBuffer_mat3v4half %sb %uint_0 %uint_30
OpStore %250 %251
%254 = OpAccessChain %_ptr_StorageBuffer_mat4v2half %sb %uint_0 %uint_31
OpStore %254 %255
%258 = OpAccessChain %_ptr_StorageBuffer_mat4v3half %sb %uint_0 %uint_32
OpStore %258 %259
%262 = OpAccessChain %_ptr_StorageBuffer_mat4v4half %sb %uint_0 %uint_33
OpStore %262 %263
%264 = OpFunctionCall %void %assign_and_preserve_padding_sb_arr2_vec3_f32 %65
%267 = OpAccessChain %_ptr_StorageBuffer__arr_mat4v2half_uint_2 %sb %uint_0 %uint_35
OpStore %267 %268
%269 = OpFunctionCall %void %assign_and_preserve_padding_1_sb_struct_inner %270
%271 = OpFunctionCall %void %assign_and_preserve_padding_2_sb_array_struct_inner %125
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -20,9 +20,19 @@ layout(binding = 1, std430) buffer tint_symbol_block_ssbo_1 {
S inner; S inner;
} tint_symbol_1; } tint_symbol_1;
void assign_and_preserve_padding_1_tint_symbol_1_inner(Inner value) {
tint_symbol_1.inner.inner.scalar_f16 = value.scalar_f16;
tint_symbol_1.inner.inner.vec3_f16 = value.vec3_f16;
tint_symbol_1.inner.inner.mat2x4_f16 = value.mat2x4_f16;
}
void assign_and_preserve_padding_tint_symbol_1(S value) {
assign_and_preserve_padding_1_tint_symbol_1_inner(value.inner);
}
void tint_symbol_2() { void tint_symbol_2() {
S t = tint_symbol.inner; S t = tint_symbol.inner;
tint_symbol_1.inner = t; assign_and_preserve_padding_tint_symbol_1(t);
} }
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;

View File

@ -26,9 +26,19 @@ struct S {
/* 0x0000 */ Inner inner; /* 0x0000 */ Inner inner;
}; };
void assign_and_preserve_padding_1(device Inner* const dest, Inner value) {
(*(dest)).scalar_f16 = value.scalar_f16;
(*(dest)).vec3_f16 = half3(value.vec3_f16);
(*(dest)).mat2x4_f16 = value.mat2x4_f16;
}
void assign_and_preserve_padding(device S* const dest, S value) {
assign_and_preserve_padding_1(&((*(dest)).inner), value.inner);
}
kernel void tint_symbol(const device S* tint_symbol_1 [[buffer(1)]], device S* tint_symbol_2 [[buffer(0)]]) { kernel void tint_symbol(const device S* tint_symbol_1 [[buffer(1)]], device S* tint_symbol_2 [[buffer(0)]]) {
S const t = *(tint_symbol_1); S const t = *(tint_symbol_1);
*(tint_symbol_2) = t; assign_and_preserve_padding(tint_symbol_2, t);
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: 21 ; Bound: 42
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpCapability Float16 OpCapability Float16
@ -21,6 +21,10 @@
OpMemberName %Inner 2 "mat2x4_f16" OpMemberName %Inner 2 "mat2x4_f16"
OpName %in "in" OpName %in "in"
OpName %out "out" OpName %out "out"
OpName %assign_and_preserve_padding_1_out_inner "assign_and_preserve_padding_1_out_inner"
OpName %value "value"
OpName %assign_and_preserve_padding_out "assign_and_preserve_padding_out"
OpName %value_0 "value"
OpName %main "main" OpName %main "main"
OpDecorate %in_block Block OpDecorate %in_block Block
OpMemberDecorate %in_block 0 Offset 0 OpMemberDecorate %in_block 0 Offset 0
@ -46,15 +50,42 @@
%in = OpVariable %_ptr_StorageBuffer_in_block StorageBuffer %in = OpVariable %_ptr_StorageBuffer_in_block StorageBuffer
%out = OpVariable %_ptr_StorageBuffer_in_block StorageBuffer %out = OpVariable %_ptr_StorageBuffer_in_block StorageBuffer
%void = OpTypeVoid %void = OpTypeVoid
%11 = OpTypeFunction %void %11 = OpTypeFunction %void %Inner
%uint = OpTypeInt 32 0 %uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer_half = OpTypePointer StorageBuffer %half
%uint_1 = OpConstant %uint 1
%_ptr_StorageBuffer_v3half = OpTypePointer StorageBuffer %v3half
%uint_2 = OpConstant %uint 2
%_ptr_StorageBuffer_mat2v4half = OpTypePointer StorageBuffer %mat2v4half
%29 = OpTypeFunction %void %S
%35 = OpTypeFunction %void
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S %_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
%main = OpFunction %void None %11 %assign_and_preserve_padding_1_out_inner = OpFunction %void None %11
%14 = OpLabel %value = OpFunctionParameter %Inner
%18 = OpAccessChain %_ptr_StorageBuffer_S %in %uint_0 %15 = OpLabel
%19 = OpLoad %S %18 %19 = OpAccessChain %_ptr_StorageBuffer_half %out %uint_0 %uint_0 %uint_0
%20 = OpAccessChain %_ptr_StorageBuffer_S %out %uint_0 %20 = OpCompositeExtract %half %value 0
OpStore %20 %19 OpStore %19 %20
%23 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %uint_0 %uint_1
%24 = OpCompositeExtract %v3half %value 1
OpStore %23 %24
%27 = OpAccessChain %_ptr_StorageBuffer_mat2v4half %out %uint_0 %uint_0 %uint_2
%28 = OpCompositeExtract %mat2v4half %value 2
OpStore %27 %28
OpReturn
OpFunctionEnd
%assign_and_preserve_padding_out = OpFunction %void None %29
%value_0 = OpFunctionParameter %S
%32 = OpLabel
%34 = OpCompositeExtract %Inner %value_0 0
%33 = OpFunctionCall %void %assign_and_preserve_padding_1_out_inner %34
OpReturn
OpFunctionEnd
%main = OpFunction %void None %35
%37 = OpLabel
%39 = OpAccessChain %_ptr_StorageBuffer_S %in %uint_0
%40 = OpLoad %S %39
%41 = OpFunctionCall %void %assign_and_preserve_padding_out %40
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -22,9 +22,19 @@ layout(binding = 1, std430) buffer tint_symbol_block_ssbo_1 {
S inner; S inner;
} tint_symbol_1; } tint_symbol_1;
void assign_and_preserve_padding_1_tint_symbol_1_inner(Inner value) {
tint_symbol_1.inner.inner.scalar_f32 = value.scalar_f32;
tint_symbol_1.inner.inner.vec3_f32 = value.vec3_f32;
tint_symbol_1.inner.inner.mat2x4_f32 = value.mat2x4_f32;
}
void assign_and_preserve_padding_tint_symbol_1(S value) {
assign_and_preserve_padding_1_tint_symbol_1_inner(value.inner);
}
void tint_symbol_2() { void tint_symbol_2() {
S t = tint_symbol.inner; S t = tint_symbol.inner;
tint_symbol_1.inner = t; assign_and_preserve_padding_tint_symbol_1(t);
} }
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;

View File

@ -26,9 +26,19 @@ struct S {
/* 0x0000 */ Inner inner; /* 0x0000 */ Inner inner;
}; };
void assign_and_preserve_padding_1(device Inner* const dest, Inner value) {
(*(dest)).scalar_f32 = value.scalar_f32;
(*(dest)).vec3_f32 = float3(value.vec3_f32);
(*(dest)).mat2x4_f32 = value.mat2x4_f32;
}
void assign_and_preserve_padding(device S* const dest, S value) {
assign_and_preserve_padding_1(&((*(dest)).inner), value.inner);
}
kernel void tint_symbol(const device S* tint_symbol_1 [[buffer(1)]], device S* tint_symbol_2 [[buffer(0)]]) { kernel void tint_symbol(const device S* tint_symbol_1 [[buffer(1)]], device S* tint_symbol_2 [[buffer(0)]]) {
S const t = *(tint_symbol_1); S const t = *(tint_symbol_1);
*(tint_symbol_2) = t; assign_and_preserve_padding(tint_symbol_2, t);
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: 21 ; Bound: 42
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
@ -17,6 +17,10 @@
OpMemberName %Inner 2 "mat2x4_f32" OpMemberName %Inner 2 "mat2x4_f32"
OpName %in "in" OpName %in "in"
OpName %out "out" OpName %out "out"
OpName %assign_and_preserve_padding_1_out_inner "assign_and_preserve_padding_1_out_inner"
OpName %value "value"
OpName %assign_and_preserve_padding_out "assign_and_preserve_padding_out"
OpName %value_0 "value"
OpName %main "main" OpName %main "main"
OpDecorate %in_block Block OpDecorate %in_block Block
OpMemberDecorate %in_block 0 Offset 0 OpMemberDecorate %in_block 0 Offset 0
@ -42,15 +46,42 @@
%in = OpVariable %_ptr_StorageBuffer_in_block StorageBuffer %in = OpVariable %_ptr_StorageBuffer_in_block StorageBuffer
%out = OpVariable %_ptr_StorageBuffer_in_block StorageBuffer %out = OpVariable %_ptr_StorageBuffer_in_block StorageBuffer
%void = OpTypeVoid %void = OpTypeVoid
%11 = OpTypeFunction %void %11 = OpTypeFunction %void %Inner
%uint = OpTypeInt 32 0 %uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
%uint_1 = OpConstant %uint 1
%_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float
%uint_2 = OpConstant %uint 2
%_ptr_StorageBuffer_mat2v4float = OpTypePointer StorageBuffer %mat2v4float
%29 = OpTypeFunction %void %S
%35 = OpTypeFunction %void
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S %_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
%main = OpFunction %void None %11 %assign_and_preserve_padding_1_out_inner = OpFunction %void None %11
%14 = OpLabel %value = OpFunctionParameter %Inner
%18 = OpAccessChain %_ptr_StorageBuffer_S %in %uint_0 %15 = OpLabel
%19 = OpLoad %S %18 %19 = OpAccessChain %_ptr_StorageBuffer_float %out %uint_0 %uint_0 %uint_0
%20 = OpAccessChain %_ptr_StorageBuffer_S %out %uint_0 %20 = OpCompositeExtract %float %value 0
OpStore %20 %19 OpStore %19 %20
%23 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %uint_0 %uint_1
%24 = OpCompositeExtract %v3float %value 1
OpStore %23 %24
%27 = OpAccessChain %_ptr_StorageBuffer_mat2v4float %out %uint_0 %uint_0 %uint_2
%28 = OpCompositeExtract %mat2v4float %value 2
OpStore %27 %28
OpReturn
OpFunctionEnd
%assign_and_preserve_padding_out = OpFunction %void None %29
%value_0 = OpFunctionParameter %S
%32 = OpLabel
%34 = OpCompositeExtract %Inner %value_0 0
%33 = OpFunctionCall %void %assign_and_preserve_padding_1_out_inner %34
OpReturn
OpFunctionEnd
%main = OpFunction %void None %35
%37 = OpLabel
%39 = OpAccessChain %_ptr_StorageBuffer_S %in %uint_0
%40 = OpLoad %S %39
%41 = OpFunctionCall %void %assign_and_preserve_padding_out %40
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -78,6 +78,21 @@ layout(binding = 1, std430) buffer u_block_ssbo {
S inner[4]; S inner[4];
} s; } s;
void assign_and_preserve_padding_1_s_X(uint dest[1], S value) {
s.inner[dest[0]].before = value.before;
s.inner[dest[0]].m = value.m;
s.inner[dest[0]].after = value.after;
}
void assign_and_preserve_padding_s(S value[4]) {
{
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
uint tint_symbol[1] = uint[1](i);
assign_and_preserve_padding_1_s_X(tint_symbol, value[i]);
}
}
}
S conv_S(S_std140 val) { S conv_S(S_std140 val) {
return S(val.before, f16mat2(val.m_0, val.m_1), val.pad, val.pad_1, val.pad_2, val.pad_3, val.pad_4, val.pad_5, val.pad_6, val.pad_7, val.pad_8, val.pad_9, val.pad_10, val.pad_11, val.pad_12, val.after, val.pad_13, val.pad_14, val.pad_15, val.pad_16, val.pad_17, val.pad_18, val.pad_19, val.pad_20, val.pad_21, val.pad_22, val.pad_23, val.pad_24, val.pad_25, val.pad_26, val.pad_27); return S(val.before, f16mat2(val.m_0, val.m_1), val.pad, val.pad_1, val.pad_2, val.pad_3, val.pad_4, val.pad_5, val.pad_6, val.pad_7, val.pad_8, val.pad_9, val.pad_10, val.pad_11, val.pad_12, val.after, val.pad_13, val.pad_14, val.pad_15, val.pad_16, val.pad_17, val.pad_18, val.pad_19, val.pad_20, val.pad_21, val.pad_22, val.pad_23, val.pad_24, val.pad_25, val.pad_26, val.pad_27);
} }
@ -97,8 +112,9 @@ f16mat2 load_u_inner_2_m() {
} }
void f() { void f() {
s.inner = conv_arr4_S(u.inner); assign_and_preserve_padding_s(conv_arr4_S(u.inner));
s.inner[1] = conv_S(u.inner[2u]); uint tint_symbol_1[1] = uint[1](1u);
assign_and_preserve_padding_1_s_X(tint_symbol_1, conv_S(u.inner[2u]));
s.inner[3].m = load_u_inner_2_m(); s.inner[3].m = load_u_inner_2_m();
s.inner[1].m[0] = u.inner[0u].m_1.yx; s.inner[1].m[0] = u.inner[0u].m_1.yx;
} }

View File

@ -22,9 +22,21 @@ struct S {
/* 0x0044 */ tint_array<int8_t, 60> tint_pad_1; /* 0x0044 */ tint_array<int8_t, 60> tint_pad_1;
}; };
void assign_and_preserve_padding_1(device S* const dest, S value) {
(*(dest)).before = value.before;
(*(dest)).m = value.m;
(*(dest)).after = value.after;
}
void assign_and_preserve_padding(device tint_array<S, 4>* const dest, tint_array<S, 4> value) {
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
assign_and_preserve_padding_1(&((*(dest))[i]), value[i]);
}
}
kernel void f(device tint_array<S, 4>* tint_symbol [[buffer(1)]], const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) { kernel void f(device tint_array<S, 4>* tint_symbol [[buffer(1)]], const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) {
*(tint_symbol) = *(tint_symbol_1); assign_and_preserve_padding(tint_symbol, *(tint_symbol_1));
(*(tint_symbol))[1] = (*(tint_symbol_1))[2]; assign_and_preserve_padding_1(&((*(tint_symbol))[1]), (*(tint_symbol_1))[2]);
(*(tint_symbol))[3].m = (*(tint_symbol_1))[2].m; (*(tint_symbol))[3].m = (*(tint_symbol_1))[2].m;
(*(tint_symbol))[1].m[0] = half2((*(tint_symbol_1))[0].m[1]).yx; (*(tint_symbol))[1].m[0] = half2((*(tint_symbol_1))[0].m[1]).yx;
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: 104 ; Bound: 142
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpCapability Float16 OpCapability Float16
@ -26,13 +26,20 @@
OpMemberName %S 1 "m" OpMemberName %S 1 "m"
OpMemberName %S 2 "after" OpMemberName %S 2 "after"
OpName %s "s" OpName %s "s"
OpName %assign_and_preserve_padding_1_s_X "assign_and_preserve_padding_1_s_X"
OpName %dest "dest"
OpName %value "value"
OpName %assign_and_preserve_padding_s "assign_and_preserve_padding_s"
OpName %value_0 "value"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %conv_S "conv_S" OpName %conv_S "conv_S"
OpName %val "val" OpName %val "val"
OpName %conv_arr4_S "conv_arr4_S" OpName %conv_arr4_S "conv_arr4_S"
OpName %val_0 "val" OpName %val_0 "val"
OpName %arr "arr" OpName %arr "arr"
OpName %i "i" OpName %i_0 "i"
OpName %var_for_index "var_for_index" OpName %var_for_index_1 "var_for_index_1"
OpName %load_u_inner_2_m "load_u_inner_2_m" OpName %load_u_inner_2_m "load_u_inner_2_m"
OpName %f "f" OpName %f "f"
OpDecorate %u_block_std140 Block OpDecorate %u_block_std140 Block
@ -55,6 +62,7 @@
OpDecorate %_arr_S_uint_4 ArrayStride 128 OpDecorate %_arr_S_uint_4 ArrayStride 128
OpDecorate %s DescriptorSet 0 OpDecorate %s DescriptorSet 0
OpDecorate %s Binding 1 OpDecorate %s Binding 1
OpDecorate %_arr_uint_uint_1 ArrayStride 4
%int = OpTypeInt 32 1 %int = OpTypeInt 32 1
%half = OpTypeFloat 16 %half = OpTypeFloat 16
%v2half = OpTypeVector %half 2 %v2half = OpTypeVector %half 2
@ -71,110 +79,164 @@
%u_block = OpTypeStruct %_arr_S_uint_4 %u_block = OpTypeStruct %_arr_S_uint_4
%_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block %_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block
%s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer %s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer
%17 = OpTypeFunction %S %S_std140 %void = OpTypeVoid
%27 = OpTypeFunction %_arr_S_uint_4 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%33 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_uint = OpTypePointer Function %uint
%36 = OpConstantNull %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
%49 = OpConstantNull %_arr_S_std140_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
%uint_1 = OpConstant %uint 1 %uint_1 = OpConstant %uint 1
%62 = OpTypeFunction %mat2v2half %_arr_uint_uint_1 = OpTypeArray %uint %uint_1
%17 = OpTypeFunction %void %_arr_uint_uint_1 %S
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%26 = OpConstantNull %int
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%_ptr_StorageBuffer_mat2v2half = OpTypePointer StorageBuffer %mat2v2half
%uint_2 = OpConstant %uint 2 %uint_2 = OpConstant %uint 2
%39 = OpTypeFunction %void %_arr_S_uint_4
%43 = OpConstantNull %uint
%_ptr_Function_uint = OpTypePointer Function %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%58 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%68 = OpTypeFunction %S %S_std140
%78 = OpTypeFunction %_arr_S_uint_4 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
%95 = OpConstantNull %_arr_S_std140_uint_4
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
%106 = OpTypeFunction %mat2v2half
%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140 %_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140
%_ptr_Uniform_v2half = OpTypePointer Uniform %v2half %_ptr_Uniform_v2half = OpTypePointer Uniform %v2half
%void = OpTypeVoid %120 = OpTypeFunction %void
%78 = OpTypeFunction %void
%_ptr_StorageBuffer__arr_S_uint_4 = OpTypePointer StorageBuffer %_arr_S_uint_4
%_ptr_Uniform__arr_S_std140_uint_4 = OpTypePointer Uniform %_arr_S_std140_uint_4 %_ptr_Uniform__arr_S_std140_uint_4 = OpTypePointer Uniform %_arr_S_std140_uint_4
%int_1 = OpConstant %int 1 %129 = OpConstantComposite %_arr_uint_uint_1 %uint_1
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
%int_3 = OpConstant %int 3 %int_3 = OpConstant %int 3
%_ptr_StorageBuffer_mat2v2half = OpTypePointer StorageBuffer %mat2v2half %int_1 = OpConstant %int 1
%98 = OpConstantNull %int
%_ptr_StorageBuffer_v2half = OpTypePointer StorageBuffer %v2half %_ptr_StorageBuffer_v2half = OpTypePointer StorageBuffer %v2half
%conv_S = OpFunction %S None %17 %assign_and_preserve_padding_1_s_X = OpFunction %void None %17
%val = OpFunctionParameter %S_std140 %dest = OpFunctionParameter %_arr_uint_uint_1
%20 = OpLabel %value = OpFunctionParameter %S
%21 = OpCompositeExtract %int %val 0 %24 = OpLabel
%22 = OpCompositeExtract %v2half %val 1 %27 = OpCompositeExtract %uint %dest 0
%23 = OpCompositeExtract %v2half %val 2 %29 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %27 %uint_0
%24 = OpCompositeConstruct %mat2v2half %22 %23 %30 = OpCompositeExtract %int %value 0
%25 = OpCompositeExtract %int %val 3 OpStore %29 %30
%26 = OpCompositeConstruct %S %21 %24 %25 %31 = OpCompositeExtract %uint %dest 0
OpReturnValue %26 %33 = OpAccessChain %_ptr_StorageBuffer_mat2v2half %s %uint_0 %31 %uint_1
OpFunctionEnd %34 = OpCompositeExtract %mat2v2half %value 1
%conv_arr4_S = OpFunction %_arr_S_uint_4 None %27 OpStore %33 %34
%val_0 = OpFunctionParameter %_arr_S_std140_uint_4 %35 = OpCompositeExtract %uint %dest 0
%30 = OpLabel %37 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %35 %uint_2
%arr = OpVariable %_ptr_Function__arr_S_uint_4 Function %33 %38 = OpCompositeExtract %int %value 2
%i = OpVariable %_ptr_Function_uint Function %36 OpStore %37 %38
%var_for_index = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function %49 OpReturn
OpBranch %37 OpFunctionEnd
%37 = OpLabel %assign_and_preserve_padding_s = OpFunction %void None %39
OpLoopMerge %38 %39 None %value_0 = OpFunctionParameter %_arr_S_uint_4
OpBranch %40 %42 = OpLabel
%40 = OpLabel %i = OpVariable %_ptr_Function_uint Function %43
%42 = OpLoad %uint %i %var_for_index = OpVariable %_ptr_Function__arr_S_uint_4 Function %58
%43 = OpULessThan %bool %42 %uint_4 OpStore %i %43
%41 = OpLogicalNot %bool %43 OpBranch %46
OpSelectionMerge %45 None %46 = OpLabel
OpBranchConditional %41 %46 %45 OpLoopMerge %47 %48 None
%46 = OpLabel OpBranch %49
OpBranch %38 %49 = OpLabel
%45 = OpLabel %51 = OpLoad %uint %i
OpStore %var_for_index %val_0 %52 = OpULessThan %bool %51 %uint_4
%50 = OpLoad %uint %i %50 = OpLogicalNot %bool %52
%52 = OpAccessChain %_ptr_Function_S %arr %50 OpSelectionMerge %54 None
%54 = OpLoad %uint %i OpBranchConditional %50 %55 %54
%56 = OpAccessChain %_ptr_Function_S_std140 %var_for_index %54 %55 = OpLabel
%57 = OpLoad %S_std140 %56 OpBranch %47
%53 = OpFunctionCall %S %conv_S %57 %54 = OpLabel
OpStore %52 %53 OpStore %var_for_index %value_0
OpBranch %39 %60 = OpLoad %uint %i
%39 = OpLabel %61 = OpCompositeConstruct %_arr_uint_uint_1 %60
%58 = OpLoad %uint %i %62 = OpLoad %uint %i
%60 = OpIAdd %uint %58 %uint_1 %64 = OpAccessChain %_ptr_Function_S %var_for_index %62
OpStore %i %60 %65 = OpLoad %S %64
OpBranch %37 %59 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %61 %65
%38 = OpLabel OpBranch %48
%61 = OpLoad %_arr_S_uint_4 %arr %48 = OpLabel
OpReturnValue %61 %66 = OpLoad %uint %i
OpFunctionEnd %67 = OpIAdd %uint %66 %uint_1
%load_u_inner_2_m = OpFunction %mat2v2half None %62 OpStore %i %67
%64 = OpLabel OpBranch %46
%69 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2 %47 = OpLabel
%72 = OpAccessChain %_ptr_Uniform_v2half %69 %uint_1 OpReturn
%73 = OpLoad %v2half %72 OpFunctionEnd
%75 = OpAccessChain %_ptr_Uniform_v2half %69 %uint_2 %conv_S = OpFunction %S None %68
%76 = OpLoad %v2half %75 %val = OpFunctionParameter %S_std140
%77 = OpCompositeConstruct %mat2v2half %73 %76 %71 = OpLabel
OpReturnValue %77 %72 = OpCompositeExtract %int %val 0
OpFunctionEnd %73 = OpCompositeExtract %v2half %val 1
%f = OpFunction %void None %78 %74 = OpCompositeExtract %v2half %val 2
%81 = OpLabel %75 = OpCompositeConstruct %mat2v2half %73 %74
%83 = OpAccessChain %_ptr_StorageBuffer__arr_S_uint_4 %s %uint_0 %76 = OpCompositeExtract %int %val 3
%86 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %u %uint_0 %77 = OpCompositeConstruct %S %72 %75 %76
%87 = OpLoad %_arr_S_std140_uint_4 %86 OpReturnValue %77
%84 = OpFunctionCall %_arr_S_uint_4 %conv_arr4_S %87 OpFunctionEnd
OpStore %83 %84 %conv_arr4_S = OpFunction %_arr_S_uint_4 None %78
%90 = OpAccessChain %_ptr_StorageBuffer_S %s %uint_0 %int_1 %val_0 = OpFunctionParameter %_arr_S_std140_uint_4
%92 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2 %81 = OpLabel
%93 = OpLoad %S_std140 %92 %arr = OpVariable %_ptr_Function__arr_S_uint_4 Function %58
%91 = OpFunctionCall %S %conv_S %93 %i_0 = OpVariable %_ptr_Function_uint Function %43
OpStore %90 %91 %var_for_index_1 = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function %95
%96 = OpAccessChain %_ptr_StorageBuffer_mat2v2half %s %uint_0 %int_3 %uint_1 OpBranch %84
%97 = OpFunctionCall %mat2v2half %load_u_inner_2_m %84 = OpLabel
OpStore %96 %97 OpLoopMerge %85 %86 None
%100 = OpAccessChain %_ptr_StorageBuffer_v2half %s %uint_0 %int_1 %uint_1 %98 OpBranch %87
%101 = OpAccessChain %_ptr_Uniform_v2half %u %uint_0 %36 %uint_2 %87 = OpLabel
%102 = OpLoad %v2half %101 %89 = OpLoad %uint %i_0
%103 = OpVectorShuffle %v2half %102 %102 1 0 %90 = OpULessThan %bool %89 %uint_4
OpStore %100 %103 %88 = OpLogicalNot %bool %90
OpSelectionMerge %91 None
OpBranchConditional %88 %92 %91
%92 = OpLabel
OpBranch %85
%91 = OpLabel
OpStore %var_for_index_1 %val_0
%96 = OpLoad %uint %i_0
%97 = OpAccessChain %_ptr_Function_S %arr %96
%99 = OpLoad %uint %i_0
%101 = OpAccessChain %_ptr_Function_S_std140 %var_for_index_1 %99
%102 = OpLoad %S_std140 %101
%98 = OpFunctionCall %S %conv_S %102
OpStore %97 %98
OpBranch %86
%86 = OpLabel
%103 = OpLoad %uint %i_0
%104 = OpIAdd %uint %103 %uint_1
OpStore %i_0 %104
OpBranch %84
%85 = OpLabel
%105 = OpLoad %_arr_S_uint_4 %arr
OpReturnValue %105
OpFunctionEnd
%load_u_inner_2_m = OpFunction %mat2v2half None %106
%108 = OpLabel
%111 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%114 = OpAccessChain %_ptr_Uniform_v2half %111 %uint_1
%115 = OpLoad %v2half %114
%117 = OpAccessChain %_ptr_Uniform_v2half %111 %uint_2
%118 = OpLoad %v2half %117
%119 = OpCompositeConstruct %mat2v2half %115 %118
OpReturnValue %119
OpFunctionEnd
%f = OpFunction %void None %120
%122 = OpLabel
%126 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %u %uint_0
%127 = OpLoad %_arr_S_std140_uint_4 %126
%124 = OpFunctionCall %_arr_S_uint_4 %conv_arr4_S %127
%123 = OpFunctionCall %void %assign_and_preserve_padding_s %124
%131 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%132 = OpLoad %S_std140 %131
%130 = OpFunctionCall %S %conv_S %132
%128 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %129 %130
%134 = OpAccessChain %_ptr_StorageBuffer_mat2v2half %s %uint_0 %int_3 %uint_1
%135 = OpFunctionCall %mat2v2half %load_u_inner_2_m
OpStore %134 %135
%138 = OpAccessChain %_ptr_StorageBuffer_v2half %s %uint_0 %int_1 %uint_1 %26
%139 = OpAccessChain %_ptr_Uniform_v2half %u %uint_0 %43 %uint_2
%140 = OpLoad %v2half %139
%141 = OpVectorShuffle %v2half %140 %140 1 0
OpStore %138 %141
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -73,6 +73,21 @@ layout(binding = 1, std430) buffer u_block_ssbo {
S inner[4]; S inner[4];
} s; } s;
void assign_and_preserve_padding_1_s_X(uint dest[1], S value) {
s.inner[dest[0]].before = value.before;
s.inner[dest[0]].m = value.m;
s.inner[dest[0]].after = value.after;
}
void assign_and_preserve_padding_s(S value[4]) {
{
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
uint tint_symbol[1] = uint[1](i);
assign_and_preserve_padding_1_s_X(tint_symbol, value[i]);
}
}
}
S conv_S(S_std140 val) { S conv_S(S_std140 val) {
return S(val.before, val.pad, mat2(val.m_0, val.m_1), val.pad_1, val.pad_2, val.pad_3, val.pad_4, val.pad_5, val.pad_6, val.pad_7, val.pad_8, val.pad_9, val.pad_10, val.after, val.pad_11, val.pad_12, val.pad_13, val.pad_14, val.pad_15, val.pad_16, val.pad_17, val.pad_18, val.pad_19, val.pad_20, val.pad_21, val.pad_22, val.pad_23, val.pad_24, val.pad_25); return S(val.before, val.pad, mat2(val.m_0, val.m_1), val.pad_1, val.pad_2, val.pad_3, val.pad_4, val.pad_5, val.pad_6, val.pad_7, val.pad_8, val.pad_9, val.pad_10, val.after, val.pad_11, val.pad_12, val.pad_13, val.pad_14, val.pad_15, val.pad_16, val.pad_17, val.pad_18, val.pad_19, val.pad_20, val.pad_21, val.pad_22, val.pad_23, val.pad_24, val.pad_25);
} }
@ -92,8 +107,9 @@ mat2 load_u_inner_2_m() {
} }
void f() { void f() {
s.inner = conv_arr4_S(u.inner); assign_and_preserve_padding_s(conv_arr4_S(u.inner));
s.inner[1] = conv_S(u.inner[2u]); uint tint_symbol_1[1] = uint[1](1u);
assign_and_preserve_padding_1_s_X(tint_symbol_1, conv_S(u.inner[2u]));
s.inner[3].m = load_u_inner_2_m(); s.inner[3].m = load_u_inner_2_m();
s.inner[1].m[0] = u.inner[0u].m_1.yx; s.inner[1].m[0] = u.inner[0u].m_1.yx;
} }

View File

@ -23,9 +23,21 @@ struct S {
/* 0x0044 */ tint_array<int8_t, 60> tint_pad_2; /* 0x0044 */ tint_array<int8_t, 60> tint_pad_2;
}; };
void assign_and_preserve_padding_1(device S* const dest, S value) {
(*(dest)).before = value.before;
(*(dest)).m = value.m;
(*(dest)).after = value.after;
}
void assign_and_preserve_padding(device tint_array<S, 4>* const dest, tint_array<S, 4> value) {
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
assign_and_preserve_padding_1(&((*(dest))[i]), value[i]);
}
}
kernel void f(device tint_array<S, 4>* tint_symbol [[buffer(1)]], const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) { kernel void f(device tint_array<S, 4>* tint_symbol [[buffer(1)]], const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) {
*(tint_symbol) = *(tint_symbol_1); assign_and_preserve_padding(tint_symbol, *(tint_symbol_1));
(*(tint_symbol))[1] = (*(tint_symbol_1))[2]; assign_and_preserve_padding_1(&((*(tint_symbol))[1]), (*(tint_symbol_1))[2]);
(*(tint_symbol))[3].m = (*(tint_symbol_1))[2].m; (*(tint_symbol))[3].m = (*(tint_symbol_1))[2].m;
(*(tint_symbol))[1].m[0] = float2((*(tint_symbol_1))[0].m[1]).yx; (*(tint_symbol))[1].m[0] = float2((*(tint_symbol_1))[0].m[1]).yx;
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: 104 ; Bound: 142
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
@ -22,13 +22,20 @@
OpMemberName %S 1 "m" OpMemberName %S 1 "m"
OpMemberName %S 2 "after" OpMemberName %S 2 "after"
OpName %s "s" OpName %s "s"
OpName %assign_and_preserve_padding_1_s_X "assign_and_preserve_padding_1_s_X"
OpName %dest "dest"
OpName %value "value"
OpName %assign_and_preserve_padding_s "assign_and_preserve_padding_s"
OpName %value_0 "value"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %conv_S "conv_S" OpName %conv_S "conv_S"
OpName %val "val" OpName %val "val"
OpName %conv_arr4_S "conv_arr4_S" OpName %conv_arr4_S "conv_arr4_S"
OpName %val_0 "val" OpName %val_0 "val"
OpName %arr "arr" OpName %arr "arr"
OpName %i "i" OpName %i_0 "i"
OpName %var_for_index "var_for_index" OpName %var_for_index_1 "var_for_index_1"
OpName %load_u_inner_2_m "load_u_inner_2_m" OpName %load_u_inner_2_m "load_u_inner_2_m"
OpName %f "f" OpName %f "f"
OpDecorate %u_block_std140 Block OpDecorate %u_block_std140 Block
@ -51,6 +58,7 @@
OpDecorate %_arr_S_uint_4 ArrayStride 128 OpDecorate %_arr_S_uint_4 ArrayStride 128
OpDecorate %s DescriptorSet 0 OpDecorate %s DescriptorSet 0
OpDecorate %s Binding 1 OpDecorate %s Binding 1
OpDecorate %_arr_uint_uint_1 ArrayStride 4
%int = OpTypeInt 32 1 %int = OpTypeInt 32 1
%float = OpTypeFloat 32 %float = OpTypeFloat 32
%v2float = OpTypeVector %float 2 %v2float = OpTypeVector %float 2
@ -67,110 +75,164 @@
%u_block = OpTypeStruct %_arr_S_uint_4 %u_block = OpTypeStruct %_arr_S_uint_4
%_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block %_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block
%s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer %s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer
%17 = OpTypeFunction %S %S_std140 %void = OpTypeVoid
%27 = OpTypeFunction %_arr_S_uint_4 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%33 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_uint = OpTypePointer Function %uint
%36 = OpConstantNull %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
%49 = OpConstantNull %_arr_S_std140_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
%uint_1 = OpConstant %uint 1 %uint_1 = OpConstant %uint 1
%62 = OpTypeFunction %mat2v2float %_arr_uint_uint_1 = OpTypeArray %uint %uint_1
%17 = OpTypeFunction %void %_arr_uint_uint_1 %S
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%26 = OpConstantNull %int
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%_ptr_StorageBuffer_mat2v2float = OpTypePointer StorageBuffer %mat2v2float
%uint_2 = OpConstant %uint 2 %uint_2 = OpConstant %uint 2
%39 = OpTypeFunction %void %_arr_S_uint_4
%43 = OpConstantNull %uint
%_ptr_Function_uint = OpTypePointer Function %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%58 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%68 = OpTypeFunction %S %S_std140
%78 = OpTypeFunction %_arr_S_uint_4 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
%95 = OpConstantNull %_arr_S_std140_uint_4
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
%106 = OpTypeFunction %mat2v2float
%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140 %_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140
%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float %_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
%void = OpTypeVoid %120 = OpTypeFunction %void
%78 = OpTypeFunction %void
%_ptr_StorageBuffer__arr_S_uint_4 = OpTypePointer StorageBuffer %_arr_S_uint_4
%_ptr_Uniform__arr_S_std140_uint_4 = OpTypePointer Uniform %_arr_S_std140_uint_4 %_ptr_Uniform__arr_S_std140_uint_4 = OpTypePointer Uniform %_arr_S_std140_uint_4
%int_1 = OpConstant %int 1 %129 = OpConstantComposite %_arr_uint_uint_1 %uint_1
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
%int_3 = OpConstant %int 3 %int_3 = OpConstant %int 3
%_ptr_StorageBuffer_mat2v2float = OpTypePointer StorageBuffer %mat2v2float %int_1 = OpConstant %int 1
%98 = OpConstantNull %int
%_ptr_StorageBuffer_v2float = OpTypePointer StorageBuffer %v2float %_ptr_StorageBuffer_v2float = OpTypePointer StorageBuffer %v2float
%conv_S = OpFunction %S None %17 %assign_and_preserve_padding_1_s_X = OpFunction %void None %17
%val = OpFunctionParameter %S_std140 %dest = OpFunctionParameter %_arr_uint_uint_1
%20 = OpLabel %value = OpFunctionParameter %S
%21 = OpCompositeExtract %int %val 0 %24 = OpLabel
%22 = OpCompositeExtract %v2float %val 1 %27 = OpCompositeExtract %uint %dest 0
%23 = OpCompositeExtract %v2float %val 2 %29 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %27 %uint_0
%24 = OpCompositeConstruct %mat2v2float %22 %23 %30 = OpCompositeExtract %int %value 0
%25 = OpCompositeExtract %int %val 3 OpStore %29 %30
%26 = OpCompositeConstruct %S %21 %24 %25 %31 = OpCompositeExtract %uint %dest 0
OpReturnValue %26 %33 = OpAccessChain %_ptr_StorageBuffer_mat2v2float %s %uint_0 %31 %uint_1
OpFunctionEnd %34 = OpCompositeExtract %mat2v2float %value 1
%conv_arr4_S = OpFunction %_arr_S_uint_4 None %27 OpStore %33 %34
%val_0 = OpFunctionParameter %_arr_S_std140_uint_4 %35 = OpCompositeExtract %uint %dest 0
%30 = OpLabel %37 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %35 %uint_2
%arr = OpVariable %_ptr_Function__arr_S_uint_4 Function %33 %38 = OpCompositeExtract %int %value 2
%i = OpVariable %_ptr_Function_uint Function %36 OpStore %37 %38
%var_for_index = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function %49 OpReturn
OpBranch %37 OpFunctionEnd
%37 = OpLabel %assign_and_preserve_padding_s = OpFunction %void None %39
OpLoopMerge %38 %39 None %value_0 = OpFunctionParameter %_arr_S_uint_4
OpBranch %40 %42 = OpLabel
%40 = OpLabel %i = OpVariable %_ptr_Function_uint Function %43
%42 = OpLoad %uint %i %var_for_index = OpVariable %_ptr_Function__arr_S_uint_4 Function %58
%43 = OpULessThan %bool %42 %uint_4 OpStore %i %43
%41 = OpLogicalNot %bool %43 OpBranch %46
OpSelectionMerge %45 None %46 = OpLabel
OpBranchConditional %41 %46 %45 OpLoopMerge %47 %48 None
%46 = OpLabel OpBranch %49
OpBranch %38 %49 = OpLabel
%45 = OpLabel %51 = OpLoad %uint %i
OpStore %var_for_index %val_0 %52 = OpULessThan %bool %51 %uint_4
%50 = OpLoad %uint %i %50 = OpLogicalNot %bool %52
%52 = OpAccessChain %_ptr_Function_S %arr %50 OpSelectionMerge %54 None
%54 = OpLoad %uint %i OpBranchConditional %50 %55 %54
%56 = OpAccessChain %_ptr_Function_S_std140 %var_for_index %54 %55 = OpLabel
%57 = OpLoad %S_std140 %56 OpBranch %47
%53 = OpFunctionCall %S %conv_S %57 %54 = OpLabel
OpStore %52 %53 OpStore %var_for_index %value_0
OpBranch %39 %60 = OpLoad %uint %i
%39 = OpLabel %61 = OpCompositeConstruct %_arr_uint_uint_1 %60
%58 = OpLoad %uint %i %62 = OpLoad %uint %i
%60 = OpIAdd %uint %58 %uint_1 %64 = OpAccessChain %_ptr_Function_S %var_for_index %62
OpStore %i %60 %65 = OpLoad %S %64
OpBranch %37 %59 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %61 %65
%38 = OpLabel OpBranch %48
%61 = OpLoad %_arr_S_uint_4 %arr %48 = OpLabel
OpReturnValue %61 %66 = OpLoad %uint %i
OpFunctionEnd %67 = OpIAdd %uint %66 %uint_1
%load_u_inner_2_m = OpFunction %mat2v2float None %62 OpStore %i %67
%64 = OpLabel OpBranch %46
%69 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2 %47 = OpLabel
%72 = OpAccessChain %_ptr_Uniform_v2float %69 %uint_1 OpReturn
%73 = OpLoad %v2float %72 OpFunctionEnd
%75 = OpAccessChain %_ptr_Uniform_v2float %69 %uint_2 %conv_S = OpFunction %S None %68
%76 = OpLoad %v2float %75 %val = OpFunctionParameter %S_std140
%77 = OpCompositeConstruct %mat2v2float %73 %76 %71 = OpLabel
OpReturnValue %77 %72 = OpCompositeExtract %int %val 0
OpFunctionEnd %73 = OpCompositeExtract %v2float %val 1
%f = OpFunction %void None %78 %74 = OpCompositeExtract %v2float %val 2
%81 = OpLabel %75 = OpCompositeConstruct %mat2v2float %73 %74
%83 = OpAccessChain %_ptr_StorageBuffer__arr_S_uint_4 %s %uint_0 %76 = OpCompositeExtract %int %val 3
%86 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %u %uint_0 %77 = OpCompositeConstruct %S %72 %75 %76
%87 = OpLoad %_arr_S_std140_uint_4 %86 OpReturnValue %77
%84 = OpFunctionCall %_arr_S_uint_4 %conv_arr4_S %87 OpFunctionEnd
OpStore %83 %84 %conv_arr4_S = OpFunction %_arr_S_uint_4 None %78
%90 = OpAccessChain %_ptr_StorageBuffer_S %s %uint_0 %int_1 %val_0 = OpFunctionParameter %_arr_S_std140_uint_4
%92 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2 %81 = OpLabel
%93 = OpLoad %S_std140 %92 %arr = OpVariable %_ptr_Function__arr_S_uint_4 Function %58
%91 = OpFunctionCall %S %conv_S %93 %i_0 = OpVariable %_ptr_Function_uint Function %43
OpStore %90 %91 %var_for_index_1 = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function %95
%96 = OpAccessChain %_ptr_StorageBuffer_mat2v2float %s %uint_0 %int_3 %uint_1 OpBranch %84
%97 = OpFunctionCall %mat2v2float %load_u_inner_2_m %84 = OpLabel
OpStore %96 %97 OpLoopMerge %85 %86 None
%100 = OpAccessChain %_ptr_StorageBuffer_v2float %s %uint_0 %int_1 %uint_1 %98 OpBranch %87
%101 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0 %36 %uint_2 %87 = OpLabel
%102 = OpLoad %v2float %101 %89 = OpLoad %uint %i_0
%103 = OpVectorShuffle %v2float %102 %102 1 0 %90 = OpULessThan %bool %89 %uint_4
OpStore %100 %103 %88 = OpLogicalNot %bool %90
OpSelectionMerge %91 None
OpBranchConditional %88 %92 %91
%92 = OpLabel
OpBranch %85
%91 = OpLabel
OpStore %var_for_index_1 %val_0
%96 = OpLoad %uint %i_0
%97 = OpAccessChain %_ptr_Function_S %arr %96
%99 = OpLoad %uint %i_0
%101 = OpAccessChain %_ptr_Function_S_std140 %var_for_index_1 %99
%102 = OpLoad %S_std140 %101
%98 = OpFunctionCall %S %conv_S %102
OpStore %97 %98
OpBranch %86
%86 = OpLabel
%103 = OpLoad %uint %i_0
%104 = OpIAdd %uint %103 %uint_1
OpStore %i_0 %104
OpBranch %84
%85 = OpLabel
%105 = OpLoad %_arr_S_uint_4 %arr
OpReturnValue %105
OpFunctionEnd
%load_u_inner_2_m = OpFunction %mat2v2float None %106
%108 = OpLabel
%111 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%114 = OpAccessChain %_ptr_Uniform_v2float %111 %uint_1
%115 = OpLoad %v2float %114
%117 = OpAccessChain %_ptr_Uniform_v2float %111 %uint_2
%118 = OpLoad %v2float %117
%119 = OpCompositeConstruct %mat2v2float %115 %118
OpReturnValue %119
OpFunctionEnd
%f = OpFunction %void None %120
%122 = OpLabel
%126 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %u %uint_0
%127 = OpLoad %_arr_S_std140_uint_4 %126
%124 = OpFunctionCall %_arr_S_uint_4 %conv_arr4_S %127
%123 = OpFunctionCall %void %assign_and_preserve_padding_s %124
%131 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%132 = OpLoad %S_std140 %131
%130 = OpFunctionCall %S %conv_S %132
%128 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %129 %130
%134 = OpAccessChain %_ptr_StorageBuffer_mat2v2float %s %uint_0 %int_3 %uint_1
%135 = OpFunctionCall %mat2v2float %load_u_inner_2_m
OpStore %134 %135
%138 = OpAccessChain %_ptr_StorageBuffer_v2float %s %uint_0 %int_1 %uint_1 %26
%139 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0 %43 %uint_2
%140 = OpLoad %v2float %139
%141 = OpVectorShuffle %v2float %140 %140 1 0
OpStore %138 %141
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -74,6 +74,21 @@ layout(binding = 1, std430) buffer u_block_ssbo {
S inner[4]; S inner[4];
} s; } s;
void assign_and_preserve_padding_1_s_X(uint dest[1], S value) {
s.inner[dest[0]].before = value.before;
s.inner[dest[0]].m = value.m;
s.inner[dest[0]].after = value.after;
}
void assign_and_preserve_padding_s(S value[4]) {
{
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
uint tint_symbol[1] = uint[1](i);
assign_and_preserve_padding_1_s_X(tint_symbol, value[i]);
}
}
}
S conv_S(S_std140 val) { S conv_S(S_std140 val) {
return S(val.before, val.pad, f16mat2x3(val.m_0, val.m_1), val.pad_1, val.pad_2, val.pad_3, val.pad_4, val.pad_5, val.pad_6, val.pad_7, val.pad_8, val.pad_9, val.pad_10, val.after, val.pad_11, val.pad_12, val.pad_13, val.pad_14, val.pad_15, val.pad_16, val.pad_17, val.pad_18, val.pad_19, val.pad_20, val.pad_21, val.pad_22, val.pad_23, val.pad_24, val.pad_25); return S(val.before, val.pad, f16mat2x3(val.m_0, val.m_1), val.pad_1, val.pad_2, val.pad_3, val.pad_4, val.pad_5, val.pad_6, val.pad_7, val.pad_8, val.pad_9, val.pad_10, val.after, val.pad_11, val.pad_12, val.pad_13, val.pad_14, val.pad_15, val.pad_16, val.pad_17, val.pad_18, val.pad_19, val.pad_20, val.pad_21, val.pad_22, val.pad_23, val.pad_24, val.pad_25);
} }
@ -93,8 +108,9 @@ f16mat2x3 load_u_inner_2_m() {
} }
void f() { void f() {
s.inner = conv_arr4_S(u.inner); assign_and_preserve_padding_s(conv_arr4_S(u.inner));
s.inner[1] = conv_S(u.inner[2u]); uint tint_symbol_1[1] = uint[1](1u);
assign_and_preserve_padding_1_s_X(tint_symbol_1, conv_S(u.inner[2u]));
s.inner[3].m = load_u_inner_2_m(); s.inner[3].m = load_u_inner_2_m();
s.inner[1].m[0] = u.inner[0u].m_1.zxy; s.inner[1].m[0] = u.inner[0u].m_1.zxy;
} }

View File

@ -23,9 +23,21 @@ struct S {
/* 0x0044 */ tint_array<int8_t, 60> tint_pad_2; /* 0x0044 */ tint_array<int8_t, 60> tint_pad_2;
}; };
void assign_and_preserve_padding_1(device S* const dest, S value) {
(*(dest)).before = value.before;
(*(dest)).m = value.m;
(*(dest)).after = value.after;
}
void assign_and_preserve_padding(device tint_array<S, 4>* const dest, tint_array<S, 4> value) {
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
assign_and_preserve_padding_1(&((*(dest))[i]), value[i]);
}
}
kernel void f(device tint_array<S, 4>* tint_symbol [[buffer(1)]], const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) { kernel void f(device tint_array<S, 4>* tint_symbol [[buffer(1)]], const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) {
*(tint_symbol) = *(tint_symbol_1); assign_and_preserve_padding(tint_symbol, *(tint_symbol_1));
(*(tint_symbol))[1] = (*(tint_symbol_1))[2]; assign_and_preserve_padding_1(&((*(tint_symbol))[1]), (*(tint_symbol_1))[2]);
(*(tint_symbol))[3].m = (*(tint_symbol_1))[2].m; (*(tint_symbol))[3].m = (*(tint_symbol_1))[2].m;
(*(tint_symbol))[1].m[0] = half3((*(tint_symbol_1))[0].m[1]).zxy; (*(tint_symbol))[1].m[0] = half3((*(tint_symbol_1))[0].m[1]).zxy;
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: 104 ; Bound: 142
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpCapability Float16 OpCapability Float16
@ -26,13 +26,20 @@
OpMemberName %S 1 "m" OpMemberName %S 1 "m"
OpMemberName %S 2 "after" OpMemberName %S 2 "after"
OpName %s "s" OpName %s "s"
OpName %assign_and_preserve_padding_1_s_X "assign_and_preserve_padding_1_s_X"
OpName %dest "dest"
OpName %value "value"
OpName %assign_and_preserve_padding_s "assign_and_preserve_padding_s"
OpName %value_0 "value"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %conv_S "conv_S" OpName %conv_S "conv_S"
OpName %val "val" OpName %val "val"
OpName %conv_arr4_S "conv_arr4_S" OpName %conv_arr4_S "conv_arr4_S"
OpName %val_0 "val" OpName %val_0 "val"
OpName %arr "arr" OpName %arr "arr"
OpName %i "i" OpName %i_0 "i"
OpName %var_for_index "var_for_index" OpName %var_for_index_1 "var_for_index_1"
OpName %load_u_inner_2_m "load_u_inner_2_m" OpName %load_u_inner_2_m "load_u_inner_2_m"
OpName %f "f" OpName %f "f"
OpDecorate %u_block_std140 Block OpDecorate %u_block_std140 Block
@ -55,6 +62,7 @@
OpDecorate %_arr_S_uint_4 ArrayStride 128 OpDecorate %_arr_S_uint_4 ArrayStride 128
OpDecorate %s DescriptorSet 0 OpDecorate %s DescriptorSet 0
OpDecorate %s Binding 1 OpDecorate %s Binding 1
OpDecorate %_arr_uint_uint_1 ArrayStride 4
%int = OpTypeInt 32 1 %int = OpTypeInt 32 1
%half = OpTypeFloat 16 %half = OpTypeFloat 16
%v3half = OpTypeVector %half 3 %v3half = OpTypeVector %half 3
@ -71,110 +79,164 @@
%u_block = OpTypeStruct %_arr_S_uint_4 %u_block = OpTypeStruct %_arr_S_uint_4
%_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block %_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block
%s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer %s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer
%17 = OpTypeFunction %S %S_std140 %void = OpTypeVoid
%27 = OpTypeFunction %_arr_S_uint_4 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%33 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_uint = OpTypePointer Function %uint
%36 = OpConstantNull %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
%49 = OpConstantNull %_arr_S_std140_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
%uint_1 = OpConstant %uint 1 %uint_1 = OpConstant %uint 1
%62 = OpTypeFunction %mat2v3half %_arr_uint_uint_1 = OpTypeArray %uint %uint_1
%17 = OpTypeFunction %void %_arr_uint_uint_1 %S
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%26 = OpConstantNull %int
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%_ptr_StorageBuffer_mat2v3half = OpTypePointer StorageBuffer %mat2v3half
%uint_2 = OpConstant %uint 2 %uint_2 = OpConstant %uint 2
%39 = OpTypeFunction %void %_arr_S_uint_4
%43 = OpConstantNull %uint
%_ptr_Function_uint = OpTypePointer Function %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%58 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%68 = OpTypeFunction %S %S_std140
%78 = OpTypeFunction %_arr_S_uint_4 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
%95 = OpConstantNull %_arr_S_std140_uint_4
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
%106 = OpTypeFunction %mat2v3half
%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140 %_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140
%_ptr_Uniform_v3half = OpTypePointer Uniform %v3half %_ptr_Uniform_v3half = OpTypePointer Uniform %v3half
%void = OpTypeVoid %120 = OpTypeFunction %void
%78 = OpTypeFunction %void
%_ptr_StorageBuffer__arr_S_uint_4 = OpTypePointer StorageBuffer %_arr_S_uint_4
%_ptr_Uniform__arr_S_std140_uint_4 = OpTypePointer Uniform %_arr_S_std140_uint_4 %_ptr_Uniform__arr_S_std140_uint_4 = OpTypePointer Uniform %_arr_S_std140_uint_4
%int_1 = OpConstant %int 1 %129 = OpConstantComposite %_arr_uint_uint_1 %uint_1
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
%int_3 = OpConstant %int 3 %int_3 = OpConstant %int 3
%_ptr_StorageBuffer_mat2v3half = OpTypePointer StorageBuffer %mat2v3half %int_1 = OpConstant %int 1
%98 = OpConstantNull %int
%_ptr_StorageBuffer_v3half = OpTypePointer StorageBuffer %v3half %_ptr_StorageBuffer_v3half = OpTypePointer StorageBuffer %v3half
%conv_S = OpFunction %S None %17 %assign_and_preserve_padding_1_s_X = OpFunction %void None %17
%val = OpFunctionParameter %S_std140 %dest = OpFunctionParameter %_arr_uint_uint_1
%20 = OpLabel %value = OpFunctionParameter %S
%21 = OpCompositeExtract %int %val 0 %24 = OpLabel
%22 = OpCompositeExtract %v3half %val 1 %27 = OpCompositeExtract %uint %dest 0
%23 = OpCompositeExtract %v3half %val 2 %29 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %27 %uint_0
%24 = OpCompositeConstruct %mat2v3half %22 %23 %30 = OpCompositeExtract %int %value 0
%25 = OpCompositeExtract %int %val 3 OpStore %29 %30
%26 = OpCompositeConstruct %S %21 %24 %25 %31 = OpCompositeExtract %uint %dest 0
OpReturnValue %26 %33 = OpAccessChain %_ptr_StorageBuffer_mat2v3half %s %uint_0 %31 %uint_1
OpFunctionEnd %34 = OpCompositeExtract %mat2v3half %value 1
%conv_arr4_S = OpFunction %_arr_S_uint_4 None %27 OpStore %33 %34
%val_0 = OpFunctionParameter %_arr_S_std140_uint_4 %35 = OpCompositeExtract %uint %dest 0
%30 = OpLabel %37 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %35 %uint_2
%arr = OpVariable %_ptr_Function__arr_S_uint_4 Function %33 %38 = OpCompositeExtract %int %value 2
%i = OpVariable %_ptr_Function_uint Function %36 OpStore %37 %38
%var_for_index = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function %49 OpReturn
OpBranch %37 OpFunctionEnd
%37 = OpLabel %assign_and_preserve_padding_s = OpFunction %void None %39
OpLoopMerge %38 %39 None %value_0 = OpFunctionParameter %_arr_S_uint_4
OpBranch %40 %42 = OpLabel
%40 = OpLabel %i = OpVariable %_ptr_Function_uint Function %43
%42 = OpLoad %uint %i %var_for_index = OpVariable %_ptr_Function__arr_S_uint_4 Function %58
%43 = OpULessThan %bool %42 %uint_4 OpStore %i %43
%41 = OpLogicalNot %bool %43 OpBranch %46
OpSelectionMerge %45 None %46 = OpLabel
OpBranchConditional %41 %46 %45 OpLoopMerge %47 %48 None
%46 = OpLabel OpBranch %49
OpBranch %38 %49 = OpLabel
%45 = OpLabel %51 = OpLoad %uint %i
OpStore %var_for_index %val_0 %52 = OpULessThan %bool %51 %uint_4
%50 = OpLoad %uint %i %50 = OpLogicalNot %bool %52
%52 = OpAccessChain %_ptr_Function_S %arr %50 OpSelectionMerge %54 None
%54 = OpLoad %uint %i OpBranchConditional %50 %55 %54
%56 = OpAccessChain %_ptr_Function_S_std140 %var_for_index %54 %55 = OpLabel
%57 = OpLoad %S_std140 %56 OpBranch %47
%53 = OpFunctionCall %S %conv_S %57 %54 = OpLabel
OpStore %52 %53 OpStore %var_for_index %value_0
OpBranch %39 %60 = OpLoad %uint %i
%39 = OpLabel %61 = OpCompositeConstruct %_arr_uint_uint_1 %60
%58 = OpLoad %uint %i %62 = OpLoad %uint %i
%60 = OpIAdd %uint %58 %uint_1 %64 = OpAccessChain %_ptr_Function_S %var_for_index %62
OpStore %i %60 %65 = OpLoad %S %64
OpBranch %37 %59 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %61 %65
%38 = OpLabel OpBranch %48
%61 = OpLoad %_arr_S_uint_4 %arr %48 = OpLabel
OpReturnValue %61 %66 = OpLoad %uint %i
OpFunctionEnd %67 = OpIAdd %uint %66 %uint_1
%load_u_inner_2_m = OpFunction %mat2v3half None %62 OpStore %i %67
%64 = OpLabel OpBranch %46
%69 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2 %47 = OpLabel
%72 = OpAccessChain %_ptr_Uniform_v3half %69 %uint_1 OpReturn
%73 = OpLoad %v3half %72 OpFunctionEnd
%75 = OpAccessChain %_ptr_Uniform_v3half %69 %uint_2 %conv_S = OpFunction %S None %68
%76 = OpLoad %v3half %75 %val = OpFunctionParameter %S_std140
%77 = OpCompositeConstruct %mat2v3half %73 %76 %71 = OpLabel
OpReturnValue %77 %72 = OpCompositeExtract %int %val 0
OpFunctionEnd %73 = OpCompositeExtract %v3half %val 1
%f = OpFunction %void None %78 %74 = OpCompositeExtract %v3half %val 2
%81 = OpLabel %75 = OpCompositeConstruct %mat2v3half %73 %74
%83 = OpAccessChain %_ptr_StorageBuffer__arr_S_uint_4 %s %uint_0 %76 = OpCompositeExtract %int %val 3
%86 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %u %uint_0 %77 = OpCompositeConstruct %S %72 %75 %76
%87 = OpLoad %_arr_S_std140_uint_4 %86 OpReturnValue %77
%84 = OpFunctionCall %_arr_S_uint_4 %conv_arr4_S %87 OpFunctionEnd
OpStore %83 %84 %conv_arr4_S = OpFunction %_arr_S_uint_4 None %78
%90 = OpAccessChain %_ptr_StorageBuffer_S %s %uint_0 %int_1 %val_0 = OpFunctionParameter %_arr_S_std140_uint_4
%92 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2 %81 = OpLabel
%93 = OpLoad %S_std140 %92 %arr = OpVariable %_ptr_Function__arr_S_uint_4 Function %58
%91 = OpFunctionCall %S %conv_S %93 %i_0 = OpVariable %_ptr_Function_uint Function %43
OpStore %90 %91 %var_for_index_1 = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function %95
%96 = OpAccessChain %_ptr_StorageBuffer_mat2v3half %s %uint_0 %int_3 %uint_1 OpBranch %84
%97 = OpFunctionCall %mat2v3half %load_u_inner_2_m %84 = OpLabel
OpStore %96 %97 OpLoopMerge %85 %86 None
%100 = OpAccessChain %_ptr_StorageBuffer_v3half %s %uint_0 %int_1 %uint_1 %98 OpBranch %87
%101 = OpAccessChain %_ptr_Uniform_v3half %u %uint_0 %36 %uint_2 %87 = OpLabel
%102 = OpLoad %v3half %101 %89 = OpLoad %uint %i_0
%103 = OpVectorShuffle %v3half %102 %102 2 0 1 %90 = OpULessThan %bool %89 %uint_4
OpStore %100 %103 %88 = OpLogicalNot %bool %90
OpSelectionMerge %91 None
OpBranchConditional %88 %92 %91
%92 = OpLabel
OpBranch %85
%91 = OpLabel
OpStore %var_for_index_1 %val_0
%96 = OpLoad %uint %i_0
%97 = OpAccessChain %_ptr_Function_S %arr %96
%99 = OpLoad %uint %i_0
%101 = OpAccessChain %_ptr_Function_S_std140 %var_for_index_1 %99
%102 = OpLoad %S_std140 %101
%98 = OpFunctionCall %S %conv_S %102
OpStore %97 %98
OpBranch %86
%86 = OpLabel
%103 = OpLoad %uint %i_0
%104 = OpIAdd %uint %103 %uint_1
OpStore %i_0 %104
OpBranch %84
%85 = OpLabel
%105 = OpLoad %_arr_S_uint_4 %arr
OpReturnValue %105
OpFunctionEnd
%load_u_inner_2_m = OpFunction %mat2v3half None %106
%108 = OpLabel
%111 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%114 = OpAccessChain %_ptr_Uniform_v3half %111 %uint_1
%115 = OpLoad %v3half %114
%117 = OpAccessChain %_ptr_Uniform_v3half %111 %uint_2
%118 = OpLoad %v3half %117
%119 = OpCompositeConstruct %mat2v3half %115 %118
OpReturnValue %119
OpFunctionEnd
%f = OpFunction %void None %120
%122 = OpLabel
%126 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %u %uint_0
%127 = OpLoad %_arr_S_std140_uint_4 %126
%124 = OpFunctionCall %_arr_S_uint_4 %conv_arr4_S %127
%123 = OpFunctionCall %void %assign_and_preserve_padding_s %124
%131 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%132 = OpLoad %S_std140 %131
%130 = OpFunctionCall %S %conv_S %132
%128 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %129 %130
%134 = OpAccessChain %_ptr_StorageBuffer_mat2v3half %s %uint_0 %int_3 %uint_1
%135 = OpFunctionCall %mat2v3half %load_u_inner_2_m
OpStore %134 %135
%138 = OpAccessChain %_ptr_StorageBuffer_v3half %s %uint_0 %int_1 %uint_1 %26
%139 = OpAccessChain %_ptr_Uniform_v3half %u %uint_0 %43 %uint_2
%140 = OpLoad %v3half %139
%141 = OpVectorShuffle %v3half %140 %140 2 0 1
OpStore %138 %141
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -36,9 +36,25 @@ layout(binding = 1, std430) buffer u_block_ssbo {
S inner[4]; S inner[4];
} s; } s;
void assign_and_preserve_padding_1_s_X(uint dest[1], S value) {
s.inner[dest[0]].before = value.before;
s.inner[dest[0]].m = value.m;
s.inner[dest[0]].after = value.after;
}
void assign_and_preserve_padding_s(S value[4]) {
{
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
uint tint_symbol[1] = uint[1](i);
assign_and_preserve_padding_1_s_X(tint_symbol, value[i]);
}
}
}
void f() { void f() {
s.inner = u.inner; assign_and_preserve_padding_s(u.inner);
s.inner[1] = u.inner[2]; uint tint_symbol_1[1] = uint[1](1u);
assign_and_preserve_padding_1_s_X(tint_symbol_1, u.inner[2]);
s.inner[3].m = u.inner[2].m; s.inner[3].m = u.inner[2].m;
s.inner[1].m[0] = u.inner[0].m[1].zxy; s.inner[1].m[0] = u.inner[0].m[1].zxy;
} }

View File

@ -23,9 +23,21 @@ struct S {
/* 0x0044 */ tint_array<int8_t, 60> tint_pad_2; /* 0x0044 */ tint_array<int8_t, 60> tint_pad_2;
}; };
void assign_and_preserve_padding_1(device S* const dest, S value) {
(*(dest)).before = value.before;
(*(dest)).m = value.m;
(*(dest)).after = value.after;
}
void assign_and_preserve_padding(device tint_array<S, 4>* const dest, tint_array<S, 4> value) {
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
assign_and_preserve_padding_1(&((*(dest))[i]), value[i]);
}
}
kernel void f(device tint_array<S, 4>* tint_symbol [[buffer(1)]], const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) { kernel void f(device tint_array<S, 4>* tint_symbol [[buffer(1)]], const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) {
*(tint_symbol) = *(tint_symbol_1); assign_and_preserve_padding(tint_symbol, *(tint_symbol_1));
(*(tint_symbol))[1] = (*(tint_symbol_1))[2]; assign_and_preserve_padding_1(&((*(tint_symbol))[1]), (*(tint_symbol_1))[2]);
(*(tint_symbol))[3].m = (*(tint_symbol_1))[2].m; (*(tint_symbol))[3].m = (*(tint_symbol_1))[2].m;
(*(tint_symbol))[1].m[0] = float3((*(tint_symbol_1))[0].m[1]).zxy; (*(tint_symbol))[1].m[0] = float3((*(tint_symbol_1))[0].m[1]).zxy;
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: 45 ; Bound: 90
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
@ -15,6 +15,13 @@
OpMemberName %S 2 "after" OpMemberName %S 2 "after"
OpName %u "u" OpName %u "u"
OpName %s "s" OpName %s "s"
OpName %assign_and_preserve_padding_1_s_X "assign_and_preserve_padding_1_s_X"
OpName %dest "dest"
OpName %value "value"
OpName %assign_and_preserve_padding_s "assign_and_preserve_padding_s"
OpName %value_0 "value"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %f "f" OpName %f "f"
OpDecorate %u_block Block OpDecorate %u_block Block
OpMemberDecorate %u_block 0 Offset 0 OpMemberDecorate %u_block 0 Offset 0
@ -29,6 +36,7 @@
OpDecorate %u Binding 0 OpDecorate %u Binding 0
OpDecorate %s DescriptorSet 0 OpDecorate %s DescriptorSet 0
OpDecorate %s Binding 1 OpDecorate %s Binding 1
OpDecorate %_arr_uint_uint_1 ArrayStride 4
%int = OpTypeInt 32 1 %int = OpTypeInt 32 1
%float = OpTypeFloat 32 %float = OpTypeFloat 32
%v3float = OpTypeVector %float 3 %v3float = OpTypeVector %float 3
@ -43,39 +51,100 @@
%_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block %_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block
%s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer %s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer
%void = OpTypeVoid %void = OpTypeVoid
%14 = OpTypeFunction %void %uint_1 = OpConstant %uint 1
%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
%14 = OpTypeFunction %void %_arr_uint_uint_1 %S
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer__arr_S_uint_4 = OpTypePointer StorageBuffer %_arr_S_uint_4 %23 = OpConstantNull %int
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%_ptr_StorageBuffer_mat2v3float = OpTypePointer StorageBuffer %mat2v3float
%uint_2 = OpConstant %uint 2
%36 = OpTypeFunction %void %_arr_S_uint_4
%40 = OpConstantNull %uint
%_ptr_Function_uint = OpTypePointer Function %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%55 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%65 = OpTypeFunction %void
%_ptr_Uniform__arr_S_uint_4 = OpTypePointer Uniform %_arr_S_uint_4 %_ptr_Uniform__arr_S_uint_4 = OpTypePointer Uniform %_arr_S_uint_4
%int_1 = OpConstant %int 1 %73 = OpConstantComposite %_arr_uint_uint_1 %uint_1
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
%int_2 = OpConstant %int 2 %int_2 = OpConstant %int 2
%_ptr_Uniform_S = OpTypePointer Uniform %S %_ptr_Uniform_S = OpTypePointer Uniform %S
%int_3 = OpConstant %int 3 %int_3 = OpConstant %int 3
%uint_1 = OpConstant %uint 1
%_ptr_StorageBuffer_mat2v3float = OpTypePointer StorageBuffer %mat2v3float
%_ptr_Uniform_mat2v3float = OpTypePointer Uniform %mat2v3float %_ptr_Uniform_mat2v3float = OpTypePointer Uniform %mat2v3float
%38 = OpConstantNull %int %int_1 = OpConstant %int 1
%_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float %_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float
%_ptr_Uniform_v3float = OpTypePointer Uniform %v3float %_ptr_Uniform_v3float = OpTypePointer Uniform %v3float
%f = OpFunction %void None %14 %assign_and_preserve_padding_1_s_X = OpFunction %void None %14
%17 = OpLabel %dest = OpFunctionParameter %_arr_uint_uint_1
%20 = OpAccessChain %_ptr_StorageBuffer__arr_S_uint_4 %s %uint_0 %value = OpFunctionParameter %S
%22 = OpAccessChain %_ptr_Uniform__arr_S_uint_4 %u %uint_0 %21 = OpLabel
%23 = OpLoad %_arr_S_uint_4 %22 %24 = OpCompositeExtract %uint %dest 0
OpStore %20 %23 %26 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %24 %uint_0
%26 = OpAccessChain %_ptr_StorageBuffer_S %s %uint_0 %int_1 %27 = OpCompositeExtract %int %value 0
%29 = OpAccessChain %_ptr_Uniform_S %u %uint_0 %int_2 OpStore %26 %27
%30 = OpLoad %S %29 %28 = OpCompositeExtract %uint %dest 0
OpStore %26 %30 %30 = OpAccessChain %_ptr_StorageBuffer_mat2v3float %s %uint_0 %28 %uint_1
%34 = OpAccessChain %_ptr_StorageBuffer_mat2v3float %s %uint_0 %int_3 %uint_1 %31 = OpCompositeExtract %mat2v3float %value 1
%36 = OpAccessChain %_ptr_Uniform_mat2v3float %u %uint_0 %int_2 %uint_1 OpStore %30 %31
%37 = OpLoad %mat2v3float %36 %32 = OpCompositeExtract %uint %dest 0
OpStore %34 %37 %34 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %32 %uint_2
%40 = OpAccessChain %_ptr_StorageBuffer_v3float %s %uint_0 %int_1 %uint_1 %38 %35 = OpCompositeExtract %int %value 2
%42 = OpAccessChain %_ptr_Uniform_v3float %u %uint_0 %38 %uint_1 %int_1 OpStore %34 %35
%43 = OpLoad %v3float %42 OpReturn
%44 = OpVectorShuffle %v3float %43 %43 2 0 1 OpFunctionEnd
OpStore %40 %44 %assign_and_preserve_padding_s = OpFunction %void None %36
%value_0 = OpFunctionParameter %_arr_S_uint_4
%39 = OpLabel
%i = OpVariable %_ptr_Function_uint Function %40
%var_for_index = OpVariable %_ptr_Function__arr_S_uint_4 Function %55
OpStore %i %40
OpBranch %43
%43 = OpLabel
OpLoopMerge %44 %45 None
OpBranch %46
%46 = OpLabel
%48 = OpLoad %uint %i
%49 = OpULessThan %bool %48 %uint_4
%47 = OpLogicalNot %bool %49
OpSelectionMerge %51 None
OpBranchConditional %47 %52 %51
%52 = OpLabel
OpBranch %44
%51 = OpLabel
OpStore %var_for_index %value_0
%57 = OpLoad %uint %i
%58 = OpCompositeConstruct %_arr_uint_uint_1 %57
%59 = OpLoad %uint %i
%61 = OpAccessChain %_ptr_Function_S %var_for_index %59
%62 = OpLoad %S %61
%56 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %58 %62
OpBranch %45
%45 = OpLabel
%63 = OpLoad %uint %i
%64 = OpIAdd %uint %63 %uint_1
OpStore %i %64
OpBranch %43
%44 = OpLabel
OpReturn
OpFunctionEnd
%f = OpFunction %void None %65
%67 = OpLabel
%70 = OpAccessChain %_ptr_Uniform__arr_S_uint_4 %u %uint_0
%71 = OpLoad %_arr_S_uint_4 %70
%68 = OpFunctionCall %void %assign_and_preserve_padding_s %71
%76 = OpAccessChain %_ptr_Uniform_S %u %uint_0 %int_2
%77 = OpLoad %S %76
%72 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %73 %77
%79 = OpAccessChain %_ptr_StorageBuffer_mat2v3float %s %uint_0 %int_3 %uint_1
%81 = OpAccessChain %_ptr_Uniform_mat2v3float %u %uint_0 %int_2 %uint_1
%82 = OpLoad %mat2v3float %81
OpStore %79 %82
%85 = OpAccessChain %_ptr_StorageBuffer_v3float %s %uint_0 %int_1 %uint_1 %23
%87 = OpAccessChain %_ptr_Uniform_v3float %u %uint_0 %23 %uint_1 %int_1
%88 = OpLoad %v3float %87
%89 = OpVectorShuffle %v3float %88 %88 2 0 1
OpStore %85 %89
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -74,6 +74,21 @@ layout(binding = 1, std430) buffer u_block_ssbo {
S inner[4]; S inner[4];
} s; } s;
void assign_and_preserve_padding_1_s_X(uint dest[1], S value) {
s.inner[dest[0]].before = value.before;
s.inner[dest[0]].m = value.m;
s.inner[dest[0]].after = value.after;
}
void assign_and_preserve_padding_s(S value[4]) {
{
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
uint tint_symbol[1] = uint[1](i);
assign_and_preserve_padding_1_s_X(tint_symbol, value[i]);
}
}
}
S conv_S(S_std140 val) { S conv_S(S_std140 val) {
return S(val.before, val.pad, f16mat2x4(val.m_0, val.m_1), val.pad_1, val.pad_2, val.pad_3, val.pad_4, val.pad_5, val.pad_6, val.pad_7, val.pad_8, val.pad_9, val.pad_10, val.after, val.pad_11, val.pad_12, val.pad_13, val.pad_14, val.pad_15, val.pad_16, val.pad_17, val.pad_18, val.pad_19, val.pad_20, val.pad_21, val.pad_22, val.pad_23, val.pad_24, val.pad_25); return S(val.before, val.pad, f16mat2x4(val.m_0, val.m_1), val.pad_1, val.pad_2, val.pad_3, val.pad_4, val.pad_5, val.pad_6, val.pad_7, val.pad_8, val.pad_9, val.pad_10, val.after, val.pad_11, val.pad_12, val.pad_13, val.pad_14, val.pad_15, val.pad_16, val.pad_17, val.pad_18, val.pad_19, val.pad_20, val.pad_21, val.pad_22, val.pad_23, val.pad_24, val.pad_25);
} }
@ -93,8 +108,9 @@ f16mat2x4 load_u_inner_2_m() {
} }
void f() { void f() {
s.inner = conv_arr4_S(u.inner); assign_and_preserve_padding_s(conv_arr4_S(u.inner));
s.inner[1] = conv_S(u.inner[2u]); uint tint_symbol_1[1] = uint[1](1u);
assign_and_preserve_padding_1_s_X(tint_symbol_1, conv_S(u.inner[2u]));
s.inner[3].m = load_u_inner_2_m(); s.inner[3].m = load_u_inner_2_m();
s.inner[1].m[0] = u.inner[0u].m_1.ywxz; s.inner[1].m[0] = u.inner[0u].m_1.ywxz;
} }

View File

@ -23,9 +23,21 @@ struct S {
/* 0x0044 */ tint_array<int8_t, 60> tint_pad_2; /* 0x0044 */ tint_array<int8_t, 60> tint_pad_2;
}; };
void assign_and_preserve_padding_1(device S* const dest, S value) {
(*(dest)).before = value.before;
(*(dest)).m = value.m;
(*(dest)).after = value.after;
}
void assign_and_preserve_padding(device tint_array<S, 4>* const dest, tint_array<S, 4> value) {
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
assign_and_preserve_padding_1(&((*(dest))[i]), value[i]);
}
}
kernel void f(device tint_array<S, 4>* tint_symbol [[buffer(1)]], const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) { kernel void f(device tint_array<S, 4>* tint_symbol [[buffer(1)]], const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) {
*(tint_symbol) = *(tint_symbol_1); assign_and_preserve_padding(tint_symbol, *(tint_symbol_1));
(*(tint_symbol))[1] = (*(tint_symbol_1))[2]; assign_and_preserve_padding_1(&((*(tint_symbol))[1]), (*(tint_symbol_1))[2]);
(*(tint_symbol))[3].m = (*(tint_symbol_1))[2].m; (*(tint_symbol))[3].m = (*(tint_symbol_1))[2].m;
(*(tint_symbol))[1].m[0] = half4((*(tint_symbol_1))[0].m[1]).ywxz; (*(tint_symbol))[1].m[0] = half4((*(tint_symbol_1))[0].m[1]).ywxz;
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: 104 ; Bound: 142
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpCapability Float16 OpCapability Float16
@ -26,13 +26,20 @@
OpMemberName %S 1 "m" OpMemberName %S 1 "m"
OpMemberName %S 2 "after" OpMemberName %S 2 "after"
OpName %s "s" OpName %s "s"
OpName %assign_and_preserve_padding_1_s_X "assign_and_preserve_padding_1_s_X"
OpName %dest "dest"
OpName %value "value"
OpName %assign_and_preserve_padding_s "assign_and_preserve_padding_s"
OpName %value_0 "value"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %conv_S "conv_S" OpName %conv_S "conv_S"
OpName %val "val" OpName %val "val"
OpName %conv_arr4_S "conv_arr4_S" OpName %conv_arr4_S "conv_arr4_S"
OpName %val_0 "val" OpName %val_0 "val"
OpName %arr "arr" OpName %arr "arr"
OpName %i "i" OpName %i_0 "i"
OpName %var_for_index "var_for_index" OpName %var_for_index_1 "var_for_index_1"
OpName %load_u_inner_2_m "load_u_inner_2_m" OpName %load_u_inner_2_m "load_u_inner_2_m"
OpName %f "f" OpName %f "f"
OpDecorate %u_block_std140 Block OpDecorate %u_block_std140 Block
@ -55,6 +62,7 @@
OpDecorate %_arr_S_uint_4 ArrayStride 128 OpDecorate %_arr_S_uint_4 ArrayStride 128
OpDecorate %s DescriptorSet 0 OpDecorate %s DescriptorSet 0
OpDecorate %s Binding 1 OpDecorate %s Binding 1
OpDecorate %_arr_uint_uint_1 ArrayStride 4
%int = OpTypeInt 32 1 %int = OpTypeInt 32 1
%half = OpTypeFloat 16 %half = OpTypeFloat 16
%v4half = OpTypeVector %half 4 %v4half = OpTypeVector %half 4
@ -71,110 +79,164 @@
%u_block = OpTypeStruct %_arr_S_uint_4 %u_block = OpTypeStruct %_arr_S_uint_4
%_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block %_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block
%s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer %s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer
%17 = OpTypeFunction %S %S_std140 %void = OpTypeVoid
%27 = OpTypeFunction %_arr_S_uint_4 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%33 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_uint = OpTypePointer Function %uint
%36 = OpConstantNull %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
%49 = OpConstantNull %_arr_S_std140_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
%uint_1 = OpConstant %uint 1 %uint_1 = OpConstant %uint 1
%62 = OpTypeFunction %mat2v4half %_arr_uint_uint_1 = OpTypeArray %uint %uint_1
%17 = OpTypeFunction %void %_arr_uint_uint_1 %S
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%26 = OpConstantNull %int
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%_ptr_StorageBuffer_mat2v4half = OpTypePointer StorageBuffer %mat2v4half
%uint_2 = OpConstant %uint 2 %uint_2 = OpConstant %uint 2
%39 = OpTypeFunction %void %_arr_S_uint_4
%43 = OpConstantNull %uint
%_ptr_Function_uint = OpTypePointer Function %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%58 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%68 = OpTypeFunction %S %S_std140
%78 = OpTypeFunction %_arr_S_uint_4 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
%95 = OpConstantNull %_arr_S_std140_uint_4
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
%106 = OpTypeFunction %mat2v4half
%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140 %_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140
%_ptr_Uniform_v4half = OpTypePointer Uniform %v4half %_ptr_Uniform_v4half = OpTypePointer Uniform %v4half
%void = OpTypeVoid %120 = OpTypeFunction %void
%78 = OpTypeFunction %void
%_ptr_StorageBuffer__arr_S_uint_4 = OpTypePointer StorageBuffer %_arr_S_uint_4
%_ptr_Uniform__arr_S_std140_uint_4 = OpTypePointer Uniform %_arr_S_std140_uint_4 %_ptr_Uniform__arr_S_std140_uint_4 = OpTypePointer Uniform %_arr_S_std140_uint_4
%int_1 = OpConstant %int 1 %129 = OpConstantComposite %_arr_uint_uint_1 %uint_1
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
%int_3 = OpConstant %int 3 %int_3 = OpConstant %int 3
%_ptr_StorageBuffer_mat2v4half = OpTypePointer StorageBuffer %mat2v4half %int_1 = OpConstant %int 1
%98 = OpConstantNull %int
%_ptr_StorageBuffer_v4half = OpTypePointer StorageBuffer %v4half %_ptr_StorageBuffer_v4half = OpTypePointer StorageBuffer %v4half
%conv_S = OpFunction %S None %17 %assign_and_preserve_padding_1_s_X = OpFunction %void None %17
%val = OpFunctionParameter %S_std140 %dest = OpFunctionParameter %_arr_uint_uint_1
%20 = OpLabel %value = OpFunctionParameter %S
%21 = OpCompositeExtract %int %val 0 %24 = OpLabel
%22 = OpCompositeExtract %v4half %val 1 %27 = OpCompositeExtract %uint %dest 0
%23 = OpCompositeExtract %v4half %val 2 %29 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %27 %uint_0
%24 = OpCompositeConstruct %mat2v4half %22 %23 %30 = OpCompositeExtract %int %value 0
%25 = OpCompositeExtract %int %val 3 OpStore %29 %30
%26 = OpCompositeConstruct %S %21 %24 %25 %31 = OpCompositeExtract %uint %dest 0
OpReturnValue %26 %33 = OpAccessChain %_ptr_StorageBuffer_mat2v4half %s %uint_0 %31 %uint_1
OpFunctionEnd %34 = OpCompositeExtract %mat2v4half %value 1
%conv_arr4_S = OpFunction %_arr_S_uint_4 None %27 OpStore %33 %34
%val_0 = OpFunctionParameter %_arr_S_std140_uint_4 %35 = OpCompositeExtract %uint %dest 0
%30 = OpLabel %37 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %35 %uint_2
%arr = OpVariable %_ptr_Function__arr_S_uint_4 Function %33 %38 = OpCompositeExtract %int %value 2
%i = OpVariable %_ptr_Function_uint Function %36 OpStore %37 %38
%var_for_index = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function %49 OpReturn
OpBranch %37 OpFunctionEnd
%37 = OpLabel %assign_and_preserve_padding_s = OpFunction %void None %39
OpLoopMerge %38 %39 None %value_0 = OpFunctionParameter %_arr_S_uint_4
OpBranch %40 %42 = OpLabel
%40 = OpLabel %i = OpVariable %_ptr_Function_uint Function %43
%42 = OpLoad %uint %i %var_for_index = OpVariable %_ptr_Function__arr_S_uint_4 Function %58
%43 = OpULessThan %bool %42 %uint_4 OpStore %i %43
%41 = OpLogicalNot %bool %43 OpBranch %46
OpSelectionMerge %45 None %46 = OpLabel
OpBranchConditional %41 %46 %45 OpLoopMerge %47 %48 None
%46 = OpLabel OpBranch %49
OpBranch %38 %49 = OpLabel
%45 = OpLabel %51 = OpLoad %uint %i
OpStore %var_for_index %val_0 %52 = OpULessThan %bool %51 %uint_4
%50 = OpLoad %uint %i %50 = OpLogicalNot %bool %52
%52 = OpAccessChain %_ptr_Function_S %arr %50 OpSelectionMerge %54 None
%54 = OpLoad %uint %i OpBranchConditional %50 %55 %54
%56 = OpAccessChain %_ptr_Function_S_std140 %var_for_index %54 %55 = OpLabel
%57 = OpLoad %S_std140 %56 OpBranch %47
%53 = OpFunctionCall %S %conv_S %57 %54 = OpLabel
OpStore %52 %53 OpStore %var_for_index %value_0
OpBranch %39 %60 = OpLoad %uint %i
%39 = OpLabel %61 = OpCompositeConstruct %_arr_uint_uint_1 %60
%58 = OpLoad %uint %i %62 = OpLoad %uint %i
%60 = OpIAdd %uint %58 %uint_1 %64 = OpAccessChain %_ptr_Function_S %var_for_index %62
OpStore %i %60 %65 = OpLoad %S %64
OpBranch %37 %59 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %61 %65
%38 = OpLabel OpBranch %48
%61 = OpLoad %_arr_S_uint_4 %arr %48 = OpLabel
OpReturnValue %61 %66 = OpLoad %uint %i
OpFunctionEnd %67 = OpIAdd %uint %66 %uint_1
%load_u_inner_2_m = OpFunction %mat2v4half None %62 OpStore %i %67
%64 = OpLabel OpBranch %46
%69 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2 %47 = OpLabel
%72 = OpAccessChain %_ptr_Uniform_v4half %69 %uint_1 OpReturn
%73 = OpLoad %v4half %72 OpFunctionEnd
%75 = OpAccessChain %_ptr_Uniform_v4half %69 %uint_2 %conv_S = OpFunction %S None %68
%76 = OpLoad %v4half %75 %val = OpFunctionParameter %S_std140
%77 = OpCompositeConstruct %mat2v4half %73 %76 %71 = OpLabel
OpReturnValue %77 %72 = OpCompositeExtract %int %val 0
OpFunctionEnd %73 = OpCompositeExtract %v4half %val 1
%f = OpFunction %void None %78 %74 = OpCompositeExtract %v4half %val 2
%81 = OpLabel %75 = OpCompositeConstruct %mat2v4half %73 %74
%83 = OpAccessChain %_ptr_StorageBuffer__arr_S_uint_4 %s %uint_0 %76 = OpCompositeExtract %int %val 3
%86 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %u %uint_0 %77 = OpCompositeConstruct %S %72 %75 %76
%87 = OpLoad %_arr_S_std140_uint_4 %86 OpReturnValue %77
%84 = OpFunctionCall %_arr_S_uint_4 %conv_arr4_S %87 OpFunctionEnd
OpStore %83 %84 %conv_arr4_S = OpFunction %_arr_S_uint_4 None %78
%90 = OpAccessChain %_ptr_StorageBuffer_S %s %uint_0 %int_1 %val_0 = OpFunctionParameter %_arr_S_std140_uint_4
%92 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2 %81 = OpLabel
%93 = OpLoad %S_std140 %92 %arr = OpVariable %_ptr_Function__arr_S_uint_4 Function %58
%91 = OpFunctionCall %S %conv_S %93 %i_0 = OpVariable %_ptr_Function_uint Function %43
OpStore %90 %91 %var_for_index_1 = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function %95
%96 = OpAccessChain %_ptr_StorageBuffer_mat2v4half %s %uint_0 %int_3 %uint_1 OpBranch %84
%97 = OpFunctionCall %mat2v4half %load_u_inner_2_m %84 = OpLabel
OpStore %96 %97 OpLoopMerge %85 %86 None
%100 = OpAccessChain %_ptr_StorageBuffer_v4half %s %uint_0 %int_1 %uint_1 %98 OpBranch %87
%101 = OpAccessChain %_ptr_Uniform_v4half %u %uint_0 %36 %uint_2 %87 = OpLabel
%102 = OpLoad %v4half %101 %89 = OpLoad %uint %i_0
%103 = OpVectorShuffle %v4half %102 %102 1 3 0 2 %90 = OpULessThan %bool %89 %uint_4
OpStore %100 %103 %88 = OpLogicalNot %bool %90
OpSelectionMerge %91 None
OpBranchConditional %88 %92 %91
%92 = OpLabel
OpBranch %85
%91 = OpLabel
OpStore %var_for_index_1 %val_0
%96 = OpLoad %uint %i_0
%97 = OpAccessChain %_ptr_Function_S %arr %96
%99 = OpLoad %uint %i_0
%101 = OpAccessChain %_ptr_Function_S_std140 %var_for_index_1 %99
%102 = OpLoad %S_std140 %101
%98 = OpFunctionCall %S %conv_S %102
OpStore %97 %98
OpBranch %86
%86 = OpLabel
%103 = OpLoad %uint %i_0
%104 = OpIAdd %uint %103 %uint_1
OpStore %i_0 %104
OpBranch %84
%85 = OpLabel
%105 = OpLoad %_arr_S_uint_4 %arr
OpReturnValue %105
OpFunctionEnd
%load_u_inner_2_m = OpFunction %mat2v4half None %106
%108 = OpLabel
%111 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%114 = OpAccessChain %_ptr_Uniform_v4half %111 %uint_1
%115 = OpLoad %v4half %114
%117 = OpAccessChain %_ptr_Uniform_v4half %111 %uint_2
%118 = OpLoad %v4half %117
%119 = OpCompositeConstruct %mat2v4half %115 %118
OpReturnValue %119
OpFunctionEnd
%f = OpFunction %void None %120
%122 = OpLabel
%126 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %u %uint_0
%127 = OpLoad %_arr_S_std140_uint_4 %126
%124 = OpFunctionCall %_arr_S_uint_4 %conv_arr4_S %127
%123 = OpFunctionCall %void %assign_and_preserve_padding_s %124
%131 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%132 = OpLoad %S_std140 %131
%130 = OpFunctionCall %S %conv_S %132
%128 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %129 %130
%134 = OpAccessChain %_ptr_StorageBuffer_mat2v4half %s %uint_0 %int_3 %uint_1
%135 = OpFunctionCall %mat2v4half %load_u_inner_2_m
OpStore %134 %135
%138 = OpAccessChain %_ptr_StorageBuffer_v4half %s %uint_0 %int_1 %uint_1 %26
%139 = OpAccessChain %_ptr_Uniform_v4half %u %uint_0 %43 %uint_2
%140 = OpLoad %v4half %139
%141 = OpVectorShuffle %v4half %140 %140 1 3 0 2
OpStore %138 %141
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -36,9 +36,25 @@ layout(binding = 1, std430) buffer u_block_ssbo {
S inner[4]; S inner[4];
} s; } s;
void assign_and_preserve_padding_1_s_X(uint dest[1], S value) {
s.inner[dest[0]].before = value.before;
s.inner[dest[0]].m = value.m;
s.inner[dest[0]].after = value.after;
}
void assign_and_preserve_padding_s(S value[4]) {
{
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
uint tint_symbol[1] = uint[1](i);
assign_and_preserve_padding_1_s_X(tint_symbol, value[i]);
}
}
}
void f() { void f() {
s.inner = u.inner; assign_and_preserve_padding_s(u.inner);
s.inner[1] = u.inner[2]; uint tint_symbol_1[1] = uint[1](1u);
assign_and_preserve_padding_1_s_X(tint_symbol_1, u.inner[2]);
s.inner[3].m = u.inner[2].m; s.inner[3].m = u.inner[2].m;
s.inner[1].m[0] = u.inner[0].m[1].ywxz; s.inner[1].m[0] = u.inner[0].m[1].ywxz;
} }

View File

@ -23,9 +23,21 @@ struct S {
/* 0x0044 */ tint_array<int8_t, 60> tint_pad_2; /* 0x0044 */ tint_array<int8_t, 60> tint_pad_2;
}; };
void assign_and_preserve_padding_1(device S* const dest, S value) {
(*(dest)).before = value.before;
(*(dest)).m = value.m;
(*(dest)).after = value.after;
}
void assign_and_preserve_padding(device tint_array<S, 4>* const dest, tint_array<S, 4> value) {
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
assign_and_preserve_padding_1(&((*(dest))[i]), value[i]);
}
}
kernel void f(device tint_array<S, 4>* tint_symbol [[buffer(1)]], const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) { kernel void f(device tint_array<S, 4>* tint_symbol [[buffer(1)]], const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) {
*(tint_symbol) = *(tint_symbol_1); assign_and_preserve_padding(tint_symbol, *(tint_symbol_1));
(*(tint_symbol))[1] = (*(tint_symbol_1))[2]; assign_and_preserve_padding_1(&((*(tint_symbol))[1]), (*(tint_symbol_1))[2]);
(*(tint_symbol))[3].m = (*(tint_symbol_1))[2].m; (*(tint_symbol))[3].m = (*(tint_symbol_1))[2].m;
(*(tint_symbol))[1].m[0] = float4((*(tint_symbol_1))[0].m[1]).ywxz; (*(tint_symbol))[1].m[0] = float4((*(tint_symbol_1))[0].m[1]).ywxz;
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: 45 ; Bound: 90
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
@ -15,6 +15,13 @@
OpMemberName %S 2 "after" OpMemberName %S 2 "after"
OpName %u "u" OpName %u "u"
OpName %s "s" OpName %s "s"
OpName %assign_and_preserve_padding_1_s_X "assign_and_preserve_padding_1_s_X"
OpName %dest "dest"
OpName %value "value"
OpName %assign_and_preserve_padding_s "assign_and_preserve_padding_s"
OpName %value_0 "value"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %f "f" OpName %f "f"
OpDecorate %u_block Block OpDecorate %u_block Block
OpMemberDecorate %u_block 0 Offset 0 OpMemberDecorate %u_block 0 Offset 0
@ -29,6 +36,7 @@
OpDecorate %u Binding 0 OpDecorate %u Binding 0
OpDecorate %s DescriptorSet 0 OpDecorate %s DescriptorSet 0
OpDecorate %s Binding 1 OpDecorate %s Binding 1
OpDecorate %_arr_uint_uint_1 ArrayStride 4
%int = OpTypeInt 32 1 %int = OpTypeInt 32 1
%float = OpTypeFloat 32 %float = OpTypeFloat 32
%v4float = OpTypeVector %float 4 %v4float = OpTypeVector %float 4
@ -43,39 +51,100 @@
%_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block %_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block
%s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer %s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer
%void = OpTypeVoid %void = OpTypeVoid
%14 = OpTypeFunction %void %uint_1 = OpConstant %uint 1
%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
%14 = OpTypeFunction %void %_arr_uint_uint_1 %S
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer__arr_S_uint_4 = OpTypePointer StorageBuffer %_arr_S_uint_4 %23 = OpConstantNull %int
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%_ptr_StorageBuffer_mat2v4float = OpTypePointer StorageBuffer %mat2v4float
%uint_2 = OpConstant %uint 2
%36 = OpTypeFunction %void %_arr_S_uint_4
%40 = OpConstantNull %uint
%_ptr_Function_uint = OpTypePointer Function %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%55 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%65 = OpTypeFunction %void
%_ptr_Uniform__arr_S_uint_4 = OpTypePointer Uniform %_arr_S_uint_4 %_ptr_Uniform__arr_S_uint_4 = OpTypePointer Uniform %_arr_S_uint_4
%int_1 = OpConstant %int 1 %73 = OpConstantComposite %_arr_uint_uint_1 %uint_1
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
%int_2 = OpConstant %int 2 %int_2 = OpConstant %int 2
%_ptr_Uniform_S = OpTypePointer Uniform %S %_ptr_Uniform_S = OpTypePointer Uniform %S
%int_3 = OpConstant %int 3 %int_3 = OpConstant %int 3
%uint_1 = OpConstant %uint 1
%_ptr_StorageBuffer_mat2v4float = OpTypePointer StorageBuffer %mat2v4float
%_ptr_Uniform_mat2v4float = OpTypePointer Uniform %mat2v4float %_ptr_Uniform_mat2v4float = OpTypePointer Uniform %mat2v4float
%38 = OpConstantNull %int %int_1 = OpConstant %int 1
%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float %_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float
%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float %_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
%f = OpFunction %void None %14 %assign_and_preserve_padding_1_s_X = OpFunction %void None %14
%17 = OpLabel %dest = OpFunctionParameter %_arr_uint_uint_1
%20 = OpAccessChain %_ptr_StorageBuffer__arr_S_uint_4 %s %uint_0 %value = OpFunctionParameter %S
%22 = OpAccessChain %_ptr_Uniform__arr_S_uint_4 %u %uint_0 %21 = OpLabel
%23 = OpLoad %_arr_S_uint_4 %22 %24 = OpCompositeExtract %uint %dest 0
OpStore %20 %23 %26 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %24 %uint_0
%26 = OpAccessChain %_ptr_StorageBuffer_S %s %uint_0 %int_1 %27 = OpCompositeExtract %int %value 0
%29 = OpAccessChain %_ptr_Uniform_S %u %uint_0 %int_2 OpStore %26 %27
%30 = OpLoad %S %29 %28 = OpCompositeExtract %uint %dest 0
OpStore %26 %30 %30 = OpAccessChain %_ptr_StorageBuffer_mat2v4float %s %uint_0 %28 %uint_1
%34 = OpAccessChain %_ptr_StorageBuffer_mat2v4float %s %uint_0 %int_3 %uint_1 %31 = OpCompositeExtract %mat2v4float %value 1
%36 = OpAccessChain %_ptr_Uniform_mat2v4float %u %uint_0 %int_2 %uint_1 OpStore %30 %31
%37 = OpLoad %mat2v4float %36 %32 = OpCompositeExtract %uint %dest 0
OpStore %34 %37 %34 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %32 %uint_2
%40 = OpAccessChain %_ptr_StorageBuffer_v4float %s %uint_0 %int_1 %uint_1 %38 %35 = OpCompositeExtract %int %value 2
%42 = OpAccessChain %_ptr_Uniform_v4float %u %uint_0 %38 %uint_1 %int_1 OpStore %34 %35
%43 = OpLoad %v4float %42 OpReturn
%44 = OpVectorShuffle %v4float %43 %43 1 3 0 2 OpFunctionEnd
OpStore %40 %44 %assign_and_preserve_padding_s = OpFunction %void None %36
%value_0 = OpFunctionParameter %_arr_S_uint_4
%39 = OpLabel
%i = OpVariable %_ptr_Function_uint Function %40
%var_for_index = OpVariable %_ptr_Function__arr_S_uint_4 Function %55
OpStore %i %40
OpBranch %43
%43 = OpLabel
OpLoopMerge %44 %45 None
OpBranch %46
%46 = OpLabel
%48 = OpLoad %uint %i
%49 = OpULessThan %bool %48 %uint_4
%47 = OpLogicalNot %bool %49
OpSelectionMerge %51 None
OpBranchConditional %47 %52 %51
%52 = OpLabel
OpBranch %44
%51 = OpLabel
OpStore %var_for_index %value_0
%57 = OpLoad %uint %i
%58 = OpCompositeConstruct %_arr_uint_uint_1 %57
%59 = OpLoad %uint %i
%61 = OpAccessChain %_ptr_Function_S %var_for_index %59
%62 = OpLoad %S %61
%56 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %58 %62
OpBranch %45
%45 = OpLabel
%63 = OpLoad %uint %i
%64 = OpIAdd %uint %63 %uint_1
OpStore %i %64
OpBranch %43
%44 = OpLabel
OpReturn
OpFunctionEnd
%f = OpFunction %void None %65
%67 = OpLabel
%70 = OpAccessChain %_ptr_Uniform__arr_S_uint_4 %u %uint_0
%71 = OpLoad %_arr_S_uint_4 %70
%68 = OpFunctionCall %void %assign_and_preserve_padding_s %71
%76 = OpAccessChain %_ptr_Uniform_S %u %uint_0 %int_2
%77 = OpLoad %S %76
%72 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %73 %77
%79 = OpAccessChain %_ptr_StorageBuffer_mat2v4float %s %uint_0 %int_3 %uint_1
%81 = OpAccessChain %_ptr_Uniform_mat2v4float %u %uint_0 %int_2 %uint_1
%82 = OpLoad %mat2v4float %81
OpStore %79 %82
%85 = OpAccessChain %_ptr_StorageBuffer_v4float %s %uint_0 %int_1 %uint_1 %23
%87 = OpAccessChain %_ptr_Uniform_v4float %u %uint_0 %23 %uint_1 %int_1
%88 = OpLoad %v4float %87
%89 = OpVectorShuffle %v4float %88 %88 1 3 0 2
OpStore %85 %89
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -77,6 +77,21 @@ layout(binding = 1, std430) buffer u_block_ssbo {
S inner[4]; S inner[4];
} s; } s;
void assign_and_preserve_padding_1_s_X(uint dest[1], S value) {
s.inner[dest[0]].before = value.before;
s.inner[dest[0]].m = value.m;
s.inner[dest[0]].after = value.after;
}
void assign_and_preserve_padding_s(S value[4]) {
{
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
uint tint_symbol[1] = uint[1](i);
assign_and_preserve_padding_1_s_X(tint_symbol, value[i]);
}
}
}
S conv_S(S_std140 val) { S conv_S(S_std140 val) {
return S(val.before, f16mat3x2(val.m_0, val.m_1, val.m_2), val.pad, val.pad_1, val.pad_2, val.pad_3, val.pad_4, val.pad_5, val.pad_6, val.pad_7, val.pad_8, val.pad_9, val.pad_10, val.pad_11, val.after, val.pad_12, val.pad_13, val.pad_14, val.pad_15, val.pad_16, val.pad_17, val.pad_18, val.pad_19, val.pad_20, val.pad_21, val.pad_22, val.pad_23, val.pad_24, val.pad_25, val.pad_26); return S(val.before, f16mat3x2(val.m_0, val.m_1, val.m_2), val.pad, val.pad_1, val.pad_2, val.pad_3, val.pad_4, val.pad_5, val.pad_6, val.pad_7, val.pad_8, val.pad_9, val.pad_10, val.pad_11, val.after, val.pad_12, val.pad_13, val.pad_14, val.pad_15, val.pad_16, val.pad_17, val.pad_18, val.pad_19, val.pad_20, val.pad_21, val.pad_22, val.pad_23, val.pad_24, val.pad_25, val.pad_26);
} }
@ -96,8 +111,9 @@ f16mat3x2 load_u_inner_2_m() {
} }
void f() { void f() {
s.inner = conv_arr4_S(u.inner); assign_and_preserve_padding_s(conv_arr4_S(u.inner));
s.inner[1] = conv_S(u.inner[2u]); uint tint_symbol_1[1] = uint[1](1u);
assign_and_preserve_padding_1_s_X(tint_symbol_1, conv_S(u.inner[2u]));
s.inner[3].m = load_u_inner_2_m(); s.inner[3].m = load_u_inner_2_m();
s.inner[1].m[0] = u.inner[0u].m_1.yx; s.inner[1].m[0] = u.inner[0u].m_1.yx;
} }

View File

@ -22,9 +22,21 @@ struct S {
/* 0x0044 */ tint_array<int8_t, 60> tint_pad_1; /* 0x0044 */ tint_array<int8_t, 60> tint_pad_1;
}; };
void assign_and_preserve_padding_1(device S* const dest, S value) {
(*(dest)).before = value.before;
(*(dest)).m = value.m;
(*(dest)).after = value.after;
}
void assign_and_preserve_padding(device tint_array<S, 4>* const dest, tint_array<S, 4> value) {
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
assign_and_preserve_padding_1(&((*(dest))[i]), value[i]);
}
}
kernel void f(device tint_array<S, 4>* tint_symbol [[buffer(1)]], const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) { kernel void f(device tint_array<S, 4>* tint_symbol [[buffer(1)]], const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) {
*(tint_symbol) = *(tint_symbol_1); assign_and_preserve_padding(tint_symbol, *(tint_symbol_1));
(*(tint_symbol))[1] = (*(tint_symbol_1))[2]; assign_and_preserve_padding_1(&((*(tint_symbol))[1]), (*(tint_symbol_1))[2]);
(*(tint_symbol))[3].m = (*(tint_symbol_1))[2].m; (*(tint_symbol))[3].m = (*(tint_symbol_1))[2].m;
(*(tint_symbol))[1].m[0] = half2((*(tint_symbol_1))[0].m[1]).yx; (*(tint_symbol))[1].m[0] = half2((*(tint_symbol_1))[0].m[1]).yx;
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: 109 ; Bound: 147
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpCapability Float16 OpCapability Float16
@ -27,13 +27,20 @@
OpMemberName %S 1 "m" OpMemberName %S 1 "m"
OpMemberName %S 2 "after" OpMemberName %S 2 "after"
OpName %s "s" OpName %s "s"
OpName %assign_and_preserve_padding_1_s_X "assign_and_preserve_padding_1_s_X"
OpName %dest "dest"
OpName %value "value"
OpName %assign_and_preserve_padding_s "assign_and_preserve_padding_s"
OpName %value_0 "value"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %conv_S "conv_S" OpName %conv_S "conv_S"
OpName %val "val" OpName %val "val"
OpName %conv_arr4_S "conv_arr4_S" OpName %conv_arr4_S "conv_arr4_S"
OpName %val_0 "val" OpName %val_0 "val"
OpName %arr "arr" OpName %arr "arr"
OpName %i "i" OpName %i_0 "i"
OpName %var_for_index "var_for_index" OpName %var_for_index_1 "var_for_index_1"
OpName %load_u_inner_2_m "load_u_inner_2_m" OpName %load_u_inner_2_m "load_u_inner_2_m"
OpName %f "f" OpName %f "f"
OpDecorate %u_block_std140 Block OpDecorate %u_block_std140 Block
@ -57,6 +64,7 @@
OpDecorate %_arr_S_uint_4 ArrayStride 128 OpDecorate %_arr_S_uint_4 ArrayStride 128
OpDecorate %s DescriptorSet 0 OpDecorate %s DescriptorSet 0
OpDecorate %s Binding 1 OpDecorate %s Binding 1
OpDecorate %_arr_uint_uint_1 ArrayStride 4
%int = OpTypeInt 32 1 %int = OpTypeInt 32 1
%half = OpTypeFloat 16 %half = OpTypeFloat 16
%v2half = OpTypeVector %half 2 %v2half = OpTypeVector %half 2
@ -73,114 +81,168 @@
%u_block = OpTypeStruct %_arr_S_uint_4 %u_block = OpTypeStruct %_arr_S_uint_4
%_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block %_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block
%s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer %s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer
%17 = OpTypeFunction %S %S_std140 %void = OpTypeVoid
%28 = OpTypeFunction %_arr_S_uint_4 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%34 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_uint = OpTypePointer Function %uint
%37 = OpConstantNull %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
%50 = OpConstantNull %_arr_S_std140_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
%uint_1 = OpConstant %uint 1 %uint_1 = OpConstant %uint 1
%63 = OpTypeFunction %mat3v2half %_arr_uint_uint_1 = OpTypeArray %uint %uint_1
%17 = OpTypeFunction %void %_arr_uint_uint_1 %S
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%26 = OpConstantNull %int
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%_ptr_StorageBuffer_mat3v2half = OpTypePointer StorageBuffer %mat3v2half
%uint_2 = OpConstant %uint 2 %uint_2 = OpConstant %uint 2
%39 = OpTypeFunction %void %_arr_S_uint_4
%43 = OpConstantNull %uint
%_ptr_Function_uint = OpTypePointer Function %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%58 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%68 = OpTypeFunction %S %S_std140
%79 = OpTypeFunction %_arr_S_uint_4 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
%96 = OpConstantNull %_arr_S_std140_uint_4
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
%107 = OpTypeFunction %mat3v2half
%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140 %_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140
%_ptr_Uniform_v2half = OpTypePointer Uniform %v2half %_ptr_Uniform_v2half = OpTypePointer Uniform %v2half
%uint_3 = OpConstant %uint 3 %uint_3 = OpConstant %uint 3
%void = OpTypeVoid %125 = OpTypeFunction %void
%83 = OpTypeFunction %void
%_ptr_StorageBuffer__arr_S_uint_4 = OpTypePointer StorageBuffer %_arr_S_uint_4
%_ptr_Uniform__arr_S_std140_uint_4 = OpTypePointer Uniform %_arr_S_std140_uint_4 %_ptr_Uniform__arr_S_std140_uint_4 = OpTypePointer Uniform %_arr_S_std140_uint_4
%int_1 = OpConstant %int 1 %134 = OpConstantComposite %_arr_uint_uint_1 %uint_1
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
%int_3 = OpConstant %int 3 %int_3 = OpConstant %int 3
%_ptr_StorageBuffer_mat3v2half = OpTypePointer StorageBuffer %mat3v2half %int_1 = OpConstant %int 1
%103 = OpConstantNull %int
%_ptr_StorageBuffer_v2half = OpTypePointer StorageBuffer %v2half %_ptr_StorageBuffer_v2half = OpTypePointer StorageBuffer %v2half
%conv_S = OpFunction %S None %17 %assign_and_preserve_padding_1_s_X = OpFunction %void None %17
%val = OpFunctionParameter %S_std140 %dest = OpFunctionParameter %_arr_uint_uint_1
%20 = OpLabel %value = OpFunctionParameter %S
%21 = OpCompositeExtract %int %val 0 %24 = OpLabel
%22 = OpCompositeExtract %v2half %val 1 %27 = OpCompositeExtract %uint %dest 0
%23 = OpCompositeExtract %v2half %val 2 %29 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %27 %uint_0
%24 = OpCompositeExtract %v2half %val 3 %30 = OpCompositeExtract %int %value 0
%25 = OpCompositeConstruct %mat3v2half %22 %23 %24 OpStore %29 %30
%26 = OpCompositeExtract %int %val 4 %31 = OpCompositeExtract %uint %dest 0
%27 = OpCompositeConstruct %S %21 %25 %26 %33 = OpAccessChain %_ptr_StorageBuffer_mat3v2half %s %uint_0 %31 %uint_1
OpReturnValue %27 %34 = OpCompositeExtract %mat3v2half %value 1
OpFunctionEnd OpStore %33 %34
%conv_arr4_S = OpFunction %_arr_S_uint_4 None %28 %35 = OpCompositeExtract %uint %dest 0
%val_0 = OpFunctionParameter %_arr_S_std140_uint_4 %37 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %35 %uint_2
%31 = OpLabel %38 = OpCompositeExtract %int %value 2
%arr = OpVariable %_ptr_Function__arr_S_uint_4 Function %34 OpStore %37 %38
%i = OpVariable %_ptr_Function_uint Function %37 OpReturn
%var_for_index = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function %50 OpFunctionEnd
OpBranch %38 %assign_and_preserve_padding_s = OpFunction %void None %39
%38 = OpLabel %value_0 = OpFunctionParameter %_arr_S_uint_4
OpLoopMerge %39 %40 None %42 = OpLabel
OpBranch %41 %i = OpVariable %_ptr_Function_uint Function %43
%41 = OpLabel %var_for_index = OpVariable %_ptr_Function__arr_S_uint_4 Function %58
%43 = OpLoad %uint %i OpStore %i %43
%44 = OpULessThan %bool %43 %uint_4 OpBranch %46
%42 = OpLogicalNot %bool %44 %46 = OpLabel
OpSelectionMerge %46 None OpLoopMerge %47 %48 None
OpBranchConditional %42 %47 %46 OpBranch %49
%47 = OpLabel %49 = OpLabel
OpBranch %39 %51 = OpLoad %uint %i
%46 = OpLabel %52 = OpULessThan %bool %51 %uint_4
OpStore %var_for_index %val_0 %50 = OpLogicalNot %bool %52
%51 = OpLoad %uint %i OpSelectionMerge %54 None
%53 = OpAccessChain %_ptr_Function_S %arr %51 OpBranchConditional %50 %55 %54
%55 = OpLoad %uint %i %55 = OpLabel
%57 = OpAccessChain %_ptr_Function_S_std140 %var_for_index %55 OpBranch %47
%58 = OpLoad %S_std140 %57 %54 = OpLabel
%54 = OpFunctionCall %S %conv_S %58 OpStore %var_for_index %value_0
OpStore %53 %54 %60 = OpLoad %uint %i
OpBranch %40 %61 = OpCompositeConstruct %_arr_uint_uint_1 %60
%40 = OpLabel %62 = OpLoad %uint %i
%59 = OpLoad %uint %i %64 = OpAccessChain %_ptr_Function_S %var_for_index %62
%61 = OpIAdd %uint %59 %uint_1 %65 = OpLoad %S %64
OpStore %i %61 %59 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %61 %65
OpBranch %38 OpBranch %48
%39 = OpLabel %48 = OpLabel
%62 = OpLoad %_arr_S_uint_4 %arr %66 = OpLoad %uint %i
OpReturnValue %62 %67 = OpIAdd %uint %66 %uint_1
OpFunctionEnd OpStore %i %67
%load_u_inner_2_m = OpFunction %mat3v2half None %63 OpBranch %46
%65 = OpLabel %47 = OpLabel
%70 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2 OpReturn
%73 = OpAccessChain %_ptr_Uniform_v2half %70 %uint_1 OpFunctionEnd
%74 = OpLoad %v2half %73 %conv_S = OpFunction %S None %68
%76 = OpAccessChain %_ptr_Uniform_v2half %70 %uint_2 %val = OpFunctionParameter %S_std140
%77 = OpLoad %v2half %76 %71 = OpLabel
%80 = OpAccessChain %_ptr_Uniform_v2half %70 %uint_3 %72 = OpCompositeExtract %int %val 0
%81 = OpLoad %v2half %80 %73 = OpCompositeExtract %v2half %val 1
%82 = OpCompositeConstruct %mat3v2half %74 %77 %81 %74 = OpCompositeExtract %v2half %val 2
OpReturnValue %82 %75 = OpCompositeExtract %v2half %val 3
OpFunctionEnd %76 = OpCompositeConstruct %mat3v2half %73 %74 %75
%f = OpFunction %void None %83 %77 = OpCompositeExtract %int %val 4
%86 = OpLabel %78 = OpCompositeConstruct %S %72 %76 %77
%88 = OpAccessChain %_ptr_StorageBuffer__arr_S_uint_4 %s %uint_0 OpReturnValue %78
%91 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %u %uint_0 OpFunctionEnd
%92 = OpLoad %_arr_S_std140_uint_4 %91 %conv_arr4_S = OpFunction %_arr_S_uint_4 None %79
%89 = OpFunctionCall %_arr_S_uint_4 %conv_arr4_S %92 %val_0 = OpFunctionParameter %_arr_S_std140_uint_4
OpStore %88 %89 %82 = OpLabel
%95 = OpAccessChain %_ptr_StorageBuffer_S %s %uint_0 %int_1 %arr = OpVariable %_ptr_Function__arr_S_uint_4 Function %58
%97 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2 %i_0 = OpVariable %_ptr_Function_uint Function %43
%98 = OpLoad %S_std140 %97 %var_for_index_1 = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function %96
%96 = OpFunctionCall %S %conv_S %98 OpBranch %85
OpStore %95 %96 %85 = OpLabel
%101 = OpAccessChain %_ptr_StorageBuffer_mat3v2half %s %uint_0 %int_3 %uint_1 OpLoopMerge %86 %87 None
%102 = OpFunctionCall %mat3v2half %load_u_inner_2_m OpBranch %88
OpStore %101 %102 %88 = OpLabel
%105 = OpAccessChain %_ptr_StorageBuffer_v2half %s %uint_0 %int_1 %uint_1 %103 %90 = OpLoad %uint %i_0
%106 = OpAccessChain %_ptr_Uniform_v2half %u %uint_0 %37 %uint_2 %91 = OpULessThan %bool %90 %uint_4
%107 = OpLoad %v2half %106 %89 = OpLogicalNot %bool %91
%108 = OpVectorShuffle %v2half %107 %107 1 0 OpSelectionMerge %92 None
OpStore %105 %108 OpBranchConditional %89 %93 %92
%93 = OpLabel
OpBranch %86
%92 = OpLabel
OpStore %var_for_index_1 %val_0
%97 = OpLoad %uint %i_0
%98 = OpAccessChain %_ptr_Function_S %arr %97
%100 = OpLoad %uint %i_0
%102 = OpAccessChain %_ptr_Function_S_std140 %var_for_index_1 %100
%103 = OpLoad %S_std140 %102
%99 = OpFunctionCall %S %conv_S %103
OpStore %98 %99
OpBranch %87
%87 = OpLabel
%104 = OpLoad %uint %i_0
%105 = OpIAdd %uint %104 %uint_1
OpStore %i_0 %105
OpBranch %85
%86 = OpLabel
%106 = OpLoad %_arr_S_uint_4 %arr
OpReturnValue %106
OpFunctionEnd
%load_u_inner_2_m = OpFunction %mat3v2half None %107
%109 = OpLabel
%112 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%115 = OpAccessChain %_ptr_Uniform_v2half %112 %uint_1
%116 = OpLoad %v2half %115
%118 = OpAccessChain %_ptr_Uniform_v2half %112 %uint_2
%119 = OpLoad %v2half %118
%122 = OpAccessChain %_ptr_Uniform_v2half %112 %uint_3
%123 = OpLoad %v2half %122
%124 = OpCompositeConstruct %mat3v2half %116 %119 %123
OpReturnValue %124
OpFunctionEnd
%f = OpFunction %void None %125
%127 = OpLabel
%131 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %u %uint_0
%132 = OpLoad %_arr_S_std140_uint_4 %131
%129 = OpFunctionCall %_arr_S_uint_4 %conv_arr4_S %132
%128 = OpFunctionCall %void %assign_and_preserve_padding_s %129
%136 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%137 = OpLoad %S_std140 %136
%135 = OpFunctionCall %S %conv_S %137
%133 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %134 %135
%139 = OpAccessChain %_ptr_StorageBuffer_mat3v2half %s %uint_0 %int_3 %uint_1
%140 = OpFunctionCall %mat3v2half %load_u_inner_2_m
OpStore %139 %140
%143 = OpAccessChain %_ptr_StorageBuffer_v2half %s %uint_0 %int_1 %uint_1 %26
%144 = OpAccessChain %_ptr_Uniform_v2half %u %uint_0 %43 %uint_2
%145 = OpLoad %v2half %144
%146 = OpVectorShuffle %v2half %145 %145 1 0
OpStore %143 %146
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -70,6 +70,21 @@ layout(binding = 1, std430) buffer u_block_ssbo {
S inner[4]; S inner[4];
} s; } s;
void assign_and_preserve_padding_1_s_X(uint dest[1], S value) {
s.inner[dest[0]].before = value.before;
s.inner[dest[0]].m = value.m;
s.inner[dest[0]].after = value.after;
}
void assign_and_preserve_padding_s(S value[4]) {
{
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
uint tint_symbol[1] = uint[1](i);
assign_and_preserve_padding_1_s_X(tint_symbol, value[i]);
}
}
}
S conv_S(S_std140 val) { S conv_S(S_std140 val) {
return S(val.before, val.pad, mat3x2(val.m_0, val.m_1, val.m_2), val.pad_1, val.pad_2, val.pad_3, val.pad_4, val.pad_5, val.pad_6, val.pad_7, val.pad_8, val.after, val.pad_9, val.pad_10, val.pad_11, val.pad_12, val.pad_13, val.pad_14, val.pad_15, val.pad_16, val.pad_17, val.pad_18, val.pad_19, val.pad_20, val.pad_21, val.pad_22, val.pad_23); return S(val.before, val.pad, mat3x2(val.m_0, val.m_1, val.m_2), val.pad_1, val.pad_2, val.pad_3, val.pad_4, val.pad_5, val.pad_6, val.pad_7, val.pad_8, val.after, val.pad_9, val.pad_10, val.pad_11, val.pad_12, val.pad_13, val.pad_14, val.pad_15, val.pad_16, val.pad_17, val.pad_18, val.pad_19, val.pad_20, val.pad_21, val.pad_22, val.pad_23);
} }
@ -89,8 +104,9 @@ mat3x2 load_u_inner_2_m() {
} }
void f() { void f() {
s.inner = conv_arr4_S(u.inner); assign_and_preserve_padding_s(conv_arr4_S(u.inner));
s.inner[1] = conv_S(u.inner[2u]); uint tint_symbol_1[1] = uint[1](1u);
assign_and_preserve_padding_1_s_X(tint_symbol_1, conv_S(u.inner[2u]));
s.inner[3].m = load_u_inner_2_m(); s.inner[3].m = load_u_inner_2_m();
s.inner[1].m[0] = u.inner[0u].m_1.yx; s.inner[1].m[0] = u.inner[0u].m_1.yx;
} }

View File

@ -23,9 +23,21 @@ struct S {
/* 0x0044 */ tint_array<int8_t, 60> tint_pad_2; /* 0x0044 */ tint_array<int8_t, 60> tint_pad_2;
}; };
void assign_and_preserve_padding_1(device S* const dest, S value) {
(*(dest)).before = value.before;
(*(dest)).m = value.m;
(*(dest)).after = value.after;
}
void assign_and_preserve_padding(device tint_array<S, 4>* const dest, tint_array<S, 4> value) {
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
assign_and_preserve_padding_1(&((*(dest))[i]), value[i]);
}
}
kernel void f(device tint_array<S, 4>* tint_symbol [[buffer(1)]], const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) { kernel void f(device tint_array<S, 4>* tint_symbol [[buffer(1)]], const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) {
*(tint_symbol) = *(tint_symbol_1); assign_and_preserve_padding(tint_symbol, *(tint_symbol_1));
(*(tint_symbol))[1] = (*(tint_symbol_1))[2]; assign_and_preserve_padding_1(&((*(tint_symbol))[1]), (*(tint_symbol_1))[2]);
(*(tint_symbol))[3].m = (*(tint_symbol_1))[2].m; (*(tint_symbol))[3].m = (*(tint_symbol_1))[2].m;
(*(tint_symbol))[1].m[0] = float2((*(tint_symbol_1))[0].m[1]).yx; (*(tint_symbol))[1].m[0] = float2((*(tint_symbol_1))[0].m[1]).yx;
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: 109 ; Bound: 147
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
@ -23,13 +23,20 @@
OpMemberName %S 1 "m" OpMemberName %S 1 "m"
OpMemberName %S 2 "after" OpMemberName %S 2 "after"
OpName %s "s" OpName %s "s"
OpName %assign_and_preserve_padding_1_s_X "assign_and_preserve_padding_1_s_X"
OpName %dest "dest"
OpName %value "value"
OpName %assign_and_preserve_padding_s "assign_and_preserve_padding_s"
OpName %value_0 "value"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %conv_S "conv_S" OpName %conv_S "conv_S"
OpName %val "val" OpName %val "val"
OpName %conv_arr4_S "conv_arr4_S" OpName %conv_arr4_S "conv_arr4_S"
OpName %val_0 "val" OpName %val_0 "val"
OpName %arr "arr" OpName %arr "arr"
OpName %i "i" OpName %i_0 "i"
OpName %var_for_index "var_for_index" OpName %var_for_index_1 "var_for_index_1"
OpName %load_u_inner_2_m "load_u_inner_2_m" OpName %load_u_inner_2_m "load_u_inner_2_m"
OpName %f "f" OpName %f "f"
OpDecorate %u_block_std140 Block OpDecorate %u_block_std140 Block
@ -53,6 +60,7 @@
OpDecorate %_arr_S_uint_4 ArrayStride 128 OpDecorate %_arr_S_uint_4 ArrayStride 128
OpDecorate %s DescriptorSet 0 OpDecorate %s DescriptorSet 0
OpDecorate %s Binding 1 OpDecorate %s Binding 1
OpDecorate %_arr_uint_uint_1 ArrayStride 4
%int = OpTypeInt 32 1 %int = OpTypeInt 32 1
%float = OpTypeFloat 32 %float = OpTypeFloat 32
%v2float = OpTypeVector %float 2 %v2float = OpTypeVector %float 2
@ -69,114 +77,168 @@
%u_block = OpTypeStruct %_arr_S_uint_4 %u_block = OpTypeStruct %_arr_S_uint_4
%_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block %_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block
%s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer %s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer
%17 = OpTypeFunction %S %S_std140 %void = OpTypeVoid
%28 = OpTypeFunction %_arr_S_uint_4 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%34 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_uint = OpTypePointer Function %uint
%37 = OpConstantNull %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
%50 = OpConstantNull %_arr_S_std140_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
%uint_1 = OpConstant %uint 1 %uint_1 = OpConstant %uint 1
%63 = OpTypeFunction %mat3v2float %_arr_uint_uint_1 = OpTypeArray %uint %uint_1
%17 = OpTypeFunction %void %_arr_uint_uint_1 %S
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%26 = OpConstantNull %int
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%_ptr_StorageBuffer_mat3v2float = OpTypePointer StorageBuffer %mat3v2float
%uint_2 = OpConstant %uint 2 %uint_2 = OpConstant %uint 2
%39 = OpTypeFunction %void %_arr_S_uint_4
%43 = OpConstantNull %uint
%_ptr_Function_uint = OpTypePointer Function %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%58 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%68 = OpTypeFunction %S %S_std140
%79 = OpTypeFunction %_arr_S_uint_4 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
%96 = OpConstantNull %_arr_S_std140_uint_4
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
%107 = OpTypeFunction %mat3v2float
%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140 %_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140
%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float %_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
%uint_3 = OpConstant %uint 3 %uint_3 = OpConstant %uint 3
%void = OpTypeVoid %125 = OpTypeFunction %void
%83 = OpTypeFunction %void
%_ptr_StorageBuffer__arr_S_uint_4 = OpTypePointer StorageBuffer %_arr_S_uint_4
%_ptr_Uniform__arr_S_std140_uint_4 = OpTypePointer Uniform %_arr_S_std140_uint_4 %_ptr_Uniform__arr_S_std140_uint_4 = OpTypePointer Uniform %_arr_S_std140_uint_4
%int_1 = OpConstant %int 1 %134 = OpConstantComposite %_arr_uint_uint_1 %uint_1
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
%int_3 = OpConstant %int 3 %int_3 = OpConstant %int 3
%_ptr_StorageBuffer_mat3v2float = OpTypePointer StorageBuffer %mat3v2float %int_1 = OpConstant %int 1
%103 = OpConstantNull %int
%_ptr_StorageBuffer_v2float = OpTypePointer StorageBuffer %v2float %_ptr_StorageBuffer_v2float = OpTypePointer StorageBuffer %v2float
%conv_S = OpFunction %S None %17 %assign_and_preserve_padding_1_s_X = OpFunction %void None %17
%val = OpFunctionParameter %S_std140 %dest = OpFunctionParameter %_arr_uint_uint_1
%20 = OpLabel %value = OpFunctionParameter %S
%21 = OpCompositeExtract %int %val 0 %24 = OpLabel
%22 = OpCompositeExtract %v2float %val 1 %27 = OpCompositeExtract %uint %dest 0
%23 = OpCompositeExtract %v2float %val 2 %29 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %27 %uint_0
%24 = OpCompositeExtract %v2float %val 3 %30 = OpCompositeExtract %int %value 0
%25 = OpCompositeConstruct %mat3v2float %22 %23 %24 OpStore %29 %30
%26 = OpCompositeExtract %int %val 4 %31 = OpCompositeExtract %uint %dest 0
%27 = OpCompositeConstruct %S %21 %25 %26 %33 = OpAccessChain %_ptr_StorageBuffer_mat3v2float %s %uint_0 %31 %uint_1
OpReturnValue %27 %34 = OpCompositeExtract %mat3v2float %value 1
OpFunctionEnd OpStore %33 %34
%conv_arr4_S = OpFunction %_arr_S_uint_4 None %28 %35 = OpCompositeExtract %uint %dest 0
%val_0 = OpFunctionParameter %_arr_S_std140_uint_4 %37 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %35 %uint_2
%31 = OpLabel %38 = OpCompositeExtract %int %value 2
%arr = OpVariable %_ptr_Function__arr_S_uint_4 Function %34 OpStore %37 %38
%i = OpVariable %_ptr_Function_uint Function %37 OpReturn
%var_for_index = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function %50 OpFunctionEnd
OpBranch %38 %assign_and_preserve_padding_s = OpFunction %void None %39
%38 = OpLabel %value_0 = OpFunctionParameter %_arr_S_uint_4
OpLoopMerge %39 %40 None %42 = OpLabel
OpBranch %41 %i = OpVariable %_ptr_Function_uint Function %43
%41 = OpLabel %var_for_index = OpVariable %_ptr_Function__arr_S_uint_4 Function %58
%43 = OpLoad %uint %i OpStore %i %43
%44 = OpULessThan %bool %43 %uint_4 OpBranch %46
%42 = OpLogicalNot %bool %44 %46 = OpLabel
OpSelectionMerge %46 None OpLoopMerge %47 %48 None
OpBranchConditional %42 %47 %46 OpBranch %49
%47 = OpLabel %49 = OpLabel
OpBranch %39 %51 = OpLoad %uint %i
%46 = OpLabel %52 = OpULessThan %bool %51 %uint_4
OpStore %var_for_index %val_0 %50 = OpLogicalNot %bool %52
%51 = OpLoad %uint %i OpSelectionMerge %54 None
%53 = OpAccessChain %_ptr_Function_S %arr %51 OpBranchConditional %50 %55 %54
%55 = OpLoad %uint %i %55 = OpLabel
%57 = OpAccessChain %_ptr_Function_S_std140 %var_for_index %55 OpBranch %47
%58 = OpLoad %S_std140 %57 %54 = OpLabel
%54 = OpFunctionCall %S %conv_S %58 OpStore %var_for_index %value_0
OpStore %53 %54 %60 = OpLoad %uint %i
OpBranch %40 %61 = OpCompositeConstruct %_arr_uint_uint_1 %60
%40 = OpLabel %62 = OpLoad %uint %i
%59 = OpLoad %uint %i %64 = OpAccessChain %_ptr_Function_S %var_for_index %62
%61 = OpIAdd %uint %59 %uint_1 %65 = OpLoad %S %64
OpStore %i %61 %59 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %61 %65
OpBranch %38 OpBranch %48
%39 = OpLabel %48 = OpLabel
%62 = OpLoad %_arr_S_uint_4 %arr %66 = OpLoad %uint %i
OpReturnValue %62 %67 = OpIAdd %uint %66 %uint_1
OpFunctionEnd OpStore %i %67
%load_u_inner_2_m = OpFunction %mat3v2float None %63 OpBranch %46
%65 = OpLabel %47 = OpLabel
%70 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2 OpReturn
%73 = OpAccessChain %_ptr_Uniform_v2float %70 %uint_1 OpFunctionEnd
%74 = OpLoad %v2float %73 %conv_S = OpFunction %S None %68
%76 = OpAccessChain %_ptr_Uniform_v2float %70 %uint_2 %val = OpFunctionParameter %S_std140
%77 = OpLoad %v2float %76 %71 = OpLabel
%80 = OpAccessChain %_ptr_Uniform_v2float %70 %uint_3 %72 = OpCompositeExtract %int %val 0
%81 = OpLoad %v2float %80 %73 = OpCompositeExtract %v2float %val 1
%82 = OpCompositeConstruct %mat3v2float %74 %77 %81 %74 = OpCompositeExtract %v2float %val 2
OpReturnValue %82 %75 = OpCompositeExtract %v2float %val 3
OpFunctionEnd %76 = OpCompositeConstruct %mat3v2float %73 %74 %75
%f = OpFunction %void None %83 %77 = OpCompositeExtract %int %val 4
%86 = OpLabel %78 = OpCompositeConstruct %S %72 %76 %77
%88 = OpAccessChain %_ptr_StorageBuffer__arr_S_uint_4 %s %uint_0 OpReturnValue %78
%91 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %u %uint_0 OpFunctionEnd
%92 = OpLoad %_arr_S_std140_uint_4 %91 %conv_arr4_S = OpFunction %_arr_S_uint_4 None %79
%89 = OpFunctionCall %_arr_S_uint_4 %conv_arr4_S %92 %val_0 = OpFunctionParameter %_arr_S_std140_uint_4
OpStore %88 %89 %82 = OpLabel
%95 = OpAccessChain %_ptr_StorageBuffer_S %s %uint_0 %int_1 %arr = OpVariable %_ptr_Function__arr_S_uint_4 Function %58
%97 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2 %i_0 = OpVariable %_ptr_Function_uint Function %43
%98 = OpLoad %S_std140 %97 %var_for_index_1 = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function %96
%96 = OpFunctionCall %S %conv_S %98 OpBranch %85
OpStore %95 %96 %85 = OpLabel
%101 = OpAccessChain %_ptr_StorageBuffer_mat3v2float %s %uint_0 %int_3 %uint_1 OpLoopMerge %86 %87 None
%102 = OpFunctionCall %mat3v2float %load_u_inner_2_m OpBranch %88
OpStore %101 %102 %88 = OpLabel
%105 = OpAccessChain %_ptr_StorageBuffer_v2float %s %uint_0 %int_1 %uint_1 %103 %90 = OpLoad %uint %i_0
%106 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0 %37 %uint_2 %91 = OpULessThan %bool %90 %uint_4
%107 = OpLoad %v2float %106 %89 = OpLogicalNot %bool %91
%108 = OpVectorShuffle %v2float %107 %107 1 0 OpSelectionMerge %92 None
OpStore %105 %108 OpBranchConditional %89 %93 %92
%93 = OpLabel
OpBranch %86
%92 = OpLabel
OpStore %var_for_index_1 %val_0
%97 = OpLoad %uint %i_0
%98 = OpAccessChain %_ptr_Function_S %arr %97
%100 = OpLoad %uint %i_0
%102 = OpAccessChain %_ptr_Function_S_std140 %var_for_index_1 %100
%103 = OpLoad %S_std140 %102
%99 = OpFunctionCall %S %conv_S %103
OpStore %98 %99
OpBranch %87
%87 = OpLabel
%104 = OpLoad %uint %i_0
%105 = OpIAdd %uint %104 %uint_1
OpStore %i_0 %105
OpBranch %85
%86 = OpLabel
%106 = OpLoad %_arr_S_uint_4 %arr
OpReturnValue %106
OpFunctionEnd
%load_u_inner_2_m = OpFunction %mat3v2float None %107
%109 = OpLabel
%112 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%115 = OpAccessChain %_ptr_Uniform_v2float %112 %uint_1
%116 = OpLoad %v2float %115
%118 = OpAccessChain %_ptr_Uniform_v2float %112 %uint_2
%119 = OpLoad %v2float %118
%122 = OpAccessChain %_ptr_Uniform_v2float %112 %uint_3
%123 = OpLoad %v2float %122
%124 = OpCompositeConstruct %mat3v2float %116 %119 %123
OpReturnValue %124
OpFunctionEnd
%f = OpFunction %void None %125
%127 = OpLabel
%131 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %u %uint_0
%132 = OpLoad %_arr_S_std140_uint_4 %131
%129 = OpFunctionCall %_arr_S_uint_4 %conv_arr4_S %132
%128 = OpFunctionCall %void %assign_and_preserve_padding_s %129
%136 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%137 = OpLoad %S_std140 %136
%135 = OpFunctionCall %S %conv_S %137
%133 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %134 %135
%139 = OpAccessChain %_ptr_StorageBuffer_mat3v2float %s %uint_0 %int_3 %uint_1
%140 = OpFunctionCall %mat3v2float %load_u_inner_2_m
OpStore %139 %140
%143 = OpAccessChain %_ptr_StorageBuffer_v2float %s %uint_0 %int_1 %uint_1 %26
%144 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0 %43 %uint_2
%145 = OpLoad %v2float %144
%146 = OpVectorShuffle %v2float %145 %145 1 0
OpStore %143 %146
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -71,6 +71,21 @@ layout(binding = 1, std430) buffer u_block_ssbo {
S inner[4]; S inner[4];
} s; } s;
void assign_and_preserve_padding_1_s_X(uint dest[1], S value) {
s.inner[dest[0]].before = value.before;
s.inner[dest[0]].m = value.m;
s.inner[dest[0]].after = value.after;
}
void assign_and_preserve_padding_s(S value[4]) {
{
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
uint tint_symbol[1] = uint[1](i);
assign_and_preserve_padding_1_s_X(tint_symbol, value[i]);
}
}
}
S conv_S(S_std140 val) { S conv_S(S_std140 val) {
return S(val.before, val.pad, f16mat3(val.m_0, val.m_1, val.m_2), val.pad_1, val.pad_2, val.pad_3, val.pad_4, val.pad_5, val.pad_6, val.pad_7, val.pad_8, val.after, val.pad_9, val.pad_10, val.pad_11, val.pad_12, val.pad_13, val.pad_14, val.pad_15, val.pad_16, val.pad_17, val.pad_18, val.pad_19, val.pad_20, val.pad_21, val.pad_22, val.pad_23); return S(val.before, val.pad, f16mat3(val.m_0, val.m_1, val.m_2), val.pad_1, val.pad_2, val.pad_3, val.pad_4, val.pad_5, val.pad_6, val.pad_7, val.pad_8, val.after, val.pad_9, val.pad_10, val.pad_11, val.pad_12, val.pad_13, val.pad_14, val.pad_15, val.pad_16, val.pad_17, val.pad_18, val.pad_19, val.pad_20, val.pad_21, val.pad_22, val.pad_23);
} }
@ -90,8 +105,9 @@ f16mat3 load_u_inner_2_m() {
} }
void f() { void f() {
s.inner = conv_arr4_S(u.inner); assign_and_preserve_padding_s(conv_arr4_S(u.inner));
s.inner[1] = conv_S(u.inner[2u]); uint tint_symbol_1[1] = uint[1](1u);
assign_and_preserve_padding_1_s_X(tint_symbol_1, conv_S(u.inner[2u]));
s.inner[3].m = load_u_inner_2_m(); s.inner[3].m = load_u_inner_2_m();
s.inner[1].m[0] = u.inner[0u].m_1.zxy; s.inner[1].m[0] = u.inner[0u].m_1.zxy;
} }

View File

@ -23,9 +23,21 @@ struct S {
/* 0x0044 */ tint_array<int8_t, 60> tint_pad_2; /* 0x0044 */ tint_array<int8_t, 60> tint_pad_2;
}; };
void assign_and_preserve_padding_1(device S* const dest, S value) {
(*(dest)).before = value.before;
(*(dest)).m = value.m;
(*(dest)).after = value.after;
}
void assign_and_preserve_padding(device tint_array<S, 4>* const dest, tint_array<S, 4> value) {
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
assign_and_preserve_padding_1(&((*(dest))[i]), value[i]);
}
}
kernel void f(device tint_array<S, 4>* tint_symbol [[buffer(1)]], const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) { kernel void f(device tint_array<S, 4>* tint_symbol [[buffer(1)]], const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) {
*(tint_symbol) = *(tint_symbol_1); assign_and_preserve_padding(tint_symbol, *(tint_symbol_1));
(*(tint_symbol))[1] = (*(tint_symbol_1))[2]; assign_and_preserve_padding_1(&((*(tint_symbol))[1]), (*(tint_symbol_1))[2]);
(*(tint_symbol))[3].m = (*(tint_symbol_1))[2].m; (*(tint_symbol))[3].m = (*(tint_symbol_1))[2].m;
(*(tint_symbol))[1].m[0] = half3((*(tint_symbol_1))[0].m[1]).zxy; (*(tint_symbol))[1].m[0] = half3((*(tint_symbol_1))[0].m[1]).zxy;
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: 109 ; Bound: 147
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpCapability Float16 OpCapability Float16
@ -27,13 +27,20 @@
OpMemberName %S 1 "m" OpMemberName %S 1 "m"
OpMemberName %S 2 "after" OpMemberName %S 2 "after"
OpName %s "s" OpName %s "s"
OpName %assign_and_preserve_padding_1_s_X "assign_and_preserve_padding_1_s_X"
OpName %dest "dest"
OpName %value "value"
OpName %assign_and_preserve_padding_s "assign_and_preserve_padding_s"
OpName %value_0 "value"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %conv_S "conv_S" OpName %conv_S "conv_S"
OpName %val "val" OpName %val "val"
OpName %conv_arr4_S "conv_arr4_S" OpName %conv_arr4_S "conv_arr4_S"
OpName %val_0 "val" OpName %val_0 "val"
OpName %arr "arr" OpName %arr "arr"
OpName %i "i" OpName %i_0 "i"
OpName %var_for_index "var_for_index" OpName %var_for_index_1 "var_for_index_1"
OpName %load_u_inner_2_m "load_u_inner_2_m" OpName %load_u_inner_2_m "load_u_inner_2_m"
OpName %f "f" OpName %f "f"
OpDecorate %u_block_std140 Block OpDecorate %u_block_std140 Block
@ -57,6 +64,7 @@
OpDecorate %_arr_S_uint_4 ArrayStride 128 OpDecorate %_arr_S_uint_4 ArrayStride 128
OpDecorate %s DescriptorSet 0 OpDecorate %s DescriptorSet 0
OpDecorate %s Binding 1 OpDecorate %s Binding 1
OpDecorate %_arr_uint_uint_1 ArrayStride 4
%int = OpTypeInt 32 1 %int = OpTypeInt 32 1
%half = OpTypeFloat 16 %half = OpTypeFloat 16
%v3half = OpTypeVector %half 3 %v3half = OpTypeVector %half 3
@ -73,114 +81,168 @@
%u_block = OpTypeStruct %_arr_S_uint_4 %u_block = OpTypeStruct %_arr_S_uint_4
%_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block %_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block
%s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer %s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer
%17 = OpTypeFunction %S %S_std140 %void = OpTypeVoid
%28 = OpTypeFunction %_arr_S_uint_4 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%34 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_uint = OpTypePointer Function %uint
%37 = OpConstantNull %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
%50 = OpConstantNull %_arr_S_std140_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
%uint_1 = OpConstant %uint 1 %uint_1 = OpConstant %uint 1
%63 = OpTypeFunction %mat3v3half %_arr_uint_uint_1 = OpTypeArray %uint %uint_1
%17 = OpTypeFunction %void %_arr_uint_uint_1 %S
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%26 = OpConstantNull %int
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%_ptr_StorageBuffer_mat3v3half = OpTypePointer StorageBuffer %mat3v3half
%uint_2 = OpConstant %uint 2 %uint_2 = OpConstant %uint 2
%39 = OpTypeFunction %void %_arr_S_uint_4
%43 = OpConstantNull %uint
%_ptr_Function_uint = OpTypePointer Function %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%58 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%68 = OpTypeFunction %S %S_std140
%79 = OpTypeFunction %_arr_S_uint_4 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
%96 = OpConstantNull %_arr_S_std140_uint_4
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
%107 = OpTypeFunction %mat3v3half
%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140 %_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140
%_ptr_Uniform_v3half = OpTypePointer Uniform %v3half %_ptr_Uniform_v3half = OpTypePointer Uniform %v3half
%uint_3 = OpConstant %uint 3 %uint_3 = OpConstant %uint 3
%void = OpTypeVoid %125 = OpTypeFunction %void
%83 = OpTypeFunction %void
%_ptr_StorageBuffer__arr_S_uint_4 = OpTypePointer StorageBuffer %_arr_S_uint_4
%_ptr_Uniform__arr_S_std140_uint_4 = OpTypePointer Uniform %_arr_S_std140_uint_4 %_ptr_Uniform__arr_S_std140_uint_4 = OpTypePointer Uniform %_arr_S_std140_uint_4
%int_1 = OpConstant %int 1 %134 = OpConstantComposite %_arr_uint_uint_1 %uint_1
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
%int_3 = OpConstant %int 3 %int_3 = OpConstant %int 3
%_ptr_StorageBuffer_mat3v3half = OpTypePointer StorageBuffer %mat3v3half %int_1 = OpConstant %int 1
%103 = OpConstantNull %int
%_ptr_StorageBuffer_v3half = OpTypePointer StorageBuffer %v3half %_ptr_StorageBuffer_v3half = OpTypePointer StorageBuffer %v3half
%conv_S = OpFunction %S None %17 %assign_and_preserve_padding_1_s_X = OpFunction %void None %17
%val = OpFunctionParameter %S_std140 %dest = OpFunctionParameter %_arr_uint_uint_1
%20 = OpLabel %value = OpFunctionParameter %S
%21 = OpCompositeExtract %int %val 0 %24 = OpLabel
%22 = OpCompositeExtract %v3half %val 1 %27 = OpCompositeExtract %uint %dest 0
%23 = OpCompositeExtract %v3half %val 2 %29 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %27 %uint_0
%24 = OpCompositeExtract %v3half %val 3 %30 = OpCompositeExtract %int %value 0
%25 = OpCompositeConstruct %mat3v3half %22 %23 %24 OpStore %29 %30
%26 = OpCompositeExtract %int %val 4 %31 = OpCompositeExtract %uint %dest 0
%27 = OpCompositeConstruct %S %21 %25 %26 %33 = OpAccessChain %_ptr_StorageBuffer_mat3v3half %s %uint_0 %31 %uint_1
OpReturnValue %27 %34 = OpCompositeExtract %mat3v3half %value 1
OpFunctionEnd OpStore %33 %34
%conv_arr4_S = OpFunction %_arr_S_uint_4 None %28 %35 = OpCompositeExtract %uint %dest 0
%val_0 = OpFunctionParameter %_arr_S_std140_uint_4 %37 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %35 %uint_2
%31 = OpLabel %38 = OpCompositeExtract %int %value 2
%arr = OpVariable %_ptr_Function__arr_S_uint_4 Function %34 OpStore %37 %38
%i = OpVariable %_ptr_Function_uint Function %37 OpReturn
%var_for_index = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function %50 OpFunctionEnd
OpBranch %38 %assign_and_preserve_padding_s = OpFunction %void None %39
%38 = OpLabel %value_0 = OpFunctionParameter %_arr_S_uint_4
OpLoopMerge %39 %40 None %42 = OpLabel
OpBranch %41 %i = OpVariable %_ptr_Function_uint Function %43
%41 = OpLabel %var_for_index = OpVariable %_ptr_Function__arr_S_uint_4 Function %58
%43 = OpLoad %uint %i OpStore %i %43
%44 = OpULessThan %bool %43 %uint_4 OpBranch %46
%42 = OpLogicalNot %bool %44 %46 = OpLabel
OpSelectionMerge %46 None OpLoopMerge %47 %48 None
OpBranchConditional %42 %47 %46 OpBranch %49
%47 = OpLabel %49 = OpLabel
OpBranch %39 %51 = OpLoad %uint %i
%46 = OpLabel %52 = OpULessThan %bool %51 %uint_4
OpStore %var_for_index %val_0 %50 = OpLogicalNot %bool %52
%51 = OpLoad %uint %i OpSelectionMerge %54 None
%53 = OpAccessChain %_ptr_Function_S %arr %51 OpBranchConditional %50 %55 %54
%55 = OpLoad %uint %i %55 = OpLabel
%57 = OpAccessChain %_ptr_Function_S_std140 %var_for_index %55 OpBranch %47
%58 = OpLoad %S_std140 %57 %54 = OpLabel
%54 = OpFunctionCall %S %conv_S %58 OpStore %var_for_index %value_0
OpStore %53 %54 %60 = OpLoad %uint %i
OpBranch %40 %61 = OpCompositeConstruct %_arr_uint_uint_1 %60
%40 = OpLabel %62 = OpLoad %uint %i
%59 = OpLoad %uint %i %64 = OpAccessChain %_ptr_Function_S %var_for_index %62
%61 = OpIAdd %uint %59 %uint_1 %65 = OpLoad %S %64
OpStore %i %61 %59 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %61 %65
OpBranch %38 OpBranch %48
%39 = OpLabel %48 = OpLabel
%62 = OpLoad %_arr_S_uint_4 %arr %66 = OpLoad %uint %i
OpReturnValue %62 %67 = OpIAdd %uint %66 %uint_1
OpFunctionEnd OpStore %i %67
%load_u_inner_2_m = OpFunction %mat3v3half None %63 OpBranch %46
%65 = OpLabel %47 = OpLabel
%70 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2 OpReturn
%73 = OpAccessChain %_ptr_Uniform_v3half %70 %uint_1 OpFunctionEnd
%74 = OpLoad %v3half %73 %conv_S = OpFunction %S None %68
%76 = OpAccessChain %_ptr_Uniform_v3half %70 %uint_2 %val = OpFunctionParameter %S_std140
%77 = OpLoad %v3half %76 %71 = OpLabel
%80 = OpAccessChain %_ptr_Uniform_v3half %70 %uint_3 %72 = OpCompositeExtract %int %val 0
%81 = OpLoad %v3half %80 %73 = OpCompositeExtract %v3half %val 1
%82 = OpCompositeConstruct %mat3v3half %74 %77 %81 %74 = OpCompositeExtract %v3half %val 2
OpReturnValue %82 %75 = OpCompositeExtract %v3half %val 3
OpFunctionEnd %76 = OpCompositeConstruct %mat3v3half %73 %74 %75
%f = OpFunction %void None %83 %77 = OpCompositeExtract %int %val 4
%86 = OpLabel %78 = OpCompositeConstruct %S %72 %76 %77
%88 = OpAccessChain %_ptr_StorageBuffer__arr_S_uint_4 %s %uint_0 OpReturnValue %78
%91 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %u %uint_0 OpFunctionEnd
%92 = OpLoad %_arr_S_std140_uint_4 %91 %conv_arr4_S = OpFunction %_arr_S_uint_4 None %79
%89 = OpFunctionCall %_arr_S_uint_4 %conv_arr4_S %92 %val_0 = OpFunctionParameter %_arr_S_std140_uint_4
OpStore %88 %89 %82 = OpLabel
%95 = OpAccessChain %_ptr_StorageBuffer_S %s %uint_0 %int_1 %arr = OpVariable %_ptr_Function__arr_S_uint_4 Function %58
%97 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2 %i_0 = OpVariable %_ptr_Function_uint Function %43
%98 = OpLoad %S_std140 %97 %var_for_index_1 = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function %96
%96 = OpFunctionCall %S %conv_S %98 OpBranch %85
OpStore %95 %96 %85 = OpLabel
%101 = OpAccessChain %_ptr_StorageBuffer_mat3v3half %s %uint_0 %int_3 %uint_1 OpLoopMerge %86 %87 None
%102 = OpFunctionCall %mat3v3half %load_u_inner_2_m OpBranch %88
OpStore %101 %102 %88 = OpLabel
%105 = OpAccessChain %_ptr_StorageBuffer_v3half %s %uint_0 %int_1 %uint_1 %103 %90 = OpLoad %uint %i_0
%106 = OpAccessChain %_ptr_Uniform_v3half %u %uint_0 %37 %uint_2 %91 = OpULessThan %bool %90 %uint_4
%107 = OpLoad %v3half %106 %89 = OpLogicalNot %bool %91
%108 = OpVectorShuffle %v3half %107 %107 2 0 1 OpSelectionMerge %92 None
OpStore %105 %108 OpBranchConditional %89 %93 %92
%93 = OpLabel
OpBranch %86
%92 = OpLabel
OpStore %var_for_index_1 %val_0
%97 = OpLoad %uint %i_0
%98 = OpAccessChain %_ptr_Function_S %arr %97
%100 = OpLoad %uint %i_0
%102 = OpAccessChain %_ptr_Function_S_std140 %var_for_index_1 %100
%103 = OpLoad %S_std140 %102
%99 = OpFunctionCall %S %conv_S %103
OpStore %98 %99
OpBranch %87
%87 = OpLabel
%104 = OpLoad %uint %i_0
%105 = OpIAdd %uint %104 %uint_1
OpStore %i_0 %105
OpBranch %85
%86 = OpLabel
%106 = OpLoad %_arr_S_uint_4 %arr
OpReturnValue %106
OpFunctionEnd
%load_u_inner_2_m = OpFunction %mat3v3half None %107
%109 = OpLabel
%112 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%115 = OpAccessChain %_ptr_Uniform_v3half %112 %uint_1
%116 = OpLoad %v3half %115
%118 = OpAccessChain %_ptr_Uniform_v3half %112 %uint_2
%119 = OpLoad %v3half %118
%122 = OpAccessChain %_ptr_Uniform_v3half %112 %uint_3
%123 = OpLoad %v3half %122
%124 = OpCompositeConstruct %mat3v3half %116 %119 %123
OpReturnValue %124
OpFunctionEnd
%f = OpFunction %void None %125
%127 = OpLabel
%131 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %u %uint_0
%132 = OpLoad %_arr_S_std140_uint_4 %131
%129 = OpFunctionCall %_arr_S_uint_4 %conv_arr4_S %132
%128 = OpFunctionCall %void %assign_and_preserve_padding_s %129
%136 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%137 = OpLoad %S_std140 %136
%135 = OpFunctionCall %S %conv_S %137
%133 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %134 %135
%139 = OpAccessChain %_ptr_StorageBuffer_mat3v3half %s %uint_0 %int_3 %uint_1
%140 = OpFunctionCall %mat3v3half %load_u_inner_2_m
OpStore %139 %140
%143 = OpAccessChain %_ptr_StorageBuffer_v3half %s %uint_0 %int_1 %uint_1 %26
%144 = OpAccessChain %_ptr_Uniform_v3half %u %uint_0 %43 %uint_2
%145 = OpLoad %v3half %144
%146 = OpVectorShuffle %v3half %145 %145 2 0 1
OpStore %143 %146
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -32,9 +32,25 @@ layout(binding = 1, std430) buffer u_block_ssbo {
S inner[4]; S inner[4];
} s; } s;
void assign_and_preserve_padding_1_s_X(uint dest[1], S value) {
s.inner[dest[0]].before = value.before;
s.inner[dest[0]].m = value.m;
s.inner[dest[0]].after = value.after;
}
void assign_and_preserve_padding_s(S value[4]) {
{
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
uint tint_symbol[1] = uint[1](i);
assign_and_preserve_padding_1_s_X(tint_symbol, value[i]);
}
}
}
void f() { void f() {
s.inner = u.inner; assign_and_preserve_padding_s(u.inner);
s.inner[1] = u.inner[2]; uint tint_symbol_1[1] = uint[1](1u);
assign_and_preserve_padding_1_s_X(tint_symbol_1, u.inner[2]);
s.inner[3].m = u.inner[2].m; s.inner[3].m = u.inner[2].m;
s.inner[1].m[0] = u.inner[0].m[1].zxy; s.inner[1].m[0] = u.inner[0].m[1].zxy;
} }

View File

@ -22,9 +22,21 @@ struct S {
/* 0x0044 */ tint_array<int8_t, 60> tint_pad_1; /* 0x0044 */ tint_array<int8_t, 60> tint_pad_1;
}; };
void assign_and_preserve_padding_1(device S* const dest, S value) {
(*(dest)).before = value.before;
(*(dest)).m = value.m;
(*(dest)).after = value.after;
}
void assign_and_preserve_padding(device tint_array<S, 4>* const dest, tint_array<S, 4> value) {
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
assign_and_preserve_padding_1(&((*(dest))[i]), value[i]);
}
}
kernel void f(device tint_array<S, 4>* tint_symbol [[buffer(1)]], const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) { kernel void f(device tint_array<S, 4>* tint_symbol [[buffer(1)]], const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) {
*(tint_symbol) = *(tint_symbol_1); assign_and_preserve_padding(tint_symbol, *(tint_symbol_1));
(*(tint_symbol))[1] = (*(tint_symbol_1))[2]; assign_and_preserve_padding_1(&((*(tint_symbol))[1]), (*(tint_symbol_1))[2]);
(*(tint_symbol))[3].m = (*(tint_symbol_1))[2].m; (*(tint_symbol))[3].m = (*(tint_symbol_1))[2].m;
(*(tint_symbol))[1].m[0] = float3((*(tint_symbol_1))[0].m[1]).zxy; (*(tint_symbol))[1].m[0] = float3((*(tint_symbol_1))[0].m[1]).zxy;
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: 45 ; Bound: 90
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
@ -15,6 +15,13 @@
OpMemberName %S 2 "after" OpMemberName %S 2 "after"
OpName %u "u" OpName %u "u"
OpName %s "s" OpName %s "s"
OpName %assign_and_preserve_padding_1_s_X "assign_and_preserve_padding_1_s_X"
OpName %dest "dest"
OpName %value "value"
OpName %assign_and_preserve_padding_s "assign_and_preserve_padding_s"
OpName %value_0 "value"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %f "f" OpName %f "f"
OpDecorate %u_block Block OpDecorate %u_block Block
OpMemberDecorate %u_block 0 Offset 0 OpMemberDecorate %u_block 0 Offset 0
@ -29,6 +36,7 @@
OpDecorate %u Binding 0 OpDecorate %u Binding 0
OpDecorate %s DescriptorSet 0 OpDecorate %s DescriptorSet 0
OpDecorate %s Binding 1 OpDecorate %s Binding 1
OpDecorate %_arr_uint_uint_1 ArrayStride 4
%int = OpTypeInt 32 1 %int = OpTypeInt 32 1
%float = OpTypeFloat 32 %float = OpTypeFloat 32
%v3float = OpTypeVector %float 3 %v3float = OpTypeVector %float 3
@ -43,39 +51,100 @@
%_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block %_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block
%s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer %s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer
%void = OpTypeVoid %void = OpTypeVoid
%14 = OpTypeFunction %void %uint_1 = OpConstant %uint 1
%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
%14 = OpTypeFunction %void %_arr_uint_uint_1 %S
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer__arr_S_uint_4 = OpTypePointer StorageBuffer %_arr_S_uint_4 %23 = OpConstantNull %int
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%_ptr_StorageBuffer_mat3v3float = OpTypePointer StorageBuffer %mat3v3float
%uint_2 = OpConstant %uint 2
%36 = OpTypeFunction %void %_arr_S_uint_4
%40 = OpConstantNull %uint
%_ptr_Function_uint = OpTypePointer Function %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%55 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%65 = OpTypeFunction %void
%_ptr_Uniform__arr_S_uint_4 = OpTypePointer Uniform %_arr_S_uint_4 %_ptr_Uniform__arr_S_uint_4 = OpTypePointer Uniform %_arr_S_uint_4
%int_1 = OpConstant %int 1 %73 = OpConstantComposite %_arr_uint_uint_1 %uint_1
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
%int_2 = OpConstant %int 2 %int_2 = OpConstant %int 2
%_ptr_Uniform_S = OpTypePointer Uniform %S %_ptr_Uniform_S = OpTypePointer Uniform %S
%int_3 = OpConstant %int 3 %int_3 = OpConstant %int 3
%uint_1 = OpConstant %uint 1
%_ptr_StorageBuffer_mat3v3float = OpTypePointer StorageBuffer %mat3v3float
%_ptr_Uniform_mat3v3float = OpTypePointer Uniform %mat3v3float %_ptr_Uniform_mat3v3float = OpTypePointer Uniform %mat3v3float
%38 = OpConstantNull %int %int_1 = OpConstant %int 1
%_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float %_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float
%_ptr_Uniform_v3float = OpTypePointer Uniform %v3float %_ptr_Uniform_v3float = OpTypePointer Uniform %v3float
%f = OpFunction %void None %14 %assign_and_preserve_padding_1_s_X = OpFunction %void None %14
%17 = OpLabel %dest = OpFunctionParameter %_arr_uint_uint_1
%20 = OpAccessChain %_ptr_StorageBuffer__arr_S_uint_4 %s %uint_0 %value = OpFunctionParameter %S
%22 = OpAccessChain %_ptr_Uniform__arr_S_uint_4 %u %uint_0 %21 = OpLabel
%23 = OpLoad %_arr_S_uint_4 %22 %24 = OpCompositeExtract %uint %dest 0
OpStore %20 %23 %26 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %24 %uint_0
%26 = OpAccessChain %_ptr_StorageBuffer_S %s %uint_0 %int_1 %27 = OpCompositeExtract %int %value 0
%29 = OpAccessChain %_ptr_Uniform_S %u %uint_0 %int_2 OpStore %26 %27
%30 = OpLoad %S %29 %28 = OpCompositeExtract %uint %dest 0
OpStore %26 %30 %30 = OpAccessChain %_ptr_StorageBuffer_mat3v3float %s %uint_0 %28 %uint_1
%34 = OpAccessChain %_ptr_StorageBuffer_mat3v3float %s %uint_0 %int_3 %uint_1 %31 = OpCompositeExtract %mat3v3float %value 1
%36 = OpAccessChain %_ptr_Uniform_mat3v3float %u %uint_0 %int_2 %uint_1 OpStore %30 %31
%37 = OpLoad %mat3v3float %36 %32 = OpCompositeExtract %uint %dest 0
OpStore %34 %37 %34 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %32 %uint_2
%40 = OpAccessChain %_ptr_StorageBuffer_v3float %s %uint_0 %int_1 %uint_1 %38 %35 = OpCompositeExtract %int %value 2
%42 = OpAccessChain %_ptr_Uniform_v3float %u %uint_0 %38 %uint_1 %int_1 OpStore %34 %35
%43 = OpLoad %v3float %42 OpReturn
%44 = OpVectorShuffle %v3float %43 %43 2 0 1 OpFunctionEnd
OpStore %40 %44 %assign_and_preserve_padding_s = OpFunction %void None %36
%value_0 = OpFunctionParameter %_arr_S_uint_4
%39 = OpLabel
%i = OpVariable %_ptr_Function_uint Function %40
%var_for_index = OpVariable %_ptr_Function__arr_S_uint_4 Function %55
OpStore %i %40
OpBranch %43
%43 = OpLabel
OpLoopMerge %44 %45 None
OpBranch %46
%46 = OpLabel
%48 = OpLoad %uint %i
%49 = OpULessThan %bool %48 %uint_4
%47 = OpLogicalNot %bool %49
OpSelectionMerge %51 None
OpBranchConditional %47 %52 %51
%52 = OpLabel
OpBranch %44
%51 = OpLabel
OpStore %var_for_index %value_0
%57 = OpLoad %uint %i
%58 = OpCompositeConstruct %_arr_uint_uint_1 %57
%59 = OpLoad %uint %i
%61 = OpAccessChain %_ptr_Function_S %var_for_index %59
%62 = OpLoad %S %61
%56 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %58 %62
OpBranch %45
%45 = OpLabel
%63 = OpLoad %uint %i
%64 = OpIAdd %uint %63 %uint_1
OpStore %i %64
OpBranch %43
%44 = OpLabel
OpReturn
OpFunctionEnd
%f = OpFunction %void None %65
%67 = OpLabel
%70 = OpAccessChain %_ptr_Uniform__arr_S_uint_4 %u %uint_0
%71 = OpLoad %_arr_S_uint_4 %70
%68 = OpFunctionCall %void %assign_and_preserve_padding_s %71
%76 = OpAccessChain %_ptr_Uniform_S %u %uint_0 %int_2
%77 = OpLoad %S %76
%72 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %73 %77
%79 = OpAccessChain %_ptr_StorageBuffer_mat3v3float %s %uint_0 %int_3 %uint_1
%81 = OpAccessChain %_ptr_Uniform_mat3v3float %u %uint_0 %int_2 %uint_1
%82 = OpLoad %mat3v3float %81
OpStore %79 %82
%85 = OpAccessChain %_ptr_StorageBuffer_v3float %s %uint_0 %int_1 %uint_1 %23
%87 = OpAccessChain %_ptr_Uniform_v3float %u %uint_0 %23 %uint_1 %int_1
%88 = OpLoad %v3float %87
%89 = OpVectorShuffle %v3float %88 %88 2 0 1
OpStore %85 %89
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -71,6 +71,21 @@ layout(binding = 1, std430) buffer u_block_ssbo {
S inner[4]; S inner[4];
} s; } s;
void assign_and_preserve_padding_1_s_X(uint dest[1], S value) {
s.inner[dest[0]].before = value.before;
s.inner[dest[0]].m = value.m;
s.inner[dest[0]].after = value.after;
}
void assign_and_preserve_padding_s(S value[4]) {
{
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
uint tint_symbol[1] = uint[1](i);
assign_and_preserve_padding_1_s_X(tint_symbol, value[i]);
}
}
}
S conv_S(S_std140 val) { S conv_S(S_std140 val) {
return S(val.before, val.pad, f16mat3x4(val.m_0, val.m_1, val.m_2), val.pad_1, val.pad_2, val.pad_3, val.pad_4, val.pad_5, val.pad_6, val.pad_7, val.pad_8, val.after, val.pad_9, val.pad_10, val.pad_11, val.pad_12, val.pad_13, val.pad_14, val.pad_15, val.pad_16, val.pad_17, val.pad_18, val.pad_19, val.pad_20, val.pad_21, val.pad_22, val.pad_23); return S(val.before, val.pad, f16mat3x4(val.m_0, val.m_1, val.m_2), val.pad_1, val.pad_2, val.pad_3, val.pad_4, val.pad_5, val.pad_6, val.pad_7, val.pad_8, val.after, val.pad_9, val.pad_10, val.pad_11, val.pad_12, val.pad_13, val.pad_14, val.pad_15, val.pad_16, val.pad_17, val.pad_18, val.pad_19, val.pad_20, val.pad_21, val.pad_22, val.pad_23);
} }
@ -90,8 +105,9 @@ f16mat3x4 load_u_inner_2_m() {
} }
void f() { void f() {
s.inner = conv_arr4_S(u.inner); assign_and_preserve_padding_s(conv_arr4_S(u.inner));
s.inner[1] = conv_S(u.inner[2u]); uint tint_symbol_1[1] = uint[1](1u);
assign_and_preserve_padding_1_s_X(tint_symbol_1, conv_S(u.inner[2u]));
s.inner[3].m = load_u_inner_2_m(); s.inner[3].m = load_u_inner_2_m();
s.inner[1].m[0] = u.inner[0u].m_1.ywxz; s.inner[1].m[0] = u.inner[0u].m_1.ywxz;
} }

View File

@ -23,9 +23,21 @@ struct S {
/* 0x0044 */ tint_array<int8_t, 60> tint_pad_2; /* 0x0044 */ tint_array<int8_t, 60> tint_pad_2;
}; };
void assign_and_preserve_padding_1(device S* const dest, S value) {
(*(dest)).before = value.before;
(*(dest)).m = value.m;
(*(dest)).after = value.after;
}
void assign_and_preserve_padding(device tint_array<S, 4>* const dest, tint_array<S, 4> value) {
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
assign_and_preserve_padding_1(&((*(dest))[i]), value[i]);
}
}
kernel void f(device tint_array<S, 4>* tint_symbol [[buffer(1)]], const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) { kernel void f(device tint_array<S, 4>* tint_symbol [[buffer(1)]], const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) {
*(tint_symbol) = *(tint_symbol_1); assign_and_preserve_padding(tint_symbol, *(tint_symbol_1));
(*(tint_symbol))[1] = (*(tint_symbol_1))[2]; assign_and_preserve_padding_1(&((*(tint_symbol))[1]), (*(tint_symbol_1))[2]);
(*(tint_symbol))[3].m = (*(tint_symbol_1))[2].m; (*(tint_symbol))[3].m = (*(tint_symbol_1))[2].m;
(*(tint_symbol))[1].m[0] = half4((*(tint_symbol_1))[0].m[1]).ywxz; (*(tint_symbol))[1].m[0] = half4((*(tint_symbol_1))[0].m[1]).ywxz;
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: 109 ; Bound: 147
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpCapability Float16 OpCapability Float16
@ -27,13 +27,20 @@
OpMemberName %S 1 "m" OpMemberName %S 1 "m"
OpMemberName %S 2 "after" OpMemberName %S 2 "after"
OpName %s "s" OpName %s "s"
OpName %assign_and_preserve_padding_1_s_X "assign_and_preserve_padding_1_s_X"
OpName %dest "dest"
OpName %value "value"
OpName %assign_and_preserve_padding_s "assign_and_preserve_padding_s"
OpName %value_0 "value"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %conv_S "conv_S" OpName %conv_S "conv_S"
OpName %val "val" OpName %val "val"
OpName %conv_arr4_S "conv_arr4_S" OpName %conv_arr4_S "conv_arr4_S"
OpName %val_0 "val" OpName %val_0 "val"
OpName %arr "arr" OpName %arr "arr"
OpName %i "i" OpName %i_0 "i"
OpName %var_for_index "var_for_index" OpName %var_for_index_1 "var_for_index_1"
OpName %load_u_inner_2_m "load_u_inner_2_m" OpName %load_u_inner_2_m "load_u_inner_2_m"
OpName %f "f" OpName %f "f"
OpDecorate %u_block_std140 Block OpDecorate %u_block_std140 Block
@ -57,6 +64,7 @@
OpDecorate %_arr_S_uint_4 ArrayStride 128 OpDecorate %_arr_S_uint_4 ArrayStride 128
OpDecorate %s DescriptorSet 0 OpDecorate %s DescriptorSet 0
OpDecorate %s Binding 1 OpDecorate %s Binding 1
OpDecorate %_arr_uint_uint_1 ArrayStride 4
%int = OpTypeInt 32 1 %int = OpTypeInt 32 1
%half = OpTypeFloat 16 %half = OpTypeFloat 16
%v4half = OpTypeVector %half 4 %v4half = OpTypeVector %half 4
@ -73,114 +81,168 @@
%u_block = OpTypeStruct %_arr_S_uint_4 %u_block = OpTypeStruct %_arr_S_uint_4
%_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block %_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block
%s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer %s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer
%17 = OpTypeFunction %S %S_std140 %void = OpTypeVoid
%28 = OpTypeFunction %_arr_S_uint_4 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%34 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_uint = OpTypePointer Function %uint
%37 = OpConstantNull %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
%50 = OpConstantNull %_arr_S_std140_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
%uint_1 = OpConstant %uint 1 %uint_1 = OpConstant %uint 1
%63 = OpTypeFunction %mat3v4half %_arr_uint_uint_1 = OpTypeArray %uint %uint_1
%17 = OpTypeFunction %void %_arr_uint_uint_1 %S
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%26 = OpConstantNull %int
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%_ptr_StorageBuffer_mat3v4half = OpTypePointer StorageBuffer %mat3v4half
%uint_2 = OpConstant %uint 2 %uint_2 = OpConstant %uint 2
%39 = OpTypeFunction %void %_arr_S_uint_4
%43 = OpConstantNull %uint
%_ptr_Function_uint = OpTypePointer Function %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%58 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%68 = OpTypeFunction %S %S_std140
%79 = OpTypeFunction %_arr_S_uint_4 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
%96 = OpConstantNull %_arr_S_std140_uint_4
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
%107 = OpTypeFunction %mat3v4half
%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140 %_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140
%_ptr_Uniform_v4half = OpTypePointer Uniform %v4half %_ptr_Uniform_v4half = OpTypePointer Uniform %v4half
%uint_3 = OpConstant %uint 3 %uint_3 = OpConstant %uint 3
%void = OpTypeVoid %125 = OpTypeFunction %void
%83 = OpTypeFunction %void
%_ptr_StorageBuffer__arr_S_uint_4 = OpTypePointer StorageBuffer %_arr_S_uint_4
%_ptr_Uniform__arr_S_std140_uint_4 = OpTypePointer Uniform %_arr_S_std140_uint_4 %_ptr_Uniform__arr_S_std140_uint_4 = OpTypePointer Uniform %_arr_S_std140_uint_4
%int_1 = OpConstant %int 1 %134 = OpConstantComposite %_arr_uint_uint_1 %uint_1
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
%int_3 = OpConstant %int 3 %int_3 = OpConstant %int 3
%_ptr_StorageBuffer_mat3v4half = OpTypePointer StorageBuffer %mat3v4half %int_1 = OpConstant %int 1
%103 = OpConstantNull %int
%_ptr_StorageBuffer_v4half = OpTypePointer StorageBuffer %v4half %_ptr_StorageBuffer_v4half = OpTypePointer StorageBuffer %v4half
%conv_S = OpFunction %S None %17 %assign_and_preserve_padding_1_s_X = OpFunction %void None %17
%val = OpFunctionParameter %S_std140 %dest = OpFunctionParameter %_arr_uint_uint_1
%20 = OpLabel %value = OpFunctionParameter %S
%21 = OpCompositeExtract %int %val 0 %24 = OpLabel
%22 = OpCompositeExtract %v4half %val 1 %27 = OpCompositeExtract %uint %dest 0
%23 = OpCompositeExtract %v4half %val 2 %29 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %27 %uint_0
%24 = OpCompositeExtract %v4half %val 3 %30 = OpCompositeExtract %int %value 0
%25 = OpCompositeConstruct %mat3v4half %22 %23 %24 OpStore %29 %30
%26 = OpCompositeExtract %int %val 4 %31 = OpCompositeExtract %uint %dest 0
%27 = OpCompositeConstruct %S %21 %25 %26 %33 = OpAccessChain %_ptr_StorageBuffer_mat3v4half %s %uint_0 %31 %uint_1
OpReturnValue %27 %34 = OpCompositeExtract %mat3v4half %value 1
OpFunctionEnd OpStore %33 %34
%conv_arr4_S = OpFunction %_arr_S_uint_4 None %28 %35 = OpCompositeExtract %uint %dest 0
%val_0 = OpFunctionParameter %_arr_S_std140_uint_4 %37 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %35 %uint_2
%31 = OpLabel %38 = OpCompositeExtract %int %value 2
%arr = OpVariable %_ptr_Function__arr_S_uint_4 Function %34 OpStore %37 %38
%i = OpVariable %_ptr_Function_uint Function %37 OpReturn
%var_for_index = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function %50 OpFunctionEnd
OpBranch %38 %assign_and_preserve_padding_s = OpFunction %void None %39
%38 = OpLabel %value_0 = OpFunctionParameter %_arr_S_uint_4
OpLoopMerge %39 %40 None %42 = OpLabel
OpBranch %41 %i = OpVariable %_ptr_Function_uint Function %43
%41 = OpLabel %var_for_index = OpVariable %_ptr_Function__arr_S_uint_4 Function %58
%43 = OpLoad %uint %i OpStore %i %43
%44 = OpULessThan %bool %43 %uint_4 OpBranch %46
%42 = OpLogicalNot %bool %44 %46 = OpLabel
OpSelectionMerge %46 None OpLoopMerge %47 %48 None
OpBranchConditional %42 %47 %46 OpBranch %49
%47 = OpLabel %49 = OpLabel
OpBranch %39 %51 = OpLoad %uint %i
%46 = OpLabel %52 = OpULessThan %bool %51 %uint_4
OpStore %var_for_index %val_0 %50 = OpLogicalNot %bool %52
%51 = OpLoad %uint %i OpSelectionMerge %54 None
%53 = OpAccessChain %_ptr_Function_S %arr %51 OpBranchConditional %50 %55 %54
%55 = OpLoad %uint %i %55 = OpLabel
%57 = OpAccessChain %_ptr_Function_S_std140 %var_for_index %55 OpBranch %47
%58 = OpLoad %S_std140 %57 %54 = OpLabel
%54 = OpFunctionCall %S %conv_S %58 OpStore %var_for_index %value_0
OpStore %53 %54 %60 = OpLoad %uint %i
OpBranch %40 %61 = OpCompositeConstruct %_arr_uint_uint_1 %60
%40 = OpLabel %62 = OpLoad %uint %i
%59 = OpLoad %uint %i %64 = OpAccessChain %_ptr_Function_S %var_for_index %62
%61 = OpIAdd %uint %59 %uint_1 %65 = OpLoad %S %64
OpStore %i %61 %59 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %61 %65
OpBranch %38 OpBranch %48
%39 = OpLabel %48 = OpLabel
%62 = OpLoad %_arr_S_uint_4 %arr %66 = OpLoad %uint %i
OpReturnValue %62 %67 = OpIAdd %uint %66 %uint_1
OpFunctionEnd OpStore %i %67
%load_u_inner_2_m = OpFunction %mat3v4half None %63 OpBranch %46
%65 = OpLabel %47 = OpLabel
%70 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2 OpReturn
%73 = OpAccessChain %_ptr_Uniform_v4half %70 %uint_1 OpFunctionEnd
%74 = OpLoad %v4half %73 %conv_S = OpFunction %S None %68
%76 = OpAccessChain %_ptr_Uniform_v4half %70 %uint_2 %val = OpFunctionParameter %S_std140
%77 = OpLoad %v4half %76 %71 = OpLabel
%80 = OpAccessChain %_ptr_Uniform_v4half %70 %uint_3 %72 = OpCompositeExtract %int %val 0
%81 = OpLoad %v4half %80 %73 = OpCompositeExtract %v4half %val 1
%82 = OpCompositeConstruct %mat3v4half %74 %77 %81 %74 = OpCompositeExtract %v4half %val 2
OpReturnValue %82 %75 = OpCompositeExtract %v4half %val 3
OpFunctionEnd %76 = OpCompositeConstruct %mat3v4half %73 %74 %75
%f = OpFunction %void None %83 %77 = OpCompositeExtract %int %val 4
%86 = OpLabel %78 = OpCompositeConstruct %S %72 %76 %77
%88 = OpAccessChain %_ptr_StorageBuffer__arr_S_uint_4 %s %uint_0 OpReturnValue %78
%91 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %u %uint_0 OpFunctionEnd
%92 = OpLoad %_arr_S_std140_uint_4 %91 %conv_arr4_S = OpFunction %_arr_S_uint_4 None %79
%89 = OpFunctionCall %_arr_S_uint_4 %conv_arr4_S %92 %val_0 = OpFunctionParameter %_arr_S_std140_uint_4
OpStore %88 %89 %82 = OpLabel
%95 = OpAccessChain %_ptr_StorageBuffer_S %s %uint_0 %int_1 %arr = OpVariable %_ptr_Function__arr_S_uint_4 Function %58
%97 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2 %i_0 = OpVariable %_ptr_Function_uint Function %43
%98 = OpLoad %S_std140 %97 %var_for_index_1 = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function %96
%96 = OpFunctionCall %S %conv_S %98 OpBranch %85
OpStore %95 %96 %85 = OpLabel
%101 = OpAccessChain %_ptr_StorageBuffer_mat3v4half %s %uint_0 %int_3 %uint_1 OpLoopMerge %86 %87 None
%102 = OpFunctionCall %mat3v4half %load_u_inner_2_m OpBranch %88
OpStore %101 %102 %88 = OpLabel
%105 = OpAccessChain %_ptr_StorageBuffer_v4half %s %uint_0 %int_1 %uint_1 %103 %90 = OpLoad %uint %i_0
%106 = OpAccessChain %_ptr_Uniform_v4half %u %uint_0 %37 %uint_2 %91 = OpULessThan %bool %90 %uint_4
%107 = OpLoad %v4half %106 %89 = OpLogicalNot %bool %91
%108 = OpVectorShuffle %v4half %107 %107 1 3 0 2 OpSelectionMerge %92 None
OpStore %105 %108 OpBranchConditional %89 %93 %92
%93 = OpLabel
OpBranch %86
%92 = OpLabel
OpStore %var_for_index_1 %val_0
%97 = OpLoad %uint %i_0
%98 = OpAccessChain %_ptr_Function_S %arr %97
%100 = OpLoad %uint %i_0
%102 = OpAccessChain %_ptr_Function_S_std140 %var_for_index_1 %100
%103 = OpLoad %S_std140 %102
%99 = OpFunctionCall %S %conv_S %103
OpStore %98 %99
OpBranch %87
%87 = OpLabel
%104 = OpLoad %uint %i_0
%105 = OpIAdd %uint %104 %uint_1
OpStore %i_0 %105
OpBranch %85
%86 = OpLabel
%106 = OpLoad %_arr_S_uint_4 %arr
OpReturnValue %106
OpFunctionEnd
%load_u_inner_2_m = OpFunction %mat3v4half None %107
%109 = OpLabel
%112 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%115 = OpAccessChain %_ptr_Uniform_v4half %112 %uint_1
%116 = OpLoad %v4half %115
%118 = OpAccessChain %_ptr_Uniform_v4half %112 %uint_2
%119 = OpLoad %v4half %118
%122 = OpAccessChain %_ptr_Uniform_v4half %112 %uint_3
%123 = OpLoad %v4half %122
%124 = OpCompositeConstruct %mat3v4half %116 %119 %123
OpReturnValue %124
OpFunctionEnd
%f = OpFunction %void None %125
%127 = OpLabel
%131 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %u %uint_0
%132 = OpLoad %_arr_S_std140_uint_4 %131
%129 = OpFunctionCall %_arr_S_uint_4 %conv_arr4_S %132
%128 = OpFunctionCall %void %assign_and_preserve_padding_s %129
%136 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%137 = OpLoad %S_std140 %136
%135 = OpFunctionCall %S %conv_S %137
%133 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %134 %135
%139 = OpAccessChain %_ptr_StorageBuffer_mat3v4half %s %uint_0 %int_3 %uint_1
%140 = OpFunctionCall %mat3v4half %load_u_inner_2_m
OpStore %139 %140
%143 = OpAccessChain %_ptr_StorageBuffer_v4half %s %uint_0 %int_1 %uint_1 %26
%144 = OpAccessChain %_ptr_Uniform_v4half %u %uint_0 %43 %uint_2
%145 = OpLoad %v4half %144
%146 = OpVectorShuffle %v4half %145 %145 1 3 0 2
OpStore %143 %146
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -32,9 +32,25 @@ layout(binding = 1, std430) buffer u_block_ssbo {
S inner[4]; S inner[4];
} s; } s;
void assign_and_preserve_padding_1_s_X(uint dest[1], S value) {
s.inner[dest[0]].before = value.before;
s.inner[dest[0]].m = value.m;
s.inner[dest[0]].after = value.after;
}
void assign_and_preserve_padding_s(S value[4]) {
{
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
uint tint_symbol[1] = uint[1](i);
assign_and_preserve_padding_1_s_X(tint_symbol, value[i]);
}
}
}
void f() { void f() {
s.inner = u.inner; assign_and_preserve_padding_s(u.inner);
s.inner[1] = u.inner[2]; uint tint_symbol_1[1] = uint[1](1u);
assign_and_preserve_padding_1_s_X(tint_symbol_1, u.inner[2]);
s.inner[3].m = u.inner[2].m; s.inner[3].m = u.inner[2].m;
s.inner[1].m[0] = u.inner[0].m[1].ywxz; s.inner[1].m[0] = u.inner[0].m[1].ywxz;
} }

View File

@ -22,9 +22,21 @@ struct S {
/* 0x0044 */ tint_array<int8_t, 60> tint_pad_1; /* 0x0044 */ tint_array<int8_t, 60> tint_pad_1;
}; };
void assign_and_preserve_padding_1(device S* const dest, S value) {
(*(dest)).before = value.before;
(*(dest)).m = value.m;
(*(dest)).after = value.after;
}
void assign_and_preserve_padding(device tint_array<S, 4>* const dest, tint_array<S, 4> value) {
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
assign_and_preserve_padding_1(&((*(dest))[i]), value[i]);
}
}
kernel void f(device tint_array<S, 4>* tint_symbol [[buffer(1)]], const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) { kernel void f(device tint_array<S, 4>* tint_symbol [[buffer(1)]], const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) {
*(tint_symbol) = *(tint_symbol_1); assign_and_preserve_padding(tint_symbol, *(tint_symbol_1));
(*(tint_symbol))[1] = (*(tint_symbol_1))[2]; assign_and_preserve_padding_1(&((*(tint_symbol))[1]), (*(tint_symbol_1))[2]);
(*(tint_symbol))[3].m = (*(tint_symbol_1))[2].m; (*(tint_symbol))[3].m = (*(tint_symbol_1))[2].m;
(*(tint_symbol))[1].m[0] = float4((*(tint_symbol_1))[0].m[1]).ywxz; (*(tint_symbol))[1].m[0] = float4((*(tint_symbol_1))[0].m[1]).ywxz;
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: 45 ; Bound: 90
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
@ -15,6 +15,13 @@
OpMemberName %S 2 "after" OpMemberName %S 2 "after"
OpName %u "u" OpName %u "u"
OpName %s "s" OpName %s "s"
OpName %assign_and_preserve_padding_1_s_X "assign_and_preserve_padding_1_s_X"
OpName %dest "dest"
OpName %value "value"
OpName %assign_and_preserve_padding_s "assign_and_preserve_padding_s"
OpName %value_0 "value"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %f "f" OpName %f "f"
OpDecorate %u_block Block OpDecorate %u_block Block
OpMemberDecorate %u_block 0 Offset 0 OpMemberDecorate %u_block 0 Offset 0
@ -29,6 +36,7 @@
OpDecorate %u Binding 0 OpDecorate %u Binding 0
OpDecorate %s DescriptorSet 0 OpDecorate %s DescriptorSet 0
OpDecorate %s Binding 1 OpDecorate %s Binding 1
OpDecorate %_arr_uint_uint_1 ArrayStride 4
%int = OpTypeInt 32 1 %int = OpTypeInt 32 1
%float = OpTypeFloat 32 %float = OpTypeFloat 32
%v4float = OpTypeVector %float 4 %v4float = OpTypeVector %float 4
@ -43,39 +51,100 @@
%_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block %_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block
%s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer %s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer
%void = OpTypeVoid %void = OpTypeVoid
%14 = OpTypeFunction %void %uint_1 = OpConstant %uint 1
%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
%14 = OpTypeFunction %void %_arr_uint_uint_1 %S
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer__arr_S_uint_4 = OpTypePointer StorageBuffer %_arr_S_uint_4 %23 = OpConstantNull %int
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%_ptr_StorageBuffer_mat3v4float = OpTypePointer StorageBuffer %mat3v4float
%uint_2 = OpConstant %uint 2
%36 = OpTypeFunction %void %_arr_S_uint_4
%40 = OpConstantNull %uint
%_ptr_Function_uint = OpTypePointer Function %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%55 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%65 = OpTypeFunction %void
%_ptr_Uniform__arr_S_uint_4 = OpTypePointer Uniform %_arr_S_uint_4 %_ptr_Uniform__arr_S_uint_4 = OpTypePointer Uniform %_arr_S_uint_4
%int_1 = OpConstant %int 1 %73 = OpConstantComposite %_arr_uint_uint_1 %uint_1
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
%int_2 = OpConstant %int 2 %int_2 = OpConstant %int 2
%_ptr_Uniform_S = OpTypePointer Uniform %S %_ptr_Uniform_S = OpTypePointer Uniform %S
%int_3 = OpConstant %int 3 %int_3 = OpConstant %int 3
%uint_1 = OpConstant %uint 1
%_ptr_StorageBuffer_mat3v4float = OpTypePointer StorageBuffer %mat3v4float
%_ptr_Uniform_mat3v4float = OpTypePointer Uniform %mat3v4float %_ptr_Uniform_mat3v4float = OpTypePointer Uniform %mat3v4float
%38 = OpConstantNull %int %int_1 = OpConstant %int 1
%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float %_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float
%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float %_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
%f = OpFunction %void None %14 %assign_and_preserve_padding_1_s_X = OpFunction %void None %14
%17 = OpLabel %dest = OpFunctionParameter %_arr_uint_uint_1
%20 = OpAccessChain %_ptr_StorageBuffer__arr_S_uint_4 %s %uint_0 %value = OpFunctionParameter %S
%22 = OpAccessChain %_ptr_Uniform__arr_S_uint_4 %u %uint_0 %21 = OpLabel
%23 = OpLoad %_arr_S_uint_4 %22 %24 = OpCompositeExtract %uint %dest 0
OpStore %20 %23 %26 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %24 %uint_0
%26 = OpAccessChain %_ptr_StorageBuffer_S %s %uint_0 %int_1 %27 = OpCompositeExtract %int %value 0
%29 = OpAccessChain %_ptr_Uniform_S %u %uint_0 %int_2 OpStore %26 %27
%30 = OpLoad %S %29 %28 = OpCompositeExtract %uint %dest 0
OpStore %26 %30 %30 = OpAccessChain %_ptr_StorageBuffer_mat3v4float %s %uint_0 %28 %uint_1
%34 = OpAccessChain %_ptr_StorageBuffer_mat3v4float %s %uint_0 %int_3 %uint_1 %31 = OpCompositeExtract %mat3v4float %value 1
%36 = OpAccessChain %_ptr_Uniform_mat3v4float %u %uint_0 %int_2 %uint_1 OpStore %30 %31
%37 = OpLoad %mat3v4float %36 %32 = OpCompositeExtract %uint %dest 0
OpStore %34 %37 %34 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %32 %uint_2
%40 = OpAccessChain %_ptr_StorageBuffer_v4float %s %uint_0 %int_1 %uint_1 %38 %35 = OpCompositeExtract %int %value 2
%42 = OpAccessChain %_ptr_Uniform_v4float %u %uint_0 %38 %uint_1 %int_1 OpStore %34 %35
%43 = OpLoad %v4float %42 OpReturn
%44 = OpVectorShuffle %v4float %43 %43 1 3 0 2 OpFunctionEnd
OpStore %40 %44 %assign_and_preserve_padding_s = OpFunction %void None %36
%value_0 = OpFunctionParameter %_arr_S_uint_4
%39 = OpLabel
%i = OpVariable %_ptr_Function_uint Function %40
%var_for_index = OpVariable %_ptr_Function__arr_S_uint_4 Function %55
OpStore %i %40
OpBranch %43
%43 = OpLabel
OpLoopMerge %44 %45 None
OpBranch %46
%46 = OpLabel
%48 = OpLoad %uint %i
%49 = OpULessThan %bool %48 %uint_4
%47 = OpLogicalNot %bool %49
OpSelectionMerge %51 None
OpBranchConditional %47 %52 %51
%52 = OpLabel
OpBranch %44
%51 = OpLabel
OpStore %var_for_index %value_0
%57 = OpLoad %uint %i
%58 = OpCompositeConstruct %_arr_uint_uint_1 %57
%59 = OpLoad %uint %i
%61 = OpAccessChain %_ptr_Function_S %var_for_index %59
%62 = OpLoad %S %61
%56 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %58 %62
OpBranch %45
%45 = OpLabel
%63 = OpLoad %uint %i
%64 = OpIAdd %uint %63 %uint_1
OpStore %i %64
OpBranch %43
%44 = OpLabel
OpReturn
OpFunctionEnd
%f = OpFunction %void None %65
%67 = OpLabel
%70 = OpAccessChain %_ptr_Uniform__arr_S_uint_4 %u %uint_0
%71 = OpLoad %_arr_S_uint_4 %70
%68 = OpFunctionCall %void %assign_and_preserve_padding_s %71
%76 = OpAccessChain %_ptr_Uniform_S %u %uint_0 %int_2
%77 = OpLoad %S %76
%72 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %73 %77
%79 = OpAccessChain %_ptr_StorageBuffer_mat3v4float %s %uint_0 %int_3 %uint_1
%81 = OpAccessChain %_ptr_Uniform_mat3v4float %u %uint_0 %int_2 %uint_1
%82 = OpLoad %mat3v4float %81
OpStore %79 %82
%85 = OpAccessChain %_ptr_StorageBuffer_v4float %s %uint_0 %int_1 %uint_1 %23
%87 = OpAccessChain %_ptr_Uniform_v4float %u %uint_0 %23 %uint_1 %int_1
%88 = OpLoad %v4float %87
%89 = OpVectorShuffle %v4float %88 %88 1 3 0 2
OpStore %85 %89
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -76,6 +76,21 @@ layout(binding = 1, std430) buffer u_block_ssbo {
S inner[4]; S inner[4];
} s; } s;
void assign_and_preserve_padding_1_s_X(uint dest[1], S value) {
s.inner[dest[0]].before = value.before;
s.inner[dest[0]].m = value.m;
s.inner[dest[0]].after = value.after;
}
void assign_and_preserve_padding_s(S value[4]) {
{
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
uint tint_symbol[1] = uint[1](i);
assign_and_preserve_padding_1_s_X(tint_symbol, value[i]);
}
}
}
S conv_S(S_std140 val) { S conv_S(S_std140 val) {
return S(val.before, f16mat4x2(val.m_0, val.m_1, val.m_2, val.m_3), val.pad, val.pad_1, val.pad_2, val.pad_3, val.pad_4, val.pad_5, val.pad_6, val.pad_7, val.pad_8, val.pad_9, val.pad_10, val.after, val.pad_11, val.pad_12, val.pad_13, val.pad_14, val.pad_15, val.pad_16, val.pad_17, val.pad_18, val.pad_19, val.pad_20, val.pad_21, val.pad_22, val.pad_23, val.pad_24, val.pad_25); return S(val.before, f16mat4x2(val.m_0, val.m_1, val.m_2, val.m_3), val.pad, val.pad_1, val.pad_2, val.pad_3, val.pad_4, val.pad_5, val.pad_6, val.pad_7, val.pad_8, val.pad_9, val.pad_10, val.after, val.pad_11, val.pad_12, val.pad_13, val.pad_14, val.pad_15, val.pad_16, val.pad_17, val.pad_18, val.pad_19, val.pad_20, val.pad_21, val.pad_22, val.pad_23, val.pad_24, val.pad_25);
} }
@ -95,8 +110,9 @@ f16mat4x2 load_u_inner_2_m() {
} }
void f() { void f() {
s.inner = conv_arr4_S(u.inner); assign_and_preserve_padding_s(conv_arr4_S(u.inner));
s.inner[1] = conv_S(u.inner[2u]); uint tint_symbol_1[1] = uint[1](1u);
assign_and_preserve_padding_1_s_X(tint_symbol_1, conv_S(u.inner[2u]));
s.inner[3].m = load_u_inner_2_m(); s.inner[3].m = load_u_inner_2_m();
s.inner[1].m[0] = u.inner[0u].m_1.yx; s.inner[1].m[0] = u.inner[0u].m_1.yx;
} }

View File

@ -22,9 +22,21 @@ struct S {
/* 0x0044 */ tint_array<int8_t, 60> tint_pad_1; /* 0x0044 */ tint_array<int8_t, 60> tint_pad_1;
}; };
void assign_and_preserve_padding_1(device S* const dest, S value) {
(*(dest)).before = value.before;
(*(dest)).m = value.m;
(*(dest)).after = value.after;
}
void assign_and_preserve_padding(device tint_array<S, 4>* const dest, tint_array<S, 4> value) {
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
assign_and_preserve_padding_1(&((*(dest))[i]), value[i]);
}
}
kernel void f(device tint_array<S, 4>* tint_symbol [[buffer(1)]], const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) { kernel void f(device tint_array<S, 4>* tint_symbol [[buffer(1)]], const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) {
*(tint_symbol) = *(tint_symbol_1); assign_and_preserve_padding(tint_symbol, *(tint_symbol_1));
(*(tint_symbol))[1] = (*(tint_symbol_1))[2]; assign_and_preserve_padding_1(&((*(tint_symbol))[1]), (*(tint_symbol_1))[2]);
(*(tint_symbol))[3].m = (*(tint_symbol_1))[2].m; (*(tint_symbol))[3].m = (*(tint_symbol_1))[2].m;
(*(tint_symbol))[1].m[0] = half2((*(tint_symbol_1))[0].m[1]).yx; (*(tint_symbol))[1].m[0] = half2((*(tint_symbol_1))[0].m[1]).yx;
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: 113 ; Bound: 151
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpCapability Float16 OpCapability Float16
@ -28,13 +28,20 @@
OpMemberName %S 1 "m" OpMemberName %S 1 "m"
OpMemberName %S 2 "after" OpMemberName %S 2 "after"
OpName %s "s" OpName %s "s"
OpName %assign_and_preserve_padding_1_s_X "assign_and_preserve_padding_1_s_X"
OpName %dest "dest"
OpName %value "value"
OpName %assign_and_preserve_padding_s "assign_and_preserve_padding_s"
OpName %value_0 "value"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %conv_S "conv_S" OpName %conv_S "conv_S"
OpName %val "val" OpName %val "val"
OpName %conv_arr4_S "conv_arr4_S" OpName %conv_arr4_S "conv_arr4_S"
OpName %val_0 "val" OpName %val_0 "val"
OpName %arr "arr" OpName %arr "arr"
OpName %i "i" OpName %i_0 "i"
OpName %var_for_index "var_for_index" OpName %var_for_index_1 "var_for_index_1"
OpName %load_u_inner_2_m "load_u_inner_2_m" OpName %load_u_inner_2_m "load_u_inner_2_m"
OpName %f "f" OpName %f "f"
OpDecorate %u_block_std140 Block OpDecorate %u_block_std140 Block
@ -59,6 +66,7 @@
OpDecorate %_arr_S_uint_4 ArrayStride 128 OpDecorate %_arr_S_uint_4 ArrayStride 128
OpDecorate %s DescriptorSet 0 OpDecorate %s DescriptorSet 0
OpDecorate %s Binding 1 OpDecorate %s Binding 1
OpDecorate %_arr_uint_uint_1 ArrayStride 4
%int = OpTypeInt 32 1 %int = OpTypeInt 32 1
%half = OpTypeFloat 16 %half = OpTypeFloat 16
%v2half = OpTypeVector %half 2 %v2half = OpTypeVector %half 2
@ -75,117 +83,171 @@
%u_block = OpTypeStruct %_arr_S_uint_4 %u_block = OpTypeStruct %_arr_S_uint_4
%_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block %_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block
%s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer %s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer
%17 = OpTypeFunction %S %S_std140 %void = OpTypeVoid
%29 = OpTypeFunction %_arr_S_uint_4 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%35 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_uint = OpTypePointer Function %uint
%38 = OpConstantNull %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
%51 = OpConstantNull %_arr_S_std140_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
%uint_1 = OpConstant %uint 1 %uint_1 = OpConstant %uint 1
%64 = OpTypeFunction %mat4v2half %_arr_uint_uint_1 = OpTypeArray %uint %uint_1
%17 = OpTypeFunction %void %_arr_uint_uint_1 %S
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%26 = OpConstantNull %int
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%_ptr_StorageBuffer_mat4v2half = OpTypePointer StorageBuffer %mat4v2half
%uint_2 = OpConstant %uint 2 %uint_2 = OpConstant %uint 2
%39 = OpTypeFunction %void %_arr_S_uint_4
%43 = OpConstantNull %uint
%_ptr_Function_uint = OpTypePointer Function %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%58 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%68 = OpTypeFunction %S %S_std140
%80 = OpTypeFunction %_arr_S_uint_4 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
%97 = OpConstantNull %_arr_S_std140_uint_4
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
%108 = OpTypeFunction %mat4v2half
%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140 %_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140
%_ptr_Uniform_v2half = OpTypePointer Uniform %v2half %_ptr_Uniform_v2half = OpTypePointer Uniform %v2half
%uint_3 = OpConstant %uint 3 %uint_3 = OpConstant %uint 3
%void = OpTypeVoid %129 = OpTypeFunction %void
%87 = OpTypeFunction %void
%_ptr_StorageBuffer__arr_S_uint_4 = OpTypePointer StorageBuffer %_arr_S_uint_4
%_ptr_Uniform__arr_S_std140_uint_4 = OpTypePointer Uniform %_arr_S_std140_uint_4 %_ptr_Uniform__arr_S_std140_uint_4 = OpTypePointer Uniform %_arr_S_std140_uint_4
%int_1 = OpConstant %int 1 %138 = OpConstantComposite %_arr_uint_uint_1 %uint_1
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
%int_3 = OpConstant %int 3 %int_3 = OpConstant %int 3
%_ptr_StorageBuffer_mat4v2half = OpTypePointer StorageBuffer %mat4v2half %int_1 = OpConstant %int 1
%107 = OpConstantNull %int
%_ptr_StorageBuffer_v2half = OpTypePointer StorageBuffer %v2half %_ptr_StorageBuffer_v2half = OpTypePointer StorageBuffer %v2half
%conv_S = OpFunction %S None %17 %assign_and_preserve_padding_1_s_X = OpFunction %void None %17
%val = OpFunctionParameter %S_std140 %dest = OpFunctionParameter %_arr_uint_uint_1
%20 = OpLabel %value = OpFunctionParameter %S
%21 = OpCompositeExtract %int %val 0 %24 = OpLabel
%22 = OpCompositeExtract %v2half %val 1 %27 = OpCompositeExtract %uint %dest 0
%23 = OpCompositeExtract %v2half %val 2 %29 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %27 %uint_0
%24 = OpCompositeExtract %v2half %val 3 %30 = OpCompositeExtract %int %value 0
%25 = OpCompositeExtract %v2half %val 4 OpStore %29 %30
%26 = OpCompositeConstruct %mat4v2half %22 %23 %24 %25 %31 = OpCompositeExtract %uint %dest 0
%27 = OpCompositeExtract %int %val 5 %33 = OpAccessChain %_ptr_StorageBuffer_mat4v2half %s %uint_0 %31 %uint_1
%28 = OpCompositeConstruct %S %21 %26 %27 %34 = OpCompositeExtract %mat4v2half %value 1
OpReturnValue %28 OpStore %33 %34
OpFunctionEnd %35 = OpCompositeExtract %uint %dest 0
%conv_arr4_S = OpFunction %_arr_S_uint_4 None %29 %37 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %35 %uint_2
%val_0 = OpFunctionParameter %_arr_S_std140_uint_4 %38 = OpCompositeExtract %int %value 2
%32 = OpLabel OpStore %37 %38
%arr = OpVariable %_ptr_Function__arr_S_uint_4 Function %35 OpReturn
%i = OpVariable %_ptr_Function_uint Function %38 OpFunctionEnd
%var_for_index = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function %51 %assign_and_preserve_padding_s = OpFunction %void None %39
OpBranch %39 %value_0 = OpFunctionParameter %_arr_S_uint_4
%39 = OpLabel %42 = OpLabel
OpLoopMerge %40 %41 None %i = OpVariable %_ptr_Function_uint Function %43
OpBranch %42 %var_for_index = OpVariable %_ptr_Function__arr_S_uint_4 Function %58
%42 = OpLabel OpStore %i %43
%44 = OpLoad %uint %i OpBranch %46
%45 = OpULessThan %bool %44 %uint_4 %46 = OpLabel
%43 = OpLogicalNot %bool %45 OpLoopMerge %47 %48 None
OpSelectionMerge %47 None OpBranch %49
OpBranchConditional %43 %48 %47 %49 = OpLabel
%48 = OpLabel %51 = OpLoad %uint %i
OpBranch %40 %52 = OpULessThan %bool %51 %uint_4
%47 = OpLabel %50 = OpLogicalNot %bool %52
OpStore %var_for_index %val_0 OpSelectionMerge %54 None
%52 = OpLoad %uint %i OpBranchConditional %50 %55 %54
%54 = OpAccessChain %_ptr_Function_S %arr %52 %55 = OpLabel
%56 = OpLoad %uint %i OpBranch %47
%58 = OpAccessChain %_ptr_Function_S_std140 %var_for_index %56 %54 = OpLabel
%59 = OpLoad %S_std140 %58 OpStore %var_for_index %value_0
%55 = OpFunctionCall %S %conv_S %59 %60 = OpLoad %uint %i
OpStore %54 %55 %61 = OpCompositeConstruct %_arr_uint_uint_1 %60
OpBranch %41 %62 = OpLoad %uint %i
%41 = OpLabel %64 = OpAccessChain %_ptr_Function_S %var_for_index %62
%60 = OpLoad %uint %i %65 = OpLoad %S %64
%62 = OpIAdd %uint %60 %uint_1 %59 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %61 %65
OpStore %i %62 OpBranch %48
OpBranch %39 %48 = OpLabel
%40 = OpLabel %66 = OpLoad %uint %i
%63 = OpLoad %_arr_S_uint_4 %arr %67 = OpIAdd %uint %66 %uint_1
OpReturnValue %63 OpStore %i %67
OpFunctionEnd OpBranch %46
%load_u_inner_2_m = OpFunction %mat4v2half None %64 %47 = OpLabel
%66 = OpLabel OpReturn
%71 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2 OpFunctionEnd
%74 = OpAccessChain %_ptr_Uniform_v2half %71 %uint_1 %conv_S = OpFunction %S None %68
%75 = OpLoad %v2half %74 %val = OpFunctionParameter %S_std140
%77 = OpAccessChain %_ptr_Uniform_v2half %71 %uint_2 %71 = OpLabel
%78 = OpLoad %v2half %77 %72 = OpCompositeExtract %int %val 0
%81 = OpAccessChain %_ptr_Uniform_v2half %71 %uint_3 %73 = OpCompositeExtract %v2half %val 1
%82 = OpLoad %v2half %81 %74 = OpCompositeExtract %v2half %val 2
%84 = OpAccessChain %_ptr_Uniform_v2half %71 %uint_4 %75 = OpCompositeExtract %v2half %val 3
%85 = OpLoad %v2half %84 %76 = OpCompositeExtract %v2half %val 4
%86 = OpCompositeConstruct %mat4v2half %75 %78 %82 %85 %77 = OpCompositeConstruct %mat4v2half %73 %74 %75 %76
OpReturnValue %86 %78 = OpCompositeExtract %int %val 5
OpFunctionEnd %79 = OpCompositeConstruct %S %72 %77 %78
%f = OpFunction %void None %87 OpReturnValue %79
%90 = OpLabel OpFunctionEnd
%92 = OpAccessChain %_ptr_StorageBuffer__arr_S_uint_4 %s %uint_0 %conv_arr4_S = OpFunction %_arr_S_uint_4 None %80
%95 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %u %uint_0 %val_0 = OpFunctionParameter %_arr_S_std140_uint_4
%96 = OpLoad %_arr_S_std140_uint_4 %95 %83 = OpLabel
%93 = OpFunctionCall %_arr_S_uint_4 %conv_arr4_S %96 %arr = OpVariable %_ptr_Function__arr_S_uint_4 Function %58
OpStore %92 %93 %i_0 = OpVariable %_ptr_Function_uint Function %43
%99 = OpAccessChain %_ptr_StorageBuffer_S %s %uint_0 %int_1 %var_for_index_1 = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function %97
%101 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2 OpBranch %86
%102 = OpLoad %S_std140 %101 %86 = OpLabel
%100 = OpFunctionCall %S %conv_S %102 OpLoopMerge %87 %88 None
OpStore %99 %100 OpBranch %89
%105 = OpAccessChain %_ptr_StorageBuffer_mat4v2half %s %uint_0 %int_3 %uint_1 %89 = OpLabel
%106 = OpFunctionCall %mat4v2half %load_u_inner_2_m %91 = OpLoad %uint %i_0
OpStore %105 %106 %92 = OpULessThan %bool %91 %uint_4
%109 = OpAccessChain %_ptr_StorageBuffer_v2half %s %uint_0 %int_1 %uint_1 %107 %90 = OpLogicalNot %bool %92
%110 = OpAccessChain %_ptr_Uniform_v2half %u %uint_0 %38 %uint_2 OpSelectionMerge %93 None
%111 = OpLoad %v2half %110 OpBranchConditional %90 %94 %93
%112 = OpVectorShuffle %v2half %111 %111 1 0 %94 = OpLabel
OpStore %109 %112 OpBranch %87
%93 = OpLabel
OpStore %var_for_index_1 %val_0
%98 = OpLoad %uint %i_0
%99 = OpAccessChain %_ptr_Function_S %arr %98
%101 = OpLoad %uint %i_0
%103 = OpAccessChain %_ptr_Function_S_std140 %var_for_index_1 %101
%104 = OpLoad %S_std140 %103
%100 = OpFunctionCall %S %conv_S %104
OpStore %99 %100
OpBranch %88
%88 = OpLabel
%105 = OpLoad %uint %i_0
%106 = OpIAdd %uint %105 %uint_1
OpStore %i_0 %106
OpBranch %86
%87 = OpLabel
%107 = OpLoad %_arr_S_uint_4 %arr
OpReturnValue %107
OpFunctionEnd
%load_u_inner_2_m = OpFunction %mat4v2half None %108
%110 = OpLabel
%113 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%116 = OpAccessChain %_ptr_Uniform_v2half %113 %uint_1
%117 = OpLoad %v2half %116
%119 = OpAccessChain %_ptr_Uniform_v2half %113 %uint_2
%120 = OpLoad %v2half %119
%123 = OpAccessChain %_ptr_Uniform_v2half %113 %uint_3
%124 = OpLoad %v2half %123
%126 = OpAccessChain %_ptr_Uniform_v2half %113 %uint_4
%127 = OpLoad %v2half %126
%128 = OpCompositeConstruct %mat4v2half %117 %120 %124 %127
OpReturnValue %128
OpFunctionEnd
%f = OpFunction %void None %129
%131 = OpLabel
%135 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %u %uint_0
%136 = OpLoad %_arr_S_std140_uint_4 %135
%133 = OpFunctionCall %_arr_S_uint_4 %conv_arr4_S %136
%132 = OpFunctionCall %void %assign_and_preserve_padding_s %133
%140 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%141 = OpLoad %S_std140 %140
%139 = OpFunctionCall %S %conv_S %141
%137 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %138 %139
%143 = OpAccessChain %_ptr_StorageBuffer_mat4v2half %s %uint_0 %int_3 %uint_1
%144 = OpFunctionCall %mat4v2half %load_u_inner_2_m
OpStore %143 %144
%147 = OpAccessChain %_ptr_StorageBuffer_v2half %s %uint_0 %int_1 %uint_1 %26
%148 = OpAccessChain %_ptr_Uniform_v2half %u %uint_0 %43 %uint_2
%149 = OpLoad %v2half %148
%150 = OpVectorShuffle %v2half %149 %149 1 0
OpStore %147 %150
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -67,6 +67,21 @@ layout(binding = 1, std430) buffer u_block_ssbo {
S inner[4]; S inner[4];
} s; } s;
void assign_and_preserve_padding_1_s_X(uint dest[1], S value) {
s.inner[dest[0]].before = value.before;
s.inner[dest[0]].m = value.m;
s.inner[dest[0]].after = value.after;
}
void assign_and_preserve_padding_s(S value[4]) {
{
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
uint tint_symbol[1] = uint[1](i);
assign_and_preserve_padding_1_s_X(tint_symbol, value[i]);
}
}
}
S conv_S(S_std140 val) { S conv_S(S_std140 val) {
return S(val.before, val.pad, mat4x2(val.m_0, val.m_1, val.m_2, val.m_3), val.pad_1, val.pad_2, val.pad_3, val.pad_4, val.pad_5, val.pad_6, val.after, val.pad_7, val.pad_8, val.pad_9, val.pad_10, val.pad_11, val.pad_12, val.pad_13, val.pad_14, val.pad_15, val.pad_16, val.pad_17, val.pad_18, val.pad_19, val.pad_20, val.pad_21); return S(val.before, val.pad, mat4x2(val.m_0, val.m_1, val.m_2, val.m_3), val.pad_1, val.pad_2, val.pad_3, val.pad_4, val.pad_5, val.pad_6, val.after, val.pad_7, val.pad_8, val.pad_9, val.pad_10, val.pad_11, val.pad_12, val.pad_13, val.pad_14, val.pad_15, val.pad_16, val.pad_17, val.pad_18, val.pad_19, val.pad_20, val.pad_21);
} }
@ -86,8 +101,9 @@ mat4x2 load_u_inner_2_m() {
} }
void f() { void f() {
s.inner = conv_arr4_S(u.inner); assign_and_preserve_padding_s(conv_arr4_S(u.inner));
s.inner[1] = conv_S(u.inner[2u]); uint tint_symbol_1[1] = uint[1](1u);
assign_and_preserve_padding_1_s_X(tint_symbol_1, conv_S(u.inner[2u]));
s.inner[3].m = load_u_inner_2_m(); s.inner[3].m = load_u_inner_2_m();
s.inner[1].m[0] = u.inner[0u].m_1.yx; s.inner[1].m[0] = u.inner[0u].m_1.yx;
} }

View File

@ -23,9 +23,21 @@ struct S {
/* 0x0044 */ tint_array<int8_t, 60> tint_pad_2; /* 0x0044 */ tint_array<int8_t, 60> tint_pad_2;
}; };
void assign_and_preserve_padding_1(device S* const dest, S value) {
(*(dest)).before = value.before;
(*(dest)).m = value.m;
(*(dest)).after = value.after;
}
void assign_and_preserve_padding(device tint_array<S, 4>* const dest, tint_array<S, 4> value) {
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
assign_and_preserve_padding_1(&((*(dest))[i]), value[i]);
}
}
kernel void f(device tint_array<S, 4>* tint_symbol [[buffer(1)]], const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) { kernel void f(device tint_array<S, 4>* tint_symbol [[buffer(1)]], const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) {
*(tint_symbol) = *(tint_symbol_1); assign_and_preserve_padding(tint_symbol, *(tint_symbol_1));
(*(tint_symbol))[1] = (*(tint_symbol_1))[2]; assign_and_preserve_padding_1(&((*(tint_symbol))[1]), (*(tint_symbol_1))[2]);
(*(tint_symbol))[3].m = (*(tint_symbol_1))[2].m; (*(tint_symbol))[3].m = (*(tint_symbol_1))[2].m;
(*(tint_symbol))[1].m[0] = float2((*(tint_symbol_1))[0].m[1]).yx; (*(tint_symbol))[1].m[0] = float2((*(tint_symbol_1))[0].m[1]).yx;
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: 113 ; Bound: 151
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
@ -24,13 +24,20 @@
OpMemberName %S 1 "m" OpMemberName %S 1 "m"
OpMemberName %S 2 "after" OpMemberName %S 2 "after"
OpName %s "s" OpName %s "s"
OpName %assign_and_preserve_padding_1_s_X "assign_and_preserve_padding_1_s_X"
OpName %dest "dest"
OpName %value "value"
OpName %assign_and_preserve_padding_s "assign_and_preserve_padding_s"
OpName %value_0 "value"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %conv_S "conv_S" OpName %conv_S "conv_S"
OpName %val "val" OpName %val "val"
OpName %conv_arr4_S "conv_arr4_S" OpName %conv_arr4_S "conv_arr4_S"
OpName %val_0 "val" OpName %val_0 "val"
OpName %arr "arr" OpName %arr "arr"
OpName %i "i" OpName %i_0 "i"
OpName %var_for_index "var_for_index" OpName %var_for_index_1 "var_for_index_1"
OpName %load_u_inner_2_m "load_u_inner_2_m" OpName %load_u_inner_2_m "load_u_inner_2_m"
OpName %f "f" OpName %f "f"
OpDecorate %u_block_std140 Block OpDecorate %u_block_std140 Block
@ -55,6 +62,7 @@
OpDecorate %_arr_S_uint_4 ArrayStride 128 OpDecorate %_arr_S_uint_4 ArrayStride 128
OpDecorate %s DescriptorSet 0 OpDecorate %s DescriptorSet 0
OpDecorate %s Binding 1 OpDecorate %s Binding 1
OpDecorate %_arr_uint_uint_1 ArrayStride 4
%int = OpTypeInt 32 1 %int = OpTypeInt 32 1
%float = OpTypeFloat 32 %float = OpTypeFloat 32
%v2float = OpTypeVector %float 2 %v2float = OpTypeVector %float 2
@ -71,117 +79,171 @@
%u_block = OpTypeStruct %_arr_S_uint_4 %u_block = OpTypeStruct %_arr_S_uint_4
%_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block %_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block
%s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer %s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer
%17 = OpTypeFunction %S %S_std140 %void = OpTypeVoid
%29 = OpTypeFunction %_arr_S_uint_4 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%35 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_uint = OpTypePointer Function %uint
%38 = OpConstantNull %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
%51 = OpConstantNull %_arr_S_std140_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
%uint_1 = OpConstant %uint 1 %uint_1 = OpConstant %uint 1
%64 = OpTypeFunction %mat4v2float %_arr_uint_uint_1 = OpTypeArray %uint %uint_1
%17 = OpTypeFunction %void %_arr_uint_uint_1 %S
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%26 = OpConstantNull %int
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%_ptr_StorageBuffer_mat4v2float = OpTypePointer StorageBuffer %mat4v2float
%uint_2 = OpConstant %uint 2 %uint_2 = OpConstant %uint 2
%39 = OpTypeFunction %void %_arr_S_uint_4
%43 = OpConstantNull %uint
%_ptr_Function_uint = OpTypePointer Function %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%58 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%68 = OpTypeFunction %S %S_std140
%80 = OpTypeFunction %_arr_S_uint_4 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
%97 = OpConstantNull %_arr_S_std140_uint_4
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
%108 = OpTypeFunction %mat4v2float
%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140 %_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140
%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float %_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
%uint_3 = OpConstant %uint 3 %uint_3 = OpConstant %uint 3
%void = OpTypeVoid %129 = OpTypeFunction %void
%87 = OpTypeFunction %void
%_ptr_StorageBuffer__arr_S_uint_4 = OpTypePointer StorageBuffer %_arr_S_uint_4
%_ptr_Uniform__arr_S_std140_uint_4 = OpTypePointer Uniform %_arr_S_std140_uint_4 %_ptr_Uniform__arr_S_std140_uint_4 = OpTypePointer Uniform %_arr_S_std140_uint_4
%int_1 = OpConstant %int 1 %138 = OpConstantComposite %_arr_uint_uint_1 %uint_1
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
%int_3 = OpConstant %int 3 %int_3 = OpConstant %int 3
%_ptr_StorageBuffer_mat4v2float = OpTypePointer StorageBuffer %mat4v2float %int_1 = OpConstant %int 1
%107 = OpConstantNull %int
%_ptr_StorageBuffer_v2float = OpTypePointer StorageBuffer %v2float %_ptr_StorageBuffer_v2float = OpTypePointer StorageBuffer %v2float
%conv_S = OpFunction %S None %17 %assign_and_preserve_padding_1_s_X = OpFunction %void None %17
%val = OpFunctionParameter %S_std140 %dest = OpFunctionParameter %_arr_uint_uint_1
%20 = OpLabel %value = OpFunctionParameter %S
%21 = OpCompositeExtract %int %val 0 %24 = OpLabel
%22 = OpCompositeExtract %v2float %val 1 %27 = OpCompositeExtract %uint %dest 0
%23 = OpCompositeExtract %v2float %val 2 %29 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %27 %uint_0
%24 = OpCompositeExtract %v2float %val 3 %30 = OpCompositeExtract %int %value 0
%25 = OpCompositeExtract %v2float %val 4 OpStore %29 %30
%26 = OpCompositeConstruct %mat4v2float %22 %23 %24 %25 %31 = OpCompositeExtract %uint %dest 0
%27 = OpCompositeExtract %int %val 5 %33 = OpAccessChain %_ptr_StorageBuffer_mat4v2float %s %uint_0 %31 %uint_1
%28 = OpCompositeConstruct %S %21 %26 %27 %34 = OpCompositeExtract %mat4v2float %value 1
OpReturnValue %28 OpStore %33 %34
OpFunctionEnd %35 = OpCompositeExtract %uint %dest 0
%conv_arr4_S = OpFunction %_arr_S_uint_4 None %29 %37 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %35 %uint_2
%val_0 = OpFunctionParameter %_arr_S_std140_uint_4 %38 = OpCompositeExtract %int %value 2
%32 = OpLabel OpStore %37 %38
%arr = OpVariable %_ptr_Function__arr_S_uint_4 Function %35 OpReturn
%i = OpVariable %_ptr_Function_uint Function %38 OpFunctionEnd
%var_for_index = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function %51 %assign_and_preserve_padding_s = OpFunction %void None %39
OpBranch %39 %value_0 = OpFunctionParameter %_arr_S_uint_4
%39 = OpLabel %42 = OpLabel
OpLoopMerge %40 %41 None %i = OpVariable %_ptr_Function_uint Function %43
OpBranch %42 %var_for_index = OpVariable %_ptr_Function__arr_S_uint_4 Function %58
%42 = OpLabel OpStore %i %43
%44 = OpLoad %uint %i OpBranch %46
%45 = OpULessThan %bool %44 %uint_4 %46 = OpLabel
%43 = OpLogicalNot %bool %45 OpLoopMerge %47 %48 None
OpSelectionMerge %47 None OpBranch %49
OpBranchConditional %43 %48 %47 %49 = OpLabel
%48 = OpLabel %51 = OpLoad %uint %i
OpBranch %40 %52 = OpULessThan %bool %51 %uint_4
%47 = OpLabel %50 = OpLogicalNot %bool %52
OpStore %var_for_index %val_0 OpSelectionMerge %54 None
%52 = OpLoad %uint %i OpBranchConditional %50 %55 %54
%54 = OpAccessChain %_ptr_Function_S %arr %52 %55 = OpLabel
%56 = OpLoad %uint %i OpBranch %47
%58 = OpAccessChain %_ptr_Function_S_std140 %var_for_index %56 %54 = OpLabel
%59 = OpLoad %S_std140 %58 OpStore %var_for_index %value_0
%55 = OpFunctionCall %S %conv_S %59 %60 = OpLoad %uint %i
OpStore %54 %55 %61 = OpCompositeConstruct %_arr_uint_uint_1 %60
OpBranch %41 %62 = OpLoad %uint %i
%41 = OpLabel %64 = OpAccessChain %_ptr_Function_S %var_for_index %62
%60 = OpLoad %uint %i %65 = OpLoad %S %64
%62 = OpIAdd %uint %60 %uint_1 %59 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %61 %65
OpStore %i %62 OpBranch %48
OpBranch %39 %48 = OpLabel
%40 = OpLabel %66 = OpLoad %uint %i
%63 = OpLoad %_arr_S_uint_4 %arr %67 = OpIAdd %uint %66 %uint_1
OpReturnValue %63 OpStore %i %67
OpFunctionEnd OpBranch %46
%load_u_inner_2_m = OpFunction %mat4v2float None %64 %47 = OpLabel
%66 = OpLabel OpReturn
%71 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2 OpFunctionEnd
%74 = OpAccessChain %_ptr_Uniform_v2float %71 %uint_1 %conv_S = OpFunction %S None %68
%75 = OpLoad %v2float %74 %val = OpFunctionParameter %S_std140
%77 = OpAccessChain %_ptr_Uniform_v2float %71 %uint_2 %71 = OpLabel
%78 = OpLoad %v2float %77 %72 = OpCompositeExtract %int %val 0
%81 = OpAccessChain %_ptr_Uniform_v2float %71 %uint_3 %73 = OpCompositeExtract %v2float %val 1
%82 = OpLoad %v2float %81 %74 = OpCompositeExtract %v2float %val 2
%84 = OpAccessChain %_ptr_Uniform_v2float %71 %uint_4 %75 = OpCompositeExtract %v2float %val 3
%85 = OpLoad %v2float %84 %76 = OpCompositeExtract %v2float %val 4
%86 = OpCompositeConstruct %mat4v2float %75 %78 %82 %85 %77 = OpCompositeConstruct %mat4v2float %73 %74 %75 %76
OpReturnValue %86 %78 = OpCompositeExtract %int %val 5
OpFunctionEnd %79 = OpCompositeConstruct %S %72 %77 %78
%f = OpFunction %void None %87 OpReturnValue %79
%90 = OpLabel OpFunctionEnd
%92 = OpAccessChain %_ptr_StorageBuffer__arr_S_uint_4 %s %uint_0 %conv_arr4_S = OpFunction %_arr_S_uint_4 None %80
%95 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %u %uint_0 %val_0 = OpFunctionParameter %_arr_S_std140_uint_4
%96 = OpLoad %_arr_S_std140_uint_4 %95 %83 = OpLabel
%93 = OpFunctionCall %_arr_S_uint_4 %conv_arr4_S %96 %arr = OpVariable %_ptr_Function__arr_S_uint_4 Function %58
OpStore %92 %93 %i_0 = OpVariable %_ptr_Function_uint Function %43
%99 = OpAccessChain %_ptr_StorageBuffer_S %s %uint_0 %int_1 %var_for_index_1 = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function %97
%101 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2 OpBranch %86
%102 = OpLoad %S_std140 %101 %86 = OpLabel
%100 = OpFunctionCall %S %conv_S %102 OpLoopMerge %87 %88 None
OpStore %99 %100 OpBranch %89
%105 = OpAccessChain %_ptr_StorageBuffer_mat4v2float %s %uint_0 %int_3 %uint_1 %89 = OpLabel
%106 = OpFunctionCall %mat4v2float %load_u_inner_2_m %91 = OpLoad %uint %i_0
OpStore %105 %106 %92 = OpULessThan %bool %91 %uint_4
%109 = OpAccessChain %_ptr_StorageBuffer_v2float %s %uint_0 %int_1 %uint_1 %107 %90 = OpLogicalNot %bool %92
%110 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0 %38 %uint_2 OpSelectionMerge %93 None
%111 = OpLoad %v2float %110 OpBranchConditional %90 %94 %93
%112 = OpVectorShuffle %v2float %111 %111 1 0 %94 = OpLabel
OpStore %109 %112 OpBranch %87
%93 = OpLabel
OpStore %var_for_index_1 %val_0
%98 = OpLoad %uint %i_0
%99 = OpAccessChain %_ptr_Function_S %arr %98
%101 = OpLoad %uint %i_0
%103 = OpAccessChain %_ptr_Function_S_std140 %var_for_index_1 %101
%104 = OpLoad %S_std140 %103
%100 = OpFunctionCall %S %conv_S %104
OpStore %99 %100
OpBranch %88
%88 = OpLabel
%105 = OpLoad %uint %i_0
%106 = OpIAdd %uint %105 %uint_1
OpStore %i_0 %106
OpBranch %86
%87 = OpLabel
%107 = OpLoad %_arr_S_uint_4 %arr
OpReturnValue %107
OpFunctionEnd
%load_u_inner_2_m = OpFunction %mat4v2float None %108
%110 = OpLabel
%113 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%116 = OpAccessChain %_ptr_Uniform_v2float %113 %uint_1
%117 = OpLoad %v2float %116
%119 = OpAccessChain %_ptr_Uniform_v2float %113 %uint_2
%120 = OpLoad %v2float %119
%123 = OpAccessChain %_ptr_Uniform_v2float %113 %uint_3
%124 = OpLoad %v2float %123
%126 = OpAccessChain %_ptr_Uniform_v2float %113 %uint_4
%127 = OpLoad %v2float %126
%128 = OpCompositeConstruct %mat4v2float %117 %120 %124 %127
OpReturnValue %128
OpFunctionEnd
%f = OpFunction %void None %129
%131 = OpLabel
%135 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %u %uint_0
%136 = OpLoad %_arr_S_std140_uint_4 %135
%133 = OpFunctionCall %_arr_S_uint_4 %conv_arr4_S %136
%132 = OpFunctionCall %void %assign_and_preserve_padding_s %133
%140 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%141 = OpLoad %S_std140 %140
%139 = OpFunctionCall %S %conv_S %141
%137 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %138 %139
%143 = OpAccessChain %_ptr_StorageBuffer_mat4v2float %s %uint_0 %int_3 %uint_1
%144 = OpFunctionCall %mat4v2float %load_u_inner_2_m
OpStore %143 %144
%147 = OpAccessChain %_ptr_StorageBuffer_v2float %s %uint_0 %int_1 %uint_1 %26
%148 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0 %43 %uint_2
%149 = OpLoad %v2float %148
%150 = OpVectorShuffle %v2float %149 %149 1 0
OpStore %147 %150
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -68,6 +68,21 @@ layout(binding = 1, std430) buffer u_block_ssbo {
S inner[4]; S inner[4];
} s; } s;
void assign_and_preserve_padding_1_s_X(uint dest[1], S value) {
s.inner[dest[0]].before = value.before;
s.inner[dest[0]].m = value.m;
s.inner[dest[0]].after = value.after;
}
void assign_and_preserve_padding_s(S value[4]) {
{
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
uint tint_symbol[1] = uint[1](i);
assign_and_preserve_padding_1_s_X(tint_symbol, value[i]);
}
}
}
S conv_S(S_std140 val) { S conv_S(S_std140 val) {
return S(val.before, val.pad, f16mat4x3(val.m_0, val.m_1, val.m_2, val.m_3), val.pad_1, val.pad_2, val.pad_3, val.pad_4, val.pad_5, val.pad_6, val.after, val.pad_7, val.pad_8, val.pad_9, val.pad_10, val.pad_11, val.pad_12, val.pad_13, val.pad_14, val.pad_15, val.pad_16, val.pad_17, val.pad_18, val.pad_19, val.pad_20, val.pad_21); return S(val.before, val.pad, f16mat4x3(val.m_0, val.m_1, val.m_2, val.m_3), val.pad_1, val.pad_2, val.pad_3, val.pad_4, val.pad_5, val.pad_6, val.after, val.pad_7, val.pad_8, val.pad_9, val.pad_10, val.pad_11, val.pad_12, val.pad_13, val.pad_14, val.pad_15, val.pad_16, val.pad_17, val.pad_18, val.pad_19, val.pad_20, val.pad_21);
} }
@ -87,8 +102,9 @@ f16mat4x3 load_u_inner_2_m() {
} }
void f() { void f() {
s.inner = conv_arr4_S(u.inner); assign_and_preserve_padding_s(conv_arr4_S(u.inner));
s.inner[1] = conv_S(u.inner[2u]); uint tint_symbol_1[1] = uint[1](1u);
assign_and_preserve_padding_1_s_X(tint_symbol_1, conv_S(u.inner[2u]));
s.inner[3].m = load_u_inner_2_m(); s.inner[3].m = load_u_inner_2_m();
s.inner[1].m[0] = u.inner[0u].m_1.zxy; s.inner[1].m[0] = u.inner[0u].m_1.zxy;
} }

View File

@ -23,9 +23,21 @@ struct S {
/* 0x0044 */ tint_array<int8_t, 60> tint_pad_2; /* 0x0044 */ tint_array<int8_t, 60> tint_pad_2;
}; };
void assign_and_preserve_padding_1(device S* const dest, S value) {
(*(dest)).before = value.before;
(*(dest)).m = value.m;
(*(dest)).after = value.after;
}
void assign_and_preserve_padding(device tint_array<S, 4>* const dest, tint_array<S, 4> value) {
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
assign_and_preserve_padding_1(&((*(dest))[i]), value[i]);
}
}
kernel void f(device tint_array<S, 4>* tint_symbol [[buffer(1)]], const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) { kernel void f(device tint_array<S, 4>* tint_symbol [[buffer(1)]], const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) {
*(tint_symbol) = *(tint_symbol_1); assign_and_preserve_padding(tint_symbol, *(tint_symbol_1));
(*(tint_symbol))[1] = (*(tint_symbol_1))[2]; assign_and_preserve_padding_1(&((*(tint_symbol))[1]), (*(tint_symbol_1))[2]);
(*(tint_symbol))[3].m = (*(tint_symbol_1))[2].m; (*(tint_symbol))[3].m = (*(tint_symbol_1))[2].m;
(*(tint_symbol))[1].m[0] = half3((*(tint_symbol_1))[0].m[1]).zxy; (*(tint_symbol))[1].m[0] = half3((*(tint_symbol_1))[0].m[1]).zxy;
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: 113 ; Bound: 151
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpCapability Float16 OpCapability Float16
@ -28,13 +28,20 @@
OpMemberName %S 1 "m" OpMemberName %S 1 "m"
OpMemberName %S 2 "after" OpMemberName %S 2 "after"
OpName %s "s" OpName %s "s"
OpName %assign_and_preserve_padding_1_s_X "assign_and_preserve_padding_1_s_X"
OpName %dest "dest"
OpName %value "value"
OpName %assign_and_preserve_padding_s "assign_and_preserve_padding_s"
OpName %value_0 "value"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %conv_S "conv_S" OpName %conv_S "conv_S"
OpName %val "val" OpName %val "val"
OpName %conv_arr4_S "conv_arr4_S" OpName %conv_arr4_S "conv_arr4_S"
OpName %val_0 "val" OpName %val_0 "val"
OpName %arr "arr" OpName %arr "arr"
OpName %i "i" OpName %i_0 "i"
OpName %var_for_index "var_for_index" OpName %var_for_index_1 "var_for_index_1"
OpName %load_u_inner_2_m "load_u_inner_2_m" OpName %load_u_inner_2_m "load_u_inner_2_m"
OpName %f "f" OpName %f "f"
OpDecorate %u_block_std140 Block OpDecorate %u_block_std140 Block
@ -59,6 +66,7 @@
OpDecorate %_arr_S_uint_4 ArrayStride 128 OpDecorate %_arr_S_uint_4 ArrayStride 128
OpDecorate %s DescriptorSet 0 OpDecorate %s DescriptorSet 0
OpDecorate %s Binding 1 OpDecorate %s Binding 1
OpDecorate %_arr_uint_uint_1 ArrayStride 4
%int = OpTypeInt 32 1 %int = OpTypeInt 32 1
%half = OpTypeFloat 16 %half = OpTypeFloat 16
%v3half = OpTypeVector %half 3 %v3half = OpTypeVector %half 3
@ -75,117 +83,171 @@
%u_block = OpTypeStruct %_arr_S_uint_4 %u_block = OpTypeStruct %_arr_S_uint_4
%_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block %_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block
%s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer %s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer
%17 = OpTypeFunction %S %S_std140 %void = OpTypeVoid
%29 = OpTypeFunction %_arr_S_uint_4 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%35 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_uint = OpTypePointer Function %uint
%38 = OpConstantNull %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
%51 = OpConstantNull %_arr_S_std140_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
%uint_1 = OpConstant %uint 1 %uint_1 = OpConstant %uint 1
%64 = OpTypeFunction %mat4v3half %_arr_uint_uint_1 = OpTypeArray %uint %uint_1
%17 = OpTypeFunction %void %_arr_uint_uint_1 %S
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%26 = OpConstantNull %int
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%_ptr_StorageBuffer_mat4v3half = OpTypePointer StorageBuffer %mat4v3half
%uint_2 = OpConstant %uint 2 %uint_2 = OpConstant %uint 2
%39 = OpTypeFunction %void %_arr_S_uint_4
%43 = OpConstantNull %uint
%_ptr_Function_uint = OpTypePointer Function %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%58 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%68 = OpTypeFunction %S %S_std140
%80 = OpTypeFunction %_arr_S_uint_4 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
%97 = OpConstantNull %_arr_S_std140_uint_4
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
%108 = OpTypeFunction %mat4v3half
%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140 %_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140
%_ptr_Uniform_v3half = OpTypePointer Uniform %v3half %_ptr_Uniform_v3half = OpTypePointer Uniform %v3half
%uint_3 = OpConstant %uint 3 %uint_3 = OpConstant %uint 3
%void = OpTypeVoid %129 = OpTypeFunction %void
%87 = OpTypeFunction %void
%_ptr_StorageBuffer__arr_S_uint_4 = OpTypePointer StorageBuffer %_arr_S_uint_4
%_ptr_Uniform__arr_S_std140_uint_4 = OpTypePointer Uniform %_arr_S_std140_uint_4 %_ptr_Uniform__arr_S_std140_uint_4 = OpTypePointer Uniform %_arr_S_std140_uint_4
%int_1 = OpConstant %int 1 %138 = OpConstantComposite %_arr_uint_uint_1 %uint_1
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
%int_3 = OpConstant %int 3 %int_3 = OpConstant %int 3
%_ptr_StorageBuffer_mat4v3half = OpTypePointer StorageBuffer %mat4v3half %int_1 = OpConstant %int 1
%107 = OpConstantNull %int
%_ptr_StorageBuffer_v3half = OpTypePointer StorageBuffer %v3half %_ptr_StorageBuffer_v3half = OpTypePointer StorageBuffer %v3half
%conv_S = OpFunction %S None %17 %assign_and_preserve_padding_1_s_X = OpFunction %void None %17
%val = OpFunctionParameter %S_std140 %dest = OpFunctionParameter %_arr_uint_uint_1
%20 = OpLabel %value = OpFunctionParameter %S
%21 = OpCompositeExtract %int %val 0 %24 = OpLabel
%22 = OpCompositeExtract %v3half %val 1 %27 = OpCompositeExtract %uint %dest 0
%23 = OpCompositeExtract %v3half %val 2 %29 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %27 %uint_0
%24 = OpCompositeExtract %v3half %val 3 %30 = OpCompositeExtract %int %value 0
%25 = OpCompositeExtract %v3half %val 4 OpStore %29 %30
%26 = OpCompositeConstruct %mat4v3half %22 %23 %24 %25 %31 = OpCompositeExtract %uint %dest 0
%27 = OpCompositeExtract %int %val 5 %33 = OpAccessChain %_ptr_StorageBuffer_mat4v3half %s %uint_0 %31 %uint_1
%28 = OpCompositeConstruct %S %21 %26 %27 %34 = OpCompositeExtract %mat4v3half %value 1
OpReturnValue %28 OpStore %33 %34
OpFunctionEnd %35 = OpCompositeExtract %uint %dest 0
%conv_arr4_S = OpFunction %_arr_S_uint_4 None %29 %37 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %35 %uint_2
%val_0 = OpFunctionParameter %_arr_S_std140_uint_4 %38 = OpCompositeExtract %int %value 2
%32 = OpLabel OpStore %37 %38
%arr = OpVariable %_ptr_Function__arr_S_uint_4 Function %35 OpReturn
%i = OpVariable %_ptr_Function_uint Function %38 OpFunctionEnd
%var_for_index = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function %51 %assign_and_preserve_padding_s = OpFunction %void None %39
OpBranch %39 %value_0 = OpFunctionParameter %_arr_S_uint_4
%39 = OpLabel %42 = OpLabel
OpLoopMerge %40 %41 None %i = OpVariable %_ptr_Function_uint Function %43
OpBranch %42 %var_for_index = OpVariable %_ptr_Function__arr_S_uint_4 Function %58
%42 = OpLabel OpStore %i %43
%44 = OpLoad %uint %i OpBranch %46
%45 = OpULessThan %bool %44 %uint_4 %46 = OpLabel
%43 = OpLogicalNot %bool %45 OpLoopMerge %47 %48 None
OpSelectionMerge %47 None OpBranch %49
OpBranchConditional %43 %48 %47 %49 = OpLabel
%48 = OpLabel %51 = OpLoad %uint %i
OpBranch %40 %52 = OpULessThan %bool %51 %uint_4
%47 = OpLabel %50 = OpLogicalNot %bool %52
OpStore %var_for_index %val_0 OpSelectionMerge %54 None
%52 = OpLoad %uint %i OpBranchConditional %50 %55 %54
%54 = OpAccessChain %_ptr_Function_S %arr %52 %55 = OpLabel
%56 = OpLoad %uint %i OpBranch %47
%58 = OpAccessChain %_ptr_Function_S_std140 %var_for_index %56 %54 = OpLabel
%59 = OpLoad %S_std140 %58 OpStore %var_for_index %value_0
%55 = OpFunctionCall %S %conv_S %59 %60 = OpLoad %uint %i
OpStore %54 %55 %61 = OpCompositeConstruct %_arr_uint_uint_1 %60
OpBranch %41 %62 = OpLoad %uint %i
%41 = OpLabel %64 = OpAccessChain %_ptr_Function_S %var_for_index %62
%60 = OpLoad %uint %i %65 = OpLoad %S %64
%62 = OpIAdd %uint %60 %uint_1 %59 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %61 %65
OpStore %i %62 OpBranch %48
OpBranch %39 %48 = OpLabel
%40 = OpLabel %66 = OpLoad %uint %i
%63 = OpLoad %_arr_S_uint_4 %arr %67 = OpIAdd %uint %66 %uint_1
OpReturnValue %63 OpStore %i %67
OpFunctionEnd OpBranch %46
%load_u_inner_2_m = OpFunction %mat4v3half None %64 %47 = OpLabel
%66 = OpLabel OpReturn
%71 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2 OpFunctionEnd
%74 = OpAccessChain %_ptr_Uniform_v3half %71 %uint_1 %conv_S = OpFunction %S None %68
%75 = OpLoad %v3half %74 %val = OpFunctionParameter %S_std140
%77 = OpAccessChain %_ptr_Uniform_v3half %71 %uint_2 %71 = OpLabel
%78 = OpLoad %v3half %77 %72 = OpCompositeExtract %int %val 0
%81 = OpAccessChain %_ptr_Uniform_v3half %71 %uint_3 %73 = OpCompositeExtract %v3half %val 1
%82 = OpLoad %v3half %81 %74 = OpCompositeExtract %v3half %val 2
%84 = OpAccessChain %_ptr_Uniform_v3half %71 %uint_4 %75 = OpCompositeExtract %v3half %val 3
%85 = OpLoad %v3half %84 %76 = OpCompositeExtract %v3half %val 4
%86 = OpCompositeConstruct %mat4v3half %75 %78 %82 %85 %77 = OpCompositeConstruct %mat4v3half %73 %74 %75 %76
OpReturnValue %86 %78 = OpCompositeExtract %int %val 5
OpFunctionEnd %79 = OpCompositeConstruct %S %72 %77 %78
%f = OpFunction %void None %87 OpReturnValue %79
%90 = OpLabel OpFunctionEnd
%92 = OpAccessChain %_ptr_StorageBuffer__arr_S_uint_4 %s %uint_0 %conv_arr4_S = OpFunction %_arr_S_uint_4 None %80
%95 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %u %uint_0 %val_0 = OpFunctionParameter %_arr_S_std140_uint_4
%96 = OpLoad %_arr_S_std140_uint_4 %95 %83 = OpLabel
%93 = OpFunctionCall %_arr_S_uint_4 %conv_arr4_S %96 %arr = OpVariable %_ptr_Function__arr_S_uint_4 Function %58
OpStore %92 %93 %i_0 = OpVariable %_ptr_Function_uint Function %43
%99 = OpAccessChain %_ptr_StorageBuffer_S %s %uint_0 %int_1 %var_for_index_1 = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function %97
%101 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2 OpBranch %86
%102 = OpLoad %S_std140 %101 %86 = OpLabel
%100 = OpFunctionCall %S %conv_S %102 OpLoopMerge %87 %88 None
OpStore %99 %100 OpBranch %89
%105 = OpAccessChain %_ptr_StorageBuffer_mat4v3half %s %uint_0 %int_3 %uint_1 %89 = OpLabel
%106 = OpFunctionCall %mat4v3half %load_u_inner_2_m %91 = OpLoad %uint %i_0
OpStore %105 %106 %92 = OpULessThan %bool %91 %uint_4
%109 = OpAccessChain %_ptr_StorageBuffer_v3half %s %uint_0 %int_1 %uint_1 %107 %90 = OpLogicalNot %bool %92
%110 = OpAccessChain %_ptr_Uniform_v3half %u %uint_0 %38 %uint_2 OpSelectionMerge %93 None
%111 = OpLoad %v3half %110 OpBranchConditional %90 %94 %93
%112 = OpVectorShuffle %v3half %111 %111 2 0 1 %94 = OpLabel
OpStore %109 %112 OpBranch %87
%93 = OpLabel
OpStore %var_for_index_1 %val_0
%98 = OpLoad %uint %i_0
%99 = OpAccessChain %_ptr_Function_S %arr %98
%101 = OpLoad %uint %i_0
%103 = OpAccessChain %_ptr_Function_S_std140 %var_for_index_1 %101
%104 = OpLoad %S_std140 %103
%100 = OpFunctionCall %S %conv_S %104
OpStore %99 %100
OpBranch %88
%88 = OpLabel
%105 = OpLoad %uint %i_0
%106 = OpIAdd %uint %105 %uint_1
OpStore %i_0 %106
OpBranch %86
%87 = OpLabel
%107 = OpLoad %_arr_S_uint_4 %arr
OpReturnValue %107
OpFunctionEnd
%load_u_inner_2_m = OpFunction %mat4v3half None %108
%110 = OpLabel
%113 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%116 = OpAccessChain %_ptr_Uniform_v3half %113 %uint_1
%117 = OpLoad %v3half %116
%119 = OpAccessChain %_ptr_Uniform_v3half %113 %uint_2
%120 = OpLoad %v3half %119
%123 = OpAccessChain %_ptr_Uniform_v3half %113 %uint_3
%124 = OpLoad %v3half %123
%126 = OpAccessChain %_ptr_Uniform_v3half %113 %uint_4
%127 = OpLoad %v3half %126
%128 = OpCompositeConstruct %mat4v3half %117 %120 %124 %127
OpReturnValue %128
OpFunctionEnd
%f = OpFunction %void None %129
%131 = OpLabel
%135 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %u %uint_0
%136 = OpLoad %_arr_S_std140_uint_4 %135
%133 = OpFunctionCall %_arr_S_uint_4 %conv_arr4_S %136
%132 = OpFunctionCall %void %assign_and_preserve_padding_s %133
%140 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%141 = OpLoad %S_std140 %140
%139 = OpFunctionCall %S %conv_S %141
%137 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %138 %139
%143 = OpAccessChain %_ptr_StorageBuffer_mat4v3half %s %uint_0 %int_3 %uint_1
%144 = OpFunctionCall %mat4v3half %load_u_inner_2_m
OpStore %143 %144
%147 = OpAccessChain %_ptr_StorageBuffer_v3half %s %uint_0 %int_1 %uint_1 %26
%148 = OpAccessChain %_ptr_Uniform_v3half %u %uint_0 %43 %uint_2
%149 = OpLoad %v3half %148
%150 = OpVectorShuffle %v3half %149 %149 2 0 1
OpStore %147 %150
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -44,9 +44,25 @@ layout(binding = 1, std430) buffer u_block_ssbo {
S inner[4]; S inner[4];
} s; } s;
void assign_and_preserve_padding_1_s_X(uint dest[1], S value) {
s.inner[dest[0]].before = value.before;
s.inner[dest[0]].m = value.m;
s.inner[dest[0]].after = value.after;
}
void assign_and_preserve_padding_s(S value[4]) {
{
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
uint tint_symbol[1] = uint[1](i);
assign_and_preserve_padding_1_s_X(tint_symbol, value[i]);
}
}
}
void f() { void f() {
s.inner = u.inner; assign_and_preserve_padding_s(u.inner);
s.inner[1] = u.inner[2]; uint tint_symbol_1[1] = uint[1](1u);
assign_and_preserve_padding_1_s_X(tint_symbol_1, u.inner[2]);
s.inner[3].m = u.inner[2].m; s.inner[3].m = u.inner[2].m;
s.inner[1].m[0] = u.inner[0].m[1].zxy; s.inner[1].m[0] = u.inner[0].m[1].zxy;
} }

View File

@ -23,9 +23,21 @@ struct S {
/* 0x0084 */ tint_array<int8_t, 60> tint_pad_2; /* 0x0084 */ tint_array<int8_t, 60> tint_pad_2;
}; };
void assign_and_preserve_padding_1(device S* const dest, S value) {
(*(dest)).before = value.before;
(*(dest)).m = value.m;
(*(dest)).after = value.after;
}
void assign_and_preserve_padding(device tint_array<S, 4>* const dest, tint_array<S, 4> value) {
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
assign_and_preserve_padding_1(&((*(dest))[i]), value[i]);
}
}
kernel void f(device tint_array<S, 4>* tint_symbol [[buffer(1)]], const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) { kernel void f(device tint_array<S, 4>* tint_symbol [[buffer(1)]], const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) {
*(tint_symbol) = *(tint_symbol_1); assign_and_preserve_padding(tint_symbol, *(tint_symbol_1));
(*(tint_symbol))[1] = (*(tint_symbol_1))[2]; assign_and_preserve_padding_1(&((*(tint_symbol))[1]), (*(tint_symbol_1))[2]);
(*(tint_symbol))[3].m = (*(tint_symbol_1))[2].m; (*(tint_symbol))[3].m = (*(tint_symbol_1))[2].m;
(*(tint_symbol))[1].m[0] = float3((*(tint_symbol_1))[0].m[1]).zxy; (*(tint_symbol))[1].m[0] = float3((*(tint_symbol_1))[0].m[1]).zxy;
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: 45 ; Bound: 90
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
@ -15,6 +15,13 @@
OpMemberName %S 2 "after" OpMemberName %S 2 "after"
OpName %u "u" OpName %u "u"
OpName %s "s" OpName %s "s"
OpName %assign_and_preserve_padding_1_s_X "assign_and_preserve_padding_1_s_X"
OpName %dest "dest"
OpName %value "value"
OpName %assign_and_preserve_padding_s "assign_and_preserve_padding_s"
OpName %value_0 "value"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %f "f" OpName %f "f"
OpDecorate %u_block Block OpDecorate %u_block Block
OpMemberDecorate %u_block 0 Offset 0 OpMemberDecorate %u_block 0 Offset 0
@ -29,6 +36,7 @@
OpDecorate %u Binding 0 OpDecorate %u Binding 0
OpDecorate %s DescriptorSet 0 OpDecorate %s DescriptorSet 0
OpDecorate %s Binding 1 OpDecorate %s Binding 1
OpDecorate %_arr_uint_uint_1 ArrayStride 4
%int = OpTypeInt 32 1 %int = OpTypeInt 32 1
%float = OpTypeFloat 32 %float = OpTypeFloat 32
%v3float = OpTypeVector %float 3 %v3float = OpTypeVector %float 3
@ -43,39 +51,100 @@
%_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block %_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block
%s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer %s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer
%void = OpTypeVoid %void = OpTypeVoid
%14 = OpTypeFunction %void %uint_1 = OpConstant %uint 1
%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
%14 = OpTypeFunction %void %_arr_uint_uint_1 %S
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer__arr_S_uint_4 = OpTypePointer StorageBuffer %_arr_S_uint_4 %23 = OpConstantNull %int
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%_ptr_StorageBuffer_mat4v3float = OpTypePointer StorageBuffer %mat4v3float
%uint_2 = OpConstant %uint 2
%36 = OpTypeFunction %void %_arr_S_uint_4
%40 = OpConstantNull %uint
%_ptr_Function_uint = OpTypePointer Function %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%55 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%65 = OpTypeFunction %void
%_ptr_Uniform__arr_S_uint_4 = OpTypePointer Uniform %_arr_S_uint_4 %_ptr_Uniform__arr_S_uint_4 = OpTypePointer Uniform %_arr_S_uint_4
%int_1 = OpConstant %int 1 %73 = OpConstantComposite %_arr_uint_uint_1 %uint_1
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
%int_2 = OpConstant %int 2 %int_2 = OpConstant %int 2
%_ptr_Uniform_S = OpTypePointer Uniform %S %_ptr_Uniform_S = OpTypePointer Uniform %S
%int_3 = OpConstant %int 3 %int_3 = OpConstant %int 3
%uint_1 = OpConstant %uint 1
%_ptr_StorageBuffer_mat4v3float = OpTypePointer StorageBuffer %mat4v3float
%_ptr_Uniform_mat4v3float = OpTypePointer Uniform %mat4v3float %_ptr_Uniform_mat4v3float = OpTypePointer Uniform %mat4v3float
%38 = OpConstantNull %int %int_1 = OpConstant %int 1
%_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float %_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float
%_ptr_Uniform_v3float = OpTypePointer Uniform %v3float %_ptr_Uniform_v3float = OpTypePointer Uniform %v3float
%f = OpFunction %void None %14 %assign_and_preserve_padding_1_s_X = OpFunction %void None %14
%17 = OpLabel %dest = OpFunctionParameter %_arr_uint_uint_1
%20 = OpAccessChain %_ptr_StorageBuffer__arr_S_uint_4 %s %uint_0 %value = OpFunctionParameter %S
%22 = OpAccessChain %_ptr_Uniform__arr_S_uint_4 %u %uint_0 %21 = OpLabel
%23 = OpLoad %_arr_S_uint_4 %22 %24 = OpCompositeExtract %uint %dest 0
OpStore %20 %23 %26 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %24 %uint_0
%26 = OpAccessChain %_ptr_StorageBuffer_S %s %uint_0 %int_1 %27 = OpCompositeExtract %int %value 0
%29 = OpAccessChain %_ptr_Uniform_S %u %uint_0 %int_2 OpStore %26 %27
%30 = OpLoad %S %29 %28 = OpCompositeExtract %uint %dest 0
OpStore %26 %30 %30 = OpAccessChain %_ptr_StorageBuffer_mat4v3float %s %uint_0 %28 %uint_1
%34 = OpAccessChain %_ptr_StorageBuffer_mat4v3float %s %uint_0 %int_3 %uint_1 %31 = OpCompositeExtract %mat4v3float %value 1
%36 = OpAccessChain %_ptr_Uniform_mat4v3float %u %uint_0 %int_2 %uint_1 OpStore %30 %31
%37 = OpLoad %mat4v3float %36 %32 = OpCompositeExtract %uint %dest 0
OpStore %34 %37 %34 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %32 %uint_2
%40 = OpAccessChain %_ptr_StorageBuffer_v3float %s %uint_0 %int_1 %uint_1 %38 %35 = OpCompositeExtract %int %value 2
%42 = OpAccessChain %_ptr_Uniform_v3float %u %uint_0 %38 %uint_1 %int_1 OpStore %34 %35
%43 = OpLoad %v3float %42 OpReturn
%44 = OpVectorShuffle %v3float %43 %43 2 0 1 OpFunctionEnd
OpStore %40 %44 %assign_and_preserve_padding_s = OpFunction %void None %36
%value_0 = OpFunctionParameter %_arr_S_uint_4
%39 = OpLabel
%i = OpVariable %_ptr_Function_uint Function %40
%var_for_index = OpVariable %_ptr_Function__arr_S_uint_4 Function %55
OpStore %i %40
OpBranch %43
%43 = OpLabel
OpLoopMerge %44 %45 None
OpBranch %46
%46 = OpLabel
%48 = OpLoad %uint %i
%49 = OpULessThan %bool %48 %uint_4
%47 = OpLogicalNot %bool %49
OpSelectionMerge %51 None
OpBranchConditional %47 %52 %51
%52 = OpLabel
OpBranch %44
%51 = OpLabel
OpStore %var_for_index %value_0
%57 = OpLoad %uint %i
%58 = OpCompositeConstruct %_arr_uint_uint_1 %57
%59 = OpLoad %uint %i
%61 = OpAccessChain %_ptr_Function_S %var_for_index %59
%62 = OpLoad %S %61
%56 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %58 %62
OpBranch %45
%45 = OpLabel
%63 = OpLoad %uint %i
%64 = OpIAdd %uint %63 %uint_1
OpStore %i %64
OpBranch %43
%44 = OpLabel
OpReturn
OpFunctionEnd
%f = OpFunction %void None %65
%67 = OpLabel
%70 = OpAccessChain %_ptr_Uniform__arr_S_uint_4 %u %uint_0
%71 = OpLoad %_arr_S_uint_4 %70
%68 = OpFunctionCall %void %assign_and_preserve_padding_s %71
%76 = OpAccessChain %_ptr_Uniform_S %u %uint_0 %int_2
%77 = OpLoad %S %76
%72 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %73 %77
%79 = OpAccessChain %_ptr_StorageBuffer_mat4v3float %s %uint_0 %int_3 %uint_1
%81 = OpAccessChain %_ptr_Uniform_mat4v3float %u %uint_0 %int_2 %uint_1
%82 = OpLoad %mat4v3float %81
OpStore %79 %82
%85 = OpAccessChain %_ptr_StorageBuffer_v3float %s %uint_0 %int_1 %uint_1 %23
%87 = OpAccessChain %_ptr_Uniform_v3float %u %uint_0 %23 %uint_1 %int_1
%88 = OpLoad %v3float %87
%89 = OpVectorShuffle %v3float %88 %88 2 0 1
OpStore %85 %89
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -68,6 +68,21 @@ layout(binding = 1, std430) buffer u_block_ssbo {
S inner[4]; S inner[4];
} s; } s;
void assign_and_preserve_padding_1_s_X(uint dest[1], S value) {
s.inner[dest[0]].before = value.before;
s.inner[dest[0]].m = value.m;
s.inner[dest[0]].after = value.after;
}
void assign_and_preserve_padding_s(S value[4]) {
{
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
uint tint_symbol[1] = uint[1](i);
assign_and_preserve_padding_1_s_X(tint_symbol, value[i]);
}
}
}
S conv_S(S_std140 val) { S conv_S(S_std140 val) {
return S(val.before, val.pad, f16mat4(val.m_0, val.m_1, val.m_2, val.m_3), val.pad_1, val.pad_2, val.pad_3, val.pad_4, val.pad_5, val.pad_6, val.after, val.pad_7, val.pad_8, val.pad_9, val.pad_10, val.pad_11, val.pad_12, val.pad_13, val.pad_14, val.pad_15, val.pad_16, val.pad_17, val.pad_18, val.pad_19, val.pad_20, val.pad_21); return S(val.before, val.pad, f16mat4(val.m_0, val.m_1, val.m_2, val.m_3), val.pad_1, val.pad_2, val.pad_3, val.pad_4, val.pad_5, val.pad_6, val.after, val.pad_7, val.pad_8, val.pad_9, val.pad_10, val.pad_11, val.pad_12, val.pad_13, val.pad_14, val.pad_15, val.pad_16, val.pad_17, val.pad_18, val.pad_19, val.pad_20, val.pad_21);
} }
@ -87,8 +102,9 @@ f16mat4 load_u_inner_2_m() {
} }
void f() { void f() {
s.inner = conv_arr4_S(u.inner); assign_and_preserve_padding_s(conv_arr4_S(u.inner));
s.inner[1] = conv_S(u.inner[2u]); uint tint_symbol_1[1] = uint[1](1u);
assign_and_preserve_padding_1_s_X(tint_symbol_1, conv_S(u.inner[2u]));
s.inner[3].m = load_u_inner_2_m(); s.inner[3].m = load_u_inner_2_m();
s.inner[1].m[0] = u.inner[0u].m_1.ywxz; s.inner[1].m[0] = u.inner[0u].m_1.ywxz;
} }

View File

@ -23,9 +23,21 @@ struct S {
/* 0x0044 */ tint_array<int8_t, 60> tint_pad_2; /* 0x0044 */ tint_array<int8_t, 60> tint_pad_2;
}; };
void assign_and_preserve_padding_1(device S* const dest, S value) {
(*(dest)).before = value.before;
(*(dest)).m = value.m;
(*(dest)).after = value.after;
}
void assign_and_preserve_padding(device tint_array<S, 4>* const dest, tint_array<S, 4> value) {
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
assign_and_preserve_padding_1(&((*(dest))[i]), value[i]);
}
}
kernel void f(device tint_array<S, 4>* tint_symbol [[buffer(1)]], const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) { kernel void f(device tint_array<S, 4>* tint_symbol [[buffer(1)]], const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) {
*(tint_symbol) = *(tint_symbol_1); assign_and_preserve_padding(tint_symbol, *(tint_symbol_1));
(*(tint_symbol))[1] = (*(tint_symbol_1))[2]; assign_and_preserve_padding_1(&((*(tint_symbol))[1]), (*(tint_symbol_1))[2]);
(*(tint_symbol))[3].m = (*(tint_symbol_1))[2].m; (*(tint_symbol))[3].m = (*(tint_symbol_1))[2].m;
(*(tint_symbol))[1].m[0] = half4((*(tint_symbol_1))[0].m[1]).ywxz; (*(tint_symbol))[1].m[0] = half4((*(tint_symbol_1))[0].m[1]).ywxz;
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: 113 ; Bound: 151
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpCapability Float16 OpCapability Float16
@ -28,13 +28,20 @@
OpMemberName %S 1 "m" OpMemberName %S 1 "m"
OpMemberName %S 2 "after" OpMemberName %S 2 "after"
OpName %s "s" OpName %s "s"
OpName %assign_and_preserve_padding_1_s_X "assign_and_preserve_padding_1_s_X"
OpName %dest "dest"
OpName %value "value"
OpName %assign_and_preserve_padding_s "assign_and_preserve_padding_s"
OpName %value_0 "value"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %conv_S "conv_S" OpName %conv_S "conv_S"
OpName %val "val" OpName %val "val"
OpName %conv_arr4_S "conv_arr4_S" OpName %conv_arr4_S "conv_arr4_S"
OpName %val_0 "val" OpName %val_0 "val"
OpName %arr "arr" OpName %arr "arr"
OpName %i "i" OpName %i_0 "i"
OpName %var_for_index "var_for_index" OpName %var_for_index_1 "var_for_index_1"
OpName %load_u_inner_2_m "load_u_inner_2_m" OpName %load_u_inner_2_m "load_u_inner_2_m"
OpName %f "f" OpName %f "f"
OpDecorate %u_block_std140 Block OpDecorate %u_block_std140 Block
@ -59,6 +66,7 @@
OpDecorate %_arr_S_uint_4 ArrayStride 128 OpDecorate %_arr_S_uint_4 ArrayStride 128
OpDecorate %s DescriptorSet 0 OpDecorate %s DescriptorSet 0
OpDecorate %s Binding 1 OpDecorate %s Binding 1
OpDecorate %_arr_uint_uint_1 ArrayStride 4
%int = OpTypeInt 32 1 %int = OpTypeInt 32 1
%half = OpTypeFloat 16 %half = OpTypeFloat 16
%v4half = OpTypeVector %half 4 %v4half = OpTypeVector %half 4
@ -75,117 +83,171 @@
%u_block = OpTypeStruct %_arr_S_uint_4 %u_block = OpTypeStruct %_arr_S_uint_4
%_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block %_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block
%s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer %s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer
%17 = OpTypeFunction %S %S_std140 %void = OpTypeVoid
%29 = OpTypeFunction %_arr_S_uint_4 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%35 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_uint = OpTypePointer Function %uint
%38 = OpConstantNull %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
%51 = OpConstantNull %_arr_S_std140_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
%uint_1 = OpConstant %uint 1 %uint_1 = OpConstant %uint 1
%64 = OpTypeFunction %mat4v4half %_arr_uint_uint_1 = OpTypeArray %uint %uint_1
%17 = OpTypeFunction %void %_arr_uint_uint_1 %S
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%26 = OpConstantNull %int
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%_ptr_StorageBuffer_mat4v4half = OpTypePointer StorageBuffer %mat4v4half
%uint_2 = OpConstant %uint 2 %uint_2 = OpConstant %uint 2
%39 = OpTypeFunction %void %_arr_S_uint_4
%43 = OpConstantNull %uint
%_ptr_Function_uint = OpTypePointer Function %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%58 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%68 = OpTypeFunction %S %S_std140
%80 = OpTypeFunction %_arr_S_uint_4 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
%97 = OpConstantNull %_arr_S_std140_uint_4
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
%108 = OpTypeFunction %mat4v4half
%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140 %_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140
%_ptr_Uniform_v4half = OpTypePointer Uniform %v4half %_ptr_Uniform_v4half = OpTypePointer Uniform %v4half
%uint_3 = OpConstant %uint 3 %uint_3 = OpConstant %uint 3
%void = OpTypeVoid %129 = OpTypeFunction %void
%87 = OpTypeFunction %void
%_ptr_StorageBuffer__arr_S_uint_4 = OpTypePointer StorageBuffer %_arr_S_uint_4
%_ptr_Uniform__arr_S_std140_uint_4 = OpTypePointer Uniform %_arr_S_std140_uint_4 %_ptr_Uniform__arr_S_std140_uint_4 = OpTypePointer Uniform %_arr_S_std140_uint_4
%int_1 = OpConstant %int 1 %138 = OpConstantComposite %_arr_uint_uint_1 %uint_1
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
%int_3 = OpConstant %int 3 %int_3 = OpConstant %int 3
%_ptr_StorageBuffer_mat4v4half = OpTypePointer StorageBuffer %mat4v4half %int_1 = OpConstant %int 1
%107 = OpConstantNull %int
%_ptr_StorageBuffer_v4half = OpTypePointer StorageBuffer %v4half %_ptr_StorageBuffer_v4half = OpTypePointer StorageBuffer %v4half
%conv_S = OpFunction %S None %17 %assign_and_preserve_padding_1_s_X = OpFunction %void None %17
%val = OpFunctionParameter %S_std140 %dest = OpFunctionParameter %_arr_uint_uint_1
%20 = OpLabel %value = OpFunctionParameter %S
%21 = OpCompositeExtract %int %val 0 %24 = OpLabel
%22 = OpCompositeExtract %v4half %val 1 %27 = OpCompositeExtract %uint %dest 0
%23 = OpCompositeExtract %v4half %val 2 %29 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %27 %uint_0
%24 = OpCompositeExtract %v4half %val 3 %30 = OpCompositeExtract %int %value 0
%25 = OpCompositeExtract %v4half %val 4 OpStore %29 %30
%26 = OpCompositeConstruct %mat4v4half %22 %23 %24 %25 %31 = OpCompositeExtract %uint %dest 0
%27 = OpCompositeExtract %int %val 5 %33 = OpAccessChain %_ptr_StorageBuffer_mat4v4half %s %uint_0 %31 %uint_1
%28 = OpCompositeConstruct %S %21 %26 %27 %34 = OpCompositeExtract %mat4v4half %value 1
OpReturnValue %28 OpStore %33 %34
OpFunctionEnd %35 = OpCompositeExtract %uint %dest 0
%conv_arr4_S = OpFunction %_arr_S_uint_4 None %29 %37 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %35 %uint_2
%val_0 = OpFunctionParameter %_arr_S_std140_uint_4 %38 = OpCompositeExtract %int %value 2
%32 = OpLabel OpStore %37 %38
%arr = OpVariable %_ptr_Function__arr_S_uint_4 Function %35 OpReturn
%i = OpVariable %_ptr_Function_uint Function %38 OpFunctionEnd
%var_for_index = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function %51 %assign_and_preserve_padding_s = OpFunction %void None %39
OpBranch %39 %value_0 = OpFunctionParameter %_arr_S_uint_4
%39 = OpLabel %42 = OpLabel
OpLoopMerge %40 %41 None %i = OpVariable %_ptr_Function_uint Function %43
OpBranch %42 %var_for_index = OpVariable %_ptr_Function__arr_S_uint_4 Function %58
%42 = OpLabel OpStore %i %43
%44 = OpLoad %uint %i OpBranch %46
%45 = OpULessThan %bool %44 %uint_4 %46 = OpLabel
%43 = OpLogicalNot %bool %45 OpLoopMerge %47 %48 None
OpSelectionMerge %47 None OpBranch %49
OpBranchConditional %43 %48 %47 %49 = OpLabel
%48 = OpLabel %51 = OpLoad %uint %i
OpBranch %40 %52 = OpULessThan %bool %51 %uint_4
%47 = OpLabel %50 = OpLogicalNot %bool %52
OpStore %var_for_index %val_0 OpSelectionMerge %54 None
%52 = OpLoad %uint %i OpBranchConditional %50 %55 %54
%54 = OpAccessChain %_ptr_Function_S %arr %52 %55 = OpLabel
%56 = OpLoad %uint %i OpBranch %47
%58 = OpAccessChain %_ptr_Function_S_std140 %var_for_index %56 %54 = OpLabel
%59 = OpLoad %S_std140 %58 OpStore %var_for_index %value_0
%55 = OpFunctionCall %S %conv_S %59 %60 = OpLoad %uint %i
OpStore %54 %55 %61 = OpCompositeConstruct %_arr_uint_uint_1 %60
OpBranch %41 %62 = OpLoad %uint %i
%41 = OpLabel %64 = OpAccessChain %_ptr_Function_S %var_for_index %62
%60 = OpLoad %uint %i %65 = OpLoad %S %64
%62 = OpIAdd %uint %60 %uint_1 %59 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %61 %65
OpStore %i %62 OpBranch %48
OpBranch %39 %48 = OpLabel
%40 = OpLabel %66 = OpLoad %uint %i
%63 = OpLoad %_arr_S_uint_4 %arr %67 = OpIAdd %uint %66 %uint_1
OpReturnValue %63 OpStore %i %67
OpFunctionEnd OpBranch %46
%load_u_inner_2_m = OpFunction %mat4v4half None %64 %47 = OpLabel
%66 = OpLabel OpReturn
%71 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2 OpFunctionEnd
%74 = OpAccessChain %_ptr_Uniform_v4half %71 %uint_1 %conv_S = OpFunction %S None %68
%75 = OpLoad %v4half %74 %val = OpFunctionParameter %S_std140
%77 = OpAccessChain %_ptr_Uniform_v4half %71 %uint_2 %71 = OpLabel
%78 = OpLoad %v4half %77 %72 = OpCompositeExtract %int %val 0
%81 = OpAccessChain %_ptr_Uniform_v4half %71 %uint_3 %73 = OpCompositeExtract %v4half %val 1
%82 = OpLoad %v4half %81 %74 = OpCompositeExtract %v4half %val 2
%84 = OpAccessChain %_ptr_Uniform_v4half %71 %uint_4 %75 = OpCompositeExtract %v4half %val 3
%85 = OpLoad %v4half %84 %76 = OpCompositeExtract %v4half %val 4
%86 = OpCompositeConstruct %mat4v4half %75 %78 %82 %85 %77 = OpCompositeConstruct %mat4v4half %73 %74 %75 %76
OpReturnValue %86 %78 = OpCompositeExtract %int %val 5
OpFunctionEnd %79 = OpCompositeConstruct %S %72 %77 %78
%f = OpFunction %void None %87 OpReturnValue %79
%90 = OpLabel OpFunctionEnd
%92 = OpAccessChain %_ptr_StorageBuffer__arr_S_uint_4 %s %uint_0 %conv_arr4_S = OpFunction %_arr_S_uint_4 None %80
%95 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %u %uint_0 %val_0 = OpFunctionParameter %_arr_S_std140_uint_4
%96 = OpLoad %_arr_S_std140_uint_4 %95 %83 = OpLabel
%93 = OpFunctionCall %_arr_S_uint_4 %conv_arr4_S %96 %arr = OpVariable %_ptr_Function__arr_S_uint_4 Function %58
OpStore %92 %93 %i_0 = OpVariable %_ptr_Function_uint Function %43
%99 = OpAccessChain %_ptr_StorageBuffer_S %s %uint_0 %int_1 %var_for_index_1 = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function %97
%101 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2 OpBranch %86
%102 = OpLoad %S_std140 %101 %86 = OpLabel
%100 = OpFunctionCall %S %conv_S %102 OpLoopMerge %87 %88 None
OpStore %99 %100 OpBranch %89
%105 = OpAccessChain %_ptr_StorageBuffer_mat4v4half %s %uint_0 %int_3 %uint_1 %89 = OpLabel
%106 = OpFunctionCall %mat4v4half %load_u_inner_2_m %91 = OpLoad %uint %i_0
OpStore %105 %106 %92 = OpULessThan %bool %91 %uint_4
%109 = OpAccessChain %_ptr_StorageBuffer_v4half %s %uint_0 %int_1 %uint_1 %107 %90 = OpLogicalNot %bool %92
%110 = OpAccessChain %_ptr_Uniform_v4half %u %uint_0 %38 %uint_2 OpSelectionMerge %93 None
%111 = OpLoad %v4half %110 OpBranchConditional %90 %94 %93
%112 = OpVectorShuffle %v4half %111 %111 1 3 0 2 %94 = OpLabel
OpStore %109 %112 OpBranch %87
%93 = OpLabel
OpStore %var_for_index_1 %val_0
%98 = OpLoad %uint %i_0
%99 = OpAccessChain %_ptr_Function_S %arr %98
%101 = OpLoad %uint %i_0
%103 = OpAccessChain %_ptr_Function_S_std140 %var_for_index_1 %101
%104 = OpLoad %S_std140 %103
%100 = OpFunctionCall %S %conv_S %104
OpStore %99 %100
OpBranch %88
%88 = OpLabel
%105 = OpLoad %uint %i_0
%106 = OpIAdd %uint %105 %uint_1
OpStore %i_0 %106
OpBranch %86
%87 = OpLabel
%107 = OpLoad %_arr_S_uint_4 %arr
OpReturnValue %107
OpFunctionEnd
%load_u_inner_2_m = OpFunction %mat4v4half None %108
%110 = OpLabel
%113 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%116 = OpAccessChain %_ptr_Uniform_v4half %113 %uint_1
%117 = OpLoad %v4half %116
%119 = OpAccessChain %_ptr_Uniform_v4half %113 %uint_2
%120 = OpLoad %v4half %119
%123 = OpAccessChain %_ptr_Uniform_v4half %113 %uint_3
%124 = OpLoad %v4half %123
%126 = OpAccessChain %_ptr_Uniform_v4half %113 %uint_4
%127 = OpLoad %v4half %126
%128 = OpCompositeConstruct %mat4v4half %117 %120 %124 %127
OpReturnValue %128
OpFunctionEnd
%f = OpFunction %void None %129
%131 = OpLabel
%135 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %u %uint_0
%136 = OpLoad %_arr_S_std140_uint_4 %135
%133 = OpFunctionCall %_arr_S_uint_4 %conv_arr4_S %136
%132 = OpFunctionCall %void %assign_and_preserve_padding_s %133
%140 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%141 = OpLoad %S_std140 %140
%139 = OpFunctionCall %S %conv_S %141
%137 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %138 %139
%143 = OpAccessChain %_ptr_StorageBuffer_mat4v4half %s %uint_0 %int_3 %uint_1
%144 = OpFunctionCall %mat4v4half %load_u_inner_2_m
OpStore %143 %144
%147 = OpAccessChain %_ptr_StorageBuffer_v4half %s %uint_0 %int_1 %uint_1 %26
%148 = OpAccessChain %_ptr_Uniform_v4half %u %uint_0 %43 %uint_2
%149 = OpLoad %v4half %148
%150 = OpVectorShuffle %v4half %149 %149 1 3 0 2
OpStore %147 %150
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -44,9 +44,25 @@ layout(binding = 1, std430) buffer u_block_ssbo {
S inner[4]; S inner[4];
} s; } s;
void assign_and_preserve_padding_1_s_X(uint dest[1], S value) {
s.inner[dest[0]].before = value.before;
s.inner[dest[0]].m = value.m;
s.inner[dest[0]].after = value.after;
}
void assign_and_preserve_padding_s(S value[4]) {
{
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
uint tint_symbol[1] = uint[1](i);
assign_and_preserve_padding_1_s_X(tint_symbol, value[i]);
}
}
}
void f() { void f() {
s.inner = u.inner; assign_and_preserve_padding_s(u.inner);
s.inner[1] = u.inner[2]; uint tint_symbol_1[1] = uint[1](1u);
assign_and_preserve_padding_1_s_X(tint_symbol_1, u.inner[2]);
s.inner[3].m = u.inner[2].m; s.inner[3].m = u.inner[2].m;
s.inner[1].m[0] = u.inner[0].m[1].ywxz; s.inner[1].m[0] = u.inner[0].m[1].ywxz;
} }

View File

@ -23,9 +23,21 @@ struct S {
/* 0x0084 */ tint_array<int8_t, 60> tint_pad_2; /* 0x0084 */ tint_array<int8_t, 60> tint_pad_2;
}; };
void assign_and_preserve_padding_1(device S* const dest, S value) {
(*(dest)).before = value.before;
(*(dest)).m = value.m;
(*(dest)).after = value.after;
}
void assign_and_preserve_padding(device tint_array<S, 4>* const dest, tint_array<S, 4> value) {
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
assign_and_preserve_padding_1(&((*(dest))[i]), value[i]);
}
}
kernel void f(device tint_array<S, 4>* tint_symbol [[buffer(1)]], const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) { kernel void f(device tint_array<S, 4>* tint_symbol [[buffer(1)]], const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) {
*(tint_symbol) = *(tint_symbol_1); assign_and_preserve_padding(tint_symbol, *(tint_symbol_1));
(*(tint_symbol))[1] = (*(tint_symbol_1))[2]; assign_and_preserve_padding_1(&((*(tint_symbol))[1]), (*(tint_symbol_1))[2]);
(*(tint_symbol))[3].m = (*(tint_symbol_1))[2].m; (*(tint_symbol))[3].m = (*(tint_symbol_1))[2].m;
(*(tint_symbol))[1].m[0] = float4((*(tint_symbol_1))[0].m[1]).ywxz; (*(tint_symbol))[1].m[0] = float4((*(tint_symbol_1))[0].m[1]).ywxz;
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: 45 ; Bound: 90
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
@ -15,6 +15,13 @@
OpMemberName %S 2 "after" OpMemberName %S 2 "after"
OpName %u "u" OpName %u "u"
OpName %s "s" OpName %s "s"
OpName %assign_and_preserve_padding_1_s_X "assign_and_preserve_padding_1_s_X"
OpName %dest "dest"
OpName %value "value"
OpName %assign_and_preserve_padding_s "assign_and_preserve_padding_s"
OpName %value_0 "value"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %f "f" OpName %f "f"
OpDecorate %u_block Block OpDecorate %u_block Block
OpMemberDecorate %u_block 0 Offset 0 OpMemberDecorate %u_block 0 Offset 0
@ -29,6 +36,7 @@
OpDecorate %u Binding 0 OpDecorate %u Binding 0
OpDecorate %s DescriptorSet 0 OpDecorate %s DescriptorSet 0
OpDecorate %s Binding 1 OpDecorate %s Binding 1
OpDecorate %_arr_uint_uint_1 ArrayStride 4
%int = OpTypeInt 32 1 %int = OpTypeInt 32 1
%float = OpTypeFloat 32 %float = OpTypeFloat 32
%v4float = OpTypeVector %float 4 %v4float = OpTypeVector %float 4
@ -43,39 +51,100 @@
%_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block %_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block
%s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer %s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer
%void = OpTypeVoid %void = OpTypeVoid
%14 = OpTypeFunction %void %uint_1 = OpConstant %uint 1
%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
%14 = OpTypeFunction %void %_arr_uint_uint_1 %S
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer__arr_S_uint_4 = OpTypePointer StorageBuffer %_arr_S_uint_4 %23 = OpConstantNull %int
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%_ptr_StorageBuffer_mat4v4float = OpTypePointer StorageBuffer %mat4v4float
%uint_2 = OpConstant %uint 2
%36 = OpTypeFunction %void %_arr_S_uint_4
%40 = OpConstantNull %uint
%_ptr_Function_uint = OpTypePointer Function %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%55 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%65 = OpTypeFunction %void
%_ptr_Uniform__arr_S_uint_4 = OpTypePointer Uniform %_arr_S_uint_4 %_ptr_Uniform__arr_S_uint_4 = OpTypePointer Uniform %_arr_S_uint_4
%int_1 = OpConstant %int 1 %73 = OpConstantComposite %_arr_uint_uint_1 %uint_1
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
%int_2 = OpConstant %int 2 %int_2 = OpConstant %int 2
%_ptr_Uniform_S = OpTypePointer Uniform %S %_ptr_Uniform_S = OpTypePointer Uniform %S
%int_3 = OpConstant %int 3 %int_3 = OpConstant %int 3
%uint_1 = OpConstant %uint 1
%_ptr_StorageBuffer_mat4v4float = OpTypePointer StorageBuffer %mat4v4float
%_ptr_Uniform_mat4v4float = OpTypePointer Uniform %mat4v4float %_ptr_Uniform_mat4v4float = OpTypePointer Uniform %mat4v4float
%38 = OpConstantNull %int %int_1 = OpConstant %int 1
%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float %_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float
%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float %_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
%f = OpFunction %void None %14 %assign_and_preserve_padding_1_s_X = OpFunction %void None %14
%17 = OpLabel %dest = OpFunctionParameter %_arr_uint_uint_1
%20 = OpAccessChain %_ptr_StorageBuffer__arr_S_uint_4 %s %uint_0 %value = OpFunctionParameter %S
%22 = OpAccessChain %_ptr_Uniform__arr_S_uint_4 %u %uint_0 %21 = OpLabel
%23 = OpLoad %_arr_S_uint_4 %22 %24 = OpCompositeExtract %uint %dest 0
OpStore %20 %23 %26 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %24 %uint_0
%26 = OpAccessChain %_ptr_StorageBuffer_S %s %uint_0 %int_1 %27 = OpCompositeExtract %int %value 0
%29 = OpAccessChain %_ptr_Uniform_S %u %uint_0 %int_2 OpStore %26 %27
%30 = OpLoad %S %29 %28 = OpCompositeExtract %uint %dest 0
OpStore %26 %30 %30 = OpAccessChain %_ptr_StorageBuffer_mat4v4float %s %uint_0 %28 %uint_1
%34 = OpAccessChain %_ptr_StorageBuffer_mat4v4float %s %uint_0 %int_3 %uint_1 %31 = OpCompositeExtract %mat4v4float %value 1
%36 = OpAccessChain %_ptr_Uniform_mat4v4float %u %uint_0 %int_2 %uint_1 OpStore %30 %31
%37 = OpLoad %mat4v4float %36 %32 = OpCompositeExtract %uint %dest 0
OpStore %34 %37 %34 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %32 %uint_2
%40 = OpAccessChain %_ptr_StorageBuffer_v4float %s %uint_0 %int_1 %uint_1 %38 %35 = OpCompositeExtract %int %value 2
%42 = OpAccessChain %_ptr_Uniform_v4float %u %uint_0 %38 %uint_1 %int_1 OpStore %34 %35
%43 = OpLoad %v4float %42 OpReturn
%44 = OpVectorShuffle %v4float %43 %43 1 3 0 2 OpFunctionEnd
OpStore %40 %44 %assign_and_preserve_padding_s = OpFunction %void None %36
%value_0 = OpFunctionParameter %_arr_S_uint_4
%39 = OpLabel
%i = OpVariable %_ptr_Function_uint Function %40
%var_for_index = OpVariable %_ptr_Function__arr_S_uint_4 Function %55
OpStore %i %40
OpBranch %43
%43 = OpLabel
OpLoopMerge %44 %45 None
OpBranch %46
%46 = OpLabel
%48 = OpLoad %uint %i
%49 = OpULessThan %bool %48 %uint_4
%47 = OpLogicalNot %bool %49
OpSelectionMerge %51 None
OpBranchConditional %47 %52 %51
%52 = OpLabel
OpBranch %44
%51 = OpLabel
OpStore %var_for_index %value_0
%57 = OpLoad %uint %i
%58 = OpCompositeConstruct %_arr_uint_uint_1 %57
%59 = OpLoad %uint %i
%61 = OpAccessChain %_ptr_Function_S %var_for_index %59
%62 = OpLoad %S %61
%56 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %58 %62
OpBranch %45
%45 = OpLabel
%63 = OpLoad %uint %i
%64 = OpIAdd %uint %63 %uint_1
OpStore %i %64
OpBranch %43
%44 = OpLabel
OpReturn
OpFunctionEnd
%f = OpFunction %void None %65
%67 = OpLabel
%70 = OpAccessChain %_ptr_Uniform__arr_S_uint_4 %u %uint_0
%71 = OpLoad %_arr_S_uint_4 %70
%68 = OpFunctionCall %void %assign_and_preserve_padding_s %71
%76 = OpAccessChain %_ptr_Uniform_S %u %uint_0 %int_2
%77 = OpLoad %S %76
%72 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %73 %77
%79 = OpAccessChain %_ptr_StorageBuffer_mat4v4float %s %uint_0 %int_3 %uint_1
%81 = OpAccessChain %_ptr_Uniform_mat4v4float %u %uint_0 %int_2 %uint_1
%82 = OpLoad %mat4v4float %81
OpStore %79 %82
%85 = OpAccessChain %_ptr_StorageBuffer_v4float %s %uint_0 %int_1 %uint_1 %23
%87 = OpAccessChain %_ptr_Uniform_v4float %u %uint_0 %23 %uint_1 %int_1
%88 = OpLoad %v4float %87
%89 = OpVectorShuffle %v4float %88 %88 1 3 0 2
OpStore %85 %89
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -25,10 +25,23 @@ strided_arr[2] mat2x2_stride_16_to_arr(mat2 m) {
return tint_symbol_3; return tint_symbol_3;
} }
void assign_and_preserve_padding_1_ssbo_m_X(uint dest[1], strided_arr value) {
ssbo.inner.m[dest[0]].el = value.el;
}
void assign_and_preserve_padding_ssbo_m(strided_arr value[2]) {
{
for(uint i = 0u; (i < 2u); i = (i + 1u)) {
uint tint_symbol_4[1] = uint[1](i);
assign_and_preserve_padding_1_ssbo_m_X(tint_symbol_4, value[i]);
}
}
}
void f_1() { void f_1() {
mat2 x_15 = arr_to_mat2x2_stride_16(ssbo.inner.m); mat2 x_15 = arr_to_mat2x2_stride_16(ssbo.inner.m);
strided_arr tint_symbol[2] = mat2x2_stride_16_to_arr(x_15); strided_arr tint_symbol[2] = mat2x2_stride_16_to_arr(x_15);
ssbo.inner.m = tint_symbol; assign_and_preserve_padding_ssbo_m(tint_symbol);
return; return;
} }

View File

@ -34,10 +34,20 @@ tint_array<strided_arr, 2> mat2x2_stride_16_to_arr(float2x2 m) {
return tint_symbol_3; return tint_symbol_3;
} }
void assign_and_preserve_padding_1(device strided_arr* const dest, strided_arr value) {
(*(dest)).el = value.el;
}
void assign_and_preserve_padding(device tint_array<strided_arr, 2>* const dest, tint_array<strided_arr, 2> value) {
for(uint i = 0u; (i < 2u); i = (i + 1u)) {
assign_and_preserve_padding_1(&((*(dest))[i]), value[i]);
}
}
void f_1(device SSBO* const tint_symbol_4) { void f_1(device SSBO* const tint_symbol_4) {
float2x2 const x_15 = arr_to_mat2x2_stride_16((*(tint_symbol_4)).m); float2x2 const x_15 = arr_to_mat2x2_stride_16((*(tint_symbol_4)).m);
tint_array<strided_arr, 2> const tint_symbol = mat2x2_stride_16_to_arr(x_15); tint_array<strided_arr, 2> const tint_symbol = mat2x2_stride_16_to_arr(x_15);
(*(tint_symbol_4)).m = tint_symbol; assign_and_preserve_padding(&((*(tint_symbol_4)).m), tint_symbol);
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: 46 ; Bound: 86
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
@ -18,6 +18,13 @@
OpName %arr "arr" OpName %arr "arr"
OpName %mat2x2_stride_16_to_arr "mat2x2_stride_16_to_arr" OpName %mat2x2_stride_16_to_arr "mat2x2_stride_16_to_arr"
OpName %m "m" OpName %m "m"
OpName %assign_and_preserve_padding_1_ssbo_m_X "assign_and_preserve_padding_1_ssbo_m_X"
OpName %dest "dest"
OpName %value "value"
OpName %assign_and_preserve_padding_ssbo_m "assign_and_preserve_padding_ssbo_m"
OpName %value_0 "value"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %f_1 "f_1" OpName %f_1 "f_1"
OpName %f "f" OpName %f "f"
OpDecorate %ssbo_block Block OpDecorate %ssbo_block Block
@ -27,6 +34,7 @@
OpDecorate %_arr_strided_arr_uint_2 ArrayStride 16 OpDecorate %_arr_strided_arr_uint_2 ArrayStride 16
OpDecorate %ssbo DescriptorSet 0 OpDecorate %ssbo DescriptorSet 0
OpDecorate %ssbo Binding 0 OpDecorate %ssbo Binding 0
OpDecorate %_arr_uint_uint_1 ArrayStride 4
%float = OpTypeFloat 32 %float = OpTypeFloat 32
%v2float = OpTypeVector %float 2 %v2float = OpTypeVector %float 2
%strided_arr = OpTypeStruct %v2float %strided_arr = OpTypeStruct %v2float
@ -43,8 +51,19 @@
%uint_1 = OpConstant %uint 1 %uint_1 = OpConstant %uint 1
%23 = OpTypeFunction %_arr_strided_arr_uint_2 %mat2v2float %23 = OpTypeFunction %_arr_strided_arr_uint_2 %mat2v2float
%void = OpTypeVoid %void = OpTypeVoid
%32 = OpTypeFunction %void %_arr_uint_uint_1 = OpTypeArray %uint %uint_1
%32 = OpTypeFunction %void %_arr_uint_uint_1 %strided_arr
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%int = OpTypeInt 32 1
%41 = OpConstantNull %int
%_ptr_StorageBuffer_v2float = OpTypePointer StorageBuffer %v2float
%46 = OpTypeFunction %void %_arr_strided_arr_uint_2
%_ptr_Function_uint = OpTypePointer Function %uint
%bool = OpTypeBool
%_ptr_Function__arr_strided_arr_uint_2 = OpTypePointer Function %_arr_strided_arr_uint_2
%64 = OpConstantNull %_arr_strided_arr_uint_2
%_ptr_Function_strided_arr = OpTypePointer Function %strided_arr
%74 = OpTypeFunction %void
%_ptr_StorageBuffer__arr_strided_arr_uint_2 = OpTypePointer StorageBuffer %_arr_strided_arr_uint_2 %_ptr_StorageBuffer__arr_strided_arr_uint_2 = OpTypePointer StorageBuffer %_arr_strided_arr_uint_2
%arr_to_mat2x2_stride_16 = OpFunction %mat2v2float None %11 %arr_to_mat2x2_stride_16 = OpFunction %mat2v2float None %11
%arr = OpFunctionParameter %_arr_strided_arr_uint_2 %arr = OpFunctionParameter %_arr_strided_arr_uint_2
@ -66,18 +85,62 @@
%31 = OpCompositeConstruct %_arr_strided_arr_uint_2 %28 %30 %31 = OpCompositeConstruct %_arr_strided_arr_uint_2 %28 %30
OpReturnValue %31 OpReturnValue %31
OpFunctionEnd OpFunctionEnd
%f_1 = OpFunction %void None %32 %assign_and_preserve_padding_1_ssbo_m_X = OpFunction %void None %32
%35 = OpLabel %dest = OpFunctionParameter %_arr_uint_uint_1
%39 = OpAccessChain %_ptr_StorageBuffer__arr_strided_arr_uint_2 %ssbo %uint_0 %uint_0 %value = OpFunctionParameter %strided_arr
%40 = OpLoad %_arr_strided_arr_uint_2 %39 %38 = OpLabel
%36 = OpFunctionCall %mat2v2float %arr_to_mat2x2_stride_16 %40 %42 = OpCompositeExtract %uint %dest 0
%41 = OpFunctionCall %_arr_strided_arr_uint_2 %mat2x2_stride_16_to_arr %36 %44 = OpAccessChain %_ptr_StorageBuffer_v2float %ssbo %uint_0 %uint_0 %42 %uint_0
%42 = OpAccessChain %_ptr_StorageBuffer__arr_strided_arr_uint_2 %ssbo %uint_0 %uint_0 %45 = OpCompositeExtract %v2float %value 0
OpStore %42 %41 OpStore %44 %45
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%f = OpFunction %void None %32 %assign_and_preserve_padding_ssbo_m = OpFunction %void None %46
%44 = OpLabel %value_0 = OpFunctionParameter %_arr_strided_arr_uint_2
%45 = OpFunctionCall %void %f_1 %49 = OpLabel
%i = OpVariable %_ptr_Function_uint Function %16
%var_for_index = OpVariable %_ptr_Function__arr_strided_arr_uint_2 Function %64
OpStore %i %16
OpBranch %52
%52 = OpLabel
OpLoopMerge %53 %54 None
OpBranch %55
%55 = OpLabel
%57 = OpLoad %uint %i
%58 = OpULessThan %bool %57 %uint_2
%56 = OpLogicalNot %bool %58
OpSelectionMerge %60 None
OpBranchConditional %56 %61 %60
%61 = OpLabel
OpBranch %53
%60 = OpLabel
OpStore %var_for_index %value_0
%66 = OpLoad %uint %i
%67 = OpCompositeConstruct %_arr_uint_uint_1 %66
%68 = OpLoad %uint %i
%70 = OpAccessChain %_ptr_Function_strided_arr %var_for_index %68
%71 = OpLoad %strided_arr %70
%65 = OpFunctionCall %void %assign_and_preserve_padding_1_ssbo_m_X %67 %71
OpBranch %54
%54 = OpLabel
%72 = OpLoad %uint %i
%73 = OpIAdd %uint %72 %uint_1
OpStore %i %73
OpBranch %52
%53 = OpLabel
OpReturn
OpFunctionEnd
%f_1 = OpFunction %void None %74
%76 = OpLabel
%79 = OpAccessChain %_ptr_StorageBuffer__arr_strided_arr_uint_2 %ssbo %uint_0 %uint_0
%80 = OpLoad %_arr_strided_arr_uint_2 %79
%77 = OpFunctionCall %mat2v2float %arr_to_mat2x2_stride_16 %80
%81 = OpFunctionCall %_arr_strided_arr_uint_2 %mat2x2_stride_16_to_arr %77
%82 = OpFunctionCall %void %assign_and_preserve_padding_ssbo_m %81
OpReturn
OpFunctionEnd
%f = OpFunction %void None %74
%84 = OpLabel
%85 = OpFunctionCall %void %f_1
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -71,11 +71,17 @@ layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
S inner; S inner;
} tint_symbol; } tint_symbol;
void assign_and_preserve_padding_tint_symbol(S value) {
tint_symbol.inner.f = value.f;
tint_symbol.inner.u = value.u;
tint_symbol.inner.v = value.v;
}
void frag_main(S tint_symbol_1) { void frag_main(S tint_symbol_1) {
float f = tint_symbol_1.f; float f = tint_symbol_1.f;
uint u = tint_symbol_1.u; uint u = tint_symbol_1.u;
vec4 v = tint_symbol_1.v; vec4 v = tint_symbol_1.v;
tint_symbol.inner = tint_symbol_1; assign_and_preserve_padding_tint_symbol(tint_symbol_1);
} }
void main() { void main() {

View File

@ -22,6 +22,12 @@ struct S {
/* 0x0090 */ tint_array<int8_t, 112> tint_pad_1; /* 0x0090 */ tint_array<int8_t, 112> tint_pad_1;
}; };
void assign_and_preserve_padding(device S* const dest, S value) {
(*(dest)).f = value.f;
(*(dest)).u = value.u;
(*(dest)).v = value.v;
}
struct tint_symbol_1 { struct tint_symbol_1 {
float f [[user(locn0)]]; float f [[user(locn0)]];
uint u [[user(locn1)]] [[flat]]; uint u [[user(locn1)]] [[flat]];
@ -31,7 +37,7 @@ void frag_main_inner(S input, device S* const tint_symbol_3) {
float const f = input.f; float const f = input.f;
uint const u = input.u; uint const u = input.u;
float4 const v = input.v; float4 const v = input.v;
*(tint_symbol_3) = input; assign_and_preserve_padding(tint_symbol_3, input);
} }
fragment void frag_main(device S* tint_symbol_4 [[buffer(0)]], float4 v [[position]], tint_symbol_1 tint_symbol [[stage_in]]) { fragment void frag_main(device S* tint_symbol_4 [[buffer(0)]], float4 v [[position]], tint_symbol_1 tint_symbol [[stage_in]]) {

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: 33 ; Bound: 46
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
@ -17,6 +17,8 @@
OpMemberName %S 1 "u" OpMemberName %S 1 "u"
OpMemberName %S 2 "v" OpMemberName %S 2 "v"
OpName %output "output" OpName %output "output"
OpName %assign_and_preserve_padding_output "assign_and_preserve_padding_output"
OpName %value "value"
OpName %frag_main_inner "frag_main_inner" OpName %frag_main_inner "frag_main_inner"
OpName %input "input" OpName %input "input"
OpName %frag_main "frag_main" OpName %frag_main "frag_main"
@ -47,24 +49,41 @@
%void = OpTypeVoid %void = OpTypeVoid
%14 = OpTypeFunction %void %S %14 = OpTypeFunction %void %S
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S %_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
%25 = OpTypeFunction %void %uint_1 = OpConstant %uint 1
%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
%uint_2 = OpConstant %uint 2
%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float
%38 = OpTypeFunction %void
%assign_and_preserve_padding_output = OpFunction %void None %14
%value = OpFunctionParameter %S
%18 = OpLabel
%21 = OpAccessChain %_ptr_StorageBuffer_float %output %uint_0 %uint_0
%22 = OpCompositeExtract %float %value 0
OpStore %21 %22
%25 = OpAccessChain %_ptr_StorageBuffer_uint %output %uint_0 %uint_1
%26 = OpCompositeExtract %uint %value 1
OpStore %25 %26
%29 = OpAccessChain %_ptr_StorageBuffer_v4float %output %uint_0 %uint_2
%30 = OpCompositeExtract %v4float %value 2
OpStore %29 %30
OpReturn
OpFunctionEnd
%frag_main_inner = OpFunction %void None %14 %frag_main_inner = OpFunction %void None %14
%input = OpFunctionParameter %S %input = OpFunctionParameter %S
%18 = OpLabel %33 = OpLabel
%19 = OpCompositeExtract %float %input 0 %34 = OpCompositeExtract %float %input 0
%20 = OpCompositeExtract %uint %input 1 %35 = OpCompositeExtract %uint %input 1
%21 = OpCompositeExtract %v4float %input 2 %36 = OpCompositeExtract %v4float %input 2
%24 = OpAccessChain %_ptr_StorageBuffer_S %output %uint_0 %37 = OpFunctionCall %void %assign_and_preserve_padding_output %input
OpStore %24 %input
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%frag_main = OpFunction %void None %25 %frag_main = OpFunction %void None %38
%27 = OpLabel %40 = OpLabel
%29 = OpLoad %float %f_1 %42 = OpLoad %float %f_1
%30 = OpLoad %uint %u_1 %43 = OpLoad %uint %u_1
%31 = OpLoad %v4float %v_1 %44 = OpLoad %v4float %v_1
%32 = OpCompositeConstruct %S %29 %30 %31 %45 = OpCompositeConstruct %S %42 %43 %44
%28 = OpFunctionCall %void %frag_main_inner %32 %41 = OpFunctionCall %void %frag_main_inner %45
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd