Tint/transform: make AddBlockAttribute always do wrapping if possible

This CL make transform AddBlockAttribute always try to wrap types used
by buffer variables into a struct, in order to generate valid GLSL code
for assigning one buffer struct variable to another buffer struct
variable.

Fixed: tint:1735
Change-Id: I009d8a9ca7ecea1dc0ad6164275c964a18acb33f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108023
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
This commit is contained in:
Zhaoming Jiang 2022-11-02 02:25:38 +00:00 committed by Dawn LUCI CQ
parent 2bea9055f4
commit 6ab5d3c151
465 changed files with 15681 additions and 12853 deletions

View File

@ -27,19 +27,6 @@ TINT_INSTANTIATE_TYPEINFO(tint::transform::AddBlockAttribute::BlockAttribute);
namespace tint::transform { namespace tint::transform {
namespace {
bool IsUsedAsNonBuffer(const std::unordered_set<tint::ast::AddressSpace>& uses) {
for (auto use : uses) {
if (!ast::IsHostShareable(use)) {
return true;
}
}
return false;
}
} // namespace
AddBlockAttribute::AddBlockAttribute() = default; AddBlockAttribute::AddBlockAttribute() = default;
AddBlockAttribute::~AddBlockAttribute() = default; AddBlockAttribute::~AddBlockAttribute() = default;
@ -47,25 +34,6 @@ AddBlockAttribute::~AddBlockAttribute() = default;
void AddBlockAttribute::Run(CloneContext& ctx, const DataMap&, DataMap&) const { void AddBlockAttribute::Run(CloneContext& ctx, const DataMap&, DataMap&) const {
auto& sem = ctx.src->Sem(); auto& sem = ctx.src->Sem();
// Collect the set of structs that are nested in other types.
utils::Hashset<const sem::Struct*, 8> nested_structs;
for (auto* ty : ctx.src->Types()) {
Switch(
ty,
[&](const sem::Array* arr) {
if (auto* nested_str = arr->ElemType()->As<sem::Struct>()) {
nested_structs.Add(nested_str);
}
},
[&](const sem::Struct* str) {
for (auto* member : str->Members()) {
if (auto* nested_str = member->Type()->As<sem::Struct>()) {
nested_structs.Add(nested_str);
}
}
});
}
// A map from a type in the source program to a block-decorated wrapper that contains it in the // A map from a type in the source program to a block-decorated wrapper that contains it in the
// destination program. // destination program.
utils::Hashmap<const sem::Type*, const ast::Struct*, 8> wrapper_structs; utils::Hashmap<const sem::Type*, const ast::Struct*, 8> wrapper_structs;
@ -80,16 +48,18 @@ void AddBlockAttribute::Run(CloneContext& ctx, const DataMap&, DataMap&) const {
auto* ty = var->Type()->UnwrapRef(); auto* ty = var->Type()->UnwrapRef();
auto* str = ty->As<sem::Struct>(); auto* str = ty->As<sem::Struct>();
bool needs_wrapping =
!str || // Type is not a structure // Always try to wrap the buffer type into a struct. We can not do so only if it is a struct
nested_structs.Contains(str) || // Structure is nested by another type // but without a fixed footprint, i.e. contains a runtime-sized array as its member. Note
IsUsedAsNonBuffer(str->AddressSpaceUsage()); // Structure is used as a non-buffer usage // that such struct type can be only used as storage buffer variables' type. Also note that
// any buffer struct type that may be nested by another type must have a fixed footprint,
// therefore will be wrapped.
bool needs_wrapping = !str || // Type is not a structure
str->HasFixedFootprint(); // Struct has a fixed footprint
if (needs_wrapping) { if (needs_wrapping) {
const char* kMemberName = "inner"; const char* kMemberName = "inner";
// This is a non-struct or a struct that is nested somewhere else, so we
// need to wrap it first.
auto* wrapper = wrapper_structs.GetOrCreate(ty, [&] { auto* wrapper = wrapper_structs.GetOrCreate(ty, [&] {
auto* block = ctx.dst->ASTNodes().Create<BlockAttribute>(ctx.dst->ID(), auto* block = ctx.dst->ASTNodes().Create<BlockAttribute>(ctx.dst->ID(),
ctx.dst->AllocateNodeID()); ctx.dst->AllocateNodeID());

View File

@ -22,11 +22,8 @@
namespace tint::transform { namespace tint::transform {
/// AddBlockAttribute is a transform that adds an /// AddBlockAttribute is a transform that wrap the store type of a buffer into a struct if possible,
/// `@internal(block)` attribute to any structure that is used as the /// then adds an `@internal(block)` attribute to the wrapper struct.
/// store type of a buffer. If that structure is nested inside another structure
/// or an array, then it is wrapped inside another structure which gets the
/// `@internal(block)` attribute instead.
class AddBlockAttribute final : public Castable<AddBlockAttribute, Transform> { class AddBlockAttribute final : public Castable<AddBlockAttribute, Transform> {
public: public:
/// BlockAttribute is an InternalAttribute that is used to decorate a /// BlockAttribute is an InternalAttribute that is used to decorate a

View File

@ -200,6 +200,85 @@ fn main() {
EXPECT_EQ(expect, str(got)); EXPECT_EQ(expect, str(got));
} }
TEST_F(AddBlockAttributeTest, BasicStruct_Storage_AccessRoot) {
auto* src = R"(
struct S {
f : f32,
};
@group(0) @binding(0)
var<storage, read_write> s : S;
@fragment
fn main() {
let f = s;
}
)";
auto* expect = R"(
struct S {
f : f32,
}
@internal(block)
struct s_block {
inner : S,
}
@group(0) @binding(0) var<storage, read_write> s : s_block;
@fragment
fn main() {
let f = s.inner;
}
)";
auto got = Run<AddBlockAttribute>(src);
EXPECT_EQ(expect, str(got));
}
TEST_F(AddBlockAttributeTest, BasicStruct_Storage_TwoUsage_AccessRoot) {
auto* src = R"(
struct S {
f : f32,
};
@group(0) @binding(0)
var<storage, read_write> in : S;
@group(0) @binding(1)
var<storage, read_write> out : S;
@compute @workgroup_size(1)
fn main() {
out = in;
}
)";
auto* expect = R"(
struct S {
f : f32,
}
@internal(block)
struct in_block {
inner : S,
}
@group(0) @binding(0) var<storage, read_write> in : in_block;
@group(0) @binding(1) var<storage, read_write> out : in_block;
@compute @workgroup_size(1)
fn main() {
out.inner = in.inner;
}
)";
auto got = Run<AddBlockAttribute>(src);
EXPECT_EQ(expect, str(got));
}
TEST_F(AddBlockAttributeTest, BasicStruct_AccessField) { TEST_F(AddBlockAttributeTest, BasicStruct_AccessField) {
auto* src = R"( auto* src = R"(
struct S { struct S {
@ -215,16 +294,20 @@ fn main() {
} }
)"; )";
auto* expect = R"( auto* expect = R"(
@internal(block)
struct S { struct S {
f : f32, f : f32,
} }
@group(0) @binding(0) var<uniform> u : S; @internal(block)
struct u_block {
inner : S,
}
@group(0) @binding(0) var<uniform> u : u_block;
@fragment @fragment
fn main() { fn main() {
let f = u.f; let f = u.inner.f;
} }
)"; )";
@ -280,16 +363,20 @@ fn main() {
auto* expect = R"( auto* expect = R"(
enable chromium_experimental_push_constant; enable chromium_experimental_push_constant;
@internal(block)
struct S { struct S {
f : f32, f : f32,
} }
var<push_constant> u : S; @internal(block)
struct u_block {
inner : S,
}
var<push_constant> u : u_block;
@fragment @fragment
fn main() { fn main() {
let f = u.f; let f = u.inner.f;
} }
)"; )";
@ -321,16 +408,20 @@ struct Inner {
f : f32, f : f32,
} }
@internal(block)
struct Outer { struct Outer {
i : Inner, i : Inner,
} }
@group(0) @binding(0) var<uniform> u : Outer; @internal(block)
struct u_block {
inner : Outer,
}
@group(0) @binding(0) var<uniform> u : u_block;
@fragment @fragment
fn main() { fn main() {
let f = u.i.f; let f = u.inner.i.f;
} }
)"; )";
@ -366,12 +457,16 @@ struct Inner {
f : f32, f : f32,
} }
@internal(block)
struct Outer { struct Outer {
i : Inner, i : Inner,
} }
@group(0) @binding(0) var<uniform> u0 : Outer; @internal(block)
struct u0_block {
inner : Outer,
}
@group(0) @binding(0) var<uniform> u0 : u0_block;
@internal(block) @internal(block)
struct u1_block { struct u1_block {
@ -382,7 +477,7 @@ struct u1_block {
@fragment @fragment
fn main() { fn main() {
let f0 = u0.i.f; let f0 = u0.inner.i.f;
let f1 = u1.inner.f; let f1 = u1.inner.f;
} }
)"; )";
@ -474,12 +569,16 @@ struct Inner {
f : f32, f : f32,
} }
@internal(block)
struct S { struct S {
i : Inner, i : Inner,
} }
@group(0) @binding(0) var<uniform> u0 : S; @internal(block)
struct u0_block {
inner : S,
}
@group(0) @binding(0) var<uniform> u0 : u0_block;
@internal(block) @internal(block)
struct u1_block { struct u1_block {
@ -492,7 +591,7 @@ struct u1_block {
@fragment @fragment
fn main() { fn main() {
let f0 = u0.i.f; let f0 = u0.inner.i.f;
let f1 = u1.inner.f; let f1 = u1.inner.f;
let f2 = u2.inner.f; let f2 = u2.inner.f;
} }
@ -621,14 +720,18 @@ struct Inner {
type MyInner = Inner; type MyInner = Inner;
@internal(block)
struct Outer { struct Outer {
i : MyInner, i : MyInner,
} }
type MyOuter = Outer; type MyOuter = Outer;
@group(0) @binding(0) var<uniform> u0 : MyOuter; @internal(block)
struct u0_block {
inner : Outer,
}
@group(0) @binding(0) var<uniform> u0 : u0_block;
@internal(block) @internal(block)
struct u1_block { struct u1_block {
@ -639,7 +742,7 @@ struct u1_block {
@fragment @fragment
fn main() { fn main() {
let f0 = u0.i.f; let f0 = u0.inner.i.f;
let f1 = u1.inner.f; let f1 = u1.inner.f;
} }
)"; )";
@ -678,7 +781,7 @@ struct Inner {
auto* expect = R"( auto* expect = R"(
@fragment @fragment
fn main() { fn main() {
let f0 = u0.i.f; let f0 = u0.inner.i.f;
let f1 = u1.inner.f; let f1 = u1.inner.f;
} }
@ -691,11 +794,15 @@ struct u1_block {
type MyInner = Inner; type MyInner = Inner;
@group(0) @binding(0) var<uniform> u0 : MyOuter; @internal(block)
struct u0_block {
inner : Outer,
}
@group(0) @binding(0) var<uniform> u0 : u0_block;
type MyOuter = Outer; type MyOuter = Outer;
@internal(block)
struct Outer { struct Outer {
i : MyInner, i : MyInner,
} }
@ -810,18 +917,22 @@ fn main() {
} }
)"; )";
auto* expect = R"( auto* expect = R"(
@internal(block) @internal(block)
struct S { struct S {
f : f32, f : f32,
} }
@group(0) @binding(0) var<uniform> u : S; @internal(block)
struct u_block {
inner : S,
}
@group(0) @binding(1) var<storage, read_write> s : S; @group(0) @binding(0) var<uniform> u : u_block;
@group(0) @binding(1) var<storage, read_write> s : u_block;
@fragment @fragment
fn main() { fn main() {
s = u; s.inner = u.inner;
} }
)"; )";
@ -850,5 +961,65 @@ fn main() {
EXPECT_EQ(expect, str(got)); EXPECT_EQ(expect, str(got));
} }
TEST_F(AddBlockAttributeTest, StorageBufferWithRuntimeArray) {
auto* src = R"(
struct S {
f : f32,
}
struct SWithArr {
f : f32,
arr : array<f32>,
}
@group(0) @binding(0)
var<storage, read> in_1 : S;
@group(0) @binding(1)
var<storage, read> in_2 : SWithArr;
@group(1) @binding(0)
var<storage, read_write> out : SWithArr;
@fragment
fn main() {
out.f = in_1.f;
out.arr[0] = in_2.arr[1];
}
)";
auto* expect = R"(
struct S {
f : f32,
}
@internal(block) @internal(block)
struct SWithArr {
f : f32,
arr : array<f32>,
}
@internal(block)
struct in_1_block {
inner : S,
}
@group(0) @binding(0) var<storage, read> in_1 : in_1_block;
@group(0) @binding(1) var<storage, read> in_2 : SWithArr;
@group(1) @binding(0) var<storage, read_write> out : SWithArr;
@fragment
fn main() {
out.f = in_1.inner.f;
out.arr[0] = in_2.arr[1];
}
)";
auto got = Run<AddBlockAttribute>(src);
EXPECT_EQ(expect, str(got));
}
} // namespace } // namespace
} // namespace tint::transform } // namespace tint::transform

View File

@ -462,13 +462,17 @@ TEST_F(GlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_With_RW_Storage
EXPECT_EQ(gen.result(), R"(#version 310 es EXPECT_EQ(gen.result(), R"(#version 310 es
precision mediump float; precision mediump float;
layout(binding = 0, std430) buffer Data_ssbo { struct Data {
int a; int a;
float b; float b;
};
layout(binding = 0, std430) buffer coord_block_ssbo {
Data inner;
} coord; } coord;
void frag_main() { void frag_main() {
float v = coord.b; float v = coord.inner.b;
return; return;
} }
@ -506,13 +510,17 @@ TEST_F(GlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_With_RO_Storage
R"(#version 310 es R"(#version 310 es
precision mediump float; precision mediump float;
layout(binding = 0, std430) buffer Data_ssbo { struct Data {
int a; int a;
float b; float b;
};
layout(binding = 0, std430) buffer coord_block_ssbo {
Data inner;
} coord; } coord;
void frag_main() { void frag_main() {
float v = coord.b; float v = coord.inner.b;
return; return;
} }
@ -547,13 +555,17 @@ TEST_F(GlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_With_WO_Storage
EXPECT_EQ(gen.result(), R"(#version 310 es EXPECT_EQ(gen.result(), R"(#version 310 es
precision mediump float; precision mediump float;
layout(binding = 0, std430) buffer Data_ssbo { struct Data {
int a; int a;
float b; float b;
};
layout(binding = 0, std430) buffer coord_block_ssbo {
Data inner;
} coord; } coord;
void frag_main() { void frag_main() {
coord.b = 2.0f; coord.inner.b = 2.0f;
return; return;
} }
@ -588,13 +600,17 @@ TEST_F(GlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_With_StorageBuf
EXPECT_EQ(gen.result(), R"(#version 310 es EXPECT_EQ(gen.result(), R"(#version 310 es
precision mediump float; precision mediump float;
layout(binding = 0, std430) buffer Data_ssbo { struct Data {
int a; int a;
float b; float b;
};
layout(binding = 0, std430) buffer coord_block_ssbo {
Data inner;
} coord; } coord;
void frag_main() { void frag_main() {
coord.b = 2.0f; coord.inner.b = 2.0f;
return; return;
} }
@ -678,12 +694,16 @@ TEST_F(GlslGeneratorImplTest_Function, Emit_Attribute_Called_By_EntryPoint_With_
R"(#version 310 es R"(#version 310 es
precision mediump float; precision mediump float;
layout(binding = 0, std430) buffer S_ssbo { struct S {
float x; float x;
};
layout(binding = 0, std430) buffer coord_block_ssbo {
S inner;
} coord; } coord;
float sub_func(float param) { float sub_func(float param) {
return coord.x; return coord.inner.x;
} }
void frag_main() { void frag_main() {
@ -895,12 +915,16 @@ TEST_F(GlslGeneratorImplTest_Function, Emit_Multiple_EntryPoint_With_Same_Module
ASSERT_TRUE(gen.Generate()) << gen.error(); ASSERT_TRUE(gen.Generate()) << gen.error();
EXPECT_EQ(gen.result(), R"(#version 310 es EXPECT_EQ(gen.result(), R"(#version 310 es
layout(binding = 0, std430) buffer Data_ssbo { struct Data {
float d; float d;
};
layout(binding = 0, std430) buffer data_block_ssbo {
Data inner;
} data; } data;
void a() { void a() {
float v = data.d; float v = data.inner.d;
return; return;
} }
@ -910,7 +934,7 @@ void main() {
return; return;
} }
void b() { void b() {
float v = data.d; float v = data.inner.d;
return; return;
} }

View File

@ -179,27 +179,27 @@ TEST_P(GlslGeneratorImplTest_MemberAccessor_StorageBufferLoad, Test) {
INSTANTIATE_TEST_SUITE_P(GlslGeneratorImplTest_MemberAccessor, INSTANTIATE_TEST_SUITE_P(GlslGeneratorImplTest_MemberAccessor,
GlslGeneratorImplTest_MemberAccessor_StorageBufferLoad, GlslGeneratorImplTest_MemberAccessor_StorageBufferLoad,
testing::Values(TypeCase{ty_u32, "data.b"}, testing::Values(TypeCase{ty_u32, "data.inner.b"},
TypeCase{ty_f32, "data.b"}, TypeCase{ty_f32, "data.inner.b"},
TypeCase{ty_i32, "data.b"}, TypeCase{ty_i32, "data.inner.b"},
TypeCase{ty_vec2<u32>, "data.b"}, TypeCase{ty_vec2<u32>, "data.inner.b"},
TypeCase{ty_vec2<f32>, "data.b"}, TypeCase{ty_vec2<f32>, "data.inner.b"},
TypeCase{ty_vec2<i32>, "data.b"}, TypeCase{ty_vec2<i32>, "data.inner.b"},
TypeCase{ty_vec3<u32>, "data.b"}, TypeCase{ty_vec3<u32>, "data.inner.b"},
TypeCase{ty_vec3<f32>, "data.b"}, TypeCase{ty_vec3<f32>, "data.inner.b"},
TypeCase{ty_vec3<i32>, "data.b"}, TypeCase{ty_vec3<i32>, "data.inner.b"},
TypeCase{ty_vec4<u32>, "data.b"}, TypeCase{ty_vec4<u32>, "data.inner.b"},
TypeCase{ty_vec4<f32>, "data.b"}, TypeCase{ty_vec4<f32>, "data.inner.b"},
TypeCase{ty_vec4<i32>, "data.b"}, TypeCase{ty_vec4<i32>, "data.inner.b"},
TypeCase{ty_mat2x2<f32>, "data.b"}, TypeCase{ty_mat2x2<f32>, "data.inner.b"},
TypeCase{ty_mat2x3<f32>, "data.b"}, TypeCase{ty_mat2x3<f32>, "data.inner.b"},
TypeCase{ty_mat2x4<f32>, "data.b"}, TypeCase{ty_mat2x4<f32>, "data.inner.b"},
TypeCase{ty_mat3x2<f32>, "data.b"}, TypeCase{ty_mat3x2<f32>, "data.inner.b"},
TypeCase{ty_mat3x3<f32>, "data.b"}, TypeCase{ty_mat3x3<f32>, "data.inner.b"},
TypeCase{ty_mat3x4<f32>, "data.b"}, TypeCase{ty_mat3x4<f32>, "data.inner.b"},
TypeCase{ty_mat4x2<f32>, "data.b"}, TypeCase{ty_mat4x2<f32>, "data.inner.b"},
TypeCase{ty_mat4x3<f32>, "data.b"}, TypeCase{ty_mat4x3<f32>, "data.inner.b"},
TypeCase{ty_mat4x4<f32>, "data.b"})); TypeCase{ty_mat4x4<f32>, "data.inner.b"}));
using GlslGeneratorImplTest_MemberAccessor_StorageBufferStore = using GlslGeneratorImplTest_MemberAccessor_StorageBufferStore =
GlslGeneratorImplTest_MemberAccessorWithParam<TypeCase>; GlslGeneratorImplTest_MemberAccessorWithParam<TypeCase>;
@ -231,27 +231,27 @@ TEST_P(GlslGeneratorImplTest_MemberAccessor_StorageBufferStore, Test) {
INSTANTIATE_TEST_SUITE_P(GlslGeneratorImplTest_MemberAccessor, INSTANTIATE_TEST_SUITE_P(GlslGeneratorImplTest_MemberAccessor,
GlslGeneratorImplTest_MemberAccessor_StorageBufferStore, GlslGeneratorImplTest_MemberAccessor_StorageBufferStore,
testing::Values(TypeCase{ty_u32, "data.b = value"}, testing::Values(TypeCase{ty_u32, "data.inner.b = value"},
TypeCase{ty_f32, "data.b = value"}, TypeCase{ty_f32, "data.inner.b = value"},
TypeCase{ty_i32, "data.b = value"}, TypeCase{ty_i32, "data.inner.b = value"},
TypeCase{ty_vec2<u32>, "data.b = value"}, TypeCase{ty_vec2<u32>, "data.inner.b = value"},
TypeCase{ty_vec2<f32>, "data.b = value"}, TypeCase{ty_vec2<f32>, "data.inner.b = value"},
TypeCase{ty_vec2<i32>, "data.b = value"}, TypeCase{ty_vec2<i32>, "data.inner.b = value"},
TypeCase{ty_vec3<u32>, "data.b = value"}, TypeCase{ty_vec3<u32>, "data.inner.b = value"},
TypeCase{ty_vec3<f32>, "data.b = value"}, TypeCase{ty_vec3<f32>, "data.inner.b = value"},
TypeCase{ty_vec3<i32>, "data.b = value"}, TypeCase{ty_vec3<i32>, "data.inner.b = value"},
TypeCase{ty_vec4<u32>, "data.b = value"}, TypeCase{ty_vec4<u32>, "data.inner.b = value"},
TypeCase{ty_vec4<f32>, "data.b = value"}, TypeCase{ty_vec4<f32>, "data.inner.b = value"},
TypeCase{ty_vec4<i32>, "data.b = value"}, TypeCase{ty_vec4<i32>, "data.inner.b = value"},
TypeCase{ty_mat2x2<f32>, "data.b = value"}, TypeCase{ty_mat2x2<f32>, "data.inner.b = value"},
TypeCase{ty_mat2x3<f32>, "data.b = value"}, TypeCase{ty_mat2x3<f32>, "data.inner.b = value"},
TypeCase{ty_mat2x4<f32>, "data.b = value"}, TypeCase{ty_mat2x4<f32>, "data.inner.b = value"},
TypeCase{ty_mat3x2<f32>, "data.b = value"}, TypeCase{ty_mat3x2<f32>, "data.inner.b = value"},
TypeCase{ty_mat3x3<f32>, "data.b = value"}, TypeCase{ty_mat3x3<f32>, "data.inner.b = value"},
TypeCase{ty_mat3x4<f32>, "data.b = value"}, TypeCase{ty_mat3x4<f32>, "data.inner.b = value"},
TypeCase{ty_mat4x2<f32>, "data.b = value"}, TypeCase{ty_mat4x2<f32>, "data.inner.b = value"},
TypeCase{ty_mat4x3<f32>, "data.b = value"}, TypeCase{ty_mat4x3<f32>, "data.inner.b = value"},
TypeCase{ty_mat4x4<f32>, "data.b = value"})); TypeCase{ty_mat4x4<f32>, "data.inner.b = value"}));
TEST_F(GlslGeneratorImplTest_MemberAccessor, StorageBuffer_Store_Matrix_Empty) { TEST_F(GlslGeneratorImplTest_MemberAccessor, StorageBuffer_Store_Matrix_Empty) {
// struct Data { // struct Data {
@ -277,16 +277,20 @@ TEST_F(GlslGeneratorImplTest_MemberAccessor, StorageBuffer_Store_Matrix_Empty) {
R"(#version 310 es R"(#version 310 es
precision mediump float; precision mediump float;
layout(binding = 0, std430) buffer Data_ssbo { struct Data {
int a; int a;
uint pad; uint pad;
uint pad_1; uint pad_1;
uint pad_2; uint pad_2;
mat2x3 b; mat2x3 b;
};
layout(binding = 0, std430) buffer data_block_ssbo {
Data inner;
} data; } data;
void tint_symbol() { void tint_symbol() {
data.b = mat2x3(vec3(0.0f), vec3(0.0f)); data.inner.b = mat2x3(vec3(0.0f), vec3(0.0f));
} }
void main() { void main() {
@ -321,16 +325,20 @@ TEST_F(GlslGeneratorImplTest_MemberAccessor, StorageBuffer_Load_Matrix_Single_El
R"(#version 310 es R"(#version 310 es
precision mediump float; precision mediump float;
layout(binding = 0, std430) buffer Data_ssbo { struct Data {
float z; float z;
uint pad; uint pad;
uint pad_1; uint pad_1;
uint pad_2; uint pad_2;
mat4x3 a; mat4x3 a;
};
layout(binding = 0, std430) buffer data_block_ssbo {
Data inner;
} data; } data;
void tint_symbol() { void tint_symbol() {
float x = data.a[2][1]; float x = data.inner.a[2][1];
} }
void main() { void main() {
@ -365,13 +373,17 @@ TEST_F(GlslGeneratorImplTest_MemberAccessor,
R"(#version 310 es R"(#version 310 es
precision mediump float; precision mediump float;
layout(binding = 0, std430) buffer Data_ssbo { struct Data {
float z; float z;
int a[5]; int a[5];
};
layout(binding = 0, std430) buffer data_block_ssbo {
Data inner;
} data; } data;
void tint_symbol() { void tint_symbol() {
int x = data.a[2]; int x = data.inner.a[2];
} }
void main() { void main() {
@ -409,16 +421,20 @@ TEST_F(GlslGeneratorImplTest_MemberAccessor,
R"(#version 310 es R"(#version 310 es
precision mediump float; precision mediump float;
layout(binding = 0, std430) buffer Data_ssbo { struct Data {
float z; float z;
int a[5]; int a[5];
};
layout(binding = 0, std430) buffer data_block_ssbo {
Data inner;
} data; } data;
void tint_symbol() { void tint_symbol() {
int a = 2; int a = 2;
int b = 4; int b = 4;
int c = 3; int c = 3;
int x = data.a[((a + b) - c)]; int x = data.inner.a[((a + b) - c)];
} }
void main() { void main() {
@ -452,13 +468,17 @@ TEST_F(GlslGeneratorImplTest_MemberAccessor, StorageBuffer_Store_ToArray) {
R"(#version 310 es R"(#version 310 es
precision mediump float; precision mediump float;
layout(binding = 0, std430) buffer Data_ssbo { struct Data {
float z; float z;
int a[5]; int a[5];
};
layout(binding = 0, std430) buffer data_block_ssbo {
Data inner;
} data; } data;
void tint_symbol() { void tint_symbol() {
data.a[2] = 2; data.inner.a[2] = 2;
} }
void main() { void main() {
@ -508,12 +528,16 @@ struct Inner {
uint pad_1; uint pad_1;
}; };
layout(binding = 0, std430) buffer Data_ssbo { struct Data {
Inner c[4]; Inner c[4];
};
layout(binding = 0, std430) buffer data_block_ssbo {
Data inner;
} data; } data;
void tint_symbol() { void tint_symbol() {
vec3 x = data.c[2].b; vec3 x = data.inner.c[2].b;
} }
void main() { void main() {
@ -565,12 +589,16 @@ struct Inner {
uint pad_1; uint pad_1;
}; };
layout(binding = 0, std430) buffer Data_ssbo { struct Data {
Inner c[4]; Inner c[4];
};
layout(binding = 0, std430) buffer data_block_ssbo {
Data inner;
} data; } data;
void tint_symbol() { void tint_symbol() {
vec2 x = data.c[2].b.xy; vec2 x = data.inner.c[2].b.xy;
} }
void main() { void main() {
@ -623,12 +651,16 @@ struct Inner {
uint pad_1; uint pad_1;
}; };
layout(binding = 0, std430) buffer Data_ssbo { struct Data {
Inner c[4]; Inner c[4];
};
layout(binding = 0, std430) buffer data_block_ssbo {
Data inner;
} data; } data;
void tint_symbol() { void tint_symbol() {
float x = data.c[2].b.g; float x = data.inner.c[2].b.g;
} }
void main() { void main() {
@ -680,12 +712,16 @@ struct Inner {
uint pad_1; uint pad_1;
}; };
layout(binding = 0, std430) buffer Data_ssbo { struct Data {
Inner c[4]; Inner c[4];
};
layout(binding = 0, std430) buffer data_block_ssbo {
Data inner;
} data; } data;
void tint_symbol() { void tint_symbol() {
float x = data.c[2].b[1]; float x = data.inner.c[2].b[1];
} }
void main() { void main() {
@ -736,12 +772,16 @@ struct Inner {
uint pad_1; uint pad_1;
}; };
layout(binding = 0, std430) buffer Data_ssbo { struct Data {
Inner c[4]; Inner c[4];
};
layout(binding = 0, std430) buffer data_block_ssbo {
Data inner;
} data; } data;
void tint_symbol() { void tint_symbol() {
data.c[2].b = vec3(1.0f, 2.0f, 3.0f); data.inner.c[2].b = vec3(1.0f, 2.0f, 3.0f);
} }
void main() { void main() {
@ -793,12 +833,16 @@ struct Inner {
uint pad_1; uint pad_1;
}; };
layout(binding = 0, std430) buffer Data_ssbo { struct Data {
Inner c[4]; Inner c[4];
};
layout(binding = 0, std430) buffer data_block_ssbo {
Data inner;
} data; } data;
void tint_symbol() { void tint_symbol() {
data.c[2].b.y = 1.0f; data.inner.c[2].b.y = 1.0f;
} }
void main() { void main() {

View File

@ -3340,25 +3340,26 @@ TEST_F(BuiltinBuilderTest, Call_AtomicLoad) {
ASSERT_EQ(b.functions().size(), 1_u); ASSERT_EQ(b.functions().size(), 1_u);
auto* expected_types = R"(%4 = OpTypeInt 32 0 auto* expected_types = R"(%5 = OpTypeInt 32 0
%5 = OpTypeInt 32 1 %6 = OpTypeInt 32 1
%3 = OpTypeStruct %4 %5 %4 = OpTypeStruct %5 %6
%3 = OpTypeStruct %4
%2 = OpTypePointer StorageBuffer %3 %2 = OpTypePointer StorageBuffer %3
%1 = OpVariable %2 StorageBuffer %1 = OpVariable %2 StorageBuffer
%7 = OpTypeVoid %8 = OpTypeVoid
%6 = OpTypeFunction %7 %7 = OpTypeFunction %8
%11 = OpConstant %4 1 %12 = OpConstant %5 1
%12 = OpConstant %4 0 %13 = OpConstant %5 0
%14 = OpTypePointer StorageBuffer %4 %15 = OpTypePointer StorageBuffer %5
%18 = OpTypePointer StorageBuffer %5 %19 = OpTypePointer StorageBuffer %6
)"; )";
auto got_types = DumpInstructions(b.types()); auto got_types = DumpInstructions(b.types());
EXPECT_EQ(expected_types, got_types); EXPECT_EQ(expected_types, got_types);
auto* expected_instructions = R"(%15 = OpAccessChain %14 %1 %12 auto* expected_instructions = R"(%16 = OpAccessChain %15 %1 %13 %13
%10 = OpAtomicLoad %4 %15 %11 %12 %11 = OpAtomicLoad %5 %16 %12 %13
%19 = OpAccessChain %18 %1 %11 %20 = OpAccessChain %19 %1 %13 %12
%16 = OpAtomicLoad %5 %19 %11 %12 %17 = OpAtomicLoad %6 %20 %12 %13
OpReturn OpReturn
)"; )";
auto got_instructions = DumpInstructions(b.functions()[0].instructions()); auto got_instructions = DumpInstructions(b.functions()[0].instructions());
@ -3405,34 +3406,35 @@ TEST_F(BuiltinBuilderTest, Call_AtomicStore) {
ASSERT_EQ(b.functions().size(), 1_u); ASSERT_EQ(b.functions().size(), 1_u);
auto* expected_types = R"(%4 = OpTypeInt 32 0 auto* expected_types = R"(%5 = OpTypeInt 32 0
%5 = OpTypeInt 32 1 %6 = OpTypeInt 32 1
%3 = OpTypeStruct %4 %5 %4 = OpTypeStruct %5 %6
%3 = OpTypeStruct %4
%2 = OpTypePointer StorageBuffer %3 %2 = OpTypePointer StorageBuffer %3
%1 = OpVariable %2 StorageBuffer %1 = OpVariable %2 StorageBuffer
%7 = OpTypeVoid %8 = OpTypeVoid
%6 = OpTypeFunction %7 %7 = OpTypeFunction %8
%10 = OpConstant %4 1 %11 = OpConstant %5 1
%12 = OpTypePointer Function %4 %13 = OpTypePointer Function %5
%13 = OpConstantNull %4 %14 = OpConstantNull %5
%14 = OpConstant %5 2 %15 = OpConstant %6 2
%16 = OpTypePointer Function %5 %17 = OpTypePointer Function %6
%17 = OpConstantNull %5 %18 = OpConstantNull %6
%19 = OpConstant %4 0 %20 = OpConstant %5 0
%21 = OpTypePointer StorageBuffer %4 %22 = OpTypePointer StorageBuffer %5
%26 = OpTypePointer StorageBuffer %5 %27 = OpTypePointer StorageBuffer %6
)"; )";
auto got_types = DumpInstructions(b.types()); auto got_types = DumpInstructions(b.types());
EXPECT_EQ(expected_types, got_types); EXPECT_EQ(expected_types, got_types);
auto* expected_instructions = R"(OpStore %11 %10 auto* expected_instructions = R"(OpStore %12 %11
OpStore %15 %14 OpStore %16 %15
%22 = OpAccessChain %21 %1 %19 %23 = OpAccessChain %22 %1 %20 %20
%23 = OpLoad %4 %11 %24 = OpLoad %5 %12
OpAtomicStore %22 %10 %19 %23 OpAtomicStore %23 %11 %20 %24
%27 = OpAccessChain %26 %1 %10 %28 = OpAccessChain %27 %1 %20 %11
%28 = OpLoad %5 %15 %29 = OpLoad %6 %16
OpAtomicStore %27 %10 %19 %28 OpAtomicStore %28 %11 %20 %29
OpReturn OpReturn
)"; )";
auto got_instructions = DumpInstructions(b.functions()[0].instructions()); auto got_instructions = DumpInstructions(b.functions()[0].instructions());
@ -3475,28 +3477,29 @@ TEST_P(Builtin_Builder_AtomicRMW_i32, Test) {
ASSERT_EQ(b.functions().size(), 1_u); ASSERT_EQ(b.functions().size(), 1_u);
std::string expected_types = R"(%4 = OpTypeInt 32 1 std::string expected_types = R"(%5 = OpTypeInt 32 1
%4 = OpTypeStruct %5
%3 = OpTypeStruct %4 %3 = OpTypeStruct %4
%2 = OpTypePointer StorageBuffer %3 %2 = OpTypePointer StorageBuffer %3
%1 = OpVariable %2 StorageBuffer %1 = OpVariable %2 StorageBuffer
%6 = OpTypeVoid %7 = OpTypeVoid
%5 = OpTypeFunction %6 %6 = OpTypeFunction %7
%9 = OpConstant %4 10 %10 = OpConstant %5 10
%11 = OpTypePointer Function %4 %12 = OpTypePointer Function %5
%12 = OpConstantNull %4 %13 = OpConstantNull %5
%14 = OpTypeInt 32 0 %15 = OpTypeInt 32 0
%15 = OpConstant %14 1 %16 = OpConstant %15 1
%16 = OpConstant %14 0 %17 = OpConstant %15 0
%18 = OpTypePointer StorageBuffer %4 %19 = OpTypePointer StorageBuffer %5
)"; )";
auto got_types = DumpInstructions(b.types()); auto got_types = DumpInstructions(b.types());
EXPECT_EQ(expected_types, got_types); EXPECT_EQ(expected_types, got_types);
std::string expected_instructions = R"(OpStore %10 %9 std::string expected_instructions = R"(OpStore %11 %10
%19 = OpAccessChain %18 %1 %16 %20 = OpAccessChain %19 %1 %17 %17
%20 = OpLoad %4 %10 %21 = OpLoad %5 %11
)"; )";
expected_instructions += "%13 = " + GetParam().op + " %4 %19 %15 %16 %20\n"; expected_instructions += "%14 = " + GetParam().op + " %5 %20 %16 %17 %21\n";
expected_instructions += "OpReturn\n"; expected_instructions += "OpReturn\n";
auto got_instructions = DumpInstructions(b.functions()[0].instructions()); auto got_instructions = DumpInstructions(b.functions()[0].instructions());
@ -3547,27 +3550,28 @@ TEST_P(Builtin_Builder_AtomicRMW_u32, Test) {
ASSERT_EQ(b.functions().size(), 1_u); ASSERT_EQ(b.functions().size(), 1_u);
std::string expected_types = R"(%4 = OpTypeInt 32 0 std::string expected_types = R"(%5 = OpTypeInt 32 0
%4 = OpTypeStruct %5
%3 = OpTypeStruct %4 %3 = OpTypeStruct %4
%2 = OpTypePointer StorageBuffer %3 %2 = OpTypePointer StorageBuffer %3
%1 = OpVariable %2 StorageBuffer %1 = OpVariable %2 StorageBuffer
%6 = OpTypeVoid %7 = OpTypeVoid
%5 = OpTypeFunction %6 %6 = OpTypeFunction %7
%9 = OpConstant %4 10 %10 = OpConstant %5 10
%11 = OpTypePointer Function %4 %12 = OpTypePointer Function %5
%12 = OpConstantNull %4 %13 = OpConstantNull %5
%14 = OpConstant %4 1 %15 = OpConstant %5 1
%15 = OpConstant %4 0 %16 = OpConstant %5 0
%17 = OpTypePointer StorageBuffer %4 %18 = OpTypePointer StorageBuffer %5
)"; )";
auto got_types = DumpInstructions(b.types()); auto got_types = DumpInstructions(b.types());
EXPECT_EQ(expected_types, got_types); EXPECT_EQ(expected_types, got_types);
std::string expected_instructions = R"(OpStore %10 %9 std::string expected_instructions = R"(OpStore %11 %10
%18 = OpAccessChain %17 %1 %15 %19 = OpAccessChain %18 %1 %16 %16
%19 = OpLoad %4 %10 %20 = OpLoad %5 %11
)"; )";
expected_instructions += "%13 = " + GetParam().op + " %4 %18 %14 %15 %19\n"; expected_instructions += "%14 = " + GetParam().op + " %5 %19 %15 %16 %20\n";
expected_instructions += "OpReturn\n"; expected_instructions += "OpReturn\n";
auto got_instructions = DumpInstructions(b.functions()[0].instructions()); auto got_instructions = DumpInstructions(b.functions()[0].instructions());
@ -3624,35 +3628,36 @@ TEST_F(BuiltinBuilderTest, Call_AtomicExchange) {
ASSERT_EQ(b.functions().size(), 1_u); ASSERT_EQ(b.functions().size(), 1_u);
auto* expected_types = R"(%4 = OpTypeInt 32 0 auto* expected_types = R"(%5 = OpTypeInt 32 0
%5 = OpTypeInt 32 1 %6 = OpTypeInt 32 1
%3 = OpTypeStruct %4 %5 %4 = OpTypeStruct %5 %6
%3 = OpTypeStruct %4
%2 = OpTypePointer StorageBuffer %3 %2 = OpTypePointer StorageBuffer %3
%1 = OpVariable %2 StorageBuffer %1 = OpVariable %2 StorageBuffer
%7 = OpTypeVoid %8 = OpTypeVoid
%6 = OpTypeFunction %7 %7 = OpTypeFunction %8
%10 = OpConstant %4 10 %11 = OpConstant %5 10
%12 = OpTypePointer Function %4 %13 = OpTypePointer Function %5
%13 = OpConstantNull %4 %14 = OpConstantNull %5
%14 = OpConstant %5 10 %15 = OpConstant %6 10
%16 = OpTypePointer Function %5 %17 = OpTypePointer Function %6
%17 = OpConstantNull %5 %18 = OpConstantNull %6
%19 = OpConstant %4 1 %20 = OpConstant %5 1
%20 = OpConstant %4 0 %21 = OpConstant %5 0
%22 = OpTypePointer StorageBuffer %4 %23 = OpTypePointer StorageBuffer %5
%27 = OpTypePointer StorageBuffer %5 %28 = OpTypePointer StorageBuffer %6
)"; )";
auto got_types = DumpInstructions(b.types()); auto got_types = DumpInstructions(b.types());
EXPECT_EQ(expected_types, got_types); EXPECT_EQ(expected_types, got_types);
auto* expected_instructions = R"(OpStore %11 %10 auto* expected_instructions = R"(OpStore %12 %11
OpStore %15 %14 OpStore %16 %15
%23 = OpAccessChain %22 %1 %20 %24 = OpAccessChain %23 %1 %21 %21
%24 = OpLoad %4 %11 %25 = OpLoad %5 %12
%18 = OpAtomicExchange %4 %23 %19 %20 %24 %19 = OpAtomicExchange %5 %24 %20 %21 %25
%28 = OpAccessChain %27 %1 %19 %29 = OpAccessChain %28 %1 %21 %20
%29 = OpLoad %5 %15 %30 = OpLoad %6 %16
%25 = OpAtomicExchange %5 %28 %19 %20 %29 %26 = OpAtomicExchange %6 %29 %20 %21 %30
OpReturn OpReturn
)"; )";
auto got_instructions = DumpInstructions(b.functions()[0].instructions()); auto got_instructions = DumpInstructions(b.functions()[0].instructions());
@ -3697,36 +3702,37 @@ TEST_F(BuiltinBuilderTest, Call_AtomicCompareExchangeWeak) {
ASSERT_EQ(b.functions().size(), 1_u); ASSERT_EQ(b.functions().size(), 1_u);
auto* expected_types = R"(%4 = OpTypeInt 32 0 auto* expected_types = R"(%5 = OpTypeInt 32 0
%5 = OpTypeInt 32 1 %6 = OpTypeInt 32 1
%3 = OpTypeStruct %4 %5 %4 = OpTypeStruct %5 %6
%3 = OpTypeStruct %4
%2 = OpTypePointer StorageBuffer %3 %2 = OpTypePointer StorageBuffer %3
%1 = OpVariable %2 StorageBuffer %1 = OpVariable %2 StorageBuffer
%7 = OpTypeVoid %8 = OpTypeVoid
%6 = OpTypeFunction %7 %7 = OpTypeFunction %8
%12 = OpTypeBool %13 = OpTypeBool
%11 = OpTypeStruct %4 %12 %12 = OpTypeStruct %5 %13
%13 = OpConstant %4 1 %14 = OpConstant %5 1
%14 = OpConstant %4 0 %15 = OpConstant %5 0
%16 = OpTypePointer StorageBuffer %4 %17 = OpTypePointer StorageBuffer %5
%18 = OpConstant %4 20 %19 = OpConstant %5 20
%19 = OpConstant %4 10 %20 = OpConstant %5 10
%23 = OpTypeStruct %5 %12 %24 = OpTypeStruct %6 %13
%25 = OpTypePointer StorageBuffer %5 %26 = OpTypePointer StorageBuffer %6
%27 = OpConstant %5 20 %28 = OpConstant %6 20
%28 = OpConstant %5 10 %29 = OpConstant %6 10
)"; )";
auto got_types = DumpInstructions(b.types()); auto got_types = DumpInstructions(b.types());
EXPECT_EQ(expected_types, got_types); EXPECT_EQ(expected_types, got_types);
auto* expected_instructions = R"(%17 = OpAccessChain %16 %1 %14 auto* expected_instructions = R"(%18 = OpAccessChain %17 %1 %15 %15
%20 = OpAtomicCompareExchange %4 %17 %13 %14 %14 %18 %19 %21 = OpAtomicCompareExchange %5 %18 %14 %15 %15 %19 %20
%21 = OpIEqual %12 %20 %19 %22 = OpIEqual %13 %21 %20
%10 = OpCompositeConstruct %11 %20 %21 %11 = OpCompositeConstruct %12 %21 %22
%26 = OpAccessChain %25 %1 %13 %27 = OpAccessChain %26 %1 %15 %14
%29 = OpAtomicCompareExchange %5 %26 %13 %14 %14 %27 %28 %30 = OpAtomicCompareExchange %6 %27 %14 %15 %15 %28 %29
%30 = OpIEqual %12 %29 %28 %31 = OpIEqual %13 %30 %29
%22 = OpCompositeConstruct %23 %29 %30 %23 = OpCompositeConstruct %24 %30 %31
OpReturn OpReturn
)"; )";
auto got_instructions = DumpInstructions(b.functions()[0].instructions()); auto got_instructions = DumpInstructions(b.functions()[0].instructions());

View File

@ -228,46 +228,50 @@ TEST_F(BuilderTest, Emit_Multiple_EntryPoint_With_Same_ModuleVar) {
ASSERT_TRUE(b.Build()); ASSERT_TRUE(b.Build());
EXPECT_EQ(DumpBuilder(b), R"(OpCapability Shader EXPECT_EQ(DumpBuilder(b), R"(OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %7 "a" OpEntryPoint GLCompute %8 "a"
OpEntryPoint GLCompute %17 "b" OpEntryPoint GLCompute %18 "b"
OpExecutionMode %7 LocalSize 1 1 1 OpExecutionMode %8 LocalSize 1 1 1
OpExecutionMode %17 LocalSize 1 1 1 OpExecutionMode %18 LocalSize 1 1 1
OpName %3 "Data" OpName %3 "data_block"
OpMemberName %3 0 "d" OpMemberName %3 0 "inner"
OpName %4 "Data"
OpMemberName %4 0 "d"
OpName %1 "data" OpName %1 "data"
OpName %7 "a" OpName %8 "a"
OpName %14 "v" OpName %15 "v"
OpName %17 "b" OpName %18 "b"
OpName %21 "v" OpName %22 "v"
OpDecorate %3 Block OpDecorate %3 Block
OpMemberDecorate %3 0 Offset 0 OpMemberDecorate %3 0 Offset 0
OpMemberDecorate %4 0 Offset 0
OpDecorate %1 Binding 0 OpDecorate %1 Binding 0
OpDecorate %1 DescriptorSet 0 OpDecorate %1 DescriptorSet 0
%4 = OpTypeFloat 32 %5 = OpTypeFloat 32
%4 = OpTypeStruct %5
%3 = OpTypeStruct %4 %3 = OpTypeStruct %4
%2 = OpTypePointer StorageBuffer %3 %2 = OpTypePointer StorageBuffer %3
%1 = OpVariable %2 StorageBuffer %1 = OpVariable %2 StorageBuffer
%6 = OpTypeVoid %7 = OpTypeVoid
%5 = OpTypeFunction %6 %6 = OpTypeFunction %7
%9 = OpTypeInt 32 0 %10 = OpTypeInt 32 0
%10 = OpConstant %9 0 %11 = OpConstant %10 0
%11 = OpTypePointer StorageBuffer %4 %12 = OpTypePointer StorageBuffer %5
%15 = OpTypePointer Function %4 %16 = OpTypePointer Function %5
%16 = OpConstantNull %4 %17 = OpConstantNull %5
%7 = OpFunction %6 None %5 %8 = OpFunction %7 None %6
%8 = OpLabel %9 = OpLabel
%14 = OpVariable %15 Function %16 %15 = OpVariable %16 Function %17
%12 = OpAccessChain %11 %1 %10 %13 = OpAccessChain %12 %1 %11 %11
%13 = OpLoad %4 %12 %14 = OpLoad %5 %13
OpStore %14 %13 OpStore %15 %14
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%17 = OpFunction %6 None %5 %18 = OpFunction %7 None %6
%18 = OpLabel %19 = OpLabel
%21 = OpVariable %15 Function %16 %22 = OpVariable %16 Function %17
%19 = OpAccessChain %11 %1 %10 %20 = OpAccessChain %12 %1 %11 %11
%20 = OpLoad %4 %19 %21 = OpLoad %5 %20
OpStore %21 %20 OpStore %22 %21
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
)"); )");

View File

@ -316,23 +316,27 @@ TEST_F(BuilderTest, GlobalVar_DeclReadOnly) {
EXPECT_EQ(DumpInstructions(b.annots()), R"(OpDecorate %3 Block EXPECT_EQ(DumpInstructions(b.annots()), R"(OpDecorate %3 Block
OpMemberDecorate %3 0 Offset 0 OpMemberDecorate %3 0 Offset 0
OpMemberDecorate %3 1 Offset 4 OpMemberDecorate %4 0 Offset 0
OpMemberDecorate %4 1 Offset 4
OpDecorate %1 NonWritable OpDecorate %1 NonWritable
OpDecorate %1 Binding 0 OpDecorate %1 Binding 0
OpDecorate %1 DescriptorSet 0 OpDecorate %1 DescriptorSet 0
)"); )");
EXPECT_EQ(DumpInstructions(b.debug()), R"(OpName %3 "A" EXPECT_EQ(DumpInstructions(b.debug()), R"(OpName %3 "b_block"
OpMemberName %3 0 "a" OpMemberName %3 0 "inner"
OpMemberName %3 1 "b" OpName %4 "A"
OpMemberName %4 0 "a"
OpMemberName %4 1 "b"
OpName %1 "b" OpName %1 "b"
OpName %7 "unused_entry_point" OpName %8 "unused_entry_point"
)"); )");
EXPECT_EQ(DumpInstructions(b.types()), R"(%4 = OpTypeInt 32 1 EXPECT_EQ(DumpInstructions(b.types()), R"(%5 = OpTypeInt 32 1
%3 = OpTypeStruct %4 %4 %4 = OpTypeStruct %5 %5
%3 = OpTypeStruct %4
%2 = OpTypePointer StorageBuffer %3 %2 = OpTypePointer StorageBuffer %3
%1 = OpVariable %2 StorageBuffer %1 = OpVariable %2 StorageBuffer
%6 = OpTypeVoid %7 = OpTypeVoid
%5 = OpTypeFunction %6 %6 = OpTypeFunction %7
)"); )");
} }
@ -354,21 +358,25 @@ TEST_F(BuilderTest, GlobalVar_TypeAliasDeclReadOnly) {
EXPECT_EQ(DumpInstructions(b.annots()), R"(OpDecorate %3 Block EXPECT_EQ(DumpInstructions(b.annots()), R"(OpDecorate %3 Block
OpMemberDecorate %3 0 Offset 0 OpMemberDecorate %3 0 Offset 0
OpMemberDecorate %4 0 Offset 0
OpDecorate %1 NonWritable OpDecorate %1 NonWritable
OpDecorate %1 Binding 0 OpDecorate %1 Binding 0
OpDecorate %1 DescriptorSet 0 OpDecorate %1 DescriptorSet 0
)"); )");
EXPECT_EQ(DumpInstructions(b.debug()), R"(OpName %3 "A" EXPECT_EQ(DumpInstructions(b.debug()), R"(OpName %3 "b_block"
OpMemberName %3 0 "a" OpMemberName %3 0 "inner"
OpName %4 "A"
OpMemberName %4 0 "a"
OpName %1 "b" OpName %1 "b"
OpName %7 "unused_entry_point" OpName %8 "unused_entry_point"
)"); )");
EXPECT_EQ(DumpInstructions(b.types()), R"(%4 = OpTypeInt 32 1 EXPECT_EQ(DumpInstructions(b.types()), R"(%5 = OpTypeInt 32 1
%4 = OpTypeStruct %5
%3 = OpTypeStruct %4 %3 = OpTypeStruct %4
%2 = OpTypePointer StorageBuffer %3 %2 = OpTypePointer StorageBuffer %3
%1 = OpVariable %2 StorageBuffer %1 = OpVariable %2 StorageBuffer
%6 = OpTypeVoid %7 = OpTypeVoid
%5 = OpTypeFunction %6 %6 = OpTypeFunction %7
)"); )");
} }
@ -390,21 +398,25 @@ TEST_F(BuilderTest, GlobalVar_TypeAliasAssignReadOnly) {
EXPECT_EQ(DumpInstructions(b.annots()), R"(OpDecorate %3 Block EXPECT_EQ(DumpInstructions(b.annots()), R"(OpDecorate %3 Block
OpMemberDecorate %3 0 Offset 0 OpMemberDecorate %3 0 Offset 0
OpMemberDecorate %4 0 Offset 0
OpDecorate %1 NonWritable OpDecorate %1 NonWritable
OpDecorate %1 Binding 0 OpDecorate %1 Binding 0
OpDecorate %1 DescriptorSet 0 OpDecorate %1 DescriptorSet 0
)"); )");
EXPECT_EQ(DumpInstructions(b.debug()), R"(OpName %3 "A" EXPECT_EQ(DumpInstructions(b.debug()), R"(OpName %3 "b_block"
OpMemberName %3 0 "a" OpMemberName %3 0 "inner"
OpName %4 "A"
OpMemberName %4 0 "a"
OpName %1 "b" OpName %1 "b"
OpName %7 "unused_entry_point" OpName %8 "unused_entry_point"
)"); )");
EXPECT_EQ(DumpInstructions(b.types()), R"(%4 = OpTypeInt 32 1 EXPECT_EQ(DumpInstructions(b.types()), R"(%5 = OpTypeInt 32 1
%4 = OpTypeStruct %5
%3 = OpTypeStruct %4 %3 = OpTypeStruct %4
%2 = OpTypePointer StorageBuffer %3 %2 = OpTypePointer StorageBuffer %3
%1 = OpVariable %2 StorageBuffer %1 = OpVariable %2 StorageBuffer
%6 = OpTypeVoid %7 = OpTypeVoid
%5 = OpTypeFunction %6 %6 = OpTypeFunction %7
)"); )");
} }
@ -428,25 +440,29 @@ TEST_F(BuilderTest, GlobalVar_TwoVarDeclReadOnly) {
EXPECT_EQ(DumpInstructions(b.annots()), EXPECT_EQ(DumpInstructions(b.annots()),
R"(OpDecorate %3 Block R"(OpDecorate %3 Block
OpMemberDecorate %3 0 Offset 0 OpMemberDecorate %3 0 Offset 0
OpMemberDecorate %4 0 Offset 0
OpDecorate %1 NonWritable OpDecorate %1 NonWritable
OpDecorate %1 DescriptorSet 0 OpDecorate %1 DescriptorSet 0
OpDecorate %1 Binding 0 OpDecorate %1 Binding 0
OpDecorate %5 DescriptorSet 1 OpDecorate %6 DescriptorSet 1
OpDecorate %5 Binding 0 OpDecorate %6 Binding 0
)"); )");
EXPECT_EQ(DumpInstructions(b.debug()), R"(OpName %3 "A" EXPECT_EQ(DumpInstructions(b.debug()), R"(OpName %3 "b_block"
OpMemberName %3 0 "a" OpMemberName %3 0 "inner"
OpName %4 "A"
OpMemberName %4 0 "a"
OpName %1 "b" OpName %1 "b"
OpName %5 "c" OpName %6 "c"
OpName %8 "unused_entry_point" OpName %9 "unused_entry_point"
)"); )");
EXPECT_EQ(DumpInstructions(b.types()), R"(%4 = OpTypeInt 32 1 EXPECT_EQ(DumpInstructions(b.types()), R"(%5 = OpTypeInt 32 1
%4 = OpTypeStruct %5
%3 = OpTypeStruct %4 %3 = OpTypeStruct %4
%2 = OpTypePointer StorageBuffer %3 %2 = OpTypePointer StorageBuffer %3
%1 = OpVariable %2 StorageBuffer %1 = OpVariable %2 StorageBuffer
%5 = OpVariable %2 StorageBuffer %6 = OpVariable %2 StorageBuffer
%7 = OpTypeVoid %8 = OpTypeVoid
%6 = OpTypeFunction %7 %7 = OpTypeFunction %8
)"); )");
} }

View File

@ -8,6 +8,10 @@ struct S {
ivec4 arr[4]; ivec4 arr[4];
}; };
struct S_nested {
int arr[4][3][2];
};
ivec4 src_private[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0)); ivec4 src_private[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
shared ivec4 src_workgroup[4]; shared ivec4 src_workgroup[4];
layout(binding = 0, std140) uniform src_uniform_block_ubo { layout(binding = 0, std140) uniform src_uniform_block_ubo {
@ -22,8 +26,8 @@ layout(binding = 2, std430) buffer src_uniform_block_ssbo_1 {
S inner; S inner;
} dst; } dst;
layout(binding = 3, std430) buffer S_nested_ssbo { layout(binding = 3, std430) buffer dst_nested_block_ssbo {
int arr[4][3][2]; S_nested inner;
} dst_nested; } dst_nested;
ivec4[4] ret_arr() { ivec4[4] ret_arr() {
@ -53,6 +57,6 @@ void foo(ivec4 src_param[4]) {
dst.inner.arr = src_uniform.inner.arr; dst.inner.arr = src_uniform.inner.arr;
dst.inner.arr = src_storage.inner.arr; dst.inner.arr = src_storage.inner.arr;
int src_nested[4][3][2] = int[4][3][2](int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0))); int src_nested[4][3][2] = int[4][3][2](int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)));
dst_nested.arr = src_nested; dst_nested.inner.arr = src_nested;
} }

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: 79 ; Bound: 80
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
@ -16,6 +16,8 @@
OpName %src_uniform "src_uniform" OpName %src_uniform "src_uniform"
OpName %src_storage "src_storage" OpName %src_storage "src_storage"
OpName %dst "dst" OpName %dst "dst"
OpName %dst_nested_block "dst_nested_block"
OpMemberName %dst_nested_block 0 "inner"
OpName %S_nested "S_nested" OpName %S_nested "S_nested"
OpMemberName %S_nested 0 "arr" OpMemberName %S_nested 0 "arr"
OpName %dst_nested "dst_nested" OpName %dst_nested "dst_nested"
@ -37,7 +39,8 @@
OpDecorate %src_storage Binding 1 OpDecorate %src_storage Binding 1
OpDecorate %dst DescriptorSet 0 OpDecorate %dst DescriptorSet 0
OpDecorate %dst Binding 2 OpDecorate %dst Binding 2
OpDecorate %S_nested Block OpDecorate %dst_nested_block Block
OpMemberDecorate %dst_nested_block 0 Offset 0
OpMemberDecorate %S_nested 0 Offset 0 OpMemberDecorate %S_nested 0 Offset 0
OpDecorate %_arr_int_uint_2 ArrayStride 4 OpDecorate %_arr_int_uint_2 ArrayStride 4
OpDecorate %_arr__arr_int_uint_2_uint_3 ArrayStride 8 OpDecorate %_arr__arr_int_uint_2_uint_3 ArrayStride 8
@ -67,77 +70,78 @@
%_arr__arr_int_uint_2_uint_3 = OpTypeArray %_arr_int_uint_2 %uint_3 %_arr__arr_int_uint_2_uint_3 = OpTypeArray %_arr_int_uint_2 %uint_3
%_arr__arr__arr_int_uint_2_uint_3_uint_4 = OpTypeArray %_arr__arr_int_uint_2_uint_3 %uint_4 %_arr__arr__arr_int_uint_2_uint_3_uint_4 = OpTypeArray %_arr__arr_int_uint_2_uint_3 %uint_4
%S_nested = OpTypeStruct %_arr__arr__arr_int_uint_2_uint_3_uint_4 %S_nested = OpTypeStruct %_arr__arr__arr_int_uint_2_uint_3_uint_4
%_ptr_StorageBuffer_S_nested = OpTypePointer StorageBuffer %S_nested %dst_nested_block = OpTypeStruct %S_nested
%dst_nested = OpVariable %_ptr_StorageBuffer_S_nested StorageBuffer %_ptr_StorageBuffer_dst_nested_block = OpTypePointer StorageBuffer %dst_nested_block
%dst_nested = OpVariable %_ptr_StorageBuffer_dst_nested_block StorageBuffer
%void = OpTypeVoid %void = OpTypeVoid
%26 = OpTypeFunction %void %27 = OpTypeFunction %void
%30 = OpTypeFunction %_arr_v4int_uint_4 %31 = OpTypeFunction %_arr_v4int_uint_4
%33 = OpTypeFunction %S %34 = OpTypeFunction %S
%36 = OpConstantNull %S %37 = OpConstantNull %S
%37 = OpTypeFunction %void %_arr_v4int_uint_4 %38 = OpTypeFunction %void %_arr_v4int_uint_4
%_ptr_Function__arr_v4int_uint_4 = OpTypePointer Function %_arr_v4int_uint_4 %_ptr_Function__arr_v4int_uint_4 = OpTypePointer Function %_arr_v4int_uint_4
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer__arr_v4int_uint_4 = OpTypePointer StorageBuffer %_arr_v4int_uint_4 %_ptr_StorageBuffer__arr_v4int_uint_4 = OpTypePointer StorageBuffer %_arr_v4int_uint_4
%int_1 = OpConstant %int 1 %int_1 = OpConstant %int 1
%47 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 %48 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1
%int_2 = OpConstant %int 2 %int_2 = OpConstant %int 2
%49 = OpConstantComposite %v4int %int_2 %int_2 %int_2 %int_2 %50 = OpConstantComposite %v4int %int_2 %int_2 %int_2 %int_2
%int_3 = OpConstant %int 3 %int_3 = OpConstant %int 3
%51 = OpConstantComposite %v4int %int_3 %int_3 %int_3 %int_3 %52 = OpConstantComposite %v4int %int_3 %int_3 %int_3 %int_3
%52 = OpConstantComposite %_arr_v4int_uint_4 %47 %49 %51 %51 %53 = OpConstantComposite %_arr_v4int_uint_4 %48 %50 %52 %52
%_ptr_Uniform__arr_v4int_uint_4 = OpTypePointer Uniform %_arr_v4int_uint_4 %_ptr_Uniform__arr_v4int_uint_4 = OpTypePointer Uniform %_arr_v4int_uint_4
%_ptr_Function__arr__arr__arr_int_uint_2_uint_3_uint_4 = OpTypePointer Function %_arr__arr__arr_int_uint_2_uint_3_uint_4 %_ptr_Function__arr__arr__arr_int_uint_2_uint_3_uint_4 = OpTypePointer Function %_arr__arr__arr_int_uint_2_uint_3_uint_4
%75 = OpConstantNull %_arr__arr__arr_int_uint_2_uint_3_uint_4 %76 = OpConstantNull %_arr__arr__arr_int_uint_2_uint_3_uint_4
%_ptr_StorageBuffer__arr__arr__arr_int_uint_2_uint_3_uint_4 = OpTypePointer StorageBuffer %_arr__arr__arr_int_uint_2_uint_3_uint_4 %_ptr_StorageBuffer__arr__arr__arr_int_uint_2_uint_3_uint_4 = OpTypePointer StorageBuffer %_arr__arr__arr_int_uint_2_uint_3_uint_4
%unused_entry_point = OpFunction %void None %26 %unused_entry_point = OpFunction %void None %27
%29 = OpLabel %30 = OpLabel
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%ret_arr = OpFunction %_arr_v4int_uint_4 None %30 %ret_arr = OpFunction %_arr_v4int_uint_4 None %31
%32 = OpLabel %33 = OpLabel
OpReturnValue %8 OpReturnValue %8
OpFunctionEnd OpFunctionEnd
%ret_struct_arr = OpFunction %S None %33 %ret_struct_arr = OpFunction %S None %34
%35 = OpLabel %36 = OpLabel
OpReturnValue %36 OpReturnValue %37
OpFunctionEnd OpFunctionEnd
%foo = OpFunction %void None %37 %foo = OpFunction %void None %38
%src_param = OpFunctionParameter %_arr_v4int_uint_4 %src_param = OpFunctionParameter %_arr_v4int_uint_4
%40 = OpLabel %41 = OpLabel
%src_function = OpVariable %_ptr_Function__arr_v4int_uint_4 Function %8 %src_function = OpVariable %_ptr_Function__arr_v4int_uint_4 Function %8
%src_nested = OpVariable %_ptr_Function__arr__arr__arr_int_uint_2_uint_3_uint_4 Function %75 %src_nested = OpVariable %_ptr_Function__arr__arr__arr_int_uint_2_uint_3_uint_4 Function %76
%45 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %uint_0 %46 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %uint_0
OpStore %45 %52 OpStore %46 %53
%53 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %uint_0 %54 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %uint_0
OpStore %53 %src_param OpStore %54 %src_param
%54 = OpFunctionCall %_arr_v4int_uint_4 %ret_arr %55 = OpFunctionCall %_arr_v4int_uint_4 %ret_arr
%55 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %uint_0
OpStore %55 %54
%56 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %uint_0 %56 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %uint_0
OpStore %56 %8 OpStore %56 %55
%57 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %uint_0 %57 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %uint_0
%58 = OpLoad %_arr_v4int_uint_4 %src_function OpStore %57 %8
OpStore %57 %58 %58 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %uint_0
%59 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %uint_0 %59 = OpLoad %_arr_v4int_uint_4 %src_function
%60 = OpLoad %_arr_v4int_uint_4 %src_private OpStore %58 %59
OpStore %59 %60 %60 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %uint_0
%61 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %uint_0 %61 = OpLoad %_arr_v4int_uint_4 %src_private
%62 = OpLoad %_arr_v4int_uint_4 %src_workgroup OpStore %60 %61
OpStore %61 %62 %62 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %uint_0
%63 = OpFunctionCall %S %ret_struct_arr %63 = OpLoad %_arr_v4int_uint_4 %src_workgroup
%64 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %uint_0 OpStore %62 %63
%65 = OpCompositeExtract %_arr_v4int_uint_4 %63 0 %64 = OpFunctionCall %S %ret_struct_arr
OpStore %64 %65 %65 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %uint_0
%66 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %uint_0 %66 = OpCompositeExtract %_arr_v4int_uint_4 %64 0
%68 = OpAccessChain %_ptr_Uniform__arr_v4int_uint_4 %src_uniform %uint_0 %uint_0 OpStore %65 %66
%69 = OpLoad %_arr_v4int_uint_4 %68 %67 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %uint_0
OpStore %66 %69 %69 = OpAccessChain %_ptr_Uniform__arr_v4int_uint_4 %src_uniform %uint_0 %uint_0
%70 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %uint_0 %70 = OpLoad %_arr_v4int_uint_4 %69
%71 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %src_storage %uint_0 %uint_0 OpStore %67 %70
%72 = OpLoad %_arr_v4int_uint_4 %71 %71 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %uint_0
OpStore %70 %72 %72 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %src_storage %uint_0 %uint_0
%77 = OpAccessChain %_ptr_StorageBuffer__arr__arr__arr_int_uint_2_uint_3_uint_4 %dst_nested %uint_0 %73 = OpLoad %_arr_v4int_uint_4 %72
%78 = OpLoad %_arr__arr__arr_int_uint_2_uint_3_uint_4 %src_nested OpStore %71 %73
OpStore %77 %78 %78 = OpAccessChain %_ptr_StorageBuffer__arr__arr__arr_int_uint_2_uint_3_uint_4 %dst_nested %uint_0 %uint_0
%79 = OpLoad %_arr__arr__arr_int_uint_2_uint_3_uint_4 %src_nested
OpStore %78 %79
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -29,18 +29,22 @@ struct strided_arr_1 {
uint pad_20; uint pad_20;
}; };
layout(binding = 0, std430) buffer S_ssbo { struct S {
strided_arr_1 a[4]; strided_arr_1 a[4];
};
layout(binding = 0, std430) buffer s_block_ssbo {
S inner;
} s; } s;
void f_1() { void f_1() {
strided_arr_1 x_19[4] = s.a; strided_arr_1 x_19[4] = s.inner.a;
strided_arr x_24[3][2] = s.a[3].el; strided_arr x_24[3][2] = s.inner.a[3].el;
strided_arr x_28[2] = s.a[3].el[2]; strided_arr x_28[2] = s.inner.a[3].el[2];
float x_32 = s.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] = 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.a = tint_symbol; s.inner.a = tint_symbol;
s.a[3].el[2][1].el = 5.0f; s.inner.a[3].el[2][1].el = 5.0f;
return; return;
} }

View File

@ -1,12 +1,14 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 42 ; Bound: 43
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f" OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1 OpExecutionMode %f LocalSize 1 1 1
OpName %s_block "s_block"
OpMemberName %s_block 0 "inner"
OpName %S "S" OpName %S "S"
OpMemberName %S 0 "a" OpMemberName %S 0 "a"
OpName %strided_arr_1 "strided_arr_1" OpName %strided_arr_1 "strided_arr_1"
@ -16,7 +18,8 @@
OpName %s "s" OpName %s "s"
OpName %f_1 "f_1" OpName %f_1 "f_1"
OpName %f "f" OpName %f "f"
OpDecorate %S Block OpDecorate %s_block Block
OpMemberDecorate %s_block 0 Offset 0
OpMemberDecorate %S 0 Offset 0 OpMemberDecorate %S 0 Offset 0
OpMemberDecorate %strided_arr_1 0 Offset 0 OpMemberDecorate %strided_arr_1 0 Offset 0
OpMemberDecorate %strided_arr 0 Offset 0 OpMemberDecorate %strided_arr 0 Offset 0
@ -36,10 +39,11 @@
%uint_4 = OpConstant %uint 4 %uint_4 = OpConstant %uint 4
%_arr_strided_arr_1_uint_4 = OpTypeArray %strided_arr_1 %uint_4 %_arr_strided_arr_1_uint_4 = OpTypeArray %strided_arr_1 %uint_4
%S = OpTypeStruct %_arr_strided_arr_1_uint_4 %S = OpTypeStruct %_arr_strided_arr_1_uint_4
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S %s_block = OpTypeStruct %S
%s = OpVariable %_ptr_StorageBuffer_S StorageBuffer %_ptr_StorageBuffer_s_block = OpTypePointer StorageBuffer %s_block
%s = OpVariable %_ptr_StorageBuffer_s_block StorageBuffer
%void = OpTypeVoid %void = OpTypeVoid
%14 = OpTypeFunction %void %15 = OpTypeFunction %void
%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 %_ptr_StorageBuffer__arr_strided_arr_1_uint_4 = OpTypePointer StorageBuffer %_arr_strided_arr_1_uint_4
%int = OpTypeInt 32 1 %int = OpTypeInt 32 1
@ -49,26 +53,26 @@
%_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 %_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
%36 = OpConstantNull %_arr_strided_arr_1_uint_4 %37 = OpConstantNull %_arr_strided_arr_1_uint_4
%float_5 = OpConstant %float 5 %float_5 = OpConstant %float 5
%f_1 = OpFunction %void None %14 %f_1 = OpFunction %void None %15
%17 = OpLabel %18 = OpLabel
%20 = OpAccessChain %_ptr_StorageBuffer__arr_strided_arr_1_uint_4 %s %uint_0 %21 = OpAccessChain %_ptr_StorageBuffer__arr_strided_arr_1_uint_4 %s %uint_0 %uint_0
%21 = OpLoad %_arr_strided_arr_1_uint_4 %20 %22 = OpLoad %_arr_strided_arr_1_uint_4 %21
%25 = OpAccessChain %_ptr_StorageBuffer__arr__arr_strided_arr_uint_2_uint_3 %s %uint_0 %int_3 %uint_0 %26 = OpAccessChain %_ptr_StorageBuffer__arr__arr_strided_arr_uint_2_uint_3 %s %uint_0 %uint_0 %int_3 %uint_0
%26 = OpLoad %_arr__arr_strided_arr_uint_2_uint_3 %25 %27 = OpLoad %_arr__arr_strided_arr_uint_2_uint_3 %26
%29 = OpAccessChain %_ptr_StorageBuffer__arr_strided_arr_uint_2 %s %uint_0 %int_3 %uint_0 %int_2 %30 = OpAccessChain %_ptr_StorageBuffer__arr_strided_arr_uint_2 %s %uint_0 %uint_0 %int_3 %uint_0 %int_2
%30 = OpLoad %_arr_strided_arr_uint_2 %29 %31 = OpLoad %_arr_strided_arr_uint_2 %30
%33 = OpAccessChain %_ptr_StorageBuffer_float %s %uint_0 %int_3 %uint_0 %int_2 %int_1 %uint_0 %34 = OpAccessChain %_ptr_StorageBuffer_float %s %uint_0 %uint_0 %int_3 %uint_0 %int_2 %int_1 %uint_0
%34 = OpLoad %float %33 %35 = OpLoad %float %34
%35 = OpAccessChain %_ptr_StorageBuffer__arr_strided_arr_1_uint_4 %s %uint_0 %36 = OpAccessChain %_ptr_StorageBuffer__arr_strided_arr_1_uint_4 %s %uint_0 %uint_0
OpStore %35 %36 OpStore %36 %37
%37 = OpAccessChain %_ptr_StorageBuffer_float %s %uint_0 %int_3 %uint_0 %int_2 %int_1 %uint_0 %38 = OpAccessChain %_ptr_StorageBuffer_float %s %uint_0 %uint_0 %int_3 %uint_0 %int_2 %int_1 %uint_0
OpStore %37 %float_5 OpStore %38 %float_5
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%f = OpFunction %void None %14 %f = OpFunction %void None %15
%40 = OpLabel %41 = OpLabel
%41 = OpFunctionCall %void %f_1 %42 = OpFunctionCall %void %f_1
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -4,7 +4,7 @@ struct Inner {
int x; int x;
}; };
layout(binding = 0, std430) buffer S_ssbo { struct S {
ivec3 a; ivec3 a;
int b; int b;
uvec3 c; uvec3 c;
@ -16,19 +16,23 @@ layout(binding = 0, std430) buffer S_ssbo {
Inner i; Inner i;
Inner j[4]; Inner j[4];
uint pad; uint pad;
};
layout(binding = 0, std430) buffer s_block_ssbo {
S inner;
} s; } s;
void tint_symbol() { void tint_symbol() {
ivec3 a = s.a; ivec3 a = s.inner.a;
int b = s.b; int b = s.inner.b;
uvec3 c = s.c; uvec3 c = s.inner.c;
uint d = s.d; uint d = s.inner.d;
vec3 e = s.e; vec3 e = s.inner.e;
float f = s.f; float f = s.inner.f;
mat2x3 g = s.g; mat2x3 g = s.inner.g;
mat3x2 h = s.h; mat3x2 h = s.inner.h;
Inner i = s.i; Inner i = s.inner.i;
Inner j[4] = s.j; Inner j[4] = s.inner.j;
} }
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

@ -1,12 +1,14 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 59 ; Bound: 60
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main" OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1 OpExecutionMode %main LocalSize 1 1 1
OpName %s_block "s_block"
OpMemberName %s_block 0 "inner"
OpName %S "S" OpName %S "S"
OpMemberName %S 0 "a" OpMemberName %S 0 "a"
OpMemberName %S 1 "b" OpMemberName %S 1 "b"
@ -22,7 +24,8 @@
OpMemberName %S 9 "j" OpMemberName %S 9 "j"
OpName %s "s" OpName %s "s"
OpName %main "main" OpName %main "main"
OpDecorate %S Block OpDecorate %s_block Block
OpMemberDecorate %s_block 0 Offset 0
OpMemberDecorate %S 0 Offset 0 OpMemberDecorate %S 0 Offset 0
OpMemberDecorate %S 1 Offset 12 OpMemberDecorate %S 1 Offset 12
OpMemberDecorate %S 2 Offset 16 OpMemberDecorate %S 2 Offset 16
@ -55,10 +58,11 @@
%uint_4 = OpConstant %uint 4 %uint_4 = OpConstant %uint 4
%_arr_Inner_uint_4 = OpTypeArray %Inner %uint_4 %_arr_Inner_uint_4 = OpTypeArray %Inner %uint_4
%S = OpTypeStruct %v3int %int %v3uint %uint %v3float %float %mat2v3float %mat3v2float %Inner %_arr_Inner_uint_4 %S = OpTypeStruct %v3int %int %v3uint %uint %v3float %float %mat2v3float %mat3v2float %Inner %_arr_Inner_uint_4
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S %s_block = OpTypeStruct %S
%s = OpVariable %_ptr_StorageBuffer_S StorageBuffer %_ptr_StorageBuffer_s_block = OpTypePointer StorageBuffer %s_block
%s = OpVariable %_ptr_StorageBuffer_s_block StorageBuffer
%void = OpTypeVoid %void = OpTypeVoid
%16 = OpTypeFunction %void %17 = OpTypeFunction %void
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer_v3int = OpTypePointer StorageBuffer %v3int %_ptr_StorageBuffer_v3int = OpTypePointer StorageBuffer %v3int
%uint_1 = OpConstant %uint 1 %uint_1 = OpConstant %uint 1
@ -78,27 +82,27 @@
%_ptr_StorageBuffer_Inner = OpTypePointer StorageBuffer %Inner %_ptr_StorageBuffer_Inner = OpTypePointer StorageBuffer %Inner
%uint_9 = OpConstant %uint 9 %uint_9 = OpConstant %uint 9
%_ptr_StorageBuffer__arr_Inner_uint_4 = OpTypePointer StorageBuffer %_arr_Inner_uint_4 %_ptr_StorageBuffer__arr_Inner_uint_4 = OpTypePointer StorageBuffer %_arr_Inner_uint_4
%main = OpFunction %void None %16 %main = OpFunction %void None %17
%19 = OpLabel %20 = OpLabel
%22 = OpAccessChain %_ptr_StorageBuffer_v3int %s %uint_0 %23 = OpAccessChain %_ptr_StorageBuffer_v3int %s %uint_0 %uint_0
%23 = OpLoad %v3int %22 %24 = OpLoad %v3int %23
%26 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_1 %27 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %uint_1
%27 = OpLoad %int %26 %28 = OpLoad %int %27
%30 = OpAccessChain %_ptr_StorageBuffer_v3uint %s %uint_2 %31 = OpAccessChain %_ptr_StorageBuffer_v3uint %s %uint_0 %uint_2
%31 = OpLoad %v3uint %30 %32 = OpLoad %v3uint %31
%34 = OpAccessChain %_ptr_StorageBuffer_uint %s %uint_3 %35 = OpAccessChain %_ptr_StorageBuffer_uint %s %uint_0 %uint_3
%35 = OpLoad %uint %34 %36 = OpLoad %uint %35
%37 = OpAccessChain %_ptr_StorageBuffer_v3float %s %uint_4 %38 = OpAccessChain %_ptr_StorageBuffer_v3float %s %uint_0 %uint_4
%38 = OpLoad %v3float %37 %39 = OpLoad %v3float %38
%41 = OpAccessChain %_ptr_StorageBuffer_float %s %uint_5 %42 = OpAccessChain %_ptr_StorageBuffer_float %s %uint_0 %uint_5
%42 = OpLoad %float %41 %43 = OpLoad %float %42
%45 = OpAccessChain %_ptr_StorageBuffer_mat2v3float %s %uint_6 %46 = OpAccessChain %_ptr_StorageBuffer_mat2v3float %s %uint_0 %uint_6
%46 = OpLoad %mat2v3float %45 %47 = OpLoad %mat2v3float %46
%49 = OpAccessChain %_ptr_StorageBuffer_mat3v2float %s %uint_7 %50 = OpAccessChain %_ptr_StorageBuffer_mat3v2float %s %uint_0 %uint_7
%50 = OpLoad %mat3v2float %49 %51 = OpLoad %mat3v2float %50
%53 = OpAccessChain %_ptr_StorageBuffer_Inner %s %uint_8 %54 = OpAccessChain %_ptr_StorageBuffer_Inner %s %uint_0 %uint_8
%54 = OpLoad %Inner %53 %55 = OpLoad %Inner %54
%57 = OpAccessChain %_ptr_StorageBuffer__arr_Inner_uint_4 %s %uint_9 %58 = OpAccessChain %_ptr_StorageBuffer__arr_Inner_uint_4 %s %uint_0 %uint_9
%58 = OpLoad %_arr_Inner_uint_4 %57 %59 = OpLoad %_arr_Inner_uint_4 %58
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -4,7 +4,7 @@ struct Inner {
int x; int x;
}; };
layout(binding = 0, std430) buffer S_ssbo { struct S {
ivec3 a; ivec3 a;
int b; int b;
uvec3 c; uvec3 c;
@ -16,21 +16,25 @@ layout(binding = 0, std430) buffer S_ssbo {
Inner i; Inner i;
Inner j[4]; Inner j[4];
uint pad; uint pad;
};
layout(binding = 0, std430) buffer s_block_ssbo {
S inner;
} s; } s;
void tint_symbol() { void tint_symbol() {
s.a = ivec3(0); s.inner.a = ivec3(0);
s.b = 0; s.inner.b = 0;
s.c = uvec3(0u); s.inner.c = uvec3(0u);
s.d = 0u; s.inner.d = 0u;
s.e = vec3(0.0f); s.inner.e = vec3(0.0f);
s.f = 0.0f; s.inner.f = 0.0f;
s.g = mat2x3(vec3(0.0f), vec3(0.0f)); s.inner.g = mat2x3(vec3(0.0f), vec3(0.0f));
s.h = mat3x2(vec2(0.0f), vec2(0.0f), vec2(0.0f)); s.inner.h = mat3x2(vec2(0.0f), vec2(0.0f), vec2(0.0f));
Inner tint_symbol_1 = Inner(0); Inner tint_symbol_1 = Inner(0);
s.i = tint_symbol_1; s.inner.i = tint_symbol_1;
Inner tint_symbol_2[4] = Inner[4](Inner(0), Inner(0), Inner(0), Inner(0)); Inner tint_symbol_2[4] = Inner[4](Inner(0), Inner(0), Inner(0), Inner(0));
s.j = tint_symbol_2; s.inner.j = 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

@ -1,12 +1,14 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 59 ; Bound: 60
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main" OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1 OpExecutionMode %main LocalSize 1 1 1
OpName %s_block "s_block"
OpMemberName %s_block 0 "inner"
OpName %S "S" OpName %S "S"
OpMemberName %S 0 "a" OpMemberName %S 0 "a"
OpMemberName %S 1 "b" OpMemberName %S 1 "b"
@ -22,7 +24,8 @@
OpMemberName %S 9 "j" OpMemberName %S 9 "j"
OpName %s "s" OpName %s "s"
OpName %main "main" OpName %main "main"
OpDecorate %S Block OpDecorate %s_block Block
OpMemberDecorate %s_block 0 Offset 0
OpMemberDecorate %S 0 Offset 0 OpMemberDecorate %S 0 Offset 0
OpMemberDecorate %S 1 Offset 12 OpMemberDecorate %S 1 Offset 12
OpMemberDecorate %S 2 Offset 16 OpMemberDecorate %S 2 Offset 16
@ -54,60 +57,61 @@
%uint_4 = OpConstant %uint 4 %uint_4 = OpConstant %uint 4
%_arr_Inner_uint_4 = OpTypeArray %Inner %uint_4 %_arr_Inner_uint_4 = OpTypeArray %Inner %uint_4
%S = OpTypeStruct %v3int %int %v3uint %uint %v3float %float %mat2v3float %mat3v2float %Inner %_arr_Inner_uint_4 %S = OpTypeStruct %v3int %int %v3uint %uint %v3float %float %mat2v3float %mat3v2float %Inner %_arr_Inner_uint_4
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S %s_block = OpTypeStruct %S
%s = OpVariable %_ptr_StorageBuffer_S StorageBuffer %_ptr_StorageBuffer_s_block = OpTypePointer StorageBuffer %s_block
%s = OpVariable %_ptr_StorageBuffer_s_block StorageBuffer
%void = OpTypeVoid %void = OpTypeVoid
%16 = OpTypeFunction %void %17 = OpTypeFunction %void
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer_v3int = OpTypePointer StorageBuffer %v3int %_ptr_StorageBuffer_v3int = OpTypePointer StorageBuffer %v3int
%23 = OpConstantNull %v3int %24 = OpConstantNull %v3int
%uint_1 = OpConstant %uint 1 %uint_1 = OpConstant %uint 1
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%27 = OpConstantNull %int %28 = OpConstantNull %int
%uint_2 = OpConstant %uint 2 %uint_2 = OpConstant %uint 2
%_ptr_StorageBuffer_v3uint = OpTypePointer StorageBuffer %v3uint %_ptr_StorageBuffer_v3uint = OpTypePointer StorageBuffer %v3uint
%31 = OpConstantNull %v3uint %32 = OpConstantNull %v3uint
%uint_3 = OpConstant %uint 3 %uint_3 = OpConstant %uint 3
%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
%35 = OpConstantNull %uint %36 = OpConstantNull %uint
%_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float %_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float
%38 = OpConstantNull %v3float %39 = OpConstantNull %v3float
%uint_5 = OpConstant %uint 5 %uint_5 = OpConstant %uint 5
%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float %_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
%42 = OpConstantNull %float %43 = OpConstantNull %float
%uint_6 = OpConstant %uint 6 %uint_6 = OpConstant %uint 6
%_ptr_StorageBuffer_mat2v3float = OpTypePointer StorageBuffer %mat2v3float %_ptr_StorageBuffer_mat2v3float = OpTypePointer StorageBuffer %mat2v3float
%46 = OpConstantNull %mat2v3float %47 = OpConstantNull %mat2v3float
%uint_7 = OpConstant %uint 7 %uint_7 = OpConstant %uint 7
%_ptr_StorageBuffer_mat3v2float = OpTypePointer StorageBuffer %mat3v2float %_ptr_StorageBuffer_mat3v2float = OpTypePointer StorageBuffer %mat3v2float
%50 = OpConstantNull %mat3v2float %51 = OpConstantNull %mat3v2float
%uint_8 = OpConstant %uint 8 %uint_8 = OpConstant %uint 8
%_ptr_StorageBuffer_Inner = OpTypePointer StorageBuffer %Inner %_ptr_StorageBuffer_Inner = OpTypePointer StorageBuffer %Inner
%54 = OpConstantNull %Inner %55 = OpConstantNull %Inner
%uint_9 = OpConstant %uint 9 %uint_9 = OpConstant %uint 9
%_ptr_StorageBuffer__arr_Inner_uint_4 = OpTypePointer StorageBuffer %_arr_Inner_uint_4 %_ptr_StorageBuffer__arr_Inner_uint_4 = OpTypePointer StorageBuffer %_arr_Inner_uint_4
%58 = OpConstantNull %_arr_Inner_uint_4 %59 = OpConstantNull %_arr_Inner_uint_4
%main = OpFunction %void None %16 %main = OpFunction %void None %17
%19 = OpLabel %20 = OpLabel
%22 = OpAccessChain %_ptr_StorageBuffer_v3int %s %uint_0 %23 = OpAccessChain %_ptr_StorageBuffer_v3int %s %uint_0 %uint_0
OpStore %22 %23 OpStore %23 %24
%26 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_1 %27 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %uint_1
OpStore %26 %27 OpStore %27 %28
%30 = OpAccessChain %_ptr_StorageBuffer_v3uint %s %uint_2 %31 = OpAccessChain %_ptr_StorageBuffer_v3uint %s %uint_0 %uint_2
OpStore %30 %31 OpStore %31 %32
%34 = OpAccessChain %_ptr_StorageBuffer_uint %s %uint_3 %35 = OpAccessChain %_ptr_StorageBuffer_uint %s %uint_0 %uint_3
OpStore %34 %35 OpStore %35 %36
%37 = OpAccessChain %_ptr_StorageBuffer_v3float %s %uint_4 %38 = OpAccessChain %_ptr_StorageBuffer_v3float %s %uint_0 %uint_4
OpStore %37 %38 OpStore %38 %39
%41 = OpAccessChain %_ptr_StorageBuffer_float %s %uint_5 %42 = OpAccessChain %_ptr_StorageBuffer_float %s %uint_0 %uint_5
OpStore %41 %42 OpStore %42 %43
%45 = OpAccessChain %_ptr_StorageBuffer_mat2v3float %s %uint_6 %46 = OpAccessChain %_ptr_StorageBuffer_mat2v3float %s %uint_0 %uint_6
OpStore %45 %46 OpStore %46 %47
%49 = OpAccessChain %_ptr_StorageBuffer_mat3v2float %s %uint_7 %50 = OpAccessChain %_ptr_StorageBuffer_mat3v2float %s %uint_0 %uint_7
OpStore %49 %50 OpStore %50 %51
%53 = OpAccessChain %_ptr_StorageBuffer_Inner %s %uint_8 %54 = OpAccessChain %_ptr_StorageBuffer_Inner %s %uint_0 %uint_8
OpStore %53 %54 OpStore %54 %55
%57 = OpAccessChain %_ptr_StorageBuffer__arr_Inner_uint_4 %s %uint_9 %58 = OpAccessChain %_ptr_StorageBuffer__arr_Inner_uint_4 %s %uint_0 %uint_9
OpStore %57 %58 OpStore %58 %59
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -1,21 +1,23 @@
SKIP: FAILED
#version 310 es #version 310 es
struct Inner { struct Inner {
float f; float f;
}; };
layout(binding = 0, std430) buffer S_ssbo { struct S {
Inner inner; Inner inner;
};
layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
S inner;
} tint_symbol; } tint_symbol;
layout(binding = 1, std430) buffer S_ssbo_1 { layout(binding = 1, std430) buffer tint_symbol_block_ssbo_1 {
Inner inner; S inner;
} tint_symbol_1; } tint_symbol_1;
void tint_symbol_2() { void tint_symbol_2() {
tint_symbol_1 = tint_symbol; tint_symbol_1.inner = tint_symbol.inner;
} }
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;
@ -23,10 +25,3 @@ void main() {
tint_symbol_2(); tint_symbol_2();
return; return;
} }
Error parsing GLSL shader:
ERROR: 0:16: 'assign' : cannot convert from 'layout( binding=0 column_major std430) buffer block{layout( column_major std430 offset=0) buffer structure{ global highp float f} inner}' to 'layout( binding=1 column_major std430) buffer block{layout( column_major std430 offset=0) buffer structure{ global highp float f} inner}'
ERROR: 0:16: '' : compilation terminated
ERROR: 2 compilation errors. No code generated.

View File

@ -1,12 +1,14 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 12 ; Bound: 18
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main" OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1 OpExecutionMode %main LocalSize 1 1 1
OpName %in_block "in_block"
OpMemberName %in_block 0 "inner"
OpName %S "S" OpName %S "S"
OpMemberName %S 0 "inner" OpMemberName %S 0 "inner"
OpName %Inner "Inner" OpName %Inner "Inner"
@ -14,7 +16,8 @@
OpName %in "in" OpName %in "in"
OpName %out "out" OpName %out "out"
OpName %main "main" OpName %main "main"
OpDecorate %S Block OpDecorate %in_block Block
OpMemberDecorate %in_block 0 Offset 0
OpMemberDecorate %S 0 Offset 0 OpMemberDecorate %S 0 Offset 0
OpMemberDecorate %Inner 0 Offset 0 OpMemberDecorate %Inner 0 Offset 0
OpDecorate %in NonWritable OpDecorate %in NonWritable
@ -25,14 +28,20 @@
%float = OpTypeFloat 32 %float = OpTypeFloat 32
%Inner = OpTypeStruct %float %Inner = OpTypeStruct %float
%S = OpTypeStruct %Inner %S = OpTypeStruct %Inner
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S %in_block = OpTypeStruct %S
%in = OpVariable %_ptr_StorageBuffer_S StorageBuffer %_ptr_StorageBuffer_in_block = OpTypePointer StorageBuffer %in_block
%out = OpVariable %_ptr_StorageBuffer_S StorageBuffer %in = OpVariable %_ptr_StorageBuffer_in_block StorageBuffer
%out = OpVariable %_ptr_StorageBuffer_in_block StorageBuffer
%void = OpTypeVoid %void = OpTypeVoid
%7 = OpTypeFunction %void %8 = OpTypeFunction %void
%main = OpFunction %void None %7 %uint = OpTypeInt 32 0
%10 = OpLabel %uint_0 = OpConstant %uint 0
%11 = OpLoad %S %in %_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
OpStore %out %11 %main = OpFunction %void None %8
%11 = OpLabel
%15 = OpAccessChain %_ptr_StorageBuffer_S %out %uint_0
%16 = OpAccessChain %_ptr_StorageBuffer_S %in %uint_0
%17 = OpLoad %S %16
OpStore %15 %17
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -34,27 +34,35 @@ struct Inner_std140 {
ivec4 k[4]; ivec4 k[4];
}; };
layout(binding = 0, std140) uniform S_std140_ubo { struct S {
Inner arr[8];
};
struct S_std140 {
Inner_std140 arr[8]; Inner_std140 arr[8];
};
layout(binding = 0, std140) uniform s_block_std140_ubo {
S_std140 inner;
} s; } s;
mat3x2 load_s_arr_p0_j(uint p0) { mat3x2 load_s_inner_arr_p0_j(uint p0) {
uint s_save = p0; uint s_save = p0;
return mat3x2(s.arr[s_save].j_0, s.arr[s_save].j_1, s.arr[s_save].j_2); return mat3x2(s.inner.arr[s_save].j_0, s.inner.arr[s_save].j_1, s.inner.arr[s_save].j_2);
} }
void tint_symbol(uint idx) { void tint_symbol(uint idx) {
ivec3 a = s.arr[idx].a; ivec3 a = s.inner.arr[idx].a;
int b = s.arr[idx].b; int b = s.inner.arr[idx].b;
uvec3 c = s.arr[idx].c; uvec3 c = s.inner.arr[idx].c;
uint d = s.arr[idx].d; uint d = s.inner.arr[idx].d;
vec3 e = s.arr[idx].e; vec3 e = s.inner.arr[idx].e;
float f = s.arr[idx].f; float f = s.inner.arr[idx].f;
ivec2 g = s.arr[idx].g; ivec2 g = s.inner.arr[idx].g;
ivec2 h = s.arr[idx].h; ivec2 h = s.inner.arr[idx].h;
mat2x3 i = s.arr[idx].i; mat2x3 i = s.inner.arr[idx].i;
mat3x2 j = load_s_arr_p0_j(uint(idx)); mat3x2 j = load_s_inner_arr_p0_j(uint(idx));
ivec4 k[4] = s.arr[idx].k; ivec4 k[4] = s.inner.arr[idx].k;
} }
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

@ -1,13 +1,15 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 92 ; Bound: 93
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main" %idx_1 OpEntryPoint GLCompute %main "main" %idx_1
OpExecutionMode %main LocalSize 1 1 1 OpExecutionMode %main LocalSize 1 1 1
OpName %idx_1 "idx_1" OpName %idx_1 "idx_1"
OpName %s_block_std140 "s_block_std140"
OpMemberName %s_block_std140 0 "inner"
OpName %S_std140 "S_std140" OpName %S_std140 "S_std140"
OpMemberName %S_std140 0 "arr" OpMemberName %S_std140 0 "arr"
OpName %Inner_std140 "Inner_std140" OpName %Inner_std140 "Inner_std140"
@ -25,13 +27,14 @@
OpMemberName %Inner_std140 11 "j_2" OpMemberName %Inner_std140 11 "j_2"
OpMemberName %Inner_std140 12 "k" OpMemberName %Inner_std140 12 "k"
OpName %s "s" OpName %s "s"
OpName %load_s_arr_p0_j "load_s_arr_p0_j" OpName %load_s_inner_arr_p0_j "load_s_inner_arr_p0_j"
OpName %p0 "p0" OpName %p0 "p0"
OpName %main_inner "main_inner" OpName %main_inner "main_inner"
OpName %idx "idx" OpName %idx "idx"
OpName %main "main" OpName %main "main"
OpDecorate %idx_1 BuiltIn LocalInvocationIndex OpDecorate %idx_1 BuiltIn LocalInvocationIndex
OpDecorate %S_std140 Block OpDecorate %s_block_std140 Block
OpMemberDecorate %s_block_std140 0 Offset 0
OpMemberDecorate %S_std140 0 Offset 0 OpMemberDecorate %S_std140 0 Offset 0
OpMemberDecorate %Inner_std140 0 Offset 0 OpMemberDecorate %Inner_std140 0 Offset 0
OpMemberDecorate %Inner_std140 1 Offset 12 OpMemberDecorate %Inner_std140 1 Offset 12
@ -71,10 +74,11 @@
%uint_8 = OpConstant %uint 8 %uint_8 = OpConstant %uint 8
%_arr_Inner_std140_uint_8 = OpTypeArray %Inner_std140 %uint_8 %_arr_Inner_std140_uint_8 = OpTypeArray %Inner_std140 %uint_8
%S_std140 = OpTypeStruct %_arr_Inner_std140_uint_8 %S_std140 = OpTypeStruct %_arr_Inner_std140_uint_8
%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140 %s_block_std140 = OpTypeStruct %S_std140
%s = OpVariable %_ptr_Uniform_S_std140 Uniform %_ptr_Uniform_s_block_std140 = OpTypePointer Uniform %s_block_std140
%s = OpVariable %_ptr_Uniform_s_block_std140 Uniform
%mat3v2float = OpTypeMatrix %v2float 3 %mat3v2float = OpTypeMatrix %v2float 3
%21 = OpTypeFunction %mat3v2float %uint %22 = OpTypeFunction %mat3v2float %uint
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%_ptr_Uniform_Inner_std140 = OpTypePointer Uniform %Inner_std140 %_ptr_Uniform_Inner_std140 = OpTypePointer Uniform %Inner_std140
%uint_9 = OpConstant %uint 9 %uint_9 = OpConstant %uint 9
@ -82,7 +86,7 @@
%uint_10 = OpConstant %uint 10 %uint_10 = OpConstant %uint 10
%uint_11 = OpConstant %uint 11 %uint_11 = OpConstant %uint 11
%void = OpTypeVoid %void = OpTypeVoid
%44 = OpTypeFunction %void %uint %45 = OpTypeFunction %void %uint
%_ptr_Uniform_v3int = OpTypePointer Uniform %v3int %_ptr_Uniform_v3int = OpTypePointer Uniform %v3int
%uint_1 = OpConstant %uint 1 %uint_1 = OpConstant %uint 1
%_ptr_Uniform_int = OpTypePointer Uniform %int %_ptr_Uniform_int = OpTypePointer Uniform %int
@ -99,49 +103,49 @@
%_ptr_Uniform_mat2v3float = OpTypePointer Uniform %mat2v3float %_ptr_Uniform_mat2v3float = OpTypePointer Uniform %mat2v3float
%uint_12 = OpConstant %uint 12 %uint_12 = OpConstant %uint 12
%_ptr_Uniform__arr_v4int_uint_4 = OpTypePointer Uniform %_arr_v4int_uint_4 %_ptr_Uniform__arr_v4int_uint_4 = OpTypePointer Uniform %_arr_v4int_uint_4
%87 = OpTypeFunction %void %88 = OpTypeFunction %void
%load_s_arr_p0_j = OpFunction %mat3v2float None %21 %load_s_inner_arr_p0_j = OpFunction %mat3v2float None %22
%p0 = OpFunctionParameter %uint %p0 = OpFunctionParameter %uint
%25 = OpLabel %26 = OpLabel
%29 = OpAccessChain %_ptr_Uniform_Inner_std140 %s %uint_0 %p0 %30 = OpAccessChain %_ptr_Uniform_Inner_std140 %s %uint_0 %uint_0 %p0
%33 = OpAccessChain %_ptr_Uniform_v2float %29 %uint_9 %34 = OpAccessChain %_ptr_Uniform_v2float %30 %uint_9
%34 = OpLoad %v2float %33 %35 = OpLoad %v2float %34
%37 = OpAccessChain %_ptr_Uniform_v2float %29 %uint_10 %38 = OpAccessChain %_ptr_Uniform_v2float %30 %uint_10
%38 = OpLoad %v2float %37 %39 = OpLoad %v2float %38
%41 = OpAccessChain %_ptr_Uniform_v2float %29 %uint_11 %42 = OpAccessChain %_ptr_Uniform_v2float %30 %uint_11
%42 = OpLoad %v2float %41 %43 = OpLoad %v2float %42
%43 = OpCompositeConstruct %mat3v2float %34 %38 %42 %44 = OpCompositeConstruct %mat3v2float %35 %39 %43
OpReturnValue %43 OpReturnValue %44
OpFunctionEnd OpFunctionEnd
%main_inner = OpFunction %void None %44 %main_inner = OpFunction %void None %45
%idx = OpFunctionParameter %uint %idx = OpFunctionParameter %uint
%48 = OpLabel %49 = OpLabel
%50 = OpAccessChain %_ptr_Uniform_v3int %s %uint_0 %idx %uint_0 %51 = OpAccessChain %_ptr_Uniform_v3int %s %uint_0 %uint_0 %idx %uint_0
%51 = OpLoad %v3int %50 %52 = OpLoad %v3int %51
%54 = OpAccessChain %_ptr_Uniform_int %s %uint_0 %idx %uint_1 %55 = OpAccessChain %_ptr_Uniform_int %s %uint_0 %uint_0 %idx %uint_1
%55 = OpLoad %int %54 %56 = OpLoad %int %55
%58 = OpAccessChain %_ptr_Uniform_v3uint %s %uint_0 %idx %uint_2 %59 = OpAccessChain %_ptr_Uniform_v3uint %s %uint_0 %uint_0 %idx %uint_2
%59 = OpLoad %v3uint %58 %60 = OpLoad %v3uint %59
%62 = OpAccessChain %_ptr_Uniform_uint %s %uint_0 %idx %uint_3 %63 = OpAccessChain %_ptr_Uniform_uint %s %uint_0 %uint_0 %idx %uint_3
%63 = OpLoad %uint %62 %64 = OpLoad %uint %63
%65 = OpAccessChain %_ptr_Uniform_v3float %s %uint_0 %idx %uint_4 %66 = OpAccessChain %_ptr_Uniform_v3float %s %uint_0 %uint_0 %idx %uint_4
%66 = OpLoad %v3float %65 %67 = OpLoad %v3float %66
%69 = OpAccessChain %_ptr_Uniform_float %s %uint_0 %idx %uint_5 %70 = OpAccessChain %_ptr_Uniform_float %s %uint_0 %uint_0 %idx %uint_5
%70 = OpLoad %float %69 %71 = OpLoad %float %70
%73 = OpAccessChain %_ptr_Uniform_v2int %s %uint_0 %idx %uint_6 %74 = OpAccessChain %_ptr_Uniform_v2int %s %uint_0 %uint_0 %idx %uint_6
%74 = OpLoad %v2int %73 %75 = OpLoad %v2int %74
%76 = OpAccessChain %_ptr_Uniform_v2int %s %uint_0 %idx %uint_7 %77 = OpAccessChain %_ptr_Uniform_v2int %s %uint_0 %uint_0 %idx %uint_7
%77 = OpLoad %v2int %76 %78 = OpLoad %v2int %77
%79 = OpAccessChain %_ptr_Uniform_mat2v3float %s %uint_0 %idx %uint_8 %80 = OpAccessChain %_ptr_Uniform_mat2v3float %s %uint_0 %uint_0 %idx %uint_8
%80 = OpLoad %mat2v3float %79 %81 = OpLoad %mat2v3float %80
%81 = OpFunctionCall %mat3v2float %load_s_arr_p0_j %idx %82 = OpFunctionCall %mat3v2float %load_s_inner_arr_p0_j %idx
%85 = OpAccessChain %_ptr_Uniform__arr_v4int_uint_4 %s %uint_0 %idx %uint_12 %86 = OpAccessChain %_ptr_Uniform__arr_v4int_uint_4 %s %uint_0 %uint_0 %idx %uint_12
%86 = OpLoad %_arr_v4int_uint_4 %85 %87 = OpLoad %_arr_v4int_uint_4 %86
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%main = OpFunction %void None %87 %main = OpFunction %void None %88
%89 = OpLabel %90 = OpLabel
%91 = OpLoad %uint %idx_1 %92 = OpLoad %uint %idx_1
%90 = OpFunctionCall %void %main_inner %91 %91 = OpFunctionCall %void %main_inner %92
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -7,7 +7,24 @@ struct Inner {
uint pad_2; uint pad_2;
}; };
layout(binding = 0, std140) uniform S_std140_ubo { struct S {
ivec3 a;
int b;
uvec3 c;
uint d;
vec3 e;
float f;
ivec2 g;
ivec2 h;
mat2x3 i;
mat3x2 j;
uint pad_3;
uint pad_4;
Inner k;
Inner l[4];
};
struct S_std140 {
ivec3 a; ivec3 a;
int b; int b;
uvec3 c; uvec3 c;
@ -24,25 +41,29 @@ layout(binding = 0, std140) uniform S_std140_ubo {
uint pad_4; uint pad_4;
Inner k; Inner k;
Inner l[4]; Inner l[4];
};
layout(binding = 0, std140) uniform s_block_std140_ubo {
S_std140 inner;
} s; } s;
mat3x2 load_s_j() { mat3x2 load_s_inner_j() {
return mat3x2(s.j_0, s.j_1, s.j_2); return mat3x2(s.inner.j_0, s.inner.j_1, s.inner.j_2);
} }
void tint_symbol() { void tint_symbol() {
ivec3 a = s.a; ivec3 a = s.inner.a;
int b = s.b; int b = s.inner.b;
uvec3 c = s.c; uvec3 c = s.inner.c;
uint d = s.d; uint d = s.inner.d;
vec3 e = s.e; vec3 e = s.inner.e;
float f = s.f; float f = s.inner.f;
ivec2 g = s.g; ivec2 g = s.inner.g;
ivec2 h = s.h; ivec2 h = s.inner.h;
mat2x3 i = s.i; mat2x3 i = s.inner.i;
mat3x2 j = load_s_j(); mat3x2 j = load_s_inner_j();
Inner k = s.k; Inner k = s.inner.k;
Inner l[4] = s.l; Inner l[4] = s.inner.l;
} }
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

@ -1,12 +1,14 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 82 ; Bound: 85
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main" OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1 OpExecutionMode %main LocalSize 1 1 1
OpName %s_block_std140 "s_block_std140"
OpMemberName %s_block_std140 0 "inner"
OpName %S_std140 "S_std140" OpName %S_std140 "S_std140"
OpMemberName %S_std140 0 "a" OpMemberName %S_std140 0 "a"
OpMemberName %S_std140 1 "b" OpMemberName %S_std140 1 "b"
@ -25,9 +27,10 @@
OpMemberName %Inner 0 "x" OpMemberName %Inner 0 "x"
OpMemberName %S_std140 13 "l" OpMemberName %S_std140 13 "l"
OpName %s "s" OpName %s "s"
OpName %load_s_j "load_s_j" OpName %load_s_inner_j "load_s_inner_j"
OpName %main "main" OpName %main "main"
OpDecorate %S_std140 Block OpDecorate %s_block_std140 Block
OpMemberDecorate %s_block_std140 0 Offset 0
OpMemberDecorate %S_std140 0 Offset 0 OpMemberDecorate %S_std140 0 Offset 0
OpMemberDecorate %S_std140 1 Offset 12 OpMemberDecorate %S_std140 1 Offset 12
OpMemberDecorate %S_std140 2 Offset 16 OpMemberDecorate %S_std140 2 Offset 16
@ -62,17 +65,19 @@
%uint_4 = OpConstant %uint 4 %uint_4 = OpConstant %uint 4
%_arr_Inner_uint_4 = OpTypeArray %Inner %uint_4 %_arr_Inner_uint_4 = OpTypeArray %Inner %uint_4
%S_std140 = OpTypeStruct %v3int %int %v3uint %uint %v3float %float %v2int %v2int %mat2v3float %v2float %v2float %v2float %Inner %_arr_Inner_uint_4 %S_std140 = OpTypeStruct %v3int %int %v3uint %uint %v3float %float %v2int %v2int %mat2v3float %v2float %v2float %v2float %Inner %_arr_Inner_uint_4
%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140 %s_block_std140 = OpTypeStruct %S_std140
%s = OpVariable %_ptr_Uniform_S_std140 Uniform %_ptr_Uniform_s_block_std140 = OpTypePointer Uniform %s_block_std140
%s = OpVariable %_ptr_Uniform_s_block_std140 Uniform
%mat3v2float = OpTypeMatrix %v2float 3 %mat3v2float = OpTypeMatrix %v2float 3
%16 = OpTypeFunction %mat3v2float %17 = OpTypeFunction %mat3v2float
%uint_0 = OpConstant %uint 0
%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140
%uint_9 = OpConstant %uint 9 %uint_9 = OpConstant %uint 9
%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float %_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
%uint_10 = OpConstant %uint 10 %uint_10 = OpConstant %uint 10
%uint_11 = OpConstant %uint 11 %uint_11 = OpConstant %uint 11
%void = OpTypeVoid %void = OpTypeVoid
%35 = OpTypeFunction %void %39 = OpTypeFunction %void
%uint_0 = OpConstant %uint 0
%_ptr_Uniform_v3int = OpTypePointer Uniform %v3int %_ptr_Uniform_v3int = OpTypePointer Uniform %v3int
%uint_1 = OpConstant %uint 1 %uint_1 = OpConstant %uint 1
%_ptr_Uniform_int = OpTypePointer Uniform %int %_ptr_Uniform_int = OpTypePointer Uniform %int
@ -92,41 +97,42 @@
%_ptr_Uniform_Inner = OpTypePointer Uniform %Inner %_ptr_Uniform_Inner = OpTypePointer Uniform %Inner
%uint_13 = OpConstant %uint 13 %uint_13 = OpConstant %uint 13
%_ptr_Uniform__arr_Inner_uint_4 = OpTypePointer Uniform %_arr_Inner_uint_4 %_ptr_Uniform__arr_Inner_uint_4 = OpTypePointer Uniform %_arr_Inner_uint_4
%load_s_j = OpFunction %mat3v2float None %16 %load_s_inner_j = OpFunction %mat3v2float None %17
%19 = OpLabel %20 = OpLabel
%24 = OpAccessChain %_ptr_Uniform_v2float %s %uint_9 %24 = OpAccessChain %_ptr_Uniform_S_std140 %s %uint_0
%25 = OpLoad %v2float %24 %28 = OpAccessChain %_ptr_Uniform_v2float %24 %uint_9
%28 = OpAccessChain %_ptr_Uniform_v2float %s %uint_10
%29 = OpLoad %v2float %28 %29 = OpLoad %v2float %28
%32 = OpAccessChain %_ptr_Uniform_v2float %s %uint_11 %32 = OpAccessChain %_ptr_Uniform_v2float %24 %uint_10
%33 = OpLoad %v2float %32 %33 = OpLoad %v2float %32
%34 = OpCompositeConstruct %mat3v2float %25 %29 %33 %36 = OpAccessChain %_ptr_Uniform_v2float %24 %uint_11
OpReturnValue %34 %37 = OpLoad %v2float %36
%38 = OpCompositeConstruct %mat3v2float %29 %33 %37
OpReturnValue %38
OpFunctionEnd OpFunctionEnd
%main = OpFunction %void None %35 %main = OpFunction %void None %39
%38 = OpLabel %42 = OpLabel
%41 = OpAccessChain %_ptr_Uniform_v3int %s %uint_0 %44 = OpAccessChain %_ptr_Uniform_v3int %s %uint_0 %uint_0
%42 = OpLoad %v3int %41 %45 = OpLoad %v3int %44
%45 = OpAccessChain %_ptr_Uniform_int %s %uint_1 %48 = OpAccessChain %_ptr_Uniform_int %s %uint_0 %uint_1
%46 = OpLoad %int %45 %49 = OpLoad %int %48
%49 = OpAccessChain %_ptr_Uniform_v3uint %s %uint_2 %52 = OpAccessChain %_ptr_Uniform_v3uint %s %uint_0 %uint_2
%50 = OpLoad %v3uint %49 %53 = OpLoad %v3uint %52
%53 = OpAccessChain %_ptr_Uniform_uint %s %uint_3 %56 = OpAccessChain %_ptr_Uniform_uint %s %uint_0 %uint_3
%54 = OpLoad %uint %53 %57 = OpLoad %uint %56
%56 = OpAccessChain %_ptr_Uniform_v3float %s %uint_4 %59 = OpAccessChain %_ptr_Uniform_v3float %s %uint_0 %uint_4
%57 = OpLoad %v3float %56 %60 = OpLoad %v3float %59
%60 = OpAccessChain %_ptr_Uniform_float %s %uint_5 %63 = OpAccessChain %_ptr_Uniform_float %s %uint_0 %uint_5
%61 = OpLoad %float %60 %64 = OpLoad %float %63
%64 = OpAccessChain %_ptr_Uniform_v2int %s %uint_6 %67 = OpAccessChain %_ptr_Uniform_v2int %s %uint_0 %uint_6
%65 = OpLoad %v2int %64
%67 = OpAccessChain %_ptr_Uniform_v2int %s %uint_7
%68 = OpLoad %v2int %67 %68 = OpLoad %v2int %67
%71 = OpAccessChain %_ptr_Uniform_mat2v3float %s %uint_8 %70 = OpAccessChain %_ptr_Uniform_v2int %s %uint_0 %uint_7
%72 = OpLoad %mat2v3float %71 %71 = OpLoad %v2int %70
%73 = OpFunctionCall %mat3v2float %load_s_j %74 = OpAccessChain %_ptr_Uniform_mat2v3float %s %uint_0 %uint_8
%76 = OpAccessChain %_ptr_Uniform_Inner %s %uint_12 %75 = OpLoad %mat2v3float %74
%77 = OpLoad %Inner %76 %76 = OpFunctionCall %mat3v2float %load_s_inner_j
%80 = OpAccessChain %_ptr_Uniform__arr_Inner_uint_4 %s %uint_13 %79 = OpAccessChain %_ptr_Uniform_Inner %s %uint_0 %uint_12
%81 = OpLoad %_arr_Inner_uint_4 %80 %80 = OpLoad %Inner %79
%83 = OpAccessChain %_ptr_Uniform__arr_Inner_uint_4 %s %uint_0 %uint_13
%84 = OpLoad %_arr_Inner_uint_4 %83
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -1,6 +1,6 @@
#version 310 es #version 310 es
layout(binding = 0, std140) uniform Uniforms_ubo { struct Uniforms {
uint numTriangles; uint numTriangles;
uint gridSize; uint gridSize;
uint puuuuuuuuuuuuuuuuad1; uint puuuuuuuuuuuuuuuuad1;
@ -9,6 +9,25 @@ layout(binding = 0, std140) uniform Uniforms_ubo {
uint pad; uint pad;
vec3 bbMax; vec3 bbMax;
uint pad_1; uint pad_1;
};
struct Dbg {
uint offsetCounter;
uint pad0;
uint pad1;
uint pad2;
uint value0;
uint value1;
uint value2;
uint value3;
float value_f32_0;
float value_f32_1;
float value_f32_2;
float value_f32_3;
};
layout(binding = 0, std140) uniform uniforms_block_ubo {
Uniforms inner;
} uniforms; } uniforms;
layout(binding = 10, std430) buffer U32s_ssbo { layout(binding = 10, std430) buffer U32s_ssbo {
@ -27,30 +46,19 @@ layout(binding = 21, std430) buffer AI32s_ssbo {
int values[]; int values[];
} LUT; } LUT;
layout(binding = 50, std430) buffer Dbg_ssbo { layout(binding = 50, std430) buffer dbg_block_ssbo {
uint offsetCounter; Dbg inner;
uint pad0;
uint pad1;
uint pad2;
uint value0;
uint value1;
uint value2;
uint value3;
float value_f32_0;
float value_f32_1;
float value_f32_2;
float value_f32_3;
} dbg; } dbg;
vec3 toVoxelPos(vec3 position) { vec3 toVoxelPos(vec3 position) {
vec3 bbMin = vec3(uniforms.bbMin.x, uniforms.bbMin.y, uniforms.bbMin.z); vec3 bbMin = vec3(uniforms.inner.bbMin.x, uniforms.inner.bbMin.y, uniforms.inner.bbMin.z);
vec3 bbMax = vec3(uniforms.bbMax.x, uniforms.bbMax.y, uniforms.bbMax.z); vec3 bbMax = vec3(uniforms.inner.bbMax.x, uniforms.inner.bbMax.y, uniforms.inner.bbMax.z);
vec3 bbSize = (bbMin - bbMin); vec3 bbSize = (bbMin - bbMin);
float cubeSize = max(max(bbMax.x, bbMax.y), bbSize.z); float cubeSize = max(max(bbMax.x, bbMax.y), bbSize.z);
float gridSize = float(uniforms.gridSize); float gridSize = float(uniforms.inner.gridSize);
float gx = ((cubeSize * (position.x - uniforms.bbMin.x)) / cubeSize); float gx = ((cubeSize * (position.x - uniforms.inner.bbMin.x)) / cubeSize);
float gy = ((gx * (position.y - uniforms.bbMin.y)) / gridSize); float gy = ((gx * (position.y - uniforms.inner.bbMin.y)) / gridSize);
float gz = ((gridSize * (position.z - uniforms.bbMin.z)) / gridSize); float gz = ((gridSize * (position.z - uniforms.inner.bbMin.z)) / gridSize);
return vec3(gz, gz, gz); return vec3(gz, gz, gz);
} }
@ -65,8 +73,8 @@ vec3 loadPosition(uint vertexIndex) {
} }
void doIgnore() { void doIgnore() {
uint g43 = uniforms.numTriangles; uint g43 = uniforms.inner.numTriangles;
uint kj6 = dbg.value1; uint kj6 = dbg.inner.value1;
uint b53 = atomicOr(counters.values[0], 0u); uint b53 = atomicOr(counters.values[0], 0u);
uint rwg = indices.values[0]; uint rwg = indices.values[0];
float rb5 = positions.values[0]; float rb5 = positions.values[0];
@ -75,7 +83,7 @@ void doIgnore() {
void main_count(uvec3 GlobalInvocationID) { void main_count(uvec3 GlobalInvocationID) {
uint triangleIndex = GlobalInvocationID.x; uint triangleIndex = GlobalInvocationID.x;
if ((triangleIndex >= uniforms.numTriangles)) { if ((triangleIndex >= uniforms.inner.numTriangles)) {
return; return;
} }
doIgnore(); doIgnore();
@ -87,7 +95,7 @@ void main_count(uvec3 GlobalInvocationID) {
vec3 p2 = loadPosition(i2); vec3 p2 = loadPosition(i2);
vec3 center = (((p0 + p2) + p1) / 3.0f); vec3 center = (((p0 + p2) + p1) / 3.0f);
vec3 voxelPos = toVoxelPos(p1); vec3 voxelPos = toVoxelPos(p1);
uint lIndex = toIndex1D(uniforms.gridSize, p0); uint lIndex = toIndex1D(uniforms.inner.gridSize, p0);
int triangleOffset = atomicAdd(LUT.values[i1], 1); int triangleOffset = atomicAdd(LUT.values[i1], 1);
} }

View File

@ -1,14 +1,16 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 273 ; Bound: 275
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
%67 = OpExtInstImport "GLSL.std.450" %69 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main_count "main_count" %GlobalInvocationID_1 OpEntryPoint GLCompute %main_count "main_count" %GlobalInvocationID_1
OpExecutionMode %main_count LocalSize 128 1 1 OpExecutionMode %main_count LocalSize 128 1 1
OpName %GlobalInvocationID_1 "GlobalInvocationID_1" OpName %GlobalInvocationID_1 "GlobalInvocationID_1"
OpName %uniforms_block "uniforms_block"
OpMemberName %uniforms_block 0 "inner"
OpName %Uniforms "Uniforms" OpName %Uniforms "Uniforms"
OpMemberName %Uniforms 0 "numTriangles" OpMemberName %Uniforms 0 "numTriangles"
OpMemberName %Uniforms 1 "gridSize" OpMemberName %Uniforms 1 "gridSize"
@ -29,6 +31,8 @@
OpName %AI32s "AI32s" OpName %AI32s "AI32s"
OpMemberName %AI32s 0 "values" OpMemberName %AI32s 0 "values"
OpName %LUT "LUT" OpName %LUT "LUT"
OpName %dbg_block "dbg_block"
OpMemberName %dbg_block 0 "inner"
OpName %Dbg "Dbg" OpName %Dbg "Dbg"
OpMemberName %Dbg 0 "offsetCounter" OpMemberName %Dbg 0 "offsetCounter"
OpMemberName %Dbg 1 "pad0" OpMemberName %Dbg 1 "pad0"
@ -89,7 +93,8 @@
OpName %triangleOffset "triangleOffset" OpName %triangleOffset "triangleOffset"
OpName %main_count "main_count" OpName %main_count "main_count"
OpDecorate %GlobalInvocationID_1 BuiltIn GlobalInvocationId OpDecorate %GlobalInvocationID_1 BuiltIn GlobalInvocationId
OpDecorate %Uniforms Block OpDecorate %uniforms_block Block
OpMemberDecorate %uniforms_block 0 Offset 0
OpMemberDecorate %Uniforms 0 Offset 0 OpMemberDecorate %Uniforms 0 Offset 0
OpMemberDecorate %Uniforms 1 Offset 4 OpMemberDecorate %Uniforms 1 Offset 4
OpMemberDecorate %Uniforms 2 Offset 8 OpMemberDecorate %Uniforms 2 Offset 8
@ -119,7 +124,8 @@
OpDecorate %_runtimearr_int ArrayStride 4 OpDecorate %_runtimearr_int ArrayStride 4
OpDecorate %LUT Binding 21 OpDecorate %LUT Binding 21
OpDecorate %LUT DescriptorSet 0 OpDecorate %LUT DescriptorSet 0
OpDecorate %Dbg Block OpDecorate %dbg_block Block
OpMemberDecorate %dbg_block 0 Offset 0
OpMemberDecorate %Dbg 0 Offset 0 OpMemberDecorate %Dbg 0 Offset 0
OpMemberDecorate %Dbg 1 Offset 4 OpMemberDecorate %Dbg 1 Offset 4
OpMemberDecorate %Dbg 2 Offset 8 OpMemberDecorate %Dbg 2 Offset 8
@ -141,8 +147,9 @@
%float = OpTypeFloat 32 %float = OpTypeFloat 32
%v3float = OpTypeVector %float 3 %v3float = OpTypeVector %float 3
%Uniforms = OpTypeStruct %uint %uint %uint %uint %v3float %v3float %Uniforms = OpTypeStruct %uint %uint %uint %uint %v3float %v3float
%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms %uniforms_block = OpTypeStruct %Uniforms
%uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform %_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block
%uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform
%_runtimearr_uint = OpTypeRuntimeArray %uint %_runtimearr_uint = OpTypeRuntimeArray %uint
%U32s = OpTypeStruct %_runtimearr_uint %U32s = OpTypeStruct %_runtimearr_uint
%_ptr_StorageBuffer_U32s = OpTypePointer StorageBuffer %U32s %_ptr_StorageBuffer_U32s = OpTypePointer StorageBuffer %U32s
@ -161,293 +168,294 @@
%_ptr_StorageBuffer_AI32s = OpTypePointer StorageBuffer %AI32s %_ptr_StorageBuffer_AI32s = OpTypePointer StorageBuffer %AI32s
%LUT = OpVariable %_ptr_StorageBuffer_AI32s StorageBuffer %LUT = OpVariable %_ptr_StorageBuffer_AI32s StorageBuffer
%Dbg = OpTypeStruct %uint %uint %uint %uint %uint %uint %uint %uint %float %float %float %float %Dbg = OpTypeStruct %uint %uint %uint %uint %uint %uint %uint %uint %float %float %float %float
%_ptr_StorageBuffer_Dbg = OpTypePointer StorageBuffer %Dbg %dbg_block = OpTypeStruct %Dbg
%dbg = OpVariable %_ptr_StorageBuffer_Dbg StorageBuffer %_ptr_StorageBuffer_dbg_block = OpTypePointer StorageBuffer %dbg_block
%dbg = OpVariable %_ptr_StorageBuffer_dbg_block StorageBuffer
%void = OpTypeVoid %void = OpTypeVoid
%30 = OpTypeFunction %void %32 = OpTypeFunction %void
%34 = OpTypeFunction %v3float %v3float %36 = OpTypeFunction %v3float %v3float
%uint_4 = OpConstant %uint 4
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%uint_4 = OpConstant %uint 4
%_ptr_Uniform_float = OpTypePointer Uniform %float %_ptr_Uniform_float = OpTypePointer Uniform %float
%uint_1 = OpConstant %uint 1 %uint_1 = OpConstant %uint 1
%uint_2 = OpConstant %uint 2 %uint_2 = OpConstant %uint 2
%_ptr_Function_v3float = OpTypePointer Function %v3float %_ptr_Function_v3float = OpTypePointer Function %v3float
%52 = OpConstantNull %v3float %54 = OpConstantNull %v3float
%uint_5 = OpConstant %uint 5 %uint_5 = OpConstant %uint 5
%_ptr_Function_float = OpTypePointer Function %float %_ptr_Function_float = OpTypePointer Function %float
%77 = OpConstantNull %float %79 = OpConstantNull %float
%_ptr_Uniform_uint = OpTypePointer Uniform %uint %_ptr_Uniform_uint = OpTypePointer Uniform %uint
%114 = OpTypeFunction %uint %uint %v3float %116 = OpTypeFunction %uint %uint %v3float
%_ptr_Function_v3uint = OpTypePointer Function %v3uint %_ptr_Function_v3uint = OpTypePointer Function %v3uint
%122 = OpConstantNull %v3uint %124 = OpConstantNull %v3uint
%_ptr_Function_uint = OpTypePointer Function %uint %_ptr_Function_uint = OpTypePointer Function %uint
%135 = OpTypeFunction %v3uint %uint %uint %137 = OpTypeFunction %v3uint %uint %uint
%143 = OpConstantNull %uint %145 = OpConstantNull %uint
%156 = OpTypeFunction %v3float %uint %158 = OpTypeFunction %v3float %uint
%uint_3 = OpConstant %uint 3 %uint_3 = OpConstant %uint 3
%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float %_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
%188 = OpConstantNull %int %190 = OpConstantNull %int
%_ptr_StorageBuffer_uint_0 = OpTypePointer StorageBuffer %uint %_ptr_StorageBuffer_uint_0 = OpTypePointer StorageBuffer %uint
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%_ptr_Function_int = OpTypePointer Function %int %_ptr_Function_int = OpTypePointer Function %int
%204 = OpTypeFunction %void %v3uint %206 = OpTypeFunction %void %v3uint
%bool = OpTypeBool %bool = OpTypeBool
%float_3 = OpConstant %float 3 %float_3 = OpConstant %float 3
%int_1 = OpConstant %int 1 %int_1 = OpConstant %int 1
%marg8uintin = OpFunction %void None %30 %marg8uintin = OpFunction %void None %32
%33 = OpLabel %35 = OpLabel
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%toVoxelPos = OpFunction %v3float None %34 %toVoxelPos = OpFunction %v3float None %36
%position = OpFunctionParameter %v3float %position = OpFunctionParameter %v3float
%37 = OpLabel %39 = OpLabel
%bbMin = OpVariable %_ptr_Function_v3float Function %52 %bbMin = OpVariable %_ptr_Function_v3float Function %54
%bbMax = OpVariable %_ptr_Function_v3float Function %52 %bbMax = OpVariable %_ptr_Function_v3float Function %54
%bbSize = OpVariable %_ptr_Function_v3float Function %52 %bbSize = OpVariable %_ptr_Function_v3float Function %54
%cubeSize = OpVariable %_ptr_Function_float Function %77 %cubeSize = OpVariable %_ptr_Function_float Function %79
%gridSize = OpVariable %_ptr_Function_float Function %77 %gridSize = OpVariable %_ptr_Function_float Function %79
%gx = OpVariable %_ptr_Function_float Function %77 %gx = OpVariable %_ptr_Function_float Function %79
%gy = OpVariable %_ptr_Function_float Function %77 %gy = OpVariable %_ptr_Function_float Function %79
%gz = OpVariable %_ptr_Function_float Function %77 %gz = OpVariable %_ptr_Function_float Function %79
%41 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_4 %uint_0 %43 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_4 %uint_0
%42 = OpLoad %float %41 %44 = OpLoad %float %43
%44 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_4 %uint_1 %46 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_4 %uint_1
%45 = OpLoad %float %44 %47 = OpLoad %float %46
%47 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_4 %uint_2 %49 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_4 %uint_2
%48 = OpLoad %float %47 %50 = OpLoad %float %49
%49 = OpCompositeConstruct %v3float %42 %45 %48 %51 = OpCompositeConstruct %v3float %44 %47 %50
OpStore %bbMin %49 OpStore %bbMin %51
%54 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_5 %uint_0 %56 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_5 %uint_0
%55 = OpLoad %float %54
%56 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_5 %uint_1
%57 = OpLoad %float %56 %57 = OpLoad %float %56
%58 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_5 %uint_2 %58 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_5 %uint_1
%59 = OpLoad %float %58 %59 = OpLoad %float %58
%60 = OpCompositeConstruct %v3float %55 %57 %59 %60 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_5 %uint_2
OpStore %bbMax %60 %61 = OpLoad %float %60
%62 = OpLoad %v3float %bbMin %62 = OpCompositeConstruct %v3float %57 %59 %61
%63 = OpLoad %v3float %bbMin OpStore %bbMax %62
%64 = OpFSub %v3float %62 %63 %64 = OpLoad %v3float %bbMin
OpStore %bbSize %64 %65 = OpLoad %v3float %bbMin
%70 = OpAccessChain %_ptr_Function_float %bbMax %uint_0 %66 = OpFSub %v3float %64 %65
%71 = OpLoad %float %70 OpStore %bbSize %66
%72 = OpAccessChain %_ptr_Function_float %bbMax %uint_1 %72 = OpAccessChain %_ptr_Function_float %bbMax %uint_0
%73 = OpLoad %float %72 %73 = OpLoad %float %72
%68 = OpExtInst %float %67 NMax %71 %73 %74 = OpAccessChain %_ptr_Function_float %bbMax %uint_1
%74 = OpAccessChain %_ptr_Function_float %bbSize %uint_2
%75 = OpLoad %float %74 %75 = OpLoad %float %74
%66 = OpExtInst %float %67 NMax %68 %75 %70 = OpExtInst %float %69 NMax %73 %75
OpStore %cubeSize %66 %76 = OpAccessChain %_ptr_Function_float %bbSize %uint_2
%80 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 %77 = OpLoad %float %76
%81 = OpLoad %uint %80 %68 = OpExtInst %float %69 NMax %70 %77
%78 = OpConvertUToF %float %81 OpStore %cubeSize %68
OpStore %gridSize %78 %82 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1
%83 = OpLoad %float %cubeSize %83 = OpLoad %uint %82
%84 = OpCompositeExtract %float %position 0 %80 = OpConvertUToF %float %83
%85 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_4 %uint_0 OpStore %gridSize %80
%86 = OpLoad %float %85 %85 = OpLoad %float %cubeSize
%87 = OpFSub %float %84 %86 %86 = OpCompositeExtract %float %position 0
%88 = OpFMul %float %83 %87 %87 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_4 %uint_0
%89 = OpLoad %float %cubeSize %88 = OpLoad %float %87
%90 = OpFDiv %float %88 %89 %89 = OpFSub %float %86 %88
OpStore %gx %90 %90 = OpFMul %float %85 %89
%92 = OpLoad %float %gx %91 = OpLoad %float %cubeSize
%93 = OpCompositeExtract %float %position 1 %92 = OpFDiv %float %90 %91
%94 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_4 %uint_1 OpStore %gx %92
%95 = OpLoad %float %94 %94 = OpLoad %float %gx
%96 = OpFSub %float %93 %95 %95 = OpCompositeExtract %float %position 1
%97 = OpFMul %float %92 %96 %96 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_4 %uint_1
%98 = OpLoad %float %gridSize %97 = OpLoad %float %96
%99 = OpFDiv %float %97 %98 %98 = OpFSub %float %95 %97
OpStore %gy %99 %99 = OpFMul %float %94 %98
%101 = OpLoad %float %gridSize %100 = OpLoad %float %gridSize
%102 = OpCompositeExtract %float %position 2 %101 = OpFDiv %float %99 %100
%103 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_4 %uint_2 OpStore %gy %101
%104 = OpLoad %float %103 %103 = OpLoad %float %gridSize
%105 = OpFSub %float %102 %104 %104 = OpCompositeExtract %float %position 2
%106 = OpFMul %float %101 %105 %105 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_4 %uint_2
%107 = OpLoad %float %gridSize %106 = OpLoad %float %105
%108 = OpFDiv %float %106 %107 %107 = OpFSub %float %104 %106
OpStore %gz %108 %108 = OpFMul %float %103 %107
%110 = OpLoad %float %gz %109 = OpLoad %float %gridSize
%111 = OpLoad %float %gz %110 = OpFDiv %float %108 %109
OpStore %gz %110
%112 = OpLoad %float %gz %112 = OpLoad %float %gz
%113 = OpCompositeConstruct %v3float %110 %111 %112 %113 = OpLoad %float %gz
OpReturnValue %113 %114 = OpLoad %float %gz
%115 = OpCompositeConstruct %v3float %112 %113 %114
OpReturnValue %115
OpFunctionEnd OpFunctionEnd
%toIndex1D = OpFunction %uint None %114 %toIndex1D = OpFunction %uint None %116
%gridSize_0 = OpFunctionParameter %uint %gridSize_0 = OpFunctionParameter %uint
%voxelPos = OpFunctionParameter %v3float %voxelPos = OpFunctionParameter %v3float
%118 = OpLabel %120 = OpLabel
%icoord = OpVariable %_ptr_Function_v3uint Function %122 %icoord = OpVariable %_ptr_Function_v3uint Function %124
%119 = OpConvertFToU %v3uint %voxelPos %121 = OpConvertFToU %v3uint %voxelPos
OpStore %icoord %119 OpStore %icoord %121
%124 = OpAccessChain %_ptr_Function_uint %icoord %uint_0 %126 = OpAccessChain %_ptr_Function_uint %icoord %uint_0
%125 = OpLoad %uint %124
%126 = OpAccessChain %_ptr_Function_uint %icoord %uint_1
%127 = OpLoad %uint %126 %127 = OpLoad %uint %126
%128 = OpIMul %uint %gridSize_0 %127 %128 = OpAccessChain %_ptr_Function_uint %icoord %uint_1
%129 = OpIAdd %uint %125 %128 %129 = OpLoad %uint %128
%130 = OpIMul %uint %gridSize_0 %gridSize_0 %130 = OpIMul %uint %gridSize_0 %129
%131 = OpAccessChain %_ptr_Function_uint %icoord %uint_2 %131 = OpIAdd %uint %127 %130
%132 = OpLoad %uint %131 %132 = OpIMul %uint %gridSize_0 %gridSize_0
%133 = OpIMul %uint %130 %132 %133 = OpAccessChain %_ptr_Function_uint %icoord %uint_2
%134 = OpIAdd %uint %129 %133 %134 = OpLoad %uint %133
OpReturnValue %134 %135 = OpIMul %uint %132 %134
%136 = OpIAdd %uint %131 %135
OpReturnValue %136
OpFunctionEnd OpFunctionEnd
%toIndex4D = OpFunction %v3uint None %135 %toIndex4D = OpFunction %v3uint None %137
%gridSize_1 = OpFunctionParameter %uint %gridSize_1 = OpFunctionParameter %uint
%index = OpFunctionParameter %uint %index = OpFunctionParameter %uint
%139 = OpLabel %141 = OpLabel
%z = OpVariable %_ptr_Function_uint Function %143 %z = OpVariable %_ptr_Function_uint Function %145
%y = OpVariable %_ptr_Function_uint Function %143 %y = OpVariable %_ptr_Function_uint Function %145
%x = OpVariable %_ptr_Function_uint Function %143 %x = OpVariable %_ptr_Function_uint Function %145
%140 = OpIMul %uint %index %index %142 = OpIMul %uint %index %index
%141 = OpUDiv %uint %gridSize_1 %140 %143 = OpUDiv %uint %gridSize_1 %142
OpStore %z %141 OpStore %z %143
%144 = OpIMul %uint %gridSize_1 %gridSize_1 %146 = OpIMul %uint %gridSize_1 %gridSize_1
%145 = OpLoad %uint %z %147 = OpLoad %uint %z
%146 = OpIMul %uint %144 %145 %148 = OpIMul %uint %146 %147
%147 = OpISub %uint %gridSize_1 %146 %149 = OpISub %uint %gridSize_1 %148
%148 = OpUDiv %uint %147 %gridSize_1 %150 = OpUDiv %uint %149 %gridSize_1
OpStore %y %148 OpStore %y %150
%150 = OpUMod %uint %index %gridSize_1 %152 = OpUMod %uint %index %gridSize_1
OpStore %x %150 OpStore %x %152
%152 = OpLoad %uint %z %154 = OpLoad %uint %z
%153 = OpLoad %uint %y %155 = OpLoad %uint %y
%154 = OpLoad %uint %y %156 = OpLoad %uint %y
%155 = OpCompositeConstruct %v3uint %152 %153 %154 %157 = OpCompositeConstruct %v3uint %154 %155 %156
OpReturnValue %155 OpReturnValue %157
OpFunctionEnd OpFunctionEnd
%loadPosition = OpFunction %v3float None %156 %loadPosition = OpFunction %v3float None %158
%vertexIndex = OpFunctionParameter %uint %vertexIndex = OpFunctionParameter %uint
%159 = OpLabel %161 = OpLabel
%position_0 = OpVariable %_ptr_Function_v3float Function %52 %position_0 = OpVariable %_ptr_Function_v3float Function %54
%161 = OpIMul %uint %uint_3 %vertexIndex %163 = OpIMul %uint %uint_3 %vertexIndex
%162 = OpIAdd %uint %161 %143 %164 = OpIAdd %uint %163 %145
%164 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %162 %166 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %164
%165 = OpLoad %float %164 %167 = OpLoad %float %166
%166 = OpIMul %uint %uint_3 %vertexIndex %168 = OpIMul %uint %uint_3 %vertexIndex
%167 = OpIAdd %uint %166 %uint_1 %169 = OpIAdd %uint %168 %uint_1
%168 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %167 %170 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %169
%169 = OpLoad %float %168 %171 = OpLoad %float %170
%170 = OpIMul %uint %uint_3 %vertexIndex %172 = OpIMul %uint %uint_3 %vertexIndex
%171 = OpIAdd %uint %170 %uint_2 %173 = OpIAdd %uint %172 %uint_2
%172 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %171 %174 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %173
%173 = OpLoad %float %172 %175 = OpLoad %float %174
%174 = OpCompositeConstruct %v3float %165 %169 %173 %176 = OpCompositeConstruct %v3float %167 %171 %175
OpStore %position_0 %174 OpStore %position_0 %176
%176 = OpLoad %v3float %position_0 %178 = OpLoad %v3float %position_0
OpReturnValue %176 OpReturnValue %178
OpFunctionEnd OpFunctionEnd
%doIgnore = OpFunction %void None %30 %doIgnore = OpFunction %void None %32
%178 = OpLabel %180 = OpLabel
%g43 = OpVariable %_ptr_Function_uint Function %143 %g43 = OpVariable %_ptr_Function_uint Function %145
%kj6 = OpVariable %_ptr_Function_uint Function %143 %kj6 = OpVariable %_ptr_Function_uint Function %145
%b53 = OpVariable %_ptr_Function_uint Function %143 %b53 = OpVariable %_ptr_Function_uint Function %145
%rwg = OpVariable %_ptr_Function_uint Function %143 %rwg = OpVariable %_ptr_Function_uint Function %145
%rb5 = OpVariable %_ptr_Function_float Function %77 %rb5 = OpVariable %_ptr_Function_float Function %79
%g55 = OpVariable %_ptr_Function_int Function %188 %g55 = OpVariable %_ptr_Function_int Function %190
%179 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %181 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0
%180 = OpLoad %uint %179 %182 = OpLoad %uint %181
OpStore %g43 %180 OpStore %g43 %182
%183 = OpAccessChain %_ptr_StorageBuffer_uint %dbg %uint_5 %185 = OpAccessChain %_ptr_StorageBuffer_uint %dbg %uint_0 %uint_5
%184 = OpLoad %uint %183 %186 = OpLoad %uint %185
OpStore %kj6 %184 OpStore %kj6 %186
%190 = OpAccessChain %_ptr_StorageBuffer_uint_0 %counters %uint_0 %188 %192 = OpAccessChain %_ptr_StorageBuffer_uint_0 %counters %uint_0 %190
%186 = OpAtomicLoad %uint %190 %uint_1 %uint_0 %188 = OpAtomicLoad %uint %192 %uint_1 %uint_0
OpStore %b53 %186 OpStore %b53 %188
%192 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %188 %194 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %190
%193 = OpLoad %uint %192 %195 = OpLoad %uint %194
OpStore %rwg %193 OpStore %rwg %195
%195 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %188 %197 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %190
%196 = OpLoad %float %195 %198 = OpLoad %float %197
OpStore %rb5 %196 OpStore %rb5 %198
%201 = OpAccessChain %_ptr_StorageBuffer_int %LUT %uint_0 %188 %203 = OpAccessChain %_ptr_StorageBuffer_int %LUT %uint_0 %190
%198 = OpAtomicLoad %int %201 %uint_1 %uint_0 %200 = OpAtomicLoad %int %203 %uint_1 %uint_0
OpStore %g55 %198 OpStore %g55 %200
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%main_count_inner = OpFunction %void None %204 %main_count_inner = OpFunction %void None %206
%GlobalInvocationID = OpFunctionParameter %v3uint %GlobalInvocationID = OpFunctionParameter %v3uint
%207 = OpLabel %209 = OpLabel
%triangleIndex = OpVariable %_ptr_Function_uint Function %143 %triangleIndex = OpVariable %_ptr_Function_uint Function %145
%i0 = OpVariable %_ptr_Function_uint Function %143 %i0 = OpVariable %_ptr_Function_uint Function %145
%i1 = OpVariable %_ptr_Function_uint Function %143 %i1 = OpVariable %_ptr_Function_uint Function %145
%i2 = OpVariable %_ptr_Function_uint Function %143 %i2 = OpVariable %_ptr_Function_uint Function %145
%p0 = OpVariable %_ptr_Function_v3float Function %52 %p0 = OpVariable %_ptr_Function_v3float Function %54
%p1 = OpVariable %_ptr_Function_v3float Function %52 %p1 = OpVariable %_ptr_Function_v3float Function %54
%p2 = OpVariable %_ptr_Function_v3float Function %52 %p2 = OpVariable %_ptr_Function_v3float Function %54
%252 = OpVariable %_ptr_Function_v3float Function %52 %254 = OpVariable %_ptr_Function_v3float Function %54
%center = OpVariable %_ptr_Function_v3float Function %52 %center = OpVariable %_ptr_Function_v3float Function %54
%voxelPos_0 = OpVariable %_ptr_Function_v3float Function %52 %voxelPos_0 = OpVariable %_ptr_Function_v3float Function %54
%lIndex = OpVariable %_ptr_Function_uint Function %143 %lIndex = OpVariable %_ptr_Function_uint Function %145
%triangleOffset = OpVariable %_ptr_Function_int Function %188 %triangleOffset = OpVariable %_ptr_Function_int Function %190
%208 = OpCompositeExtract %uint %GlobalInvocationID 0 %210 = OpCompositeExtract %uint %GlobalInvocationID 0
OpStore %triangleIndex %208 OpStore %triangleIndex %210
%210 = OpLoad %uint %triangleIndex %212 = OpLoad %uint %triangleIndex
%211 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %213 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0
%212 = OpLoad %uint %211 %214 = OpLoad %uint %213
%213 = OpUGreaterThanEqual %bool %210 %212 %215 = OpUGreaterThanEqual %bool %212 %214
OpSelectionMerge %215 None OpSelectionMerge %217 None
OpBranchConditional %213 %216 %215 OpBranchConditional %215 %218 %217
%216 = OpLabel %218 = OpLabel
OpReturn OpReturn
%215 = OpLabel %217 = OpLabel
%217 = OpFunctionCall %void %doIgnore %219 = OpFunctionCall %void %doIgnore
%218 = OpLoad %uint %triangleIndex %220 = OpLoad %uint %triangleIndex
%219 = OpIMul %uint %uint_3 %218 %221 = OpIMul %uint %uint_3 %220
%220 = OpIAdd %uint %219 %143 %222 = OpIAdd %uint %221 %145
%221 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %220 %223 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %222
%222 = OpLoad %uint %221 %224 = OpLoad %uint %223
OpStore %i0 %222 OpStore %i0 %224
%224 = OpLoad %uint %i0 %226 = OpLoad %uint %i0
%225 = OpIMul %uint %uint_3 %224 %227 = OpIMul %uint %uint_3 %226
%226 = OpIAdd %uint %225 %uint_1 %228 = OpIAdd %uint %227 %uint_1
%227 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %226 %229 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %228
%228 = OpLoad %uint %227 %230 = OpLoad %uint %229
OpStore %i1 %228 OpStore %i1 %230
%230 = OpLoad %uint %i0 %232 = OpLoad %uint %i0
%231 = OpIMul %uint %uint_3 %230 %233 = OpIMul %uint %uint_3 %232
%232 = OpIAdd %uint %231 %uint_2 %234 = OpIAdd %uint %233 %uint_2
%233 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %232 %235 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %234
%234 = OpLoad %uint %233 %236 = OpLoad %uint %235
OpStore %i2 %234 OpStore %i2 %236
%237 = OpLoad %uint %i0 %239 = OpLoad %uint %i0
%236 = OpFunctionCall %v3float %loadPosition %237 %238 = OpFunctionCall %v3float %loadPosition %239
OpStore %p0 %236 OpStore %p0 %238
%240 = OpLoad %uint %i0 %242 = OpLoad %uint %i0
%239 = OpFunctionCall %v3float %loadPosition %240 %241 = OpFunctionCall %v3float %loadPosition %242
OpStore %p1 %239 OpStore %p1 %241
%243 = OpLoad %uint %i2 %245 = OpLoad %uint %i2
%242 = OpFunctionCall %v3float %loadPosition %243 %244 = OpFunctionCall %v3float %loadPosition %245
OpStore %p2 %242 OpStore %p2 %244
%245 = OpLoad %v3float %p0 %247 = OpLoad %v3float %p0
%246 = OpLoad %v3float %p2 %248 = OpLoad %v3float %p2
%247 = OpFAdd %v3float %245 %246
%248 = OpLoad %v3float %p1
%249 = OpFAdd %v3float %247 %248 %249 = OpFAdd %v3float %247 %248
%253 = OpCompositeConstruct %v3float %float_3 %float_3 %float_3 %250 = OpLoad %v3float %p1
%251 = OpFDiv %v3float %249 %253 %251 = OpFAdd %v3float %249 %250
OpStore %center %251 %255 = OpCompositeConstruct %v3float %float_3 %float_3 %float_3
%256 = OpLoad %v3float %p1 %253 = OpFDiv %v3float %251 %255
%255 = OpFunctionCall %v3float %toVoxelPos %256 OpStore %center %253
OpStore %voxelPos_0 %255 %258 = OpLoad %v3float %p1
%259 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 %257 = OpFunctionCall %v3float %toVoxelPos %258
%260 = OpLoad %uint %259 OpStore %voxelPos_0 %257
%261 = OpLoad %v3float %p0 %261 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1
%258 = OpFunctionCall %uint %toIndex1D %260 %261 %262 = OpLoad %uint %261
OpStore %lIndex %258 %263 = OpLoad %v3float %p0
%265 = OpLoad %uint %i1 %260 = OpFunctionCall %uint %toIndex1D %262 %263
%266 = OpAccessChain %_ptr_StorageBuffer_int %LUT %uint_0 %265 OpStore %lIndex %260
%263 = OpAtomicIAdd %int %266 %uint_1 %uint_0 %int_1 %267 = OpLoad %uint %i1
OpStore %triangleOffset %263 %268 = OpAccessChain %_ptr_StorageBuffer_int %LUT %uint_0 %267
%265 = OpAtomicIAdd %int %268 %uint_1 %uint_0 %int_1
OpStore %triangleOffset %265
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%main_count = OpFunction %void None %30 %main_count = OpFunction %void None %32
%270 = OpLabel %272 = OpLabel
%272 = OpLoad %v3uint %GlobalInvocationID_1 %274 = OpLoad %v3uint %GlobalInvocationID_1
%271 = OpFunctionCall %void %main_count_inner %272 %273 = OpFunctionCall %void %main_count_inner %274
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -8,7 +8,11 @@ layout(binding = 0, std430) buffer v_block_ssbo {
int inner[1000000]; int inner[1000000];
} v; } v;
layout(binding = 1, std430) buffer A_ssbo { struct A {
float a[1000000]; float a[1000000];
};
layout(binding = 1, std430) buffer b_block_ssbo {
A inner;
} b; } b;

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: 17 ; Bound: 18
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
@ -10,6 +10,8 @@
OpName %v_block "v_block" OpName %v_block "v_block"
OpMemberName %v_block 0 "inner" OpMemberName %v_block 0 "inner"
OpName %v "v" OpName %v "v"
OpName %b_block "b_block"
OpMemberName %b_block 0 "inner"
OpName %A "A" OpName %A "A"
OpMemberName %A 0 "a" OpMemberName %A 0 "a"
OpName %b "b" OpName %b "b"
@ -20,7 +22,8 @@
OpDecorate %v NonWritable OpDecorate %v NonWritable
OpDecorate %v DescriptorSet 0 OpDecorate %v DescriptorSet 0
OpDecorate %v Binding 0 OpDecorate %v Binding 0
OpDecorate %A Block OpDecorate %b_block Block
OpMemberDecorate %b_block 0 Offset 0
OpMemberDecorate %A 0 Offset 0 OpMemberDecorate %A 0 Offset 0
OpDecorate %_arr_float_uint_1000000 ArrayStride 4 OpDecorate %_arr_float_uint_1000000 ArrayStride 4
OpDecorate %b NonWritable OpDecorate %b NonWritable
@ -36,11 +39,12 @@
%float = OpTypeFloat 32 %float = OpTypeFloat 32
%_arr_float_uint_1000000 = OpTypeArray %float %uint_1000000 %_arr_float_uint_1000000 = OpTypeArray %float %uint_1000000
%A = OpTypeStruct %_arr_float_uint_1000000 %A = OpTypeStruct %_arr_float_uint_1000000
%_ptr_StorageBuffer_A = OpTypePointer StorageBuffer %A %b_block = OpTypeStruct %A
%b = OpVariable %_ptr_StorageBuffer_A StorageBuffer %_ptr_StorageBuffer_b_block = OpTypePointer StorageBuffer %b_block
%b = OpVariable %_ptr_StorageBuffer_b_block StorageBuffer
%void = OpTypeVoid %void = OpTypeVoid
%13 = OpTypeFunction %void %14 = OpTypeFunction %void
%unused_entry_point = OpFunction %void None %13 %unused_entry_point = OpFunction %void None %14
%16 = OpLabel %17 = OpLabel
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -1,9 +1,13 @@
#version 310 es #version 310 es
layout(location = 0) out vec2 texcoords_1; layout(location = 0) out vec2 texcoords_1;
layout(binding = 0, std140) uniform Uniforms_ubo { struct Uniforms {
vec2 u_scale; vec2 u_scale;
vec2 u_offset; vec2 u_offset;
};
layout(binding = 0, std140) uniform uniforms_block_ubo {
Uniforms inner;
} uniforms; } uniforms;
struct VertexOutputs { struct VertexOutputs {
@ -15,11 +19,11 @@ VertexOutputs vs_main(uint VertexIndex) {
vec2 texcoord[3] = vec2[3](vec2(-0.5f, 0.0f), vec2(1.5f, 0.0f), vec2(0.5f, 2.0f)); vec2 texcoord[3] = vec2[3](vec2(-0.5f, 0.0f), vec2(1.5f, 0.0f), vec2(0.5f, 2.0f));
VertexOutputs tint_symbol = VertexOutputs(vec2(0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f)); VertexOutputs tint_symbol = VertexOutputs(vec2(0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f));
tint_symbol.position = vec4(((texcoord[VertexIndex] * 2.0f) - vec2(1.0f)), 0.0f, 1.0f); tint_symbol.position = vec4(((texcoord[VertexIndex] * 2.0f) - vec2(1.0f)), 0.0f, 1.0f);
bool flipY = (uniforms.u_scale.y < 0.0f); bool flipY = (uniforms.inner.u_scale.y < 0.0f);
if (flipY) { if (flipY) {
tint_symbol.texcoords = ((((texcoord[VertexIndex] * uniforms.u_scale) + uniforms.u_offset) * vec2(1.0f, -1.0f)) + vec2(0.0f, 1.0f)); tint_symbol.texcoords = ((((texcoord[VertexIndex] * uniforms.inner.u_scale) + uniforms.inner.u_offset) * vec2(1.0f, -1.0f)) + vec2(0.0f, 1.0f));
} else { } else {
tint_symbol.texcoords = ((((texcoord[VertexIndex] * vec2(1.0f, -1.0f)) + vec2(0.0f, 1.0f)) * uniforms.u_scale) + uniforms.u_offset); tint_symbol.texcoords = ((((texcoord[VertexIndex] * vec2(1.0f, -1.0f)) + vec2(0.0f, 1.0f)) * uniforms.inner.u_scale) + uniforms.inner.u_offset);
} }
return tint_symbol; return tint_symbol;
} }

View File

@ -1,10 +1,10 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 133 ; Bound: 134
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
%117 = OpExtInstImport "GLSL.std.450" %118 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vs_main "vs_main" %VertexIndex_1 %texcoords_1 %position_1 %vertex_point_size OpEntryPoint Vertex %vs_main "vs_main" %VertexIndex_1 %texcoords_1 %position_1 %vertex_point_size
OpEntryPoint Fragment %fs_main "fs_main" %texcoord_1 %value OpEntryPoint Fragment %fs_main "fs_main" %texcoord_1 %value
@ -15,6 +15,8 @@
OpName %vertex_point_size "vertex_point_size" OpName %vertex_point_size "vertex_point_size"
OpName %texcoord_1 "texcoord_1" OpName %texcoord_1 "texcoord_1"
OpName %value "value" OpName %value "value"
OpName %uniforms_block "uniforms_block"
OpMemberName %uniforms_block 0 "inner"
OpName %Uniforms "Uniforms" OpName %Uniforms "Uniforms"
OpMemberName %Uniforms 0 "u_scale" OpMemberName %Uniforms 0 "u_scale"
OpMemberName %Uniforms 1 "u_offset" OpMemberName %Uniforms 1 "u_offset"
@ -42,7 +44,8 @@
OpDecorate %vertex_point_size BuiltIn PointSize OpDecorate %vertex_point_size BuiltIn PointSize
OpDecorate %texcoord_1 Location 0 OpDecorate %texcoord_1 Location 0
OpDecorate %value Location 0 OpDecorate %value Location 0
OpDecorate %Uniforms Block OpDecorate %uniforms_block Block
OpMemberDecorate %uniforms_block 0 Offset 0
OpMemberDecorate %Uniforms 0 Offset 0 OpMemberDecorate %Uniforms 0 Offset 0
OpMemberDecorate %Uniforms 1 Offset 8 OpMemberDecorate %Uniforms 1 Offset 8
OpDecorate %uniforms NonWritable OpDecorate %uniforms NonWritable
@ -74,143 +77,144 @@
%texcoord_1 = OpVariable %_ptr_Input_v2float Input %texcoord_1 = OpVariable %_ptr_Input_v2float Input
%value = OpVariable %_ptr_Output_v4float Output %12 %value = OpVariable %_ptr_Output_v4float Output %12
%Uniforms = OpTypeStruct %v2float %v2float %Uniforms = OpTypeStruct %v2float %v2float
%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms %uniforms_block = OpTypeStruct %Uniforms
%uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform %_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block
%24 = OpTypeSampler %uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform
%_ptr_UniformConstant_24 = OpTypePointer UniformConstant %24 %25 = OpTypeSampler
%mySampler = OpVariable %_ptr_UniformConstant_24 UniformConstant %_ptr_UniformConstant_25 = OpTypePointer UniformConstant %25
%27 = OpTypeImage %float 2D 0 0 0 1 Unknown %mySampler = OpVariable %_ptr_UniformConstant_25 UniformConstant
%_ptr_UniformConstant_27 = OpTypePointer UniformConstant %27 %28 = OpTypeImage %float 2D 0 0 0 1 Unknown
%myTexture = OpVariable %_ptr_UniformConstant_27 UniformConstant %_ptr_UniformConstant_28 = OpTypePointer UniformConstant %28
%myTexture = OpVariable %_ptr_UniformConstant_28 UniformConstant
%VertexOutputs = OpTypeStruct %v2float %v4float %VertexOutputs = OpTypeStruct %v2float %v4float
%28 = OpTypeFunction %VertexOutputs %uint %29 = OpTypeFunction %VertexOutputs %uint
%uint_3 = OpConstant %uint 3 %uint_3 = OpConstant %uint 3
%_arr_v2float_uint_3 = OpTypeArray %v2float %uint_3 %_arr_v2float_uint_3 = OpTypeArray %v2float %uint_3
%float_n0_5 = OpConstant %float -0.5 %float_n0_5 = OpConstant %float -0.5
%36 = OpConstantComposite %v2float %float_n0_5 %15 %37 = OpConstantComposite %v2float %float_n0_5 %15
%float_1_5 = OpConstant %float 1.5 %float_1_5 = OpConstant %float 1.5
%38 = OpConstantComposite %v2float %float_1_5 %15 %39 = OpConstantComposite %v2float %float_1_5 %15
%float_0_5 = OpConstant %float 0.5 %float_0_5 = OpConstant %float 0.5
%float_2 = OpConstant %float 2 %float_2 = OpConstant %float 2
%41 = OpConstantComposite %v2float %float_0_5 %float_2 %42 = OpConstantComposite %v2float %float_0_5 %float_2
%42 = OpConstantComposite %_arr_v2float_uint_3 %36 %38 %41 %43 = OpConstantComposite %_arr_v2float_uint_3 %37 %39 %42
%_ptr_Function__arr_v2float_uint_3 = OpTypePointer Function %_arr_v2float_uint_3 %_ptr_Function__arr_v2float_uint_3 = OpTypePointer Function %_arr_v2float_uint_3
%45 = OpConstantNull %_arr_v2float_uint_3 %46 = OpConstantNull %_arr_v2float_uint_3
%_ptr_Function_VertexOutputs = OpTypePointer Function %VertexOutputs %_ptr_Function_VertexOutputs = OpTypePointer Function %VertexOutputs
%48 = OpConstantNull %VertexOutputs %49 = OpConstantNull %VertexOutputs
%uint_1 = OpConstant %uint 1 %uint_1 = OpConstant %uint 1
%_ptr_Function_v4float = OpTypePointer Function %v4float %_ptr_Function_v4float = OpTypePointer Function %v4float
%_ptr_Function_v2float = OpTypePointer Function %v2float %_ptr_Function_v2float = OpTypePointer Function %v2float
%float_1 = OpConstant %float 1 %float_1 = OpConstant %float 1
%57 = OpConstantComposite %v2float %float_1 %float_1 %58 = OpConstantComposite %v2float %float_1 %float_1
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%_ptr_Uniform_float = OpTypePointer Uniform %float %_ptr_Uniform_float = OpTypePointer Uniform %float
%bool = OpTypeBool %bool = OpTypeBool
%_ptr_Function_bool = OpTypePointer Function %bool %_ptr_Function_bool = OpTypePointer Function %bool
%70 = OpConstantNull %bool %71 = OpConstantNull %bool
%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float %_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
%float_n1 = OpConstant %float -1 %float_n1 = OpConstant %float -1
%86 = OpConstantComposite %v2float %float_1 %float_n1 %87 = OpConstantComposite %v2float %float_1 %float_n1
%88 = OpConstantComposite %v2float %15 %float_1 %89 = OpConstantComposite %v2float %15 %float_1
%void = OpTypeVoid %void = OpTypeVoid
%102 = OpTypeFunction %void %103 = OpTypeFunction %void
%112 = OpTypeFunction %v4float %v2float %113 = OpTypeFunction %v4float %v2float
%v2bool = OpTypeVector %bool 2 %v2bool = OpTypeVector %bool 2
%vs_main_inner = OpFunction %VertexOutputs None %28 %vs_main_inner = OpFunction %VertexOutputs None %29
%VertexIndex = OpFunctionParameter %uint %VertexIndex = OpFunctionParameter %uint
%32 = OpLabel %33 = OpLabel
%texcoord = OpVariable %_ptr_Function__arr_v2float_uint_3 Function %45 %texcoord = OpVariable %_ptr_Function__arr_v2float_uint_3 Function %46
%output = OpVariable %_ptr_Function_VertexOutputs Function %48 %output = OpVariable %_ptr_Function_VertexOutputs Function %49
%flipY = OpVariable %_ptr_Function_bool Function %70 %flipY = OpVariable %_ptr_Function_bool Function %71
OpStore %texcoord %42 OpStore %texcoord %43
%51 = OpAccessChain %_ptr_Function_v4float %output %uint_1 %52 = OpAccessChain %_ptr_Function_v4float %output %uint_1
%53 = OpAccessChain %_ptr_Function_v2float %texcoord %VertexIndex %54 = OpAccessChain %_ptr_Function_v2float %texcoord %VertexIndex
%54 = OpLoad %v2float %53 %55 = OpLoad %v2float %54
%55 = OpVectorTimesScalar %v2float %54 %float_2 %56 = OpVectorTimesScalar %v2float %55 %float_2
%58 = OpFSub %v2float %55 %57 %59 = OpFSub %v2float %56 %58
%59 = OpCompositeExtract %float %58 0 %60 = OpCompositeExtract %float %59 0
%60 = OpCompositeExtract %float %58 1 %61 = OpCompositeExtract %float %59 1
%61 = OpCompositeConstruct %v4float %59 %60 %15 %float_1 %62 = OpCompositeConstruct %v4float %60 %61 %15 %float_1
OpStore %51 %61 OpStore %52 %62
%64 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_1 %65 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_0 %uint_1
%65 = OpLoad %float %64 %66 = OpLoad %float %65
%66 = OpFOrdLessThan %bool %65 %15 %67 = OpFOrdLessThan %bool %66 %15
OpStore %flipY %66 OpStore %flipY %67
%71 = OpLoad %bool %flipY %72 = OpLoad %bool %flipY
OpSelectionMerge %72 None OpSelectionMerge %73 None
OpBranchConditional %71 %73 %74 OpBranchConditional %72 %74 %75
%73 = OpLabel
%75 = OpAccessChain %_ptr_Function_v2float %output %uint_0
%76 = OpAccessChain %_ptr_Function_v2float %texcoord %VertexIndex
%77 = OpLoad %v2float %76
%79 = OpAccessChain %_ptr_Uniform_v2float %uniforms %uint_0
%80 = OpLoad %v2float %79
%81 = OpFMul %v2float %77 %80
%82 = OpAccessChain %_ptr_Uniform_v2float %uniforms %uint_1
%83 = OpLoad %v2float %82
%84 = OpFAdd %v2float %81 %83
%87 = OpFMul %v2float %84 %86
%89 = OpFAdd %v2float %87 %88
OpStore %75 %89
OpBranch %72
%74 = OpLabel %74 = OpLabel
%90 = OpAccessChain %_ptr_Function_v2float %output %uint_0 %76 = OpAccessChain %_ptr_Function_v2float %output %uint_0
%91 = OpAccessChain %_ptr_Function_v2float %texcoord %VertexIndex %77 = OpAccessChain %_ptr_Function_v2float %texcoord %VertexIndex
%92 = OpLoad %v2float %91 %78 = OpLoad %v2float %77
%93 = OpFMul %v2float %92 %86 %80 = OpAccessChain %_ptr_Uniform_v2float %uniforms %uint_0 %uint_0
%94 = OpFAdd %v2float %93 %88 %81 = OpLoad %v2float %80
%95 = OpAccessChain %_ptr_Uniform_v2float %uniforms %uint_0 %82 = OpFMul %v2float %78 %81
%96 = OpLoad %v2float %95 %83 = OpAccessChain %_ptr_Uniform_v2float %uniforms %uint_0 %uint_1
%97 = OpFMul %v2float %94 %96 %84 = OpLoad %v2float %83
%98 = OpAccessChain %_ptr_Uniform_v2float %uniforms %uint_1 %85 = OpFAdd %v2float %82 %84
%99 = OpLoad %v2float %98 %88 = OpFMul %v2float %85 %87
%100 = OpFAdd %v2float %97 %99 %90 = OpFAdd %v2float %88 %89
OpStore %90 %100 OpStore %76 %90
OpBranch %72 OpBranch %73
%72 = OpLabel %75 = OpLabel
%101 = OpLoad %VertexOutputs %output %91 = OpAccessChain %_ptr_Function_v2float %output %uint_0
OpReturnValue %101 %92 = OpAccessChain %_ptr_Function_v2float %texcoord %VertexIndex
%93 = OpLoad %v2float %92
%94 = OpFMul %v2float %93 %87
%95 = OpFAdd %v2float %94 %89
%96 = OpAccessChain %_ptr_Uniform_v2float %uniforms %uint_0 %uint_0
%97 = OpLoad %v2float %96
%98 = OpFMul %v2float %95 %97
%99 = OpAccessChain %_ptr_Uniform_v2float %uniforms %uint_0 %uint_1
%100 = OpLoad %v2float %99
%101 = OpFAdd %v2float %98 %100
OpStore %91 %101
OpBranch %73
%73 = OpLabel
%102 = OpLoad %VertexOutputs %output
OpReturnValue %102
OpFunctionEnd OpFunctionEnd
%vs_main = OpFunction %void None %102 %vs_main = OpFunction %void None %103
%105 = OpLabel %106 = OpLabel
%107 = OpLoad %uint %VertexIndex_1 %108 = OpLoad %uint %VertexIndex_1
%106 = OpFunctionCall %VertexOutputs %vs_main_inner %107 %107 = OpFunctionCall %VertexOutputs %vs_main_inner %108
%108 = OpCompositeExtract %v2float %106 0 %109 = OpCompositeExtract %v2float %107 0
OpStore %texcoords_1 %108 OpStore %texcoords_1 %109
%109 = OpCompositeExtract %v4float %106 1 %110 = OpCompositeExtract %v4float %107 1
OpStore %position_1 %109 OpStore %position_1 %110
OpStore %vertex_point_size %float_1 OpStore %vertex_point_size %float_1
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%tint_discard_func = OpFunction %void None %102 %tint_discard_func = OpFunction %void None %103
%111 = OpLabel %112 = OpLabel
OpKill OpKill
OpFunctionEnd OpFunctionEnd
%fs_main_inner = OpFunction %v4float None %112 %fs_main_inner = OpFunction %v4float None %113
%texcoord_0 = OpFunctionParameter %v2float %texcoord_0 = OpFunctionParameter %v2float
%115 = OpLabel %116 = OpLabel
%clampedTexcoord = OpVariable %_ptr_Function_v2float Function %8 %clampedTexcoord = OpVariable %_ptr_Function_v2float Function %8
%srcColor = OpVariable %_ptr_Function_v4float Function %12 %srcColor = OpVariable %_ptr_Function_v4float Function %12
%116 = OpExtInst %v2float %117 NClamp %texcoord_0 %8 %57 %117 = OpExtInst %v2float %118 NClamp %texcoord_0 %8 %58
OpStore %clampedTexcoord %116 OpStore %clampedTexcoord %117
%121 = OpLoad %v2float %clampedTexcoord %122 = OpLoad %v2float %clampedTexcoord
%122 = OpFOrdEqual %v2bool %121 %texcoord_0 %123 = OpFOrdEqual %v2bool %122 %texcoord_0
%120 = OpAll %bool %122 %121 = OpAll %bool %123
%119 = OpLogicalNot %bool %120 %120 = OpLogicalNot %bool %121
OpSelectionMerge %124 None OpSelectionMerge %125 None
OpBranchConditional %119 %125 %124 OpBranchConditional %120 %126 %125
%125 = OpLabel %126 = OpLabel
%126 = OpFunctionCall %void %tint_discard_func %127 = OpFunctionCall %void %tint_discard_func
OpReturnValue %12 OpReturnValue %12
%124 = OpLabel %125 = OpLabel
OpStore %srcColor %12 OpStore %srcColor %12
%128 = OpLoad %v4float %srcColor %129 = OpLoad %v4float %srcColor
OpReturnValue %128 OpReturnValue %129
OpFunctionEnd OpFunctionEnd
%fs_main = OpFunction %void None %102 %fs_main = OpFunction %void None %103
%130 = OpLabel %131 = OpLabel
%132 = OpLoad %v2float %texcoord_1 %133 = OpLoad %v2float %texcoord_1
%131 = OpFunctionCall %v4float %fs_main_inner %132 %132 = OpFunctionCall %v4float %fs_main_inner %133
OpStore %value %131 OpStore %value %132
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -1,23 +1,31 @@
#version 310 es #version 310 es
layout(binding = 0, std140) uniform UBO_ubo { struct UBO {
int dynamic_idx; int dynamic_idx;
uint pad; uint pad;
uint pad_1; uint pad_1;
uint pad_2; uint pad_2;
};
layout(binding = 0, std140) uniform ubo_block_ubo {
UBO inner;
} ubo; } ubo;
struct S { struct S {
int data[64]; int data[64];
}; };
layout(binding = 1, std430) buffer Result_ssbo { struct Result {
int tint_symbol; int tint_symbol;
};
layout(binding = 1, std430) buffer result_block_ssbo {
Result inner;
} result; } result;
void f() { void f() {
S s = S(int[64](0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)); S s = S(int[64](0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
result.tint_symbol = s.data[ubo.dynamic_idx]; result.inner.tint_symbol = s.data[ubo.inner.dynamic_idx];
} }
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

@ -1,15 +1,19 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 28 ; Bound: 30
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f" OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1 OpExecutionMode %f LocalSize 1 1 1
OpName %ubo_block "ubo_block"
OpMemberName %ubo_block 0 "inner"
OpName %UBO "UBO" OpName %UBO "UBO"
OpMemberName %UBO 0 "dynamic_idx" OpMemberName %UBO 0 "dynamic_idx"
OpName %ubo "ubo" OpName %ubo "ubo"
OpName %result_block "result_block"
OpMemberName %result_block 0 "inner"
OpName %Result "Result" OpName %Result "Result"
OpMemberName %Result 0 "out" OpMemberName %Result 0 "out"
OpName %result "result" OpName %result "result"
@ -17,12 +21,14 @@
OpName %S "S" OpName %S "S"
OpMemberName %S 0 "data" OpMemberName %S 0 "data"
OpName %s "s" OpName %s "s"
OpDecorate %UBO Block OpDecorate %ubo_block Block
OpMemberDecorate %ubo_block 0 Offset 0
OpMemberDecorate %UBO 0 Offset 0 OpMemberDecorate %UBO 0 Offset 0
OpDecorate %ubo NonWritable OpDecorate %ubo NonWritable
OpDecorate %ubo DescriptorSet 0 OpDecorate %ubo DescriptorSet 0
OpDecorate %ubo Binding 0 OpDecorate %ubo Binding 0
OpDecorate %Result Block OpDecorate %result_block Block
OpMemberDecorate %result_block 0 Offset 0
OpMemberDecorate %Result 0 Offset 0 OpMemberDecorate %Result 0 Offset 0
OpDecorate %result DescriptorSet 0 OpDecorate %result DescriptorSet 0
OpDecorate %result Binding 1 OpDecorate %result Binding 1
@ -30,31 +36,33 @@
OpDecorate %_arr_int_uint_64 ArrayStride 4 OpDecorate %_arr_int_uint_64 ArrayStride 4
%int = OpTypeInt 32 1 %int = OpTypeInt 32 1
%UBO = OpTypeStruct %int %UBO = OpTypeStruct %int
%_ptr_Uniform_UBO = OpTypePointer Uniform %UBO %ubo_block = OpTypeStruct %UBO
%ubo = OpVariable %_ptr_Uniform_UBO Uniform %_ptr_Uniform_ubo_block = OpTypePointer Uniform %ubo_block
%ubo = OpVariable %_ptr_Uniform_ubo_block Uniform
%Result = OpTypeStruct %int %Result = OpTypeStruct %int
%_ptr_StorageBuffer_Result = OpTypePointer StorageBuffer %Result %result_block = OpTypeStruct %Result
%result = OpVariable %_ptr_StorageBuffer_Result StorageBuffer %_ptr_StorageBuffer_result_block = OpTypePointer StorageBuffer %result_block
%result = OpVariable %_ptr_StorageBuffer_result_block StorageBuffer
%void = OpTypeVoid %void = OpTypeVoid
%8 = OpTypeFunction %void %10 = OpTypeFunction %void
%uint = OpTypeInt 32 0 %uint = OpTypeInt 32 0
%uint_64 = OpConstant %uint 64 %uint_64 = OpConstant %uint 64
%_arr_int_uint_64 = OpTypeArray %int %uint_64 %_arr_int_uint_64 = OpTypeArray %int %uint_64
%S = OpTypeStruct %_arr_int_uint_64 %S = OpTypeStruct %_arr_int_uint_64
%_ptr_Function_S = OpTypePointer Function %S %_ptr_Function_S = OpTypePointer Function %S
%18 = OpConstantNull %S %20 = OpConstantNull %S
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%_ptr_Uniform_int = OpTypePointer Uniform %int %_ptr_Uniform_int = OpTypePointer Uniform %int
%_ptr_Function_int = OpTypePointer Function %int %_ptr_Function_int = OpTypePointer Function %int
%f = OpFunction %void None %8 %f = OpFunction %void None %10
%11 = OpLabel %13 = OpLabel
%s = OpVariable %_ptr_Function_S Function %18 %s = OpVariable %_ptr_Function_S Function %20
%21 = OpAccessChain %_ptr_StorageBuffer_int %result %uint_0 %23 = OpAccessChain %_ptr_StorageBuffer_int %result %uint_0 %uint_0
%23 = OpAccessChain %_ptr_Uniform_int %ubo %uint_0 %25 = OpAccessChain %_ptr_Uniform_int %ubo %uint_0 %uint_0
%24 = OpLoad %int %23 %26 = OpLoad %int %25
%26 = OpAccessChain %_ptr_Function_int %s %uint_0 %24 %28 = OpAccessChain %_ptr_Function_int %s %uint_0 %26
%27 = OpLoad %int %26 %29 = OpLoad %int %28
OpStore %21 %27 OpStore %23 %29
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -1,23 +1,31 @@
#version 310 es #version 310 es
layout(binding = 0, std140) uniform UBO_ubo { struct UBO {
int dynamic_idx; int dynamic_idx;
uint pad; uint pad;
uint pad_1; uint pad_1;
uint pad_2; uint pad_2;
};
layout(binding = 0, std140) uniform ubo_block_ubo {
UBO inner;
} ubo; } ubo;
struct S { struct S {
int data[64]; int data[64];
}; };
layout(binding = 1, std430) buffer Result_ssbo { struct Result {
int tint_symbol; int tint_symbol;
};
layout(binding = 1, std430) buffer result_block_ssbo {
Result inner;
} result; } result;
S s = S(int[64](0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)); S s = S(int[64](0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
void f() { void f() {
result.tint_symbol = s.data[ubo.dynamic_idx]; result.inner.tint_symbol = s.data[ubo.inner.dynamic_idx];
} }
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

@ -1,15 +1,19 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 28 ; Bound: 30
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f" OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1 OpExecutionMode %f LocalSize 1 1 1
OpName %ubo_block "ubo_block"
OpMemberName %ubo_block 0 "inner"
OpName %UBO "UBO" OpName %UBO "UBO"
OpMemberName %UBO 0 "dynamic_idx" OpMemberName %UBO 0 "dynamic_idx"
OpName %ubo "ubo" OpName %ubo "ubo"
OpName %result_block "result_block"
OpMemberName %result_block 0 "inner"
OpName %Result "Result" OpName %Result "Result"
OpMemberName %Result 0 "out" OpMemberName %Result 0 "out"
OpName %result "result" OpName %result "result"
@ -17,12 +21,14 @@
OpMemberName %S 0 "data" OpMemberName %S 0 "data"
OpName %s "s" OpName %s "s"
OpName %f "f" OpName %f "f"
OpDecorate %UBO Block OpDecorate %ubo_block Block
OpMemberDecorate %ubo_block 0 Offset 0
OpMemberDecorate %UBO 0 Offset 0 OpMemberDecorate %UBO 0 Offset 0
OpDecorate %ubo NonWritable OpDecorate %ubo NonWritable
OpDecorate %ubo DescriptorSet 0 OpDecorate %ubo DescriptorSet 0
OpDecorate %ubo Binding 0 OpDecorate %ubo Binding 0
OpDecorate %Result Block OpDecorate %result_block Block
OpMemberDecorate %result_block 0 Offset 0
OpMemberDecorate %Result 0 Offset 0 OpMemberDecorate %Result 0 Offset 0
OpDecorate %result DescriptorSet 0 OpDecorate %result DescriptorSet 0
OpDecorate %result Binding 1 OpDecorate %result Binding 1
@ -30,31 +36,33 @@
OpDecorate %_arr_int_uint_64 ArrayStride 4 OpDecorate %_arr_int_uint_64 ArrayStride 4
%int = OpTypeInt 32 1 %int = OpTypeInt 32 1
%UBO = OpTypeStruct %int %UBO = OpTypeStruct %int
%_ptr_Uniform_UBO = OpTypePointer Uniform %UBO %ubo_block = OpTypeStruct %UBO
%ubo = OpVariable %_ptr_Uniform_UBO Uniform %_ptr_Uniform_ubo_block = OpTypePointer Uniform %ubo_block
%ubo = OpVariable %_ptr_Uniform_ubo_block Uniform
%Result = OpTypeStruct %int %Result = OpTypeStruct %int
%_ptr_StorageBuffer_Result = OpTypePointer StorageBuffer %Result %result_block = OpTypeStruct %Result
%result = OpVariable %_ptr_StorageBuffer_Result StorageBuffer %_ptr_StorageBuffer_result_block = OpTypePointer StorageBuffer %result_block
%result = OpVariable %_ptr_StorageBuffer_result_block StorageBuffer
%uint = OpTypeInt 32 0 %uint = OpTypeInt 32 0
%uint_64 = OpConstant %uint 64 %uint_64 = OpConstant %uint 64
%_arr_int_uint_64 = OpTypeArray %int %uint_64 %_arr_int_uint_64 = OpTypeArray %int %uint_64
%S = OpTypeStruct %_arr_int_uint_64 %S = OpTypeStruct %_arr_int_uint_64
%_ptr_Private_S = OpTypePointer Private %S %_ptr_Private_S = OpTypePointer Private %S
%14 = OpConstantNull %S %16 = OpConstantNull %S
%s = OpVariable %_ptr_Private_S Private %14 %s = OpVariable %_ptr_Private_S Private %16
%void = OpTypeVoid %void = OpTypeVoid
%15 = OpTypeFunction %void %17 = OpTypeFunction %void
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%_ptr_Uniform_int = OpTypePointer Uniform %int %_ptr_Uniform_int = OpTypePointer Uniform %int
%_ptr_Private_int = OpTypePointer Private %int %_ptr_Private_int = OpTypePointer Private %int
%f = OpFunction %void None %15 %f = OpFunction %void None %17
%18 = OpLabel %20 = OpLabel
%21 = OpAccessChain %_ptr_StorageBuffer_int %result %uint_0 %23 = OpAccessChain %_ptr_StorageBuffer_int %result %uint_0 %uint_0
%23 = OpAccessChain %_ptr_Uniform_int %ubo %uint_0 %25 = OpAccessChain %_ptr_Uniform_int %ubo %uint_0 %uint_0
%24 = OpLoad %int %23 %26 = OpLoad %int %25
%26 = OpAccessChain %_ptr_Private_int %s %uint_0 %24 %28 = OpAccessChain %_ptr_Private_int %s %uint_0 %26
%27 = OpLoad %int %26 %29 = OpLoad %int %28
OpStore %21 %27 OpStore %23 %29
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -1,22 +1,34 @@
#version 310 es #version 310 es
layout(binding = 0, std140) uniform UBO_ubo { struct UBO {
int dynamic_idx; int dynamic_idx;
uint pad; uint pad;
uint pad_1; uint pad_1;
uint pad_2; uint pad_2;
};
layout(binding = 0, std140) uniform ubo_block_ubo {
UBO inner;
} ubo; } ubo;
layout(binding = 2, std430) buffer Result_ssbo { struct Result {
int tint_symbol; int tint_symbol;
};
layout(binding = 2, std430) buffer result_block_ssbo {
Result inner;
} result; } result;
layout(binding = 1, std430) buffer SSBO_ssbo { struct SSBO {
int data[4]; int data[4];
};
layout(binding = 1, std430) buffer ssbo_block_ssbo {
SSBO inner;
} ssbo; } ssbo;
void f() { void f() {
result.tint_symbol = ssbo.data[ubo.dynamic_idx]; result.inner.tint_symbol = ssbo.inner.data[ubo.inner.dynamic_idx];
} }
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

@ -1,61 +1,73 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 26 ; Bound: 29
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f" OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1 OpExecutionMode %f LocalSize 1 1 1
OpName %ubo_block "ubo_block"
OpMemberName %ubo_block 0 "inner"
OpName %UBO "UBO" OpName %UBO "UBO"
OpMemberName %UBO 0 "dynamic_idx" OpMemberName %UBO 0 "dynamic_idx"
OpName %ubo "ubo" OpName %ubo "ubo"
OpName %result_block "result_block"
OpMemberName %result_block 0 "inner"
OpName %Result "Result" OpName %Result "Result"
OpMemberName %Result 0 "out" OpMemberName %Result 0 "out"
OpName %result "result" OpName %result "result"
OpName %ssbo_block "ssbo_block"
OpMemberName %ssbo_block 0 "inner"
OpName %SSBO "SSBO" OpName %SSBO "SSBO"
OpMemberName %SSBO 0 "data" OpMemberName %SSBO 0 "data"
OpName %ssbo "ssbo" OpName %ssbo "ssbo"
OpName %f "f" OpName %f "f"
OpDecorate %UBO Block OpDecorate %ubo_block Block
OpMemberDecorate %ubo_block 0 Offset 0
OpMemberDecorate %UBO 0 Offset 0 OpMemberDecorate %UBO 0 Offset 0
OpDecorate %ubo NonWritable OpDecorate %ubo NonWritable
OpDecorate %ubo DescriptorSet 0 OpDecorate %ubo DescriptorSet 0
OpDecorate %ubo Binding 0 OpDecorate %ubo Binding 0
OpDecorate %Result Block OpDecorate %result_block Block
OpMemberDecorate %result_block 0 Offset 0
OpMemberDecorate %Result 0 Offset 0 OpMemberDecorate %Result 0 Offset 0
OpDecorate %result DescriptorSet 0 OpDecorate %result DescriptorSet 0
OpDecorate %result Binding 2 OpDecorate %result Binding 2
OpDecorate %SSBO Block OpDecorate %ssbo_block Block
OpMemberDecorate %ssbo_block 0 Offset 0
OpMemberDecorate %SSBO 0 Offset 0 OpMemberDecorate %SSBO 0 Offset 0
OpDecorate %_arr_int_uint_4 ArrayStride 4 OpDecorate %_arr_int_uint_4 ArrayStride 4
OpDecorate %ssbo DescriptorSet 0 OpDecorate %ssbo DescriptorSet 0
OpDecorate %ssbo Binding 1 OpDecorate %ssbo Binding 1
%int = OpTypeInt 32 1 %int = OpTypeInt 32 1
%UBO = OpTypeStruct %int %UBO = OpTypeStruct %int
%_ptr_Uniform_UBO = OpTypePointer Uniform %UBO %ubo_block = OpTypeStruct %UBO
%ubo = OpVariable %_ptr_Uniform_UBO Uniform %_ptr_Uniform_ubo_block = OpTypePointer Uniform %ubo_block
%ubo = OpVariable %_ptr_Uniform_ubo_block Uniform
%Result = OpTypeStruct %int %Result = OpTypeStruct %int
%_ptr_StorageBuffer_Result = OpTypePointer StorageBuffer %Result %result_block = OpTypeStruct %Result
%result = OpVariable %_ptr_StorageBuffer_Result StorageBuffer %_ptr_StorageBuffer_result_block = OpTypePointer StorageBuffer %result_block
%result = OpVariable %_ptr_StorageBuffer_result_block StorageBuffer
%uint = OpTypeInt 32 0 %uint = OpTypeInt 32 0
%uint_4 = OpConstant %uint 4 %uint_4 = OpConstant %uint 4
%_arr_int_uint_4 = OpTypeArray %int %uint_4 %_arr_int_uint_4 = OpTypeArray %int %uint_4
%SSBO = OpTypeStruct %_arr_int_uint_4 %SSBO = OpTypeStruct %_arr_int_uint_4
%_ptr_StorageBuffer_SSBO = OpTypePointer StorageBuffer %SSBO %ssbo_block = OpTypeStruct %SSBO
%ssbo = OpVariable %_ptr_StorageBuffer_SSBO StorageBuffer %_ptr_StorageBuffer_ssbo_block = OpTypePointer StorageBuffer %ssbo_block
%ssbo = OpVariable %_ptr_StorageBuffer_ssbo_block StorageBuffer
%void = OpTypeVoid %void = OpTypeVoid
%14 = OpTypeFunction %void %17 = OpTypeFunction %void
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%_ptr_Uniform_int = OpTypePointer Uniform %int %_ptr_Uniform_int = OpTypePointer Uniform %int
%f = OpFunction %void None %14 %f = OpFunction %void None %17
%17 = OpLabel %20 = OpLabel
%20 = OpAccessChain %_ptr_StorageBuffer_int %result %uint_0 %23 = OpAccessChain %_ptr_StorageBuffer_int %result %uint_0 %uint_0
%22 = OpAccessChain %_ptr_Uniform_int %ubo %uint_0 %25 = OpAccessChain %_ptr_Uniform_int %ubo %uint_0 %uint_0
%23 = OpLoad %int %22 %26 = OpLoad %int %25
%24 = OpAccessChain %_ptr_StorageBuffer_int %ssbo %uint_0 %23 %27 = OpAccessChain %_ptr_StorageBuffer_int %ssbo %uint_0 %uint_0 %26
%25 = OpLoad %int %24 %28 = OpLoad %int %27
OpStore %20 %25 OpStore %23 %28
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -1,19 +1,27 @@
#version 310 es #version 310 es
layout(binding = 0, std140) uniform UBO_ubo { struct UBO {
ivec4 data[4]; ivec4 data[4];
int dynamic_idx; int dynamic_idx;
uint pad; uint pad;
uint pad_1; uint pad_1;
uint pad_2; uint pad_2;
};
layout(binding = 0, std140) uniform ubo_block_ubo {
UBO inner;
} ubo; } ubo;
layout(binding = 2, std430) buffer Result_ssbo { struct Result {
int tint_symbol; int tint_symbol;
};
layout(binding = 2, std430) buffer result_block_ssbo {
Result inner;
} result; } result;
void f() { void f() {
result.tint_symbol = ubo.data[ubo.dynamic_idx].x; result.inner.tint_symbol = ubo.inner.data[ubo.inner.dynamic_idx].x;
} }
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

@ -1,28 +1,34 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 25 ; Bound: 27
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f" OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1 OpExecutionMode %f LocalSize 1 1 1
OpName %ubo_block "ubo_block"
OpMemberName %ubo_block 0 "inner"
OpName %UBO "UBO" OpName %UBO "UBO"
OpMemberName %UBO 0 "data" OpMemberName %UBO 0 "data"
OpMemberName %UBO 1 "dynamic_idx" OpMemberName %UBO 1 "dynamic_idx"
OpName %ubo "ubo" OpName %ubo "ubo"
OpName %result_block "result_block"
OpMemberName %result_block 0 "inner"
OpName %Result "Result" OpName %Result "Result"
OpMemberName %Result 0 "out" OpMemberName %Result 0 "out"
OpName %result "result" OpName %result "result"
OpName %f "f" OpName %f "f"
OpDecorate %UBO Block OpDecorate %ubo_block Block
OpMemberDecorate %ubo_block 0 Offset 0
OpMemberDecorate %UBO 0 Offset 0 OpMemberDecorate %UBO 0 Offset 0
OpDecorate %_arr_v4int_uint_4 ArrayStride 16 OpDecorate %_arr_v4int_uint_4 ArrayStride 16
OpMemberDecorate %UBO 1 Offset 64 OpMemberDecorate %UBO 1 Offset 64
OpDecorate %ubo NonWritable OpDecorate %ubo NonWritable
OpDecorate %ubo DescriptorSet 0 OpDecorate %ubo DescriptorSet 0
OpDecorate %ubo Binding 0 OpDecorate %ubo Binding 0
OpDecorate %Result Block OpDecorate %result_block Block
OpMemberDecorate %result_block 0 Offset 0
OpMemberDecorate %Result 0 Offset 0 OpMemberDecorate %Result 0 Offset 0
OpDecorate %result DescriptorSet 0 OpDecorate %result DescriptorSet 0
OpDecorate %result Binding 2 OpDecorate %result Binding 2
@ -32,24 +38,26 @@
%uint_4 = OpConstant %uint 4 %uint_4 = OpConstant %uint 4
%_arr_v4int_uint_4 = OpTypeArray %v4int %uint_4 %_arr_v4int_uint_4 = OpTypeArray %v4int %uint_4
%UBO = OpTypeStruct %_arr_v4int_uint_4 %int %UBO = OpTypeStruct %_arr_v4int_uint_4 %int
%_ptr_Uniform_UBO = OpTypePointer Uniform %UBO %ubo_block = OpTypeStruct %UBO
%ubo = OpVariable %_ptr_Uniform_UBO Uniform %_ptr_Uniform_ubo_block = OpTypePointer Uniform %ubo_block
%ubo = OpVariable %_ptr_Uniform_ubo_block Uniform
%Result = OpTypeStruct %int %Result = OpTypeStruct %int
%_ptr_StorageBuffer_Result = OpTypePointer StorageBuffer %Result %result_block = OpTypeStruct %Result
%result = OpVariable %_ptr_StorageBuffer_Result StorageBuffer %_ptr_StorageBuffer_result_block = OpTypePointer StorageBuffer %result_block
%result = OpVariable %_ptr_StorageBuffer_result_block StorageBuffer
%void = OpTypeVoid %void = OpTypeVoid
%12 = OpTypeFunction %void %14 = OpTypeFunction %void
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%uint_1 = OpConstant %uint 1 %uint_1 = OpConstant %uint 1
%_ptr_Uniform_int = OpTypePointer Uniform %int %_ptr_Uniform_int = OpTypePointer Uniform %int
%f = OpFunction %void None %12 %f = OpFunction %void None %14
%15 = OpLabel %17 = OpLabel
%18 = OpAccessChain %_ptr_StorageBuffer_int %result %uint_0 %20 = OpAccessChain %_ptr_StorageBuffer_int %result %uint_0 %uint_0
%21 = OpAccessChain %_ptr_Uniform_int %ubo %uint_1 %23 = OpAccessChain %_ptr_Uniform_int %ubo %uint_0 %uint_1
%22 = OpLoad %int %21
%23 = OpAccessChain %_ptr_Uniform_int %ubo %uint_0 %22 %uint_0
%24 = OpLoad %int %23 %24 = OpLoad %int %23
OpStore %18 %24 %25 = OpAccessChain %_ptr_Uniform_int %ubo %uint_0 %uint_0 %24 %uint_0
%26 = OpLoad %int %25
OpStore %20 %26
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -1,18 +1,26 @@
#version 310 es #version 310 es
layout(binding = 0, std140) uniform UBO_ubo { struct UBO {
int dynamic_idx; int dynamic_idx;
uint pad; uint pad;
uint pad_1; uint pad_1;
uint pad_2; uint pad_2;
};
layout(binding = 0, std140) uniform ubo_block_ubo {
UBO inner;
} ubo; } ubo;
struct S { struct S {
int data[64]; int data[64];
}; };
layout(binding = 1, std430) buffer Result_ssbo { struct Result {
int tint_symbol; int tint_symbol;
};
layout(binding = 1, std430) buffer result_block_ssbo {
Result inner;
} result; } result;
shared S s; shared S s;
@ -24,7 +32,7 @@ void f(uint local_invocation_index) {
} }
} }
barrier(); barrier();
result.tint_symbol = s.data[ubo.dynamic_idx]; result.inner.tint_symbol = s.data[ubo.inner.dynamic_idx];
} }
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

@ -1,16 +1,20 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 57 ; Bound: 59
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f" %local_invocation_index_1 OpEntryPoint GLCompute %f "f" %local_invocation_index_1
OpExecutionMode %f LocalSize 1 1 1 OpExecutionMode %f LocalSize 1 1 1
OpName %local_invocation_index_1 "local_invocation_index_1" OpName %local_invocation_index_1 "local_invocation_index_1"
OpName %ubo_block "ubo_block"
OpMemberName %ubo_block 0 "inner"
OpName %UBO "UBO" OpName %UBO "UBO"
OpMemberName %UBO 0 "dynamic_idx" OpMemberName %UBO 0 "dynamic_idx"
OpName %ubo "ubo" OpName %ubo "ubo"
OpName %result_block "result_block"
OpMemberName %result_block 0 "inner"
OpName %Result "Result" OpName %Result "Result"
OpMemberName %Result 0 "out" OpMemberName %Result 0 "out"
OpName %result "result" OpName %result "result"
@ -22,12 +26,14 @@
OpName %idx "idx" OpName %idx "idx"
OpName %f "f" OpName %f "f"
OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex
OpDecorate %UBO Block OpDecorate %ubo_block Block
OpMemberDecorate %ubo_block 0 Offset 0
OpMemberDecorate %UBO 0 Offset 0 OpMemberDecorate %UBO 0 Offset 0
OpDecorate %ubo NonWritable OpDecorate %ubo NonWritable
OpDecorate %ubo DescriptorSet 0 OpDecorate %ubo DescriptorSet 0
OpDecorate %ubo Binding 0 OpDecorate %ubo Binding 0
OpDecorate %Result Block OpDecorate %result_block Block
OpMemberDecorate %result_block 0 Offset 0
OpMemberDecorate %Result 0 Offset 0 OpMemberDecorate %Result 0 Offset 0
OpDecorate %result DescriptorSet 0 OpDecorate %result DescriptorSet 0
OpDecorate %result Binding 1 OpDecorate %result Binding 1
@ -38,70 +44,72 @@
%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input %local_invocation_index_1 = OpVariable %_ptr_Input_uint Input
%int = OpTypeInt 32 1 %int = OpTypeInt 32 1
%UBO = OpTypeStruct %int %UBO = OpTypeStruct %int
%_ptr_Uniform_UBO = OpTypePointer Uniform %UBO %ubo_block = OpTypeStruct %UBO
%ubo = OpVariable %_ptr_Uniform_UBO Uniform %_ptr_Uniform_ubo_block = OpTypePointer Uniform %ubo_block
%ubo = OpVariable %_ptr_Uniform_ubo_block Uniform
%Result = OpTypeStruct %int %Result = OpTypeStruct %int
%_ptr_StorageBuffer_Result = OpTypePointer StorageBuffer %Result %result_block = OpTypeStruct %Result
%result = OpVariable %_ptr_StorageBuffer_Result StorageBuffer %_ptr_StorageBuffer_result_block = OpTypePointer StorageBuffer %result_block
%result = OpVariable %_ptr_StorageBuffer_result_block StorageBuffer
%uint_64 = OpConstant %uint 64 %uint_64 = OpConstant %uint 64
%_arr_int_uint_64 = OpTypeArray %int %uint_64 %_arr_int_uint_64 = OpTypeArray %int %uint_64
%S = OpTypeStruct %_arr_int_uint_64 %S = OpTypeStruct %_arr_int_uint_64
%_ptr_Workgroup_S = OpTypePointer Workgroup %S %_ptr_Workgroup_S = OpTypePointer Workgroup %S
%s = OpVariable %_ptr_Workgroup_S Workgroup %s = OpVariable %_ptr_Workgroup_S Workgroup
%void = OpTypeVoid %void = OpTypeVoid
%16 = OpTypeFunction %void %uint %18 = OpTypeFunction %void %uint
%_ptr_Function_uint = OpTypePointer Function %uint %_ptr_Function_uint = OpTypePointer Function %uint
%23 = OpConstantNull %uint %25 = OpConstantNull %uint
%bool = OpTypeBool %bool = OpTypeBool
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%_ptr_Workgroup_int = OpTypePointer Workgroup %int %_ptr_Workgroup_int = OpTypePointer Workgroup %int
%38 = OpConstantNull %int %40 = OpConstantNull %int
%uint_1 = OpConstant %uint 1 %uint_1 = OpConstant %uint 1
%uint_2 = OpConstant %uint 2 %uint_2 = OpConstant %uint 2
%uint_264 = OpConstant %uint 264 %uint_264 = OpConstant %uint 264
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%_ptr_Uniform_int = OpTypePointer Uniform %int %_ptr_Uniform_int = OpTypePointer Uniform %int
%52 = OpTypeFunction %void %54 = OpTypeFunction %void
%f_inner = OpFunction %void None %16 %f_inner = OpFunction %void None %18
%local_invocation_index = OpFunctionParameter %uint %local_invocation_index = OpFunctionParameter %uint
%20 = OpLabel %22 = OpLabel
%idx = OpVariable %_ptr_Function_uint Function %23 %idx = OpVariable %_ptr_Function_uint Function %25
OpStore %idx %local_invocation_index OpStore %idx %local_invocation_index
OpBranch %24
%24 = OpLabel
OpLoopMerge %25 %26 None
OpBranch %27
%27 = OpLabel
%29 = OpLoad %uint %idx
%30 = OpULessThan %bool %29 %uint_64
%28 = OpLogicalNot %bool %30
OpSelectionMerge %32 None
OpBranchConditional %28 %33 %32
%33 = OpLabel
OpBranch %25
%32 = OpLabel
%34 = OpLoad %uint %idx
%37 = OpAccessChain %_ptr_Workgroup_int %s %uint_0 %34
OpStore %37 %38
OpBranch %26 OpBranch %26
%26 = OpLabel %26 = OpLabel
%39 = OpLoad %uint %idx OpLoopMerge %27 %28 None
%41 = OpIAdd %uint %39 %uint_1 OpBranch %29
OpStore %idx %41 %29 = OpLabel
OpBranch %24 %31 = OpLoad %uint %idx
%25 = OpLabel %32 = OpULessThan %bool %31 %uint_64
%30 = OpLogicalNot %bool %32
OpSelectionMerge %34 None
OpBranchConditional %30 %35 %34
%35 = OpLabel
OpBranch %27
%34 = OpLabel
%36 = OpLoad %uint %idx
%39 = OpAccessChain %_ptr_Workgroup_int %s %uint_0 %36
OpStore %39 %40
OpBranch %28
%28 = OpLabel
%41 = OpLoad %uint %idx
%43 = OpIAdd %uint %41 %uint_1
OpStore %idx %43
OpBranch %26
%27 = OpLabel
OpControlBarrier %uint_2 %uint_2 %uint_264 OpControlBarrier %uint_2 %uint_2 %uint_264
%46 = OpAccessChain %_ptr_StorageBuffer_int %result %uint_0 %48 = OpAccessChain %_ptr_StorageBuffer_int %result %uint_0 %uint_0
%48 = OpAccessChain %_ptr_Uniform_int %ubo %uint_0 %50 = OpAccessChain %_ptr_Uniform_int %ubo %uint_0 %uint_0
%49 = OpLoad %int %48
%50 = OpAccessChain %_ptr_Workgroup_int %s %uint_0 %49
%51 = OpLoad %int %50 %51 = OpLoad %int %50
OpStore %46 %51 %52 = OpAccessChain %_ptr_Workgroup_int %s %uint_0 %51
%53 = OpLoad %int %52
OpStore %48 %53
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%f = OpFunction %void None %52 %f = OpFunction %void None %54
%54 = OpLabel %56 = OpLabel
%56 = OpLoad %uint %local_invocation_index_1 %58 = OpLoad %uint %local_invocation_index_1
%55 = OpFunctionCall %void %f_inner %56 %57 = OpFunctionCall %void %f_inner %58
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -1,24 +1,32 @@
#version 310 es #version 310 es
layout(binding = 0, std140) uniform UBO_ubo { struct UBO {
int dynamic_idx; int dynamic_idx;
uint pad; uint pad;
uint pad_1; uint pad_1;
uint pad_2; uint pad_2;
};
layout(binding = 0, std140) uniform ubo_block_ubo {
UBO inner;
} ubo; } ubo;
struct S { struct S {
int data[64]; int data[64];
}; };
layout(binding = 1, std430) buffer Result_ssbo { struct Result {
int tint_symbol; int tint_symbol;
};
layout(binding = 1, std430) buffer result_block_ssbo {
Result inner;
} result; } result;
void f() { void f() {
S s = S(int[64](0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)); S s = S(int[64](0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
s.data[ubo.dynamic_idx] = 1; s.data[ubo.inner.dynamic_idx] = 1;
result.tint_symbol = s.data[3]; result.inner.tint_symbol = s.data[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

@ -1,15 +1,19 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 31 ; Bound: 33
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f" OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1 OpExecutionMode %f LocalSize 1 1 1
OpName %ubo_block "ubo_block"
OpMemberName %ubo_block 0 "inner"
OpName %UBO "UBO" OpName %UBO "UBO"
OpMemberName %UBO 0 "dynamic_idx" OpMemberName %UBO 0 "dynamic_idx"
OpName %ubo "ubo" OpName %ubo "ubo"
OpName %result_block "result_block"
OpMemberName %result_block 0 "inner"
OpName %Result "Result" OpName %Result "Result"
OpMemberName %Result 0 "out" OpMemberName %Result 0 "out"
OpName %result "result" OpName %result "result"
@ -17,12 +21,14 @@
OpName %S "S" OpName %S "S"
OpMemberName %S 0 "data" OpMemberName %S 0 "data"
OpName %s "s" OpName %s "s"
OpDecorate %UBO Block OpDecorate %ubo_block Block
OpMemberDecorate %ubo_block 0 Offset 0
OpMemberDecorate %UBO 0 Offset 0 OpMemberDecorate %UBO 0 Offset 0
OpDecorate %ubo NonWritable OpDecorate %ubo NonWritable
OpDecorate %ubo DescriptorSet 0 OpDecorate %ubo DescriptorSet 0
OpDecorate %ubo Binding 0 OpDecorate %ubo Binding 0
OpDecorate %Result Block OpDecorate %result_block Block
OpMemberDecorate %result_block 0 Offset 0
OpMemberDecorate %Result 0 Offset 0 OpMemberDecorate %Result 0 Offset 0
OpDecorate %result DescriptorSet 0 OpDecorate %result DescriptorSet 0
OpDecorate %result Binding 1 OpDecorate %result Binding 1
@ -30,35 +36,37 @@
OpDecorate %_arr_int_uint_64 ArrayStride 4 OpDecorate %_arr_int_uint_64 ArrayStride 4
%int = OpTypeInt 32 1 %int = OpTypeInt 32 1
%UBO = OpTypeStruct %int %UBO = OpTypeStruct %int
%_ptr_Uniform_UBO = OpTypePointer Uniform %UBO %ubo_block = OpTypeStruct %UBO
%ubo = OpVariable %_ptr_Uniform_UBO Uniform %_ptr_Uniform_ubo_block = OpTypePointer Uniform %ubo_block
%ubo = OpVariable %_ptr_Uniform_ubo_block Uniform
%Result = OpTypeStruct %int %Result = OpTypeStruct %int
%_ptr_StorageBuffer_Result = OpTypePointer StorageBuffer %Result %result_block = OpTypeStruct %Result
%result = OpVariable %_ptr_StorageBuffer_Result StorageBuffer %_ptr_StorageBuffer_result_block = OpTypePointer StorageBuffer %result_block
%result = OpVariable %_ptr_StorageBuffer_result_block StorageBuffer
%void = OpTypeVoid %void = OpTypeVoid
%8 = OpTypeFunction %void %10 = OpTypeFunction %void
%uint = OpTypeInt 32 0 %uint = OpTypeInt 32 0
%uint_64 = OpConstant %uint 64 %uint_64 = OpConstant %uint 64
%_arr_int_uint_64 = OpTypeArray %int %uint_64 %_arr_int_uint_64 = OpTypeArray %int %uint_64
%S = OpTypeStruct %_arr_int_uint_64 %S = OpTypeStruct %_arr_int_uint_64
%_ptr_Function_S = OpTypePointer Function %S %_ptr_Function_S = OpTypePointer Function %S
%18 = OpConstantNull %S %20 = OpConstantNull %S
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%_ptr_Uniform_int = OpTypePointer Uniform %int %_ptr_Uniform_int = OpTypePointer Uniform %int
%_ptr_Function_int = OpTypePointer Function %int %_ptr_Function_int = OpTypePointer Function %int
%int_1 = OpConstant %int 1 %int_1 = OpConstant %int 1
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%int_3 = OpConstant %int 3 %int_3 = OpConstant %int 3
%f = OpFunction %void None %8 %f = OpFunction %void None %10
%11 = OpLabel %13 = OpLabel
%s = OpVariable %_ptr_Function_S Function %18 %s = OpVariable %_ptr_Function_S Function %20
%21 = OpAccessChain %_ptr_Uniform_int %ubo %uint_0 %23 = OpAccessChain %_ptr_Uniform_int %ubo %uint_0 %uint_0
%22 = OpLoad %int %21 %24 = OpLoad %int %23
%24 = OpAccessChain %_ptr_Function_int %s %uint_0 %22 %26 = OpAccessChain %_ptr_Function_int %s %uint_0 %24
OpStore %24 %int_1 OpStore %26 %int_1
%27 = OpAccessChain %_ptr_StorageBuffer_int %result %uint_0 %29 = OpAccessChain %_ptr_StorageBuffer_int %result %uint_0 %uint_0
%29 = OpAccessChain %_ptr_Function_int %s %uint_0 %int_3 %31 = OpAccessChain %_ptr_Function_int %s %uint_0 %int_3
%30 = OpLoad %int %29 %32 = OpLoad %int %31
OpStore %27 %30 OpStore %29 %32
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -1,28 +1,36 @@
#version 310 es #version 310 es
layout(binding = 0, std140) uniform UBO_ubo { struct UBO {
int dynamic_idx; int dynamic_idx;
uint pad; uint pad;
uint pad_1; uint pad_1;
uint pad_2; uint pad_2;
};
layout(binding = 0, std140) uniform ubo_block_ubo {
UBO inner;
} ubo; } ubo;
struct S { struct S {
int data[64]; int data[64];
}; };
layout(binding = 1, std430) buffer Result_ssbo { struct Result {
int tint_symbol; int tint_symbol;
};
layout(binding = 1, std430) buffer result_block_ssbo {
Result inner;
} result; } result;
void x(inout S p) { void x(inout S p) {
p.data[ubo.dynamic_idx] = 1; p.data[ubo.inner.dynamic_idx] = 1;
} }
void f() { void f() {
S s = S(int[64](0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)); S s = S(int[64](0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
x(s); x(s);
result.tint_symbol = s.data[3]; result.inner.tint_symbol = s.data[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

@ -1,15 +1,19 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 38 ; Bound: 40
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f" OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1 OpExecutionMode %f LocalSize 1 1 1
OpName %ubo_block "ubo_block"
OpMemberName %ubo_block 0 "inner"
OpName %UBO "UBO" OpName %UBO "UBO"
OpMemberName %UBO 0 "dynamic_idx" OpMemberName %UBO 0 "dynamic_idx"
OpName %ubo "ubo" OpName %ubo "ubo"
OpName %result_block "result_block"
OpMemberName %result_block 0 "inner"
OpName %Result "Result" OpName %Result "Result"
OpMemberName %Result 0 "out" OpMemberName %Result 0 "out"
OpName %result "result" OpName %result "result"
@ -19,12 +23,14 @@
OpName %p "p" OpName %p "p"
OpName %f "f" OpName %f "f"
OpName %s "s" OpName %s "s"
OpDecorate %UBO Block OpDecorate %ubo_block Block
OpMemberDecorate %ubo_block 0 Offset 0
OpMemberDecorate %UBO 0 Offset 0 OpMemberDecorate %UBO 0 Offset 0
OpDecorate %ubo NonWritable OpDecorate %ubo NonWritable
OpDecorate %ubo DescriptorSet 0 OpDecorate %ubo DescriptorSet 0
OpDecorate %ubo Binding 0 OpDecorate %ubo Binding 0
OpDecorate %Result Block OpDecorate %result_block Block
OpMemberDecorate %result_block 0 Offset 0
OpMemberDecorate %Result 0 Offset 0 OpMemberDecorate %Result 0 Offset 0
OpDecorate %result DescriptorSet 0 OpDecorate %result DescriptorSet 0
OpDecorate %result Binding 1 OpDecorate %result Binding 1
@ -32,42 +38,44 @@
OpDecorate %_arr_int_uint_64 ArrayStride 4 OpDecorate %_arr_int_uint_64 ArrayStride 4
%int = OpTypeInt 32 1 %int = OpTypeInt 32 1
%UBO = OpTypeStruct %int %UBO = OpTypeStruct %int
%_ptr_Uniform_UBO = OpTypePointer Uniform %UBO %ubo_block = OpTypeStruct %UBO
%ubo = OpVariable %_ptr_Uniform_UBO Uniform %_ptr_Uniform_ubo_block = OpTypePointer Uniform %ubo_block
%ubo = OpVariable %_ptr_Uniform_ubo_block Uniform
%Result = OpTypeStruct %int %Result = OpTypeStruct %int
%_ptr_StorageBuffer_Result = OpTypePointer StorageBuffer %Result %result_block = OpTypeStruct %Result
%result = OpVariable %_ptr_StorageBuffer_Result StorageBuffer %_ptr_StorageBuffer_result_block = OpTypePointer StorageBuffer %result_block
%result = OpVariable %_ptr_StorageBuffer_result_block StorageBuffer
%void = OpTypeVoid %void = OpTypeVoid
%uint = OpTypeInt 32 0 %uint = OpTypeInt 32 0
%uint_64 = OpConstant %uint 64 %uint_64 = OpConstant %uint 64
%_arr_int_uint_64 = OpTypeArray %int %uint_64 %_arr_int_uint_64 = OpTypeArray %int %uint_64
%S = OpTypeStruct %_arr_int_uint_64 %S = OpTypeStruct %_arr_int_uint_64
%_ptr_Function_S = OpTypePointer Function %S %_ptr_Function_S = OpTypePointer Function %S
%8 = OpTypeFunction %void %_ptr_Function_S %10 = OpTypeFunction %void %_ptr_Function_S
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%_ptr_Uniform_int = OpTypePointer Uniform %int %_ptr_Uniform_int = OpTypePointer Uniform %int
%_ptr_Function_int = OpTypePointer Function %int %_ptr_Function_int = OpTypePointer Function %int
%int_1 = OpConstant %int 1 %int_1 = OpConstant %int 1
%26 = OpTypeFunction %void %28 = OpTypeFunction %void
%30 = OpConstantNull %S %32 = OpConstantNull %S
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%int_3 = OpConstant %int 3 %int_3 = OpConstant %int 3
%x = OpFunction %void None %8 %x = OpFunction %void None %10
%p = OpFunctionParameter %_ptr_Function_S %p = OpFunctionParameter %_ptr_Function_S
%17 = OpLabel %19 = OpLabel
%21 = OpAccessChain %_ptr_Uniform_int %ubo %uint_0 %23 = OpAccessChain %_ptr_Uniform_int %ubo %uint_0 %uint_0
%22 = OpLoad %int %21 %24 = OpLoad %int %23
%24 = OpAccessChain %_ptr_Function_int %p %uint_0 %22 %26 = OpAccessChain %_ptr_Function_int %p %uint_0 %24
OpStore %24 %int_1 OpStore %26 %int_1
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%f = OpFunction %void None %26 %f = OpFunction %void None %28
%28 = OpLabel %30 = OpLabel
%s = OpVariable %_ptr_Function_S Function %30 %s = OpVariable %_ptr_Function_S Function %32
%31 = OpFunctionCall %void %x %s %33 = OpFunctionCall %void %x %s
%34 = OpAccessChain %_ptr_StorageBuffer_int %result %uint_0 %36 = OpAccessChain %_ptr_StorageBuffer_int %result %uint_0 %uint_0
%36 = OpAccessChain %_ptr_Function_int %s %uint_0 %int_3 %38 = OpAccessChain %_ptr_Function_int %s %uint_0 %int_3
%37 = OpLoad %int %36 %39 = OpLoad %int %38
OpStore %34 %37 OpStore %36 %39
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -1,24 +1,32 @@
#version 310 es #version 310 es
layout(binding = 0, std140) uniform UBO_ubo { struct UBO {
int dynamic_idx; int dynamic_idx;
uint pad; uint pad;
uint pad_1; uint pad_1;
uint pad_2; uint pad_2;
};
layout(binding = 0, std140) uniform ubo_block_ubo {
UBO inner;
} ubo; } ubo;
struct S { struct S {
int data[64]; int data[64];
}; };
layout(binding = 1, std430) buffer Result_ssbo { struct Result {
int tint_symbol; int tint_symbol;
};
layout(binding = 1, std430) buffer result_block_ssbo {
Result inner;
} result; } result;
S s = S(int[64](0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)); S s = S(int[64](0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
void f() { void f() {
s.data[ubo.dynamic_idx] = 1; s.data[ubo.inner.dynamic_idx] = 1;
result.tint_symbol = s.data[3]; result.inner.tint_symbol = s.data[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

@ -1,15 +1,19 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 31 ; Bound: 33
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f" OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1 OpExecutionMode %f LocalSize 1 1 1
OpName %ubo_block "ubo_block"
OpMemberName %ubo_block 0 "inner"
OpName %UBO "UBO" OpName %UBO "UBO"
OpMemberName %UBO 0 "dynamic_idx" OpMemberName %UBO 0 "dynamic_idx"
OpName %ubo "ubo" OpName %ubo "ubo"
OpName %result_block "result_block"
OpMemberName %result_block 0 "inner"
OpName %Result "Result" OpName %Result "Result"
OpMemberName %Result 0 "out" OpMemberName %Result 0 "out"
OpName %result "result" OpName %result "result"
@ -17,12 +21,14 @@
OpMemberName %S 0 "data" OpMemberName %S 0 "data"
OpName %s "s" OpName %s "s"
OpName %f "f" OpName %f "f"
OpDecorate %UBO Block OpDecorate %ubo_block Block
OpMemberDecorate %ubo_block 0 Offset 0
OpMemberDecorate %UBO 0 Offset 0 OpMemberDecorate %UBO 0 Offset 0
OpDecorate %ubo NonWritable OpDecorate %ubo NonWritable
OpDecorate %ubo DescriptorSet 0 OpDecorate %ubo DescriptorSet 0
OpDecorate %ubo Binding 0 OpDecorate %ubo Binding 0
OpDecorate %Result Block OpDecorate %result_block Block
OpMemberDecorate %result_block 0 Offset 0
OpMemberDecorate %Result 0 Offset 0 OpMemberDecorate %Result 0 Offset 0
OpDecorate %result DescriptorSet 0 OpDecorate %result DescriptorSet 0
OpDecorate %result Binding 1 OpDecorate %result Binding 1
@ -30,35 +36,37 @@
OpDecorate %_arr_int_uint_64 ArrayStride 4 OpDecorate %_arr_int_uint_64 ArrayStride 4
%int = OpTypeInt 32 1 %int = OpTypeInt 32 1
%UBO = OpTypeStruct %int %UBO = OpTypeStruct %int
%_ptr_Uniform_UBO = OpTypePointer Uniform %UBO %ubo_block = OpTypeStruct %UBO
%ubo = OpVariable %_ptr_Uniform_UBO Uniform %_ptr_Uniform_ubo_block = OpTypePointer Uniform %ubo_block
%ubo = OpVariable %_ptr_Uniform_ubo_block Uniform
%Result = OpTypeStruct %int %Result = OpTypeStruct %int
%_ptr_StorageBuffer_Result = OpTypePointer StorageBuffer %Result %result_block = OpTypeStruct %Result
%result = OpVariable %_ptr_StorageBuffer_Result StorageBuffer %_ptr_StorageBuffer_result_block = OpTypePointer StorageBuffer %result_block
%result = OpVariable %_ptr_StorageBuffer_result_block StorageBuffer
%uint = OpTypeInt 32 0 %uint = OpTypeInt 32 0
%uint_64 = OpConstant %uint 64 %uint_64 = OpConstant %uint 64
%_arr_int_uint_64 = OpTypeArray %int %uint_64 %_arr_int_uint_64 = OpTypeArray %int %uint_64
%S = OpTypeStruct %_arr_int_uint_64 %S = OpTypeStruct %_arr_int_uint_64
%_ptr_Private_S = OpTypePointer Private %S %_ptr_Private_S = OpTypePointer Private %S
%14 = OpConstantNull %S %16 = OpConstantNull %S
%s = OpVariable %_ptr_Private_S Private %14 %s = OpVariable %_ptr_Private_S Private %16
%void = OpTypeVoid %void = OpTypeVoid
%15 = OpTypeFunction %void %17 = OpTypeFunction %void
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%_ptr_Uniform_int = OpTypePointer Uniform %int %_ptr_Uniform_int = OpTypePointer Uniform %int
%_ptr_Private_int = OpTypePointer Private %int %_ptr_Private_int = OpTypePointer Private %int
%int_1 = OpConstant %int 1 %int_1 = OpConstant %int 1
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%int_3 = OpConstant %int 3 %int_3 = OpConstant %int 3
%f = OpFunction %void None %15 %f = OpFunction %void None %17
%18 = OpLabel %20 = OpLabel
%21 = OpAccessChain %_ptr_Uniform_int %ubo %uint_0 %23 = OpAccessChain %_ptr_Uniform_int %ubo %uint_0 %uint_0
%22 = OpLoad %int %21 %24 = OpLoad %int %23
%24 = OpAccessChain %_ptr_Private_int %s %uint_0 %22 %26 = OpAccessChain %_ptr_Private_int %s %uint_0 %24
OpStore %24 %int_1 OpStore %26 %int_1
%27 = OpAccessChain %_ptr_StorageBuffer_int %result %uint_0 %29 = OpAccessChain %_ptr_StorageBuffer_int %result %uint_0 %uint_0
%29 = OpAccessChain %_ptr_Private_int %s %uint_0 %int_3 %31 = OpAccessChain %_ptr_Private_int %s %uint_0 %int_3
%30 = OpLoad %int %29 %32 = OpLoad %int %31
OpStore %27 %30 OpStore %29 %32
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -1,28 +1,36 @@
#version 310 es #version 310 es
layout(binding = 0, std140) uniform UBO_ubo { struct UBO {
int dynamic_idx; int dynamic_idx;
uint pad; uint pad;
uint pad_1; uint pad_1;
uint pad_2; uint pad_2;
};
layout(binding = 0, std140) uniform ubo_block_ubo {
UBO inner;
} ubo; } ubo;
struct S { struct S {
int data[64]; int data[64];
}; };
layout(binding = 1, std430) buffer Result_ssbo { struct Result {
int tint_symbol; int tint_symbol;
};
layout(binding = 1, std430) buffer result_block_ssbo {
Result inner;
} result; } result;
S s = S(int[64](0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)); S s = S(int[64](0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
void x(inout S p) { void x(inout S p) {
p.data[ubo.dynamic_idx] = 1; p.data[ubo.inner.dynamic_idx] = 1;
} }
void f() { void f() {
x(s); x(s);
result.tint_symbol = s.data[3]; result.inner.tint_symbol = s.data[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

@ -1,15 +1,19 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 38 ; Bound: 40
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f" OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1 OpExecutionMode %f LocalSize 1 1 1
OpName %ubo_block "ubo_block"
OpMemberName %ubo_block 0 "inner"
OpName %UBO "UBO" OpName %UBO "UBO"
OpMemberName %UBO 0 "dynamic_idx" OpMemberName %UBO 0 "dynamic_idx"
OpName %ubo "ubo" OpName %ubo "ubo"
OpName %result_block "result_block"
OpMemberName %result_block 0 "inner"
OpName %Result "Result" OpName %Result "Result"
OpMemberName %Result 0 "out" OpMemberName %Result 0 "out"
OpName %result "result" OpName %result "result"
@ -19,12 +23,14 @@
OpName %x "x" OpName %x "x"
OpName %p "p" OpName %p "p"
OpName %f "f" OpName %f "f"
OpDecorate %UBO Block OpDecorate %ubo_block Block
OpMemberDecorate %ubo_block 0 Offset 0
OpMemberDecorate %UBO 0 Offset 0 OpMemberDecorate %UBO 0 Offset 0
OpDecorate %ubo NonWritable OpDecorate %ubo NonWritable
OpDecorate %ubo DescriptorSet 0 OpDecorate %ubo DescriptorSet 0
OpDecorate %ubo Binding 0 OpDecorate %ubo Binding 0
OpDecorate %Result Block OpDecorate %result_block Block
OpMemberDecorate %result_block 0 Offset 0
OpMemberDecorate %Result 0 Offset 0 OpMemberDecorate %Result 0 Offset 0
OpDecorate %result DescriptorSet 0 OpDecorate %result DescriptorSet 0
OpDecorate %result Binding 1 OpDecorate %result Binding 1
@ -32,42 +38,44 @@
OpDecorate %_arr_int_uint_64 ArrayStride 4 OpDecorate %_arr_int_uint_64 ArrayStride 4
%int = OpTypeInt 32 1 %int = OpTypeInt 32 1
%UBO = OpTypeStruct %int %UBO = OpTypeStruct %int
%_ptr_Uniform_UBO = OpTypePointer Uniform %UBO %ubo_block = OpTypeStruct %UBO
%ubo = OpVariable %_ptr_Uniform_UBO Uniform %_ptr_Uniform_ubo_block = OpTypePointer Uniform %ubo_block
%ubo = OpVariable %_ptr_Uniform_ubo_block Uniform
%Result = OpTypeStruct %int %Result = OpTypeStruct %int
%_ptr_StorageBuffer_Result = OpTypePointer StorageBuffer %Result %result_block = OpTypeStruct %Result
%result = OpVariable %_ptr_StorageBuffer_Result StorageBuffer %_ptr_StorageBuffer_result_block = OpTypePointer StorageBuffer %result_block
%result = OpVariable %_ptr_StorageBuffer_result_block StorageBuffer
%uint = OpTypeInt 32 0 %uint = OpTypeInt 32 0
%uint_64 = OpConstant %uint 64 %uint_64 = OpConstant %uint 64
%_arr_int_uint_64 = OpTypeArray %int %uint_64 %_arr_int_uint_64 = OpTypeArray %int %uint_64
%S = OpTypeStruct %_arr_int_uint_64 %S = OpTypeStruct %_arr_int_uint_64
%_ptr_Private_S = OpTypePointer Private %S %_ptr_Private_S = OpTypePointer Private %S
%14 = OpConstantNull %S %16 = OpConstantNull %S
%s = OpVariable %_ptr_Private_S Private %14 %s = OpVariable %_ptr_Private_S Private %16
%void = OpTypeVoid %void = OpTypeVoid
%15 = OpTypeFunction %void %_ptr_Private_S %17 = OpTypeFunction %void %_ptr_Private_S
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%_ptr_Uniform_int = OpTypePointer Uniform %int %_ptr_Uniform_int = OpTypePointer Uniform %int
%_ptr_Private_int = OpTypePointer Private %int %_ptr_Private_int = OpTypePointer Private %int
%int_1 = OpConstant %int 1 %int_1 = OpConstant %int 1
%28 = OpTypeFunction %void %30 = OpTypeFunction %void
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%int_3 = OpConstant %int 3 %int_3 = OpConstant %int 3
%x = OpFunction %void None %15 %x = OpFunction %void None %17
%p = OpFunctionParameter %_ptr_Private_S %p = OpFunctionParameter %_ptr_Private_S
%19 = OpLabel %21 = OpLabel
%23 = OpAccessChain %_ptr_Uniform_int %ubo %uint_0 %25 = OpAccessChain %_ptr_Uniform_int %ubo %uint_0 %uint_0
%24 = OpLoad %int %23 %26 = OpLoad %int %25
%26 = OpAccessChain %_ptr_Private_int %p %uint_0 %24 %28 = OpAccessChain %_ptr_Private_int %p %uint_0 %26
OpStore %26 %int_1 OpStore %28 %int_1
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%f = OpFunction %void None %28 %f = OpFunction %void None %30
%30 = OpLabel %32 = OpLabel
%31 = OpFunctionCall %void %x %s %33 = OpFunctionCall %void %x %s
%34 = OpAccessChain %_ptr_StorageBuffer_int %result %uint_0 %36 = OpAccessChain %_ptr_StorageBuffer_int %result %uint_0 %uint_0
%36 = OpAccessChain %_ptr_Private_int %s %uint_0 %int_3 %38 = OpAccessChain %_ptr_Private_int %s %uint_0 %int_3
%37 = OpLoad %int %36 %39 = OpLoad %int %38
OpStore %34 %37 OpStore %36 %39
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -1,23 +1,35 @@
#version 310 es #version 310 es
layout(binding = 0, std140) uniform UBO_ubo { struct UBO {
int dynamic_idx; int dynamic_idx;
uint pad; uint pad;
uint pad_1; uint pad_1;
uint pad_2; uint pad_2;
};
layout(binding = 0, std140) uniform ubo_block_ubo {
UBO inner;
} ubo; } ubo;
layout(binding = 2, std430) buffer Result_ssbo { struct Result {
int tint_symbol; int tint_symbol;
};
layout(binding = 2, std430) buffer result_block_ssbo {
Result inner;
} result; } result;
layout(binding = 1, std430) buffer SSBO_ssbo { struct SSBO {
int data[4]; int data[4];
};
layout(binding = 1, std430) buffer ssbo_block_ssbo {
SSBO inner;
} ssbo; } ssbo;
void f() { void f() {
ssbo.data[ubo.dynamic_idx] = 1; ssbo.inner.data[ubo.inner.dynamic_idx] = 1;
result.tint_symbol = ssbo.data[3]; result.inner.tint_symbol = ssbo.inner.data[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

@ -1,65 +1,77 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 29 ; Bound: 32
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f" OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1 OpExecutionMode %f LocalSize 1 1 1
OpName %ubo_block "ubo_block"
OpMemberName %ubo_block 0 "inner"
OpName %UBO "UBO" OpName %UBO "UBO"
OpMemberName %UBO 0 "dynamic_idx" OpMemberName %UBO 0 "dynamic_idx"
OpName %ubo "ubo" OpName %ubo "ubo"
OpName %result_block "result_block"
OpMemberName %result_block 0 "inner"
OpName %Result "Result" OpName %Result "Result"
OpMemberName %Result 0 "out" OpMemberName %Result 0 "out"
OpName %result "result" OpName %result "result"
OpName %ssbo_block "ssbo_block"
OpMemberName %ssbo_block 0 "inner"
OpName %SSBO "SSBO" OpName %SSBO "SSBO"
OpMemberName %SSBO 0 "data" OpMemberName %SSBO 0 "data"
OpName %ssbo "ssbo" OpName %ssbo "ssbo"
OpName %f "f" OpName %f "f"
OpDecorate %UBO Block OpDecorate %ubo_block Block
OpMemberDecorate %ubo_block 0 Offset 0
OpMemberDecorate %UBO 0 Offset 0 OpMemberDecorate %UBO 0 Offset 0
OpDecorate %ubo NonWritable OpDecorate %ubo NonWritable
OpDecorate %ubo DescriptorSet 0 OpDecorate %ubo DescriptorSet 0
OpDecorate %ubo Binding 0 OpDecorate %ubo Binding 0
OpDecorate %Result Block OpDecorate %result_block Block
OpMemberDecorate %result_block 0 Offset 0
OpMemberDecorate %Result 0 Offset 0 OpMemberDecorate %Result 0 Offset 0
OpDecorate %result DescriptorSet 0 OpDecorate %result DescriptorSet 0
OpDecorate %result Binding 2 OpDecorate %result Binding 2
OpDecorate %SSBO Block OpDecorate %ssbo_block Block
OpMemberDecorate %ssbo_block 0 Offset 0
OpMemberDecorate %SSBO 0 Offset 0 OpMemberDecorate %SSBO 0 Offset 0
OpDecorate %_arr_int_uint_4 ArrayStride 4 OpDecorate %_arr_int_uint_4 ArrayStride 4
OpDecorate %ssbo DescriptorSet 0 OpDecorate %ssbo DescriptorSet 0
OpDecorate %ssbo Binding 1 OpDecorate %ssbo Binding 1
%int = OpTypeInt 32 1 %int = OpTypeInt 32 1
%UBO = OpTypeStruct %int %UBO = OpTypeStruct %int
%_ptr_Uniform_UBO = OpTypePointer Uniform %UBO %ubo_block = OpTypeStruct %UBO
%ubo = OpVariable %_ptr_Uniform_UBO Uniform %_ptr_Uniform_ubo_block = OpTypePointer Uniform %ubo_block
%ubo = OpVariable %_ptr_Uniform_ubo_block Uniform
%Result = OpTypeStruct %int %Result = OpTypeStruct %int
%_ptr_StorageBuffer_Result = OpTypePointer StorageBuffer %Result %result_block = OpTypeStruct %Result
%result = OpVariable %_ptr_StorageBuffer_Result StorageBuffer %_ptr_StorageBuffer_result_block = OpTypePointer StorageBuffer %result_block
%result = OpVariable %_ptr_StorageBuffer_result_block StorageBuffer
%uint = OpTypeInt 32 0 %uint = OpTypeInt 32 0
%uint_4 = OpConstant %uint 4 %uint_4 = OpConstant %uint 4
%_arr_int_uint_4 = OpTypeArray %int %uint_4 %_arr_int_uint_4 = OpTypeArray %int %uint_4
%SSBO = OpTypeStruct %_arr_int_uint_4 %SSBO = OpTypeStruct %_arr_int_uint_4
%_ptr_StorageBuffer_SSBO = OpTypePointer StorageBuffer %SSBO %ssbo_block = OpTypeStruct %SSBO
%ssbo = OpVariable %_ptr_StorageBuffer_SSBO StorageBuffer %_ptr_StorageBuffer_ssbo_block = OpTypePointer StorageBuffer %ssbo_block
%ssbo = OpVariable %_ptr_StorageBuffer_ssbo_block StorageBuffer
%void = OpTypeVoid %void = OpTypeVoid
%14 = OpTypeFunction %void %17 = OpTypeFunction %void
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%_ptr_Uniform_int = OpTypePointer Uniform %int %_ptr_Uniform_int = OpTypePointer Uniform %int
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%int_1 = OpConstant %int 1 %int_1 = OpConstant %int 1
%int_3 = OpConstant %int 3 %int_3 = OpConstant %int 3
%f = OpFunction %void None %14 %f = OpFunction %void None %17
%17 = OpLabel %20 = OpLabel
%20 = OpAccessChain %_ptr_Uniform_int %ubo %uint_0 %23 = OpAccessChain %_ptr_Uniform_int %ubo %uint_0 %uint_0
%21 = OpLoad %int %20 %24 = OpLoad %int %23
%23 = OpAccessChain %_ptr_StorageBuffer_int %ssbo %uint_0 %21 %26 = OpAccessChain %_ptr_StorageBuffer_int %ssbo %uint_0 %uint_0 %24
OpStore %23 %int_1 OpStore %26 %int_1
%25 = OpAccessChain %_ptr_StorageBuffer_int %result %uint_0 %28 = OpAccessChain %_ptr_StorageBuffer_int %result %uint_0 %uint_0
%27 = OpAccessChain %_ptr_StorageBuffer_int %ssbo %uint_0 %int_3 %30 = OpAccessChain %_ptr_StorageBuffer_int %ssbo %uint_0 %uint_0 %int_3
%28 = OpLoad %int %27 %31 = OpLoad %int %30
OpStore %25 %28 OpStore %28 %31
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -1,18 +1,26 @@
#version 310 es #version 310 es
layout(binding = 0, std140) uniform UBO_ubo { struct UBO {
int dynamic_idx; int dynamic_idx;
uint pad; uint pad;
uint pad_1; uint pad_1;
uint pad_2; uint pad_2;
};
layout(binding = 0, std140) uniform ubo_block_ubo {
UBO inner;
} ubo; } ubo;
struct S { struct S {
int data[64]; int data[64];
}; };
layout(binding = 1, std430) buffer Result_ssbo { struct Result {
int tint_symbol; int tint_symbol;
};
layout(binding = 1, std430) buffer result_block_ssbo {
Result inner;
} result; } result;
shared S s; shared S s;
@ -24,8 +32,8 @@ void f(uint local_invocation_index) {
} }
} }
barrier(); barrier();
s.data[ubo.dynamic_idx] = 1; s.data[ubo.inner.dynamic_idx] = 1;
result.tint_symbol = s.data[3]; result.inner.tint_symbol = s.data[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

@ -1,16 +1,20 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 60 ; Bound: 62
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f" %local_invocation_index_1 OpEntryPoint GLCompute %f "f" %local_invocation_index_1
OpExecutionMode %f LocalSize 1 1 1 OpExecutionMode %f LocalSize 1 1 1
OpName %local_invocation_index_1 "local_invocation_index_1" OpName %local_invocation_index_1 "local_invocation_index_1"
OpName %ubo_block "ubo_block"
OpMemberName %ubo_block 0 "inner"
OpName %UBO "UBO" OpName %UBO "UBO"
OpMemberName %UBO 0 "dynamic_idx" OpMemberName %UBO 0 "dynamic_idx"
OpName %ubo "ubo" OpName %ubo "ubo"
OpName %result_block "result_block"
OpMemberName %result_block 0 "inner"
OpName %Result "Result" OpName %Result "Result"
OpMemberName %Result 0 "out" OpMemberName %Result 0 "out"
OpName %result "result" OpName %result "result"
@ -22,12 +26,14 @@
OpName %idx "idx" OpName %idx "idx"
OpName %f "f" OpName %f "f"
OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex
OpDecorate %UBO Block OpDecorate %ubo_block Block
OpMemberDecorate %ubo_block 0 Offset 0
OpMemberDecorate %UBO 0 Offset 0 OpMemberDecorate %UBO 0 Offset 0
OpDecorate %ubo NonWritable OpDecorate %ubo NonWritable
OpDecorate %ubo DescriptorSet 0 OpDecorate %ubo DescriptorSet 0
OpDecorate %ubo Binding 0 OpDecorate %ubo Binding 0
OpDecorate %Result Block OpDecorate %result_block Block
OpMemberDecorate %result_block 0 Offset 0
OpMemberDecorate %Result 0 Offset 0 OpMemberDecorate %Result 0 Offset 0
OpDecorate %result DescriptorSet 0 OpDecorate %result DescriptorSet 0
OpDecorate %result Binding 1 OpDecorate %result Binding 1
@ -38,24 +44,26 @@
%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input %local_invocation_index_1 = OpVariable %_ptr_Input_uint Input
%int = OpTypeInt 32 1 %int = OpTypeInt 32 1
%UBO = OpTypeStruct %int %UBO = OpTypeStruct %int
%_ptr_Uniform_UBO = OpTypePointer Uniform %UBO %ubo_block = OpTypeStruct %UBO
%ubo = OpVariable %_ptr_Uniform_UBO Uniform %_ptr_Uniform_ubo_block = OpTypePointer Uniform %ubo_block
%ubo = OpVariable %_ptr_Uniform_ubo_block Uniform
%Result = OpTypeStruct %int %Result = OpTypeStruct %int
%_ptr_StorageBuffer_Result = OpTypePointer StorageBuffer %Result %result_block = OpTypeStruct %Result
%result = OpVariable %_ptr_StorageBuffer_Result StorageBuffer %_ptr_StorageBuffer_result_block = OpTypePointer StorageBuffer %result_block
%result = OpVariable %_ptr_StorageBuffer_result_block StorageBuffer
%uint_64 = OpConstant %uint 64 %uint_64 = OpConstant %uint 64
%_arr_int_uint_64 = OpTypeArray %int %uint_64 %_arr_int_uint_64 = OpTypeArray %int %uint_64
%S = OpTypeStruct %_arr_int_uint_64 %S = OpTypeStruct %_arr_int_uint_64
%_ptr_Workgroup_S = OpTypePointer Workgroup %S %_ptr_Workgroup_S = OpTypePointer Workgroup %S
%s = OpVariable %_ptr_Workgroup_S Workgroup %s = OpVariable %_ptr_Workgroup_S Workgroup
%void = OpTypeVoid %void = OpTypeVoid
%16 = OpTypeFunction %void %uint %18 = OpTypeFunction %void %uint
%_ptr_Function_uint = OpTypePointer Function %uint %_ptr_Function_uint = OpTypePointer Function %uint
%23 = OpConstantNull %uint %25 = OpConstantNull %uint
%bool = OpTypeBool %bool = OpTypeBool
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%_ptr_Workgroup_int = OpTypePointer Workgroup %int %_ptr_Workgroup_int = OpTypePointer Workgroup %int
%38 = OpConstantNull %int %40 = OpConstantNull %int
%uint_1 = OpConstant %uint 1 %uint_1 = OpConstant %uint 1
%uint_2 = OpConstant %uint 2 %uint_2 = OpConstant %uint 2
%uint_264 = OpConstant %uint 264 %uint_264 = OpConstant %uint 264
@ -63,49 +71,49 @@
%int_1 = OpConstant %int 1 %int_1 = OpConstant %int 1
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%int_3 = OpConstant %int 3 %int_3 = OpConstant %int 3
%55 = OpTypeFunction %void %57 = OpTypeFunction %void
%f_inner = OpFunction %void None %16 %f_inner = OpFunction %void None %18
%local_invocation_index = OpFunctionParameter %uint %local_invocation_index = OpFunctionParameter %uint
%20 = OpLabel %22 = OpLabel
%idx = OpVariable %_ptr_Function_uint Function %23 %idx = OpVariable %_ptr_Function_uint Function %25
OpStore %idx %local_invocation_index OpStore %idx %local_invocation_index
OpBranch %24
%24 = OpLabel
OpLoopMerge %25 %26 None
OpBranch %27
%27 = OpLabel
%29 = OpLoad %uint %idx
%30 = OpULessThan %bool %29 %uint_64
%28 = OpLogicalNot %bool %30
OpSelectionMerge %32 None
OpBranchConditional %28 %33 %32
%33 = OpLabel
OpBranch %25
%32 = OpLabel
%34 = OpLoad %uint %idx
%37 = OpAccessChain %_ptr_Workgroup_int %s %uint_0 %34
OpStore %37 %38
OpBranch %26 OpBranch %26
%26 = OpLabel %26 = OpLabel
%39 = OpLoad %uint %idx OpLoopMerge %27 %28 None
%41 = OpIAdd %uint %39 %uint_1 OpBranch %29
OpStore %idx %41 %29 = OpLabel
OpBranch %24 %31 = OpLoad %uint %idx
%25 = OpLabel %32 = OpULessThan %bool %31 %uint_64
%30 = OpLogicalNot %bool %32
OpSelectionMerge %34 None
OpBranchConditional %30 %35 %34
%35 = OpLabel
OpBranch %27
%34 = OpLabel
%36 = OpLoad %uint %idx
%39 = OpAccessChain %_ptr_Workgroup_int %s %uint_0 %36
OpStore %39 %40
OpBranch %28
%28 = OpLabel
%41 = OpLoad %uint %idx
%43 = OpIAdd %uint %41 %uint_1
OpStore %idx %43
OpBranch %26
%27 = OpLabel
OpControlBarrier %uint_2 %uint_2 %uint_264 OpControlBarrier %uint_2 %uint_2 %uint_264
%46 = OpAccessChain %_ptr_Uniform_int %ubo %uint_0 %48 = OpAccessChain %_ptr_Uniform_int %ubo %uint_0 %uint_0
%47 = OpLoad %int %46 %49 = OpLoad %int %48
%48 = OpAccessChain %_ptr_Workgroup_int %s %uint_0 %47 %50 = OpAccessChain %_ptr_Workgroup_int %s %uint_0 %49
OpStore %48 %int_1 OpStore %50 %int_1
%51 = OpAccessChain %_ptr_StorageBuffer_int %result %uint_0 %53 = OpAccessChain %_ptr_StorageBuffer_int %result %uint_0 %uint_0
%53 = OpAccessChain %_ptr_Workgroup_int %s %uint_0 %int_3 %55 = OpAccessChain %_ptr_Workgroup_int %s %uint_0 %int_3
%54 = OpLoad %int %53 %56 = OpLoad %int %55
OpStore %51 %54 OpStore %53 %56
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%f = OpFunction %void None %55 %f = OpFunction %void None %57
%57 = OpLabel %59 = OpLabel
%59 = OpLoad %uint %local_invocation_index_1 %61 = OpLoad %uint %local_invocation_index_1
%58 = OpFunctionCall %void %f_inner %59 %60 = OpFunctionCall %void %f_inner %61
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -1,5 +1,12 @@
#version 310 es #version 310 es
struct Simulation {
uint i;
uint pad;
uint pad_1;
uint pad_2;
};
struct Particle { struct Particle {
vec3 position[8]; vec3 position[8];
float lifetime; float lifetime;
@ -15,16 +22,13 @@ layout(binding = 3, std430) buffer Particles_ssbo {
Particle p[]; Particle p[];
} particles; } particles;
layout(binding = 4, std140) uniform Simulation_ubo { layout(binding = 4, std140) uniform sim_block_ubo {
uint i; Simulation inner;
uint pad;
uint pad_1;
uint pad_2;
} sim; } sim;
void tint_symbol() { void tint_symbol() {
Particle particle = particles.p[0]; Particle particle = particles.p[0];
particle.position[sim.i] = particle.position[sim.i]; particle.position[sim.inner.i] = particle.position[sim.inner.i];
} }
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

@ -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: 37 ; Bound: 38
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
@ -15,6 +15,8 @@
OpMemberName %Particle 2 "color" OpMemberName %Particle 2 "color"
OpMemberName %Particle 3 "velocity" OpMemberName %Particle 3 "velocity"
OpName %particles "particles" OpName %particles "particles"
OpName %sim_block "sim_block"
OpMemberName %sim_block 0 "inner"
OpName %Simulation "Simulation" OpName %Simulation "Simulation"
OpMemberName %Simulation 0 "i" OpMemberName %Simulation 0 "i"
OpName %sim "sim" OpName %sim "sim"
@ -31,7 +33,8 @@
OpDecorate %particles NonWritable OpDecorate %particles NonWritable
OpDecorate %particles DescriptorSet 1 OpDecorate %particles DescriptorSet 1
OpDecorate %particles Binding 3 OpDecorate %particles Binding 3
OpDecorate %Simulation Block OpDecorate %sim_block Block
OpMemberDecorate %sim_block 0 Offset 0
OpMemberDecorate %Simulation 0 Offset 0 OpMemberDecorate %Simulation 0 Offset 0
OpDecorate %sim NonWritable OpDecorate %sim NonWritable
OpDecorate %sim DescriptorSet 1 OpDecorate %sim DescriptorSet 1
@ -48,31 +51,32 @@
%_ptr_StorageBuffer_Particles = OpTypePointer StorageBuffer %Particles %_ptr_StorageBuffer_Particles = OpTypePointer StorageBuffer %Particles
%particles = OpVariable %_ptr_StorageBuffer_Particles StorageBuffer %particles = OpVariable %_ptr_StorageBuffer_Particles StorageBuffer
%Simulation = OpTypeStruct %uint %Simulation = OpTypeStruct %uint
%_ptr_Uniform_Simulation = OpTypePointer Uniform %Simulation %sim_block = OpTypeStruct %Simulation
%sim = OpVariable %_ptr_Uniform_Simulation Uniform %_ptr_Uniform_sim_block = OpTypePointer Uniform %sim_block
%sim = OpVariable %_ptr_Uniform_sim_block Uniform
%void = OpTypeVoid %void = OpTypeVoid
%15 = OpTypeFunction %void %16 = OpTypeFunction %void
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%int = OpTypeInt 32 1 %int = OpTypeInt 32 1
%21 = OpConstantNull %int %22 = OpConstantNull %int
%_ptr_StorageBuffer_Particle = OpTypePointer StorageBuffer %Particle %_ptr_StorageBuffer_Particle = OpTypePointer StorageBuffer %Particle
%_ptr_Function_Particle = OpTypePointer Function %Particle %_ptr_Function_Particle = OpTypePointer Function %Particle
%27 = OpConstantNull %Particle %28 = OpConstantNull %Particle
%_ptr_Uniform_uint = OpTypePointer Uniform %uint %_ptr_Uniform_uint = OpTypePointer Uniform %uint
%_ptr_Function_v3float = OpTypePointer Function %v3float %_ptr_Function_v3float = OpTypePointer Function %v3float
%main = OpFunction %void None %15 %main = OpFunction %void None %16
%18 = OpLabel %19 = OpLabel
%particle = OpVariable %_ptr_Function_Particle Function %27 %particle = OpVariable %_ptr_Function_Particle Function %28
%23 = OpAccessChain %_ptr_StorageBuffer_Particle %particles %uint_0 %21 %24 = OpAccessChain %_ptr_StorageBuffer_Particle %particles %uint_0 %22
%24 = OpLoad %Particle %23 %25 = OpLoad %Particle %24
OpStore %particle %24 OpStore %particle %25
%29 = OpAccessChain %_ptr_Uniform_uint %sim %uint_0 %30 = OpAccessChain %_ptr_Uniform_uint %sim %uint_0 %uint_0
%30 = OpLoad %uint %29 %31 = OpLoad %uint %30
%32 = OpAccessChain %_ptr_Function_v3float %particle %uint_0 %30 %33 = OpAccessChain %_ptr_Function_v3float %particle %uint_0 %31
%33 = OpAccessChain %_ptr_Uniform_uint %sim %uint_0 %34 = OpAccessChain %_ptr_Uniform_uint %sim %uint_0 %uint_0
%34 = OpLoad %uint %33 %35 = OpLoad %uint %34
%35 = OpAccessChain %_ptr_Function_v3float %particle %uint_0 %34 %36 = OpAccessChain %_ptr_Function_v3float %particle %uint_0 %35
%36 = OpLoad %v3float %35 %37 = OpLoad %v3float %36
OpStore %32 %36 OpStore %33 %37
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -1,15 +1,19 @@
#version 310 es #version 310 es
layout(binding = 4, std140) uniform Uniforms_ubo { struct Uniforms {
uint i; uint i;
uint j; uint j;
uint pad; uint pad;
uint pad_1; uint pad_1;
};
layout(binding = 4, std140) uniform uniforms_block_ubo {
Uniforms inner;
} uniforms; } uniforms;
void tint_symbol() { void tint_symbol() {
mat2x4 m1 = mat2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); mat2x4 m1 = mat2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
m1[uniforms.i][0] = 1.0f; m1[uniforms.inner.i][0] = 1.0f;
} }
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

@ -1,19 +1,22 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 24 ; Bound: 25
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main" OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1 OpExecutionMode %main LocalSize 1 1 1
OpName %uniforms_block "uniforms_block"
OpMemberName %uniforms_block 0 "inner"
OpName %Uniforms "Uniforms" OpName %Uniforms "Uniforms"
OpMemberName %Uniforms 0 "i" OpMemberName %Uniforms 0 "i"
OpMemberName %Uniforms 1 "j" OpMemberName %Uniforms 1 "j"
OpName %uniforms "uniforms" OpName %uniforms "uniforms"
OpName %main "main" OpName %main "main"
OpName %m1 "m1" OpName %m1 "m1"
OpDecorate %Uniforms Block OpDecorate %uniforms_block Block
OpMemberDecorate %uniforms_block 0 Offset 0
OpMemberDecorate %Uniforms 0 Offset 0 OpMemberDecorate %Uniforms 0 Offset 0
OpMemberDecorate %Uniforms 1 Offset 4 OpMemberDecorate %Uniforms 1 Offset 4
OpDecorate %uniforms NonWritable OpDecorate %uniforms NonWritable
@ -21,27 +24,28 @@
OpDecorate %uniforms Binding 4 OpDecorate %uniforms Binding 4
%uint = OpTypeInt 32 0 %uint = OpTypeInt 32 0
%Uniforms = OpTypeStruct %uint %uint %Uniforms = OpTypeStruct %uint %uint
%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms %uniforms_block = OpTypeStruct %Uniforms
%uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform %_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block
%uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform
%void = OpTypeVoid %void = OpTypeVoid
%5 = OpTypeFunction %void %6 = OpTypeFunction %void
%float = OpTypeFloat 32 %float = OpTypeFloat 32
%v4float = OpTypeVector %float 4 %v4float = OpTypeVector %float 4
%mat2v4float = OpTypeMatrix %v4float 2 %mat2v4float = OpTypeMatrix %v4float 2
%_ptr_Function_mat2v4float = OpTypePointer Function %mat2v4float %_ptr_Function_mat2v4float = OpTypePointer Function %mat2v4float
%14 = OpConstantNull %mat2v4float %15 = OpConstantNull %mat2v4float
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%_ptr_Uniform_uint = OpTypePointer Uniform %uint %_ptr_Uniform_uint = OpTypePointer Uniform %uint
%int = OpTypeInt 32 1 %int = OpTypeInt 32 1
%20 = OpConstantNull %int %21 = OpConstantNull %int
%_ptr_Function_float = OpTypePointer Function %float %_ptr_Function_float = OpTypePointer Function %float
%float_1 = OpConstant %float 1 %float_1 = OpConstant %float 1
%main = OpFunction %void None %5 %main = OpFunction %void None %6
%8 = OpLabel %9 = OpLabel
%m1 = OpVariable %_ptr_Function_mat2v4float Function %14 %m1 = OpVariable %_ptr_Function_mat2v4float Function %15
%17 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %18 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0
%18 = OpLoad %uint %17 %19 = OpLoad %uint %18
%22 = OpAccessChain %_ptr_Function_float %m1 %18 %20 %23 = OpAccessChain %_ptr_Function_float %m1 %19 %21
OpStore %22 %float_1 OpStore %23 %float_1
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -1,15 +1,19 @@
#version 310 es #version 310 es
layout(binding = 4, std140) uniform Uniforms_ubo { struct Uniforms {
uint i; uint i;
uint j; uint j;
uint pad; uint pad;
uint pad_1; uint pad_1;
};
layout(binding = 4, std140) uniform uniforms_block_ubo {
Uniforms inner;
} uniforms; } uniforms;
void tint_symbol() { void tint_symbol() {
mat2x4 m1 = mat2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); mat2x4 m1 = mat2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
m1[uniforms.i][uniforms.j] = 1.0f; m1[uniforms.inner.i][uniforms.inner.j] = 1.0f;
} }
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

@ -1,19 +1,22 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 25 ; Bound: 26
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main" OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1 OpExecutionMode %main LocalSize 1 1 1
OpName %uniforms_block "uniforms_block"
OpMemberName %uniforms_block 0 "inner"
OpName %Uniforms "Uniforms" OpName %Uniforms "Uniforms"
OpMemberName %Uniforms 0 "i" OpMemberName %Uniforms 0 "i"
OpMemberName %Uniforms 1 "j" OpMemberName %Uniforms 1 "j"
OpName %uniforms "uniforms" OpName %uniforms "uniforms"
OpName %main "main" OpName %main "main"
OpName %m1 "m1" OpName %m1 "m1"
OpDecorate %Uniforms Block OpDecorate %uniforms_block Block
OpMemberDecorate %uniforms_block 0 Offset 0
OpMemberDecorate %Uniforms 0 Offset 0 OpMemberDecorate %Uniforms 0 Offset 0
OpMemberDecorate %Uniforms 1 Offset 4 OpMemberDecorate %Uniforms 1 Offset 4
OpDecorate %uniforms NonWritable OpDecorate %uniforms NonWritable
@ -21,28 +24,29 @@
OpDecorate %uniforms Binding 4 OpDecorate %uniforms Binding 4
%uint = OpTypeInt 32 0 %uint = OpTypeInt 32 0
%Uniforms = OpTypeStruct %uint %uint %Uniforms = OpTypeStruct %uint %uint
%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms %uniforms_block = OpTypeStruct %Uniforms
%uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform %_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block
%uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform
%void = OpTypeVoid %void = OpTypeVoid
%5 = OpTypeFunction %void %6 = OpTypeFunction %void
%float = OpTypeFloat 32 %float = OpTypeFloat 32
%v4float = OpTypeVector %float 4 %v4float = OpTypeVector %float 4
%mat2v4float = OpTypeMatrix %v4float 2 %mat2v4float = OpTypeMatrix %v4float 2
%_ptr_Function_mat2v4float = OpTypePointer Function %mat2v4float %_ptr_Function_mat2v4float = OpTypePointer Function %mat2v4float
%14 = OpConstantNull %mat2v4float %15 = OpConstantNull %mat2v4float
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%_ptr_Uniform_uint = OpTypePointer Uniform %uint %_ptr_Uniform_uint = OpTypePointer Uniform %uint
%uint_1 = OpConstant %uint 1 %uint_1 = OpConstant %uint 1
%_ptr_Function_float = OpTypePointer Function %float %_ptr_Function_float = OpTypePointer Function %float
%float_1 = OpConstant %float 1 %float_1 = OpConstant %float 1
%main = OpFunction %void None %5 %main = OpFunction %void None %6
%8 = OpLabel %9 = OpLabel
%m1 = OpVariable %_ptr_Function_mat2v4float Function %14 %m1 = OpVariable %_ptr_Function_mat2v4float Function %15
%17 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %18 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0
%18 = OpLoad %uint %17 %19 = OpLoad %uint %18
%20 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 %21 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1
%21 = OpLoad %uint %20 %22 = OpLoad %uint %21
%23 = OpAccessChain %_ptr_Function_float %m1 %18 %21 %24 = OpAccessChain %_ptr_Function_float %m1 %19 %22
OpStore %23 %float_1 OpStore %24 %float_1
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -1,15 +1,19 @@
#version 310 es #version 310 es
layout(binding = 4, std140) uniform Uniforms_ubo { struct Uniforms {
uint i; uint i;
uint j; uint j;
uint pad; uint pad;
uint pad_1; uint pad_1;
};
layout(binding = 4, std140) uniform uniforms_block_ubo {
Uniforms inner;
} uniforms; } uniforms;
mat2x4 m1 = mat2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); mat2x4 m1 = mat2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
void tint_symbol() { void tint_symbol() {
m1[0][uniforms.j] = 1.0f; m1[0][uniforms.inner.j] = 1.0f;
} }
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

@ -1,19 +1,22 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 24 ; Bound: 26
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main" OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1 OpExecutionMode %main LocalSize 1 1 1
OpName %uniforms_block "uniforms_block"
OpMemberName %uniforms_block 0 "inner"
OpName %Uniforms "Uniforms" OpName %Uniforms "Uniforms"
OpMemberName %Uniforms 0 "i" OpMemberName %Uniforms 0 "i"
OpMemberName %Uniforms 1 "j" OpMemberName %Uniforms 1 "j"
OpName %uniforms "uniforms" OpName %uniforms "uniforms"
OpName %m1 "m1" OpName %m1 "m1"
OpName %main "main" OpName %main "main"
OpDecorate %Uniforms Block OpDecorate %uniforms_block Block
OpMemberDecorate %uniforms_block 0 Offset 0
OpMemberDecorate %Uniforms 0 Offset 0 OpMemberDecorate %Uniforms 0 Offset 0
OpMemberDecorate %Uniforms 1 Offset 4 OpMemberDecorate %Uniforms 1 Offset 4
OpDecorate %uniforms NonWritable OpDecorate %uniforms NonWritable
@ -21,27 +24,29 @@
OpDecorate %uniforms Binding 4 OpDecorate %uniforms Binding 4
%uint = OpTypeInt 32 0 %uint = OpTypeInt 32 0
%Uniforms = OpTypeStruct %uint %uint %Uniforms = OpTypeStruct %uint %uint
%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms %uniforms_block = OpTypeStruct %Uniforms
%uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform %_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block
%uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform
%float = OpTypeFloat 32 %float = OpTypeFloat 32
%v4float = OpTypeVector %float 4 %v4float = OpTypeVector %float 4
%mat2v4float = OpTypeMatrix %v4float 2 %mat2v4float = OpTypeMatrix %v4float 2
%_ptr_Private_mat2v4float = OpTypePointer Private %mat2v4float %_ptr_Private_mat2v4float = OpTypePointer Private %mat2v4float
%10 = OpConstantNull %mat2v4float %11 = OpConstantNull %mat2v4float
%m1 = OpVariable %_ptr_Private_mat2v4float Private %10 %m1 = OpVariable %_ptr_Private_mat2v4float Private %11
%void = OpTypeVoid %void = OpTypeVoid
%11 = OpTypeFunction %void %12 = OpTypeFunction %void
%int = OpTypeInt 32 1 %int = OpTypeInt 32 1
%16 = OpConstantNull %int %17 = OpConstantNull %int
%uint_0 = OpConstant %uint 0
%uint_1 = OpConstant %uint 1 %uint_1 = OpConstant %uint 1
%_ptr_Uniform_uint = OpTypePointer Uniform %uint %_ptr_Uniform_uint = OpTypePointer Uniform %uint
%_ptr_Private_float = OpTypePointer Private %float %_ptr_Private_float = OpTypePointer Private %float
%float_1 = OpConstant %float 1 %float_1 = OpConstant %float 1
%main = OpFunction %void None %11 %main = OpFunction %void None %12
%14 = OpLabel %15 = OpLabel
%19 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 %21 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1
%20 = OpLoad %uint %19 %22 = OpLoad %uint %21
%22 = OpAccessChain %_ptr_Private_float %m1 %16 %20 %24 = OpAccessChain %_ptr_Private_float %m1 %17 %22
OpStore %22 %float_1 OpStore %24 %float_1
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -1,15 +1,19 @@
#version 310 es #version 310 es
layout(binding = 4, std140) uniform Uniforms_ubo { struct Uniforms {
uint i; uint i;
uint j; uint j;
uint pad; uint pad;
uint pad_1; uint pad_1;
};
layout(binding = 4, std140) uniform uniforms_block_ubo {
Uniforms inner;
} uniforms; } uniforms;
void tint_symbol() { void tint_symbol() {
mat2x4 m1 = mat2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); mat2x4 m1 = mat2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
m1[uniforms.i] = vec4(1.0f); m1[uniforms.inner.i] = vec4(1.0f);
} }
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

@ -1,19 +1,22 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 23 ; Bound: 24
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main" OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1 OpExecutionMode %main LocalSize 1 1 1
OpName %uniforms_block "uniforms_block"
OpMemberName %uniforms_block 0 "inner"
OpName %Uniforms "Uniforms" OpName %Uniforms "Uniforms"
OpMemberName %Uniforms 0 "i" OpMemberName %Uniforms 0 "i"
OpMemberName %Uniforms 1 "j" OpMemberName %Uniforms 1 "j"
OpName %uniforms "uniforms" OpName %uniforms "uniforms"
OpName %main "main" OpName %main "main"
OpName %m1 "m1" OpName %m1 "m1"
OpDecorate %Uniforms Block OpDecorate %uniforms_block Block
OpMemberDecorate %uniforms_block 0 Offset 0
OpMemberDecorate %Uniforms 0 Offset 0 OpMemberDecorate %Uniforms 0 Offset 0
OpMemberDecorate %Uniforms 1 Offset 4 OpMemberDecorate %Uniforms 1 Offset 4
OpDecorate %uniforms NonWritable OpDecorate %uniforms NonWritable
@ -21,26 +24,27 @@
OpDecorate %uniforms Binding 4 OpDecorate %uniforms Binding 4
%uint = OpTypeInt 32 0 %uint = OpTypeInt 32 0
%Uniforms = OpTypeStruct %uint %uint %Uniforms = OpTypeStruct %uint %uint
%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms %uniforms_block = OpTypeStruct %Uniforms
%uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform %_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block
%uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform
%void = OpTypeVoid %void = OpTypeVoid
%5 = OpTypeFunction %void %6 = OpTypeFunction %void
%float = OpTypeFloat 32 %float = OpTypeFloat 32
%v4float = OpTypeVector %float 4 %v4float = OpTypeVector %float 4
%mat2v4float = OpTypeMatrix %v4float 2 %mat2v4float = OpTypeMatrix %v4float 2
%_ptr_Function_mat2v4float = OpTypePointer Function %mat2v4float %_ptr_Function_mat2v4float = OpTypePointer Function %mat2v4float
%14 = OpConstantNull %mat2v4float %15 = OpConstantNull %mat2v4float
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%_ptr_Uniform_uint = OpTypePointer Uniform %uint %_ptr_Uniform_uint = OpTypePointer Uniform %uint
%_ptr_Function_v4float = OpTypePointer Function %v4float %_ptr_Function_v4float = OpTypePointer Function %v4float
%float_1 = OpConstant %float 1 %float_1 = OpConstant %float 1
%22 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 %23 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
%main = OpFunction %void None %5 %main = OpFunction %void None %6
%8 = OpLabel %9 = OpLabel
%m1 = OpVariable %_ptr_Function_mat2v4float Function %14 %m1 = OpVariable %_ptr_Function_mat2v4float Function %15
%17 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %18 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0
%18 = OpLoad %uint %17 %19 = OpLoad %uint %18
%20 = OpAccessChain %_ptr_Function_v4float %m1 %18 %21 = OpAccessChain %_ptr_Function_v4float %m1 %19
OpStore %20 %22 OpStore %21 %23
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -1,15 +1,19 @@
#version 310 es #version 310 es
layout(binding = 4, std140) uniform Uniforms_ubo { struct Uniforms {
uint i; uint i;
uint j; uint j;
uint pad; uint pad;
uint pad_1; uint pad_1;
};
layout(binding = 4, std140) uniform uniforms_block_ubo {
Uniforms inner;
} uniforms; } uniforms;
mat2x4 m1 = mat2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); mat2x4 m1 = mat2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
void tint_symbol() { void tint_symbol() {
m1[uniforms.i][0] = 1.0f; m1[uniforms.inner.i][0] = 1.0f;
} }
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

@ -1,19 +1,22 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 24 ; Bound: 25
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main" OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1 OpExecutionMode %main LocalSize 1 1 1
OpName %uniforms_block "uniforms_block"
OpMemberName %uniforms_block 0 "inner"
OpName %Uniforms "Uniforms" OpName %Uniforms "Uniforms"
OpMemberName %Uniforms 0 "i" OpMemberName %Uniforms 0 "i"
OpMemberName %Uniforms 1 "j" OpMemberName %Uniforms 1 "j"
OpName %uniforms "uniforms" OpName %uniforms "uniforms"
OpName %m1 "m1" OpName %m1 "m1"
OpName %main "main" OpName %main "main"
OpDecorate %Uniforms Block OpDecorate %uniforms_block Block
OpMemberDecorate %uniforms_block 0 Offset 0
OpMemberDecorate %Uniforms 0 Offset 0 OpMemberDecorate %Uniforms 0 Offset 0
OpMemberDecorate %Uniforms 1 Offset 4 OpMemberDecorate %Uniforms 1 Offset 4
OpDecorate %uniforms NonWritable OpDecorate %uniforms NonWritable
@ -21,27 +24,28 @@
OpDecorate %uniforms Binding 4 OpDecorate %uniforms Binding 4
%uint = OpTypeInt 32 0 %uint = OpTypeInt 32 0
%Uniforms = OpTypeStruct %uint %uint %Uniforms = OpTypeStruct %uint %uint
%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms %uniforms_block = OpTypeStruct %Uniforms
%uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform %_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block
%uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform
%float = OpTypeFloat 32 %float = OpTypeFloat 32
%v4float = OpTypeVector %float 4 %v4float = OpTypeVector %float 4
%mat2v4float = OpTypeMatrix %v4float 2 %mat2v4float = OpTypeMatrix %v4float 2
%_ptr_Private_mat2v4float = OpTypePointer Private %mat2v4float %_ptr_Private_mat2v4float = OpTypePointer Private %mat2v4float
%10 = OpConstantNull %mat2v4float %11 = OpConstantNull %mat2v4float
%m1 = OpVariable %_ptr_Private_mat2v4float Private %10 %m1 = OpVariable %_ptr_Private_mat2v4float Private %11
%void = OpTypeVoid %void = OpTypeVoid
%11 = OpTypeFunction %void %12 = OpTypeFunction %void
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%_ptr_Uniform_uint = OpTypePointer Uniform %uint %_ptr_Uniform_uint = OpTypePointer Uniform %uint
%int = OpTypeInt 32 1 %int = OpTypeInt 32 1
%20 = OpConstantNull %int %21 = OpConstantNull %int
%_ptr_Private_float = OpTypePointer Private %float %_ptr_Private_float = OpTypePointer Private %float
%float_1 = OpConstant %float 1 %float_1 = OpConstant %float 1
%main = OpFunction %void None %11 %main = OpFunction %void None %12
%14 = OpLabel %15 = OpLabel
%17 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %18 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0
%18 = OpLoad %uint %17 %19 = OpLoad %uint %18
%22 = OpAccessChain %_ptr_Private_float %m1 %18 %20 %23 = OpAccessChain %_ptr_Private_float %m1 %19 %21
OpStore %22 %float_1 OpStore %23 %float_1
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -1,15 +1,19 @@
#version 310 es #version 310 es
layout(binding = 4, std140) uniform Uniforms_ubo { struct Uniforms {
uint i; uint i;
uint j; uint j;
uint pad; uint pad;
uint pad_1; uint pad_1;
};
layout(binding = 4, std140) uniform uniforms_block_ubo {
Uniforms inner;
} uniforms; } uniforms;
mat2x4 m1 = mat2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); mat2x4 m1 = mat2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
void tint_symbol() { void tint_symbol() {
m1[uniforms.i][uniforms.j] = 1.0f; m1[uniforms.inner.i][uniforms.inner.j] = 1.0f;
} }
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

@ -1,19 +1,22 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 25 ; Bound: 26
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main" OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1 OpExecutionMode %main LocalSize 1 1 1
OpName %uniforms_block "uniforms_block"
OpMemberName %uniforms_block 0 "inner"
OpName %Uniforms "Uniforms" OpName %Uniforms "Uniforms"
OpMemberName %Uniforms 0 "i" OpMemberName %Uniforms 0 "i"
OpMemberName %Uniforms 1 "j" OpMemberName %Uniforms 1 "j"
OpName %uniforms "uniforms" OpName %uniforms "uniforms"
OpName %m1 "m1" OpName %m1 "m1"
OpName %main "main" OpName %main "main"
OpDecorate %Uniforms Block OpDecorate %uniforms_block Block
OpMemberDecorate %uniforms_block 0 Offset 0
OpMemberDecorate %Uniforms 0 Offset 0 OpMemberDecorate %Uniforms 0 Offset 0
OpMemberDecorate %Uniforms 1 Offset 4 OpMemberDecorate %Uniforms 1 Offset 4
OpDecorate %uniforms NonWritable OpDecorate %uniforms NonWritable
@ -21,28 +24,29 @@
OpDecorate %uniforms Binding 4 OpDecorate %uniforms Binding 4
%uint = OpTypeInt 32 0 %uint = OpTypeInt 32 0
%Uniforms = OpTypeStruct %uint %uint %Uniforms = OpTypeStruct %uint %uint
%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms %uniforms_block = OpTypeStruct %Uniforms
%uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform %_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block
%uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform
%float = OpTypeFloat 32 %float = OpTypeFloat 32
%v4float = OpTypeVector %float 4 %v4float = OpTypeVector %float 4
%mat2v4float = OpTypeMatrix %v4float 2 %mat2v4float = OpTypeMatrix %v4float 2
%_ptr_Private_mat2v4float = OpTypePointer Private %mat2v4float %_ptr_Private_mat2v4float = OpTypePointer Private %mat2v4float
%10 = OpConstantNull %mat2v4float %11 = OpConstantNull %mat2v4float
%m1 = OpVariable %_ptr_Private_mat2v4float Private %10 %m1 = OpVariable %_ptr_Private_mat2v4float Private %11
%void = OpTypeVoid %void = OpTypeVoid
%11 = OpTypeFunction %void %12 = OpTypeFunction %void
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%_ptr_Uniform_uint = OpTypePointer Uniform %uint %_ptr_Uniform_uint = OpTypePointer Uniform %uint
%uint_1 = OpConstant %uint 1 %uint_1 = OpConstant %uint 1
%_ptr_Private_float = OpTypePointer Private %float %_ptr_Private_float = OpTypePointer Private %float
%float_1 = OpConstant %float 1 %float_1 = OpConstant %float 1
%main = OpFunction %void None %11 %main = OpFunction %void None %12
%14 = OpLabel %15 = OpLabel
%17 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %18 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0
%18 = OpLoad %uint %17 %19 = OpLoad %uint %18
%20 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 %21 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1
%21 = OpLoad %uint %20 %22 = OpLoad %uint %21
%23 = OpAccessChain %_ptr_Private_float %m1 %18 %21 %24 = OpAccessChain %_ptr_Private_float %m1 %19 %22
OpStore %23 %float_1 OpStore %24 %float_1
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -1,15 +1,19 @@
#version 310 es #version 310 es
layout(binding = 4, std140) uniform Uniforms_ubo { struct Uniforms {
uint i; uint i;
uint j; uint j;
uint pad; uint pad;
uint pad_1; uint pad_1;
};
layout(binding = 4, std140) uniform uniforms_block_ubo {
Uniforms inner;
} uniforms; } uniforms;
mat2x4 m1 = mat2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); mat2x4 m1 = mat2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
void tint_symbol() { void tint_symbol() {
m1[0][uniforms.j] = 1.0f; m1[0][uniforms.inner.j] = 1.0f;
} }
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

@ -1,19 +1,22 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 24 ; Bound: 26
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main" OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1 OpExecutionMode %main LocalSize 1 1 1
OpName %uniforms_block "uniforms_block"
OpMemberName %uniforms_block 0 "inner"
OpName %Uniforms "Uniforms" OpName %Uniforms "Uniforms"
OpMemberName %Uniforms 0 "i" OpMemberName %Uniforms 0 "i"
OpMemberName %Uniforms 1 "j" OpMemberName %Uniforms 1 "j"
OpName %uniforms "uniforms" OpName %uniforms "uniforms"
OpName %m1 "m1" OpName %m1 "m1"
OpName %main "main" OpName %main "main"
OpDecorate %Uniforms Block OpDecorate %uniforms_block Block
OpMemberDecorate %uniforms_block 0 Offset 0
OpMemberDecorate %Uniforms 0 Offset 0 OpMemberDecorate %Uniforms 0 Offset 0
OpMemberDecorate %Uniforms 1 Offset 4 OpMemberDecorate %Uniforms 1 Offset 4
OpDecorate %uniforms NonWritable OpDecorate %uniforms NonWritable
@ -21,27 +24,29 @@
OpDecorate %uniforms Binding 4 OpDecorate %uniforms Binding 4
%uint = OpTypeInt 32 0 %uint = OpTypeInt 32 0
%Uniforms = OpTypeStruct %uint %uint %Uniforms = OpTypeStruct %uint %uint
%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms %uniforms_block = OpTypeStruct %Uniforms
%uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform %_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block
%uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform
%float = OpTypeFloat 32 %float = OpTypeFloat 32
%v4float = OpTypeVector %float 4 %v4float = OpTypeVector %float 4
%mat2v4float = OpTypeMatrix %v4float 2 %mat2v4float = OpTypeMatrix %v4float 2
%_ptr_Private_mat2v4float = OpTypePointer Private %mat2v4float %_ptr_Private_mat2v4float = OpTypePointer Private %mat2v4float
%10 = OpConstantNull %mat2v4float %11 = OpConstantNull %mat2v4float
%m1 = OpVariable %_ptr_Private_mat2v4float Private %10 %m1 = OpVariable %_ptr_Private_mat2v4float Private %11
%void = OpTypeVoid %void = OpTypeVoid
%11 = OpTypeFunction %void %12 = OpTypeFunction %void
%int = OpTypeInt 32 1 %int = OpTypeInt 32 1
%16 = OpConstantNull %int %17 = OpConstantNull %int
%uint_0 = OpConstant %uint 0
%uint_1 = OpConstant %uint 1 %uint_1 = OpConstant %uint 1
%_ptr_Uniform_uint = OpTypePointer Uniform %uint %_ptr_Uniform_uint = OpTypePointer Uniform %uint
%_ptr_Private_float = OpTypePointer Private %float %_ptr_Private_float = OpTypePointer Private %float
%float_1 = OpConstant %float 1 %float_1 = OpConstant %float 1
%main = OpFunction %void None %11 %main = OpFunction %void None %12
%14 = OpLabel %15 = OpLabel
%19 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 %21 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1
%20 = OpLoad %uint %19 %22 = OpLoad %uint %21
%22 = OpAccessChain %_ptr_Private_float %m1 %16 %20 %24 = OpAccessChain %_ptr_Private_float %m1 %17 %22
OpStore %22 %float_1 OpStore %24 %float_1
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -1,15 +1,19 @@
#version 310 es #version 310 es
layout(binding = 4, std140) uniform Uniforms_ubo { struct Uniforms {
uint i; uint i;
uint j; uint j;
uint pad; uint pad;
uint pad_1; uint pad_1;
};
layout(binding = 4, std140) uniform uniforms_block_ubo {
Uniforms inner;
} uniforms; } uniforms;
mat2x4 m1 = mat2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); mat2x4 m1 = mat2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
void tint_symbol() { void tint_symbol() {
m1[uniforms.i] = vec4(1.0f); m1[uniforms.inner.i] = vec4(1.0f);
} }
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

@ -1,19 +1,22 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 23 ; Bound: 24
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main" OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1 OpExecutionMode %main LocalSize 1 1 1
OpName %uniforms_block "uniforms_block"
OpMemberName %uniforms_block 0 "inner"
OpName %Uniforms "Uniforms" OpName %Uniforms "Uniforms"
OpMemberName %Uniforms 0 "i" OpMemberName %Uniforms 0 "i"
OpMemberName %Uniforms 1 "j" OpMemberName %Uniforms 1 "j"
OpName %uniforms "uniforms" OpName %uniforms "uniforms"
OpName %m1 "m1" OpName %m1 "m1"
OpName %main "main" OpName %main "main"
OpDecorate %Uniforms Block OpDecorate %uniforms_block Block
OpMemberDecorate %uniforms_block 0 Offset 0
OpMemberDecorate %Uniforms 0 Offset 0 OpMemberDecorate %Uniforms 0 Offset 0
OpMemberDecorate %Uniforms 1 Offset 4 OpMemberDecorate %Uniforms 1 Offset 4
OpDecorate %uniforms NonWritable OpDecorate %uniforms NonWritable
@ -21,26 +24,27 @@
OpDecorate %uniforms Binding 4 OpDecorate %uniforms Binding 4
%uint = OpTypeInt 32 0 %uint = OpTypeInt 32 0
%Uniforms = OpTypeStruct %uint %uint %Uniforms = OpTypeStruct %uint %uint
%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms %uniforms_block = OpTypeStruct %Uniforms
%uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform %_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block
%uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform
%float = OpTypeFloat 32 %float = OpTypeFloat 32
%v4float = OpTypeVector %float 4 %v4float = OpTypeVector %float 4
%mat2v4float = OpTypeMatrix %v4float 2 %mat2v4float = OpTypeMatrix %v4float 2
%_ptr_Private_mat2v4float = OpTypePointer Private %mat2v4float %_ptr_Private_mat2v4float = OpTypePointer Private %mat2v4float
%10 = OpConstantNull %mat2v4float %11 = OpConstantNull %mat2v4float
%m1 = OpVariable %_ptr_Private_mat2v4float Private %10 %m1 = OpVariable %_ptr_Private_mat2v4float Private %11
%void = OpTypeVoid %void = OpTypeVoid
%11 = OpTypeFunction %void %12 = OpTypeFunction %void
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%_ptr_Uniform_uint = OpTypePointer Uniform %uint %_ptr_Uniform_uint = OpTypePointer Uniform %uint
%_ptr_Private_v4float = OpTypePointer Private %v4float %_ptr_Private_v4float = OpTypePointer Private %v4float
%float_1 = OpConstant %float 1 %float_1 = OpConstant %float 1
%22 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 %23 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
%main = OpFunction %void None %11 %main = OpFunction %void None %12
%14 = OpLabel %15 = OpLabel
%17 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %18 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0
%18 = OpLoad %uint %17 %19 = OpLoad %uint %18
%20 = OpAccessChain %_ptr_Private_v4float %m1 %18 %21 = OpAccessChain %_ptr_Private_v4float %m1 %19
OpStore %20 %22 OpStore %21 %23
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -10,7 +10,7 @@ struct PointLight {
vec4 position; vec4 position;
}; };
layout(binding = 0, std140) uniform Uniforms_ubo { struct Uniforms {
mat4 worldView; mat4 worldView;
mat4 proj; mat4 proj;
uint numPointLights; uint numPointLights;
@ -18,6 +18,10 @@ layout(binding = 0, std140) uniform Uniforms_ubo {
uint pad; uint pad;
uint pad_1; uint pad_1;
vec4 color; vec4 color;
};
layout(binding = 0, std140) uniform uniforms_block_ubo {
Uniforms inner;
} uniforms; } uniforms;
layout(binding = 1, std430) buffer PointLights_ssbo { layout(binding = 1, std430) buffer PointLights_ssbo {

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: 107 ; Bound: 108
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
@ -13,6 +13,8 @@
OpName %uv_1 "uv_1" OpName %uv_1 "uv_1"
OpName %color_1 "color_1" OpName %color_1 "color_1"
OpName %color_2 "color_2" OpName %color_2 "color_2"
OpName %uniforms_block "uniforms_block"
OpMemberName %uniforms_block 0 "inner"
OpName %Uniforms "Uniforms" OpName %Uniforms "Uniforms"
OpMemberName %Uniforms 0 "worldView" OpMemberName %Uniforms 0 "worldView"
OpMemberName %Uniforms 1 "proj" OpMemberName %Uniforms 1 "proj"
@ -48,7 +50,8 @@
OpDecorate %uv_1 Location 2 OpDecorate %uv_1 Location 2
OpDecorate %color_1 Location 3 OpDecorate %color_1 Location 3
OpDecorate %color_2 Location 0 OpDecorate %color_2 Location 0
OpDecorate %Uniforms Block OpDecorate %uniforms_block Block
OpMemberDecorate %uniforms_block 0 Offset 0
OpMemberDecorate %Uniforms 0 Offset 0 OpMemberDecorate %Uniforms 0 Offset 0
OpMemberDecorate %Uniforms 0 ColMajor OpMemberDecorate %Uniforms 0 ColMajor
OpMemberDecorate %Uniforms 0 MatrixStride 16 OpMemberDecorate %Uniforms 0 MatrixStride 16
@ -94,25 +97,27 @@
%mat4v4float = OpTypeMatrix %v4float 4 %mat4v4float = OpTypeMatrix %v4float 4
%uint = OpTypeInt 32 0 %uint = OpTypeInt 32 0
%Uniforms = OpTypeStruct %mat4v4float %mat4v4float %uint %uint %v4float %Uniforms = OpTypeStruct %mat4v4float %mat4v4float %uint %uint %v4float
%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms %uniforms_block = OpTypeStruct %Uniforms
%uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform %_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block
%uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform
%PointLight = OpTypeStruct %v4float %PointLight = OpTypeStruct %v4float
%_runtimearr_PointLight = OpTypeRuntimeArray %PointLight %_runtimearr_PointLight = OpTypeRuntimeArray %PointLight
%PointLights = OpTypeStruct %_runtimearr_PointLight %PointLights = OpTypeStruct %_runtimearr_PointLight
%_ptr_StorageBuffer_PointLights = OpTypePointer StorageBuffer %PointLights %_ptr_StorageBuffer_PointLights = OpTypePointer StorageBuffer %PointLights
%pointLights = OpVariable %_ptr_StorageBuffer_PointLights StorageBuffer %pointLights = OpVariable %_ptr_StorageBuffer_PointLights StorageBuffer
%26 = OpTypeSampler %27 = OpTypeSampler
%_ptr_UniformConstant_26 = OpTypePointer UniformConstant %26 %_ptr_UniformConstant_27 = OpTypePointer UniformConstant %27
%mySampler = OpVariable %_ptr_UniformConstant_26 UniformConstant %mySampler = OpVariable %_ptr_UniformConstant_27 UniformConstant
%29 = OpTypeImage %float 2D 0 0 0 1 Unknown %30 = OpTypeImage %float 2D 0 0 0 1 Unknown
%_ptr_UniformConstant_29 = OpTypePointer UniformConstant %29 %_ptr_UniformConstant_30 = OpTypePointer UniformConstant %30
%myTexture = OpVariable %_ptr_UniformConstant_29 UniformConstant %myTexture = OpVariable %_ptr_UniformConstant_30 UniformConstant
%FragmentInput = OpTypeStruct %v4float %v4float %v4float %v2float %v4float %FragmentInput = OpTypeStruct %v4float %v4float %v4float %v2float %v4float
%30 = OpTypeFunction %v4float %FragmentInput %31 = OpTypeFunction %v4float %FragmentInput
%_ptr_Function_v4float = OpTypePointer Function %v4float %_ptr_Function_v4float = OpTypePointer Function %v4float
%uint_0 = OpConstant %uint 0
%uint_3 = OpConstant %uint 3 %uint_3 = OpConstant %uint 3
%_ptr_Uniform_uint = OpTypePointer Uniform %uint %_ptr_Uniform_uint = OpTypePointer Uniform %uint
%41 = OpConstantNull %uint %43 = OpConstantNull %uint
%bool = OpTypeBool %bool = OpTypeBool
%uint_1 = OpConstant %uint 1 %uint_1 = OpConstant %uint 1
%_ptr_Function_float = OpTypePointer Function %float %_ptr_Function_float = OpTypePointer Function %float
@ -120,95 +125,94 @@
%uint_2 = OpConstant %uint 2 %uint_2 = OpConstant %uint 2
%uint_4 = OpConstant %uint 4 %uint_4 = OpConstant %uint 4
%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float %_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
%78 = OpTypeSampledImage %29 %80 = OpTypeSampledImage %30
%FragmentOutput = OpTypeStruct %v4float %FragmentOutput = OpTypeStruct %v4float
%82 = OpTypeFunction %FragmentOutput %FragmentInput %84 = OpTypeFunction %FragmentOutput %FragmentInput
%_ptr_Function_FragmentOutput = OpTypePointer Function %FragmentOutput %_ptr_Function_FragmentOutput = OpTypePointer Function %FragmentOutput
%89 = OpConstantNull %FragmentOutput %91 = OpConstantNull %FragmentOutput
%uint_0 = OpConstant %uint 0 %93 = OpConstantNull %float
%92 = OpConstantNull %float %94 = OpConstantComposite %v4float %float_1 %93 %93 %float_1
%93 = OpConstantComposite %v4float %float_1 %92 %92 %float_1
%void = OpTypeVoid %void = OpTypeVoid
%95 = OpTypeFunction %void %96 = OpTypeFunction %void
%getColor = OpFunction %v4float None %30 %getColor = OpFunction %v4float None %31
%fragment = OpFunctionParameter %FragmentInput %fragment = OpFunctionParameter %FragmentInput
%34 = OpLabel %35 = OpLabel
%color = OpVariable %_ptr_Function_v4float Function %13 %color = OpVariable %_ptr_Function_v4float Function %13
%39 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_3 %41 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_3
%40 = OpLoad %uint %39 %42 = OpLoad %uint %41
%42 = OpIEqual %bool %40 %41 %44 = OpIEqual %bool %42 %43
OpSelectionMerge %44 None OpSelectionMerge %46 None
OpBranchConditional %42 %45 %46 OpBranchConditional %44 %47 %48
%45 = OpLabel %47 = OpLabel
%47 = OpCompositeExtract %v4float %fragment 4 %49 = OpCompositeExtract %v4float %fragment 4
OpStore %color %47 OpStore %color %49
OpBranch %44 OpBranch %46
%46 = OpLabel %48 = OpLabel
%48 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_3 %50 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_3
%49 = OpLoad %uint %48 %51 = OpLoad %uint %50
%51 = OpIEqual %bool %49 %uint_1 %53 = OpIEqual %bool %51 %uint_1
OpSelectionMerge %52 None OpSelectionMerge %54 None
OpBranchConditional %51 %53 %54 OpBranchConditional %53 %55 %56
%53 = OpLabel %55 = OpLabel
%55 = OpCompositeExtract %v4float %fragment 2 %57 = OpCompositeExtract %v4float %fragment 2
OpStore %color %55 OpStore %color %57
%57 = OpAccessChain %_ptr_Function_float %color %uint_3 %59 = OpAccessChain %_ptr_Function_float %color %uint_3
OpStore %57 %float_1 OpStore %59 %float_1
OpBranch %52 OpBranch %54
%54 = OpLabel %56 = OpLabel
%59 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_3 %61 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_3
%60 = OpLoad %uint %59 %62 = OpLoad %uint %61
%62 = OpIEqual %bool %60 %uint_2 %64 = OpIEqual %bool %62 %uint_2
OpSelectionMerge %63 None OpSelectionMerge %65 None
OpBranchConditional %62 %64 %65 OpBranchConditional %64 %66 %67
%64 = OpLabel %66 = OpLabel
%68 = OpAccessChain %_ptr_Uniform_v4float %uniforms %uint_4 %70 = OpAccessChain %_ptr_Uniform_v4float %uniforms %uint_0 %uint_4
%69 = OpLoad %v4float %68 %71 = OpLoad %v4float %70
OpStore %color %69 OpStore %color %71
OpBranch %63 OpBranch %65
%67 = OpLabel
%72 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_3
%73 = OpLoad %uint %72
%74 = OpIEqual %bool %73 %uint_3
OpSelectionMerge %75 None
OpBranchConditional %74 %76 %75
%76 = OpLabel
%78 = OpLoad %27 %mySampler
%79 = OpLoad %30 %myTexture
%81 = OpSampledImage %80 %79 %78
%82 = OpCompositeExtract %v2float %fragment 3
%77 = OpImageSampleImplicitLod %v4float %81 %82
OpStore %color %77
OpBranch %75
%75 = OpLabel
OpBranch %65
%65 = OpLabel %65 = OpLabel
%70 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_3 OpBranch %54
%71 = OpLoad %uint %70 %54 = OpLabel
%72 = OpIEqual %bool %71 %uint_3 OpBranch %46
OpSelectionMerge %73 None %46 = OpLabel
OpBranchConditional %72 %74 %73 %83 = OpLoad %v4float %color
%74 = OpLabel OpReturnValue %83
%76 = OpLoad %26 %mySampler
%77 = OpLoad %29 %myTexture
%79 = OpSampledImage %78 %77 %76
%80 = OpCompositeExtract %v2float %fragment 3
%75 = OpImageSampleImplicitLod %v4float %79 %80
OpStore %color %75
OpBranch %73
%73 = OpLabel
OpBranch %63
%63 = OpLabel
OpBranch %52
%52 = OpLabel
OpBranch %44
%44 = OpLabel
%81 = OpLoad %v4float %color
OpReturnValue %81
OpFunctionEnd OpFunctionEnd
%main_inner = OpFunction %FragmentOutput None %82 %main_inner = OpFunction %FragmentOutput None %84
%fragment_0 = OpFunctionParameter %FragmentInput %fragment_0 = OpFunctionParameter %FragmentInput
%86 = OpLabel %88 = OpLabel
%output = OpVariable %_ptr_Function_FragmentOutput Function %89 %output = OpVariable %_ptr_Function_FragmentOutput Function %91
%91 = OpAccessChain %_ptr_Function_v4float %output %uint_0 %92 = OpAccessChain %_ptr_Function_v4float %output %uint_0
OpStore %91 %93 OpStore %92 %94
%94 = OpLoad %FragmentOutput %output %95 = OpLoad %FragmentOutput %output
OpReturnValue %94 OpReturnValue %95
OpFunctionEnd OpFunctionEnd
%main = OpFunction %void None %95 %main = OpFunction %void None %96
%98 = OpLabel %99 = OpLabel
%100 = OpLoad %v4float %position_1 %101 = OpLoad %v4float %position_1
%101 = OpLoad %v4float %view_position_1 %102 = OpLoad %v4float %view_position_1
%102 = OpLoad %v4float %normal_1 %103 = OpLoad %v4float %normal_1
%103 = OpLoad %v2float %uv_1 %104 = OpLoad %v2float %uv_1
%104 = OpLoad %v4float %color_1 %105 = OpLoad %v4float %color_1
%105 = OpCompositeConstruct %FragmentInput %100 %101 %102 %103 %104 %106 = OpCompositeConstruct %FragmentInput %101 %102 %103 %104 %105
%99 = OpFunctionCall %FragmentOutput %main_inner %105 %100 = OpFunctionCall %FragmentOutput %main_inner %106
%106 = OpCompositeExtract %v4float %99 0 %107 = OpCompositeExtract %v4float %100 0
OpStore %color_2 %106 OpStore %color_2 %107
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -2,8 +2,12 @@
precision mediump float; precision mediump float;
layout(location = 0) out vec4 x_GLF_color_1_1; layout(location = 0) out vec4 x_GLF_color_1_1;
layout(binding = 0, std140) uniform buf0_ubo { struct buf0 {
vec4 ref; vec4 ref;
};
layout(binding = 0, std140) uniform x_7_block_ubo {
buf0 inner;
} x_7; } x_7;
vec4 x_GLF_color = vec4(0.0f, 0.0f, 0.0f, 0.0f); vec4 x_GLF_color = vec4(0.0f, 0.0f, 0.0f, 0.0f);
@ -17,7 +21,7 @@ void main_1() {
float x_39 = f; float x_39 = f;
v = vec4(sin(x_33), cos(x_35), exp2(x_37), log(x_39)); v = vec4(sin(x_33), cos(x_35), exp2(x_37), log(x_39));
vec4 x_42 = v; vec4 x_42 = v;
vec4 x_44 = x_7.ref; vec4 x_44 = x_7.inner.ref;
if ((distance(x_42, x_44) < 0.100000001f)) { if ((distance(x_42, x_44) < 0.100000001f)) {
x_GLF_color = vec4(1.0f, 0.0f, 0.0f, 1.0f); x_GLF_color = vec4(1.0f, 0.0f, 0.0f, 1.0f);
} else { } else {

View File

@ -1,14 +1,16 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 63 ; Bound: 64
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
%21 = OpExtInstImport "GLSL.std.450" %22 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %x_GLF_color_1_1 OpEntryPoint Fragment %main "main" %x_GLF_color_1_1
OpExecutionMode %main OriginUpperLeft OpExecutionMode %main OriginUpperLeft
OpName %x_GLF_color_1_1 "x_GLF_color_1_1" OpName %x_GLF_color_1_1 "x_GLF_color_1_1"
OpName %x_7_block "x_7_block"
OpMemberName %x_7_block 0 "inner"
OpName %buf0 "buf0" OpName %buf0 "buf0"
OpMemberName %buf0 0 "ref" OpMemberName %buf0 0 "ref"
OpName %x_7 "x_7" OpName %x_7 "x_7"
@ -21,7 +23,8 @@
OpName %main_inner "main_inner" OpName %main_inner "main_inner"
OpName %main "main" OpName %main "main"
OpDecorate %x_GLF_color_1_1 Location 0 OpDecorate %x_GLF_color_1_1 Location 0
OpDecorate %buf0 Block OpDecorate %x_7_block Block
OpMemberDecorate %x_7_block 0 Offset 0
OpMemberDecorate %buf0 0 Offset 0 OpMemberDecorate %buf0 0 Offset 0
OpDecorate %x_7 NonWritable OpDecorate %x_7 NonWritable
OpDecorate %x_7 DescriptorSet 0 OpDecorate %x_7 DescriptorSet 0
@ -33,73 +36,74 @@
%5 = OpConstantNull %v4float %5 = OpConstantNull %v4float
%x_GLF_color_1_1 = OpVariable %_ptr_Output_v4float Output %5 %x_GLF_color_1_1 = OpVariable %_ptr_Output_v4float Output %5
%buf0 = OpTypeStruct %v4float %buf0 = OpTypeStruct %v4float
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 %x_7_block = OpTypeStruct %buf0
%x_7 = OpVariable %_ptr_Uniform_buf0 Uniform %_ptr_Uniform_x_7_block = OpTypePointer Uniform %x_7_block
%x_7 = OpVariable %_ptr_Uniform_x_7_block Uniform
%_ptr_Private_v4float = OpTypePointer Private %v4float %_ptr_Private_v4float = OpTypePointer Private %v4float
%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 %x_GLF_color = OpVariable %_ptr_Private_v4float Private %5
%void = OpTypeVoid %void = OpTypeVoid
%11 = OpTypeFunction %void %12 = OpTypeFunction %void
%_ptr_Function_float = OpTypePointer Function %float %_ptr_Function_float = OpTypePointer Function %float
%17 = OpConstantNull %float %18 = OpConstantNull %float
%_ptr_Function_v4float = OpTypePointer Function %v4float %_ptr_Function_v4float = OpTypePointer Function %v4float
%v3float = OpTypeVector %float 3 %v3float = OpTypeVector %float 3
%mat3v3float = OpTypeMatrix %v3float 3 %mat3v3float = OpTypeMatrix %v3float 3
%float_1 = OpConstant %float 1 %float_1 = OpConstant %float 1
%25 = OpConstantComposite %v3float %float_1 %17 %17 %26 = OpConstantComposite %v3float %float_1 %18 %18
%26 = OpConstantComposite %v3float %17 %float_1 %17 %27 = OpConstantComposite %v3float %18 %float_1 %18
%27 = OpConstantComposite %v3float %17 %17 %float_1 %28 = OpConstantComposite %v3float %18 %18 %float_1
%28 = OpConstantComposite %mat3v3float %25 %26 %27 %29 = OpConstantComposite %mat3v3float %26 %27 %28
%uint = OpTypeInt 32 0 %uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float %_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
%float_0_100000001 = OpConstant %float 0.100000001 %float_0_100000001 = OpConstant %float 0.100000001
%bool = OpTypeBool %bool = OpTypeBool
%51 = OpConstantComposite %v4float %float_1 %17 %17 %float_1 %52 = OpConstantComposite %v4float %float_1 %18 %18 %float_1
%main_out = OpTypeStruct %v4float %main_out = OpTypeStruct %v4float
%52 = OpTypeFunction %main_out %53 = OpTypeFunction %main_out
%main_1 = OpFunction %void None %11 %main_1 = OpFunction %void None %12
%14 = OpLabel %15 = OpLabel
%f = OpVariable %_ptr_Function_float Function %17 %f = OpVariable %_ptr_Function_float Function %18
%v = OpVariable %_ptr_Function_v4float Function %5 %v = OpVariable %_ptr_Function_v4float Function %5
%20 = OpExtInst %float %21 Determinant %28 %21 = OpExtInst %float %22 Determinant %29
OpStore %f %20 OpStore %f %21
%29 = OpLoad %float %f
%30 = OpLoad %float %f %30 = OpLoad %float %f
%31 = OpLoad %float %f %31 = OpLoad %float %f
%32 = OpLoad %float %f %32 = OpLoad %float %f
%33 = OpExtInst %float %21 Sin %29 %33 = OpLoad %float %f
%34 = OpExtInst %float %21 Cos %30 %34 = OpExtInst %float %22 Sin %30
%35 = OpExtInst %float %21 Exp2 %31 %35 = OpExtInst %float %22 Cos %31
%36 = OpExtInst %float %21 Log %32 %36 = OpExtInst %float %22 Exp2 %32
%37 = OpCompositeConstruct %v4float %33 %34 %35 %36 %37 = OpExtInst %float %22 Log %33
OpStore %v %37 %38 = OpCompositeConstruct %v4float %34 %35 %36 %37
%38 = OpLoad %v4float %v OpStore %v %38
%42 = OpAccessChain %_ptr_Uniform_v4float %x_7 %uint_0 %39 = OpLoad %v4float %v
%43 = OpLoad %v4float %42 %43 = OpAccessChain %_ptr_Uniform_v4float %x_7 %uint_0 %uint_0
%44 = OpExtInst %float %21 Distance %38 %43 %44 = OpLoad %v4float %43
%46 = OpFOrdLessThan %bool %44 %float_0_100000001 %45 = OpExtInst %float %22 Distance %39 %44
OpSelectionMerge %48 None %47 = OpFOrdLessThan %bool %45 %float_0_100000001
OpBranchConditional %46 %49 %50 OpSelectionMerge %49 None
%49 = OpLabel OpBranchConditional %47 %50 %51
OpStore %x_GLF_color %51
OpBranch %48
%50 = OpLabel %50 = OpLabel
OpStore %x_GLF_color %52
OpBranch %49
%51 = OpLabel
OpStore %x_GLF_color %5 OpStore %x_GLF_color %5
OpBranch %48 OpBranch %49
%48 = OpLabel %49 = OpLabel
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%main_inner = OpFunction %main_out None %52 %main_inner = OpFunction %main_out None %53
%55 = OpLabel %56 = OpLabel
%56 = OpFunctionCall %void %main_1 %57 = OpFunctionCall %void %main_1
%57 = OpLoad %v4float %x_GLF_color %58 = OpLoad %v4float %x_GLF_color
%58 = OpCompositeConstruct %main_out %57 %59 = OpCompositeConstruct %main_out %58
OpReturnValue %58 OpReturnValue %59
OpFunctionEnd OpFunctionEnd
%main = OpFunction %void None %11 %main = OpFunction %void None %12
%60 = OpLabel %61 = OpLabel
%61 = OpFunctionCall %main_out %main_inner %62 = OpFunctionCall %main_out %main_inner
%62 = OpCompositeExtract %v4float %61 0 %63 = OpCompositeExtract %v4float %62 0
OpStore %x_GLF_color_1_1 %62 OpStore %x_GLF_color_1_1 %63
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -11,8 +11,7 @@ struct strided_arr {
uint pad_2; uint pad_2;
}; };
vec3 position = vec3(0.0f, 0.0f, 0.0f); struct LeftOver {
layout(binding = 2, std140) uniform LeftOver_ubo {
mat4 worldViewProjection; mat4 worldViewProjection;
float time; float time;
uint pad_3; uint pad_3;
@ -20,6 +19,11 @@ layout(binding = 2, std140) uniform LeftOver_ubo {
uint pad_5; uint pad_5;
mat4 test2[2]; mat4 test2[2];
strided_arr test[4]; strided_arr test[4];
};
vec3 position = vec3(0.0f, 0.0f, 0.0f);
layout(binding = 2, std140) uniform x_14_block_ubo {
LeftOver inner;
} x_14; } x_14;
vec2 vUV = vec2(0.0f, 0.0f); vec2 vUV = vec2(0.0f, 0.0f);
@ -34,14 +38,14 @@ void main_1() {
vec4 x_21 = q; vec4 x_21 = q;
p = vec3(x_21.x, x_21.y, x_21.z); p = vec3(x_21.x, x_21.y, x_21.z);
float x_27 = p.x; float x_27 = p.x;
float x_41 = x_14.test[0].el; float x_41 = x_14.inner.test[0].el;
float x_45 = position.y; float x_45 = position.y;
float x_49 = x_14.time; float x_49 = x_14.inner.time;
p.x = (x_27 + sin(((x_41 * x_45) + x_49))); p.x = (x_27 + sin(((x_41 * x_45) + x_49)));
float x_55 = p.y; float x_55 = p.y;
float x_57 = x_14.time; float x_57 = x_14.inner.time;
p.y = (x_55 + sin((x_57 + 4.0f))); p.y = (x_55 + sin((x_57 + 4.0f)));
mat4 x_69 = x_14.worldViewProjection; mat4 x_69 = x_14.inner.worldViewProjection;
vec3 x_70 = p; vec3 x_70 = p;
tint_symbol = (x_69 * vec4(x_70.x, x_70.y, x_70.z, 1.0f)); tint_symbol = (x_69 * vec4(x_70.x, x_70.y, x_70.z, 1.0f));
vec2 x_83 = uv; vec2 x_83 = uv;

View File

@ -1,10 +1,10 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 122 ; Bound: 123
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
%75 = OpExtInstImport "GLSL.std.450" %76 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %main "main" %position_param_1 %uv_param_1 %normal_param_1 %gl_Position_1 %vUV_1_1 %vertex_point_size OpEntryPoint Vertex %main "main" %position_param_1 %uv_param_1 %normal_param_1 %gl_Position_1 %vUV_1_1 %vertex_point_size
OpName %position_param_1 "position_param_1" OpName %position_param_1 "position_param_1"
@ -14,6 +14,8 @@
OpName %vUV_1_1 "vUV_1_1" OpName %vUV_1_1 "vUV_1_1"
OpName %vertex_point_size "vertex_point_size" OpName %vertex_point_size "vertex_point_size"
OpName %position "position" OpName %position "position"
OpName %x_14_block "x_14_block"
OpMemberName %x_14_block 0 "inner"
OpName %LeftOver "LeftOver" OpName %LeftOver "LeftOver"
OpMemberName %LeftOver 0 "worldViewProjection" OpMemberName %LeftOver 0 "worldViewProjection"
OpMemberName %LeftOver 1 "time" OpMemberName %LeftOver 1 "time"
@ -43,7 +45,8 @@
OpDecorate %gl_Position_1 BuiltIn Position OpDecorate %gl_Position_1 BuiltIn Position
OpDecorate %vUV_1_1 Location 0 OpDecorate %vUV_1_1 Location 0
OpDecorate %vertex_point_size BuiltIn PointSize OpDecorate %vertex_point_size BuiltIn PointSize
OpDecorate %LeftOver Block OpDecorate %x_14_block Block
OpMemberDecorate %x_14_block 0 Offset 0
OpMemberDecorate %LeftOver 0 Offset 0 OpMemberDecorate %LeftOver 0 Offset 0
OpMemberDecorate %LeftOver 0 ColMajor OpMemberDecorate %LeftOver 0 ColMajor
OpMemberDecorate %LeftOver 0 MatrixStride 16 OpMemberDecorate %LeftOver 0 MatrixStride 16
@ -89,8 +92,9 @@
%uint_4 = OpConstant %uint 4 %uint_4 = OpConstant %uint 4
%_arr_strided_arr_uint_4 = OpTypeArray %strided_arr %uint_4 %_arr_strided_arr_uint_4 = OpTypeArray %strided_arr %uint_4
%LeftOver = OpTypeStruct %mat4v4float %float %_arr_mat4v4float_uint_2 %_arr_strided_arr_uint_4 %LeftOver = OpTypeStruct %mat4v4float %float %_arr_mat4v4float_uint_2 %_arr_strided_arr_uint_4
%_ptr_Uniform_LeftOver = OpTypePointer Uniform %LeftOver %x_14_block = OpTypeStruct %LeftOver
%x_14 = OpVariable %_ptr_Uniform_LeftOver Uniform %_ptr_Uniform_x_14_block = OpTypePointer Uniform %x_14_block
%x_14 = OpVariable %_ptr_Uniform_x_14_block Uniform
%_ptr_Private_v2float = OpTypePointer Private %v2float %_ptr_Private_v2float = OpTypePointer Private %v2float
%vUV = OpVariable %_ptr_Private_v2float Private %15 %vUV = OpVariable %_ptr_Private_v2float Private %15
%uv = OpVariable %_ptr_Private_v2float Private %15 %uv = OpVariable %_ptr_Private_v2float Private %15
@ -98,7 +102,7 @@
%_ptr_Private_v4float = OpTypePointer Private %v4float %_ptr_Private_v4float = OpTypePointer Private %v4float
%gl_Position = OpVariable %_ptr_Private_v4float Private %12 %gl_Position = OpVariable %_ptr_Private_v4float Private %12
%void = OpTypeVoid %void = OpTypeVoid
%38 = OpTypeFunction %void %39 = OpTypeFunction %void
%_ptr_Function_v4float = OpTypePointer Function %v4float %_ptr_Function_v4float = OpTypePointer Function %v4float
%_ptr_Function_v3float = OpTypePointer Function %v3float %_ptr_Function_v3float = OpTypePointer Function %v3float
%float_1 = OpConstant %float 1 %float_1 = OpConstant %float 1
@ -106,7 +110,7 @@
%_ptr_Function_float = OpTypePointer Function %float %_ptr_Function_float = OpTypePointer Function %float
%uint_3 = OpConstant %uint 3 %uint_3 = OpConstant %uint 3
%int = OpTypeInt 32 1 %int = OpTypeInt 32 1
%63 = OpConstantNull %int %64 = OpConstantNull %int
%_ptr_Uniform_float = OpTypePointer Uniform %float %_ptr_Uniform_float = OpTypePointer Uniform %float
%uint_1 = OpConstant %uint 1 %uint_1 = OpConstant %uint 1
%_ptr_Private_float = OpTypePointer Private %float %_ptr_Private_float = OpTypePointer Private %float
@ -114,88 +118,88 @@
%_ptr_Uniform_mat4v4float = OpTypePointer Uniform %mat4v4float %_ptr_Uniform_mat4v4float = OpTypePointer Uniform %mat4v4float
%float_n1 = OpConstant %float -1 %float_n1 = OpConstant %float -1
%main_out = OpTypeStruct %v4float %v2float %main_out = OpTypeStruct %v4float %v2float
%103 = OpTypeFunction %main_out %v3float %v2float %v3float %104 = OpTypeFunction %main_out %v3float %v2float %v3float
%main_1 = OpFunction %void None %38 %main_1 = OpFunction %void None %39
%41 = OpLabel %42 = OpLabel
%q = OpVariable %_ptr_Function_v4float Function %12 %q = OpVariable %_ptr_Function_v4float Function %12
%p = OpVariable %_ptr_Function_v3float Function %21 %p = OpVariable %_ptr_Function_v3float Function %21
%46 = OpLoad %v3float %position %47 = OpLoad %v3float %position
%47 = OpCompositeExtract %float %46 0 %48 = OpCompositeExtract %float %47 0
%48 = OpCompositeExtract %float %46 1 %49 = OpCompositeExtract %float %47 1
%49 = OpCompositeExtract %float %46 2 %50 = OpCompositeExtract %float %47 2
%51 = OpCompositeConstruct %v4float %47 %48 %49 %float_1 %52 = OpCompositeConstruct %v4float %48 %49 %50 %float_1
OpStore %q %51 OpStore %q %52
%52 = OpLoad %v4float %q %53 = OpLoad %v4float %q
%53 = OpCompositeExtract %float %52 0 %54 = OpCompositeExtract %float %53 0
%54 = OpCompositeExtract %float %52 1 %55 = OpCompositeExtract %float %53 1
%55 = OpCompositeExtract %float %52 2 %56 = OpCompositeExtract %float %53 2
%56 = OpCompositeConstruct %v3float %53 %54 %55 %57 = OpCompositeConstruct %v3float %54 %55 %56
OpStore %p %56 OpStore %p %57
%59 = OpAccessChain %_ptr_Function_float %p %uint_0 %60 = OpAccessChain %_ptr_Function_float %p %uint_0
%60 = OpLoad %float %59 %61 = OpLoad %float %60
%65 = OpAccessChain %_ptr_Uniform_float %x_14 %uint_3 %63 %uint_0 %66 = OpAccessChain %_ptr_Uniform_float %x_14 %uint_0 %uint_3 %64 %uint_0
%66 = OpLoad %float %65 %67 = OpLoad %float %66
%69 = OpAccessChain %_ptr_Private_float %position %uint_1 %70 = OpAccessChain %_ptr_Private_float %position %uint_1
%70 = OpLoad %float %69 %71 = OpLoad %float %70
%71 = OpAccessChain %_ptr_Uniform_float %x_14 %uint_1 %72 = OpAccessChain %_ptr_Uniform_float %x_14 %uint_0 %uint_1
%72 = OpLoad %float %71 %73 = OpLoad %float %72
%73 = OpAccessChain %_ptr_Function_float %p %uint_0 %74 = OpAccessChain %_ptr_Function_float %p %uint_0
%76 = OpFMul %float %66 %70 %77 = OpFMul %float %67 %71
%77 = OpFAdd %float %76 %72 %78 = OpFAdd %float %77 %73
%74 = OpExtInst %float %75 Sin %77 %75 = OpExtInst %float %76 Sin %78
%78 = OpFAdd %float %60 %74 %79 = OpFAdd %float %61 %75
OpStore %73 %78 OpStore %74 %79
%79 = OpAccessChain %_ptr_Function_float %p %uint_1 %80 = OpAccessChain %_ptr_Function_float %p %uint_1
%80 = OpLoad %float %79 %81 = OpLoad %float %80
%81 = OpAccessChain %_ptr_Uniform_float %x_14 %uint_1 %82 = OpAccessChain %_ptr_Uniform_float %x_14 %uint_0 %uint_1
%82 = OpLoad %float %81 %83 = OpLoad %float %82
%83 = OpAccessChain %_ptr_Function_float %p %uint_1 %84 = OpAccessChain %_ptr_Function_float %p %uint_1
%86 = OpFAdd %float %82 %float_4 %87 = OpFAdd %float %83 %float_4
%84 = OpExtInst %float %75 Sin %86 %85 = OpExtInst %float %76 Sin %87
%87 = OpFAdd %float %80 %84 %88 = OpFAdd %float %81 %85
OpStore %83 %87 OpStore %84 %88
%89 = OpAccessChain %_ptr_Uniform_mat4v4float %x_14 %uint_0 %90 = OpAccessChain %_ptr_Uniform_mat4v4float %x_14 %uint_0 %uint_0
%90 = OpLoad %mat4v4float %89 %91 = OpLoad %mat4v4float %90
%91 = OpLoad %v3float %p %92 = OpLoad %v3float %p
%92 = OpCompositeExtract %float %91 0 %93 = OpCompositeExtract %float %92 0
%93 = OpCompositeExtract %float %91 1 %94 = OpCompositeExtract %float %92 1
%94 = OpCompositeExtract %float %91 2 %95 = OpCompositeExtract %float %92 2
%95 = OpCompositeConstruct %v4float %92 %93 %94 %float_1 %96 = OpCompositeConstruct %v4float %93 %94 %95 %float_1
%96 = OpMatrixTimesVector %v4float %90 %95 %97 = OpMatrixTimesVector %v4float %91 %96
OpStore %gl_Position %96 OpStore %gl_Position %97
%97 = OpLoad %v2float %uv %98 = OpLoad %v2float %uv
OpStore %vUV %97 OpStore %vUV %98
%98 = OpAccessChain %_ptr_Private_float %gl_Position %uint_1 %99 = OpAccessChain %_ptr_Private_float %gl_Position %uint_1
%99 = OpLoad %float %98 %100 = OpLoad %float %99
%100 = OpAccessChain %_ptr_Private_float %gl_Position %uint_1 %101 = OpAccessChain %_ptr_Private_float %gl_Position %uint_1
%102 = OpFMul %float %99 %float_n1 %103 = OpFMul %float %100 %float_n1
OpStore %100 %102 OpStore %101 %103
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%main_inner = OpFunction %main_out None %103 %main_inner = OpFunction %main_out None %104
%position_param = OpFunctionParameter %v3float %position_param = OpFunctionParameter %v3float
%uv_param = OpFunctionParameter %v2float %uv_param = OpFunctionParameter %v2float
%normal_param = OpFunctionParameter %v3float %normal_param = OpFunctionParameter %v3float
%109 = OpLabel %110 = OpLabel
OpStore %position %position_param OpStore %position %position_param
OpStore %uv %uv_param OpStore %uv %uv_param
OpStore %normal %normal_param OpStore %normal %normal_param
%110 = OpFunctionCall %void %main_1 %111 = OpFunctionCall %void %main_1
%111 = OpLoad %v4float %gl_Position %112 = OpLoad %v4float %gl_Position
%112 = OpLoad %v2float %vUV %113 = OpLoad %v2float %vUV
%113 = OpCompositeConstruct %main_out %111 %112 %114 = OpCompositeConstruct %main_out %112 %113
OpReturnValue %113 OpReturnValue %114
OpFunctionEnd OpFunctionEnd
%main = OpFunction %void None %38 %main = OpFunction %void None %39
%115 = OpLabel %116 = OpLabel
%117 = OpLoad %v3float %position_param_1 %118 = OpLoad %v3float %position_param_1
%118 = OpLoad %v2float %uv_param_1 %119 = OpLoad %v2float %uv_param_1
%119 = OpLoad %v3float %normal_param_1 %120 = OpLoad %v3float %normal_param_1
%116 = OpFunctionCall %main_out %main_inner %117 %118 %119 %117 = OpFunctionCall %main_out %main_inner %118 %119 %120
%120 = OpCompositeExtract %v4float %116 0 %121 = OpCompositeExtract %v4float %117 0
OpStore %gl_Position_1 %120 OpStore %gl_Position_1 %121
%121 = OpCompositeExtract %v2float %116 1 %122 = OpCompositeExtract %v2float %117 1
OpStore %vUV_1_1 %121 OpStore %vUV_1_1 %122
OpStore %vertex_point_size %float_1 OpStore %vertex_point_size %float_1
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -1,6 +1,6 @@
#version 310 es #version 310 es
layout(binding = 0, std140) uniform Uniforms_ubo { struct Uniforms {
uint numTriangles; uint numTriangles;
uint gridSize; uint gridSize;
uint pad1; uint pad1;
@ -9,6 +9,25 @@ layout(binding = 0, std140) uniform Uniforms_ubo {
uint pad; uint pad;
vec3 bbMax; vec3 bbMax;
uint pad_1; uint pad_1;
};
struct Dbg {
uint offsetCounter;
uint pad0;
uint pad1;
uint pad2;
uint value0;
uint value1;
uint value2;
uint value3;
float value_f32_0;
float value_f32_1;
float value_f32_2;
float value_f32_3;
};
layout(binding = 0, std140) uniform uniforms_block_ubo {
Uniforms inner;
} uniforms; } uniforms;
layout(binding = 10, std430) buffer U32s_ssbo { layout(binding = 10, std430) buffer U32s_ssbo {
@ -27,30 +46,19 @@ layout(binding = 21, std430) buffer AI32s_ssbo {
int values[]; int values[];
} LUT; } LUT;
layout(binding = 50, std430) buffer Dbg_ssbo { layout(binding = 50, std430) buffer dbg_block_ssbo {
uint offsetCounter; Dbg inner;
uint pad0;
uint pad1;
uint pad2;
uint value0;
uint value1;
uint value2;
uint value3;
float value_f32_0;
float value_f32_1;
float value_f32_2;
float value_f32_3;
} dbg; } dbg;
vec3 toVoxelPos(vec3 position) { vec3 toVoxelPos(vec3 position) {
vec3 bbMin = vec3(uniforms.bbMin.x, uniforms.bbMin.y, uniforms.bbMin.z); vec3 bbMin = vec3(uniforms.inner.bbMin.x, uniforms.inner.bbMin.y, uniforms.inner.bbMin.z);
vec3 bbMax = vec3(uniforms.bbMax.x, uniforms.bbMax.y, uniforms.bbMax.z); vec3 bbMax = vec3(uniforms.inner.bbMax.x, uniforms.inner.bbMax.y, uniforms.inner.bbMax.z);
vec3 bbSize = (bbMax - bbMin); vec3 bbSize = (bbMax - bbMin);
float cubeSize = max(max(bbSize.x, bbSize.y), bbSize.z); float cubeSize = max(max(bbSize.x, bbSize.y), bbSize.z);
float gridSize = float(uniforms.gridSize); float gridSize = float(uniforms.inner.gridSize);
float gx = ((gridSize * (position.x - uniforms.bbMin.x)) / cubeSize); float gx = ((gridSize * (position.x - uniforms.inner.bbMin.x)) / cubeSize);
float gy = ((gridSize * (position.y - uniforms.bbMin.y)) / cubeSize); float gy = ((gridSize * (position.y - uniforms.inner.bbMin.y)) / cubeSize);
float gz = ((gridSize * (position.z - uniforms.bbMin.z)) / cubeSize); float gz = ((gridSize * (position.z - uniforms.inner.bbMin.z)) / cubeSize);
return vec3(gx, gy, gz); return vec3(gx, gy, gz);
} }
@ -65,8 +73,8 @@ vec3 loadPosition(uint vertexIndex) {
} }
void doIgnore() { void doIgnore() {
uint g42 = uniforms.numTriangles; uint g42 = uniforms.inner.numTriangles;
uint kj6 = dbg.value1; uint kj6 = dbg.inner.value1;
uint b53 = atomicOr(counters.values[0], 0u); uint b53 = atomicOr(counters.values[0], 0u);
uint rwg = indices.values[0]; uint rwg = indices.values[0];
float rb5 = positions.values[0]; float rb5 = positions.values[0];
@ -75,7 +83,7 @@ void doIgnore() {
void main_count(uvec3 GlobalInvocationID) { void main_count(uvec3 GlobalInvocationID) {
uint triangleIndex = GlobalInvocationID.x; uint triangleIndex = GlobalInvocationID.x;
if ((triangleIndex >= uniforms.numTriangles)) { if ((triangleIndex >= uniforms.inner.numTriangles)) {
return; return;
} }
doIgnore(); doIgnore();
@ -87,13 +95,13 @@ void main_count(uvec3 GlobalInvocationID) {
vec3 p2 = loadPosition(i2); vec3 p2 = loadPosition(i2);
vec3 center = (((p0 + p1) + p2) / 3.0f); vec3 center = (((p0 + p1) + p2) / 3.0f);
vec3 voxelPos = toVoxelPos(center); vec3 voxelPos = toVoxelPos(center);
uint voxelIndex = toIndex1D(uniforms.gridSize, voxelPos); uint voxelIndex = toIndex1D(uniforms.inner.gridSize, voxelPos);
uint acefg = atomicAdd(counters.values[voxelIndex], 1u); uint acefg = atomicAdd(counters.values[voxelIndex], 1u);
if ((triangleIndex == 0u)) { if ((triangleIndex == 0u)) {
dbg.value0 = uniforms.gridSize; dbg.inner.value0 = uniforms.inner.gridSize;
dbg.value_f32_0 = center.x; dbg.inner.value_f32_0 = center.x;
dbg.value_f32_1 = center.y; dbg.inner.value_f32_1 = center.y;
dbg.value_f32_2 = center.z; dbg.inner.value_f32_2 = center.z;
} }
} }
@ -104,7 +112,7 @@ void main() {
} }
#version 310 es #version 310 es
layout(binding = 0, std140) uniform Uniforms_ubo { struct Uniforms {
uint numTriangles; uint numTriangles;
uint gridSize; uint gridSize;
uint pad1; uint pad1;
@ -113,6 +121,25 @@ layout(binding = 0, std140) uniform Uniforms_ubo {
uint pad; uint pad;
vec3 bbMax; vec3 bbMax;
uint pad_1; uint pad_1;
};
struct Dbg {
uint offsetCounter;
uint pad0;
uint pad1;
uint pad2;
uint value0;
uint value1;
uint value2;
uint value3;
float value_f32_0;
float value_f32_1;
float value_f32_2;
float value_f32_3;
};
layout(binding = 0, std140) uniform uniforms_block_ubo {
Uniforms inner;
} uniforms; } uniforms;
layout(binding = 10, std430) buffer U32s_ssbo { layout(binding = 10, std430) buffer U32s_ssbo {
@ -131,24 +158,13 @@ layout(binding = 21, std430) buffer AI32s_ssbo {
int values[]; int values[];
} LUT; } LUT;
layout(binding = 50, std430) buffer Dbg_ssbo { layout(binding = 50, std430) buffer dbg_block_ssbo {
uint offsetCounter; Dbg inner;
uint pad0;
uint pad1;
uint pad2;
uint value0;
uint value1;
uint value2;
uint value3;
float value_f32_0;
float value_f32_1;
float value_f32_2;
float value_f32_3;
} dbg; } dbg;
void doIgnore() { void doIgnore() {
uint g42 = uniforms.numTriangles; uint g42 = uniforms.inner.numTriangles;
uint kj6 = dbg.value1; uint kj6 = dbg.inner.value1;
uint b53 = atomicOr(counters.values[0], 0u); uint b53 = atomicOr(counters.values[0], 0u);
uint rwg = indices.values[0]; uint rwg = indices.values[0];
float rb5 = positions.values[0]; float rb5 = positions.values[0];
@ -158,14 +174,14 @@ void doIgnore() {
void main_create_lut(uvec3 GlobalInvocationID) { void main_create_lut(uvec3 GlobalInvocationID) {
uint voxelIndex = GlobalInvocationID.x; uint voxelIndex = GlobalInvocationID.x;
doIgnore(); doIgnore();
uint maxVoxels = ((uniforms.gridSize * uniforms.gridSize) * uniforms.gridSize); uint maxVoxels = ((uniforms.inner.gridSize * uniforms.inner.gridSize) * uniforms.inner.gridSize);
if ((voxelIndex >= maxVoxels)) { if ((voxelIndex >= maxVoxels)) {
return; return;
} }
uint numTriangles = atomicOr(counters.values[voxelIndex], 0u); uint numTriangles = atomicOr(counters.values[voxelIndex], 0u);
int offset = -1; int offset = -1;
if ((numTriangles > 0u)) { if ((numTriangles > 0u)) {
uint tint_symbol = atomicAdd(dbg.offsetCounter, numTriangles); uint tint_symbol = atomicAdd(dbg.inner.offsetCounter, numTriangles);
offset = int(tint_symbol); offset = int(tint_symbol);
} }
atomicExchange(LUT.values[voxelIndex], offset); atomicExchange(LUT.values[voxelIndex], offset);
@ -178,7 +194,7 @@ void main() {
} }
#version 310 es #version 310 es
layout(binding = 0, std140) uniform Uniforms_ubo { struct Uniforms {
uint numTriangles; uint numTriangles;
uint gridSize; uint gridSize;
uint pad1; uint pad1;
@ -187,6 +203,25 @@ layout(binding = 0, std140) uniform Uniforms_ubo {
uint pad; uint pad;
vec3 bbMax; vec3 bbMax;
uint pad_1; uint pad_1;
};
struct Dbg {
uint offsetCounter;
uint pad0;
uint pad1;
uint pad2;
uint value0;
uint value1;
uint value2;
uint value3;
float value_f32_0;
float value_f32_1;
float value_f32_2;
float value_f32_3;
};
layout(binding = 0, std140) uniform uniforms_block_ubo {
Uniforms inner;
} uniforms; } uniforms;
layout(binding = 10, std430) buffer U32s_ssbo { layout(binding = 10, std430) buffer U32s_ssbo {
@ -205,30 +240,19 @@ layout(binding = 21, std430) buffer AI32s_ssbo {
int values[]; int values[];
} LUT; } LUT;
layout(binding = 50, std430) buffer Dbg_ssbo { layout(binding = 50, std430) buffer dbg_block_ssbo {
uint offsetCounter; Dbg inner;
uint pad0;
uint pad1;
uint pad2;
uint value0;
uint value1;
uint value2;
uint value3;
float value_f32_0;
float value_f32_1;
float value_f32_2;
float value_f32_3;
} dbg; } dbg;
vec3 toVoxelPos(vec3 position) { vec3 toVoxelPos(vec3 position) {
vec3 bbMin = vec3(uniforms.bbMin.x, uniforms.bbMin.y, uniforms.bbMin.z); vec3 bbMin = vec3(uniforms.inner.bbMin.x, uniforms.inner.bbMin.y, uniforms.inner.bbMin.z);
vec3 bbMax = vec3(uniforms.bbMax.x, uniforms.bbMax.y, uniforms.bbMax.z); vec3 bbMax = vec3(uniforms.inner.bbMax.x, uniforms.inner.bbMax.y, uniforms.inner.bbMax.z);
vec3 bbSize = (bbMax - bbMin); vec3 bbSize = (bbMax - bbMin);
float cubeSize = max(max(bbSize.x, bbSize.y), bbSize.z); float cubeSize = max(max(bbSize.x, bbSize.y), bbSize.z);
float gridSize = float(uniforms.gridSize); float gridSize = float(uniforms.inner.gridSize);
float gx = ((gridSize * (position.x - uniforms.bbMin.x)) / cubeSize); float gx = ((gridSize * (position.x - uniforms.inner.bbMin.x)) / cubeSize);
float gy = ((gridSize * (position.y - uniforms.bbMin.y)) / cubeSize); float gy = ((gridSize * (position.y - uniforms.inner.bbMin.y)) / cubeSize);
float gz = ((gridSize * (position.z - uniforms.bbMin.z)) / cubeSize); float gz = ((gridSize * (position.z - uniforms.inner.bbMin.z)) / cubeSize);
return vec3(gx, gy, gz); return vec3(gx, gy, gz);
} }
@ -243,8 +267,8 @@ vec3 loadPosition(uint vertexIndex) {
} }
void doIgnore() { void doIgnore() {
uint g42 = uniforms.numTriangles; uint g42 = uniforms.inner.numTriangles;
uint kj6 = dbg.value1; uint kj6 = dbg.inner.value1;
uint b53 = atomicOr(counters.values[0], 0u); uint b53 = atomicOr(counters.values[0], 0u);
uint rwg = indices.values[0]; uint rwg = indices.values[0];
float rb5 = positions.values[0]; float rb5 = positions.values[0];
@ -254,7 +278,7 @@ void doIgnore() {
void main_sort_triangles(uvec3 GlobalInvocationID) { void main_sort_triangles(uvec3 GlobalInvocationID) {
uint triangleIndex = GlobalInvocationID.x; uint triangleIndex = GlobalInvocationID.x;
doIgnore(); doIgnore();
if ((triangleIndex >= uniforms.numTriangles)) { if ((triangleIndex >= uniforms.inner.numTriangles)) {
return; return;
} }
uint i0 = indices.values[((3u * triangleIndex) + 0u)]; uint i0 = indices.values[((3u * triangleIndex) + 0u)];
@ -265,7 +289,7 @@ void main_sort_triangles(uvec3 GlobalInvocationID) {
vec3 p2 = loadPosition(i2); vec3 p2 = loadPosition(i2);
vec3 center = (((p0 + p1) + p2) / 3.0f); vec3 center = (((p0 + p1) + p2) / 3.0f);
vec3 voxelPos = toVoxelPos(center); vec3 voxelPos = toVoxelPos(center);
uint voxelIndex = toIndex1D(uniforms.gridSize, voxelPos); uint voxelIndex = toIndex1D(uniforms.inner.gridSize, voxelPos);
int triangleOffset = atomicAdd(LUT.values[voxelIndex], 1); int triangleOffset = atomicAdd(LUT.values[voxelIndex], 1);
} }

View File

@ -1,10 +1,10 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 402 ; Bound: 404
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
%65 = OpExtInstImport "GLSL.std.450" %67 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main_count "main_count" %GlobalInvocationID_1 OpEntryPoint GLCompute %main_count "main_count" %GlobalInvocationID_1
OpEntryPoint GLCompute %main_create_lut "main_create_lut" %GlobalInvocationID_2 OpEntryPoint GLCompute %main_create_lut "main_create_lut" %GlobalInvocationID_2
@ -15,6 +15,8 @@
OpName %GlobalInvocationID_1 "GlobalInvocationID_1" OpName %GlobalInvocationID_1 "GlobalInvocationID_1"
OpName %GlobalInvocationID_2 "GlobalInvocationID_2" OpName %GlobalInvocationID_2 "GlobalInvocationID_2"
OpName %GlobalInvocationID_3 "GlobalInvocationID_3" OpName %GlobalInvocationID_3 "GlobalInvocationID_3"
OpName %uniforms_block "uniforms_block"
OpMemberName %uniforms_block 0 "inner"
OpName %Uniforms "Uniforms" OpName %Uniforms "Uniforms"
OpMemberName %Uniforms 0 "numTriangles" OpMemberName %Uniforms 0 "numTriangles"
OpMemberName %Uniforms 1 "gridSize" OpMemberName %Uniforms 1 "gridSize"
@ -35,6 +37,8 @@
OpName %AI32s "AI32s" OpName %AI32s "AI32s"
OpMemberName %AI32s 0 "values" OpMemberName %AI32s 0 "values"
OpName %LUT "LUT" OpName %LUT "LUT"
OpName %dbg_block "dbg_block"
OpMemberName %dbg_block 0 "inner"
OpName %Dbg "Dbg" OpName %Dbg "Dbg"
OpMemberName %Dbg 0 "offsetCounter" OpMemberName %Dbg 0 "offsetCounter"
OpMemberName %Dbg 1 "pad0" OpMemberName %Dbg 1 "pad0"
@ -117,7 +121,8 @@
OpDecorate %GlobalInvocationID_1 BuiltIn GlobalInvocationId OpDecorate %GlobalInvocationID_1 BuiltIn GlobalInvocationId
OpDecorate %GlobalInvocationID_2 BuiltIn GlobalInvocationId OpDecorate %GlobalInvocationID_2 BuiltIn GlobalInvocationId
OpDecorate %GlobalInvocationID_3 BuiltIn GlobalInvocationId OpDecorate %GlobalInvocationID_3 BuiltIn GlobalInvocationId
OpDecorate %Uniforms Block OpDecorate %uniforms_block Block
OpMemberDecorate %uniforms_block 0 Offset 0
OpMemberDecorate %Uniforms 0 Offset 0 OpMemberDecorate %Uniforms 0 Offset 0
OpMemberDecorate %Uniforms 1 Offset 4 OpMemberDecorate %Uniforms 1 Offset 4
OpMemberDecorate %Uniforms 2 Offset 8 OpMemberDecorate %Uniforms 2 Offset 8
@ -147,7 +152,8 @@
OpDecorate %_runtimearr_int ArrayStride 4 OpDecorate %_runtimearr_int ArrayStride 4
OpDecorate %LUT Binding 21 OpDecorate %LUT Binding 21
OpDecorate %LUT DescriptorSet 0 OpDecorate %LUT DescriptorSet 0
OpDecorate %Dbg Block OpDecorate %dbg_block Block
OpMemberDecorate %dbg_block 0 Offset 0
OpMemberDecorate %Dbg 0 Offset 0 OpMemberDecorate %Dbg 0 Offset 0
OpMemberDecorate %Dbg 1 Offset 4 OpMemberDecorate %Dbg 1 Offset 4
OpMemberDecorate %Dbg 2 Offset 8 OpMemberDecorate %Dbg 2 Offset 8
@ -171,8 +177,9 @@
%float = OpTypeFloat 32 %float = OpTypeFloat 32
%v3float = OpTypeVector %float 3 %v3float = OpTypeVector %float 3
%Uniforms = OpTypeStruct %uint %uint %uint %uint %v3float %v3float %Uniforms = OpTypeStruct %uint %uint %uint %uint %v3float %v3float
%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms %uniforms_block = OpTypeStruct %Uniforms
%uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform %_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block
%uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform
%_runtimearr_uint = OpTypeRuntimeArray %uint %_runtimearr_uint = OpTypeRuntimeArray %uint
%U32s = OpTypeStruct %_runtimearr_uint %U32s = OpTypeStruct %_runtimearr_uint
%_ptr_StorageBuffer_U32s = OpTypePointer StorageBuffer %U32s %_ptr_StorageBuffer_U32s = OpTypePointer StorageBuffer %U32s
@ -191,37 +198,38 @@
%_ptr_StorageBuffer_AI32s = OpTypePointer StorageBuffer %AI32s %_ptr_StorageBuffer_AI32s = OpTypePointer StorageBuffer %AI32s
%LUT = OpVariable %_ptr_StorageBuffer_AI32s StorageBuffer %LUT = OpVariable %_ptr_StorageBuffer_AI32s StorageBuffer
%Dbg = OpTypeStruct %uint %uint %uint %uint %uint %uint %uint %uint %float %float %float %float %Dbg = OpTypeStruct %uint %uint %uint %uint %uint %uint %uint %uint %float %float %float %float
%_ptr_StorageBuffer_Dbg = OpTypePointer StorageBuffer %Dbg %dbg_block = OpTypeStruct %Dbg
%dbg = OpVariable %_ptr_StorageBuffer_Dbg StorageBuffer %_ptr_StorageBuffer_dbg_block = OpTypePointer StorageBuffer %dbg_block
%32 = OpTypeFunction %v3float %v3float %dbg = OpVariable %_ptr_StorageBuffer_dbg_block StorageBuffer
%uint_4 = OpConstant %uint 4 %34 = OpTypeFunction %v3float %v3float
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%uint_4 = OpConstant %uint 4
%_ptr_Uniform_float = OpTypePointer Uniform %float %_ptr_Uniform_float = OpTypePointer Uniform %float
%uint_1 = OpConstant %uint 1 %uint_1 = OpConstant %uint 1
%uint_2 = OpConstant %uint 2 %uint_2 = OpConstant %uint 2
%_ptr_Function_v3float = OpTypePointer Function %v3float %_ptr_Function_v3float = OpTypePointer Function %v3float
%50 = OpConstantNull %v3float %52 = OpConstantNull %v3float
%uint_5 = OpConstant %uint 5 %uint_5 = OpConstant %uint 5
%_ptr_Function_float = OpTypePointer Function %float %_ptr_Function_float = OpTypePointer Function %float
%75 = OpConstantNull %float %77 = OpConstantNull %float
%_ptr_Uniform_uint = OpTypePointer Uniform %uint %_ptr_Uniform_uint = OpTypePointer Uniform %uint
%112 = OpTypeFunction %uint %uint %v3float %114 = OpTypeFunction %uint %uint %v3float
%_ptr_Function_v3uint = OpTypePointer Function %v3uint %_ptr_Function_v3uint = OpTypePointer Function %v3uint
%120 = OpConstantNull %v3uint %122 = OpConstantNull %v3uint
%_ptr_Function_uint = OpTypePointer Function %uint %_ptr_Function_uint = OpTypePointer Function %uint
%133 = OpTypeFunction %v3uint %uint %uint %135 = OpTypeFunction %v3uint %uint %uint
%141 = OpConstantNull %uint %143 = OpConstantNull %uint
%154 = OpTypeFunction %v3float %uint %156 = OpTypeFunction %v3float %uint
%uint_3 = OpConstant %uint 3 %uint_3 = OpConstant %uint 3
%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float %_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
%void = OpTypeVoid %void = OpTypeVoid
%175 = OpTypeFunction %void %177 = OpTypeFunction %void
%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
%188 = OpConstantNull %int %190 = OpConstantNull %int
%_ptr_StorageBuffer_uint_0 = OpTypePointer StorageBuffer %uint %_ptr_StorageBuffer_uint_0 = OpTypePointer StorageBuffer %uint
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%_ptr_Function_int = OpTypePointer Function %int %_ptr_Function_int = OpTypePointer Function %int
%204 = OpTypeFunction %void %v3uint %206 = OpTypeFunction %void %v3uint
%bool = OpTypeBool %bool = OpTypeBool
%float_3 = OpConstant %float 3 %float_3 = OpConstant %float 3
%uint_8 = OpConstant %uint 8 %uint_8 = OpConstant %uint 8
@ -229,416 +237,416 @@
%uint_10 = OpConstant %uint 10 %uint_10 = OpConstant %uint 10
%int_n1 = OpConstant %int -1 %int_n1 = OpConstant %int -1
%int_1 = OpConstant %int 1 %int_1 = OpConstant %int 1
%toVoxelPos = OpFunction %v3float None %32 %toVoxelPos = OpFunction %v3float None %34
%position = OpFunctionParameter %v3float %position = OpFunctionParameter %v3float
%35 = OpLabel %37 = OpLabel
%bbMin = OpVariable %_ptr_Function_v3float Function %50 %bbMin = OpVariable %_ptr_Function_v3float Function %52
%bbMax = OpVariable %_ptr_Function_v3float Function %50 %bbMax = OpVariable %_ptr_Function_v3float Function %52
%bbSize = OpVariable %_ptr_Function_v3float Function %50 %bbSize = OpVariable %_ptr_Function_v3float Function %52
%cubeSize = OpVariable %_ptr_Function_float Function %75 %cubeSize = OpVariable %_ptr_Function_float Function %77
%gridSize = OpVariable %_ptr_Function_float Function %75 %gridSize = OpVariable %_ptr_Function_float Function %77
%gx = OpVariable %_ptr_Function_float Function %75 %gx = OpVariable %_ptr_Function_float Function %77
%gy = OpVariable %_ptr_Function_float Function %75 %gy = OpVariable %_ptr_Function_float Function %77
%gz = OpVariable %_ptr_Function_float Function %75 %gz = OpVariable %_ptr_Function_float Function %77
%39 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_4 %uint_0 %41 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_4 %uint_0
%40 = OpLoad %float %39 %42 = OpLoad %float %41
%42 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_4 %uint_1 %44 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_4 %uint_1
%43 = OpLoad %float %42 %45 = OpLoad %float %44
%45 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_4 %uint_2 %47 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_4 %uint_2
%46 = OpLoad %float %45 %48 = OpLoad %float %47
%47 = OpCompositeConstruct %v3float %40 %43 %46 %49 = OpCompositeConstruct %v3float %42 %45 %48
OpStore %bbMin %47 OpStore %bbMin %49
%52 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_5 %uint_0 %54 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_5 %uint_0
%53 = OpLoad %float %52
%54 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_5 %uint_1
%55 = OpLoad %float %54 %55 = OpLoad %float %54
%56 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_5 %uint_2 %56 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_5 %uint_1
%57 = OpLoad %float %56 %57 = OpLoad %float %56
%58 = OpCompositeConstruct %v3float %53 %55 %57 %58 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_5 %uint_2
OpStore %bbMax %58 %59 = OpLoad %float %58
%60 = OpLoad %v3float %bbMax %60 = OpCompositeConstruct %v3float %55 %57 %59
%61 = OpLoad %v3float %bbMin OpStore %bbMax %60
%62 = OpFSub %v3float %60 %61 %62 = OpLoad %v3float %bbMax
OpStore %bbSize %62 %63 = OpLoad %v3float %bbMin
%68 = OpAccessChain %_ptr_Function_float %bbSize %uint_0 %64 = OpFSub %v3float %62 %63
%69 = OpLoad %float %68 OpStore %bbSize %64
%70 = OpAccessChain %_ptr_Function_float %bbSize %uint_1 %70 = OpAccessChain %_ptr_Function_float %bbSize %uint_0
%71 = OpLoad %float %70 %71 = OpLoad %float %70
%66 = OpExtInst %float %65 NMax %69 %71 %72 = OpAccessChain %_ptr_Function_float %bbSize %uint_1
%72 = OpAccessChain %_ptr_Function_float %bbSize %uint_2
%73 = OpLoad %float %72 %73 = OpLoad %float %72
%64 = OpExtInst %float %65 NMax %66 %73 %68 = OpExtInst %float %67 NMax %71 %73
OpStore %cubeSize %64 %74 = OpAccessChain %_ptr_Function_float %bbSize %uint_2
%78 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 %75 = OpLoad %float %74
%79 = OpLoad %uint %78 %66 = OpExtInst %float %67 NMax %68 %75
%76 = OpConvertUToF %float %79 OpStore %cubeSize %66
OpStore %gridSize %76 %80 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1
%81 = OpLoad %float %gridSize %81 = OpLoad %uint %80
%82 = OpCompositeExtract %float %position 0 %78 = OpConvertUToF %float %81
%83 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_4 %uint_0 OpStore %gridSize %78
%84 = OpLoad %float %83 %83 = OpLoad %float %gridSize
%85 = OpFSub %float %82 %84 %84 = OpCompositeExtract %float %position 0
%86 = OpFMul %float %81 %85 %85 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_4 %uint_0
%87 = OpLoad %float %cubeSize %86 = OpLoad %float %85
%88 = OpFDiv %float %86 %87 %87 = OpFSub %float %84 %86
OpStore %gx %88 %88 = OpFMul %float %83 %87
%90 = OpLoad %float %gridSize %89 = OpLoad %float %cubeSize
%91 = OpCompositeExtract %float %position 1 %90 = OpFDiv %float %88 %89
%92 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_4 %uint_1 OpStore %gx %90
%93 = OpLoad %float %92 %92 = OpLoad %float %gridSize
%94 = OpFSub %float %91 %93 %93 = OpCompositeExtract %float %position 1
%95 = OpFMul %float %90 %94 %94 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_4 %uint_1
%96 = OpLoad %float %cubeSize %95 = OpLoad %float %94
%97 = OpFDiv %float %95 %96 %96 = OpFSub %float %93 %95
OpStore %gy %97 %97 = OpFMul %float %92 %96
%99 = OpLoad %float %gridSize %98 = OpLoad %float %cubeSize
%100 = OpCompositeExtract %float %position 2 %99 = OpFDiv %float %97 %98
%101 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_4 %uint_2 OpStore %gy %99
%102 = OpLoad %float %101 %101 = OpLoad %float %gridSize
%103 = OpFSub %float %100 %102 %102 = OpCompositeExtract %float %position 2
%104 = OpFMul %float %99 %103 %103 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_4 %uint_2
%105 = OpLoad %float %cubeSize %104 = OpLoad %float %103
%106 = OpFDiv %float %104 %105 %105 = OpFSub %float %102 %104
OpStore %gz %106 %106 = OpFMul %float %101 %105
%108 = OpLoad %float %gx %107 = OpLoad %float %cubeSize
%109 = OpLoad %float %gy %108 = OpFDiv %float %106 %107
%110 = OpLoad %float %gz OpStore %gz %108
%111 = OpCompositeConstruct %v3float %108 %109 %110 %110 = OpLoad %float %gx
OpReturnValue %111 %111 = OpLoad %float %gy
%112 = OpLoad %float %gz
%113 = OpCompositeConstruct %v3float %110 %111 %112
OpReturnValue %113
OpFunctionEnd OpFunctionEnd
%toIndex1D = OpFunction %uint None %112 %toIndex1D = OpFunction %uint None %114
%gridSize_0 = OpFunctionParameter %uint %gridSize_0 = OpFunctionParameter %uint
%voxelPos = OpFunctionParameter %v3float %voxelPos = OpFunctionParameter %v3float
%116 = OpLabel %118 = OpLabel
%icoord = OpVariable %_ptr_Function_v3uint Function %120 %icoord = OpVariable %_ptr_Function_v3uint Function %122
%117 = OpConvertFToU %v3uint %voxelPos %119 = OpConvertFToU %v3uint %voxelPos
OpStore %icoord %117 OpStore %icoord %119
%122 = OpAccessChain %_ptr_Function_uint %icoord %uint_0 %124 = OpAccessChain %_ptr_Function_uint %icoord %uint_0
%123 = OpLoad %uint %122
%124 = OpAccessChain %_ptr_Function_uint %icoord %uint_1
%125 = OpLoad %uint %124 %125 = OpLoad %uint %124
%126 = OpIMul %uint %gridSize_0 %125 %126 = OpAccessChain %_ptr_Function_uint %icoord %uint_1
%127 = OpIAdd %uint %123 %126 %127 = OpLoad %uint %126
%128 = OpIMul %uint %gridSize_0 %gridSize_0 %128 = OpIMul %uint %gridSize_0 %127
%129 = OpAccessChain %_ptr_Function_uint %icoord %uint_2 %129 = OpIAdd %uint %125 %128
%130 = OpLoad %uint %129 %130 = OpIMul %uint %gridSize_0 %gridSize_0
%131 = OpIMul %uint %128 %130 %131 = OpAccessChain %_ptr_Function_uint %icoord %uint_2
%132 = OpIAdd %uint %127 %131 %132 = OpLoad %uint %131
OpReturnValue %132 %133 = OpIMul %uint %130 %132
%134 = OpIAdd %uint %129 %133
OpReturnValue %134
OpFunctionEnd OpFunctionEnd
%toIndex3D = OpFunction %v3uint None %133 %toIndex3D = OpFunction %v3uint None %135
%gridSize_1 = OpFunctionParameter %uint %gridSize_1 = OpFunctionParameter %uint
%index = OpFunctionParameter %uint %index = OpFunctionParameter %uint
%137 = OpLabel %139 = OpLabel
%z = OpVariable %_ptr_Function_uint Function %141 %z = OpVariable %_ptr_Function_uint Function %143
%y = OpVariable %_ptr_Function_uint Function %141 %y = OpVariable %_ptr_Function_uint Function %143
%x = OpVariable %_ptr_Function_uint Function %141 %x = OpVariable %_ptr_Function_uint Function %143
%138 = OpIMul %uint %gridSize_1 %gridSize_1 %140 = OpIMul %uint %gridSize_1 %gridSize_1
%139 = OpUDiv %uint %index %138 %141 = OpUDiv %uint %index %140
OpStore %z %139 OpStore %z %141
%142 = OpIMul %uint %gridSize_1 %gridSize_1 %144 = OpIMul %uint %gridSize_1 %gridSize_1
%143 = OpLoad %uint %z %145 = OpLoad %uint %z
%144 = OpIMul %uint %142 %143 %146 = OpIMul %uint %144 %145
%145 = OpISub %uint %index %144 %147 = OpISub %uint %index %146
%146 = OpUDiv %uint %145 %gridSize_1 %148 = OpUDiv %uint %147 %gridSize_1
OpStore %y %146 OpStore %y %148
%148 = OpUMod %uint %index %gridSize_1 %150 = OpUMod %uint %index %gridSize_1
OpStore %x %148 OpStore %x %150
%150 = OpLoad %uint %x %152 = OpLoad %uint %x
%151 = OpLoad %uint %y %153 = OpLoad %uint %y
%152 = OpLoad %uint %z %154 = OpLoad %uint %z
%153 = OpCompositeConstruct %v3uint %150 %151 %152 %155 = OpCompositeConstruct %v3uint %152 %153 %154
OpReturnValue %153 OpReturnValue %155
OpFunctionEnd OpFunctionEnd
%loadPosition = OpFunction %v3float None %154 %loadPosition = OpFunction %v3float None %156
%vertexIndex = OpFunctionParameter %uint %vertexIndex = OpFunctionParameter %uint
%157 = OpLabel %159 = OpLabel
%position_0 = OpVariable %_ptr_Function_v3float Function %50 %position_0 = OpVariable %_ptr_Function_v3float Function %52
%159 = OpIMul %uint %uint_3 %vertexIndex %161 = OpIMul %uint %uint_3 %vertexIndex
%160 = OpIAdd %uint %159 %141 %162 = OpIAdd %uint %161 %143
%162 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %160 %164 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %162
%163 = OpLoad %float %162 %165 = OpLoad %float %164
%164 = OpIMul %uint %uint_3 %vertexIndex %166 = OpIMul %uint %uint_3 %vertexIndex
%165 = OpIAdd %uint %164 %uint_1 %167 = OpIAdd %uint %166 %uint_1
%166 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %165 %168 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %167
%167 = OpLoad %float %166 %169 = OpLoad %float %168
%168 = OpIMul %uint %uint_3 %vertexIndex %170 = OpIMul %uint %uint_3 %vertexIndex
%169 = OpIAdd %uint %168 %uint_2 %171 = OpIAdd %uint %170 %uint_2
%170 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %169 %172 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %171
%171 = OpLoad %float %170 %173 = OpLoad %float %172
%172 = OpCompositeConstruct %v3float %163 %167 %171 %174 = OpCompositeConstruct %v3float %165 %169 %173
OpStore %position_0 %172 OpStore %position_0 %174
%174 = OpLoad %v3float %position_0 %176 = OpLoad %v3float %position_0
OpReturnValue %174 OpReturnValue %176
OpFunctionEnd OpFunctionEnd
%doIgnore = OpFunction %void None %175 %doIgnore = OpFunction %void None %177
%178 = OpLabel %180 = OpLabel
%g42 = OpVariable %_ptr_Function_uint Function %141 %g42 = OpVariable %_ptr_Function_uint Function %143
%kj6 = OpVariable %_ptr_Function_uint Function %141 %kj6 = OpVariable %_ptr_Function_uint Function %143
%b53 = OpVariable %_ptr_Function_uint Function %141 %b53 = OpVariable %_ptr_Function_uint Function %143
%rwg = OpVariable %_ptr_Function_uint Function %141 %rwg = OpVariable %_ptr_Function_uint Function %143
%rb5 = OpVariable %_ptr_Function_float Function %75 %rb5 = OpVariable %_ptr_Function_float Function %77
%g55 = OpVariable %_ptr_Function_int Function %188 %g55 = OpVariable %_ptr_Function_int Function %190
%179 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %181 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0
%180 = OpLoad %uint %179 %182 = OpLoad %uint %181
OpStore %g42 %180 OpStore %g42 %182
%183 = OpAccessChain %_ptr_StorageBuffer_uint %dbg %uint_5 %185 = OpAccessChain %_ptr_StorageBuffer_uint %dbg %uint_0 %uint_5
%184 = OpLoad %uint %183 %186 = OpLoad %uint %185
OpStore %kj6 %184 OpStore %kj6 %186
%190 = OpAccessChain %_ptr_StorageBuffer_uint_0 %counters %uint_0 %188 %192 = OpAccessChain %_ptr_StorageBuffer_uint_0 %counters %uint_0 %190
%186 = OpAtomicLoad %uint %190 %uint_1 %uint_0 %188 = OpAtomicLoad %uint %192 %uint_1 %uint_0
OpStore %b53 %186 OpStore %b53 %188
%192 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %188 %194 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %190
%193 = OpLoad %uint %192 %195 = OpLoad %uint %194
OpStore %rwg %193 OpStore %rwg %195
%195 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %188 %197 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %190
%196 = OpLoad %float %195 %198 = OpLoad %float %197
OpStore %rb5 %196 OpStore %rb5 %198
%201 = OpAccessChain %_ptr_StorageBuffer_int %LUT %uint_0 %188 %203 = OpAccessChain %_ptr_StorageBuffer_int %LUT %uint_0 %190
%198 = OpAtomicLoad %int %201 %uint_1 %uint_0 %200 = OpAtomicLoad %int %203 %uint_1 %uint_0
OpStore %g55 %198 OpStore %g55 %200
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%main_count_inner = OpFunction %void None %204 %main_count_inner = OpFunction %void None %206
%GlobalInvocationID = OpFunctionParameter %v3uint %GlobalInvocationID = OpFunctionParameter %v3uint
%207 = OpLabel %209 = OpLabel
%triangleIndex = OpVariable %_ptr_Function_uint Function %141 %triangleIndex = OpVariable %_ptr_Function_uint Function %143
%i0 = OpVariable %_ptr_Function_uint Function %141 %i0 = OpVariable %_ptr_Function_uint Function %143
%i1 = OpVariable %_ptr_Function_uint Function %141 %i1 = OpVariable %_ptr_Function_uint Function %143
%i2 = OpVariable %_ptr_Function_uint Function %141 %i2 = OpVariable %_ptr_Function_uint Function %143
%p0 = OpVariable %_ptr_Function_v3float Function %50 %p0 = OpVariable %_ptr_Function_v3float Function %52
%p1 = OpVariable %_ptr_Function_v3float Function %50 %p1 = OpVariable %_ptr_Function_v3float Function %52
%p2 = OpVariable %_ptr_Function_v3float Function %50 %p2 = OpVariable %_ptr_Function_v3float Function %52
%252 = OpVariable %_ptr_Function_v3float Function %50 %254 = OpVariable %_ptr_Function_v3float Function %52
%center = OpVariable %_ptr_Function_v3float Function %50 %center = OpVariable %_ptr_Function_v3float Function %52
%voxelPos_0 = OpVariable %_ptr_Function_v3float Function %50 %voxelPos_0 = OpVariable %_ptr_Function_v3float Function %52
%voxelIndex = OpVariable %_ptr_Function_uint Function %141 %voxelIndex = OpVariable %_ptr_Function_uint Function %143
%acefg = OpVariable %_ptr_Function_uint Function %141 %acefg = OpVariable %_ptr_Function_uint Function %143
%208 = OpCompositeExtract %uint %GlobalInvocationID 0 %210 = OpCompositeExtract %uint %GlobalInvocationID 0
OpStore %triangleIndex %208 OpStore %triangleIndex %210
%210 = OpLoad %uint %triangleIndex %212 = OpLoad %uint %triangleIndex
%211 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %213 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0
%212 = OpLoad %uint %211 %214 = OpLoad %uint %213
%213 = OpUGreaterThanEqual %bool %210 %212 %215 = OpUGreaterThanEqual %bool %212 %214
OpSelectionMerge %215 None OpSelectionMerge %217 None
OpBranchConditional %213 %216 %215 OpBranchConditional %215 %218 %217
%216 = OpLabel %218 = OpLabel
OpReturn OpReturn
%215 = OpLabel %217 = OpLabel
%217 = OpFunctionCall %void %doIgnore %219 = OpFunctionCall %void %doIgnore
%218 = OpLoad %uint %triangleIndex %220 = OpLoad %uint %triangleIndex
%219 = OpIMul %uint %uint_3 %218 %221 = OpIMul %uint %uint_3 %220
%220 = OpIAdd %uint %219 %141 %222 = OpIAdd %uint %221 %143
%221 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %220 %223 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %222
%222 = OpLoad %uint %221 %224 = OpLoad %uint %223
OpStore %i0 %222 OpStore %i0 %224
%224 = OpLoad %uint %triangleIndex %226 = OpLoad %uint %triangleIndex
%225 = OpIMul %uint %uint_3 %224 %227 = OpIMul %uint %uint_3 %226
%226 = OpIAdd %uint %225 %uint_1 %228 = OpIAdd %uint %227 %uint_1
%227 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %226 %229 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %228
%228 = OpLoad %uint %227 %230 = OpLoad %uint %229
OpStore %i1 %228 OpStore %i1 %230
%230 = OpLoad %uint %triangleIndex %232 = OpLoad %uint %triangleIndex
%231 = OpIMul %uint %uint_3 %230 %233 = OpIMul %uint %uint_3 %232
%232 = OpIAdd %uint %231 %uint_2 %234 = OpIAdd %uint %233 %uint_2
%233 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %232 %235 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %234
%234 = OpLoad %uint %233 %236 = OpLoad %uint %235
OpStore %i2 %234 OpStore %i2 %236
%237 = OpLoad %uint %i0 %239 = OpLoad %uint %i0
%236 = OpFunctionCall %v3float %loadPosition %237 %238 = OpFunctionCall %v3float %loadPosition %239
OpStore %p0 %236 OpStore %p0 %238
%240 = OpLoad %uint %i1 %242 = OpLoad %uint %i1
%239 = OpFunctionCall %v3float %loadPosition %240 %241 = OpFunctionCall %v3float %loadPosition %242
OpStore %p1 %239 OpStore %p1 %241
%243 = OpLoad %uint %i2 %245 = OpLoad %uint %i2
%242 = OpFunctionCall %v3float %loadPosition %243 %244 = OpFunctionCall %v3float %loadPosition %245
OpStore %p2 %242 OpStore %p2 %244
%245 = OpLoad %v3float %p0 %247 = OpLoad %v3float %p0
%246 = OpLoad %v3float %p1 %248 = OpLoad %v3float %p1
%247 = OpFAdd %v3float %245 %246
%248 = OpLoad %v3float %p2
%249 = OpFAdd %v3float %247 %248 %249 = OpFAdd %v3float %247 %248
%253 = OpCompositeConstruct %v3float %float_3 %float_3 %float_3 %250 = OpLoad %v3float %p2
%251 = OpFDiv %v3float %249 %253 %251 = OpFAdd %v3float %249 %250
OpStore %center %251 %255 = OpCompositeConstruct %v3float %float_3 %float_3 %float_3
%256 = OpLoad %v3float %center %253 = OpFDiv %v3float %251 %255
%255 = OpFunctionCall %v3float %toVoxelPos %256 OpStore %center %253
OpStore %voxelPos_0 %255 %258 = OpLoad %v3float %center
%259 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 %257 = OpFunctionCall %v3float %toVoxelPos %258
%260 = OpLoad %uint %259 OpStore %voxelPos_0 %257
%261 = OpLoad %v3float %voxelPos_0 %261 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1
%258 = OpFunctionCall %uint %toIndex1D %260 %261 %262 = OpLoad %uint %261
OpStore %voxelIndex %258 %263 = OpLoad %v3float %voxelPos_0
%265 = OpLoad %uint %voxelIndex %260 = OpFunctionCall %uint %toIndex1D %262 %263
%266 = OpAccessChain %_ptr_StorageBuffer_uint_0 %counters %uint_0 %265 OpStore %voxelIndex %260
%263 = OpAtomicIAdd %uint %266 %uint_1 %uint_0 %uint_1 %267 = OpLoad %uint %voxelIndex
OpStore %acefg %263 %268 = OpAccessChain %_ptr_StorageBuffer_uint_0 %counters %uint_0 %267
%268 = OpLoad %uint %triangleIndex %265 = OpAtomicIAdd %uint %268 %uint_1 %uint_0 %uint_1
%269 = OpIEqual %bool %268 %141 OpStore %acefg %265
OpSelectionMerge %270 None %270 = OpLoad %uint %triangleIndex
OpBranchConditional %269 %271 %270 %271 = OpIEqual %bool %270 %143
%271 = OpLabel OpSelectionMerge %272 None
%272 = OpAccessChain %_ptr_StorageBuffer_uint %dbg %uint_4 OpBranchConditional %271 %273 %272
%273 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 %273 = OpLabel
%274 = OpLoad %uint %273 %274 = OpAccessChain %_ptr_StorageBuffer_uint %dbg %uint_0 %uint_4
OpStore %272 %274 %275 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1
%276 = OpAccessChain %_ptr_StorageBuffer_float %dbg %uint_8 %276 = OpLoad %uint %275
%277 = OpAccessChain %_ptr_Function_float %center %uint_0 OpStore %274 %276
%278 = OpLoad %float %277 %278 = OpAccessChain %_ptr_StorageBuffer_float %dbg %uint_0 %uint_8
OpStore %276 %278 %279 = OpAccessChain %_ptr_Function_float %center %uint_0
%280 = OpAccessChain %_ptr_StorageBuffer_float %dbg %uint_9 %280 = OpLoad %float %279
%281 = OpAccessChain %_ptr_Function_float %center %uint_1 OpStore %278 %280
%282 = OpLoad %float %281 %282 = OpAccessChain %_ptr_StorageBuffer_float %dbg %uint_0 %uint_9
OpStore %280 %282 %283 = OpAccessChain %_ptr_Function_float %center %uint_1
%284 = OpAccessChain %_ptr_StorageBuffer_float %dbg %uint_10 %284 = OpLoad %float %283
%285 = OpAccessChain %_ptr_Function_float %center %uint_2 OpStore %282 %284
%286 = OpLoad %float %285 %286 = OpAccessChain %_ptr_StorageBuffer_float %dbg %uint_0 %uint_10
OpStore %284 %286 %287 = OpAccessChain %_ptr_Function_float %center %uint_2
OpBranch %270 %288 = OpLoad %float %287
%270 = OpLabel OpStore %286 %288
OpBranch %272
%272 = OpLabel
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%main_count = OpFunction %void None %175 %main_count = OpFunction %void None %177
%288 = OpLabel %290 = OpLabel
%290 = OpLoad %v3uint %GlobalInvocationID_1 %292 = OpLoad %v3uint %GlobalInvocationID_1
%289 = OpFunctionCall %void %main_count_inner %290 %291 = OpFunctionCall %void %main_count_inner %292
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%main_create_lut_inner = OpFunction %void None %204 %main_create_lut_inner = OpFunction %void None %206
%GlobalInvocationID_0 = OpFunctionParameter %v3uint %GlobalInvocationID_0 = OpFunctionParameter %v3uint
%293 = OpLabel %295 = OpLabel
%voxelIndex_0 = OpVariable %_ptr_Function_uint Function %141 %voxelIndex_0 = OpVariable %_ptr_Function_uint Function %143
%maxVoxels = OpVariable %_ptr_Function_uint Function %141 %maxVoxels = OpVariable %_ptr_Function_uint Function %143
%numTriangles = OpVariable %_ptr_Function_uint Function %141 %numTriangles = OpVariable %_ptr_Function_uint Function %143
%offset = OpVariable %_ptr_Function_int Function %188 %offset = OpVariable %_ptr_Function_int Function %190
%294 = OpCompositeExtract %uint %GlobalInvocationID_0 0 %296 = OpCompositeExtract %uint %GlobalInvocationID_0 0
OpStore %voxelIndex_0 %294 OpStore %voxelIndex_0 %296
%296 = OpFunctionCall %void %doIgnore %298 = OpFunctionCall %void %doIgnore
%297 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 %299 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1
%298 = OpLoad %uint %297
%299 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1
%300 = OpLoad %uint %299 %300 = OpLoad %uint %299
%301 = OpIMul %uint %298 %300 %301 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1
%302 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 %302 = OpLoad %uint %301
%303 = OpLoad %uint %302 %303 = OpIMul %uint %300 %302
%304 = OpIMul %uint %301 %303 %304 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1
OpStore %maxVoxels %304 %305 = OpLoad %uint %304
%306 = OpLoad %uint %voxelIndex_0 %306 = OpIMul %uint %303 %305
%307 = OpLoad %uint %maxVoxels OpStore %maxVoxels %306
%308 = OpUGreaterThanEqual %bool %306 %307 %308 = OpLoad %uint %voxelIndex_0
OpSelectionMerge %309 None %309 = OpLoad %uint %maxVoxels
OpBranchConditional %308 %310 %309 %310 = OpUGreaterThanEqual %bool %308 %309
%310 = OpLabel OpSelectionMerge %311 None
OpBranchConditional %310 %312 %311
%312 = OpLabel
OpReturn OpReturn
%309 = OpLabel %311 = OpLabel
%313 = OpLoad %uint %voxelIndex_0 %315 = OpLoad %uint %voxelIndex_0
%314 = OpAccessChain %_ptr_StorageBuffer_uint_0 %counters %uint_0 %313 %316 = OpAccessChain %_ptr_StorageBuffer_uint_0 %counters %uint_0 %315
%311 = OpAtomicLoad %uint %314 %uint_1 %uint_0 %313 = OpAtomicLoad %uint %316 %uint_1 %uint_0
OpStore %numTriangles %311 OpStore %numTriangles %313
OpStore %offset %int_n1 OpStore %offset %int_n1
%318 = OpLoad %uint %numTriangles %320 = OpLoad %uint %numTriangles
%319 = OpUGreaterThan %bool %318 %141 %321 = OpUGreaterThan %bool %320 %143
OpSelectionMerge %320 None OpSelectionMerge %322 None
OpBranchConditional %319 %321 %320 OpBranchConditional %321 %323 %322
%321 = OpLabel %323 = OpLabel
%324 = OpAccessChain %_ptr_StorageBuffer_uint_0 %dbg %uint_0 %326 = OpAccessChain %_ptr_StorageBuffer_uint_0 %dbg %uint_0 %uint_0
%325 = OpLoad %uint %numTriangles %327 = OpLoad %uint %numTriangles
%322 = OpAtomicIAdd %uint %324 %uint_1 %uint_0 %325 %324 = OpAtomicIAdd %uint %326 %uint_1 %uint_0 %327
%326 = OpBitcast %int %322 %328 = OpBitcast %int %324
OpStore %offset %326 OpStore %offset %328
OpBranch %320 OpBranch %322
%320 = OpLabel %322 = OpLabel
%329 = OpLoad %uint %voxelIndex_0 %331 = OpLoad %uint %voxelIndex_0
%330 = OpAccessChain %_ptr_StorageBuffer_int %LUT %uint_0 %329 %332 = OpAccessChain %_ptr_StorageBuffer_int %LUT %uint_0 %331
%331 = OpLoad %int %offset %333 = OpLoad %int %offset
OpAtomicStore %330 %uint_1 %uint_0 %331 OpAtomicStore %332 %uint_1 %uint_0 %333
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%main_create_lut = OpFunction %void None %175 %main_create_lut = OpFunction %void None %177
%333 = OpLabel %335 = OpLabel
%335 = OpLoad %v3uint %GlobalInvocationID_2 %337 = OpLoad %v3uint %GlobalInvocationID_2
%334 = OpFunctionCall %void %main_create_lut_inner %335 %336 = OpFunctionCall %void %main_create_lut_inner %337
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%main_sort_triangles_inner = OpFunction %void None %204 %main_sort_triangles_inner = OpFunction %void None %206
%GlobalInvocationID_4 = OpFunctionParameter %v3uint %GlobalInvocationID_4 = OpFunctionParameter %v3uint
%338 = OpLabel %340 = OpLabel
%triangleIndex_0 = OpVariable %_ptr_Function_uint Function %141 %triangleIndex_0 = OpVariable %_ptr_Function_uint Function %143
%i0_0 = OpVariable %_ptr_Function_uint Function %141 %i0_0 = OpVariable %_ptr_Function_uint Function %143
%i1_0 = OpVariable %_ptr_Function_uint Function %141 %i1_0 = OpVariable %_ptr_Function_uint Function %143
%i2_0 = OpVariable %_ptr_Function_uint Function %141 %i2_0 = OpVariable %_ptr_Function_uint Function %143
%p0_0 = OpVariable %_ptr_Function_v3float Function %50 %p0_0 = OpVariable %_ptr_Function_v3float Function %52
%p1_0 = OpVariable %_ptr_Function_v3float Function %50 %p1_0 = OpVariable %_ptr_Function_v3float Function %52
%p2_0 = OpVariable %_ptr_Function_v3float Function %50 %p2_0 = OpVariable %_ptr_Function_v3float Function %52
%381 = OpVariable %_ptr_Function_v3float Function %50 %383 = OpVariable %_ptr_Function_v3float Function %52
%center_0 = OpVariable %_ptr_Function_v3float Function %50 %center_0 = OpVariable %_ptr_Function_v3float Function %52
%voxelPos_1 = OpVariable %_ptr_Function_v3float Function %50 %voxelPos_1 = OpVariable %_ptr_Function_v3float Function %52
%voxelIndex_1 = OpVariable %_ptr_Function_uint Function %141 %voxelIndex_1 = OpVariable %_ptr_Function_uint Function %143
%triangleOffset = OpVariable %_ptr_Function_int Function %188 %triangleOffset = OpVariable %_ptr_Function_int Function %190
%339 = OpCompositeExtract %uint %GlobalInvocationID_4 0 %341 = OpCompositeExtract %uint %GlobalInvocationID_4 0
OpStore %triangleIndex_0 %339 OpStore %triangleIndex_0 %341
%341 = OpFunctionCall %void %doIgnore %343 = OpFunctionCall %void %doIgnore
%342 = OpLoad %uint %triangleIndex_0 %344 = OpLoad %uint %triangleIndex_0
%343 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %345 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0
%344 = OpLoad %uint %343 %346 = OpLoad %uint %345
%345 = OpUGreaterThanEqual %bool %342 %344 %347 = OpUGreaterThanEqual %bool %344 %346
OpSelectionMerge %346 None OpSelectionMerge %348 None
OpBranchConditional %345 %347 %346 OpBranchConditional %347 %349 %348
%347 = OpLabel %349 = OpLabel
OpReturn OpReturn
%346 = OpLabel %348 = OpLabel
%348 = OpLoad %uint %triangleIndex_0 %350 = OpLoad %uint %triangleIndex_0
%349 = OpIMul %uint %uint_3 %348 %351 = OpIMul %uint %uint_3 %350
%350 = OpIAdd %uint %349 %141 %352 = OpIAdd %uint %351 %143
%351 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %350 %353 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %352
%352 = OpLoad %uint %351 %354 = OpLoad %uint %353
OpStore %i0_0 %352 OpStore %i0_0 %354
%354 = OpLoad %uint %triangleIndex_0 %356 = OpLoad %uint %triangleIndex_0
%355 = OpIMul %uint %uint_3 %354 %357 = OpIMul %uint %uint_3 %356
%356 = OpIAdd %uint %355 %uint_1 %358 = OpIAdd %uint %357 %uint_1
%357 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %356 %359 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %358
%358 = OpLoad %uint %357 %360 = OpLoad %uint %359
OpStore %i1_0 %358 OpStore %i1_0 %360
%360 = OpLoad %uint %triangleIndex_0 %362 = OpLoad %uint %triangleIndex_0
%361 = OpIMul %uint %uint_3 %360 %363 = OpIMul %uint %uint_3 %362
%362 = OpIAdd %uint %361 %uint_2 %364 = OpIAdd %uint %363 %uint_2
%363 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %362 %365 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %364
%364 = OpLoad %uint %363 %366 = OpLoad %uint %365
OpStore %i2_0 %364 OpStore %i2_0 %366
%367 = OpLoad %uint %i0_0 %369 = OpLoad %uint %i0_0
%366 = OpFunctionCall %v3float %loadPosition %367 %368 = OpFunctionCall %v3float %loadPosition %369
OpStore %p0_0 %366 OpStore %p0_0 %368
%370 = OpLoad %uint %i1_0 %372 = OpLoad %uint %i1_0
%369 = OpFunctionCall %v3float %loadPosition %370 %371 = OpFunctionCall %v3float %loadPosition %372
OpStore %p1_0 %369 OpStore %p1_0 %371
%373 = OpLoad %uint %i2_0 %375 = OpLoad %uint %i2_0
%372 = OpFunctionCall %v3float %loadPosition %373 %374 = OpFunctionCall %v3float %loadPosition %375
OpStore %p2_0 %372 OpStore %p2_0 %374
%375 = OpLoad %v3float %p0_0 %377 = OpLoad %v3float %p0_0
%376 = OpLoad %v3float %p1_0 %378 = OpLoad %v3float %p1_0
%377 = OpFAdd %v3float %375 %376
%378 = OpLoad %v3float %p2_0
%379 = OpFAdd %v3float %377 %378 %379 = OpFAdd %v3float %377 %378
%382 = OpCompositeConstruct %v3float %float_3 %float_3 %float_3 %380 = OpLoad %v3float %p2_0
%380 = OpFDiv %v3float %379 %382 %381 = OpFAdd %v3float %379 %380
OpStore %center_0 %380 %384 = OpCompositeConstruct %v3float %float_3 %float_3 %float_3
%385 = OpLoad %v3float %center_0 %382 = OpFDiv %v3float %381 %384
%384 = OpFunctionCall %v3float %toVoxelPos %385 OpStore %center_0 %382
OpStore %voxelPos_1 %384 %387 = OpLoad %v3float %center_0
%388 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 %386 = OpFunctionCall %v3float %toVoxelPos %387
%389 = OpLoad %uint %388 OpStore %voxelPos_1 %386
%390 = OpLoad %v3float %voxelPos_1 %390 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1
%387 = OpFunctionCall %uint %toIndex1D %389 %390 %391 = OpLoad %uint %390
OpStore %voxelIndex_1 %387 %392 = OpLoad %v3float %voxelPos_1
%394 = OpLoad %uint %voxelIndex_1 %389 = OpFunctionCall %uint %toIndex1D %391 %392
%395 = OpAccessChain %_ptr_StorageBuffer_int %LUT %uint_0 %394 OpStore %voxelIndex_1 %389
%392 = OpAtomicIAdd %int %395 %uint_1 %uint_0 %int_1 %396 = OpLoad %uint %voxelIndex_1
OpStore %triangleOffset %392 %397 = OpAccessChain %_ptr_StorageBuffer_int %LUT %uint_0 %396
%394 = OpAtomicIAdd %int %397 %uint_1 %uint_0 %int_1
OpStore %triangleOffset %394
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%main_sort_triangles = OpFunction %void None %175 %main_sort_triangles = OpFunction %void None %177
%399 = OpLabel %401 = OpLabel
%401 = OpLoad %v3uint %GlobalInvocationID_3 %403 = OpLoad %v3uint %GlobalInvocationID_3
%400 = OpFunctionCall %void %main_sort_triangles_inner %401 %402 = OpFunctionCall %void %main_sort_triangles_inner %403
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -4,25 +4,37 @@ precision mediump float;
layout(location = 2) in float fClipDistance3_param_1; layout(location = 2) in float fClipDistance3_param_1;
layout(location = 3) in float fClipDistance4_param_1; layout(location = 3) in float fClipDistance4_param_1;
layout(location = 0) out vec4 glFragColor_1_1; layout(location = 0) out vec4 glFragColor_1_1;
float fClipDistance3 = 0.0f; struct Scene {
float fClipDistance4 = 0.0f;
layout(binding = 0, std140) uniform Scene_ubo {
vec4 vEyePosition; vec4 vEyePosition;
} x_29; };
layout(binding = 1, std140) uniform Material_ubo { struct Material {
vec4 vDiffuseColor; vec4 vDiffuseColor;
vec3 vAmbientColor; vec3 vAmbientColor;
float placeholder; float placeholder;
vec3 vEmissiveColor; vec3 vEmissiveColor;
float placeholder2; float placeholder2;
} x_49; };
layout(binding = 2, std140) uniform Mesh_ubo { struct Mesh {
float visibility; float visibility;
uint pad; uint pad;
uint pad_1; uint pad_1;
uint pad_2; uint pad_2;
};
float fClipDistance3 = 0.0f;
float fClipDistance4 = 0.0f;
layout(binding = 0, std140) uniform x_29_block_ubo {
Scene inner;
} x_29;
layout(binding = 1, std140) uniform x_49_block_ubo {
Material inner;
} x_49;
layout(binding = 2, std140) uniform x_137_block_ubo {
Mesh inner;
} x_137; } x_137;
vec4 glFragColor = vec4(0.0f, 0.0f, 0.0f, 0.0f); vec4 glFragColor = vec4(0.0f, 0.0f, 0.0f, 0.0f);
@ -54,13 +66,13 @@ void main_1() {
tint_discard = true; tint_discard = true;
return; return;
} }
vec4 x_34 = x_29.vEyePosition; vec4 x_34 = x_29.inner.vEyePosition;
vec3 x_38 = vec3(0.0f); vec3 x_38 = vec3(0.0f);
viewDirectionW = normalize((vec3(x_34.x, x_34.y, x_34.z) - x_38)); viewDirectionW = normalize((vec3(x_34.x, x_34.y, x_34.z) - x_38));
baseColor = vec4(1.0f); baseColor = vec4(1.0f);
vec4 x_52 = x_49.vDiffuseColor; vec4 x_52 = x_49.inner.vDiffuseColor;
diffuseColor = vec3(x_52.x, x_52.y, x_52.z); diffuseColor = vec3(x_52.x, x_52.y, x_52.z);
float x_60 = x_49.vDiffuseColor.w; float x_60 = x_49.inner.vDiffuseColor.w;
alpha = x_60; alpha = x_60;
vec3 x_62 = vec3(0.0f); vec3 x_62 = vec3(0.0f);
vec3 x_64 = vec3(0.0f); vec3 x_64 = vec3(0.0f);
@ -76,12 +88,12 @@ void main_1() {
shadow = 1.0f; shadow = 1.0f;
refractionColor = vec4(0.0f, 0.0f, 0.0f, 1.0f); refractionColor = vec4(0.0f, 0.0f, 0.0f, 1.0f);
reflectionColor = vec4(0.0f, 0.0f, 0.0f, 1.0f); reflectionColor = vec4(0.0f, 0.0f, 0.0f, 1.0f);
vec3 x_94 = x_49.vEmissiveColor; vec3 x_94 = x_49.inner.vEmissiveColor;
emissiveColor = x_94; emissiveColor = x_94;
vec3 x_96 = diffuseBase; vec3 x_96 = diffuseBase;
vec3 x_97 = diffuseColor; vec3 x_97 = diffuseColor;
vec3 x_99 = emissiveColor; vec3 x_99 = emissiveColor;
vec3 x_103 = x_49.vAmbientColor; vec3 x_103 = x_49.inner.vAmbientColor;
vec4 x_108 = baseColor; vec4 x_108 = baseColor;
finalDiffuse = (clamp((((x_96 * x_97) + x_99) + x_103), vec3(0.0f), vec3(1.0f)) * vec3(x_108.x, x_108.y, x_108.z)); finalDiffuse = (clamp((((x_96 * x_97) + x_99) + x_103), vec3(0.0f), vec3(1.0f)) * vec3(x_108.x, x_108.y, x_108.z));
finalSpecular = vec3(0.0f); finalSpecular = vec3(0.0f);
@ -97,7 +109,7 @@ void main_1() {
vec3 x_132 = max(vec3(x_129.x, x_129.y, x_129.z), vec3(0.0f)); vec3 x_132 = max(vec3(x_129.x, x_129.y, x_129.z), vec3(0.0f));
vec4 x_133 = color; vec4 x_133 = color;
color = vec4(x_132.x, x_132.y, x_132.z, x_133.w); color = vec4(x_132.x, x_132.y, x_132.z, x_133.w);
float x_140 = x_137.visibility; float x_140 = x_137.inner.visibility;
float x_142 = color.w; float x_142 = color.w;
color.w = (x_142 * x_140); color.w = (x_142 * x_140);
vec4 x_147 = color; vec4 x_147 = color;

View File

@ -1,10 +1,10 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 199 ; Bound: 202
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
%81 = OpExtInstImport "GLSL.std.450" %84 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %fClipDistance3_param_1 %fClipDistance4_param_1 %glFragColor_1_1 OpEntryPoint Fragment %main "main" %fClipDistance3_param_1 %fClipDistance4_param_1 %glFragColor_1_1
OpExecutionMode %main OriginUpperLeft OpExecutionMode %main OriginUpperLeft
@ -13,9 +13,13 @@
OpName %glFragColor_1_1 "glFragColor_1_1" OpName %glFragColor_1_1 "glFragColor_1_1"
OpName %fClipDistance3 "fClipDistance3" OpName %fClipDistance3 "fClipDistance3"
OpName %fClipDistance4 "fClipDistance4" OpName %fClipDistance4 "fClipDistance4"
OpName %x_29_block "x_29_block"
OpMemberName %x_29_block 0 "inner"
OpName %Scene "Scene" OpName %Scene "Scene"
OpMemberName %Scene 0 "vEyePosition" OpMemberName %Scene 0 "vEyePosition"
OpName %x_29 "x_29" OpName %x_29 "x_29"
OpName %x_49_block "x_49_block"
OpMemberName %x_49_block 0 "inner"
OpName %Material "Material" OpName %Material "Material"
OpMemberName %Material 0 "vDiffuseColor" OpMemberName %Material 0 "vDiffuseColor"
OpMemberName %Material 1 "vAmbientColor" OpMemberName %Material 1 "vAmbientColor"
@ -23,6 +27,8 @@
OpMemberName %Material 3 "vEmissiveColor" OpMemberName %Material 3 "vEmissiveColor"
OpMemberName %Material 4 "placeholder2" OpMemberName %Material 4 "placeholder2"
OpName %x_49 "x_49" OpName %x_49 "x_49"
OpName %x_137_block "x_137_block"
OpMemberName %x_137_block 0 "inner"
OpName %Mesh "Mesh" OpName %Mesh "Mesh"
OpMemberName %Mesh 0 "visibility" OpMemberName %Mesh 0 "visibility"
OpName %x_137 "x_137" OpName %x_137 "x_137"
@ -56,12 +62,14 @@
OpDecorate %fClipDistance3_param_1 Location 2 OpDecorate %fClipDistance3_param_1 Location 2
OpDecorate %fClipDistance4_param_1 Location 3 OpDecorate %fClipDistance4_param_1 Location 3
OpDecorate %glFragColor_1_1 Location 0 OpDecorate %glFragColor_1_1 Location 0
OpDecorate %Scene Block OpDecorate %x_29_block Block
OpMemberDecorate %x_29_block 0 Offset 0
OpMemberDecorate %Scene 0 Offset 0 OpMemberDecorate %Scene 0 Offset 0
OpDecorate %x_29 NonWritable OpDecorate %x_29 NonWritable
OpDecorate %x_29 DescriptorSet 0 OpDecorate %x_29 DescriptorSet 0
OpDecorate %x_29 Binding 0 OpDecorate %x_29 Binding 0
OpDecorate %Material Block OpDecorate %x_49_block Block
OpMemberDecorate %x_49_block 0 Offset 0
OpMemberDecorate %Material 0 Offset 0 OpMemberDecorate %Material 0 Offset 0
OpMemberDecorate %Material 1 Offset 16 OpMemberDecorate %Material 1 Offset 16
OpMemberDecorate %Material 2 Offset 28 OpMemberDecorate %Material 2 Offset 28
@ -70,7 +78,8 @@
OpDecorate %x_49 NonWritable OpDecorate %x_49 NonWritable
OpDecorate %x_49 DescriptorSet 0 OpDecorate %x_49 DescriptorSet 0
OpDecorate %x_49 Binding 1 OpDecorate %x_49 Binding 1
OpDecorate %Mesh Block OpDecorate %x_137_block Block
OpMemberDecorate %x_137_block 0 Offset 0
OpMemberDecorate %Mesh 0 Offset 0 OpMemberDecorate %Mesh 0 Offset 0
OpDecorate %x_137 NonWritable OpDecorate %x_137 NonWritable
OpDecorate %x_137 DescriptorSet 0 OpDecorate %x_137 DescriptorSet 0
@ -89,237 +98,240 @@
%fClipDistance3 = OpVariable %_ptr_Private_float Private %11 %fClipDistance3 = OpVariable %_ptr_Private_float Private %11
%fClipDistance4 = OpVariable %_ptr_Private_float Private %11 %fClipDistance4 = OpVariable %_ptr_Private_float Private %11
%Scene = OpTypeStruct %v4float %Scene = OpTypeStruct %v4float
%_ptr_Uniform_Scene = OpTypePointer Uniform %Scene %x_29_block = OpTypeStruct %Scene
%x_29 = OpVariable %_ptr_Uniform_Scene Uniform %_ptr_Uniform_x_29_block = OpTypePointer Uniform %x_29_block
%x_29 = OpVariable %_ptr_Uniform_x_29_block Uniform
%v3float = OpTypeVector %float 3 %v3float = OpTypeVector %float 3
%Material = OpTypeStruct %v4float %v3float %float %v3float %float %Material = OpTypeStruct %v4float %v3float %float %v3float %float
%_ptr_Uniform_Material = OpTypePointer Uniform %Material %x_49_block = OpTypeStruct %Material
%x_49 = OpVariable %_ptr_Uniform_Material Uniform %_ptr_Uniform_x_49_block = OpTypePointer Uniform %x_49_block
%x_49 = OpVariable %_ptr_Uniform_x_49_block Uniform
%Mesh = OpTypeStruct %float %Mesh = OpTypeStruct %float
%_ptr_Uniform_Mesh = OpTypePointer Uniform %Mesh %x_137_block = OpTypeStruct %Mesh
%x_137 = OpVariable %_ptr_Uniform_Mesh Uniform %_ptr_Uniform_x_137_block = OpTypePointer Uniform %x_137_block
%x_137 = OpVariable %_ptr_Uniform_x_137_block Uniform
%_ptr_Private_v4float = OpTypePointer Private %v4float %_ptr_Private_v4float = OpTypePointer Private %v4float
%glFragColor = OpVariable %_ptr_Private_v4float Private %8 %glFragColor = OpVariable %_ptr_Private_v4float Private %8
%bool = OpTypeBool %bool = OpTypeBool
%26 = OpConstantNull %bool %29 = OpConstantNull %bool
%_ptr_Private_bool = OpTypePointer Private %bool %_ptr_Private_bool = OpTypePointer Private %bool
%tint_discard = OpVariable %_ptr_Private_bool Private %26 %tint_discard = OpVariable %_ptr_Private_bool Private %29
%void = OpTypeVoid %void = OpTypeVoid
%29 = OpTypeFunction %void %32 = OpTypeFunction %void
%_ptr_Function_bool = OpTypePointer Function %bool %_ptr_Function_bool = OpTypePointer Function %bool
%_ptr_Function_v3float = OpTypePointer Function %v3float %_ptr_Function_v3float = OpTypePointer Function %v3float
%37 = OpConstantNull %v3float %40 = OpConstantNull %v3float
%_ptr_Function_v4float = OpTypePointer Function %v4float %_ptr_Function_v4float = OpTypePointer Function %v4float
%_ptr_Function_float = OpTypePointer Function %float %_ptr_Function_float = OpTypePointer Function %float
%v2float = OpTypeVector %float 2 %v2float = OpTypeVector %float 2
%_ptr_Function_v2float = OpTypePointer Function %v2float %_ptr_Function_v2float = OpTypePointer Function %v2float
%47 = OpConstantNull %v2float %50 = OpConstantNull %v2float
%true = OpConstantTrue %bool %true = OpConstantTrue %bool
%uint = OpTypeInt 32 0 %uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float %_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
%float_1 = OpConstant %float 1 %float_1 = OpConstant %float 1
%88 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 %91 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
%uint_3 = OpConstant %uint 3 %uint_3 = OpConstant %uint 3
%_ptr_Uniform_float = OpTypePointer Uniform %float %_ptr_Uniform_float = OpTypePointer Uniform %float
%115 = OpConstantComposite %v3float %float_1 %float_1 %float_1 %118 = OpConstantComposite %v3float %float_1 %float_1 %float_1
%116 = OpConstantComposite %v4float %11 %11 %11 %float_1 %119 = OpConstantComposite %v4float %11 %11 %11 %float_1
%_ptr_Uniform_v3float = OpTypePointer Uniform %v3float %_ptr_Uniform_v3float = OpTypePointer Uniform %v3float
%uint_1 = OpConstant %uint 1 %uint_1 = OpConstant %uint 1
%main_out = OpTypeStruct %v4float %main_out = OpTypeStruct %v4float
%179 = OpTypeFunction %main_out %float %float %182 = OpTypeFunction %main_out %float %float
%190 = OpConstantNull %main_out %193 = OpConstantNull %main_out
%main_1 = OpFunction %void None %29 %main_1 = OpFunction %void None %32
%32 = OpLabel %35 = OpLabel
%tint_return_flag = OpVariable %_ptr_Function_bool Function %26 %tint_return_flag = OpVariable %_ptr_Function_bool Function %29
%viewDirectionW = OpVariable %_ptr_Function_v3float Function %37 %viewDirectionW = OpVariable %_ptr_Function_v3float Function %40
%baseColor = OpVariable %_ptr_Function_v4float Function %8 %baseColor = OpVariable %_ptr_Function_v4float Function %8
%diffuseColor = OpVariable %_ptr_Function_v3float Function %37 %diffuseColor = OpVariable %_ptr_Function_v3float Function %40
%alpha = OpVariable %_ptr_Function_float Function %11 %alpha = OpVariable %_ptr_Function_float Function %11
%normalW = OpVariable %_ptr_Function_v3float Function %37 %normalW = OpVariable %_ptr_Function_v3float Function %40
%uvOffset = OpVariable %_ptr_Function_v2float Function %47 %uvOffset = OpVariable %_ptr_Function_v2float Function %50
%baseAmbientColor = OpVariable %_ptr_Function_v3float Function %37 %baseAmbientColor = OpVariable %_ptr_Function_v3float Function %40
%glossiness = OpVariable %_ptr_Function_float Function %11 %glossiness = OpVariable %_ptr_Function_float Function %11
%diffuseBase = OpVariable %_ptr_Function_v3float Function %37 %diffuseBase = OpVariable %_ptr_Function_v3float Function %40
%shadow = OpVariable %_ptr_Function_float Function %11 %shadow = OpVariable %_ptr_Function_float Function %11
%refractionColor = OpVariable %_ptr_Function_v4float Function %8 %refractionColor = OpVariable %_ptr_Function_v4float Function %8
%reflectionColor = OpVariable %_ptr_Function_v4float Function %8 %reflectionColor = OpVariable %_ptr_Function_v4float Function %8
%emissiveColor = OpVariable %_ptr_Function_v3float Function %37 %emissiveColor = OpVariable %_ptr_Function_v3float Function %40
%finalDiffuse = OpVariable %_ptr_Function_v3float Function %37 %finalDiffuse = OpVariable %_ptr_Function_v3float Function %40
%finalSpecular = OpVariable %_ptr_Function_v3float Function %37 %finalSpecular = OpVariable %_ptr_Function_v3float Function %40
%color = OpVariable %_ptr_Function_v4float Function %8 %color = OpVariable %_ptr_Function_v4float Function %8
%58 = OpLoad %float %fClipDistance3 %61 = OpLoad %float %fClipDistance3
%59 = OpFOrdGreaterThan %bool %58 %11 %62 = OpFOrdGreaterThan %bool %61 %11
OpSelectionMerge %60 None OpSelectionMerge %63 None
OpBranchConditional %59 %61 %60 OpBranchConditional %62 %64 %63
%61 = OpLabel %64 = OpLabel
OpStore %tint_discard %true OpStore %tint_discard %true
OpStore %tint_return_flag %true OpStore %tint_return_flag %true
OpBranch %60 OpBranch %63
%60 = OpLabel %63 = OpLabel
%64 = OpLoad %bool %tint_return_flag %67 = OpLoad %bool %tint_return_flag
%63 = OpLogicalNot %bool %64 %66 = OpLogicalNot %bool %67
OpSelectionMerge %65 None OpSelectionMerge %68 None
OpBranchConditional %63 %66 %65 OpBranchConditional %66 %69 %68
%66 = OpLabel
%67 = OpLoad %float %fClipDistance4
%68 = OpFOrdGreaterThan %bool %67 %11
OpSelectionMerge %69 None
OpBranchConditional %68 %70 %69
%70 = OpLabel
OpStore %tint_discard %true
OpStore %tint_return_flag %true
OpBranch %69
%69 = OpLabel %69 = OpLabel
%72 = OpLoad %bool %tint_return_flag %70 = OpLoad %float %fClipDistance4
%71 = OpLogicalNot %bool %72 %71 = OpFOrdGreaterThan %bool %70 %11
OpSelectionMerge %73 None OpSelectionMerge %72 None
OpBranchConditional %71 %74 %73 OpBranchConditional %71 %73 %72
%74 = OpLabel
%78 = OpAccessChain %_ptr_Uniform_v4float %x_29 %uint_0
%79 = OpLoad %v4float %78
%82 = OpCompositeExtract %float %79 0
%83 = OpCompositeExtract %float %79 1
%84 = OpCompositeExtract %float %79 2
%85 = OpCompositeConstruct %v3float %82 %83 %84
%86 = OpFSub %v3float %85 %37
%80 = OpExtInst %v3float %81 Normalize %86
OpStore %viewDirectionW %80
OpStore %baseColor %88
%89 = OpAccessChain %_ptr_Uniform_v4float %x_49 %uint_0
%90 = OpLoad %v4float %89
%91 = OpCompositeExtract %float %90 0
%92 = OpCompositeExtract %float %90 1
%93 = OpCompositeExtract %float %90 2
%94 = OpCompositeConstruct %v3float %91 %92 %93
OpStore %diffuseColor %94
%97 = OpAccessChain %_ptr_Uniform_float %x_49 %uint_0 %uint_3
%98 = OpLoad %float %97
OpStore %alpha %98
OpStore %uvOffset %47
%99 = OpLoad %v4float %baseColor
%100 = OpCompositeExtract %float %99 0
%101 = OpCompositeExtract %float %99 1
%102 = OpCompositeExtract %float %99 2
%103 = OpCompositeConstruct %v3float %100 %101 %102
%104 = OpCompositeExtract %float %8 0
%105 = OpCompositeExtract %float %8 1
%106 = OpCompositeExtract %float %8 2
%107 = OpCompositeConstruct %v3float %104 %105 %106
%108 = OpFMul %v3float %103 %107
%109 = OpLoad %v4float %baseColor
%110 = OpCompositeExtract %float %108 0
%111 = OpCompositeExtract %float %108 1
%112 = OpCompositeExtract %float %108 2
%113 = OpCompositeExtract %float %109 3
%114 = OpCompositeConstruct %v4float %110 %111 %112 %113
OpStore %baseColor %114
OpStore %baseAmbientColor %115
OpStore %glossiness %11
OpStore %diffuseBase %37
OpStore %shadow %float_1
OpStore %refractionColor %116
OpStore %reflectionColor %116
%118 = OpAccessChain %_ptr_Uniform_v3float %x_49 %uint_3
%119 = OpLoad %v3float %118
OpStore %emissiveColor %119
%120 = OpLoad %v3float %diffuseBase
%121 = OpLoad %v3float %diffuseColor
%122 = OpLoad %v3float %emissiveColor
%124 = OpAccessChain %_ptr_Uniform_v3float %x_49 %uint_1
%125 = OpLoad %v3float %124
%126 = OpLoad %v4float %baseColor
%128 = OpFMul %v3float %120 %121
%129 = OpFAdd %v3float %128 %122
%130 = OpFAdd %v3float %129 %125
%127 = OpExtInst %v3float %81 NClamp %130 %37 %115
%131 = OpCompositeExtract %float %126 0
%132 = OpCompositeExtract %float %126 1
%133 = OpCompositeExtract %float %126 2
%134 = OpCompositeConstruct %v3float %131 %132 %133
%135 = OpFMul %v3float %127 %134
OpStore %finalDiffuse %135
OpStore %finalSpecular %37
%136 = OpLoad %v3float %finalDiffuse
%137 = OpLoad %v3float %baseAmbientColor
%138 = OpLoad %v3float %finalSpecular
%139 = OpLoad %v4float %reflectionColor
%140 = OpLoad %v4float %refractionColor
%141 = OpFMul %v3float %136 %137
%142 = OpFAdd %v3float %141 %138
%143 = OpCompositeExtract %float %139 0
%144 = OpCompositeExtract %float %139 1
%145 = OpCompositeExtract %float %139 2
%146 = OpCompositeConstruct %v3float %143 %144 %145
%147 = OpFAdd %v3float %142 %146
%148 = OpCompositeExtract %float %140 0
%149 = OpCompositeExtract %float %140 1
%150 = OpCompositeExtract %float %140 2
%151 = OpCompositeConstruct %v3float %148 %149 %150
%152 = OpFAdd %v3float %147 %151
%153 = OpLoad %float %alpha
%154 = OpCompositeExtract %float %152 0
%155 = OpCompositeExtract %float %152 1
%156 = OpCompositeExtract %float %152 2
%157 = OpCompositeConstruct %v4float %154 %155 %156 %153
OpStore %color %157
%158 = OpLoad %v4float %color
%160 = OpCompositeExtract %float %158 0
%161 = OpCompositeExtract %float %158 1
%162 = OpCompositeExtract %float %158 2
%163 = OpCompositeConstruct %v3float %160 %161 %162
%159 = OpExtInst %v3float %81 NMax %163 %37
%164 = OpLoad %v4float %color
%165 = OpCompositeExtract %float %159 0
%166 = OpCompositeExtract %float %159 1
%167 = OpCompositeExtract %float %159 2
%168 = OpCompositeExtract %float %164 3
%169 = OpCompositeConstruct %v4float %165 %166 %167 %168
OpStore %color %169
%170 = OpAccessChain %_ptr_Uniform_float %x_137 %uint_0
%171 = OpLoad %float %170
%172 = OpAccessChain %_ptr_Function_float %color %uint_3
%173 = OpLoad %float %172
%174 = OpAccessChain %_ptr_Function_float %color %uint_3
%175 = OpFMul %float %173 %171
OpStore %174 %175
%176 = OpLoad %v4float %color
OpStore %glFragColor %176
OpStore %tint_return_flag %true
OpBranch %73
%73 = OpLabel %73 = OpLabel
OpBranch %65 OpStore %tint_discard %true
%65 = OpLabel OpStore %tint_return_flag %true
OpBranch %72
%72 = OpLabel
%75 = OpLoad %bool %tint_return_flag
%74 = OpLogicalNot %bool %75
OpSelectionMerge %76 None
OpBranchConditional %74 %77 %76
%77 = OpLabel
%81 = OpAccessChain %_ptr_Uniform_v4float %x_29 %uint_0 %uint_0
%82 = OpLoad %v4float %81
%85 = OpCompositeExtract %float %82 0
%86 = OpCompositeExtract %float %82 1
%87 = OpCompositeExtract %float %82 2
%88 = OpCompositeConstruct %v3float %85 %86 %87
%89 = OpFSub %v3float %88 %40
%83 = OpExtInst %v3float %84 Normalize %89
OpStore %viewDirectionW %83
OpStore %baseColor %91
%92 = OpAccessChain %_ptr_Uniform_v4float %x_49 %uint_0 %uint_0
%93 = OpLoad %v4float %92
%94 = OpCompositeExtract %float %93 0
%95 = OpCompositeExtract %float %93 1
%96 = OpCompositeExtract %float %93 2
%97 = OpCompositeConstruct %v3float %94 %95 %96
OpStore %diffuseColor %97
%100 = OpAccessChain %_ptr_Uniform_float %x_49 %uint_0 %uint_0 %uint_3
%101 = OpLoad %float %100
OpStore %alpha %101
OpStore %uvOffset %50
%102 = OpLoad %v4float %baseColor
%103 = OpCompositeExtract %float %102 0
%104 = OpCompositeExtract %float %102 1
%105 = OpCompositeExtract %float %102 2
%106 = OpCompositeConstruct %v3float %103 %104 %105
%107 = OpCompositeExtract %float %8 0
%108 = OpCompositeExtract %float %8 1
%109 = OpCompositeExtract %float %8 2
%110 = OpCompositeConstruct %v3float %107 %108 %109
%111 = OpFMul %v3float %106 %110
%112 = OpLoad %v4float %baseColor
%113 = OpCompositeExtract %float %111 0
%114 = OpCompositeExtract %float %111 1
%115 = OpCompositeExtract %float %111 2
%116 = OpCompositeExtract %float %112 3
%117 = OpCompositeConstruct %v4float %113 %114 %115 %116
OpStore %baseColor %117
OpStore %baseAmbientColor %118
OpStore %glossiness %11
OpStore %diffuseBase %40
OpStore %shadow %float_1
OpStore %refractionColor %119
OpStore %reflectionColor %119
%121 = OpAccessChain %_ptr_Uniform_v3float %x_49 %uint_0 %uint_3
%122 = OpLoad %v3float %121
OpStore %emissiveColor %122
%123 = OpLoad %v3float %diffuseBase
%124 = OpLoad %v3float %diffuseColor
%125 = OpLoad %v3float %emissiveColor
%127 = OpAccessChain %_ptr_Uniform_v3float %x_49 %uint_0 %uint_1
%128 = OpLoad %v3float %127
%129 = OpLoad %v4float %baseColor
%131 = OpFMul %v3float %123 %124
%132 = OpFAdd %v3float %131 %125
%133 = OpFAdd %v3float %132 %128
%130 = OpExtInst %v3float %84 NClamp %133 %40 %118
%134 = OpCompositeExtract %float %129 0
%135 = OpCompositeExtract %float %129 1
%136 = OpCompositeExtract %float %129 2
%137 = OpCompositeConstruct %v3float %134 %135 %136
%138 = OpFMul %v3float %130 %137
OpStore %finalDiffuse %138
OpStore %finalSpecular %40
%139 = OpLoad %v3float %finalDiffuse
%140 = OpLoad %v3float %baseAmbientColor
%141 = OpLoad %v3float %finalSpecular
%142 = OpLoad %v4float %reflectionColor
%143 = OpLoad %v4float %refractionColor
%144 = OpFMul %v3float %139 %140
%145 = OpFAdd %v3float %144 %141
%146 = OpCompositeExtract %float %142 0
%147 = OpCompositeExtract %float %142 1
%148 = OpCompositeExtract %float %142 2
%149 = OpCompositeConstruct %v3float %146 %147 %148
%150 = OpFAdd %v3float %145 %149
%151 = OpCompositeExtract %float %143 0
%152 = OpCompositeExtract %float %143 1
%153 = OpCompositeExtract %float %143 2
%154 = OpCompositeConstruct %v3float %151 %152 %153
%155 = OpFAdd %v3float %150 %154
%156 = OpLoad %float %alpha
%157 = OpCompositeExtract %float %155 0
%158 = OpCompositeExtract %float %155 1
%159 = OpCompositeExtract %float %155 2
%160 = OpCompositeConstruct %v4float %157 %158 %159 %156
OpStore %color %160
%161 = OpLoad %v4float %color
%163 = OpCompositeExtract %float %161 0
%164 = OpCompositeExtract %float %161 1
%165 = OpCompositeExtract %float %161 2
%166 = OpCompositeConstruct %v3float %163 %164 %165
%162 = OpExtInst %v3float %84 NMax %166 %40
%167 = OpLoad %v4float %color
%168 = OpCompositeExtract %float %162 0
%169 = OpCompositeExtract %float %162 1
%170 = OpCompositeExtract %float %162 2
%171 = OpCompositeExtract %float %167 3
%172 = OpCompositeConstruct %v4float %168 %169 %170 %171
OpStore %color %172
%173 = OpAccessChain %_ptr_Uniform_float %x_137 %uint_0 %uint_0
%174 = OpLoad %float %173
%175 = OpAccessChain %_ptr_Function_float %color %uint_3
%176 = OpLoad %float %175
%177 = OpAccessChain %_ptr_Function_float %color %uint_3
%178 = OpFMul %float %176 %174
OpStore %177 %178
%179 = OpLoad %v4float %color
OpStore %glFragColor %179
OpStore %tint_return_flag %true
OpBranch %76
%76 = OpLabel
OpBranch %68
%68 = OpLabel
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%tint_discard_func = OpFunction %void None %29 %tint_discard_func = OpFunction %void None %32
%178 = OpLabel %181 = OpLabel
OpKill OpKill
OpFunctionEnd OpFunctionEnd
%main_inner = OpFunction %main_out None %179 %main_inner = OpFunction %main_out None %182
%fClipDistance3_param = OpFunctionParameter %float %fClipDistance3_param = OpFunctionParameter %float
%fClipDistance4_param = OpFunctionParameter %float %fClipDistance4_param = OpFunctionParameter %float
%184 = OpLabel %187 = OpLabel
OpStore %fClipDistance3 %fClipDistance3_param OpStore %fClipDistance3 %fClipDistance3_param
OpStore %fClipDistance4 %fClipDistance4_param OpStore %fClipDistance4 %fClipDistance4_param
%185 = OpFunctionCall %void %main_1 %188 = OpFunctionCall %void %main_1
%186 = OpLoad %bool %tint_discard %189 = OpLoad %bool %tint_discard
OpSelectionMerge %187 None OpSelectionMerge %190 None
OpBranchConditional %186 %188 %187 OpBranchConditional %189 %191 %190
%188 = OpLabel %191 = OpLabel
%189 = OpFunctionCall %void %tint_discard_func %192 = OpFunctionCall %void %tint_discard_func
OpReturnValue %190 OpReturnValue %193
%187 = OpLabel %190 = OpLabel
%191 = OpLoad %v4float %glFragColor %194 = OpLoad %v4float %glFragColor
%192 = OpCompositeConstruct %main_out %191 %195 = OpCompositeConstruct %main_out %194
OpReturnValue %192 OpReturnValue %195
OpFunctionEnd OpFunctionEnd
%main = OpFunction %void None %29 %main = OpFunction %void None %32
%194 = OpLabel %197 = OpLabel
%196 = OpLoad %float %fClipDistance3_param_1 %199 = OpLoad %float %fClipDistance3_param_1
%197 = OpLoad %float %fClipDistance4_param_1 %200 = OpLoad %float %fClipDistance4_param_1
%195 = OpFunctionCall %main_out %main_inner %196 %197 %198 = OpFunctionCall %main_out %main_inner %199 %200
%198 = OpCompositeExtract %v4float %195 0 %201 = OpCompositeExtract %v4float %198 0
OpStore %glFragColor_1_1 %198 OpStore %glFragColor_1_1 %201
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -15,11 +15,15 @@ struct TileLightIdData {
uint lightId[64]; uint lightId[64];
}; };
layout(binding = 0, std430) buffer Tiles_ssbo { struct Tiles {
TileLightIdData data[4]; TileLightIdData data[4];
};
layout(binding = 0, std430) buffer tileLightId_block_ssbo {
Tiles inner;
} tileLightId; } tileLightId;
layout(binding = 0, std140) uniform Config_ubo { struct Config {
uint numLights; uint numLights;
uint numTiles; uint numTiles;
uint tileCountX; uint tileCountX;
@ -28,30 +32,38 @@ layout(binding = 0, std140) uniform Config_ubo {
uint tileSize; uint tileSize;
uint pad; uint pad;
uint pad_1; uint pad_1;
};
layout(binding = 0, std140) uniform config_block_ubo {
Config inner;
} config; } config;
layout(binding = 0, std140) uniform Uniforms_ubo { struct Uniforms {
vec4 tint_symbol; vec4 tint_symbol;
vec4 tint_symbol_1; vec4 tint_symbol_1;
mat4 viewMatrix; mat4 viewMatrix;
mat4 projectionMatrix; mat4 projectionMatrix;
vec4 fullScreenSize; vec4 fullScreenSize;
};
layout(binding = 0, std140) uniform uniforms_block_ubo {
Uniforms inner;
} uniforms; } uniforms;
void tint_symbol_2(uvec3 GlobalInvocationID) { void tint_symbol_2(uvec3 GlobalInvocationID) {
uint index = GlobalInvocationID.x; uint index = GlobalInvocationID.x;
if ((index >= config.numLights)) { if ((index >= config.inner.numLights)) {
return; return;
} }
lightsBuffer.lights[index].position.y = ((lightsBuffer.lights[index].position.y - 0.100000001f) + (0.001f * (float(index) - (64.0f * floor((float(index) / 64.0f)))))); lightsBuffer.lights[index].position.y = ((lightsBuffer.lights[index].position.y - 0.100000001f) + (0.001f * (float(index) - (64.0f * floor((float(index) / 64.0f))))));
if ((lightsBuffer.lights[index].position.y < uniforms.tint_symbol.y)) { if ((lightsBuffer.lights[index].position.y < uniforms.inner.tint_symbol.y)) {
lightsBuffer.lights[index].position.y = uniforms.tint_symbol_1.y; lightsBuffer.lights[index].position.y = uniforms.inner.tint_symbol_1.y;
} }
mat4 M = uniforms.projectionMatrix; mat4 M = uniforms.inner.projectionMatrix;
float viewNear = (-(M[3][2]) / (-1.0f + M[2][2])); float viewNear = (-(M[3][2]) / (-1.0f + M[2][2]));
float viewFar = (-(M[3][2]) / (1.0f + M[2][2])); float viewFar = (-(M[3][2]) / (1.0f + M[2][2]));
vec4 lightPos = lightsBuffer.lights[index].position; vec4 lightPos = lightsBuffer.lights[index].position;
lightPos = (uniforms.viewMatrix * lightPos); lightPos = (uniforms.inner.viewMatrix * lightPos);
lightPos = (lightPos / lightPos.w); lightPos = (lightPos / lightPos.w);
float lightRadius = lightsBuffer.lights[index].radius; float lightRadius = lightsBuffer.lights[index].radius;
vec4 boxMin = (lightPos - vec4(vec3(lightRadius), 0.0f)); vec4 boxMin = (lightPos - vec4(vec3(lightRadius), 0.0f));
@ -67,8 +79,8 @@ void tint_symbol_2(uvec3 GlobalInvocationID) {
{ {
for(int x_1 = 0; (x_1 < TILE_COUNT_X); x_1 = (x_1 + 1)) { for(int x_1 = 0; (x_1 < TILE_COUNT_X); x_1 = (x_1 + 1)) {
ivec2 tilePixel0Idx = ivec2((x_1 * TILE_SIZE), (y_1 * TILE_SIZE)); ivec2 tilePixel0Idx = ivec2((x_1 * TILE_SIZE), (y_1 * TILE_SIZE));
vec2 floorCoord = (((2.0f * vec2(tilePixel0Idx)) / uniforms.fullScreenSize.xy) - vec2(1.0f)); vec2 floorCoord = (((2.0f * vec2(tilePixel0Idx)) / uniforms.inner.fullScreenSize.xy) - vec2(1.0f));
vec2 ceilCoord = (((2.0f * vec2((tilePixel0Idx + ivec2(TILE_SIZE)))) / uniforms.fullScreenSize.xy) - vec2(1.0f)); vec2 ceilCoord = (((2.0f * vec2((tilePixel0Idx + ivec2(TILE_SIZE)))) / uniforms.inner.fullScreenSize.xy) - vec2(1.0f));
vec2 viewFloorCoord = vec2((((-(viewNear) * floorCoord.x) - (M[2][0] * viewNear)) / M[0][0]), (((-(viewNear) * floorCoord.y) - (M[2][1] * viewNear)) / M[1][1])); vec2 viewFloorCoord = vec2((((-(viewNear) * floorCoord.x) - (M[2][0] * viewNear)) / M[0][0]), (((-(viewNear) * floorCoord.y) - (M[2][1] * viewNear)) / M[1][1]));
vec2 viewCeilCoord = vec2((((-(viewNear) * ceilCoord.x) - (M[2][0] * viewNear)) / M[0][0]), (((-(viewNear) * ceilCoord.y) - (M[2][1] * viewNear)) / M[1][1])); vec2 viewCeilCoord = vec2((((-(viewNear) * ceilCoord.x) - (M[2][0] * viewNear)) / M[0][0]), (((-(viewNear) * ceilCoord.y) - (M[2][1] * viewNear)) / M[1][1]));
frustumPlanes[0] = vec4(1.0f, 0.0f, (-(viewFloorCoord.x) / viewNear), 0.0f); frustumPlanes[0] = vec4(1.0f, 0.0f, (-(viewFloorCoord.x) / viewNear), 0.0f);
@ -102,16 +114,16 @@ void tint_symbol_2(uvec3 GlobalInvocationID) {
uint tileId = uint((x_1 + (y_1 * TILE_COUNT_X))); uint tileId = uint((x_1 + (y_1 * TILE_COUNT_X)));
bool tint_tmp = (tileId < 0u); bool tint_tmp = (tileId < 0u);
if (!tint_tmp) { if (!tint_tmp) {
tint_tmp = (tileId >= config.numTiles); tint_tmp = (tileId >= config.inner.numTiles);
} }
if ((tint_tmp)) { if ((tint_tmp)) {
continue; continue;
} }
uint offset = atomicAdd(tileLightId.data[tileId].count, 1u); uint offset = atomicAdd(tileLightId.inner.data[tileId].count, 1u);
if ((offset >= config.numTileLightSlot)) { if ((offset >= config.inner.numTileLightSlot)) {
continue; continue;
} }
tileLightId.data[tileId].lightId[offset] = GlobalInvocationID.x; tileLightId.inner.data[tileId].lightId[offset] = GlobalInvocationID.x;
} }
} }
} }

View File

@ -1,10 +1,10 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 415 ; Bound: 418
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
%60 = OpExtInstImport "GLSL.std.450" %63 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main" %GlobalInvocationID_1 OpEntryPoint GLCompute %main "main" %GlobalInvocationID_1
OpExecutionMode %main LocalSize 64 1 1 OpExecutionMode %main LocalSize 64 1 1
@ -16,12 +16,16 @@
OpMemberName %LightData 1 "color" OpMemberName %LightData 1 "color"
OpMemberName %LightData 2 "radius" OpMemberName %LightData 2 "radius"
OpName %lightsBuffer "lightsBuffer" OpName %lightsBuffer "lightsBuffer"
OpName %tileLightId_block "tileLightId_block"
OpMemberName %tileLightId_block 0 "inner"
OpName %Tiles "Tiles" OpName %Tiles "Tiles"
OpMemberName %Tiles 0 "data" OpMemberName %Tiles 0 "data"
OpName %TileLightIdData "TileLightIdData" OpName %TileLightIdData "TileLightIdData"
OpMemberName %TileLightIdData 0 "count" OpMemberName %TileLightIdData 0 "count"
OpMemberName %TileLightIdData 1 "lightId" OpMemberName %TileLightIdData 1 "lightId"
OpName %tileLightId "tileLightId" OpName %tileLightId "tileLightId"
OpName %config_block "config_block"
OpMemberName %config_block 0 "inner"
OpName %Config "Config" OpName %Config "Config"
OpMemberName %Config 0 "numLights" OpMemberName %Config 0 "numLights"
OpMemberName %Config 1 "numTiles" OpMemberName %Config 1 "numTiles"
@ -30,6 +34,8 @@
OpMemberName %Config 4 "numTileLightSlot" OpMemberName %Config 4 "numTileLightSlot"
OpMemberName %Config 5 "tileSize" OpMemberName %Config 5 "tileSize"
OpName %config "config" OpName %config "config"
OpName %uniforms_block "uniforms_block"
OpMemberName %uniforms_block 0 "inner"
OpName %Uniforms "Uniforms" OpName %Uniforms "Uniforms"
OpMemberName %Uniforms 0 "min" OpMemberName %Uniforms 0 "min"
OpMemberName %Uniforms 1 "max" OpMemberName %Uniforms 1 "max"
@ -70,7 +76,8 @@
OpDecorate %_runtimearr_LightData ArrayStride 32 OpDecorate %_runtimearr_LightData ArrayStride 32
OpDecorate %lightsBuffer DescriptorSet 0 OpDecorate %lightsBuffer DescriptorSet 0
OpDecorate %lightsBuffer Binding 0 OpDecorate %lightsBuffer Binding 0
OpDecorate %Tiles Block OpDecorate %tileLightId_block Block
OpMemberDecorate %tileLightId_block 0 Offset 0
OpMemberDecorate %Tiles 0 Offset 0 OpMemberDecorate %Tiles 0 Offset 0
OpMemberDecorate %TileLightIdData 0 Offset 0 OpMemberDecorate %TileLightIdData 0 Offset 0
OpMemberDecorate %TileLightIdData 1 Offset 4 OpMemberDecorate %TileLightIdData 1 Offset 4
@ -78,7 +85,8 @@
OpDecorate %_arr_TileLightIdData_uint_4 ArrayStride 260 OpDecorate %_arr_TileLightIdData_uint_4 ArrayStride 260
OpDecorate %tileLightId DescriptorSet 1 OpDecorate %tileLightId DescriptorSet 1
OpDecorate %tileLightId Binding 0 OpDecorate %tileLightId Binding 0
OpDecorate %Config Block OpDecorate %config_block Block
OpMemberDecorate %config_block 0 Offset 0
OpMemberDecorate %Config 0 Offset 0 OpMemberDecorate %Config 0 Offset 0
OpMemberDecorate %Config 1 Offset 4 OpMemberDecorate %Config 1 Offset 4
OpMemberDecorate %Config 2 Offset 8 OpMemberDecorate %Config 2 Offset 8
@ -88,7 +96,8 @@
OpDecorate %config NonWritable OpDecorate %config NonWritable
OpDecorate %config DescriptorSet 2 OpDecorate %config DescriptorSet 2
OpDecorate %config Binding 0 OpDecorate %config Binding 0
OpDecorate %Uniforms Block OpDecorate %uniforms_block Block
OpMemberDecorate %uniforms_block 0 Offset 0
OpMemberDecorate %Uniforms 0 Offset 0 OpMemberDecorate %Uniforms 0 Offset 0
OpMemberDecorate %Uniforms 1 Offset 16 OpMemberDecorate %Uniforms 1 Offset 16
OpMemberDecorate %Uniforms 2 Offset 32 OpMemberDecorate %Uniforms 2 Offset 32
@ -120,19 +129,22 @@
%uint_4 = OpConstant %uint 4 %uint_4 = OpConstant %uint 4
%_arr_TileLightIdData_uint_4 = OpTypeArray %TileLightIdData %uint_4 %_arr_TileLightIdData_uint_4 = OpTypeArray %TileLightIdData %uint_4
%Tiles = OpTypeStruct %_arr_TileLightIdData_uint_4 %Tiles = OpTypeStruct %_arr_TileLightIdData_uint_4
%_ptr_StorageBuffer_Tiles = OpTypePointer StorageBuffer %Tiles %tileLightId_block = OpTypeStruct %Tiles
%tileLightId = OpVariable %_ptr_StorageBuffer_Tiles StorageBuffer %_ptr_StorageBuffer_tileLightId_block = OpTypePointer StorageBuffer %tileLightId_block
%tileLightId = OpVariable %_ptr_StorageBuffer_tileLightId_block StorageBuffer
%Config = OpTypeStruct %uint %uint %uint %uint %uint %uint %Config = OpTypeStruct %uint %uint %uint %uint %uint %uint
%_ptr_Uniform_Config = OpTypePointer Uniform %Config %config_block = OpTypeStruct %Config
%config = OpVariable %_ptr_Uniform_Config Uniform %_ptr_Uniform_config_block = OpTypePointer Uniform %config_block
%config = OpVariable %_ptr_Uniform_config_block Uniform
%mat4v4float = OpTypeMatrix %v4float 4 %mat4v4float = OpTypeMatrix %v4float 4
%Uniforms = OpTypeStruct %v4float %v4float %mat4v4float %mat4v4float %v4float %Uniforms = OpTypeStruct %v4float %v4float %mat4v4float %mat4v4float %v4float
%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms %uniforms_block = OpTypeStruct %Uniforms
%uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform %_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block
%uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform
%void = OpTypeVoid %void = OpTypeVoid
%28 = OpTypeFunction %void %v3uint %31 = OpTypeFunction %void %v3uint
%_ptr_Function_uint = OpTypePointer Function %uint %_ptr_Function_uint = OpTypePointer Function %uint
%36 = OpConstantNull %uint %39 = OpConstantNull %uint
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%_ptr_Uniform_uint = OpTypePointer Uniform %uint %_ptr_Uniform_uint = OpTypePointer Uniform %uint
%bool = OpTypeBool %bool = OpTypeBool
@ -145,471 +157,471 @@
%uint_3 = OpConstant %uint 3 %uint_3 = OpConstant %uint 3
%_ptr_Uniform_mat4v4float = OpTypePointer Uniform %mat4v4float %_ptr_Uniform_mat4v4float = OpTypePointer Uniform %mat4v4float
%_ptr_Function_mat4v4float = OpTypePointer Function %mat4v4float %_ptr_Function_mat4v4float = OpTypePointer Function %mat4v4float
%87 = OpConstantNull %mat4v4float %90 = OpConstantNull %mat4v4float
%int = OpTypeInt 32 1 %int = OpTypeInt 32 1
%int_3 = OpConstant %int 3 %int_3 = OpConstant %int 3
%int_2 = OpConstant %int 2 %int_2 = OpConstant %int 2
%_ptr_Function_float = OpTypePointer Function %float %_ptr_Function_float = OpTypePointer Function %float
%float_n1 = OpConstant %float -1 %float_n1 = OpConstant %float -1
%101 = OpConstantNull %float %104 = OpConstantNull %float
%float_1 = OpConstant %float 1 %float_1 = OpConstant %float 1
%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float %_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float
%_ptr_Function_v4float = OpTypePointer Function %v4float %_ptr_Function_v4float = OpTypePointer Function %v4float
%117 = OpConstantNull %v4float %120 = OpConstantNull %v4float
%uint_2 = OpConstant %uint 2 %uint_2 = OpConstant %uint 2
%uint_6 = OpConstant %uint 6 %uint_6 = OpConstant %uint 6
%_arr_v4float_uint_6 = OpTypeArray %v4float %uint_6 %_arr_v4float_uint_6 = OpTypeArray %v4float %uint_6
%_ptr_Function__arr_v4float_uint_6 = OpTypePointer Function %_arr_v4float_uint_6 %_ptr_Function__arr_v4float_uint_6 = OpTypePointer Function %_arr_v4float_uint_6
%155 = OpConstantNull %_arr_v4float_uint_6 %158 = OpConstantNull %_arr_v4float_uint_6
%int_4 = OpConstant %int 4 %int_4 = OpConstant %int 4
%int_5 = OpConstant %int 5 %int_5 = OpConstant %int 5
%int_16 = OpConstant %int 16 %int_16 = OpConstant %int 16
%166 = OpConstantNull %int %169 = OpConstantNull %int
%_ptr_Function_int = OpTypePointer Function %int %_ptr_Function_int = OpTypePointer Function %int
%v2int = OpTypeVector %int 2 %v2int = OpTypeVector %int 2
%_ptr_Function_v2int = OpTypePointer Function %v2int %_ptr_Function_v2int = OpTypePointer Function %v2int
%196 = OpConstantNull %v2int %199 = OpConstantNull %v2int
%float_2 = OpConstant %float 2 %float_2 = OpConstant %float 2
%v2float = OpTypeVector %float 2 %v2float = OpTypeVector %float 2
%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float %_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
%207 = OpConstantComposite %v2float %float_1 %float_1 %210 = OpConstantComposite %v2float %float_1 %float_1
%_ptr_Function_v2float = OpTypePointer Function %v2float %_ptr_Function_v2float = OpTypePointer Function %v2float
%211 = OpConstantNull %v2float %214 = OpConstantNull %v2float
%int_1 = OpConstant %int 1 %int_1 = OpConstant %int 1
%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
%_ptr_StorageBuffer_uint_0 = OpTypePointer StorageBuffer %uint %_ptr_StorageBuffer_uint_0 = OpTypePointer StorageBuffer %uint
%410 = OpTypeFunction %void %413 = OpTypeFunction %void
%main_inner = OpFunction %void None %28 %main_inner = OpFunction %void None %31
%GlobalInvocationID = OpFunctionParameter %v3uint %GlobalInvocationID = OpFunctionParameter %v3uint
%32 = OpLabel %35 = OpLabel
%index = OpVariable %_ptr_Function_uint Function %36 %index = OpVariable %_ptr_Function_uint Function %39
%M = OpVariable %_ptr_Function_mat4v4float Function %87 %M = OpVariable %_ptr_Function_mat4v4float Function %90
%viewNear = OpVariable %_ptr_Function_float Function %101 %viewNear = OpVariable %_ptr_Function_float Function %104
%viewFar = OpVariable %_ptr_Function_float Function %101 %viewFar = OpVariable %_ptr_Function_float Function %104
%lightPos = OpVariable %_ptr_Function_v4float Function %117 %lightPos = OpVariable %_ptr_Function_v4float Function %120
%127 = OpVariable %_ptr_Function_v4float Function %117 %130 = OpVariable %_ptr_Function_v4float Function %120
%lightRadius = OpVariable %_ptr_Function_float Function %101 %lightRadius = OpVariable %_ptr_Function_float Function %104
%boxMin = OpVariable %_ptr_Function_v4float Function %117 %boxMin = OpVariable %_ptr_Function_v4float Function %120
%boxMax = OpVariable %_ptr_Function_v4float Function %117 %boxMax = OpVariable %_ptr_Function_v4float Function %120
%frustumPlanes = OpVariable %_ptr_Function__arr_v4float_uint_6 Function %155 %frustumPlanes = OpVariable %_ptr_Function__arr_v4float_uint_6 Function %158
%y = OpVariable %_ptr_Function_int Function %166 %y = OpVariable %_ptr_Function_int Function %169
%x = OpVariable %_ptr_Function_int Function %166 %x = OpVariable %_ptr_Function_int Function %169
%tilePixel0Idx = OpVariable %_ptr_Function_v2int Function %196 %tilePixel0Idx = OpVariable %_ptr_Function_v2int Function %199
%floorCoord = OpVariable %_ptr_Function_v2float Function %211 %floorCoord = OpVariable %_ptr_Function_v2float Function %214
%ceilCoord = OpVariable %_ptr_Function_v2float Function %211 %ceilCoord = OpVariable %_ptr_Function_v2float Function %214
%viewFloorCoord = OpVariable %_ptr_Function_v2float Function %211 %viewFloorCoord = OpVariable %_ptr_Function_v2float Function %214
%viewCeilCoord = OpVariable %_ptr_Function_v2float Function %211 %viewCeilCoord = OpVariable %_ptr_Function_v2float Function %214
%dp = OpVariable %_ptr_Function_float Function %101 %dp = OpVariable %_ptr_Function_float Function %104
%i = OpVariable %_ptr_Function_uint Function %36 %i = OpVariable %_ptr_Function_uint Function %39
%p = OpVariable %_ptr_Function_v4float Function %117 %p = OpVariable %_ptr_Function_v4float Function %120
%tileId = OpVariable %_ptr_Function_uint Function %36 %tileId = OpVariable %_ptr_Function_uint Function %39
%offset = OpVariable %_ptr_Function_uint Function %36 %offset = OpVariable %_ptr_Function_uint Function %39
%33 = OpCompositeExtract %uint %GlobalInvocationID 0 %36 = OpCompositeExtract %uint %GlobalInvocationID 0
OpStore %index %33 OpStore %index %36
%37 = OpLoad %uint %index %40 = OpLoad %uint %index
%40 = OpAccessChain %_ptr_Uniform_uint %config %uint_0 %43 = OpAccessChain %_ptr_Uniform_uint %config %uint_0 %uint_0
%41 = OpLoad %uint %40 %44 = OpLoad %uint %43
%42 = OpUGreaterThanEqual %bool %37 %41 %45 = OpUGreaterThanEqual %bool %40 %44
OpSelectionMerge %44 None OpSelectionMerge %47 None
OpBranchConditional %42 %45 %44 OpBranchConditional %45 %48 %47
%45 = OpLabel %48 = OpLabel
OpReturn OpReturn
%44 = OpLabel %47 = OpLabel
%46 = OpLoad %uint %index %49 = OpLoad %uint %index
%49 = OpAccessChain %_ptr_StorageBuffer_float %lightsBuffer %uint_0 %46 %uint_0 %uint_1 %52 = OpAccessChain %_ptr_StorageBuffer_float %lightsBuffer %uint_0 %49 %uint_0 %uint_1
%50 = OpLoad %uint %index %53 = OpLoad %uint %index
%51 = OpAccessChain %_ptr_StorageBuffer_float %lightsBuffer %uint_0 %50 %uint_0 %uint_1 %54 = OpAccessChain %_ptr_StorageBuffer_float %lightsBuffer %uint_0 %53 %uint_0 %uint_1
%52 = OpLoad %float %51 %55 = OpLoad %float %54
%54 = OpFSub %float %52 %float_0_100000001 %57 = OpFSub %float %55 %float_0_100000001
%57 = OpLoad %uint %index %60 = OpLoad %uint %index
%56 = OpConvertUToF %float %57 %59 = OpConvertUToF %float %60
%62 = OpLoad %uint %index %65 = OpLoad %uint %index
%61 = OpConvertUToF %float %62 %64 = OpConvertUToF %float %65
%63 = OpFDiv %float %61 %float_64 %66 = OpFDiv %float %64 %float_64
%59 = OpExtInst %float %60 Floor %63 %62 = OpExtInst %float %63 Floor %66
%64 = OpFMul %float %float_64 %59 %67 = OpFMul %float %float_64 %62
%65 = OpFSub %float %56 %64 %68 = OpFSub %float %59 %67
%66 = OpFMul %float %float_0_00100000005 %65 %69 = OpFMul %float %float_0_00100000005 %68
%67 = OpFAdd %float %54 %66 %70 = OpFAdd %float %57 %69
OpStore %49 %67 OpStore %52 %70
%68 = OpLoad %uint %index %71 = OpLoad %uint %index
%69 = OpAccessChain %_ptr_StorageBuffer_float %lightsBuffer %uint_0 %68 %uint_0 %uint_1 %72 = OpAccessChain %_ptr_StorageBuffer_float %lightsBuffer %uint_0 %71 %uint_0 %uint_1
%70 = OpLoad %float %69
%72 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_1
%73 = OpLoad %float %72 %73 = OpLoad %float %72
%74 = OpFOrdLessThan %bool %70 %73 %75 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_0 %uint_1
OpSelectionMerge %75 None %76 = OpLoad %float %75
OpBranchConditional %74 %76 %75 %77 = OpFOrdLessThan %bool %73 %76
%76 = OpLabel OpSelectionMerge %78 None
%77 = OpLoad %uint %index OpBranchConditional %77 %79 %78
%78 = OpAccessChain %_ptr_StorageBuffer_float %lightsBuffer %uint_0 %77 %uint_0 %uint_1 %79 = OpLabel
%79 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_1 %uint_1 %80 = OpLoad %uint %index
%80 = OpLoad %float %79 %81 = OpAccessChain %_ptr_StorageBuffer_float %lightsBuffer %uint_0 %80 %uint_0 %uint_1
OpStore %78 %80 %82 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_1 %uint_1
OpBranch %75 %83 = OpLoad %float %82
%75 = OpLabel OpStore %81 %83
%83 = OpAccessChain %_ptr_Uniform_mat4v4float %uniforms %uint_3 OpBranch %78
%84 = OpLoad %mat4v4float %83 %78 = OpLabel
OpStore %M %84 %86 = OpAccessChain %_ptr_Uniform_mat4v4float %uniforms %uint_0 %uint_3
%93 = OpAccessChain %_ptr_Function_float %M %int_3 %int_2 %87 = OpLoad %mat4v4float %86
%94 = OpLoad %float %93 OpStore %M %87
%88 = OpFNegate %float %94 %96 = OpAccessChain %_ptr_Function_float %M %int_3 %int_2
%96 = OpAccessChain %_ptr_Function_float %M %int_2 %int_2
%97 = OpLoad %float %96 %97 = OpLoad %float %96
%98 = OpFAdd %float %float_n1 %97 %91 = OpFNegate %float %97
%99 = OpFDiv %float %88 %98 %99 = OpAccessChain %_ptr_Function_float %M %int_2 %int_2
OpStore %viewNear %99 %100 = OpLoad %float %99
%103 = OpAccessChain %_ptr_Function_float %M %int_3 %int_2 %101 = OpFAdd %float %float_n1 %100
%104 = OpLoad %float %103 %102 = OpFDiv %float %91 %101
%102 = OpFNegate %float %104 OpStore %viewNear %102
%106 = OpAccessChain %_ptr_Function_float %M %int_2 %int_2 %106 = OpAccessChain %_ptr_Function_float %M %int_3 %int_2
%107 = OpLoad %float %106 %107 = OpLoad %float %106
%108 = OpFAdd %float %float_1 %107 %105 = OpFNegate %float %107
%109 = OpFDiv %float %102 %108 %109 = OpAccessChain %_ptr_Function_float %M %int_2 %int_2
OpStore %viewFar %109 %110 = OpLoad %float %109
%111 = OpLoad %uint %index %111 = OpFAdd %float %float_1 %110
%113 = OpAccessChain %_ptr_StorageBuffer_v4float %lightsBuffer %uint_0 %111 %uint_0 %112 = OpFDiv %float %105 %111
%114 = OpLoad %v4float %113 OpStore %viewFar %112
OpStore %lightPos %114 %114 = OpLoad %uint %index
%119 = OpAccessChain %_ptr_Uniform_mat4v4float %uniforms %uint_2 %116 = OpAccessChain %_ptr_StorageBuffer_v4float %lightsBuffer %uint_0 %114 %uint_0
%120 = OpLoad %mat4v4float %119 %117 = OpLoad %v4float %116
%121 = OpLoad %v4float %lightPos OpStore %lightPos %117
%122 = OpMatrixTimesVector %v4float %120 %121 %122 = OpAccessChain %_ptr_Uniform_mat4v4float %uniforms %uint_0 %uint_2
OpStore %lightPos %122 %123 = OpLoad %mat4v4float %122
%123 = OpLoad %v4float %lightPos %124 = OpLoad %v4float %lightPos
%124 = OpAccessChain %_ptr_Function_float %lightPos %uint_3 %125 = OpMatrixTimesVector %v4float %123 %124
%125 = OpLoad %float %124 OpStore %lightPos %125
%128 = OpCompositeConstruct %v4float %125 %125 %125 %125 %126 = OpLoad %v4float %lightPos
%126 = OpFDiv %v4float %123 %128 %127 = OpAccessChain %_ptr_Function_float %lightPos %uint_3
OpStore %lightPos %126 %128 = OpLoad %float %127
%129 = OpLoad %uint %index %131 = OpCompositeConstruct %v4float %128 %128 %128 %128
%130 = OpAccessChain %_ptr_StorageBuffer_float %lightsBuffer %uint_0 %129 %uint_2 %129 = OpFDiv %v4float %126 %131
%131 = OpLoad %float %130 OpStore %lightPos %129
OpStore %lightRadius %131 %132 = OpLoad %uint %index
%133 = OpLoad %v4float %lightPos %133 = OpAccessChain %_ptr_StorageBuffer_float %lightsBuffer %uint_0 %132 %uint_2
%134 = OpLoad %float %lightRadius %134 = OpLoad %float %133
%135 = OpCompositeConstruct %v3float %134 %134 %134 OpStore %lightRadius %134
%136 = OpCompositeExtract %float %135 0 %136 = OpLoad %v4float %lightPos
%137 = OpCompositeExtract %float %135 1 %137 = OpLoad %float %lightRadius
%138 = OpCompositeExtract %float %135 2 %138 = OpCompositeConstruct %v3float %137 %137 %137
%139 = OpCompositeConstruct %v4float %136 %137 %138 %101 %139 = OpCompositeExtract %float %138 0
%140 = OpFSub %v4float %133 %139 %140 = OpCompositeExtract %float %138 1
OpStore %boxMin %140 %141 = OpCompositeExtract %float %138 2
%142 = OpLoad %v4float %lightPos %142 = OpCompositeConstruct %v4float %139 %140 %141 %104
%143 = OpLoad %float %lightRadius %143 = OpFSub %v4float %136 %142
%144 = OpCompositeConstruct %v3float %143 %143 %143 OpStore %boxMin %143
%145 = OpCompositeExtract %float %144 0 %145 = OpLoad %v4float %lightPos
%146 = OpCompositeExtract %float %144 1 %146 = OpLoad %float %lightRadius
%147 = OpCompositeExtract %float %144 2 %147 = OpCompositeConstruct %v3float %146 %146 %146
%148 = OpCompositeConstruct %v4float %145 %146 %147 %101 %148 = OpCompositeExtract %float %147 0
%149 = OpFAdd %v4float %142 %148 %149 = OpCompositeExtract %float %147 1
OpStore %boxMax %149 %150 = OpCompositeExtract %float %147 2
%157 = OpAccessChain %_ptr_Function_v4float %frustumPlanes %int_4 %151 = OpCompositeConstruct %v4float %148 %149 %150 %104
%158 = OpLoad %float %viewNear %152 = OpFAdd %v4float %145 %151
%159 = OpCompositeConstruct %v4float %101 %101 %float_n1 %158 OpStore %boxMax %152
OpStore %157 %159 %160 = OpAccessChain %_ptr_Function_v4float %frustumPlanes %int_4
%161 = OpAccessChain %_ptr_Function_v4float %frustumPlanes %int_5 %161 = OpLoad %float %viewNear
%163 = OpLoad %float %viewFar %162 = OpCompositeConstruct %v4float %104 %104 %float_n1 %161
%162 = OpFNegate %float %163 OpStore %160 %162
%164 = OpCompositeConstruct %v4float %101 %101 %float_1 %162 %164 = OpAccessChain %_ptr_Function_v4float %frustumPlanes %int_5
OpStore %161 %164 %166 = OpLoad %float %viewFar
OpStore %y %166 %165 = OpFNegate %float %166
OpBranch %169 %167 = OpCompositeConstruct %v4float %104 %104 %float_1 %165
%169 = OpLabel OpStore %164 %167
OpLoopMerge %170 %171 None OpStore %y %169
OpBranch %172 OpBranch %172
%172 = OpLabel %172 = OpLabel
%174 = OpLoad %int %y OpLoopMerge %173 %174 None
%175 = OpSLessThan %bool %174 %int_2 OpBranch %175
%173 = OpLogicalNot %bool %175 %175 = OpLabel
OpSelectionMerge %176 None %177 = OpLoad %int %y
OpBranchConditional %173 %177 %176 %178 = OpSLessThan %bool %177 %int_2
%177 = OpLabel %176 = OpLogicalNot %bool %178
OpBranch %170 OpSelectionMerge %179 None
%176 = OpLabel OpBranchConditional %176 %180 %179
OpStore %x %166 %180 = OpLabel
OpBranch %179 OpBranch %173
%179 = OpLabel %179 = OpLabel
OpLoopMerge %180 %181 None OpStore %x %169
OpBranch %182 OpBranch %182
%182 = OpLabel %182 = OpLabel
%184 = OpLoad %int %x OpLoopMerge %183 %184 None
%185 = OpSLessThan %bool %184 %int_2 OpBranch %185
%183 = OpLogicalNot %bool %185 %185 = OpLabel
OpSelectionMerge %186 None %187 = OpLoad %int %x
OpBranchConditional %183 %187 %186 %188 = OpSLessThan %bool %187 %int_2
%187 = OpLabel %186 = OpLogicalNot %bool %188
OpBranch %180 OpSelectionMerge %189 None
%186 = OpLabel OpBranchConditional %186 %190 %189
%189 = OpLoad %int %x %190 = OpLabel
%190 = OpIMul %int %189 %int_16 OpBranch %183
%191 = OpLoad %int %y %189 = OpLabel
%192 = OpIMul %int %191 %int_16 %192 = OpLoad %int %x
%193 = OpCompositeConstruct %v2int %190 %192 %193 = OpIMul %int %192 %int_16
OpStore %tilePixel0Idx %193 %194 = OpLoad %int %y
%200 = OpLoad %v2int %tilePixel0Idx %195 = OpIMul %int %194 %int_16
%198 = OpConvertSToF %v2float %200 %196 = OpCompositeConstruct %v2int %193 %195
%201 = OpVectorTimesScalar %v2float %198 %float_2 OpStore %tilePixel0Idx %196
%203 = OpAccessChain %_ptr_Uniform_v4float %uniforms %uint_4 %203 = OpLoad %v2int %tilePixel0Idx
%204 = OpLoad %v4float %203 %201 = OpConvertSToF %v2float %203
%205 = OpVectorShuffle %v2float %204 %204 0 1 %204 = OpVectorTimesScalar %v2float %201 %float_2
%206 = OpFDiv %v2float %201 %205 %206 = OpAccessChain %_ptr_Uniform_v4float %uniforms %uint_0 %uint_4
%208 = OpFSub %v2float %206 %207 %207 = OpLoad %v4float %206
OpStore %floorCoord %208 %208 = OpVectorShuffle %v2float %207 %207 0 1
%213 = OpLoad %v2int %tilePixel0Idx %209 = OpFDiv %v2float %204 %208
%214 = OpCompositeConstruct %v2int %int_16 %int_16 %211 = OpFSub %v2float %209 %210
%215 = OpIAdd %v2int %213 %214 OpStore %floorCoord %211
%212 = OpConvertSToF %v2float %215 %216 = OpLoad %v2int %tilePixel0Idx
%216 = OpVectorTimesScalar %v2float %212 %float_2 %217 = OpCompositeConstruct %v2int %int_16 %int_16
%217 = OpAccessChain %_ptr_Uniform_v4float %uniforms %uint_4 %218 = OpIAdd %v2int %216 %217
%218 = OpLoad %v4float %217 %215 = OpConvertSToF %v2float %218
%219 = OpVectorShuffle %v2float %218 %218 0 1 %219 = OpVectorTimesScalar %v2float %215 %float_2
%220 = OpFDiv %v2float %216 %219 %220 = OpAccessChain %_ptr_Uniform_v4float %uniforms %uint_0 %uint_4
%221 = OpFSub %v2float %220 %207 %221 = OpLoad %v4float %220
OpStore %ceilCoord %221 %222 = OpVectorShuffle %v2float %221 %221 0 1
%224 = OpLoad %float %viewNear %223 = OpFDiv %v2float %219 %222
%223 = OpFNegate %float %224 %224 = OpFSub %v2float %223 %210
%225 = OpAccessChain %_ptr_Function_float %floorCoord %uint_0 OpStore %ceilCoord %224
%226 = OpLoad %float %225 %227 = OpLoad %float %viewNear
%227 = OpFMul %float %223 %226 %226 = OpFNegate %float %227
%228 = OpAccessChain %_ptr_Function_float %M %int_2 %166 %228 = OpAccessChain %_ptr_Function_float %floorCoord %uint_0
%229 = OpLoad %float %228 %229 = OpLoad %float %228
%230 = OpLoad %float %viewNear %230 = OpFMul %float %226 %229
%231 = OpFMul %float %229 %230 %231 = OpAccessChain %_ptr_Function_float %M %int_2 %169
%232 = OpFSub %float %227 %231 %232 = OpLoad %float %231
%233 = OpAccessChain %_ptr_Function_float %M %166 %166 %233 = OpLoad %float %viewNear
%234 = OpLoad %float %233 %234 = OpFMul %float %232 %233
%235 = OpFDiv %float %232 %234 %235 = OpFSub %float %230 %234
%237 = OpLoad %float %viewNear %236 = OpAccessChain %_ptr_Function_float %M %169 %169
%236 = OpFNegate %float %237 %237 = OpLoad %float %236
%238 = OpAccessChain %_ptr_Function_float %floorCoord %uint_1 %238 = OpFDiv %float %235 %237
%239 = OpLoad %float %238 %240 = OpLoad %float %viewNear
%240 = OpFMul %float %236 %239 %239 = OpFNegate %float %240
%242 = OpAccessChain %_ptr_Function_float %M %int_2 %int_1 %241 = OpAccessChain %_ptr_Function_float %floorCoord %uint_1
%243 = OpLoad %float %242 %242 = OpLoad %float %241
%244 = OpLoad %float %viewNear %243 = OpFMul %float %239 %242
%245 = OpFMul %float %243 %244 %245 = OpAccessChain %_ptr_Function_float %M %int_2 %int_1
%246 = OpFSub %float %240 %245 %246 = OpLoad %float %245
%247 = OpAccessChain %_ptr_Function_float %M %int_1 %int_1 %247 = OpLoad %float %viewNear
%248 = OpLoad %float %247 %248 = OpFMul %float %246 %247
%249 = OpFDiv %float %246 %248 %249 = OpFSub %float %243 %248
%250 = OpCompositeConstruct %v2float %235 %249 %250 = OpAccessChain %_ptr_Function_float %M %int_1 %int_1
OpStore %viewFloorCoord %250 %251 = OpLoad %float %250
%253 = OpLoad %float %viewNear %252 = OpFDiv %float %249 %251
%252 = OpFNegate %float %253 %253 = OpCompositeConstruct %v2float %238 %252
%254 = OpAccessChain %_ptr_Function_float %ceilCoord %uint_0 OpStore %viewFloorCoord %253
%255 = OpLoad %float %254 %256 = OpLoad %float %viewNear
%256 = OpFMul %float %252 %255 %255 = OpFNegate %float %256
%257 = OpAccessChain %_ptr_Function_float %M %int_2 %166 %257 = OpAccessChain %_ptr_Function_float %ceilCoord %uint_0
%258 = OpLoad %float %257 %258 = OpLoad %float %257
%259 = OpLoad %float %viewNear %259 = OpFMul %float %255 %258
%260 = OpFMul %float %258 %259 %260 = OpAccessChain %_ptr_Function_float %M %int_2 %169
%261 = OpFSub %float %256 %260 %261 = OpLoad %float %260
%262 = OpAccessChain %_ptr_Function_float %M %166 %166 %262 = OpLoad %float %viewNear
%263 = OpLoad %float %262 %263 = OpFMul %float %261 %262
%264 = OpFDiv %float %261 %263 %264 = OpFSub %float %259 %263
%266 = OpLoad %float %viewNear %265 = OpAccessChain %_ptr_Function_float %M %169 %169
%265 = OpFNegate %float %266 %266 = OpLoad %float %265
%267 = OpAccessChain %_ptr_Function_float %ceilCoord %uint_1 %267 = OpFDiv %float %264 %266
%268 = OpLoad %float %267 %269 = OpLoad %float %viewNear
%269 = OpFMul %float %265 %268 %268 = OpFNegate %float %269
%270 = OpAccessChain %_ptr_Function_float %M %int_2 %int_1 %270 = OpAccessChain %_ptr_Function_float %ceilCoord %uint_1
%271 = OpLoad %float %270 %271 = OpLoad %float %270
%272 = OpLoad %float %viewNear %272 = OpFMul %float %268 %271
%273 = OpFMul %float %271 %272 %273 = OpAccessChain %_ptr_Function_float %M %int_2 %int_1
%274 = OpFSub %float %269 %273 %274 = OpLoad %float %273
%275 = OpAccessChain %_ptr_Function_float %M %int_1 %int_1 %275 = OpLoad %float %viewNear
%276 = OpLoad %float %275 %276 = OpFMul %float %274 %275
%277 = OpFDiv %float %274 %276 %277 = OpFSub %float %272 %276
%278 = OpCompositeConstruct %v2float %264 %277 %278 = OpAccessChain %_ptr_Function_float %M %int_1 %int_1
OpStore %viewCeilCoord %278 %279 = OpLoad %float %278
%280 = OpAccessChain %_ptr_Function_v4float %frustumPlanes %166 %280 = OpFDiv %float %277 %279
%282 = OpAccessChain %_ptr_Function_float %viewFloorCoord %uint_0 %281 = OpCompositeConstruct %v2float %267 %280
%283 = OpLoad %float %282 OpStore %viewCeilCoord %281
%281 = OpFNegate %float %283 %283 = OpAccessChain %_ptr_Function_v4float %frustumPlanes %169
%284 = OpLoad %float %viewNear %285 = OpAccessChain %_ptr_Function_float %viewFloorCoord %uint_0
%285 = OpFDiv %float %281 %284 %286 = OpLoad %float %285
%286 = OpCompositeConstruct %v4float %float_1 %101 %285 %101 %284 = OpFNegate %float %286
OpStore %280 %286 %287 = OpLoad %float %viewNear
%287 = OpAccessChain %_ptr_Function_v4float %frustumPlanes %int_1 %288 = OpFDiv %float %284 %287
%288 = OpAccessChain %_ptr_Function_float %viewCeilCoord %uint_0 %289 = OpCompositeConstruct %v4float %float_1 %104 %288 %104
%289 = OpLoad %float %288 OpStore %283 %289
%290 = OpLoad %float %viewNear %290 = OpAccessChain %_ptr_Function_v4float %frustumPlanes %int_1
%291 = OpFDiv %float %289 %290 %291 = OpAccessChain %_ptr_Function_float %viewCeilCoord %uint_0
%292 = OpCompositeConstruct %v4float %float_n1 %101 %291 %101 %292 = OpLoad %float %291
OpStore %287 %292 %293 = OpLoad %float %viewNear
%293 = OpAccessChain %_ptr_Function_v4float %frustumPlanes %int_2 %294 = OpFDiv %float %292 %293
%295 = OpAccessChain %_ptr_Function_float %viewFloorCoord %uint_1 %295 = OpCompositeConstruct %v4float %float_n1 %104 %294 %104
%296 = OpLoad %float %295 OpStore %290 %295
%294 = OpFNegate %float %296 %296 = OpAccessChain %_ptr_Function_v4float %frustumPlanes %int_2
%297 = OpLoad %float %viewNear %298 = OpAccessChain %_ptr_Function_float %viewFloorCoord %uint_1
%298 = OpFDiv %float %294 %297 %299 = OpLoad %float %298
%299 = OpCompositeConstruct %v4float %101 %float_1 %298 %101 %297 = OpFNegate %float %299
OpStore %293 %299 %300 = OpLoad %float %viewNear
%300 = OpAccessChain %_ptr_Function_v4float %frustumPlanes %int_3 %301 = OpFDiv %float %297 %300
%301 = OpAccessChain %_ptr_Function_float %viewCeilCoord %uint_1 %302 = OpCompositeConstruct %v4float %104 %float_1 %301 %104
%302 = OpLoad %float %301 OpStore %296 %302
%303 = OpLoad %float %viewNear %303 = OpAccessChain %_ptr_Function_v4float %frustumPlanes %int_3
%304 = OpFDiv %float %302 %303 %304 = OpAccessChain %_ptr_Function_float %viewCeilCoord %uint_1
%305 = OpCompositeConstruct %v4float %101 %float_n1 %304 %101 %305 = OpLoad %float %304
OpStore %300 %305 %306 = OpLoad %float %viewNear
OpStore %dp %101 %307 = OpFDiv %float %305 %306
OpStore %i %36 %308 = OpCompositeConstruct %v4float %104 %float_n1 %307 %104
OpBranch %308 OpStore %303 %308
%308 = OpLabel OpStore %dp %104
OpLoopMerge %309 %310 None OpStore %i %39
OpBranch %311 OpBranch %311
%311 = OpLabel %311 = OpLabel
%313 = OpLoad %uint %i OpLoopMerge %312 %313 None
%314 = OpULessThan %bool %313 %uint_6 OpBranch %314
%312 = OpLogicalNot %bool %314 %314 = OpLabel
OpSelectionMerge %315 None %316 = OpLoad %uint %i
OpBranchConditional %312 %316 %315 %317 = OpULessThan %bool %316 %uint_6
%316 = OpLabel %315 = OpLogicalNot %bool %317
OpBranch %309 OpSelectionMerge %318 None
%315 = OpLabel OpBranchConditional %315 %319 %318
%318 = OpLoad %uint %i %319 = OpLabel
%319 = OpAccessChain %_ptr_Function_float %frustumPlanes %318 %uint_0 OpBranch %312
%320 = OpLoad %float %319 %318 = OpLabel
%321 = OpFOrdGreaterThan %bool %320 %101 %321 = OpLoad %uint %i
OpSelectionMerge %322 None %322 = OpAccessChain %_ptr_Function_float %frustumPlanes %321 %uint_0
OpBranchConditional %321 %323 %324 %323 = OpLoad %float %322
%323 = OpLabel %324 = OpFOrdGreaterThan %bool %323 %104
%325 = OpAccessChain %_ptr_Function_float %p %uint_0 OpSelectionMerge %325 None
%326 = OpAccessChain %_ptr_Function_float %boxMax %uint_0 OpBranchConditional %324 %326 %327
%327 = OpLoad %float %326 %326 = OpLabel
OpStore %325 %327
OpBranch %322
%324 = OpLabel
%328 = OpAccessChain %_ptr_Function_float %p %uint_0 %328 = OpAccessChain %_ptr_Function_float %p %uint_0
%329 = OpAccessChain %_ptr_Function_float %boxMin %uint_0 %329 = OpAccessChain %_ptr_Function_float %boxMax %uint_0
%330 = OpLoad %float %329 %330 = OpLoad %float %329
OpStore %328 %330 OpStore %328 %330
OpBranch %322 OpBranch %325
%322 = OpLabel %327 = OpLabel
%331 = OpLoad %uint %i %331 = OpAccessChain %_ptr_Function_float %p %uint_0
%332 = OpAccessChain %_ptr_Function_float %frustumPlanes %331 %uint_1 %332 = OpAccessChain %_ptr_Function_float %boxMin %uint_0
%333 = OpLoad %float %332 %333 = OpLoad %float %332
%334 = OpFOrdGreaterThan %bool %333 %101 OpStore %331 %333
OpSelectionMerge %335 None OpBranch %325
OpBranchConditional %334 %336 %337 %325 = OpLabel
%336 = OpLabel %334 = OpLoad %uint %i
%338 = OpAccessChain %_ptr_Function_float %p %uint_1 %335 = OpAccessChain %_ptr_Function_float %frustumPlanes %334 %uint_1
%339 = OpAccessChain %_ptr_Function_float %boxMax %uint_1 %336 = OpLoad %float %335
%340 = OpLoad %float %339 %337 = OpFOrdGreaterThan %bool %336 %104
OpStore %338 %340 OpSelectionMerge %338 None
OpBranch %335 OpBranchConditional %337 %339 %340
%337 = OpLabel %339 = OpLabel
%341 = OpAccessChain %_ptr_Function_float %p %uint_1 %341 = OpAccessChain %_ptr_Function_float %p %uint_1
%342 = OpAccessChain %_ptr_Function_float %boxMin %uint_1 %342 = OpAccessChain %_ptr_Function_float %boxMax %uint_1
%343 = OpLoad %float %342 %343 = OpLoad %float %342
OpStore %341 %343 OpStore %341 %343
OpBranch %335 OpBranch %338
%335 = OpLabel %340 = OpLabel
%344 = OpLoad %uint %i %344 = OpAccessChain %_ptr_Function_float %p %uint_1
%345 = OpAccessChain %_ptr_Function_float %frustumPlanes %344 %uint_2 %345 = OpAccessChain %_ptr_Function_float %boxMin %uint_1
%346 = OpLoad %float %345 %346 = OpLoad %float %345
%347 = OpFOrdGreaterThan %bool %346 %101 OpStore %344 %346
OpSelectionMerge %348 None OpBranch %338
OpBranchConditional %347 %349 %350 %338 = OpLabel
%349 = OpLabel %347 = OpLoad %uint %i
%351 = OpAccessChain %_ptr_Function_float %p %uint_2 %348 = OpAccessChain %_ptr_Function_float %frustumPlanes %347 %uint_2
%352 = OpAccessChain %_ptr_Function_float %boxMax %uint_2 %349 = OpLoad %float %348
%353 = OpLoad %float %352 %350 = OpFOrdGreaterThan %bool %349 %104
OpStore %351 %353 OpSelectionMerge %351 None
OpBranch %348 OpBranchConditional %350 %352 %353
%350 = OpLabel %352 = OpLabel
%354 = OpAccessChain %_ptr_Function_float %p %uint_2 %354 = OpAccessChain %_ptr_Function_float %p %uint_2
%355 = OpAccessChain %_ptr_Function_float %boxMin %uint_2 %355 = OpAccessChain %_ptr_Function_float %boxMax %uint_2
%356 = OpLoad %float %355 %356 = OpLoad %float %355
OpStore %354 %356 OpStore %354 %356
OpBranch %348 OpBranch %351
%348 = OpLabel %353 = OpLabel
%357 = OpAccessChain %_ptr_Function_float %p %uint_3 %357 = OpAccessChain %_ptr_Function_float %p %uint_2
OpStore %357 %float_1 %358 = OpAccessChain %_ptr_Function_float %boxMin %uint_2
%358 = OpLoad %float %dp %359 = OpLoad %float %358
%361 = OpLoad %v4float %p OpStore %357 %359
%362 = OpLoad %uint %i OpBranch %351
%363 = OpAccessChain %_ptr_Function_v4float %frustumPlanes %362 %351 = OpLabel
%364 = OpLoad %v4float %363 %360 = OpAccessChain %_ptr_Function_float %p %uint_3
%360 = OpDot %float %361 %364 OpStore %360 %float_1
%359 = OpExtInst %float %60 NMin %101 %360 %361 = OpLoad %float %dp
%365 = OpFAdd %float %358 %359 %364 = OpLoad %v4float %p
OpStore %dp %365 %365 = OpLoad %uint %i
OpBranch %310 %366 = OpAccessChain %_ptr_Function_v4float %frustumPlanes %365
%310 = OpLabel %367 = OpLoad %v4float %366
%366 = OpLoad %uint %i %363 = OpDot %float %364 %367
%367 = OpIAdd %uint %366 %uint_1 %362 = OpExtInst %float %63 NMin %104 %363
OpStore %i %367 %368 = OpFAdd %float %361 %362
OpBranch %308 OpStore %dp %368
%309 = OpLabel OpBranch %313
%368 = OpLoad %float %dp %313 = OpLabel
%369 = OpFOrdGreaterThanEqual %bool %368 %101 %369 = OpLoad %uint %i
OpSelectionMerge %370 None %370 = OpIAdd %uint %369 %uint_1
OpBranchConditional %369 %371 %370 OpStore %i %370
%371 = OpLabel OpBranch %311
%373 = OpLoad %int %x %312 = OpLabel
%374 = OpLoad %int %y %371 = OpLoad %float %dp
%375 = OpIMul %int %374 %int_2 %372 = OpFOrdGreaterThanEqual %bool %371 %104
%376 = OpIAdd %int %373 %375 OpSelectionMerge %373 None
%372 = OpBitcast %uint %376 OpBranchConditional %372 %374 %373
OpStore %tileId %372 %374 = OpLabel
%378 = OpLoad %uint %tileId %376 = OpLoad %int %x
%379 = OpULessThan %bool %378 %36 %377 = OpLoad %int %y
OpSelectionMerge %380 None %378 = OpIMul %int %377 %int_2
OpBranchConditional %379 %380 %381 %379 = OpIAdd %int %376 %378
%381 = OpLabel %375 = OpBitcast %uint %379
%382 = OpLoad %uint %tileId OpStore %tileId %375
%383 = OpAccessChain %_ptr_Uniform_uint %config %uint_1 %381 = OpLoad %uint %tileId
%384 = OpLoad %uint %383 %382 = OpULessThan %bool %381 %39
%385 = OpUGreaterThanEqual %bool %382 %384 OpSelectionMerge %383 None
OpBranch %380 OpBranchConditional %382 %383 %384
%380 = OpLabel %384 = OpLabel
%386 = OpPhi %bool %379 %371 %385 %381 %385 = OpLoad %uint %tileId
OpSelectionMerge %387 None %386 = OpAccessChain %_ptr_Uniform_uint %config %uint_0 %uint_1
OpBranchConditional %386 %388 %387 %387 = OpLoad %uint %386
%388 = OpLabel %388 = OpUGreaterThanEqual %bool %385 %387
OpBranch %181 OpBranch %383
%387 = OpLabel %383 = OpLabel
%391 = OpLoad %uint %tileId %389 = OpPhi %bool %382 %374 %388 %384
%393 = OpAccessChain %_ptr_StorageBuffer_uint %tileLightId %uint_0 %391 %uint_0 OpSelectionMerge %390 None
%389 = OpAtomicIAdd %uint %393 %uint_1 %uint_0 %uint_1 OpBranchConditional %389 %391 %390
OpStore %offset %389 %391 = OpLabel
%395 = OpLoad %uint %offset OpBranch %184
%396 = OpAccessChain %_ptr_Uniform_uint %config %uint_4 %390 = OpLabel
%397 = OpLoad %uint %396 %394 = OpLoad %uint %tileId
%398 = OpUGreaterThanEqual %bool %395 %397 %396 = OpAccessChain %_ptr_StorageBuffer_uint %tileLightId %uint_0 %uint_0 %394 %uint_0
OpSelectionMerge %399 None %392 = OpAtomicIAdd %uint %396 %uint_1 %uint_0 %uint_1
OpBranchConditional %398 %400 %399 OpStore %offset %392
%400 = OpLabel %398 = OpLoad %uint %offset
OpBranch %181 %399 = OpAccessChain %_ptr_Uniform_uint %config %uint_0 %uint_4
%399 = OpLabel %400 = OpLoad %uint %399
%401 = OpLoad %uint %tileId %401 = OpUGreaterThanEqual %bool %398 %400
%402 = OpLoad %uint %offset OpSelectionMerge %402 None
%404 = OpAccessChain %_ptr_StorageBuffer_uint_0 %tileLightId %uint_0 %401 %uint_1 %402 OpBranchConditional %401 %403 %402
%405 = OpCompositeExtract %uint %GlobalInvocationID 0 %403 = OpLabel
OpStore %404 %405 OpBranch %184
OpBranch %370 %402 = OpLabel
%370 = OpLabel %404 = OpLoad %uint %tileId
OpBranch %181 %405 = OpLoad %uint %offset
%181 = OpLabel %407 = OpAccessChain %_ptr_StorageBuffer_uint_0 %tileLightId %uint_0 %uint_0 %404 %uint_1 %405
%406 = OpLoad %int %x %408 = OpCompositeExtract %uint %GlobalInvocationID 0
%407 = OpIAdd %int %406 %int_1 OpStore %407 %408
OpStore %x %407 OpBranch %373
OpBranch %179 %373 = OpLabel
%180 = OpLabel OpBranch %184
OpBranch %171 %184 = OpLabel
%171 = OpLabel %409 = OpLoad %int %x
%408 = OpLoad %int %y %410 = OpIAdd %int %409 %int_1
%409 = OpIAdd %int %408 %int_1 OpStore %x %410
OpStore %y %409 OpBranch %182
OpBranch %169 %183 = OpLabel
%170 = OpLabel OpBranch %174
%174 = OpLabel
%411 = OpLoad %int %y
%412 = OpIAdd %int %411 %int_1
OpStore %y %412
OpBranch %172
%173 = OpLabel
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%main = OpFunction %void None %410 %main = OpFunction %void None %413
%412 = OpLabel %415 = OpLabel
%414 = OpLoad %v3uint %GlobalInvocationID_1 %417 = OpLoad %v3uint %GlobalInvocationID_1
%413 = OpFunctionCall %void %main_inner %414 %416 = OpFunctionCall %void %main_inner %417
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -4,11 +4,15 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void unused_entry_point() { void unused_entry_point() {
return; return;
} }
layout(binding = 0, std430) buffer Buffer_ssbo { struct Buffer {
uint data; uint data;
};
layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
Buffer inner;
} tint_symbol; } tint_symbol;
void tint_symbol_1() { void tint_symbol_1() {
tint_symbol.data = (tint_symbol.data + 1u); tint_symbol.inner.data = (tint_symbol.inner.data + 1u);
} }

View File

@ -1,40 +1,44 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 18 ; Bound: 19
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
OpExecutionMode %unused_entry_point LocalSize 1 1 1 OpExecutionMode %unused_entry_point LocalSize 1 1 1
OpName %buffer_block "buffer_block"
OpMemberName %buffer_block 0 "inner"
OpName %Buffer "Buffer" OpName %Buffer "Buffer"
OpMemberName %Buffer 0 "data" OpMemberName %Buffer 0 "data"
OpName %buffer "buffer" OpName %buffer "buffer"
OpName %unused_entry_point "unused_entry_point" OpName %unused_entry_point "unused_entry_point"
OpName %main "main" OpName %main "main"
OpDecorate %Buffer Block OpDecorate %buffer_block Block
OpMemberDecorate %buffer_block 0 Offset 0
OpMemberDecorate %Buffer 0 Offset 0 OpMemberDecorate %Buffer 0 Offset 0
OpDecorate %buffer DescriptorSet 0 OpDecorate %buffer DescriptorSet 0
OpDecorate %buffer Binding 0 OpDecorate %buffer Binding 0
%uint = OpTypeInt 32 0 %uint = OpTypeInt 32 0
%Buffer = OpTypeStruct %uint %Buffer = OpTypeStruct %uint
%_ptr_StorageBuffer_Buffer = OpTypePointer StorageBuffer %Buffer %buffer_block = OpTypeStruct %Buffer
%buffer = OpVariable %_ptr_StorageBuffer_Buffer StorageBuffer %_ptr_StorageBuffer_buffer_block = OpTypePointer StorageBuffer %buffer_block
%buffer = OpVariable %_ptr_StorageBuffer_buffer_block StorageBuffer
%void = OpTypeVoid %void = OpTypeVoid
%5 = OpTypeFunction %void %6 = OpTypeFunction %void
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
%uint_1 = OpConstant %uint 1 %uint_1 = OpConstant %uint 1
%unused_entry_point = OpFunction %void None %5 %unused_entry_point = OpFunction %void None %6
%8 = OpLabel %9 = OpLabel
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%main = OpFunction %void None %5 %main = OpFunction %void None %6
%10 = OpLabel %11 = OpLabel
%13 = OpAccessChain %_ptr_StorageBuffer_uint %buffer %uint_0 %14 = OpAccessChain %_ptr_StorageBuffer_uint %buffer %uint_0 %uint_0
%14 = OpAccessChain %_ptr_StorageBuffer_uint %buffer %uint_0 %15 = OpAccessChain %_ptr_StorageBuffer_uint %buffer %uint_0 %uint_0
%15 = OpLoad %uint %14 %16 = OpLoad %uint %15
%17 = OpIAdd %uint %15 %uint_1 %18 = OpIAdd %uint %16 %uint_1
OpStore %13 %17 OpStore %14 %18
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -3,7 +3,7 @@ precision mediump float;
layout(location = 0) in vec4 vcolor_S0_param_1; layout(location = 0) in vec4 vcolor_S0_param_1;
layout(location = 0) out vec4 sk_FragColor_1_1; layout(location = 0) out vec4 sk_FragColor_1_1;
layout(binding = 0, std140) uniform UniformBuffer_ubo { struct UniformBuffer {
uint pad; uint pad;
uint pad_1; uint pad_1;
uint pad_2; uint pad_2;
@ -15,6 +15,10 @@ layout(binding = 0, std140) uniform UniformBuffer_ubo {
vec4 ucolorRed_S1_c0; vec4 ucolorRed_S1_c0;
vec4 ucolorGreen_S1_c0; vec4 ucolorGreen_S1_c0;
mat3 umatrix_S1; mat3 umatrix_S1;
};
layout(binding = 0, std140) uniform x_4_block_ubo {
UniformBuffer inner;
} x_4; } x_4;
vec4 sk_FragColor = vec4(0.0f, 0.0f, 0.0f, 0.0f); vec4 sk_FragColor = vec4(0.0f, 0.0f, 0.0f, 0.0f);
@ -30,7 +34,7 @@ bool test_int_S1_c0_b() {
bool x_55 = false; bool x_55 = false;
bool x_65 = false; bool x_65 = false;
bool x_66 = false; bool x_66 = false;
float x_26 = x_4.unknownInput_S1_c0; float x_26 = x_4.inner.unknownInput_S1_c0;
int x_27 = int(x_26); int x_27 = int(x_26);
unknown = x_27; unknown = x_27;
ok = true; ok = true;
@ -90,7 +94,7 @@ void main_1() {
bool x_115 = false; bool x_115 = false;
vec4 x_72 = vcolor_S0; vec4 x_72 = vcolor_S0;
outputColor_S0 = x_72; outputColor_S0 = x_72;
float x_77 = x_4.unknownInput_S1_c0; float x_77 = x_4.inner.unknownInput_S1_c0;
x_8_unknown = x_77; x_8_unknown = x_77;
x_9_ok = true; x_9_ok = true;
x_87 = false; x_87 = false;
@ -135,10 +139,10 @@ void main_1() {
x_115 = x_114; x_115 = x_114;
} }
if (x_115) { if (x_115) {
vec4 x_122 = x_4.ucolorGreen_S1_c0; vec4 x_122 = x_4.inner.ucolorGreen_S1_c0;
x_116 = x_122; x_116 = x_122;
} else { } else {
vec4 x_124 = x_4.ucolorRed_S1_c0; vec4 x_124 = x_4.inner.ucolorRed_S1_c0;
x_116 = x_124; x_116 = x_124;
} }
vec4 x_125 = x_116; vec4 x_125 = x_116;

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: 176 ; Bound: 177
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
@ -10,6 +10,8 @@
OpName %sk_Clockwise_param_1 "sk_Clockwise_param_1" OpName %sk_Clockwise_param_1 "sk_Clockwise_param_1"
OpName %vcolor_S0_param_1 "vcolor_S0_param_1" OpName %vcolor_S0_param_1 "vcolor_S0_param_1"
OpName %sk_FragColor_1_1 "sk_FragColor_1_1" OpName %sk_FragColor_1_1 "sk_FragColor_1_1"
OpName %x_4_block "x_4_block"
OpMemberName %x_4_block 0 "inner"
OpName %UniformBuffer "UniformBuffer" OpName %UniformBuffer "UniformBuffer"
OpMemberName %UniformBuffer 0 "unknownInput_S1_c0" OpMemberName %UniformBuffer 0 "unknownInput_S1_c0"
OpMemberName %UniformBuffer 1 "ucolorRed_S1_c0" OpMemberName %UniformBuffer 1 "ucolorRed_S1_c0"
@ -53,7 +55,8 @@
OpDecorate %sk_Clockwise_param_1 BuiltIn FrontFacing OpDecorate %sk_Clockwise_param_1 BuiltIn FrontFacing
OpDecorate %vcolor_S0_param_1 Location 0 OpDecorate %vcolor_S0_param_1 Location 0
OpDecorate %sk_FragColor_1_1 Location 0 OpDecorate %sk_FragColor_1_1 Location 0
OpDecorate %UniformBuffer Block OpDecorate %x_4_block Block
OpMemberDecorate %x_4_block 0 Offset 0
OpMemberDecorate %UniformBuffer 0 Offset 16 OpMemberDecorate %UniformBuffer 0 Offset 16
OpMemberDecorate %UniformBuffer 1 Offset 32 OpMemberDecorate %UniformBuffer 1 Offset 32
OpMemberDecorate %UniformBuffer 2 Offset 48 OpMemberDecorate %UniformBuffer 2 Offset 48
@ -77,255 +80,256 @@
%v3float = OpTypeVector %float 3 %v3float = OpTypeVector %float 3
%mat3v3float = OpTypeMatrix %v3float 3 %mat3v3float = OpTypeMatrix %v3float 3
%UniformBuffer = OpTypeStruct %float %v4float %v4float %mat3v3float %UniformBuffer = OpTypeStruct %float %v4float %v4float %mat3v3float
%_ptr_Uniform_UniformBuffer = OpTypePointer Uniform %UniformBuffer %x_4_block = OpTypeStruct %UniformBuffer
%x_4 = OpVariable %_ptr_Uniform_UniformBuffer Uniform %_ptr_Uniform_x_4_block = OpTypePointer Uniform %x_4_block
%x_4 = OpVariable %_ptr_Uniform_x_4_block Uniform
%_ptr_Private_v4float = OpTypePointer Private %v4float %_ptr_Private_v4float = OpTypePointer Private %v4float
%sk_FragColor = OpVariable %_ptr_Private_v4float Private %10 %sk_FragColor = OpVariable %_ptr_Private_v4float Private %10
%_ptr_Private_bool = OpTypePointer Private %bool %_ptr_Private_bool = OpTypePointer Private %bool
%20 = OpConstantNull %bool %21 = OpConstantNull %bool
%sk_Clockwise = OpVariable %_ptr_Private_bool Private %20 %sk_Clockwise = OpVariable %_ptr_Private_bool Private %21
%vcolor_S0 = OpVariable %_ptr_Private_v4float Private %10 %vcolor_S0 = OpVariable %_ptr_Private_v4float Private %10
%22 = OpTypeFunction %bool %23 = OpTypeFunction %bool
%int = OpTypeInt 32 1 %int = OpTypeInt 32 1
%_ptr_Function_int = OpTypePointer Function %int %_ptr_Function_int = OpTypePointer Function %int
%28 = OpConstantNull %int %29 = OpConstantNull %int
%_ptr_Function_bool = OpTypePointer Function %bool %_ptr_Function_bool = OpTypePointer Function %bool
%v4int = OpTypeVector %int 4 %v4int = OpTypeVector %int 4
%_ptr_Function_v4int = OpTypePointer Function %v4int %_ptr_Function_v4int = OpTypePointer Function %v4int
%34 = OpConstantNull %v4int %35 = OpConstantNull %v4int
%uint = OpTypeInt 32 0 %uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%_ptr_Uniform_float = OpTypePointer Uniform %float %_ptr_Uniform_float = OpTypePointer Uniform %float
%true = OpConstantTrue %bool %true = OpConstantTrue %bool
%v4bool = OpTypeVector %bool 4 %v4bool = OpTypeVector %bool 4
%int_1 = OpConstant %int 1 %int_1 = OpConstant %int 1
%59 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 %60 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1
%int_2 = OpConstant %int 2 %int_2 = OpConstant %int 2
%72 = OpConstantComposite %v4int %int_2 %int_2 %int_2 %int_2 %73 = OpConstantComposite %v4int %int_2 %int_2 %int_2 %int_2
%void = OpTypeVoid %void = OpTypeVoid
%85 = OpTypeFunction %void %86 = OpTypeFunction %void
%_ptr_Function_v4float = OpTypePointer Function %v4float %_ptr_Function_v4float = OpTypePointer Function %v4float
%_ptr_Function_float = OpTypePointer Function %float %_ptr_Function_float = OpTypePointer Function %float
%94 = OpConstantNull %float %95 = OpConstantNull %float
%float_1 = OpConstant %float 1 %float_1 = OpConstant %float 1
%119 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 %120 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
%float_2 = OpConstant %float 2 %float_2 = OpConstant %float 2
%132 = OpConstantComposite %v4float %float_2 %float_2 %float_2 %float_2 %133 = OpConstantComposite %v4float %float_2 %float_2 %float_2 %float_2
%uint_2 = OpConstant %uint 2 %uint_2 = OpConstant %uint 2
%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float %_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
%uint_1 = OpConstant %uint 1 %uint_1 = OpConstant %uint 1
%main_out = OpTypeStruct %v4float %main_out = OpTypeStruct %v4float
%161 = OpTypeFunction %main_out %bool %v4float %162 = OpTypeFunction %main_out %bool %v4float
%test_int_S1_c0_b = OpFunction %bool None %22 %test_int_S1_c0_b = OpFunction %bool None %23
%24 = OpLabel %25 = OpLabel
%unknown = OpVariable %_ptr_Function_int Function %28 %unknown = OpVariable %_ptr_Function_int Function %29
%ok = OpVariable %_ptr_Function_bool Function %20 %ok = OpVariable %_ptr_Function_bool Function %21
%val = OpVariable %_ptr_Function_v4int Function %34 %val = OpVariable %_ptr_Function_v4int Function %35
%x_40 = OpVariable %_ptr_Function_bool Function %20 %x_40 = OpVariable %_ptr_Function_bool Function %21
%x_41 = OpVariable %_ptr_Function_bool Function %20 %x_41 = OpVariable %_ptr_Function_bool Function %21
%x_54 = OpVariable %_ptr_Function_bool Function %20 %x_54 = OpVariable %_ptr_Function_bool Function %21
%x_55 = OpVariable %_ptr_Function_bool Function %20 %x_55 = OpVariable %_ptr_Function_bool Function %21
%x_65 = OpVariable %_ptr_Function_bool Function %20 %x_65 = OpVariable %_ptr_Function_bool Function %21
%x_66 = OpVariable %_ptr_Function_bool Function %20 %x_66 = OpVariable %_ptr_Function_bool Function %21
%44 = OpAccessChain %_ptr_Uniform_float %x_4 %uint_0 %45 = OpAccessChain %_ptr_Uniform_float %x_4 %uint_0 %uint_0
%45 = OpLoad %float %44 %46 = OpLoad %float %45
%46 = OpConvertFToS %int %45 %47 = OpConvertFToS %int %46
OpStore %unknown %46 OpStore %unknown %47
OpStore %ok %true OpStore %ok %true
OpStore %x_41 %20 OpStore %x_41 %21
OpSelectionMerge %48 None OpSelectionMerge %49 None
OpBranchConditional %true %49 %48 OpBranchConditional %true %50 %49
%50 = OpLabel
%52 = OpCompositeConstruct %v4int %47 %47 %47 %47
%53 = OpSDiv %v4int %35 %52
%54 = OpIEqual %v4bool %53 %35
%51 = OpAll %bool %54
OpStore %x_40 %51
%56 = OpLoad %bool %x_40
OpStore %x_41 %56
OpBranch %49
%49 = OpLabel %49 = OpLabel
%51 = OpCompositeConstruct %v4int %46 %46 %46 %46 %57 = OpLoad %bool %x_41
%52 = OpSDiv %v4int %34 %51 OpStore %ok %57
%53 = OpIEqual %v4bool %52 %34 %58 = OpCompositeConstruct %v4int %47 %47 %47 %47
%50 = OpAll %bool %53 OpStore %val %58
OpStore %x_40 %50 %61 = OpIAdd %v4int %58 %60
%55 = OpLoad %bool %x_40
OpStore %x_41 %55
OpBranch %48
%48 = OpLabel
%56 = OpLoad %bool %x_41
OpStore %ok %56
%57 = OpCompositeConstruct %v4int %46 %46 %46 %46
OpStore %val %57
%60 = OpIAdd %v4int %57 %59
OpStore %val %60
%61 = OpISub %v4int %60 %59
OpStore %val %61 OpStore %val %61
%62 = OpIAdd %v4int %61 %59 %62 = OpISub %v4int %61 %60
OpStore %val %62 OpStore %val %62
%63 = OpISub %v4int %62 %59 %63 = OpIAdd %v4int %62 %60
OpStore %val %63 OpStore %val %63
OpStore %x_55 %20 %64 = OpISub %v4int %63 %60
%64 = OpLoad %bool %x_41 OpStore %val %64
OpSelectionMerge %65 None OpStore %x_55 %21
OpBranchConditional %64 %66 %65 %65 = OpLoad %bool %x_41
OpSelectionMerge %66 None
OpBranchConditional %65 %67 %66
%67 = OpLabel
%69 = OpIEqual %v4bool %64 %58
%68 = OpAll %bool %69
OpStore %x_54 %68
%70 = OpLoad %bool %x_54
OpStore %x_55 %70
OpBranch %66
%66 = OpLabel %66 = OpLabel
%68 = OpIEqual %v4bool %63 %57 %71 = OpLoad %bool %x_55
%67 = OpAll %bool %68 OpStore %ok %71
OpStore %x_54 %67 %74 = OpIMul %v4int %64 %73
%69 = OpLoad %bool %x_54
OpStore %x_55 %69
OpBranch %65
%65 = OpLabel
%70 = OpLoad %bool %x_55
OpStore %ok %70
%73 = OpIMul %v4int %63 %72
OpStore %val %73
%74 = OpSDiv %v4int %73 %72
OpStore %val %74 OpStore %val %74
%75 = OpIMul %v4int %74 %72 %75 = OpSDiv %v4int %74 %73
OpStore %val %75 OpStore %val %75
%76 = OpSDiv %v4int %75 %72 %76 = OpIMul %v4int %75 %73
OpStore %val %76 OpStore %val %76
OpStore %x_66 %20 %77 = OpSDiv %v4int %76 %73
%77 = OpLoad %bool %x_55 OpStore %val %77
OpSelectionMerge %78 None OpStore %x_66 %21
OpBranchConditional %77 %79 %78 %78 = OpLoad %bool %x_55
OpSelectionMerge %79 None
OpBranchConditional %78 %80 %79
%80 = OpLabel
%82 = OpIEqual %v4bool %77 %58
%81 = OpAll %bool %82
OpStore %x_65 %81
%83 = OpLoad %bool %x_65
OpStore %x_66 %83
OpBranch %79
%79 = OpLabel %79 = OpLabel
%81 = OpIEqual %v4bool %76 %57
%80 = OpAll %bool %81
OpStore %x_65 %80
%82 = OpLoad %bool %x_65
OpStore %x_66 %82
OpBranch %78
%78 = OpLabel
%83 = OpLoad %bool %x_66
OpStore %ok %83
%84 = OpLoad %bool %x_66 %84 = OpLoad %bool %x_66
OpReturnValue %84 OpStore %ok %84
%85 = OpLoad %bool %x_66
OpReturnValue %85
OpFunctionEnd OpFunctionEnd
%main_1 = OpFunction %void None %85 %main_1 = OpFunction %void None %86
%88 = OpLabel %89 = OpLabel
%outputColor_S0 = OpVariable %_ptr_Function_v4float Function %10 %outputColor_S0 = OpVariable %_ptr_Function_v4float Function %10
%output_S1 = OpVariable %_ptr_Function_v4float Function %10 %output_S1 = OpVariable %_ptr_Function_v4float Function %10
%x_8_unknown = OpVariable %_ptr_Function_float Function %94 %x_8_unknown = OpVariable %_ptr_Function_float Function %95
%x_9_ok = OpVariable %_ptr_Function_bool Function %20 %x_9_ok = OpVariable %_ptr_Function_bool Function %21
%x_10_val = OpVariable %_ptr_Function_v4float Function %10 %x_10_val = OpVariable %_ptr_Function_v4float Function %10
%x_116 = OpVariable %_ptr_Function_v4float Function %10 %x_116 = OpVariable %_ptr_Function_v4float Function %10
%x_86 = OpVariable %_ptr_Function_bool Function %20 %x_86 = OpVariable %_ptr_Function_bool Function %21
%x_87 = OpVariable %_ptr_Function_bool Function %20 %x_87 = OpVariable %_ptr_Function_bool Function %21
%x_99 = OpVariable %_ptr_Function_bool Function %20 %x_99 = OpVariable %_ptr_Function_bool Function %21
%x_100 = OpVariable %_ptr_Function_bool Function %20 %x_100 = OpVariable %_ptr_Function_bool Function %21
%x_110 = OpVariable %_ptr_Function_bool Function %20 %x_110 = OpVariable %_ptr_Function_bool Function %21
%x_111 = OpVariable %_ptr_Function_bool Function %20 %x_111 = OpVariable %_ptr_Function_bool Function %21
%x_114 = OpVariable %_ptr_Function_bool Function %20 %x_114 = OpVariable %_ptr_Function_bool Function %21
%x_115 = OpVariable %_ptr_Function_bool Function %20 %x_115 = OpVariable %_ptr_Function_bool Function %21
%106 = OpLoad %v4float %vcolor_S0 %107 = OpLoad %v4float %vcolor_S0
OpStore %outputColor_S0 %106 OpStore %outputColor_S0 %107
%107 = OpAccessChain %_ptr_Uniform_float %x_4 %uint_0 %108 = OpAccessChain %_ptr_Uniform_float %x_4 %uint_0 %uint_0
%108 = OpLoad %float %107 %109 = OpLoad %float %108
OpStore %x_8_unknown %108 OpStore %x_8_unknown %109
OpStore %x_9_ok %true OpStore %x_9_ok %true
OpStore %x_87 %20 OpStore %x_87 %21
OpSelectionMerge %109 None OpSelectionMerge %110 None
OpBranchConditional %true %110 %109 OpBranchConditional %true %111 %110
%111 = OpLabel
%113 = OpCompositeConstruct %v4float %109 %109 %109 %109
%114 = OpFDiv %v4float %10 %113
%115 = OpFOrdEqual %v4bool %114 %10
%112 = OpAll %bool %115
OpStore %x_86 %112
%116 = OpLoad %bool %x_86
OpStore %x_87 %116
OpBranch %110
%110 = OpLabel %110 = OpLabel
%112 = OpCompositeConstruct %v4float %108 %108 %108 %108 %117 = OpLoad %bool %x_87
%113 = OpFDiv %v4float %10 %112 OpStore %x_9_ok %117
%114 = OpFOrdEqual %v4bool %113 %10 %118 = OpCompositeConstruct %v4float %109 %109 %109 %109
%111 = OpAll %bool %114 OpStore %x_10_val %118
OpStore %x_86 %111 %121 = OpFAdd %v4float %118 %120
%115 = OpLoad %bool %x_86
OpStore %x_87 %115
OpBranch %109
%109 = OpLabel
%116 = OpLoad %bool %x_87
OpStore %x_9_ok %116
%117 = OpCompositeConstruct %v4float %108 %108 %108 %108
OpStore %x_10_val %117
%120 = OpFAdd %v4float %117 %119
OpStore %x_10_val %120
%121 = OpFSub %v4float %120 %119
OpStore %x_10_val %121 OpStore %x_10_val %121
%122 = OpFAdd %v4float %121 %119 %122 = OpFSub %v4float %121 %120
OpStore %x_10_val %122 OpStore %x_10_val %122
%123 = OpFSub %v4float %122 %119 %123 = OpFAdd %v4float %122 %120
OpStore %x_10_val %123 OpStore %x_10_val %123
OpStore %x_100 %20 %124 = OpFSub %v4float %123 %120
%124 = OpLoad %bool %x_87 OpStore %x_10_val %124
OpSelectionMerge %125 None OpStore %x_100 %21
OpBranchConditional %124 %126 %125 %125 = OpLoad %bool %x_87
OpSelectionMerge %126 None
OpBranchConditional %125 %127 %126
%127 = OpLabel
%129 = OpFOrdEqual %v4bool %124 %118
%128 = OpAll %bool %129
OpStore %x_99 %128
%130 = OpLoad %bool %x_99
OpStore %x_100 %130
OpBranch %126
%126 = OpLabel %126 = OpLabel
%128 = OpFOrdEqual %v4bool %123 %117 %131 = OpLoad %bool %x_100
%127 = OpAll %bool %128 OpStore %x_9_ok %131
OpStore %x_99 %127 %134 = OpFMul %v4float %124 %133
%129 = OpLoad %bool %x_99
OpStore %x_100 %129
OpBranch %125
%125 = OpLabel
%130 = OpLoad %bool %x_100
OpStore %x_9_ok %130
%133 = OpFMul %v4float %123 %132
OpStore %x_10_val %133
%134 = OpFDiv %v4float %133 %132
OpStore %x_10_val %134 OpStore %x_10_val %134
%135 = OpFMul %v4float %134 %132 %135 = OpFDiv %v4float %134 %133
OpStore %x_10_val %135 OpStore %x_10_val %135
%136 = OpFDiv %v4float %135 %132 %136 = OpFMul %v4float %135 %133
OpStore %x_10_val %136 OpStore %x_10_val %136
OpStore %x_111 %20 %137 = OpFDiv %v4float %136 %133
%137 = OpLoad %bool %x_100 OpStore %x_10_val %137
OpSelectionMerge %138 None OpStore %x_111 %21
OpBranchConditional %137 %139 %138 %138 = OpLoad %bool %x_100
OpSelectionMerge %139 None
OpBranchConditional %138 %140 %139
%140 = OpLabel
%142 = OpFOrdEqual %v4bool %137 %118
%141 = OpAll %bool %142
OpStore %x_110 %141
%143 = OpLoad %bool %x_110
OpStore %x_111 %143
OpBranch %139
%139 = OpLabel %139 = OpLabel
%141 = OpFOrdEqual %v4bool %136 %117
%140 = OpAll %bool %141
OpStore %x_110 %140
%142 = OpLoad %bool %x_110
OpStore %x_111 %142
OpBranch %138
%138 = OpLabel
%143 = OpLoad %bool %x_111
OpStore %x_9_ok %143
OpStore %x_115 %20
%144 = OpLoad %bool %x_111 %144 = OpLoad %bool %x_111
OpSelectionMerge %145 None OpStore %x_9_ok %144
OpBranchConditional %144 %146 %145 OpStore %x_115 %21
%145 = OpLoad %bool %x_111
OpSelectionMerge %146 None
OpBranchConditional %145 %147 %146
%147 = OpLabel
%148 = OpFunctionCall %bool %test_int_S1_c0_b
OpStore %x_114 %148
%149 = OpLoad %bool %x_114
OpStore %x_115 %149
OpBranch %146
%146 = OpLabel %146 = OpLabel
%147 = OpFunctionCall %bool %test_int_S1_c0_b %150 = OpLoad %bool %x_115
OpStore %x_114 %147 OpSelectionMerge %151 None
%148 = OpLoad %bool %x_114 OpBranchConditional %150 %152 %153
OpStore %x_115 %148
OpBranch %145
%145 = OpLabel
%149 = OpLoad %bool %x_115
OpSelectionMerge %150 None
OpBranchConditional %149 %151 %152
%151 = OpLabel
%155 = OpAccessChain %_ptr_Uniform_v4float %x_4 %uint_2
%156 = OpLoad %v4float %155
OpStore %x_116 %156
OpBranch %150
%152 = OpLabel %152 = OpLabel
%158 = OpAccessChain %_ptr_Uniform_v4float %x_4 %uint_1 %156 = OpAccessChain %_ptr_Uniform_v4float %x_4 %uint_0 %uint_2
%159 = OpLoad %v4float %158 %157 = OpLoad %v4float %156
OpStore %x_116 %159 OpStore %x_116 %157
OpBranch %150 OpBranch %151
%150 = OpLabel %153 = OpLabel
%160 = OpLoad %v4float %x_116 %159 = OpAccessChain %_ptr_Uniform_v4float %x_4 %uint_0 %uint_1
OpStore %output_S1 %160 %160 = OpLoad %v4float %159
OpStore %sk_FragColor %160 OpStore %x_116 %160
OpBranch %151
%151 = OpLabel
%161 = OpLoad %v4float %x_116
OpStore %output_S1 %161
OpStore %sk_FragColor %161
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%main_inner = OpFunction %main_out None %161 %main_inner = OpFunction %main_out None %162
%sk_Clockwise_param = OpFunctionParameter %bool %sk_Clockwise_param = OpFunctionParameter %bool
%vcolor_S0_param = OpFunctionParameter %v4float %vcolor_S0_param = OpFunctionParameter %v4float
%166 = OpLabel %167 = OpLabel
OpStore %sk_Clockwise %sk_Clockwise_param OpStore %sk_Clockwise %sk_Clockwise_param
OpStore %vcolor_S0 %vcolor_S0_param OpStore %vcolor_S0 %vcolor_S0_param
%167 = OpFunctionCall %void %main_1 %168 = OpFunctionCall %void %main_1
%168 = OpLoad %v4float %sk_FragColor %169 = OpLoad %v4float %sk_FragColor
%169 = OpCompositeConstruct %main_out %168 %170 = OpCompositeConstruct %main_out %169
OpReturnValue %169 OpReturnValue %170
OpFunctionEnd OpFunctionEnd
%main = OpFunction %void None %85 %main = OpFunction %void None %86
%171 = OpLabel %172 = OpLabel
%173 = OpLoad %bool %sk_Clockwise_param_1 %174 = OpLoad %bool %sk_Clockwise_param_1
%174 = OpLoad %v4float %vcolor_S0_param_1 %175 = OpLoad %v4float %vcolor_S0_param_1
%172 = OpFunctionCall %main_out %main_inner %173 %174 %173 = OpFunctionCall %main_out %main_inner %174 %175
%175 = OpCompositeExtract %v4float %172 0 %176 = OpCompositeExtract %v4float %173 0
OpStore %sk_FragColor_1_1 %175 OpStore %sk_FragColor_1_1 %176
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -4,18 +4,26 @@ uint tint_int_dot(uvec3 a, uvec3 b) {
return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]; return a[0]*b[0] + a[1]*b[1] + a[2]*b[2];
} }
layout(binding = 0, std140) uniform g_ubo { struct g {
uvec3 a; uvec3 a;
uint pad; uint pad;
};
struct h {
uint a;
};
layout(binding = 0, std140) uniform i_block_ubo {
g inner;
} i; } i;
layout(binding = 1, std430) buffer h_ssbo { layout(binding = 1, std430) buffer j_block_ssbo {
uint a; h inner;
} j; } j;
void tint_symbol() { void tint_symbol() {
uint l = tint_int_dot(i.a, i.a); uint l = tint_int_dot(i.inner.a, i.inner.a);
j.a = i.a.x; j.inner.a = i.inner.a.x;
} }
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

@ -1,62 +1,70 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 35 ; Bound: 37
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main" OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1 OpExecutionMode %main LocalSize 1 1 1
OpName %i_block "i_block"
OpMemberName %i_block 0 "inner"
OpName %g "g" OpName %g "g"
OpMemberName %g 0 "a" OpMemberName %g 0 "a"
OpName %i "i" OpName %i "i"
OpName %j_block "j_block"
OpMemberName %j_block 0 "inner"
OpName %h "h" OpName %h "h"
OpMemberName %h 0 "a" OpMemberName %h 0 "a"
OpName %j "j" OpName %j "j"
OpName %main "main" OpName %main "main"
OpDecorate %g Block OpDecorate %i_block Block
OpMemberDecorate %i_block 0 Offset 0
OpMemberDecorate %g 0 Offset 0 OpMemberDecorate %g 0 Offset 0
OpDecorate %i NonWritable OpDecorate %i NonWritable
OpDecorate %i DescriptorSet 0 OpDecorate %i DescriptorSet 0
OpDecorate %i Binding 0 OpDecorate %i Binding 0
OpDecorate %h Block OpDecorate %j_block Block
OpMemberDecorate %j_block 0 Offset 0
OpMemberDecorate %h 0 Offset 0 OpMemberDecorate %h 0 Offset 0
OpDecorate %j DescriptorSet 0 OpDecorate %j DescriptorSet 0
OpDecorate %j Binding 1 OpDecorate %j Binding 1
%uint = OpTypeInt 32 0 %uint = OpTypeInt 32 0
%v3uint = OpTypeVector %uint 3 %v3uint = OpTypeVector %uint 3
%g = OpTypeStruct %v3uint %g = OpTypeStruct %v3uint
%_ptr_Uniform_g = OpTypePointer Uniform %g %i_block = OpTypeStruct %g
%i = OpVariable %_ptr_Uniform_g Uniform %_ptr_Uniform_i_block = OpTypePointer Uniform %i_block
%i = OpVariable %_ptr_Uniform_i_block Uniform
%h = OpTypeStruct %uint %h = OpTypeStruct %uint
%_ptr_StorageBuffer_h = OpTypePointer StorageBuffer %h %j_block = OpTypeStruct %h
%j = OpVariable %_ptr_StorageBuffer_h StorageBuffer %_ptr_StorageBuffer_j_block = OpTypePointer StorageBuffer %j_block
%j = OpVariable %_ptr_StorageBuffer_j_block StorageBuffer
%void = OpTypeVoid %void = OpTypeVoid
%9 = OpTypeFunction %void %11 = OpTypeFunction %void
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%_ptr_Uniform_v3uint = OpTypePointer Uniform %v3uint %_ptr_Uniform_v3uint = OpTypePointer Uniform %v3uint
%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
%_ptr_Uniform_uint = OpTypePointer Uniform %uint %_ptr_Uniform_uint = OpTypePointer Uniform %uint
%main = OpFunction %void None %9 %main = OpFunction %void None %11
%12 = OpLabel %14 = OpLabel
%16 = OpAccessChain %_ptr_Uniform_v3uint %i %uint_0 %18 = OpAccessChain %_ptr_Uniform_v3uint %i %uint_0 %uint_0
%17 = OpLoad %v3uint %16
%18 = OpAccessChain %_ptr_Uniform_v3uint %i %uint_0
%19 = OpLoad %v3uint %18 %19 = OpLoad %v3uint %18
%20 = OpCompositeExtract %uint %17 0 %20 = OpAccessChain %_ptr_Uniform_v3uint %i %uint_0 %uint_0
%21 = OpCompositeExtract %uint %19 0 %21 = OpLoad %v3uint %20
%22 = OpIMul %uint %20 %21 %22 = OpCompositeExtract %uint %19 0
%23 = OpCompositeExtract %uint %17 1 %23 = OpCompositeExtract %uint %21 0
%24 = OpCompositeExtract %uint %19 1 %24 = OpIMul %uint %22 %23
%25 = OpIMul %uint %23 %24 %25 = OpCompositeExtract %uint %19 1
%26 = OpIAdd %uint %22 %25 %26 = OpCompositeExtract %uint %21 1
%27 = OpCompositeExtract %uint %17 2 %27 = OpIMul %uint %25 %26
%28 = OpCompositeExtract %uint %19 2 %28 = OpIAdd %uint %24 %27
%29 = OpIMul %uint %27 %28 %29 = OpCompositeExtract %uint %19 2
%13 = OpIAdd %uint %26 %29 %30 = OpCompositeExtract %uint %21 2
%31 = OpAccessChain %_ptr_StorageBuffer_uint %j %uint_0 %31 = OpIMul %uint %29 %30
%33 = OpAccessChain %_ptr_Uniform_uint %i %uint_0 %uint_0 %15 = OpIAdd %uint %28 %31
%34 = OpLoad %uint %33 %33 = OpAccessChain %_ptr_StorageBuffer_uint %j %uint_0 %uint_0
OpStore %31 %34 %35 = OpAccessChain %_ptr_Uniform_uint %i %uint_0 %uint_0 %uint_0
%36 = OpLoad %uint %35
OpStore %33 %36
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -1,12 +1,16 @@
#version 310 es #version 310 es
layout(binding = 0, std140) uniform UniformBuffer_ubo { struct UniformBuffer {
ivec3 d; ivec3 d;
uint pad; uint pad;
};
layout(binding = 0, std140) uniform u_input_block_ubo {
UniformBuffer inner;
} u_input; } u_input;
void tint_symbol() { void tint_symbol() {
ivec3 temp = (u_input.d << uvec3(0u)); ivec3 temp = (u_input.inner.d << uvec3(0u));
} }
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

@ -1,17 +1,20 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 18 ; Bound: 19
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main" OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1 OpExecutionMode %main LocalSize 1 1 1
OpName %u_input_block "u_input_block"
OpMemberName %u_input_block 0 "inner"
OpName %UniformBuffer "UniformBuffer" OpName %UniformBuffer "UniformBuffer"
OpMemberName %UniformBuffer 0 "d" OpMemberName %UniformBuffer 0 "d"
OpName %u_input "u_input" OpName %u_input "u_input"
OpName %main "main" OpName %main "main"
OpDecorate %UniformBuffer Block OpDecorate %u_input_block Block
OpMemberDecorate %u_input_block 0 Offset 0
OpMemberDecorate %UniformBuffer 0 Offset 0 OpMemberDecorate %UniformBuffer 0 Offset 0
OpDecorate %u_input NonWritable OpDecorate %u_input NonWritable
OpDecorate %u_input DescriptorSet 0 OpDecorate %u_input DescriptorSet 0
@ -19,19 +22,20 @@
%int = OpTypeInt 32 1 %int = OpTypeInt 32 1
%v3int = OpTypeVector %int 3 %v3int = OpTypeVector %int 3
%UniformBuffer = OpTypeStruct %v3int %UniformBuffer = OpTypeStruct %v3int
%_ptr_Uniform_UniformBuffer = OpTypePointer Uniform %UniformBuffer %u_input_block = OpTypeStruct %UniformBuffer
%u_input = OpVariable %_ptr_Uniform_UniformBuffer Uniform %_ptr_Uniform_u_input_block = OpTypePointer Uniform %u_input_block
%u_input = OpVariable %_ptr_Uniform_u_input_block Uniform
%void = OpTypeVoid %void = OpTypeVoid
%6 = OpTypeFunction %void %7 = OpTypeFunction %void
%uint = OpTypeInt 32 0 %uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%_ptr_Uniform_v3int = OpTypePointer Uniform %v3int %_ptr_Uniform_v3int = OpTypePointer Uniform %v3int
%v3uint = OpTypeVector %uint 3 %v3uint = OpTypeVector %uint 3
%16 = OpConstantNull %v3uint %17 = OpConstantNull %v3uint
%main = OpFunction %void None %6 %main = OpFunction %void None %7
%9 = OpLabel %10 = OpLabel
%13 = OpAccessChain %_ptr_Uniform_v3int %u_input %uint_0 %14 = OpAccessChain %_ptr_Uniform_v3int %u_input %uint_0 %uint_0
%14 = OpLoad %v3int %13 %15 = OpLoad %v3int %14
%17 = OpShiftLeftLogical %v3int %14 %16 %18 = OpShiftLeftLogical %v3int %15 %17
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -1,12 +1,16 @@
#version 310 es #version 310 es
layout(binding = 0, std430) buffer Input_ssbo { struct Input {
ivec3 position; ivec3 position;
uint pad; uint pad;
};
layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
Input inner;
} tint_symbol; } tint_symbol;
void tint_symbol_1(uvec3 id) { void tint_symbol_1(uvec3 id) {
ivec3 pos = (tint_symbol.position - ivec3(0)); ivec3 pos = (tint_symbol.inner.position - ivec3(0));
} }
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

@ -1,13 +1,15 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 26 ; Bound: 27
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main" %id_1 OpEntryPoint GLCompute %main "main" %id_1
OpExecutionMode %main LocalSize 1 1 1 OpExecutionMode %main LocalSize 1 1 1
OpName %id_1 "id_1" OpName %id_1 "id_1"
OpName %input_block "input_block"
OpMemberName %input_block 0 "inner"
OpName %Input "Input" OpName %Input "Input"
OpMemberName %Input 0 "position" OpMemberName %Input 0 "position"
OpName %input "input" OpName %input "input"
@ -15,7 +17,8 @@
OpName %id "id" OpName %id "id"
OpName %main "main" OpName %main "main"
OpDecorate %id_1 BuiltIn GlobalInvocationId OpDecorate %id_1 BuiltIn GlobalInvocationId
OpDecorate %Input Block OpDecorate %input_block Block
OpMemberDecorate %input_block 0 Offset 0
OpMemberDecorate %Input 0 Offset 0 OpMemberDecorate %Input 0 Offset 0
OpDecorate %input NonWritable OpDecorate %input NonWritable
OpDecorate %input DescriptorSet 0 OpDecorate %input DescriptorSet 0
@ -27,25 +30,26 @@
%int = OpTypeInt 32 1 %int = OpTypeInt 32 1
%v3int = OpTypeVector %int 3 %v3int = OpTypeVector %int 3
%Input = OpTypeStruct %v3int %Input = OpTypeStruct %v3int
%_ptr_StorageBuffer_Input = OpTypePointer StorageBuffer %Input %input_block = OpTypeStruct %Input
%input = OpVariable %_ptr_StorageBuffer_Input StorageBuffer %_ptr_StorageBuffer_input_block = OpTypePointer StorageBuffer %input_block
%input = OpVariable %_ptr_StorageBuffer_input_block StorageBuffer
%void = OpTypeVoid %void = OpTypeVoid
%10 = OpTypeFunction %void %v3uint %11 = OpTypeFunction %void %v3uint
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer_v3int = OpTypePointer StorageBuffer %v3int %_ptr_StorageBuffer_v3int = OpTypePointer StorageBuffer %v3int
%19 = OpConstantNull %v3int %20 = OpConstantNull %v3int
%21 = OpTypeFunction %void %22 = OpTypeFunction %void
%main_inner = OpFunction %void None %10 %main_inner = OpFunction %void None %11
%id = OpFunctionParameter %v3uint %id = OpFunctionParameter %v3uint
%14 = OpLabel %15 = OpLabel
%17 = OpAccessChain %_ptr_StorageBuffer_v3int %input %uint_0 %18 = OpAccessChain %_ptr_StorageBuffer_v3int %input %uint_0 %uint_0
%18 = OpLoad %v3int %17 %19 = OpLoad %v3int %18
%20 = OpISub %v3int %18 %19 %21 = OpISub %v3int %19 %20
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%main = OpFunction %void None %21 %main = OpFunction %void None %22
%23 = OpLabel %24 = OpLabel
%25 = OpLoad %v3uint %id_1 %26 = OpLoad %v3uint %id_1
%24 = OpFunctionCall %void %main_inner %25 %25 = OpFunctionCall %void %main_inner %26
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -0,0 +1,14 @@
struct S {
f : f32,
};
@group(0) @binding(0)
var<storage, read> in : S;
@group(0) @binding(1)
var<storage, read_write> out : S;
@compute @workgroup_size(1)
fn main() {
out = in;
}

View File

@ -0,0 +1,21 @@
struct S {
float f;
};
ByteAddressBuffer tint_symbol : register(t0, space0);
RWByteAddressBuffer tint_symbol_1 : register(u1, space0);
void tint_symbol_2(RWByteAddressBuffer buffer, uint offset, S value) {
buffer.Store((offset + 0u), asuint(value.f));
}
S tint_symbol_4(ByteAddressBuffer buffer, uint offset) {
const S tint_symbol_6 = {asfloat(buffer.Load((offset + 0u)))};
return tint_symbol_6;
}
[numthreads(1, 1, 1)]
void main() {
tint_symbol_2(tint_symbol_1, 0u, tint_symbol_4(tint_symbol, 0u));
return;
}

View File

@ -0,0 +1,21 @@
struct S {
float f;
};
ByteAddressBuffer tint_symbol : register(t0, space0);
RWByteAddressBuffer tint_symbol_1 : register(u1, space0);
void tint_symbol_2(RWByteAddressBuffer buffer, uint offset, S value) {
buffer.Store((offset + 0u), asuint(value.f));
}
S tint_symbol_4(ByteAddressBuffer buffer, uint offset) {
const S tint_symbol_6 = {asfloat(buffer.Load((offset + 0u)))};
return tint_symbol_6;
}
[numthreads(1, 1, 1)]
void main() {
tint_symbol_2(tint_symbol_1, 0u, tint_symbol_4(tint_symbol, 0u));
return;
}

View File

@ -0,0 +1,23 @@
#version 310 es
struct S {
float f;
};
layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
S inner;
} tint_symbol;
layout(binding = 1, std430) buffer tint_symbol_block_ssbo_1 {
S inner;
} tint_symbol_1;
void tint_symbol_2() {
tint_symbol_1.inner = tint_symbol.inner;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
tint_symbol_2();
return;
}

View File

@ -0,0 +1,12 @@
#include <metal_stdlib>
using namespace metal;
struct S {
/* 0x0000 */ float f;
};
kernel void tint_symbol(device S* tint_symbol_1 [[buffer(0)]], const device S* tint_symbol_2 [[buffer(1)]]) {
*(tint_symbol_1) = *(tint_symbol_2);
return;
}

View File

@ -0,0 +1,43 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 17
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %in_block "in_block"
OpMemberName %in_block 0 "inner"
OpName %S "S"
OpMemberName %S 0 "f"
OpName %in "in"
OpName %out "out"
OpName %main "main"
OpDecorate %in_block Block
OpMemberDecorate %in_block 0 Offset 0
OpMemberDecorate %S 0 Offset 0
OpDecorate %in NonWritable
OpDecorate %in DescriptorSet 0
OpDecorate %in Binding 0
OpDecorate %out DescriptorSet 0
OpDecorate %out Binding 1
%float = OpTypeFloat 32
%S = OpTypeStruct %float
%in_block = OpTypeStruct %S
%_ptr_StorageBuffer_in_block = OpTypePointer StorageBuffer %in_block
%in = OpVariable %_ptr_StorageBuffer_in_block StorageBuffer
%out = OpVariable %_ptr_StorageBuffer_in_block StorageBuffer
%void = OpTypeVoid
%7 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
%main = OpFunction %void None %7
%10 = OpLabel
%14 = OpAccessChain %_ptr_StorageBuffer_S %out %uint_0
%15 = OpAccessChain %_ptr_StorageBuffer_S %in %uint_0
%16 = OpLoad %S %15
OpStore %14 %16
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,12 @@
struct S {
f : f32,
}
@group(0) @binding(0) var<storage, read> in : S;
@group(0) @binding(1) var<storage, read_write> out : S;
@compute @workgroup_size(1)
fn main() {
out = in;
}

View File

@ -1,27 +1,31 @@
#version 310 es #version 310 es
layout(binding = 0, std430) buffer Buf_ssbo { struct Buf {
uint count; uint count;
uint data[50]; uint data[50];
};
layout(binding = 0, std430) buffer b_block_ssbo {
Buf inner;
} b; } b;
void tint_symbol() { void tint_symbol() {
uint i = 0u; uint i = 0u;
while (true) { while (true) {
if ((i >= b.count)) { if ((i >= b.inner.count)) {
break; break;
} }
uint p_save = i; uint p_save = i;
if (((i % 2u) == 0u)) { if (((i % 2u) == 0u)) {
{ {
b.data[p_save] = (b.data[p_save] * 2u); b.inner.data[p_save] = (b.inner.data[p_save] * 2u);
i = (i + 1u); i = (i + 1u);
} }
continue; continue;
} }
b.data[p_save] = 0u; b.inner.data[p_save] = 0u;
{ {
b.data[p_save] = (b.data[p_save] * 2u); b.inner.data[p_save] = (b.inner.data[p_save] * 2u);
i = (i + 1u); i = (i + 1u);
} }
} }

View File

@ -1,19 +1,22 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 42 ; Bound: 43
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main" OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1 OpExecutionMode %main LocalSize 1 1 1
OpName %b_block "b_block"
OpMemberName %b_block 0 "inner"
OpName %Buf "Buf" OpName %Buf "Buf"
OpMemberName %Buf 0 "count" OpMemberName %Buf 0 "count"
OpMemberName %Buf 1 "data" OpMemberName %Buf 1 "data"
OpName %b "b" OpName %b "b"
OpName %main "main" OpName %main "main"
OpName %i "i" OpName %i "i"
OpDecorate %Buf Block OpDecorate %b_block Block
OpMemberDecorate %b_block 0 Offset 0
OpMemberDecorate %Buf 0 Offset 0 OpMemberDecorate %Buf 0 Offset 0
OpMemberDecorate %Buf 1 Offset 4 OpMemberDecorate %Buf 1 Offset 4
OpDecorate %_arr_uint_uint_50 ArrayStride 4 OpDecorate %_arr_uint_uint_50 ArrayStride 4
@ -23,57 +26,58 @@
%uint_50 = OpConstant %uint 50 %uint_50 = OpConstant %uint 50
%_arr_uint_uint_50 = OpTypeArray %uint %uint_50 %_arr_uint_uint_50 = OpTypeArray %uint %uint_50
%Buf = OpTypeStruct %uint %_arr_uint_uint_50 %Buf = OpTypeStruct %uint %_arr_uint_uint_50
%_ptr_StorageBuffer_Buf = OpTypePointer StorageBuffer %Buf %b_block = OpTypeStruct %Buf
%b = OpVariable %_ptr_StorageBuffer_Buf StorageBuffer %_ptr_StorageBuffer_b_block = OpTypePointer StorageBuffer %b_block
%b = OpVariable %_ptr_StorageBuffer_b_block StorageBuffer
%void = OpTypeVoid %void = OpTypeVoid
%7 = OpTypeFunction %void %8 = OpTypeFunction %void
%11 = OpConstantNull %uint %12 = OpConstantNull %uint
%_ptr_Function_uint = OpTypePointer Function %uint %_ptr_Function_uint = OpTypePointer Function %uint
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
%bool = OpTypeBool %bool = OpTypeBool
%uint_2 = OpConstant %uint 2 %uint_2 = OpConstant %uint 2
%uint_1 = OpConstant %uint 1 %uint_1 = OpConstant %uint 1
%main = OpFunction %void None %7 %main = OpFunction %void None %8
%10 = OpLabel %11 = OpLabel
%i = OpVariable %_ptr_Function_uint Function %11 %i = OpVariable %_ptr_Function_uint Function %12
OpStore %i %11 OpStore %i %12
OpBranch %14 OpBranch %15
%14 = OpLabel %15 = OpLabel
OpLoopMerge %15 %16 None OpLoopMerge %16 %17 None
OpBranch %18
%18 = OpLabel
%19 = OpLoad %uint %i
%22 = OpAccessChain %_ptr_StorageBuffer_uint %b %uint_0 %uint_0
%23 = OpLoad %uint %22
%24 = OpUGreaterThanEqual %bool %19 %23
OpSelectionMerge %26 None
OpBranchConditional %24 %27 %26
%27 = OpLabel
OpBranch %16
%26 = OpLabel
%28 = OpLoad %uint %i
%29 = OpLoad %uint %i
%31 = OpUMod %uint %29 %uint_2
%32 = OpIEqual %bool %31 %12
OpSelectionMerge %33 None
OpBranchConditional %32 %34 %33
%34 = OpLabel
OpBranch %17
%33 = OpLabel
%36 = OpAccessChain %_ptr_StorageBuffer_uint %b %uint_0 %uint_1 %28
OpStore %36 %12
OpBranch %17 OpBranch %17
%17 = OpLabel %17 = OpLabel
%18 = OpLoad %uint %i %37 = OpAccessChain %_ptr_StorageBuffer_uint %b %uint_0 %uint_1 %28
%21 = OpAccessChain %_ptr_StorageBuffer_uint %b %uint_0 %38 = OpAccessChain %_ptr_StorageBuffer_uint %b %uint_0 %uint_1 %28
%22 = OpLoad %uint %21 %39 = OpLoad %uint %38
%23 = OpUGreaterThanEqual %bool %18 %22 %40 = OpIMul %uint %39 %uint_2
OpSelectionMerge %25 None OpStore %37 %40
OpBranchConditional %23 %26 %25 %41 = OpLoad %uint %i
%26 = OpLabel %42 = OpIAdd %uint %41 %uint_1
OpStore %i %42
OpBranch %15 OpBranch %15
%25 = OpLabel
%27 = OpLoad %uint %i
%28 = OpLoad %uint %i
%30 = OpUMod %uint %28 %uint_2
%31 = OpIEqual %bool %30 %11
OpSelectionMerge %32 None
OpBranchConditional %31 %33 %32
%33 = OpLabel
OpBranch %16
%32 = OpLabel
%35 = OpAccessChain %_ptr_StorageBuffer_uint %b %uint_1 %27
OpStore %35 %11
OpBranch %16
%16 = OpLabel %16 = OpLabel
%36 = OpAccessChain %_ptr_StorageBuffer_uint %b %uint_1 %27
%37 = OpAccessChain %_ptr_StorageBuffer_uint %b %uint_1 %27
%38 = OpLoad %uint %37
%39 = OpIMul %uint %38 %uint_2
OpStore %36 %39
%40 = OpLoad %uint %i
%41 = OpIAdd %uint %40 %uint_1
OpStore %i %41
OpBranch %14
%15 = OpLabel
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -4,12 +4,20 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void unused_entry_point() { void unused_entry_point() {
return; return;
} }
layout(binding = 0, std430) buffer S_ssbo { struct S {
mat2 m; mat2 m;
} SSBO; };
layout(binding = 0, std140) uniform S_std140_ubo { struct S_std140 {
vec2 m_0; vec2 m_0;
vec2 m_1; vec2 m_1;
};
layout(binding = 0, std430) buffer SSBO_block_ssbo {
S inner;
} SSBO;
layout(binding = 0, std140) uniform SSBO_block_std140_ubo {
S_std140 inner;
} UBO; } UBO;

Some files were not shown because too many files have changed in this diff Show More