mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-16 00:17:03 +00:00
tint/writer: Handle unnested, uniform matCx2 matrices
Shuffle the transform orders to ensure that these are embedded in a structure before running the Std140 transform. Add more end-to-end tests for these. As pointed out in tint:1673, arrays of matrices are not correctly decomposed by the Std140 transform. This will be addressed by a later change. Bug: tint:1673 Change-Id: I47c93e458ff48578922d576819792e8ed3a5723c Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/102541 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Zhaoming Jiang <zhaoming.jiang@intel.com> Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
committed by
Dawn LUCI CQ
parent
2bfd9f8c83
commit
84b43d61fa
@@ -0,0 +1,31 @@
|
||||
struct Inner {
|
||||
m : mat2x2<f32>,
|
||||
}
|
||||
|
||||
struct Outer {
|
||||
a : array<Inner, 4>,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<uniform> a : array<Outer, 4>;
|
||||
|
||||
var<private> counter = 0;
|
||||
fn i() -> i32 { counter++; return counter; }
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn f() {
|
||||
let p_a = &a;
|
||||
let p_a_i = &((*p_a)[i()]);
|
||||
let p_a_i_a = &((*p_a_i).a);
|
||||
let p_a_i_a_i = &((*p_a_i_a)[i()]);
|
||||
let p_a_i_a_i_m = &((*p_a_i_a_i).m);
|
||||
let p_a_i_a_i_m_i = &((*p_a_i_a_i_m)[i()]);
|
||||
|
||||
|
||||
let l_a : array<Outer, 4> = *p_a;
|
||||
let l_a_i : Outer = *p_a_i;
|
||||
let l_a_i_a : array<Inner, 4> = *p_a_i_a;
|
||||
let l_a_i_a_i : Inner = *p_a_i_a_i;
|
||||
let l_a_i_a_i_m : mat2x2<f32> = *p_a_i_a_i_m;
|
||||
let l_a_i_a_i_m_i : vec2<f32> = *p_a_i_a_i_m_i;
|
||||
let l_a_i_a_i_m_i_i : f32 = (*p_a_i_a_i_m_i)[i()];
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
struct Inner {
|
||||
float2x2 m;
|
||||
};
|
||||
struct Outer {
|
||||
Inner a[4];
|
||||
};
|
||||
|
||||
cbuffer cbuffer_a : register(b0, space0) {
|
||||
uint4 a[16];
|
||||
};
|
||||
static int counter = 0;
|
||||
|
||||
int i() {
|
||||
counter = (counter + 1);
|
||||
return counter;
|
||||
}
|
||||
|
||||
float2x2 tint_symbol_8(uint4 buffer[16], uint offset) {
|
||||
const uint scalar_offset = ((offset + 0u)) / 4;
|
||||
uint4 ubo_load = buffer[scalar_offset / 4];
|
||||
const uint scalar_offset_1 = ((offset + 8u)) / 4;
|
||||
uint4 ubo_load_1 = buffer[scalar_offset_1 / 4];
|
||||
return float2x2(asfloat(((scalar_offset & 2) ? ubo_load.zw : ubo_load.xy)), asfloat(((scalar_offset_1 & 2) ? ubo_load_1.zw : ubo_load_1.xy)));
|
||||
}
|
||||
|
||||
Inner tint_symbol_7(uint4 buffer[16], uint offset) {
|
||||
const Inner tint_symbol_11 = {tint_symbol_8(buffer, (offset + 0u))};
|
||||
return tint_symbol_11;
|
||||
}
|
||||
|
||||
typedef Inner tint_symbol_6_ret[4];
|
||||
tint_symbol_6_ret tint_symbol_6(uint4 buffer[16], uint offset) {
|
||||
Inner arr[4] = (Inner[4])0;
|
||||
{
|
||||
[loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
|
||||
arr[i_1] = tint_symbol_7(buffer, (offset + (i_1 * 16u)));
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
Outer tint_symbol_5(uint4 buffer[16], uint offset) {
|
||||
const Outer tint_symbol_12 = {tint_symbol_6(buffer, (offset + 0u))};
|
||||
return tint_symbol_12;
|
||||
}
|
||||
|
||||
typedef Outer tint_symbol_4_ret[4];
|
||||
tint_symbol_4_ret tint_symbol_4(uint4 buffer[16], uint offset) {
|
||||
Outer arr_1[4] = (Outer[4])0;
|
||||
{
|
||||
[loop] for(uint i_2 = 0u; (i_2 < 4u); i_2 = (i_2 + 1u)) {
|
||||
arr_1[i_2] = tint_symbol_5(buffer, (offset + (i_2 * 64u)));
|
||||
}
|
||||
}
|
||||
return arr_1;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void f() {
|
||||
const int p_a_i_save = i();
|
||||
const int p_a_i_a_i_save = i();
|
||||
const int p_a_i_a_i_m_i_save = i();
|
||||
const Outer l_a[4] = tint_symbol_4(a, 0u);
|
||||
const Outer l_a_i = tint_symbol_5(a, (64u * uint(p_a_i_save)));
|
||||
const Inner l_a_i_a[4] = tint_symbol_6(a, (64u * uint(p_a_i_save)));
|
||||
const Inner l_a_i_a_i = tint_symbol_7(a, ((64u * uint(p_a_i_save)) + (16u * uint(p_a_i_a_i_save))));
|
||||
const float2x2 l_a_i_a_i_m = tint_symbol_8(a, ((64u * uint(p_a_i_save)) + (16u * uint(p_a_i_a_i_save))));
|
||||
const uint scalar_offset_2 = ((((64u * uint(p_a_i_save)) + (16u * uint(p_a_i_a_i_save))) + (8u * uint(p_a_i_a_i_m_i_save)))) / 4;
|
||||
uint4 ubo_load_2 = a[scalar_offset_2 / 4];
|
||||
const float2 l_a_i_a_i_m_i = asfloat(((scalar_offset_2 & 2) ? ubo_load_2.zw : ubo_load_2.xy));
|
||||
const int tint_symbol = p_a_i_save;
|
||||
const int tint_symbol_1 = p_a_i_a_i_save;
|
||||
const int tint_symbol_2 = p_a_i_a_i_m_i_save;
|
||||
const int tint_symbol_3 = i();
|
||||
const uint scalar_offset_3 = (((((64u * uint(tint_symbol)) + (16u * uint(tint_symbol_1))) + (8u * uint(tint_symbol_2))) + (4u * uint(tint_symbol_3)))) / 4;
|
||||
const float l_a_i_a_i_m_i_i = asfloat(a[scalar_offset_3 / 4][scalar_offset_3 % 4]);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
struct Inner {
|
||||
float2x2 m;
|
||||
};
|
||||
struct Outer {
|
||||
Inner a[4];
|
||||
};
|
||||
|
||||
cbuffer cbuffer_a : register(b0, space0) {
|
||||
uint4 a[16];
|
||||
};
|
||||
static int counter = 0;
|
||||
|
||||
int i() {
|
||||
counter = (counter + 1);
|
||||
return counter;
|
||||
}
|
||||
|
||||
float2x2 tint_symbol_8(uint4 buffer[16], uint offset) {
|
||||
const uint scalar_offset = ((offset + 0u)) / 4;
|
||||
uint4 ubo_load = buffer[scalar_offset / 4];
|
||||
const uint scalar_offset_1 = ((offset + 8u)) / 4;
|
||||
uint4 ubo_load_1 = buffer[scalar_offset_1 / 4];
|
||||
return float2x2(asfloat(((scalar_offset & 2) ? ubo_load.zw : ubo_load.xy)), asfloat(((scalar_offset_1 & 2) ? ubo_load_1.zw : ubo_load_1.xy)));
|
||||
}
|
||||
|
||||
Inner tint_symbol_7(uint4 buffer[16], uint offset) {
|
||||
const Inner tint_symbol_11 = {tint_symbol_8(buffer, (offset + 0u))};
|
||||
return tint_symbol_11;
|
||||
}
|
||||
|
||||
typedef Inner tint_symbol_6_ret[4];
|
||||
tint_symbol_6_ret tint_symbol_6(uint4 buffer[16], uint offset) {
|
||||
Inner arr[4] = (Inner[4])0;
|
||||
{
|
||||
[loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
|
||||
arr[i_1] = tint_symbol_7(buffer, (offset + (i_1 * 16u)));
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
Outer tint_symbol_5(uint4 buffer[16], uint offset) {
|
||||
const Outer tint_symbol_12 = {tint_symbol_6(buffer, (offset + 0u))};
|
||||
return tint_symbol_12;
|
||||
}
|
||||
|
||||
typedef Outer tint_symbol_4_ret[4];
|
||||
tint_symbol_4_ret tint_symbol_4(uint4 buffer[16], uint offset) {
|
||||
Outer arr_1[4] = (Outer[4])0;
|
||||
{
|
||||
[loop] for(uint i_2 = 0u; (i_2 < 4u); i_2 = (i_2 + 1u)) {
|
||||
arr_1[i_2] = tint_symbol_5(buffer, (offset + (i_2 * 64u)));
|
||||
}
|
||||
}
|
||||
return arr_1;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void f() {
|
||||
const int p_a_i_save = i();
|
||||
const int p_a_i_a_i_save = i();
|
||||
const int p_a_i_a_i_m_i_save = i();
|
||||
const Outer l_a[4] = tint_symbol_4(a, 0u);
|
||||
const Outer l_a_i = tint_symbol_5(a, (64u * uint(p_a_i_save)));
|
||||
const Inner l_a_i_a[4] = tint_symbol_6(a, (64u * uint(p_a_i_save)));
|
||||
const Inner l_a_i_a_i = tint_symbol_7(a, ((64u * uint(p_a_i_save)) + (16u * uint(p_a_i_a_i_save))));
|
||||
const float2x2 l_a_i_a_i_m = tint_symbol_8(a, ((64u * uint(p_a_i_save)) + (16u * uint(p_a_i_a_i_save))));
|
||||
const uint scalar_offset_2 = ((((64u * uint(p_a_i_save)) + (16u * uint(p_a_i_a_i_save))) + (8u * uint(p_a_i_a_i_m_i_save)))) / 4;
|
||||
uint4 ubo_load_2 = a[scalar_offset_2 / 4];
|
||||
const float2 l_a_i_a_i_m_i = asfloat(((scalar_offset_2 & 2) ? ubo_load_2.zw : ubo_load_2.xy));
|
||||
const int tint_symbol = p_a_i_save;
|
||||
const int tint_symbol_1 = p_a_i_a_i_save;
|
||||
const int tint_symbol_2 = p_a_i_a_i_m_i_save;
|
||||
const int tint_symbol_3 = i();
|
||||
const uint scalar_offset_3 = (((((64u * uint(tint_symbol)) + (16u * uint(tint_symbol_1))) + (8u * uint(tint_symbol_2))) + (4u * uint(tint_symbol_3)))) / 4;
|
||||
const float l_a_i_a_i_m_i_i = asfloat(a[scalar_offset_3 / 4][scalar_offset_3 % 4]);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
#version 310 es
|
||||
|
||||
struct Inner {
|
||||
mat2 m;
|
||||
};
|
||||
|
||||
struct Inner_std140 {
|
||||
vec2 m_0;
|
||||
vec2 m_1;
|
||||
};
|
||||
|
||||
struct Outer {
|
||||
Inner a[4];
|
||||
};
|
||||
|
||||
struct Outer_std140 {
|
||||
Inner_std140 a[4];
|
||||
};
|
||||
|
||||
layout(binding = 0, std140) uniform a_block_std140_ubo {
|
||||
Outer_std140 inner[4];
|
||||
} a;
|
||||
|
||||
int counter = 0;
|
||||
int i() {
|
||||
counter = (counter + 1);
|
||||
return counter;
|
||||
}
|
||||
|
||||
Inner conv_Inner(Inner_std140 val) {
|
||||
return Inner(mat2(val.m_0, val.m_1));
|
||||
}
|
||||
|
||||
Inner[4] conv_arr_4_Inner(Inner_std140 val[4]) {
|
||||
Inner arr[4] = Inner[4](Inner(mat2(0.0f, 0.0f, 0.0f, 0.0f)), Inner(mat2(0.0f, 0.0f, 0.0f, 0.0f)), Inner(mat2(0.0f, 0.0f, 0.0f, 0.0f)), Inner(mat2(0.0f, 0.0f, 0.0f, 0.0f)));
|
||||
{
|
||||
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
|
||||
arr[i] = conv_Inner(val[i]);
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
Outer conv_Outer(Outer_std140 val) {
|
||||
return Outer(conv_arr_4_Inner(val.a));
|
||||
}
|
||||
|
||||
Outer[4] conv_arr_4_Outer(Outer_std140 val[4]) {
|
||||
Outer arr[4] = Outer[4](Outer(Inner[4](Inner(mat2(0.0f, 0.0f, 0.0f, 0.0f)), Inner(mat2(0.0f, 0.0f, 0.0f, 0.0f)), Inner(mat2(0.0f, 0.0f, 0.0f, 0.0f)), Inner(mat2(0.0f, 0.0f, 0.0f, 0.0f)))), Outer(Inner[4](Inner(mat2(0.0f, 0.0f, 0.0f, 0.0f)), Inner(mat2(0.0f, 0.0f, 0.0f, 0.0f)), Inner(mat2(0.0f, 0.0f, 0.0f, 0.0f)), Inner(mat2(0.0f, 0.0f, 0.0f, 0.0f)))), Outer(Inner[4](Inner(mat2(0.0f, 0.0f, 0.0f, 0.0f)), Inner(mat2(0.0f, 0.0f, 0.0f, 0.0f)), Inner(mat2(0.0f, 0.0f, 0.0f, 0.0f)), Inner(mat2(0.0f, 0.0f, 0.0f, 0.0f)))), Outer(Inner[4](Inner(mat2(0.0f, 0.0f, 0.0f, 0.0f)), Inner(mat2(0.0f, 0.0f, 0.0f, 0.0f)), Inner(mat2(0.0f, 0.0f, 0.0f, 0.0f)), Inner(mat2(0.0f, 0.0f, 0.0f, 0.0f)))));
|
||||
{
|
||||
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
|
||||
arr[i] = conv_Outer(val[i]);
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
mat2 load_a_inner_p0_a_p1_m(uint p0, uint p1) {
|
||||
uint s_save = p0;
|
||||
uint s_save_1 = p1;
|
||||
return mat2(a.inner[s_save].a[s_save_1].m_0, a.inner[s_save].a[s_save_1].m_1);
|
||||
}
|
||||
|
||||
vec2 load_a_inner_p0_a_p1_m_p2(uint p0, uint p1, uint p2) {
|
||||
switch(p2) {
|
||||
case 0u: {
|
||||
return a.inner[p0].a[p1].m_0;
|
||||
break;
|
||||
}
|
||||
case 1u: {
|
||||
return a.inner[p0].a[p1].m_1;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
return vec2(0.0f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
float load_a_inner_p0_a_p1_m_p2_p3(uint p0, uint p1, uint p2, uint p3) {
|
||||
switch(p2) {
|
||||
case 0u: {
|
||||
return a.inner[p0].a[p1].m_0[p3];
|
||||
break;
|
||||
}
|
||||
case 1u: {
|
||||
return a.inner[p0].a[p1].m_1[p3];
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
return 0.0f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void f() {
|
||||
Outer p_a[4] = conv_arr_4_Outer(a.inner);
|
||||
int tint_symbol = i();
|
||||
Outer p_a_i = conv_Outer(a.inner[tint_symbol]);
|
||||
Inner p_a_i_a[4] = conv_arr_4_Inner(a.inner[tint_symbol].a);
|
||||
int tint_symbol_1 = i();
|
||||
Inner p_a_i_a_i = conv_Inner(a.inner[tint_symbol].a[tint_symbol_1]);
|
||||
mat2 p_a_i_a_i_m = load_a_inner_p0_a_p1_m(uint(tint_symbol), uint(tint_symbol_1));
|
||||
int tint_symbol_2 = i();
|
||||
vec2 p_a_i_a_i_m_i = load_a_inner_p0_a_p1_m_p2(uint(tint_symbol), uint(tint_symbol_1), uint(tint_symbol_2));
|
||||
Outer l_a[4] = conv_arr_4_Outer(a.inner);
|
||||
Outer l_a_i = conv_Outer(a.inner[tint_symbol]);
|
||||
Inner l_a_i_a[4] = conv_arr_4_Inner(a.inner[tint_symbol].a);
|
||||
Inner l_a_i_a_i = conv_Inner(a.inner[tint_symbol].a[tint_symbol_1]);
|
||||
mat2 l_a_i_a_i_m = load_a_inner_p0_a_p1_m(uint(tint_symbol), uint(tint_symbol_1));
|
||||
vec2 l_a_i_a_i_m_i = load_a_inner_p0_a_p1_m_p2(uint(tint_symbol), uint(tint_symbol_1), uint(tint_symbol_2));
|
||||
int tint_symbol_3 = i();
|
||||
float l_a_i_a_i_m_i_i = load_a_inner_p0_a_p1_m_p2_p3(uint(tint_symbol), uint(tint_symbol_1), uint(tint_symbol_2), uint(tint_symbol_3));
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
f();
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
template<typename T, size_t N>
|
||||
struct tint_array {
|
||||
const constant T& operator[](size_t i) const constant { return elements[i]; }
|
||||
device T& operator[](size_t i) device { return elements[i]; }
|
||||
const device T& operator[](size_t i) const device { return elements[i]; }
|
||||
thread T& operator[](size_t i) thread { return elements[i]; }
|
||||
const thread T& operator[](size_t i) const thread { return elements[i]; }
|
||||
threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
|
||||
const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
|
||||
T elements[N];
|
||||
};
|
||||
|
||||
struct Inner {
|
||||
/* 0x0000 */ float2x2 m;
|
||||
};
|
||||
|
||||
struct Outer {
|
||||
/* 0x0000 */ tint_array<Inner, 4> a;
|
||||
};
|
||||
|
||||
int i() {
|
||||
thread int tint_symbol_4 = 0;
|
||||
tint_symbol_4 = as_type<int>((as_type<uint>(tint_symbol_4) + as_type<uint>(1)));
|
||||
return tint_symbol_4;
|
||||
}
|
||||
|
||||
kernel void f(const constant tint_array<Outer, 4>* tint_symbol_5 [[buffer(0)]]) {
|
||||
int const tint_symbol = i();
|
||||
int const p_a_i_save = tint_symbol;
|
||||
int const tint_symbol_1 = i();
|
||||
int const p_a_i_a_i_save = tint_symbol_1;
|
||||
int const tint_symbol_2 = i();
|
||||
int const p_a_i_a_i_m_i_save = tint_symbol_2;
|
||||
tint_array<Outer, 4> const l_a = *(tint_symbol_5);
|
||||
Outer const l_a_i = (*(tint_symbol_5))[p_a_i_save];
|
||||
tint_array<Inner, 4> const l_a_i_a = (*(tint_symbol_5))[p_a_i_save].a;
|
||||
Inner const l_a_i_a_i = (*(tint_symbol_5))[p_a_i_save].a[p_a_i_a_i_save];
|
||||
float2x2 const l_a_i_a_i_m = (*(tint_symbol_5))[p_a_i_save].a[p_a_i_a_i_save].m;
|
||||
float2 const l_a_i_a_i_m_i = (*(tint_symbol_5))[p_a_i_save].a[p_a_i_a_i_save].m[p_a_i_a_i_m_i_save];
|
||||
int const tint_symbol_3 = i();
|
||||
float const l_a_i_a_i_m_i_i = (*(tint_symbol_5))[p_a_i_save].a[p_a_i_a_i_save].m[p_a_i_a_i_m_i_save][tint_symbol_3];
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,306 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 193
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %f "f"
|
||||
OpExecutionMode %f LocalSize 1 1 1
|
||||
OpName %a_block_std140 "a_block_std140"
|
||||
OpMemberName %a_block_std140 0 "inner"
|
||||
OpName %Outer_std140 "Outer_std140"
|
||||
OpMemberName %Outer_std140 0 "a"
|
||||
OpName %Inner_std140 "Inner_std140"
|
||||
OpMemberName %Inner_std140 0 "m_0"
|
||||
OpMemberName %Inner_std140 1 "m_1"
|
||||
OpName %a "a"
|
||||
OpName %counter "counter"
|
||||
OpName %i "i"
|
||||
OpName %Inner "Inner"
|
||||
OpMemberName %Inner 0 "m"
|
||||
OpName %conv_Inner "conv_Inner"
|
||||
OpName %val "val"
|
||||
OpName %conv_arr_4_Inner "conv_arr_4_Inner"
|
||||
OpName %val_0 "val"
|
||||
OpName %arr "arr"
|
||||
OpName %i_0 "i"
|
||||
OpName %var_for_index_1 "var_for_index_1"
|
||||
OpName %Outer "Outer"
|
||||
OpMemberName %Outer 0 "a"
|
||||
OpName %conv_Outer "conv_Outer"
|
||||
OpName %val_1 "val"
|
||||
OpName %conv_arr_4_Outer "conv_arr_4_Outer"
|
||||
OpName %val_2 "val"
|
||||
OpName %arr_0 "arr"
|
||||
OpName %i_1 "i"
|
||||
OpName %var_for_index "var_for_index"
|
||||
OpName %load_a_inner_p0_a_p1_m "load_a_inner_p0_a_p1_m"
|
||||
OpName %p0 "p0"
|
||||
OpName %p1 "p1"
|
||||
OpName %load_a_inner_p0_a_p1_m_p2 "load_a_inner_p0_a_p1_m_p2"
|
||||
OpName %p0_0 "p0"
|
||||
OpName %p1_0 "p1"
|
||||
OpName %p2 "p2"
|
||||
OpName %load_a_inner_p0_a_p1_m_p2_p3 "load_a_inner_p0_a_p1_m_p2_p3"
|
||||
OpName %p0_1 "p0"
|
||||
OpName %p1_1 "p1"
|
||||
OpName %p2_0 "p2"
|
||||
OpName %p3 "p3"
|
||||
OpName %f "f"
|
||||
OpDecorate %a_block_std140 Block
|
||||
OpMemberDecorate %a_block_std140 0 Offset 0
|
||||
OpMemberDecorate %Outer_std140 0 Offset 0
|
||||
OpMemberDecorate %Inner_std140 0 Offset 0
|
||||
OpMemberDecorate %Inner_std140 1 Offset 8
|
||||
OpDecorate %_arr_Inner_std140_uint_4 ArrayStride 16
|
||||
OpDecorate %_arr_Outer_std140_uint_4 ArrayStride 64
|
||||
OpDecorate %a NonWritable
|
||||
OpDecorate %a DescriptorSet 0
|
||||
OpDecorate %a Binding 0
|
||||
OpMemberDecorate %Inner 0 Offset 0
|
||||
OpMemberDecorate %Inner 0 ColMajor
|
||||
OpMemberDecorate %Inner 0 MatrixStride 8
|
||||
OpDecorate %_arr_Inner_uint_4 ArrayStride 16
|
||||
OpMemberDecorate %Outer 0 Offset 0
|
||||
OpDecorate %_arr_Outer_uint_4 ArrayStride 64
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%Inner_std140 = OpTypeStruct %v2float %v2float
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%_arr_Inner_std140_uint_4 = OpTypeArray %Inner_std140 %uint_4
|
||||
%Outer_std140 = OpTypeStruct %_arr_Inner_std140_uint_4
|
||||
%_arr_Outer_std140_uint_4 = OpTypeArray %Outer_std140 %uint_4
|
||||
%a_block_std140 = OpTypeStruct %_arr_Outer_std140_uint_4
|
||||
%_ptr_Uniform_a_block_std140 = OpTypePointer Uniform %a_block_std140
|
||||
%a = OpVariable %_ptr_Uniform_a_block_std140 Uniform
|
||||
%int = OpTypeInt 32 1
|
||||
%13 = OpConstantNull %int
|
||||
%_ptr_Private_int = OpTypePointer Private %int
|
||||
%counter = OpVariable %_ptr_Private_int Private %13
|
||||
%16 = OpTypeFunction %int
|
||||
%int_1 = OpConstant %int 1
|
||||
%mat2v2float = OpTypeMatrix %v2float 2
|
||||
%Inner = OpTypeStruct %mat2v2float
|
||||
%23 = OpTypeFunction %Inner %Inner_std140
|
||||
%_arr_Inner_uint_4 = OpTypeArray %Inner %uint_4
|
||||
%33 = OpTypeFunction %_arr_Inner_uint_4 %_arr_Inner_std140_uint_4
|
||||
%_ptr_Function__arr_Inner_uint_4 = OpTypePointer Function %_arr_Inner_uint_4
|
||||
%40 = OpConstantNull %_arr_Inner_uint_4
|
||||
%_ptr_Function_uint = OpTypePointer Function %uint
|
||||
%43 = OpConstantNull %uint
|
||||
%bool = OpTypeBool
|
||||
%_ptr_Function__arr_Inner_std140_uint_4 = OpTypePointer Function %_arr_Inner_std140_uint_4
|
||||
%56 = OpConstantNull %_arr_Inner_std140_uint_4
|
||||
%_ptr_Function_Inner = OpTypePointer Function %Inner
|
||||
%_ptr_Function_Inner_std140 = OpTypePointer Function %Inner_std140
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%Outer = OpTypeStruct %_arr_Inner_uint_4
|
||||
%69 = OpTypeFunction %Outer %Outer_std140
|
||||
%_arr_Outer_uint_4 = OpTypeArray %Outer %uint_4
|
||||
%77 = OpTypeFunction %_arr_Outer_uint_4 %_arr_Outer_std140_uint_4
|
||||
%_ptr_Function__arr_Outer_uint_4 = OpTypePointer Function %_arr_Outer_uint_4
|
||||
%84 = OpConstantNull %_arr_Outer_uint_4
|
||||
%_ptr_Function__arr_Outer_std140_uint_4 = OpTypePointer Function %_arr_Outer_std140_uint_4
|
||||
%97 = OpConstantNull %_arr_Outer_std140_uint_4
|
||||
%_ptr_Function_Outer = OpTypePointer Function %Outer
|
||||
%_ptr_Function_Outer_std140 = OpTypePointer Function %Outer_std140
|
||||
%109 = OpTypeFunction %mat2v2float %uint %uint
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Uniform_Inner_std140 = OpTypePointer Uniform %Inner_std140
|
||||
%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
|
||||
%126 = OpTypeFunction %v2float %uint %uint %uint
|
||||
%140 = OpConstantNull %v2float
|
||||
%141 = OpTypeFunction %float %uint %uint %uint %uint
|
||||
%_ptr_Uniform_float = OpTypePointer Uniform %float
|
||||
%157 = OpConstantNull %float
|
||||
%void = OpTypeVoid
|
||||
%158 = OpTypeFunction %void
|
||||
%_ptr_Uniform__arr_Outer_std140_uint_4 = OpTypePointer Uniform %_arr_Outer_std140_uint_4
|
||||
%_ptr_Uniform_Outer_std140 = OpTypePointer Uniform %Outer_std140
|
||||
%_ptr_Uniform__arr_Inner_std140_uint_4 = OpTypePointer Uniform %_arr_Inner_std140_uint_4
|
||||
%i = OpFunction %int None %16
|
||||
%18 = OpLabel
|
||||
%19 = OpLoad %int %counter
|
||||
%21 = OpIAdd %int %19 %int_1
|
||||
OpStore %counter %21
|
||||
%22 = OpLoad %int %counter
|
||||
OpReturnValue %22
|
||||
OpFunctionEnd
|
||||
%conv_Inner = OpFunction %Inner None %23
|
||||
%val = OpFunctionParameter %Inner_std140
|
||||
%28 = OpLabel
|
||||
%29 = OpCompositeExtract %v2float %val 0
|
||||
%30 = OpCompositeExtract %v2float %val 1
|
||||
%31 = OpCompositeConstruct %mat2v2float %29 %30
|
||||
%32 = OpCompositeConstruct %Inner %31
|
||||
OpReturnValue %32
|
||||
OpFunctionEnd
|
||||
%conv_arr_4_Inner = OpFunction %_arr_Inner_uint_4 None %33
|
||||
%val_0 = OpFunctionParameter %_arr_Inner_std140_uint_4
|
||||
%37 = OpLabel
|
||||
%arr = OpVariable %_ptr_Function__arr_Inner_uint_4 Function %40
|
||||
%i_0 = OpVariable %_ptr_Function_uint Function %43
|
||||
%var_for_index_1 = OpVariable %_ptr_Function__arr_Inner_std140_uint_4 Function %56
|
||||
OpBranch %44
|
||||
%44 = OpLabel
|
||||
OpLoopMerge %45 %46 None
|
||||
OpBranch %47
|
||||
%47 = OpLabel
|
||||
%49 = OpLoad %uint %i_0
|
||||
%50 = OpULessThan %bool %49 %uint_4
|
||||
%48 = OpLogicalNot %bool %50
|
||||
OpSelectionMerge %52 None
|
||||
OpBranchConditional %48 %53 %52
|
||||
%53 = OpLabel
|
||||
OpBranch %45
|
||||
%52 = OpLabel
|
||||
OpStore %var_for_index_1 %val_0
|
||||
%57 = OpLoad %uint %i_0
|
||||
%59 = OpAccessChain %_ptr_Function_Inner %arr %57
|
||||
%61 = OpLoad %uint %i_0
|
||||
%63 = OpAccessChain %_ptr_Function_Inner_std140 %var_for_index_1 %61
|
||||
%64 = OpLoad %Inner_std140 %63
|
||||
%60 = OpFunctionCall %Inner %conv_Inner %64
|
||||
OpStore %59 %60
|
||||
OpBranch %46
|
||||
%46 = OpLabel
|
||||
%65 = OpLoad %uint %i_0
|
||||
%67 = OpIAdd %uint %65 %uint_1
|
||||
OpStore %i_0 %67
|
||||
OpBranch %44
|
||||
%45 = OpLabel
|
||||
%68 = OpLoad %_arr_Inner_uint_4 %arr
|
||||
OpReturnValue %68
|
||||
OpFunctionEnd
|
||||
%conv_Outer = OpFunction %Outer None %69
|
||||
%val_1 = OpFunctionParameter %Outer_std140
|
||||
%73 = OpLabel
|
||||
%75 = OpCompositeExtract %_arr_Inner_std140_uint_4 %val_1 0
|
||||
%74 = OpFunctionCall %_arr_Inner_uint_4 %conv_arr_4_Inner %75
|
||||
%76 = OpCompositeConstruct %Outer %74
|
||||
OpReturnValue %76
|
||||
OpFunctionEnd
|
||||
%conv_arr_4_Outer = OpFunction %_arr_Outer_uint_4 None %77
|
||||
%val_2 = OpFunctionParameter %_arr_Outer_std140_uint_4
|
||||
%81 = OpLabel
|
||||
%arr_0 = OpVariable %_ptr_Function__arr_Outer_uint_4 Function %84
|
||||
%i_1 = OpVariable %_ptr_Function_uint Function %43
|
||||
%var_for_index = OpVariable %_ptr_Function__arr_Outer_std140_uint_4 Function %97
|
||||
OpBranch %86
|
||||
%86 = OpLabel
|
||||
OpLoopMerge %87 %88 None
|
||||
OpBranch %89
|
||||
%89 = OpLabel
|
||||
%91 = OpLoad %uint %i_1
|
||||
%92 = OpULessThan %bool %91 %uint_4
|
||||
%90 = OpLogicalNot %bool %92
|
||||
OpSelectionMerge %93 None
|
||||
OpBranchConditional %90 %94 %93
|
||||
%94 = OpLabel
|
||||
OpBranch %87
|
||||
%93 = OpLabel
|
||||
OpStore %var_for_index %val_2
|
||||
%98 = OpLoad %uint %i_1
|
||||
%100 = OpAccessChain %_ptr_Function_Outer %arr_0 %98
|
||||
%102 = OpLoad %uint %i_1
|
||||
%104 = OpAccessChain %_ptr_Function_Outer_std140 %var_for_index %102
|
||||
%105 = OpLoad %Outer_std140 %104
|
||||
%101 = OpFunctionCall %Outer %conv_Outer %105
|
||||
OpStore %100 %101
|
||||
OpBranch %88
|
||||
%88 = OpLabel
|
||||
%106 = OpLoad %uint %i_1
|
||||
%107 = OpIAdd %uint %106 %uint_1
|
||||
OpStore %i_1 %107
|
||||
OpBranch %86
|
||||
%87 = OpLabel
|
||||
%108 = OpLoad %_arr_Outer_uint_4 %arr_0
|
||||
OpReturnValue %108
|
||||
OpFunctionEnd
|
||||
%load_a_inner_p0_a_p1_m = OpFunction %mat2v2float None %109
|
||||
%p0 = OpFunctionParameter %uint
|
||||
%p1 = OpFunctionParameter %uint
|
||||
%113 = OpLabel
|
||||
%117 = OpAccessChain %_ptr_Uniform_Inner_std140 %a %uint_0 %p0 %uint_0 %p1
|
||||
%120 = OpAccessChain %_ptr_Uniform_v2float %117 %uint_0
|
||||
%121 = OpLoad %v2float %120
|
||||
%123 = OpAccessChain %_ptr_Uniform_v2float %117 %uint_1
|
||||
%124 = OpLoad %v2float %123
|
||||
%125 = OpCompositeConstruct %mat2v2float %121 %124
|
||||
OpReturnValue %125
|
||||
OpFunctionEnd
|
||||
%load_a_inner_p0_a_p1_m_p2 = OpFunction %v2float None %126
|
||||
%p0_0 = OpFunctionParameter %uint
|
||||
%p1_0 = OpFunctionParameter %uint
|
||||
%p2 = OpFunctionParameter %uint
|
||||
%131 = OpLabel
|
||||
OpSelectionMerge %132 None
|
||||
OpSwitch %p2 %133 0 %134 1 %135
|
||||
%134 = OpLabel
|
||||
%136 = OpAccessChain %_ptr_Uniform_v2float %a %uint_0 %p0_0 %uint_0 %p1_0 %uint_0
|
||||
%137 = OpLoad %v2float %136
|
||||
OpReturnValue %137
|
||||
%135 = OpLabel
|
||||
%138 = OpAccessChain %_ptr_Uniform_v2float %a %uint_0 %p0_0 %uint_0 %p1_0 %uint_1
|
||||
%139 = OpLoad %v2float %138
|
||||
OpReturnValue %139
|
||||
%133 = OpLabel
|
||||
OpReturnValue %140
|
||||
%132 = OpLabel
|
||||
OpReturnValue %140
|
||||
OpFunctionEnd
|
||||
%load_a_inner_p0_a_p1_m_p2_p3 = OpFunction %float None %141
|
||||
%p0_1 = OpFunctionParameter %uint
|
||||
%p1_1 = OpFunctionParameter %uint
|
||||
%p2_0 = OpFunctionParameter %uint
|
||||
%p3 = OpFunctionParameter %uint
|
||||
%147 = OpLabel
|
||||
OpSelectionMerge %148 None
|
||||
OpSwitch %p2_0 %149 0 %150 1 %151
|
||||
%150 = OpLabel
|
||||
%153 = OpAccessChain %_ptr_Uniform_float %a %uint_0 %p0_1 %uint_0 %p1_1 %uint_0 %p3
|
||||
%154 = OpLoad %float %153
|
||||
OpReturnValue %154
|
||||
%151 = OpLabel
|
||||
%155 = OpAccessChain %_ptr_Uniform_float %a %uint_0 %p0_1 %uint_0 %p1_1 %uint_1 %p3
|
||||
%156 = OpLoad %float %155
|
||||
OpReturnValue %156
|
||||
%149 = OpLabel
|
||||
OpReturnValue %157
|
||||
%148 = OpLabel
|
||||
OpReturnValue %157
|
||||
OpFunctionEnd
|
||||
%f = OpFunction %void None %158
|
||||
%161 = OpLabel
|
||||
%162 = OpFunctionCall %int %i
|
||||
%163 = OpFunctionCall %int %i
|
||||
%164 = OpFunctionCall %int %i
|
||||
%167 = OpAccessChain %_ptr_Uniform__arr_Outer_std140_uint_4 %a %uint_0
|
||||
%168 = OpLoad %_arr_Outer_std140_uint_4 %167
|
||||
%165 = OpFunctionCall %_arr_Outer_uint_4 %conv_arr_4_Outer %168
|
||||
%171 = OpAccessChain %_ptr_Uniform_Outer_std140 %a %uint_0 %162
|
||||
%172 = OpLoad %Outer_std140 %171
|
||||
%169 = OpFunctionCall %Outer %conv_Outer %172
|
||||
%175 = OpAccessChain %_ptr_Uniform__arr_Inner_std140_uint_4 %a %uint_0 %162 %uint_0
|
||||
%176 = OpLoad %_arr_Inner_std140_uint_4 %175
|
||||
%173 = OpFunctionCall %_arr_Inner_uint_4 %conv_arr_4_Inner %176
|
||||
%178 = OpAccessChain %_ptr_Uniform_Inner_std140 %a %uint_0 %162 %uint_0 %163
|
||||
%179 = OpLoad %Inner_std140 %178
|
||||
%177 = OpFunctionCall %Inner %conv_Inner %179
|
||||
%181 = OpBitcast %uint %162
|
||||
%182 = OpBitcast %uint %163
|
||||
%180 = OpFunctionCall %mat2v2float %load_a_inner_p0_a_p1_m %181 %182
|
||||
%184 = OpBitcast %uint %162
|
||||
%185 = OpBitcast %uint %163
|
||||
%186 = OpBitcast %uint %164
|
||||
%183 = OpFunctionCall %v2float %load_a_inner_p0_a_p1_m_p2 %184 %185 %186
|
||||
%187 = OpFunctionCall %int %i
|
||||
%189 = OpBitcast %uint %162
|
||||
%190 = OpBitcast %uint %163
|
||||
%191 = OpBitcast %uint %164
|
||||
%192 = OpBitcast %uint %187
|
||||
%188 = OpFunctionCall %float %load_a_inner_p0_a_p1_m_p2_p3 %189 %190 %191 %192
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,33 @@
|
||||
struct Inner {
|
||||
m : mat2x2<f32>,
|
||||
}
|
||||
|
||||
struct Outer {
|
||||
a : array<Inner, 4>,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<uniform> a : array<Outer, 4>;
|
||||
|
||||
var<private> counter = 0;
|
||||
|
||||
fn i() -> i32 {
|
||||
counter++;
|
||||
return counter;
|
||||
}
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn f() {
|
||||
let p_a = &(a);
|
||||
let p_a_i = &((*(p_a))[i()]);
|
||||
let p_a_i_a = &((*(p_a_i)).a);
|
||||
let p_a_i_a_i = &((*(p_a_i_a))[i()]);
|
||||
let p_a_i_a_i_m = &((*(p_a_i_a_i)).m);
|
||||
let p_a_i_a_i_m_i = &((*(p_a_i_a_i_m))[i()]);
|
||||
let l_a : array<Outer, 4> = *(p_a);
|
||||
let l_a_i : Outer = *(p_a_i);
|
||||
let l_a_i_a : array<Inner, 4> = *(p_a_i_a);
|
||||
let l_a_i_a_i : Inner = *(p_a_i_a_i);
|
||||
let l_a_i_a_i_m : mat2x2<f32> = *(p_a_i_a_i_m);
|
||||
let l_a_i_a_i_m_i : vec2<f32> = *(p_a_i_a_i_m_i);
|
||||
let l_a_i_a_i_m_i_i : f32 = (*(p_a_i_a_i_m_i))[i()];
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
struct Inner {
|
||||
m : mat2x2<f32>,
|
||||
}
|
||||
|
||||
struct Outer {
|
||||
a : array<Inner, 4>,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<uniform> a : array<Outer, 4>;
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn f() {
|
||||
let p_a = &a;
|
||||
let p_a_3 = &((*p_a)[3]);
|
||||
let p_a_3_a = &((*p_a_3).a);
|
||||
let p_a_3_a_2 = &((*p_a_3_a)[2]);
|
||||
let p_a_3_a_2_m = &((*p_a_3_a_2).m);
|
||||
let p_a_3_a_2_m_1 = &((*p_a_3_a_2_m)[1]);
|
||||
|
||||
|
||||
let l_a : array<Outer, 4> = *p_a;
|
||||
let l_a_3 : Outer = *p_a_3;
|
||||
let l_a_3_a : array<Inner, 4> = *p_a_3_a;
|
||||
let l_a_3_a_2 : Inner = *p_a_3_a_2;
|
||||
let l_a_3_a_2_m : mat2x2<f32> = *p_a_3_a_2_m;
|
||||
let l_a_3_a_2_m_1 : vec2<f32> = *p_a_3_a_2_m_1;
|
||||
let l_a_3_a_2_m_1_0 : f32 = (*p_a_3_a_2_m_1)[0];
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
struct Inner {
|
||||
float2x2 m;
|
||||
};
|
||||
struct Outer {
|
||||
Inner a[4];
|
||||
};
|
||||
|
||||
cbuffer cbuffer_a : register(b0, space0) {
|
||||
uint4 a[16];
|
||||
};
|
||||
|
||||
float2x2 tint_symbol_4(uint4 buffer[16], uint offset) {
|
||||
const uint scalar_offset = ((offset + 0u)) / 4;
|
||||
uint4 ubo_load = buffer[scalar_offset / 4];
|
||||
const uint scalar_offset_1 = ((offset + 8u)) / 4;
|
||||
uint4 ubo_load_1 = buffer[scalar_offset_1 / 4];
|
||||
return float2x2(asfloat(((scalar_offset & 2) ? ubo_load.zw : ubo_load.xy)), asfloat(((scalar_offset_1 & 2) ? ubo_load_1.zw : ubo_load_1.xy)));
|
||||
}
|
||||
|
||||
Inner tint_symbol_3(uint4 buffer[16], uint offset) {
|
||||
const Inner tint_symbol_7 = {tint_symbol_4(buffer, (offset + 0u))};
|
||||
return tint_symbol_7;
|
||||
}
|
||||
|
||||
typedef Inner tint_symbol_2_ret[4];
|
||||
tint_symbol_2_ret tint_symbol_2(uint4 buffer[16], uint offset) {
|
||||
Inner arr[4] = (Inner[4])0;
|
||||
{
|
||||
[loop] for(uint i = 0u; (i < 4u); i = (i + 1u)) {
|
||||
arr[i] = tint_symbol_3(buffer, (offset + (i * 16u)));
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
Outer tint_symbol_1(uint4 buffer[16], uint offset) {
|
||||
const Outer tint_symbol_8 = {tint_symbol_2(buffer, (offset + 0u))};
|
||||
return tint_symbol_8;
|
||||
}
|
||||
|
||||
typedef Outer tint_symbol_ret[4];
|
||||
tint_symbol_ret tint_symbol(uint4 buffer[16], uint offset) {
|
||||
Outer arr_1[4] = (Outer[4])0;
|
||||
{
|
||||
[loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
|
||||
arr_1[i_1] = tint_symbol_1(buffer, (offset + (i_1 * 64u)));
|
||||
}
|
||||
}
|
||||
return arr_1;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void f() {
|
||||
const Outer l_a[4] = tint_symbol(a, 0u);
|
||||
const Outer l_a_3 = tint_symbol_1(a, 192u);
|
||||
const Inner l_a_3_a[4] = tint_symbol_2(a, 192u);
|
||||
const Inner l_a_3_a_2 = tint_symbol_3(a, 224u);
|
||||
const float2x2 l_a_3_a_2_m = tint_symbol_4(a, 224u);
|
||||
const float2 l_a_3_a_2_m_1 = asfloat(a[14].zw);
|
||||
const float l_a_3_a_2_m_1_0 = asfloat(a[14].z);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
struct Inner {
|
||||
float2x2 m;
|
||||
};
|
||||
struct Outer {
|
||||
Inner a[4];
|
||||
};
|
||||
|
||||
cbuffer cbuffer_a : register(b0, space0) {
|
||||
uint4 a[16];
|
||||
};
|
||||
|
||||
float2x2 tint_symbol_4(uint4 buffer[16], uint offset) {
|
||||
const uint scalar_offset = ((offset + 0u)) / 4;
|
||||
uint4 ubo_load = buffer[scalar_offset / 4];
|
||||
const uint scalar_offset_1 = ((offset + 8u)) / 4;
|
||||
uint4 ubo_load_1 = buffer[scalar_offset_1 / 4];
|
||||
return float2x2(asfloat(((scalar_offset & 2) ? ubo_load.zw : ubo_load.xy)), asfloat(((scalar_offset_1 & 2) ? ubo_load_1.zw : ubo_load_1.xy)));
|
||||
}
|
||||
|
||||
Inner tint_symbol_3(uint4 buffer[16], uint offset) {
|
||||
const Inner tint_symbol_7 = {tint_symbol_4(buffer, (offset + 0u))};
|
||||
return tint_symbol_7;
|
||||
}
|
||||
|
||||
typedef Inner tint_symbol_2_ret[4];
|
||||
tint_symbol_2_ret tint_symbol_2(uint4 buffer[16], uint offset) {
|
||||
Inner arr[4] = (Inner[4])0;
|
||||
{
|
||||
[loop] for(uint i = 0u; (i < 4u); i = (i + 1u)) {
|
||||
arr[i] = tint_symbol_3(buffer, (offset + (i * 16u)));
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
Outer tint_symbol_1(uint4 buffer[16], uint offset) {
|
||||
const Outer tint_symbol_8 = {tint_symbol_2(buffer, (offset + 0u))};
|
||||
return tint_symbol_8;
|
||||
}
|
||||
|
||||
typedef Outer tint_symbol_ret[4];
|
||||
tint_symbol_ret tint_symbol(uint4 buffer[16], uint offset) {
|
||||
Outer arr_1[4] = (Outer[4])0;
|
||||
{
|
||||
[loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
|
||||
arr_1[i_1] = tint_symbol_1(buffer, (offset + (i_1 * 64u)));
|
||||
}
|
||||
}
|
||||
return arr_1;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void f() {
|
||||
const Outer l_a[4] = tint_symbol(a, 0u);
|
||||
const Outer l_a_3 = tint_symbol_1(a, 192u);
|
||||
const Inner l_a_3_a[4] = tint_symbol_2(a, 192u);
|
||||
const Inner l_a_3_a_2 = tint_symbol_3(a, 224u);
|
||||
const float2x2 l_a_3_a_2_m = tint_symbol_4(a, 224u);
|
||||
const float2 l_a_3_a_2_m_1 = asfloat(a[14].zw);
|
||||
const float l_a_3_a_2_m_1_0 = asfloat(a[14].z);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
#version 310 es
|
||||
|
||||
struct Inner {
|
||||
mat2 m;
|
||||
};
|
||||
|
||||
struct Inner_std140 {
|
||||
vec2 m_0;
|
||||
vec2 m_1;
|
||||
};
|
||||
|
||||
struct Outer {
|
||||
Inner a[4];
|
||||
};
|
||||
|
||||
struct Outer_std140 {
|
||||
Inner_std140 a[4];
|
||||
};
|
||||
|
||||
layout(binding = 0, std140) uniform a_block_std140_ubo {
|
||||
Outer_std140 inner[4];
|
||||
} a;
|
||||
|
||||
Inner conv_Inner(Inner_std140 val) {
|
||||
return Inner(mat2(val.m_0, val.m_1));
|
||||
}
|
||||
|
||||
Inner[4] conv_arr_4_Inner(Inner_std140 val[4]) {
|
||||
Inner arr[4] = Inner[4](Inner(mat2(0.0f, 0.0f, 0.0f, 0.0f)), Inner(mat2(0.0f, 0.0f, 0.0f, 0.0f)), Inner(mat2(0.0f, 0.0f, 0.0f, 0.0f)), Inner(mat2(0.0f, 0.0f, 0.0f, 0.0f)));
|
||||
{
|
||||
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
|
||||
arr[i] = conv_Inner(val[i]);
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
Outer conv_Outer(Outer_std140 val) {
|
||||
return Outer(conv_arr_4_Inner(val.a));
|
||||
}
|
||||
|
||||
Outer[4] conv_arr_4_Outer(Outer_std140 val[4]) {
|
||||
Outer arr[4] = Outer[4](Outer(Inner[4](Inner(mat2(0.0f, 0.0f, 0.0f, 0.0f)), Inner(mat2(0.0f, 0.0f, 0.0f, 0.0f)), Inner(mat2(0.0f, 0.0f, 0.0f, 0.0f)), Inner(mat2(0.0f, 0.0f, 0.0f, 0.0f)))), Outer(Inner[4](Inner(mat2(0.0f, 0.0f, 0.0f, 0.0f)), Inner(mat2(0.0f, 0.0f, 0.0f, 0.0f)), Inner(mat2(0.0f, 0.0f, 0.0f, 0.0f)), Inner(mat2(0.0f, 0.0f, 0.0f, 0.0f)))), Outer(Inner[4](Inner(mat2(0.0f, 0.0f, 0.0f, 0.0f)), Inner(mat2(0.0f, 0.0f, 0.0f, 0.0f)), Inner(mat2(0.0f, 0.0f, 0.0f, 0.0f)), Inner(mat2(0.0f, 0.0f, 0.0f, 0.0f)))), Outer(Inner[4](Inner(mat2(0.0f, 0.0f, 0.0f, 0.0f)), Inner(mat2(0.0f, 0.0f, 0.0f, 0.0f)), Inner(mat2(0.0f, 0.0f, 0.0f, 0.0f)), Inner(mat2(0.0f, 0.0f, 0.0f, 0.0f)))));
|
||||
{
|
||||
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
|
||||
arr[i] = conv_Outer(val[i]);
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
mat2 load_a_inner_3_a_2_m() {
|
||||
return mat2(a.inner[3u].a[2u].m_0, a.inner[3u].a[2u].m_1);
|
||||
}
|
||||
|
||||
void f() {
|
||||
Outer p_a[4] = conv_arr_4_Outer(a.inner);
|
||||
Outer p_a_3 = conv_Outer(a.inner[3u]);
|
||||
Inner p_a_3_a[4] = conv_arr_4_Inner(a.inner[3u].a);
|
||||
Inner p_a_3_a_2 = conv_Inner(a.inner[3u].a[2u]);
|
||||
mat2 p_a_3_a_2_m = load_a_inner_3_a_2_m();
|
||||
vec2 p_a_3_a_2_m_1 = a.inner[3u].a[2u].m_1;
|
||||
Outer l_a[4] = conv_arr_4_Outer(a.inner);
|
||||
Outer l_a_3 = conv_Outer(a.inner[3u]);
|
||||
Inner l_a_3_a[4] = conv_arr_4_Inner(a.inner[3u].a);
|
||||
Inner l_a_3_a_2 = conv_Inner(a.inner[3u].a[2u]);
|
||||
mat2 l_a_3_a_2_m = load_a_inner_3_a_2_m();
|
||||
vec2 l_a_3_a_2_m_1 = a.inner[3u].a[2u].m_1;
|
||||
float l_a_3_a_2_m_1_0 = a.inner[3u].a[2u].m_1[0u];
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
f();
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
template<typename T, size_t N>
|
||||
struct tint_array {
|
||||
const constant T& operator[](size_t i) const constant { return elements[i]; }
|
||||
device T& operator[](size_t i) device { return elements[i]; }
|
||||
const device T& operator[](size_t i) const device { return elements[i]; }
|
||||
thread T& operator[](size_t i) thread { return elements[i]; }
|
||||
const thread T& operator[](size_t i) const thread { return elements[i]; }
|
||||
threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
|
||||
const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
|
||||
T elements[N];
|
||||
};
|
||||
|
||||
struct Inner {
|
||||
/* 0x0000 */ float2x2 m;
|
||||
};
|
||||
|
||||
struct Outer {
|
||||
/* 0x0000 */ tint_array<Inner, 4> a;
|
||||
};
|
||||
|
||||
kernel void f(const constant tint_array<Outer, 4>* tint_symbol [[buffer(0)]]) {
|
||||
tint_array<Outer, 4> const l_a = *(tint_symbol);
|
||||
Outer const l_a_3 = (*(tint_symbol))[3];
|
||||
tint_array<Inner, 4> const l_a_3_a = (*(tint_symbol))[3].a;
|
||||
Inner const l_a_3_a_2 = (*(tint_symbol))[3].a[2];
|
||||
float2x2 const l_a_3_a_2_m = (*(tint_symbol))[3].a[2].m;
|
||||
float2 const l_a_3_a_2_m_1 = (*(tint_symbol))[3].a[2].m[1];
|
||||
float const l_a_3_a_2_m_1_0 = (*(tint_symbol))[3].a[2].m[1][0];
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,223 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 140
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %f "f"
|
||||
OpExecutionMode %f LocalSize 1 1 1
|
||||
OpName %a_block_std140 "a_block_std140"
|
||||
OpMemberName %a_block_std140 0 "inner"
|
||||
OpName %Outer_std140 "Outer_std140"
|
||||
OpMemberName %Outer_std140 0 "a"
|
||||
OpName %Inner_std140 "Inner_std140"
|
||||
OpMemberName %Inner_std140 0 "m_0"
|
||||
OpMemberName %Inner_std140 1 "m_1"
|
||||
OpName %a "a"
|
||||
OpName %Inner "Inner"
|
||||
OpMemberName %Inner 0 "m"
|
||||
OpName %conv_Inner "conv_Inner"
|
||||
OpName %val "val"
|
||||
OpName %conv_arr_4_Inner "conv_arr_4_Inner"
|
||||
OpName %val_0 "val"
|
||||
OpName %arr "arr"
|
||||
OpName %i "i"
|
||||
OpName %var_for_index_1 "var_for_index_1"
|
||||
OpName %Outer "Outer"
|
||||
OpMemberName %Outer 0 "a"
|
||||
OpName %conv_Outer "conv_Outer"
|
||||
OpName %val_1 "val"
|
||||
OpName %conv_arr_4_Outer "conv_arr_4_Outer"
|
||||
OpName %val_2 "val"
|
||||
OpName %arr_0 "arr"
|
||||
OpName %i_0 "i"
|
||||
OpName %var_for_index "var_for_index"
|
||||
OpName %load_a_inner_3_a_2_m "load_a_inner_3_a_2_m"
|
||||
OpName %f "f"
|
||||
OpDecorate %a_block_std140 Block
|
||||
OpMemberDecorate %a_block_std140 0 Offset 0
|
||||
OpMemberDecorate %Outer_std140 0 Offset 0
|
||||
OpMemberDecorate %Inner_std140 0 Offset 0
|
||||
OpMemberDecorate %Inner_std140 1 Offset 8
|
||||
OpDecorate %_arr_Inner_std140_uint_4 ArrayStride 16
|
||||
OpDecorate %_arr_Outer_std140_uint_4 ArrayStride 64
|
||||
OpDecorate %a NonWritable
|
||||
OpDecorate %a DescriptorSet 0
|
||||
OpDecorate %a Binding 0
|
||||
OpMemberDecorate %Inner 0 Offset 0
|
||||
OpMemberDecorate %Inner 0 ColMajor
|
||||
OpMemberDecorate %Inner 0 MatrixStride 8
|
||||
OpDecorate %_arr_Inner_uint_4 ArrayStride 16
|
||||
OpMemberDecorate %Outer 0 Offset 0
|
||||
OpDecorate %_arr_Outer_uint_4 ArrayStride 64
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%Inner_std140 = OpTypeStruct %v2float %v2float
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%_arr_Inner_std140_uint_4 = OpTypeArray %Inner_std140 %uint_4
|
||||
%Outer_std140 = OpTypeStruct %_arr_Inner_std140_uint_4
|
||||
%_arr_Outer_std140_uint_4 = OpTypeArray %Outer_std140 %uint_4
|
||||
%a_block_std140 = OpTypeStruct %_arr_Outer_std140_uint_4
|
||||
%_ptr_Uniform_a_block_std140 = OpTypePointer Uniform %a_block_std140
|
||||
%a = OpVariable %_ptr_Uniform_a_block_std140 Uniform
|
||||
%mat2v2float = OpTypeMatrix %v2float 2
|
||||
%Inner = OpTypeStruct %mat2v2float
|
||||
%12 = OpTypeFunction %Inner %Inner_std140
|
||||
%_arr_Inner_uint_4 = OpTypeArray %Inner %uint_4
|
||||
%22 = OpTypeFunction %_arr_Inner_uint_4 %_arr_Inner_std140_uint_4
|
||||
%_ptr_Function__arr_Inner_uint_4 = OpTypePointer Function %_arr_Inner_uint_4
|
||||
%29 = OpConstantNull %_arr_Inner_uint_4
|
||||
%_ptr_Function_uint = OpTypePointer Function %uint
|
||||
%32 = OpConstantNull %uint
|
||||
%bool = OpTypeBool
|
||||
%_ptr_Function__arr_Inner_std140_uint_4 = OpTypePointer Function %_arr_Inner_std140_uint_4
|
||||
%45 = OpConstantNull %_arr_Inner_std140_uint_4
|
||||
%_ptr_Function_Inner = OpTypePointer Function %Inner
|
||||
%_ptr_Function_Inner_std140 = OpTypePointer Function %Inner_std140
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%Outer = OpTypeStruct %_arr_Inner_uint_4
|
||||
%58 = OpTypeFunction %Outer %Outer_std140
|
||||
%_arr_Outer_uint_4 = OpTypeArray %Outer %uint_4
|
||||
%66 = OpTypeFunction %_arr_Outer_uint_4 %_arr_Outer_std140_uint_4
|
||||
%_ptr_Function__arr_Outer_uint_4 = OpTypePointer Function %_arr_Outer_uint_4
|
||||
%73 = OpConstantNull %_arr_Outer_uint_4
|
||||
%_ptr_Function__arr_Outer_std140_uint_4 = OpTypePointer Function %_arr_Outer_std140_uint_4
|
||||
%86 = OpConstantNull %_arr_Outer_std140_uint_4
|
||||
%_ptr_Function_Outer = OpTypePointer Function %Outer
|
||||
%_ptr_Function_Outer_std140 = OpTypePointer Function %Outer_std140
|
||||
%98 = OpTypeFunction %mat2v2float
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_ptr_Uniform_Inner_std140 = OpTypePointer Uniform %Inner_std140
|
||||
%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
|
||||
%void = OpTypeVoid
|
||||
%115 = OpTypeFunction %void
|
||||
%_ptr_Uniform__arr_Outer_std140_uint_4 = OpTypePointer Uniform %_arr_Outer_std140_uint_4
|
||||
%_ptr_Uniform_Outer_std140 = OpTypePointer Uniform %Outer_std140
|
||||
%_ptr_Uniform__arr_Inner_std140_uint_4 = OpTypePointer Uniform %_arr_Inner_std140_uint_4
|
||||
%_ptr_Uniform_float = OpTypePointer Uniform %float
|
||||
%conv_Inner = OpFunction %Inner None %12
|
||||
%val = OpFunctionParameter %Inner_std140
|
||||
%17 = OpLabel
|
||||
%18 = OpCompositeExtract %v2float %val 0
|
||||
%19 = OpCompositeExtract %v2float %val 1
|
||||
%20 = OpCompositeConstruct %mat2v2float %18 %19
|
||||
%21 = OpCompositeConstruct %Inner %20
|
||||
OpReturnValue %21
|
||||
OpFunctionEnd
|
||||
%conv_arr_4_Inner = OpFunction %_arr_Inner_uint_4 None %22
|
||||
%val_0 = OpFunctionParameter %_arr_Inner_std140_uint_4
|
||||
%26 = OpLabel
|
||||
%arr = OpVariable %_ptr_Function__arr_Inner_uint_4 Function %29
|
||||
%i = OpVariable %_ptr_Function_uint Function %32
|
||||
%var_for_index_1 = OpVariable %_ptr_Function__arr_Inner_std140_uint_4 Function %45
|
||||
OpBranch %33
|
||||
%33 = OpLabel
|
||||
OpLoopMerge %34 %35 None
|
||||
OpBranch %36
|
||||
%36 = OpLabel
|
||||
%38 = OpLoad %uint %i
|
||||
%39 = OpULessThan %bool %38 %uint_4
|
||||
%37 = OpLogicalNot %bool %39
|
||||
OpSelectionMerge %41 None
|
||||
OpBranchConditional %37 %42 %41
|
||||
%42 = OpLabel
|
||||
OpBranch %34
|
||||
%41 = OpLabel
|
||||
OpStore %var_for_index_1 %val_0
|
||||
%46 = OpLoad %uint %i
|
||||
%48 = OpAccessChain %_ptr_Function_Inner %arr %46
|
||||
%50 = OpLoad %uint %i
|
||||
%52 = OpAccessChain %_ptr_Function_Inner_std140 %var_for_index_1 %50
|
||||
%53 = OpLoad %Inner_std140 %52
|
||||
%49 = OpFunctionCall %Inner %conv_Inner %53
|
||||
OpStore %48 %49
|
||||
OpBranch %35
|
||||
%35 = OpLabel
|
||||
%54 = OpLoad %uint %i
|
||||
%56 = OpIAdd %uint %54 %uint_1
|
||||
OpStore %i %56
|
||||
OpBranch %33
|
||||
%34 = OpLabel
|
||||
%57 = OpLoad %_arr_Inner_uint_4 %arr
|
||||
OpReturnValue %57
|
||||
OpFunctionEnd
|
||||
%conv_Outer = OpFunction %Outer None %58
|
||||
%val_1 = OpFunctionParameter %Outer_std140
|
||||
%62 = OpLabel
|
||||
%64 = OpCompositeExtract %_arr_Inner_std140_uint_4 %val_1 0
|
||||
%63 = OpFunctionCall %_arr_Inner_uint_4 %conv_arr_4_Inner %64
|
||||
%65 = OpCompositeConstruct %Outer %63
|
||||
OpReturnValue %65
|
||||
OpFunctionEnd
|
||||
%conv_arr_4_Outer = OpFunction %_arr_Outer_uint_4 None %66
|
||||
%val_2 = OpFunctionParameter %_arr_Outer_std140_uint_4
|
||||
%70 = OpLabel
|
||||
%arr_0 = OpVariable %_ptr_Function__arr_Outer_uint_4 Function %73
|
||||
%i_0 = OpVariable %_ptr_Function_uint Function %32
|
||||
%var_for_index = OpVariable %_ptr_Function__arr_Outer_std140_uint_4 Function %86
|
||||
OpBranch %75
|
||||
%75 = OpLabel
|
||||
OpLoopMerge %76 %77 None
|
||||
OpBranch %78
|
||||
%78 = OpLabel
|
||||
%80 = OpLoad %uint %i_0
|
||||
%81 = OpULessThan %bool %80 %uint_4
|
||||
%79 = OpLogicalNot %bool %81
|
||||
OpSelectionMerge %82 None
|
||||
OpBranchConditional %79 %83 %82
|
||||
%83 = OpLabel
|
||||
OpBranch %76
|
||||
%82 = OpLabel
|
||||
OpStore %var_for_index %val_2
|
||||
%87 = OpLoad %uint %i_0
|
||||
%89 = OpAccessChain %_ptr_Function_Outer %arr_0 %87
|
||||
%91 = OpLoad %uint %i_0
|
||||
%93 = OpAccessChain %_ptr_Function_Outer_std140 %var_for_index %91
|
||||
%94 = OpLoad %Outer_std140 %93
|
||||
%90 = OpFunctionCall %Outer %conv_Outer %94
|
||||
OpStore %89 %90
|
||||
OpBranch %77
|
||||
%77 = OpLabel
|
||||
%95 = OpLoad %uint %i_0
|
||||
%96 = OpIAdd %uint %95 %uint_1
|
||||
OpStore %i_0 %96
|
||||
OpBranch %75
|
||||
%76 = OpLabel
|
||||
%97 = OpLoad %_arr_Outer_uint_4 %arr_0
|
||||
OpReturnValue %97
|
||||
OpFunctionEnd
|
||||
%load_a_inner_3_a_2_m = OpFunction %mat2v2float None %98
|
||||
%100 = OpLabel
|
||||
%106 = OpAccessChain %_ptr_Uniform_Inner_std140 %a %uint_0 %uint_3 %uint_0 %uint_2
|
||||
%109 = OpAccessChain %_ptr_Uniform_v2float %106 %uint_0
|
||||
%110 = OpLoad %v2float %109
|
||||
%112 = OpAccessChain %_ptr_Uniform_v2float %106 %uint_1
|
||||
%113 = OpLoad %v2float %112
|
||||
%114 = OpCompositeConstruct %mat2v2float %110 %113
|
||||
OpReturnValue %114
|
||||
OpFunctionEnd
|
||||
%f = OpFunction %void None %115
|
||||
%118 = OpLabel
|
||||
%121 = OpAccessChain %_ptr_Uniform__arr_Outer_std140_uint_4 %a %uint_0
|
||||
%122 = OpLoad %_arr_Outer_std140_uint_4 %121
|
||||
%119 = OpFunctionCall %_arr_Outer_uint_4 %conv_arr_4_Outer %122
|
||||
%125 = OpAccessChain %_ptr_Uniform_Outer_std140 %a %uint_0 %uint_3
|
||||
%126 = OpLoad %Outer_std140 %125
|
||||
%123 = OpFunctionCall %Outer %conv_Outer %126
|
||||
%129 = OpAccessChain %_ptr_Uniform__arr_Inner_std140_uint_4 %a %uint_0 %uint_3 %uint_0
|
||||
%130 = OpLoad %_arr_Inner_std140_uint_4 %129
|
||||
%127 = OpFunctionCall %_arr_Inner_uint_4 %conv_arr_4_Inner %130
|
||||
%132 = OpAccessChain %_ptr_Uniform_Inner_std140 %a %uint_0 %uint_3 %uint_0 %uint_2
|
||||
%133 = OpLoad %Inner_std140 %132
|
||||
%131 = OpFunctionCall %Inner %conv_Inner %133
|
||||
%134 = OpFunctionCall %mat2v2float %load_a_inner_3_a_2_m
|
||||
%135 = OpAccessChain %_ptr_Uniform_v2float %a %uint_0 %uint_3 %uint_0 %uint_2 %uint_1
|
||||
%136 = OpLoad %v2float %135
|
||||
%138 = OpAccessChain %_ptr_Uniform_float %a %uint_0 %uint_3 %uint_0 %uint_2 %uint_1 %32
|
||||
%139 = OpLoad %float %138
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,26 @@
|
||||
struct Inner {
|
||||
m : mat2x2<f32>,
|
||||
}
|
||||
|
||||
struct Outer {
|
||||
a : array<Inner, 4>,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<uniform> a : array<Outer, 4>;
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn f() {
|
||||
let p_a = &(a);
|
||||
let p_a_3 = &((*(p_a))[3]);
|
||||
let p_a_3_a = &((*(p_a_3)).a);
|
||||
let p_a_3_a_2 = &((*(p_a_3_a))[2]);
|
||||
let p_a_3_a_2_m = &((*(p_a_3_a_2)).m);
|
||||
let p_a_3_a_2_m_1 = &((*(p_a_3_a_2_m))[1]);
|
||||
let l_a : array<Outer, 4> = *(p_a);
|
||||
let l_a_3 : Outer = *(p_a_3);
|
||||
let l_a_3_a : array<Inner, 4> = *(p_a_3_a);
|
||||
let l_a_3_a_2 : Inner = *(p_a_3_a_2);
|
||||
let l_a_3_a_2_m : mat2x2<f32> = *(p_a_3_a_2_m);
|
||||
let l_a_3_a_2_m_1 : vec2<f32> = *(p_a_3_a_2_m_1);
|
||||
let l_a_3_a_2_m_1_0 : f32 = (*(p_a_3_a_2_m_1))[0];
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
struct S {
|
||||
before : i32,
|
||||
m : mat2x2<f32>,
|
||||
after : i32,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<uniform> u : array<S, 4>;
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn f() {
|
||||
let t = transpose(u[2].m);
|
||||
let l = length(u[0].m[1].yx);
|
||||
let a = abs(u[0].m[1].yx.x);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
cbuffer cbuffer_u : register(b0, space0) {
|
||||
uint4 u[8];
|
||||
};
|
||||
|
||||
float2x2 tint_symbol(uint4 buffer[8], uint offset) {
|
||||
const uint scalar_offset = ((offset + 0u)) / 4;
|
||||
uint4 ubo_load = buffer[scalar_offset / 4];
|
||||
const uint scalar_offset_1 = ((offset + 8u)) / 4;
|
||||
uint4 ubo_load_1 = buffer[scalar_offset_1 / 4];
|
||||
return float2x2(asfloat(((scalar_offset & 2) ? ubo_load.zw : ubo_load.xy)), asfloat(((scalar_offset_1 & 2) ? ubo_load_1.zw : ubo_load_1.xy)));
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void f() {
|
||||
const float2x2 t = transpose(tint_symbol(u, 72u));
|
||||
const float l = length(asfloat(u[1].xy).yx);
|
||||
const float a = abs(asfloat(u[1].xy).yx.x);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
cbuffer cbuffer_u : register(b0, space0) {
|
||||
uint4 u[8];
|
||||
};
|
||||
|
||||
float2x2 tint_symbol(uint4 buffer[8], uint offset) {
|
||||
const uint scalar_offset = ((offset + 0u)) / 4;
|
||||
uint4 ubo_load = buffer[scalar_offset / 4];
|
||||
const uint scalar_offset_1 = ((offset + 8u)) / 4;
|
||||
uint4 ubo_load_1 = buffer[scalar_offset_1 / 4];
|
||||
return float2x2(asfloat(((scalar_offset & 2) ? ubo_load.zw : ubo_load.xy)), asfloat(((scalar_offset_1 & 2) ? ubo_load_1.zw : ubo_load_1.xy)));
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void f() {
|
||||
const float2x2 t = transpose(tint_symbol(u, 72u));
|
||||
const float l = length(asfloat(u[1].xy).yx);
|
||||
const float a = abs(asfloat(u[1].xy).yx.x);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
#version 310 es
|
||||
|
||||
struct S {
|
||||
int before;
|
||||
uint pad;
|
||||
mat2 m;
|
||||
int after;
|
||||
uint pad_1;
|
||||
};
|
||||
|
||||
struct S_std140 {
|
||||
int before;
|
||||
uint pad;
|
||||
vec2 m_0;
|
||||
vec2 m_1;
|
||||
int after;
|
||||
uint pad_1;
|
||||
};
|
||||
|
||||
layout(binding = 0, std140) uniform u_block_std140_ubo {
|
||||
S_std140 inner[4];
|
||||
} u;
|
||||
|
||||
mat2 load_u_inner_2_m() {
|
||||
return mat2(u.inner[2u].m_0, u.inner[2u].m_1);
|
||||
}
|
||||
|
||||
void f() {
|
||||
mat2 t = transpose(load_u_inner_2_m());
|
||||
float l = length(u.inner[0u].m_1.yx);
|
||||
float a = abs(u.inner[0u].m_1.yx[0u]);
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
f();
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
template<typename T, size_t N>
|
||||
struct tint_array {
|
||||
const constant T& operator[](size_t i) const constant { return elements[i]; }
|
||||
device T& operator[](size_t i) device { return elements[i]; }
|
||||
const device T& operator[](size_t i) const device { return elements[i]; }
|
||||
thread T& operator[](size_t i) thread { return elements[i]; }
|
||||
const thread T& operator[](size_t i) const thread { return elements[i]; }
|
||||
threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
|
||||
const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
|
||||
T elements[N];
|
||||
};
|
||||
|
||||
struct S {
|
||||
/* 0x0000 */ int before;
|
||||
/* 0x0004 */ tint_array<int8_t, 4> tint_pad;
|
||||
/* 0x0008 */ float2x2 m;
|
||||
/* 0x0018 */ int after;
|
||||
/* 0x001c */ tint_array<int8_t, 4> tint_pad_1;
|
||||
};
|
||||
|
||||
kernel void f(const constant tint_array<S, 4>* tint_symbol [[buffer(0)]]) {
|
||||
float2x2 const t = transpose((*(tint_symbol))[2].m);
|
||||
float const l = length(float2((*(tint_symbol))[0].m[1]).yx);
|
||||
float const a = fabs(float2((*(tint_symbol))[0].m[1]).yx[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 46
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%36 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %f "f"
|
||||
OpExecutionMode %f LocalSize 1 1 1
|
||||
OpName %u_block_std140 "u_block_std140"
|
||||
OpMemberName %u_block_std140 0 "inner"
|
||||
OpName %S_std140 "S_std140"
|
||||
OpMemberName %S_std140 0 "before"
|
||||
OpMemberName %S_std140 1 "m_0"
|
||||
OpMemberName %S_std140 2 "m_1"
|
||||
OpMemberName %S_std140 3 "after"
|
||||
OpName %u "u"
|
||||
OpName %load_u_inner_2_m "load_u_inner_2_m"
|
||||
OpName %f "f"
|
||||
OpDecorate %u_block_std140 Block
|
||||
OpMemberDecorate %u_block_std140 0 Offset 0
|
||||
OpMemberDecorate %S_std140 0 Offset 0
|
||||
OpMemberDecorate %S_std140 1 Offset 8
|
||||
OpMemberDecorate %S_std140 2 Offset 16
|
||||
OpMemberDecorate %S_std140 3 Offset 24
|
||||
OpDecorate %_arr_S_std140_uint_4 ArrayStride 32
|
||||
OpDecorate %u NonWritable
|
||||
OpDecorate %u DescriptorSet 0
|
||||
OpDecorate %u Binding 0
|
||||
%int = OpTypeInt 32 1
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%S_std140 = OpTypeStruct %int %v2float %v2float %int
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%_arr_S_std140_uint_4 = OpTypeArray %S_std140 %uint_4
|
||||
%u_block_std140 = OpTypeStruct %_arr_S_std140_uint_4
|
||||
%_ptr_Uniform_u_block_std140 = OpTypePointer Uniform %u_block_std140
|
||||
%u = OpVariable %_ptr_Uniform_u_block_std140 Uniform
|
||||
%mat2v2float = OpTypeMatrix %v2float 2
|
||||
%11 = OpTypeFunction %mat2v2float
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
|
||||
%void = OpTypeVoid
|
||||
%29 = OpTypeFunction %void
|
||||
%37 = OpConstantNull %uint
|
||||
%load_u_inner_2_m = OpFunction %mat2v2float None %11
|
||||
%14 = OpLabel
|
||||
%19 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
|
||||
%23 = OpAccessChain %_ptr_Uniform_v2float %19 %uint_1
|
||||
%24 = OpLoad %v2float %23
|
||||
%26 = OpAccessChain %_ptr_Uniform_v2float %19 %uint_2
|
||||
%27 = OpLoad %v2float %26
|
||||
%28 = OpCompositeConstruct %mat2v2float %24 %27
|
||||
OpReturnValue %28
|
||||
OpFunctionEnd
|
||||
%f = OpFunction %void None %29
|
||||
%32 = OpLabel
|
||||
%34 = OpFunctionCall %mat2v2float %load_u_inner_2_m
|
||||
%33 = OpTranspose %mat2v2float %34
|
||||
%38 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0 %37 %uint_2
|
||||
%39 = OpLoad %v2float %38
|
||||
%40 = OpVectorShuffle %v2float %39 %39 1 0
|
||||
%35 = OpExtInst %float %36 Length %40
|
||||
%42 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0 %37 %uint_2
|
||||
%43 = OpLoad %v2float %42
|
||||
%44 = OpVectorShuffle %v2float %43 %43 1 0
|
||||
%45 = OpCompositeExtract %float %44 0
|
||||
%41 = OpExtInst %float %36 FAbs %45
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,14 @@
|
||||
struct S {
|
||||
before : i32,
|
||||
m : mat2x2<f32>,
|
||||
after : i32,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<uniform> u : array<S, 4>;
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn f() {
|
||||
let t = transpose(u[2].m);
|
||||
let l = length(u[0].m[1].yx);
|
||||
let a = abs(u[0].m[1].yx.x);
|
||||
}
|
||||
22
test/tint/buffer/uniform/std140/struct/mat2x2/to_fn.wgsl
Normal file
22
test/tint/buffer/uniform/std140/struct/mat2x2/to_fn.wgsl
Normal file
@@ -0,0 +1,22 @@
|
||||
struct S {
|
||||
before : i32,
|
||||
m : mat2x2<f32>,
|
||||
after : i32,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<uniform> u : array<S, 4>;
|
||||
|
||||
fn a(a : array<S, 4>) {}
|
||||
fn b(s : S) {}
|
||||
fn c(m : mat2x2<f32>) {}
|
||||
fn d(v : vec2<f32>) {}
|
||||
fn e(f : f32) {}
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn f() {
|
||||
a(u);
|
||||
b(u[2]);
|
||||
c(u[2].m);
|
||||
d(u[0].m[1].yx);
|
||||
e(u[0].m[1].yx.x);
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
struct S {
|
||||
int before;
|
||||
float2x2 m;
|
||||
int after;
|
||||
};
|
||||
|
||||
cbuffer cbuffer_u : register(b0, space0) {
|
||||
uint4 u[8];
|
||||
};
|
||||
|
||||
void a(S a_1[4]) {
|
||||
}
|
||||
|
||||
void b(S s) {
|
||||
}
|
||||
|
||||
void c(float2x2 m) {
|
||||
}
|
||||
|
||||
void d(float2 v) {
|
||||
}
|
||||
|
||||
void e(float f_1) {
|
||||
}
|
||||
|
||||
float2x2 tint_symbol_3(uint4 buffer[8], uint offset) {
|
||||
const uint scalar_offset = ((offset + 0u)) / 4;
|
||||
uint4 ubo_load = buffer[scalar_offset / 4];
|
||||
const uint scalar_offset_1 = ((offset + 8u)) / 4;
|
||||
uint4 ubo_load_1 = buffer[scalar_offset_1 / 4];
|
||||
return float2x2(asfloat(((scalar_offset & 2) ? ubo_load.zw : ubo_load.xy)), asfloat(((scalar_offset_1 & 2) ? ubo_load_1.zw : ubo_load_1.xy)));
|
||||
}
|
||||
|
||||
S tint_symbol_1(uint4 buffer[8], uint offset) {
|
||||
const uint scalar_offset_2 = ((offset + 0u)) / 4;
|
||||
const uint scalar_offset_3 = ((offset + 24u)) / 4;
|
||||
const S tint_symbol_5 = {asint(buffer[scalar_offset_2 / 4][scalar_offset_2 % 4]), tint_symbol_3(buffer, (offset + 8u)), asint(buffer[scalar_offset_3 / 4][scalar_offset_3 % 4])};
|
||||
return tint_symbol_5;
|
||||
}
|
||||
|
||||
typedef S tint_symbol_ret[4];
|
||||
tint_symbol_ret tint_symbol(uint4 buffer[8], uint offset) {
|
||||
S arr[4] = (S[4])0;
|
||||
{
|
||||
[loop] for(uint i = 0u; (i < 4u); i = (i + 1u)) {
|
||||
arr[i] = tint_symbol_1(buffer, (offset + (i * 32u)));
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void f() {
|
||||
a(tint_symbol(u, 0u));
|
||||
b(tint_symbol_1(u, 64u));
|
||||
c(tint_symbol_3(u, 72u));
|
||||
d(asfloat(u[1].xy).yx);
|
||||
e(asfloat(u[1].xy).yx.x);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
struct S {
|
||||
int before;
|
||||
float2x2 m;
|
||||
int after;
|
||||
};
|
||||
|
||||
cbuffer cbuffer_u : register(b0, space0) {
|
||||
uint4 u[8];
|
||||
};
|
||||
|
||||
void a(S a_1[4]) {
|
||||
}
|
||||
|
||||
void b(S s) {
|
||||
}
|
||||
|
||||
void c(float2x2 m) {
|
||||
}
|
||||
|
||||
void d(float2 v) {
|
||||
}
|
||||
|
||||
void e(float f_1) {
|
||||
}
|
||||
|
||||
float2x2 tint_symbol_3(uint4 buffer[8], uint offset) {
|
||||
const uint scalar_offset = ((offset + 0u)) / 4;
|
||||
uint4 ubo_load = buffer[scalar_offset / 4];
|
||||
const uint scalar_offset_1 = ((offset + 8u)) / 4;
|
||||
uint4 ubo_load_1 = buffer[scalar_offset_1 / 4];
|
||||
return float2x2(asfloat(((scalar_offset & 2) ? ubo_load.zw : ubo_load.xy)), asfloat(((scalar_offset_1 & 2) ? ubo_load_1.zw : ubo_load_1.xy)));
|
||||
}
|
||||
|
||||
S tint_symbol_1(uint4 buffer[8], uint offset) {
|
||||
const uint scalar_offset_2 = ((offset + 0u)) / 4;
|
||||
const uint scalar_offset_3 = ((offset + 24u)) / 4;
|
||||
const S tint_symbol_5 = {asint(buffer[scalar_offset_2 / 4][scalar_offset_2 % 4]), tint_symbol_3(buffer, (offset + 8u)), asint(buffer[scalar_offset_3 / 4][scalar_offset_3 % 4])};
|
||||
return tint_symbol_5;
|
||||
}
|
||||
|
||||
typedef S tint_symbol_ret[4];
|
||||
tint_symbol_ret tint_symbol(uint4 buffer[8], uint offset) {
|
||||
S arr[4] = (S[4])0;
|
||||
{
|
||||
[loop] for(uint i = 0u; (i < 4u); i = (i + 1u)) {
|
||||
arr[i] = tint_symbol_1(buffer, (offset + (i * 32u)));
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void f() {
|
||||
a(tint_symbol(u, 0u));
|
||||
b(tint_symbol_1(u, 64u));
|
||||
c(tint_symbol_3(u, 72u));
|
||||
d(asfloat(u[1].xy).yx);
|
||||
e(asfloat(u[1].xy).yx.x);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
#version 310 es
|
||||
|
||||
struct S {
|
||||
int before;
|
||||
uint pad;
|
||||
mat2 m;
|
||||
int after;
|
||||
uint pad_1;
|
||||
};
|
||||
|
||||
struct S_std140 {
|
||||
int before;
|
||||
uint pad;
|
||||
vec2 m_0;
|
||||
vec2 m_1;
|
||||
int after;
|
||||
uint pad_1;
|
||||
};
|
||||
|
||||
layout(binding = 0, std140) uniform u_block_std140_ubo {
|
||||
S_std140 inner[4];
|
||||
} u;
|
||||
|
||||
void a(S a_1[4]) {
|
||||
}
|
||||
|
||||
void b(S s) {
|
||||
}
|
||||
|
||||
void c(mat2 m) {
|
||||
}
|
||||
|
||||
void d(vec2 v) {
|
||||
}
|
||||
|
||||
void e(float f_1) {
|
||||
}
|
||||
|
||||
S conv_S(S_std140 val) {
|
||||
return S(val.before, val.pad, mat2(val.m_0, val.m_1), val.after, val.pad_1);
|
||||
}
|
||||
|
||||
S[4] conv_arr_4_S(S_std140 val[4]) {
|
||||
S arr[4] = S[4](S(0, 0u, mat2(0.0f, 0.0f, 0.0f, 0.0f), 0, 0u), S(0, 0u, mat2(0.0f, 0.0f, 0.0f, 0.0f), 0, 0u), S(0, 0u, mat2(0.0f, 0.0f, 0.0f, 0.0f), 0, 0u), S(0, 0u, mat2(0.0f, 0.0f, 0.0f, 0.0f), 0, 0u));
|
||||
{
|
||||
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
|
||||
arr[i] = conv_S(val[i]);
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
mat2 load_u_inner_2_m() {
|
||||
return mat2(u.inner[2u].m_0, u.inner[2u].m_1);
|
||||
}
|
||||
|
||||
void f() {
|
||||
a(conv_arr_4_S(u.inner));
|
||||
b(conv_S(u.inner[2u]));
|
||||
c(load_u_inner_2_m());
|
||||
d(u.inner[0u].m_1.yx);
|
||||
e(u.inner[0u].m_1.yx[0u]);
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
f();
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
template<typename T, size_t N>
|
||||
struct tint_array {
|
||||
const constant T& operator[](size_t i) const constant { return elements[i]; }
|
||||
device T& operator[](size_t i) device { return elements[i]; }
|
||||
const device T& operator[](size_t i) const device { return elements[i]; }
|
||||
thread T& operator[](size_t i) thread { return elements[i]; }
|
||||
const thread T& operator[](size_t i) const thread { return elements[i]; }
|
||||
threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
|
||||
const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
|
||||
T elements[N];
|
||||
};
|
||||
|
||||
struct S {
|
||||
/* 0x0000 */ int before;
|
||||
/* 0x0004 */ tint_array<int8_t, 4> tint_pad;
|
||||
/* 0x0008 */ float2x2 m;
|
||||
/* 0x0018 */ int after;
|
||||
/* 0x001c */ tint_array<int8_t, 4> tint_pad_1;
|
||||
};
|
||||
|
||||
void a(tint_array<S, 4> a_1) {
|
||||
}
|
||||
|
||||
void b(S s) {
|
||||
}
|
||||
|
||||
void c(float2x2 m) {
|
||||
}
|
||||
|
||||
void d(float2 v) {
|
||||
}
|
||||
|
||||
void e(float f_1) {
|
||||
}
|
||||
|
||||
kernel void f(const constant tint_array<S, 4>* tint_symbol [[buffer(0)]]) {
|
||||
a(*(tint_symbol));
|
||||
b((*(tint_symbol))[2]);
|
||||
c((*(tint_symbol))[2].m);
|
||||
d(float2((*(tint_symbol))[0].m[1]).yx);
|
||||
e(float2((*(tint_symbol))[0].m[1]).yx[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,200 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 119
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %f "f"
|
||||
OpExecutionMode %f LocalSize 1 1 1
|
||||
OpName %u_block_std140 "u_block_std140"
|
||||
OpMemberName %u_block_std140 0 "inner"
|
||||
OpName %S_std140 "S_std140"
|
||||
OpMemberName %S_std140 0 "before"
|
||||
OpMemberName %S_std140 1 "m_0"
|
||||
OpMemberName %S_std140 2 "m_1"
|
||||
OpMemberName %S_std140 3 "after"
|
||||
OpName %u "u"
|
||||
OpName %S "S"
|
||||
OpMemberName %S 0 "before"
|
||||
OpMemberName %S 1 "m"
|
||||
OpMemberName %S 2 "after"
|
||||
OpName %a "a"
|
||||
OpName %a_1 "a_1"
|
||||
OpName %b "b"
|
||||
OpName %s "s"
|
||||
OpName %c "c"
|
||||
OpName %m "m"
|
||||
OpName %d "d"
|
||||
OpName %v "v"
|
||||
OpName %e "e"
|
||||
OpName %f_1 "f_1"
|
||||
OpName %conv_S "conv_S"
|
||||
OpName %val "val"
|
||||
OpName %conv_arr_4_S "conv_arr_4_S"
|
||||
OpName %val_0 "val"
|
||||
OpName %arr "arr"
|
||||
OpName %i "i"
|
||||
OpName %var_for_index "var_for_index"
|
||||
OpName %load_u_inner_2_m "load_u_inner_2_m"
|
||||
OpName %f "f"
|
||||
OpDecorate %u_block_std140 Block
|
||||
OpMemberDecorate %u_block_std140 0 Offset 0
|
||||
OpMemberDecorate %S_std140 0 Offset 0
|
||||
OpMemberDecorate %S_std140 1 Offset 8
|
||||
OpMemberDecorate %S_std140 2 Offset 16
|
||||
OpMemberDecorate %S_std140 3 Offset 24
|
||||
OpDecorate %_arr_S_std140_uint_4 ArrayStride 32
|
||||
OpDecorate %u NonWritable
|
||||
OpDecorate %u DescriptorSet 0
|
||||
OpDecorate %u Binding 0
|
||||
OpMemberDecorate %S 0 Offset 0
|
||||
OpMemberDecorate %S 1 Offset 8
|
||||
OpMemberDecorate %S 1 ColMajor
|
||||
OpMemberDecorate %S 1 MatrixStride 8
|
||||
OpMemberDecorate %S 2 Offset 24
|
||||
OpDecorate %_arr_S_uint_4 ArrayStride 32
|
||||
%int = OpTypeInt 32 1
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%S_std140 = OpTypeStruct %int %v2float %v2float %int
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%_arr_S_std140_uint_4 = OpTypeArray %S_std140 %uint_4
|
||||
%u_block_std140 = OpTypeStruct %_arr_S_std140_uint_4
|
||||
%_ptr_Uniform_u_block_std140 = OpTypePointer Uniform %u_block_std140
|
||||
%u = OpVariable %_ptr_Uniform_u_block_std140 Uniform
|
||||
%void = OpTypeVoid
|
||||
%mat2v2float = OpTypeMatrix %v2float 2
|
||||
%S = OpTypeStruct %int %mat2v2float %int
|
||||
%_arr_S_uint_4 = OpTypeArray %S %uint_4
|
||||
%11 = OpTypeFunction %void %_arr_S_uint_4
|
||||
%19 = OpTypeFunction %void %S
|
||||
%23 = OpTypeFunction %void %mat2v2float
|
||||
%27 = OpTypeFunction %void %v2float
|
||||
%31 = OpTypeFunction %void %float
|
||||
%35 = OpTypeFunction %S %S_std140
|
||||
%45 = OpTypeFunction %_arr_S_uint_4 %_arr_S_std140_uint_4
|
||||
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
|
||||
%51 = OpConstantNull %_arr_S_uint_4
|
||||
%_ptr_Function_uint = OpTypePointer Function %uint
|
||||
%54 = OpConstantNull %uint
|
||||
%bool = OpTypeBool
|
||||
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
|
||||
%67 = OpConstantNull %_arr_S_std140_uint_4
|
||||
%_ptr_Function_S = OpTypePointer Function %S
|
||||
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%80 = OpTypeFunction %mat2v2float
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140
|
||||
%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
|
||||
%96 = OpTypeFunction %void
|
||||
%_ptr_Uniform__arr_S_std140_uint_4 = OpTypePointer Uniform %_arr_S_std140_uint_4
|
||||
%a = OpFunction %void None %11
|
||||
%a_1 = OpFunctionParameter %_arr_S_uint_4
|
||||
%18 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%b = OpFunction %void None %19
|
||||
%s = OpFunctionParameter %S
|
||||
%22 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%c = OpFunction %void None %23
|
||||
%m = OpFunctionParameter %mat2v2float
|
||||
%26 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%d = OpFunction %void None %27
|
||||
%v = OpFunctionParameter %v2float
|
||||
%30 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%e = OpFunction %void None %31
|
||||
%f_1 = OpFunctionParameter %float
|
||||
%34 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%conv_S = OpFunction %S None %35
|
||||
%val = OpFunctionParameter %S_std140
|
||||
%38 = OpLabel
|
||||
%39 = OpCompositeExtract %int %val 0
|
||||
%40 = OpCompositeExtract %v2float %val 1
|
||||
%41 = OpCompositeExtract %v2float %val 2
|
||||
%42 = OpCompositeConstruct %mat2v2float %40 %41
|
||||
%43 = OpCompositeExtract %int %val 3
|
||||
%44 = OpCompositeConstruct %S %39 %42 %43
|
||||
OpReturnValue %44
|
||||
OpFunctionEnd
|
||||
%conv_arr_4_S = OpFunction %_arr_S_uint_4 None %45
|
||||
%val_0 = OpFunctionParameter %_arr_S_std140_uint_4
|
||||
%48 = OpLabel
|
||||
%arr = OpVariable %_ptr_Function__arr_S_uint_4 Function %51
|
||||
%i = OpVariable %_ptr_Function_uint Function %54
|
||||
%var_for_index = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function %67
|
||||
OpBranch %55
|
||||
%55 = OpLabel
|
||||
OpLoopMerge %56 %57 None
|
||||
OpBranch %58
|
||||
%58 = OpLabel
|
||||
%60 = OpLoad %uint %i
|
||||
%61 = OpULessThan %bool %60 %uint_4
|
||||
%59 = OpLogicalNot %bool %61
|
||||
OpSelectionMerge %63 None
|
||||
OpBranchConditional %59 %64 %63
|
||||
%64 = OpLabel
|
||||
OpBranch %56
|
||||
%63 = OpLabel
|
||||
OpStore %var_for_index %val_0
|
||||
%68 = OpLoad %uint %i
|
||||
%70 = OpAccessChain %_ptr_Function_S %arr %68
|
||||
%72 = OpLoad %uint %i
|
||||
%74 = OpAccessChain %_ptr_Function_S_std140 %var_for_index %72
|
||||
%75 = OpLoad %S_std140 %74
|
||||
%71 = OpFunctionCall %S %conv_S %75
|
||||
OpStore %70 %71
|
||||
OpBranch %57
|
||||
%57 = OpLabel
|
||||
%76 = OpLoad %uint %i
|
||||
%78 = OpIAdd %uint %76 %uint_1
|
||||
OpStore %i %78
|
||||
OpBranch %55
|
||||
%56 = OpLabel
|
||||
%79 = OpLoad %_arr_S_uint_4 %arr
|
||||
OpReturnValue %79
|
||||
OpFunctionEnd
|
||||
%load_u_inner_2_m = OpFunction %mat2v2float None %80
|
||||
%82 = OpLabel
|
||||
%87 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
|
||||
%90 = OpAccessChain %_ptr_Uniform_v2float %87 %uint_1
|
||||
%91 = OpLoad %v2float %90
|
||||
%93 = OpAccessChain %_ptr_Uniform_v2float %87 %uint_2
|
||||
%94 = OpLoad %v2float %93
|
||||
%95 = OpCompositeConstruct %mat2v2float %91 %94
|
||||
OpReturnValue %95
|
||||
OpFunctionEnd
|
||||
%f = OpFunction %void None %96
|
||||
%98 = OpLabel
|
||||
%102 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %u %uint_0
|
||||
%103 = OpLoad %_arr_S_std140_uint_4 %102
|
||||
%100 = OpFunctionCall %_arr_S_uint_4 %conv_arr_4_S %103
|
||||
%99 = OpFunctionCall %void %a %100
|
||||
%106 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
|
||||
%107 = OpLoad %S_std140 %106
|
||||
%105 = OpFunctionCall %S %conv_S %107
|
||||
%104 = OpFunctionCall %void %b %105
|
||||
%109 = OpFunctionCall %mat2v2float %load_u_inner_2_m
|
||||
%108 = OpFunctionCall %void %c %109
|
||||
%111 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0 %54 %uint_2
|
||||
%112 = OpLoad %v2float %111
|
||||
%113 = OpVectorShuffle %v2float %112 %112 1 0
|
||||
%110 = OpFunctionCall %void %d %113
|
||||
%115 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0 %54 %uint_2
|
||||
%116 = OpLoad %v2float %115
|
||||
%117 = OpVectorShuffle %v2float %116 %116 1 0
|
||||
%118 = OpCompositeExtract %float %117 0
|
||||
%114 = OpFunctionCall %void %e %118
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,31 @@
|
||||
struct S {
|
||||
before : i32,
|
||||
m : mat2x2<f32>,
|
||||
after : i32,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<uniform> u : array<S, 4>;
|
||||
|
||||
fn a(a : array<S, 4>) {
|
||||
}
|
||||
|
||||
fn b(s : S) {
|
||||
}
|
||||
|
||||
fn c(m : mat2x2<f32>) {
|
||||
}
|
||||
|
||||
fn d(v : vec2<f32>) {
|
||||
}
|
||||
|
||||
fn e(f : f32) {
|
||||
}
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn f() {
|
||||
a(u);
|
||||
b(u[2]);
|
||||
c(u[2].m);
|
||||
d(u[0].m[1].yx);
|
||||
e(u[0].m[1].yx.x);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
struct S {
|
||||
before : i32,
|
||||
m : mat2x2<f32>,
|
||||
after : i32,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<uniform> u : array<S, 4>;
|
||||
var<private> p : array<S, 4>;
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn f() {
|
||||
p = u;
|
||||
p[1] = u[2];
|
||||
p[3].m = u[2].m;
|
||||
p[1].m[0] = u[0].m[1].yx;
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
struct S {
|
||||
int before;
|
||||
float2x2 m;
|
||||
int after;
|
||||
};
|
||||
|
||||
cbuffer cbuffer_u : register(b0, space0) {
|
||||
uint4 u[8];
|
||||
};
|
||||
static S p[4] = (S[4])0;
|
||||
|
||||
float2x2 tint_symbol_3(uint4 buffer[8], uint offset) {
|
||||
const uint scalar_offset = ((offset + 0u)) / 4;
|
||||
uint4 ubo_load = buffer[scalar_offset / 4];
|
||||
const uint scalar_offset_1 = ((offset + 8u)) / 4;
|
||||
uint4 ubo_load_1 = buffer[scalar_offset_1 / 4];
|
||||
return float2x2(asfloat(((scalar_offset & 2) ? ubo_load.zw : ubo_load.xy)), asfloat(((scalar_offset_1 & 2) ? ubo_load_1.zw : ubo_load_1.xy)));
|
||||
}
|
||||
|
||||
S tint_symbol_1(uint4 buffer[8], uint offset) {
|
||||
const uint scalar_offset_2 = ((offset + 0u)) / 4;
|
||||
const uint scalar_offset_3 = ((offset + 24u)) / 4;
|
||||
const S tint_symbol_5 = {asint(buffer[scalar_offset_2 / 4][scalar_offset_2 % 4]), tint_symbol_3(buffer, (offset + 8u)), asint(buffer[scalar_offset_3 / 4][scalar_offset_3 % 4])};
|
||||
return tint_symbol_5;
|
||||
}
|
||||
|
||||
typedef S tint_symbol_ret[4];
|
||||
tint_symbol_ret tint_symbol(uint4 buffer[8], uint offset) {
|
||||
S arr[4] = (S[4])0;
|
||||
{
|
||||
[loop] for(uint i = 0u; (i < 4u); i = (i + 1u)) {
|
||||
arr[i] = tint_symbol_1(buffer, (offset + (i * 32u)));
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void f() {
|
||||
p = tint_symbol(u, 0u);
|
||||
p[1] = tint_symbol_1(u, 64u);
|
||||
p[3].m = tint_symbol_3(u, 72u);
|
||||
p[1].m[0] = asfloat(u[1].xy).yx;
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
struct S {
|
||||
int before;
|
||||
float2x2 m;
|
||||
int after;
|
||||
};
|
||||
|
||||
cbuffer cbuffer_u : register(b0, space0) {
|
||||
uint4 u[8];
|
||||
};
|
||||
static S p[4] = (S[4])0;
|
||||
|
||||
float2x2 tint_symbol_3(uint4 buffer[8], uint offset) {
|
||||
const uint scalar_offset = ((offset + 0u)) / 4;
|
||||
uint4 ubo_load = buffer[scalar_offset / 4];
|
||||
const uint scalar_offset_1 = ((offset + 8u)) / 4;
|
||||
uint4 ubo_load_1 = buffer[scalar_offset_1 / 4];
|
||||
return float2x2(asfloat(((scalar_offset & 2) ? ubo_load.zw : ubo_load.xy)), asfloat(((scalar_offset_1 & 2) ? ubo_load_1.zw : ubo_load_1.xy)));
|
||||
}
|
||||
|
||||
S tint_symbol_1(uint4 buffer[8], uint offset) {
|
||||
const uint scalar_offset_2 = ((offset + 0u)) / 4;
|
||||
const uint scalar_offset_3 = ((offset + 24u)) / 4;
|
||||
const S tint_symbol_5 = {asint(buffer[scalar_offset_2 / 4][scalar_offset_2 % 4]), tint_symbol_3(buffer, (offset + 8u)), asint(buffer[scalar_offset_3 / 4][scalar_offset_3 % 4])};
|
||||
return tint_symbol_5;
|
||||
}
|
||||
|
||||
typedef S tint_symbol_ret[4];
|
||||
tint_symbol_ret tint_symbol(uint4 buffer[8], uint offset) {
|
||||
S arr[4] = (S[4])0;
|
||||
{
|
||||
[loop] for(uint i = 0u; (i < 4u); i = (i + 1u)) {
|
||||
arr[i] = tint_symbol_1(buffer, (offset + (i * 32u)));
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void f() {
|
||||
p = tint_symbol(u, 0u);
|
||||
p[1] = tint_symbol_1(u, 64u);
|
||||
p[3].m = tint_symbol_3(u, 72u);
|
||||
p[1].m[0] = asfloat(u[1].xy).yx;
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
#version 310 es
|
||||
|
||||
struct S {
|
||||
int before;
|
||||
uint pad;
|
||||
mat2 m;
|
||||
int after;
|
||||
uint pad_1;
|
||||
};
|
||||
|
||||
struct S_std140 {
|
||||
int before;
|
||||
uint pad;
|
||||
vec2 m_0;
|
||||
vec2 m_1;
|
||||
int after;
|
||||
uint pad_1;
|
||||
};
|
||||
|
||||
layout(binding = 0, std140) uniform u_block_std140_ubo {
|
||||
S_std140 inner[4];
|
||||
} u;
|
||||
|
||||
S p[4] = S[4](S(0, 0u, mat2(0.0f, 0.0f, 0.0f, 0.0f), 0, 0u), S(0, 0u, mat2(0.0f, 0.0f, 0.0f, 0.0f), 0, 0u), S(0, 0u, mat2(0.0f, 0.0f, 0.0f, 0.0f), 0, 0u), S(0, 0u, mat2(0.0f, 0.0f, 0.0f, 0.0f), 0, 0u));
|
||||
S conv_S(S_std140 val) {
|
||||
return S(val.before, val.pad, mat2(val.m_0, val.m_1), val.after, val.pad_1);
|
||||
}
|
||||
|
||||
S[4] conv_arr_4_S(S_std140 val[4]) {
|
||||
S arr[4] = S[4](S(0, 0u, mat2(0.0f, 0.0f, 0.0f, 0.0f), 0, 0u), S(0, 0u, mat2(0.0f, 0.0f, 0.0f, 0.0f), 0, 0u), S(0, 0u, mat2(0.0f, 0.0f, 0.0f, 0.0f), 0, 0u), S(0, 0u, mat2(0.0f, 0.0f, 0.0f, 0.0f), 0, 0u));
|
||||
{
|
||||
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
|
||||
arr[i] = conv_S(val[i]);
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
mat2 load_u_inner_2_m() {
|
||||
return mat2(u.inner[2u].m_0, u.inner[2u].m_1);
|
||||
}
|
||||
|
||||
void f() {
|
||||
p = conv_arr_4_S(u.inner);
|
||||
p[1] = conv_S(u.inner[2u]);
|
||||
p[3].m = load_u_inner_2_m();
|
||||
p[1].m[0] = u.inner[0u].m_1.yx;
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
f();
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
template<typename T, size_t N>
|
||||
struct tint_array {
|
||||
const constant T& operator[](size_t i) const constant { return elements[i]; }
|
||||
device T& operator[](size_t i) device { return elements[i]; }
|
||||
const device T& operator[](size_t i) const device { return elements[i]; }
|
||||
thread T& operator[](size_t i) thread { return elements[i]; }
|
||||
const thread T& operator[](size_t i) const thread { return elements[i]; }
|
||||
threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
|
||||
const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
|
||||
T elements[N];
|
||||
};
|
||||
|
||||
struct S {
|
||||
/* 0x0000 */ int before;
|
||||
/* 0x0004 */ tint_array<int8_t, 4> tint_pad;
|
||||
/* 0x0008 */ float2x2 m;
|
||||
/* 0x0018 */ int after;
|
||||
/* 0x001c */ tint_array<int8_t, 4> tint_pad_1;
|
||||
};
|
||||
|
||||
kernel void f(const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) {
|
||||
thread tint_array<S, 4> tint_symbol = {};
|
||||
tint_symbol = *(tint_symbol_1);
|
||||
tint_symbol[1] = (*(tint_symbol_1))[2];
|
||||
tint_symbol[3].m = (*(tint_symbol_1))[2].m;
|
||||
tint_symbol[1].m[0] = float2((*(tint_symbol_1))[0].m[1]).yx;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,167 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 101
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %f "f"
|
||||
OpExecutionMode %f LocalSize 1 1 1
|
||||
OpName %u_block_std140 "u_block_std140"
|
||||
OpMemberName %u_block_std140 0 "inner"
|
||||
OpName %S_std140 "S_std140"
|
||||
OpMemberName %S_std140 0 "before"
|
||||
OpMemberName %S_std140 1 "m_0"
|
||||
OpMemberName %S_std140 2 "m_1"
|
||||
OpMemberName %S_std140 3 "after"
|
||||
OpName %u "u"
|
||||
OpName %S "S"
|
||||
OpMemberName %S 0 "before"
|
||||
OpMemberName %S 1 "m"
|
||||
OpMemberName %S 2 "after"
|
||||
OpName %p "p"
|
||||
OpName %conv_S "conv_S"
|
||||
OpName %val "val"
|
||||
OpName %conv_arr_4_S "conv_arr_4_S"
|
||||
OpName %val_0 "val"
|
||||
OpName %arr "arr"
|
||||
OpName %i "i"
|
||||
OpName %var_for_index "var_for_index"
|
||||
OpName %load_u_inner_2_m "load_u_inner_2_m"
|
||||
OpName %f "f"
|
||||
OpDecorate %u_block_std140 Block
|
||||
OpMemberDecorate %u_block_std140 0 Offset 0
|
||||
OpMemberDecorate %S_std140 0 Offset 0
|
||||
OpMemberDecorate %S_std140 1 Offset 8
|
||||
OpMemberDecorate %S_std140 2 Offset 16
|
||||
OpMemberDecorate %S_std140 3 Offset 24
|
||||
OpDecorate %_arr_S_std140_uint_4 ArrayStride 32
|
||||
OpDecorate %u NonWritable
|
||||
OpDecorate %u DescriptorSet 0
|
||||
OpDecorate %u Binding 0
|
||||
OpMemberDecorate %S 0 Offset 0
|
||||
OpMemberDecorate %S 1 Offset 8
|
||||
OpMemberDecorate %S 1 ColMajor
|
||||
OpMemberDecorate %S 1 MatrixStride 8
|
||||
OpMemberDecorate %S 2 Offset 24
|
||||
OpDecorate %_arr_S_uint_4 ArrayStride 32
|
||||
%int = OpTypeInt 32 1
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%S_std140 = OpTypeStruct %int %v2float %v2float %int
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%_arr_S_std140_uint_4 = OpTypeArray %S_std140 %uint_4
|
||||
%u_block_std140 = OpTypeStruct %_arr_S_std140_uint_4
|
||||
%_ptr_Uniform_u_block_std140 = OpTypePointer Uniform %u_block_std140
|
||||
%u = OpVariable %_ptr_Uniform_u_block_std140 Uniform
|
||||
%mat2v2float = OpTypeMatrix %v2float 2
|
||||
%S = OpTypeStruct %int %mat2v2float %int
|
||||
%_arr_S_uint_4 = OpTypeArray %S %uint_4
|
||||
%_ptr_Private__arr_S_uint_4 = OpTypePointer Private %_arr_S_uint_4
|
||||
%16 = OpConstantNull %_arr_S_uint_4
|
||||
%p = OpVariable %_ptr_Private__arr_S_uint_4 Private %16
|
||||
%17 = OpTypeFunction %S %S_std140
|
||||
%27 = OpTypeFunction %_arr_S_uint_4 %_arr_S_std140_uint_4
|
||||
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
|
||||
%_ptr_Function_uint = OpTypePointer Function %uint
|
||||
%35 = OpConstantNull %uint
|
||||
%bool = OpTypeBool
|
||||
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
|
||||
%48 = OpConstantNull %_arr_S_std140_uint_4
|
||||
%_ptr_Function_S = OpTypePointer Function %S
|
||||
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%61 = OpTypeFunction %mat2v2float
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140
|
||||
%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
|
||||
%void = OpTypeVoid
|
||||
%77 = OpTypeFunction %void
|
||||
%_ptr_Uniform__arr_S_std140_uint_4 = OpTypePointer Uniform %_arr_S_std140_uint_4
|
||||
%int_1 = OpConstant %int 1
|
||||
%_ptr_Private_S = OpTypePointer Private %S
|
||||
%int_3 = OpConstant %int 3
|
||||
%_ptr_Private_mat2v2float = OpTypePointer Private %mat2v2float
|
||||
%95 = OpConstantNull %int
|
||||
%_ptr_Private_v2float = OpTypePointer Private %v2float
|
||||
%conv_S = OpFunction %S None %17
|
||||
%val = OpFunctionParameter %S_std140
|
||||
%20 = OpLabel
|
||||
%21 = OpCompositeExtract %int %val 0
|
||||
%22 = OpCompositeExtract %v2float %val 1
|
||||
%23 = OpCompositeExtract %v2float %val 2
|
||||
%24 = OpCompositeConstruct %mat2v2float %22 %23
|
||||
%25 = OpCompositeExtract %int %val 3
|
||||
%26 = OpCompositeConstruct %S %21 %24 %25
|
||||
OpReturnValue %26
|
||||
OpFunctionEnd
|
||||
%conv_arr_4_S = OpFunction %_arr_S_uint_4 None %27
|
||||
%val_0 = OpFunctionParameter %_arr_S_std140_uint_4
|
||||
%30 = OpLabel
|
||||
%arr = OpVariable %_ptr_Function__arr_S_uint_4 Function %16
|
||||
%i = OpVariable %_ptr_Function_uint Function %35
|
||||
%var_for_index = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function %48
|
||||
OpBranch %36
|
||||
%36 = OpLabel
|
||||
OpLoopMerge %37 %38 None
|
||||
OpBranch %39
|
||||
%39 = OpLabel
|
||||
%41 = OpLoad %uint %i
|
||||
%42 = OpULessThan %bool %41 %uint_4
|
||||
%40 = OpLogicalNot %bool %42
|
||||
OpSelectionMerge %44 None
|
||||
OpBranchConditional %40 %45 %44
|
||||
%45 = OpLabel
|
||||
OpBranch %37
|
||||
%44 = OpLabel
|
||||
OpStore %var_for_index %val_0
|
||||
%49 = OpLoad %uint %i
|
||||
%51 = OpAccessChain %_ptr_Function_S %arr %49
|
||||
%53 = OpLoad %uint %i
|
||||
%55 = OpAccessChain %_ptr_Function_S_std140 %var_for_index %53
|
||||
%56 = OpLoad %S_std140 %55
|
||||
%52 = OpFunctionCall %S %conv_S %56
|
||||
OpStore %51 %52
|
||||
OpBranch %38
|
||||
%38 = OpLabel
|
||||
%57 = OpLoad %uint %i
|
||||
%59 = OpIAdd %uint %57 %uint_1
|
||||
OpStore %i %59
|
||||
OpBranch %36
|
||||
%37 = OpLabel
|
||||
%60 = OpLoad %_arr_S_uint_4 %arr
|
||||
OpReturnValue %60
|
||||
OpFunctionEnd
|
||||
%load_u_inner_2_m = OpFunction %mat2v2float None %61
|
||||
%63 = OpLabel
|
||||
%68 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
|
||||
%71 = OpAccessChain %_ptr_Uniform_v2float %68 %uint_1
|
||||
%72 = OpLoad %v2float %71
|
||||
%74 = OpAccessChain %_ptr_Uniform_v2float %68 %uint_2
|
||||
%75 = OpLoad %v2float %74
|
||||
%76 = OpCompositeConstruct %mat2v2float %72 %75
|
||||
OpReturnValue %76
|
||||
OpFunctionEnd
|
||||
%f = OpFunction %void None %77
|
||||
%80 = OpLabel
|
||||
%83 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %u %uint_0
|
||||
%84 = OpLoad %_arr_S_std140_uint_4 %83
|
||||
%81 = OpFunctionCall %_arr_S_uint_4 %conv_arr_4_S %84
|
||||
OpStore %p %81
|
||||
%87 = OpAccessChain %_ptr_Private_S %p %int_1
|
||||
%89 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
|
||||
%90 = OpLoad %S_std140 %89
|
||||
%88 = OpFunctionCall %S %conv_S %90
|
||||
OpStore %87 %88
|
||||
%93 = OpAccessChain %_ptr_Private_mat2v2float %p %int_3 %uint_1
|
||||
%94 = OpFunctionCall %mat2v2float %load_u_inner_2_m
|
||||
OpStore %93 %94
|
||||
%97 = OpAccessChain %_ptr_Private_v2float %p %int_1 %uint_1 %95
|
||||
%98 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0 %35 %uint_2
|
||||
%99 = OpLoad %v2float %98
|
||||
%100 = OpVectorShuffle %v2float %99 %99 1 0
|
||||
OpStore %97 %100
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,17 @@
|
||||
struct S {
|
||||
before : i32,
|
||||
m : mat2x2<f32>,
|
||||
after : i32,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<uniform> u : array<S, 4>;
|
||||
|
||||
var<private> p : array<S, 4>;
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn f() {
|
||||
p = u;
|
||||
p[1] = u[2];
|
||||
p[3].m = u[2].m;
|
||||
p[1].m[0] = u[0].m[1].yx;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
struct S {
|
||||
before : i32,
|
||||
m : mat2x2<f32>,
|
||||
after : i32,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<uniform> u : array<S, 4>;
|
||||
@group(0) @binding(1) var<storage, read_write> s : array<S, 4>;
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn f() {
|
||||
s = u;
|
||||
s[1] = u[2];
|
||||
s[3].m = u[2].m;
|
||||
s[1].m[0] = u[0].m[1].yx;
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
struct S {
|
||||
int before;
|
||||
float2x2 m;
|
||||
int after;
|
||||
};
|
||||
|
||||
cbuffer cbuffer_u : register(b0, space0) {
|
||||
uint4 u[8];
|
||||
};
|
||||
RWByteAddressBuffer s : register(u1, space0);
|
||||
|
||||
void tint_symbol_3(RWByteAddressBuffer buffer, uint offset, float2x2 value) {
|
||||
buffer.Store2((offset + 0u), asuint(value[0u]));
|
||||
buffer.Store2((offset + 8u), asuint(value[1u]));
|
||||
}
|
||||
|
||||
void tint_symbol_1(RWByteAddressBuffer buffer, uint offset, S value) {
|
||||
buffer.Store((offset + 0u), asuint(value.before));
|
||||
tint_symbol_3(buffer, (offset + 8u), value.m);
|
||||
buffer.Store((offset + 24u), asuint(value.after));
|
||||
}
|
||||
|
||||
void tint_symbol(RWByteAddressBuffer buffer, uint offset, S value[4]) {
|
||||
S array[4] = value;
|
||||
{
|
||||
[loop] for(uint i = 0u; (i < 4u); i = (i + 1u)) {
|
||||
tint_symbol_1(buffer, (offset + (i * 32u)), array[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
float2x2 tint_symbol_8(uint4 buffer[8], uint offset) {
|
||||
const uint scalar_offset = ((offset + 0u)) / 4;
|
||||
uint4 ubo_load = buffer[scalar_offset / 4];
|
||||
const uint scalar_offset_1 = ((offset + 8u)) / 4;
|
||||
uint4 ubo_load_1 = buffer[scalar_offset_1 / 4];
|
||||
return float2x2(asfloat(((scalar_offset & 2) ? ubo_load.zw : ubo_load.xy)), asfloat(((scalar_offset_1 & 2) ? ubo_load_1.zw : ubo_load_1.xy)));
|
||||
}
|
||||
|
||||
S tint_symbol_6(uint4 buffer[8], uint offset) {
|
||||
const uint scalar_offset_2 = ((offset + 0u)) / 4;
|
||||
const uint scalar_offset_3 = ((offset + 24u)) / 4;
|
||||
const S tint_symbol_10 = {asint(buffer[scalar_offset_2 / 4][scalar_offset_2 % 4]), tint_symbol_8(buffer, (offset + 8u)), asint(buffer[scalar_offset_3 / 4][scalar_offset_3 % 4])};
|
||||
return tint_symbol_10;
|
||||
}
|
||||
|
||||
typedef S tint_symbol_5_ret[4];
|
||||
tint_symbol_5_ret tint_symbol_5(uint4 buffer[8], uint offset) {
|
||||
S arr[4] = (S[4])0;
|
||||
{
|
||||
[loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
|
||||
arr[i_1] = tint_symbol_6(buffer, (offset + (i_1 * 32u)));
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void f() {
|
||||
tint_symbol(s, 0u, tint_symbol_5(u, 0u));
|
||||
tint_symbol_1(s, 32u, tint_symbol_6(u, 64u));
|
||||
tint_symbol_3(s, 104u, tint_symbol_8(u, 72u));
|
||||
s.Store2(40u, asuint(asfloat(u[1].xy).yx));
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
struct S {
|
||||
int before;
|
||||
float2x2 m;
|
||||
int after;
|
||||
};
|
||||
|
||||
cbuffer cbuffer_u : register(b0, space0) {
|
||||
uint4 u[8];
|
||||
};
|
||||
RWByteAddressBuffer s : register(u1, space0);
|
||||
|
||||
void tint_symbol_3(RWByteAddressBuffer buffer, uint offset, float2x2 value) {
|
||||
buffer.Store2((offset + 0u), asuint(value[0u]));
|
||||
buffer.Store2((offset + 8u), asuint(value[1u]));
|
||||
}
|
||||
|
||||
void tint_symbol_1(RWByteAddressBuffer buffer, uint offset, S value) {
|
||||
buffer.Store((offset + 0u), asuint(value.before));
|
||||
tint_symbol_3(buffer, (offset + 8u), value.m);
|
||||
buffer.Store((offset + 24u), asuint(value.after));
|
||||
}
|
||||
|
||||
void tint_symbol(RWByteAddressBuffer buffer, uint offset, S value[4]) {
|
||||
S array[4] = value;
|
||||
{
|
||||
[loop] for(uint i = 0u; (i < 4u); i = (i + 1u)) {
|
||||
tint_symbol_1(buffer, (offset + (i * 32u)), array[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
float2x2 tint_symbol_8(uint4 buffer[8], uint offset) {
|
||||
const uint scalar_offset = ((offset + 0u)) / 4;
|
||||
uint4 ubo_load = buffer[scalar_offset / 4];
|
||||
const uint scalar_offset_1 = ((offset + 8u)) / 4;
|
||||
uint4 ubo_load_1 = buffer[scalar_offset_1 / 4];
|
||||
return float2x2(asfloat(((scalar_offset & 2) ? ubo_load.zw : ubo_load.xy)), asfloat(((scalar_offset_1 & 2) ? ubo_load_1.zw : ubo_load_1.xy)));
|
||||
}
|
||||
|
||||
S tint_symbol_6(uint4 buffer[8], uint offset) {
|
||||
const uint scalar_offset_2 = ((offset + 0u)) / 4;
|
||||
const uint scalar_offset_3 = ((offset + 24u)) / 4;
|
||||
const S tint_symbol_10 = {asint(buffer[scalar_offset_2 / 4][scalar_offset_2 % 4]), tint_symbol_8(buffer, (offset + 8u)), asint(buffer[scalar_offset_3 / 4][scalar_offset_3 % 4])};
|
||||
return tint_symbol_10;
|
||||
}
|
||||
|
||||
typedef S tint_symbol_5_ret[4];
|
||||
tint_symbol_5_ret tint_symbol_5(uint4 buffer[8], uint offset) {
|
||||
S arr[4] = (S[4])0;
|
||||
{
|
||||
[loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
|
||||
arr[i_1] = tint_symbol_6(buffer, (offset + (i_1 * 32u)));
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void f() {
|
||||
tint_symbol(s, 0u, tint_symbol_5(u, 0u));
|
||||
tint_symbol_1(s, 32u, tint_symbol_6(u, 64u));
|
||||
tint_symbol_3(s, 104u, tint_symbol_8(u, 72u));
|
||||
s.Store2(40u, asuint(asfloat(u[1].xy).yx));
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
#version 310 es
|
||||
|
||||
struct S {
|
||||
int before;
|
||||
uint pad;
|
||||
mat2 m;
|
||||
int after;
|
||||
uint pad_1;
|
||||
};
|
||||
|
||||
struct S_std140 {
|
||||
int before;
|
||||
uint pad;
|
||||
vec2 m_0;
|
||||
vec2 m_1;
|
||||
int after;
|
||||
uint pad_1;
|
||||
};
|
||||
|
||||
layout(binding = 0, std140) uniform u_block_std140_ubo {
|
||||
S_std140 inner[4];
|
||||
} u;
|
||||
|
||||
layout(binding = 1, std430) buffer u_block_ssbo {
|
||||
S inner[4];
|
||||
} s;
|
||||
|
||||
S conv_S(S_std140 val) {
|
||||
return S(val.before, val.pad, mat2(val.m_0, val.m_1), val.after, val.pad_1);
|
||||
}
|
||||
|
||||
S[4] conv_arr_4_S(S_std140 val[4]) {
|
||||
S arr[4] = S[4](S(0, 0u, mat2(0.0f, 0.0f, 0.0f, 0.0f), 0, 0u), S(0, 0u, mat2(0.0f, 0.0f, 0.0f, 0.0f), 0, 0u), S(0, 0u, mat2(0.0f, 0.0f, 0.0f, 0.0f), 0, 0u), S(0, 0u, mat2(0.0f, 0.0f, 0.0f, 0.0f), 0, 0u));
|
||||
{
|
||||
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
|
||||
arr[i] = conv_S(val[i]);
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
mat2 load_u_inner_2_m() {
|
||||
return mat2(u.inner[2u].m_0, u.inner[2u].m_1);
|
||||
}
|
||||
|
||||
void f() {
|
||||
s.inner = conv_arr_4_S(u.inner);
|
||||
s.inner[1] = conv_S(u.inner[2u]);
|
||||
s.inner[3].m = load_u_inner_2_m();
|
||||
s.inner[1].m[0] = u.inner[0u].m_1.yx;
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
f();
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
template<typename T, size_t N>
|
||||
struct tint_array {
|
||||
const constant T& operator[](size_t i) const constant { return elements[i]; }
|
||||
device T& operator[](size_t i) device { return elements[i]; }
|
||||
const device T& operator[](size_t i) const device { return elements[i]; }
|
||||
thread T& operator[](size_t i) thread { return elements[i]; }
|
||||
const thread T& operator[](size_t i) const thread { return elements[i]; }
|
||||
threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
|
||||
const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
|
||||
T elements[N];
|
||||
};
|
||||
|
||||
struct S {
|
||||
/* 0x0000 */ int before;
|
||||
/* 0x0004 */ tint_array<int8_t, 4> tint_pad;
|
||||
/* 0x0008 */ float2x2 m;
|
||||
/* 0x0018 */ int after;
|
||||
/* 0x001c */ tint_array<int8_t, 4> tint_pad_1;
|
||||
};
|
||||
|
||||
kernel void f(device tint_array<S, 4>* tint_symbol [[buffer(1)]], const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) {
|
||||
*(tint_symbol) = *(tint_symbol_1);
|
||||
(*(tint_symbol))[1] = (*(tint_symbol_1))[2];
|
||||
(*(tint_symbol))[3].m = (*(tint_symbol_1))[2].m;
|
||||
(*(tint_symbol))[1].m[0] = float2((*(tint_symbol_1))[0].m[1]).yx;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,176 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 104
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %f "f"
|
||||
OpExecutionMode %f LocalSize 1 1 1
|
||||
OpName %u_block_std140 "u_block_std140"
|
||||
OpMemberName %u_block_std140 0 "inner"
|
||||
OpName %S_std140 "S_std140"
|
||||
OpMemberName %S_std140 0 "before"
|
||||
OpMemberName %S_std140 1 "m_0"
|
||||
OpMemberName %S_std140 2 "m_1"
|
||||
OpMemberName %S_std140 3 "after"
|
||||
OpName %u "u"
|
||||
OpName %u_block "u_block"
|
||||
OpMemberName %u_block 0 "inner"
|
||||
OpName %S "S"
|
||||
OpMemberName %S 0 "before"
|
||||
OpMemberName %S 1 "m"
|
||||
OpMemberName %S 2 "after"
|
||||
OpName %s "s"
|
||||
OpName %conv_S "conv_S"
|
||||
OpName %val "val"
|
||||
OpName %conv_arr_4_S "conv_arr_4_S"
|
||||
OpName %val_0 "val"
|
||||
OpName %arr "arr"
|
||||
OpName %i "i"
|
||||
OpName %var_for_index "var_for_index"
|
||||
OpName %load_u_inner_2_m "load_u_inner_2_m"
|
||||
OpName %f "f"
|
||||
OpDecorate %u_block_std140 Block
|
||||
OpMemberDecorate %u_block_std140 0 Offset 0
|
||||
OpMemberDecorate %S_std140 0 Offset 0
|
||||
OpMemberDecorate %S_std140 1 Offset 8
|
||||
OpMemberDecorate %S_std140 2 Offset 16
|
||||
OpMemberDecorate %S_std140 3 Offset 24
|
||||
OpDecorate %_arr_S_std140_uint_4 ArrayStride 32
|
||||
OpDecorate %u NonWritable
|
||||
OpDecorate %u DescriptorSet 0
|
||||
OpDecorate %u Binding 0
|
||||
OpDecorate %u_block Block
|
||||
OpMemberDecorate %u_block 0 Offset 0
|
||||
OpMemberDecorate %S 0 Offset 0
|
||||
OpMemberDecorate %S 1 Offset 8
|
||||
OpMemberDecorate %S 1 ColMajor
|
||||
OpMemberDecorate %S 1 MatrixStride 8
|
||||
OpMemberDecorate %S 2 Offset 24
|
||||
OpDecorate %_arr_S_uint_4 ArrayStride 32
|
||||
OpDecorate %s DescriptorSet 0
|
||||
OpDecorate %s Binding 1
|
||||
%int = OpTypeInt 32 1
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%S_std140 = OpTypeStruct %int %v2float %v2float %int
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%_arr_S_std140_uint_4 = OpTypeArray %S_std140 %uint_4
|
||||
%u_block_std140 = OpTypeStruct %_arr_S_std140_uint_4
|
||||
%_ptr_Uniform_u_block_std140 = OpTypePointer Uniform %u_block_std140
|
||||
%u = OpVariable %_ptr_Uniform_u_block_std140 Uniform
|
||||
%mat2v2float = OpTypeMatrix %v2float 2
|
||||
%S = OpTypeStruct %int %mat2v2float %int
|
||||
%_arr_S_uint_4 = OpTypeArray %S %uint_4
|
||||
%u_block = OpTypeStruct %_arr_S_uint_4
|
||||
%_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block
|
||||
%s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer
|
||||
%17 = OpTypeFunction %S %S_std140
|
||||
%27 = OpTypeFunction %_arr_S_uint_4 %_arr_S_std140_uint_4
|
||||
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
|
||||
%33 = OpConstantNull %_arr_S_uint_4
|
||||
%_ptr_Function_uint = OpTypePointer Function %uint
|
||||
%36 = OpConstantNull %uint
|
||||
%bool = OpTypeBool
|
||||
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
|
||||
%49 = OpConstantNull %_arr_S_std140_uint_4
|
||||
%_ptr_Function_S = OpTypePointer Function %S
|
||||
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%62 = OpTypeFunction %mat2v2float
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140
|
||||
%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
|
||||
%void = OpTypeVoid
|
||||
%78 = OpTypeFunction %void
|
||||
%_ptr_StorageBuffer__arr_S_uint_4 = OpTypePointer StorageBuffer %_arr_S_uint_4
|
||||
%_ptr_Uniform__arr_S_std140_uint_4 = OpTypePointer Uniform %_arr_S_std140_uint_4
|
||||
%int_1 = OpConstant %int 1
|
||||
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
|
||||
%int_3 = OpConstant %int 3
|
||||
%_ptr_StorageBuffer_mat2v2float = OpTypePointer StorageBuffer %mat2v2float
|
||||
%98 = OpConstantNull %int
|
||||
%_ptr_StorageBuffer_v2float = OpTypePointer StorageBuffer %v2float
|
||||
%conv_S = OpFunction %S None %17
|
||||
%val = OpFunctionParameter %S_std140
|
||||
%20 = OpLabel
|
||||
%21 = OpCompositeExtract %int %val 0
|
||||
%22 = OpCompositeExtract %v2float %val 1
|
||||
%23 = OpCompositeExtract %v2float %val 2
|
||||
%24 = OpCompositeConstruct %mat2v2float %22 %23
|
||||
%25 = OpCompositeExtract %int %val 3
|
||||
%26 = OpCompositeConstruct %S %21 %24 %25
|
||||
OpReturnValue %26
|
||||
OpFunctionEnd
|
||||
%conv_arr_4_S = OpFunction %_arr_S_uint_4 None %27
|
||||
%val_0 = OpFunctionParameter %_arr_S_std140_uint_4
|
||||
%30 = OpLabel
|
||||
%arr = OpVariable %_ptr_Function__arr_S_uint_4 Function %33
|
||||
%i = OpVariable %_ptr_Function_uint Function %36
|
||||
%var_for_index = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function %49
|
||||
OpBranch %37
|
||||
%37 = OpLabel
|
||||
OpLoopMerge %38 %39 None
|
||||
OpBranch %40
|
||||
%40 = OpLabel
|
||||
%42 = OpLoad %uint %i
|
||||
%43 = OpULessThan %bool %42 %uint_4
|
||||
%41 = OpLogicalNot %bool %43
|
||||
OpSelectionMerge %45 None
|
||||
OpBranchConditional %41 %46 %45
|
||||
%46 = OpLabel
|
||||
OpBranch %38
|
||||
%45 = OpLabel
|
||||
OpStore %var_for_index %val_0
|
||||
%50 = OpLoad %uint %i
|
||||
%52 = OpAccessChain %_ptr_Function_S %arr %50
|
||||
%54 = OpLoad %uint %i
|
||||
%56 = OpAccessChain %_ptr_Function_S_std140 %var_for_index %54
|
||||
%57 = OpLoad %S_std140 %56
|
||||
%53 = OpFunctionCall %S %conv_S %57
|
||||
OpStore %52 %53
|
||||
OpBranch %39
|
||||
%39 = OpLabel
|
||||
%58 = OpLoad %uint %i
|
||||
%60 = OpIAdd %uint %58 %uint_1
|
||||
OpStore %i %60
|
||||
OpBranch %37
|
||||
%38 = OpLabel
|
||||
%61 = OpLoad %_arr_S_uint_4 %arr
|
||||
OpReturnValue %61
|
||||
OpFunctionEnd
|
||||
%load_u_inner_2_m = OpFunction %mat2v2float None %62
|
||||
%64 = OpLabel
|
||||
%69 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
|
||||
%72 = OpAccessChain %_ptr_Uniform_v2float %69 %uint_1
|
||||
%73 = OpLoad %v2float %72
|
||||
%75 = OpAccessChain %_ptr_Uniform_v2float %69 %uint_2
|
||||
%76 = OpLoad %v2float %75
|
||||
%77 = OpCompositeConstruct %mat2v2float %73 %76
|
||||
OpReturnValue %77
|
||||
OpFunctionEnd
|
||||
%f = OpFunction %void None %78
|
||||
%81 = OpLabel
|
||||
%83 = OpAccessChain %_ptr_StorageBuffer__arr_S_uint_4 %s %uint_0
|
||||
%86 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %u %uint_0
|
||||
%87 = OpLoad %_arr_S_std140_uint_4 %86
|
||||
%84 = OpFunctionCall %_arr_S_uint_4 %conv_arr_4_S %87
|
||||
OpStore %83 %84
|
||||
%90 = OpAccessChain %_ptr_StorageBuffer_S %s %uint_0 %int_1
|
||||
%92 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
|
||||
%93 = OpLoad %S_std140 %92
|
||||
%91 = OpFunctionCall %S %conv_S %93
|
||||
OpStore %90 %91
|
||||
%96 = OpAccessChain %_ptr_StorageBuffer_mat2v2float %s %uint_0 %int_3 %uint_1
|
||||
%97 = OpFunctionCall %mat2v2float %load_u_inner_2_m
|
||||
OpStore %96 %97
|
||||
%100 = OpAccessChain %_ptr_StorageBuffer_v2float %s %uint_0 %int_1 %uint_1 %98
|
||||
%101 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0 %36 %uint_2
|
||||
%102 = OpLoad %v2float %101
|
||||
%103 = OpVectorShuffle %v2float %102 %102 1 0
|
||||
OpStore %100 %103
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,17 @@
|
||||
struct S {
|
||||
before : i32,
|
||||
m : mat2x2<f32>,
|
||||
after : i32,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<uniform> u : array<S, 4>;
|
||||
|
||||
@group(0) @binding(1) var<storage, read_write> s : array<S, 4>;
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn f() {
|
||||
s = u;
|
||||
s[1] = u[2];
|
||||
s[3].m = u[2].m;
|
||||
s[1].m[0] = u[0].m[1].yx;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
struct S {
|
||||
before : i32,
|
||||
m : mat2x2<f32>,
|
||||
after : i32,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<uniform> u : array<S, 4>;
|
||||
var<workgroup> w : array<S, 4>;
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn f() {
|
||||
w = u;
|
||||
w[1] = u[2];
|
||||
w[3].m = u[2].m;
|
||||
w[1].m[0] = u[0].m[1].yx;
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
struct S {
|
||||
int before;
|
||||
float2x2 m;
|
||||
int after;
|
||||
};
|
||||
|
||||
cbuffer cbuffer_u : register(b0, space0) {
|
||||
uint4 u[8];
|
||||
};
|
||||
groupshared S w[4];
|
||||
|
||||
struct tint_symbol_1 {
|
||||
uint local_invocation_index : SV_GroupIndex;
|
||||
};
|
||||
|
||||
float2x2 tint_symbol_5(uint4 buffer[8], uint offset) {
|
||||
const uint scalar_offset = ((offset + 0u)) / 4;
|
||||
uint4 ubo_load = buffer[scalar_offset / 4];
|
||||
const uint scalar_offset_1 = ((offset + 8u)) / 4;
|
||||
uint4 ubo_load_1 = buffer[scalar_offset_1 / 4];
|
||||
return float2x2(asfloat(((scalar_offset & 2) ? ubo_load.zw : ubo_load.xy)), asfloat(((scalar_offset_1 & 2) ? ubo_load_1.zw : ubo_load_1.xy)));
|
||||
}
|
||||
|
||||
S tint_symbol_3(uint4 buffer[8], uint offset) {
|
||||
const uint scalar_offset_2 = ((offset + 0u)) / 4;
|
||||
const uint scalar_offset_3 = ((offset + 24u)) / 4;
|
||||
const S tint_symbol_8 = {asint(buffer[scalar_offset_2 / 4][scalar_offset_2 % 4]), tint_symbol_5(buffer, (offset + 8u)), asint(buffer[scalar_offset_3 / 4][scalar_offset_3 % 4])};
|
||||
return tint_symbol_8;
|
||||
}
|
||||
|
||||
typedef S tint_symbol_2_ret[4];
|
||||
tint_symbol_2_ret tint_symbol_2(uint4 buffer[8], uint offset) {
|
||||
S arr[4] = (S[4])0;
|
||||
{
|
||||
[loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
|
||||
arr[i_1] = tint_symbol_3(buffer, (offset + (i_1 * 32u)));
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
void f_inner(uint local_invocation_index) {
|
||||
{
|
||||
[loop] for(uint idx = local_invocation_index; (idx < 4u); idx = (idx + 1u)) {
|
||||
const uint i = idx;
|
||||
const S tint_symbol_7 = (S)0;
|
||||
w[i] = tint_symbol_7;
|
||||
}
|
||||
}
|
||||
GroupMemoryBarrierWithGroupSync();
|
||||
w = tint_symbol_2(u, 0u);
|
||||
w[1] = tint_symbol_3(u, 64u);
|
||||
w[3].m = tint_symbol_5(u, 72u);
|
||||
w[1].m[0] = asfloat(u[1].xy).yx;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void f(tint_symbol_1 tint_symbol) {
|
||||
f_inner(tint_symbol.local_invocation_index);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
struct S {
|
||||
int before;
|
||||
float2x2 m;
|
||||
int after;
|
||||
};
|
||||
|
||||
cbuffer cbuffer_u : register(b0, space0) {
|
||||
uint4 u[8];
|
||||
};
|
||||
groupshared S w[4];
|
||||
|
||||
struct tint_symbol_1 {
|
||||
uint local_invocation_index : SV_GroupIndex;
|
||||
};
|
||||
|
||||
float2x2 tint_symbol_5(uint4 buffer[8], uint offset) {
|
||||
const uint scalar_offset = ((offset + 0u)) / 4;
|
||||
uint4 ubo_load = buffer[scalar_offset / 4];
|
||||
const uint scalar_offset_1 = ((offset + 8u)) / 4;
|
||||
uint4 ubo_load_1 = buffer[scalar_offset_1 / 4];
|
||||
return float2x2(asfloat(((scalar_offset & 2) ? ubo_load.zw : ubo_load.xy)), asfloat(((scalar_offset_1 & 2) ? ubo_load_1.zw : ubo_load_1.xy)));
|
||||
}
|
||||
|
||||
S tint_symbol_3(uint4 buffer[8], uint offset) {
|
||||
const uint scalar_offset_2 = ((offset + 0u)) / 4;
|
||||
const uint scalar_offset_3 = ((offset + 24u)) / 4;
|
||||
const S tint_symbol_8 = {asint(buffer[scalar_offset_2 / 4][scalar_offset_2 % 4]), tint_symbol_5(buffer, (offset + 8u)), asint(buffer[scalar_offset_3 / 4][scalar_offset_3 % 4])};
|
||||
return tint_symbol_8;
|
||||
}
|
||||
|
||||
typedef S tint_symbol_2_ret[4];
|
||||
tint_symbol_2_ret tint_symbol_2(uint4 buffer[8], uint offset) {
|
||||
S arr[4] = (S[4])0;
|
||||
{
|
||||
[loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
|
||||
arr[i_1] = tint_symbol_3(buffer, (offset + (i_1 * 32u)));
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
void f_inner(uint local_invocation_index) {
|
||||
{
|
||||
[loop] for(uint idx = local_invocation_index; (idx < 4u); idx = (idx + 1u)) {
|
||||
const uint i = idx;
|
||||
const S tint_symbol_7 = (S)0;
|
||||
w[i] = tint_symbol_7;
|
||||
}
|
||||
}
|
||||
GroupMemoryBarrierWithGroupSync();
|
||||
w = tint_symbol_2(u, 0u);
|
||||
w[1] = tint_symbol_3(u, 64u);
|
||||
w[3].m = tint_symbol_5(u, 72u);
|
||||
w[1].m[0] = asfloat(u[1].xy).yx;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void f(tint_symbol_1 tint_symbol) {
|
||||
f_inner(tint_symbol.local_invocation_index);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
#version 310 es
|
||||
|
||||
struct S {
|
||||
int before;
|
||||
uint pad;
|
||||
mat2 m;
|
||||
int after;
|
||||
uint pad_1;
|
||||
};
|
||||
|
||||
struct S_std140 {
|
||||
int before;
|
||||
uint pad;
|
||||
vec2 m_0;
|
||||
vec2 m_1;
|
||||
int after;
|
||||
uint pad_1;
|
||||
};
|
||||
|
||||
layout(binding = 0, std140) uniform u_block_std140_ubo {
|
||||
S_std140 inner[4];
|
||||
} u;
|
||||
|
||||
shared S w[4];
|
||||
S conv_S(S_std140 val) {
|
||||
return S(val.before, val.pad, mat2(val.m_0, val.m_1), val.after, val.pad_1);
|
||||
}
|
||||
|
||||
S[4] conv_arr_4_S(S_std140 val[4]) {
|
||||
S arr[4] = S[4](S(0, 0u, mat2(0.0f, 0.0f, 0.0f, 0.0f), 0, 0u), S(0, 0u, mat2(0.0f, 0.0f, 0.0f, 0.0f), 0, 0u), S(0, 0u, mat2(0.0f, 0.0f, 0.0f, 0.0f), 0, 0u), S(0, 0u, mat2(0.0f, 0.0f, 0.0f, 0.0f), 0, 0u));
|
||||
{
|
||||
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
|
||||
arr[i] = conv_S(val[i]);
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
mat2 load_u_inner_2_m() {
|
||||
return mat2(u.inner[2u].m_0, u.inner[2u].m_1);
|
||||
}
|
||||
|
||||
void f(uint local_invocation_index) {
|
||||
{
|
||||
for(uint idx = local_invocation_index; (idx < 4u); idx = (idx + 1u)) {
|
||||
uint i = idx;
|
||||
S tint_symbol = S(0, 0u, mat2(vec2(0.0f), vec2(0.0f)), 0, 0u);
|
||||
w[i] = tint_symbol;
|
||||
}
|
||||
}
|
||||
barrier();
|
||||
w = conv_arr_4_S(u.inner);
|
||||
w[1] = conv_S(u.inner[2u]);
|
||||
w[3].m = load_u_inner_2_m();
|
||||
w[1].m[0] = u.inner[0u].m_1.yx;
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
f(gl_LocalInvocationIndex);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
template<typename T, size_t N>
|
||||
struct tint_array {
|
||||
const constant T& operator[](size_t i) const constant { return elements[i]; }
|
||||
device T& operator[](size_t i) device { return elements[i]; }
|
||||
const device T& operator[](size_t i) const device { return elements[i]; }
|
||||
thread T& operator[](size_t i) thread { return elements[i]; }
|
||||
const thread T& operator[](size_t i) const thread { return elements[i]; }
|
||||
threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
|
||||
const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
|
||||
T elements[N];
|
||||
};
|
||||
|
||||
struct S {
|
||||
/* 0x0000 */ int before;
|
||||
/* 0x0004 */ tint_array<int8_t, 4> tint_pad;
|
||||
/* 0x0008 */ float2x2 m;
|
||||
/* 0x0018 */ int after;
|
||||
/* 0x001c */ tint_array<int8_t, 4> tint_pad_1;
|
||||
};
|
||||
|
||||
struct tint_symbol_6 {
|
||||
tint_array<S, 4> w;
|
||||
};
|
||||
|
||||
void f_inner(uint local_invocation_index, threadgroup tint_array<S, 4>* const tint_symbol_1, const constant tint_array<S, 4>* const tint_symbol_2) {
|
||||
for(uint idx = local_invocation_index; (idx < 4u); idx = (idx + 1u)) {
|
||||
uint const i = idx;
|
||||
S const tint_symbol = S{};
|
||||
(*(tint_symbol_1))[i] = tint_symbol;
|
||||
}
|
||||
threadgroup_barrier(mem_flags::mem_threadgroup);
|
||||
*(tint_symbol_1) = *(tint_symbol_2);
|
||||
(*(tint_symbol_1))[1] = (*(tint_symbol_2))[2];
|
||||
(*(tint_symbol_1))[3].m = (*(tint_symbol_2))[2].m;
|
||||
(*(tint_symbol_1))[1].m[0] = float2((*(tint_symbol_2))[0].m[1]).yx;
|
||||
}
|
||||
|
||||
kernel void f(const constant tint_array<S, 4>* tint_symbol_5 [[buffer(0)]], threadgroup tint_symbol_6* tint_symbol_4 [[threadgroup(0)]], uint local_invocation_index [[thread_index_in_threadgroup]]) {
|
||||
threadgroup tint_array<S, 4>* const tint_symbol_3 = &((*(tint_symbol_4)).w);
|
||||
f_inner(local_invocation_index, tint_symbol_3, tint_symbol_5);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,210 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 126
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %f "f" %local_invocation_index_1
|
||||
OpExecutionMode %f LocalSize 1 1 1
|
||||
OpName %local_invocation_index_1 "local_invocation_index_1"
|
||||
OpName %u_block_std140 "u_block_std140"
|
||||
OpMemberName %u_block_std140 0 "inner"
|
||||
OpName %S_std140 "S_std140"
|
||||
OpMemberName %S_std140 0 "before"
|
||||
OpMemberName %S_std140 1 "m_0"
|
||||
OpMemberName %S_std140 2 "m_1"
|
||||
OpMemberName %S_std140 3 "after"
|
||||
OpName %u "u"
|
||||
OpName %S "S"
|
||||
OpMemberName %S 0 "before"
|
||||
OpMemberName %S 1 "m"
|
||||
OpMemberName %S 2 "after"
|
||||
OpName %w "w"
|
||||
OpName %conv_S "conv_S"
|
||||
OpName %val "val"
|
||||
OpName %conv_arr_4_S "conv_arr_4_S"
|
||||
OpName %val_0 "val"
|
||||
OpName %arr "arr"
|
||||
OpName %i "i"
|
||||
OpName %var_for_index "var_for_index"
|
||||
OpName %load_u_inner_2_m "load_u_inner_2_m"
|
||||
OpName %f_inner "f_inner"
|
||||
OpName %local_invocation_index "local_invocation_index"
|
||||
OpName %idx "idx"
|
||||
OpName %f "f"
|
||||
OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex
|
||||
OpDecorate %u_block_std140 Block
|
||||
OpMemberDecorate %u_block_std140 0 Offset 0
|
||||
OpMemberDecorate %S_std140 0 Offset 0
|
||||
OpMemberDecorate %S_std140 1 Offset 8
|
||||
OpMemberDecorate %S_std140 2 Offset 16
|
||||
OpMemberDecorate %S_std140 3 Offset 24
|
||||
OpDecorate %_arr_S_std140_uint_4 ArrayStride 32
|
||||
OpDecorate %u NonWritable
|
||||
OpDecorate %u DescriptorSet 0
|
||||
OpDecorate %u Binding 0
|
||||
OpMemberDecorate %S 0 Offset 0
|
||||
OpMemberDecorate %S 1 Offset 8
|
||||
OpMemberDecorate %S 1 ColMajor
|
||||
OpMemberDecorate %S 1 MatrixStride 8
|
||||
OpMemberDecorate %S 2 Offset 24
|
||||
OpDecorate %_arr_S_uint_4 ArrayStride 32
|
||||
%uint = OpTypeInt 32 0
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input
|
||||
%int = OpTypeInt 32 1
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%S_std140 = OpTypeStruct %int %v2float %v2float %int
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%_arr_S_std140_uint_4 = OpTypeArray %S_std140 %uint_4
|
||||
%u_block_std140 = OpTypeStruct %_arr_S_std140_uint_4
|
||||
%_ptr_Uniform_u_block_std140 = OpTypePointer Uniform %u_block_std140
|
||||
%u = OpVariable %_ptr_Uniform_u_block_std140 Uniform
|
||||
%mat2v2float = OpTypeMatrix %v2float 2
|
||||
%S = OpTypeStruct %int %mat2v2float %int
|
||||
%_arr_S_uint_4 = OpTypeArray %S %uint_4
|
||||
%_ptr_Workgroup__arr_S_uint_4 = OpTypePointer Workgroup %_arr_S_uint_4
|
||||
%w = OpVariable %_ptr_Workgroup__arr_S_uint_4 Workgroup
|
||||
%18 = OpTypeFunction %S %S_std140
|
||||
%28 = OpTypeFunction %_arr_S_uint_4 %_arr_S_std140_uint_4
|
||||
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
|
||||
%34 = OpConstantNull %_arr_S_uint_4
|
||||
%_ptr_Function_uint = OpTypePointer Function %uint
|
||||
%37 = OpConstantNull %uint
|
||||
%bool = OpTypeBool
|
||||
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
|
||||
%50 = OpConstantNull %_arr_S_std140_uint_4
|
||||
%_ptr_Function_S = OpTypePointer Function %S
|
||||
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%63 = OpTypeFunction %mat2v2float
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140
|
||||
%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
|
||||
%void = OpTypeVoid
|
||||
%79 = OpTypeFunction %void %uint
|
||||
%_ptr_Workgroup_S = OpTypePointer Workgroup %S
|
||||
%97 = OpConstantNull %S
|
||||
%uint_264 = OpConstant %uint 264
|
||||
%_ptr_Uniform__arr_S_std140_uint_4 = OpTypePointer Uniform %_arr_S_std140_uint_4
|
||||
%int_1 = OpConstant %int 1
|
||||
%int_3 = OpConstant %int 3
|
||||
%_ptr_Workgroup_mat2v2float = OpTypePointer Workgroup %mat2v2float
|
||||
%115 = OpConstantNull %int
|
||||
%_ptr_Workgroup_v2float = OpTypePointer Workgroup %v2float
|
||||
%121 = OpTypeFunction %void
|
||||
%conv_S = OpFunction %S None %18
|
||||
%val = OpFunctionParameter %S_std140
|
||||
%21 = OpLabel
|
||||
%22 = OpCompositeExtract %int %val 0
|
||||
%23 = OpCompositeExtract %v2float %val 1
|
||||
%24 = OpCompositeExtract %v2float %val 2
|
||||
%25 = OpCompositeConstruct %mat2v2float %23 %24
|
||||
%26 = OpCompositeExtract %int %val 3
|
||||
%27 = OpCompositeConstruct %S %22 %25 %26
|
||||
OpReturnValue %27
|
||||
OpFunctionEnd
|
||||
%conv_arr_4_S = OpFunction %_arr_S_uint_4 None %28
|
||||
%val_0 = OpFunctionParameter %_arr_S_std140_uint_4
|
||||
%31 = OpLabel
|
||||
%arr = OpVariable %_ptr_Function__arr_S_uint_4 Function %34
|
||||
%i = OpVariable %_ptr_Function_uint Function %37
|
||||
%var_for_index = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function %50
|
||||
OpBranch %38
|
||||
%38 = OpLabel
|
||||
OpLoopMerge %39 %40 None
|
||||
OpBranch %41
|
||||
%41 = OpLabel
|
||||
%43 = OpLoad %uint %i
|
||||
%44 = OpULessThan %bool %43 %uint_4
|
||||
%42 = OpLogicalNot %bool %44
|
||||
OpSelectionMerge %46 None
|
||||
OpBranchConditional %42 %47 %46
|
||||
%47 = OpLabel
|
||||
OpBranch %39
|
||||
%46 = OpLabel
|
||||
OpStore %var_for_index %val_0
|
||||
%51 = OpLoad %uint %i
|
||||
%53 = OpAccessChain %_ptr_Function_S %arr %51
|
||||
%55 = OpLoad %uint %i
|
||||
%57 = OpAccessChain %_ptr_Function_S_std140 %var_for_index %55
|
||||
%58 = OpLoad %S_std140 %57
|
||||
%54 = OpFunctionCall %S %conv_S %58
|
||||
OpStore %53 %54
|
||||
OpBranch %40
|
||||
%40 = OpLabel
|
||||
%59 = OpLoad %uint %i
|
||||
%61 = OpIAdd %uint %59 %uint_1
|
||||
OpStore %i %61
|
||||
OpBranch %38
|
||||
%39 = OpLabel
|
||||
%62 = OpLoad %_arr_S_uint_4 %arr
|
||||
OpReturnValue %62
|
||||
OpFunctionEnd
|
||||
%load_u_inner_2_m = OpFunction %mat2v2float None %63
|
||||
%65 = OpLabel
|
||||
%70 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
|
||||
%73 = OpAccessChain %_ptr_Uniform_v2float %70 %uint_1
|
||||
%74 = OpLoad %v2float %73
|
||||
%76 = OpAccessChain %_ptr_Uniform_v2float %70 %uint_2
|
||||
%77 = OpLoad %v2float %76
|
||||
%78 = OpCompositeConstruct %mat2v2float %74 %77
|
||||
OpReturnValue %78
|
||||
OpFunctionEnd
|
||||
%f_inner = OpFunction %void None %79
|
||||
%local_invocation_index = OpFunctionParameter %uint
|
||||
%83 = OpLabel
|
||||
%idx = OpVariable %_ptr_Function_uint Function %37
|
||||
OpStore %idx %local_invocation_index
|
||||
OpBranch %85
|
||||
%85 = OpLabel
|
||||
OpLoopMerge %86 %87 None
|
||||
OpBranch %88
|
||||
%88 = OpLabel
|
||||
%90 = OpLoad %uint %idx
|
||||
%91 = OpULessThan %bool %90 %uint_4
|
||||
%89 = OpLogicalNot %bool %91
|
||||
OpSelectionMerge %92 None
|
||||
OpBranchConditional %89 %93 %92
|
||||
%93 = OpLabel
|
||||
OpBranch %86
|
||||
%92 = OpLabel
|
||||
%94 = OpLoad %uint %idx
|
||||
%96 = OpAccessChain %_ptr_Workgroup_S %w %94
|
||||
OpStore %96 %97
|
||||
OpBranch %87
|
||||
%87 = OpLabel
|
||||
%98 = OpLoad %uint %idx
|
||||
%99 = OpIAdd %uint %98 %uint_1
|
||||
OpStore %idx %99
|
||||
OpBranch %85
|
||||
%86 = OpLabel
|
||||
OpControlBarrier %uint_2 %uint_2 %uint_264
|
||||
%104 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %u %uint_0
|
||||
%105 = OpLoad %_arr_S_std140_uint_4 %104
|
||||
%102 = OpFunctionCall %_arr_S_uint_4 %conv_arr_4_S %105
|
||||
OpStore %w %102
|
||||
%107 = OpAccessChain %_ptr_Workgroup_S %w %int_1
|
||||
%109 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
|
||||
%110 = OpLoad %S_std140 %109
|
||||
%108 = OpFunctionCall %S %conv_S %110
|
||||
OpStore %107 %108
|
||||
%113 = OpAccessChain %_ptr_Workgroup_mat2v2float %w %int_3 %uint_1
|
||||
%114 = OpFunctionCall %mat2v2float %load_u_inner_2_m
|
||||
OpStore %113 %114
|
||||
%117 = OpAccessChain %_ptr_Workgroup_v2float %w %int_1 %uint_1 %115
|
||||
%118 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0 %37 %uint_2
|
||||
%119 = OpLoad %v2float %118
|
||||
%120 = OpVectorShuffle %v2float %119 %119 1 0
|
||||
OpStore %117 %120
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%f = OpFunction %void None %121
|
||||
%123 = OpLabel
|
||||
%125 = OpLoad %uint %local_invocation_index_1
|
||||
%124 = OpFunctionCall %void %f_inner %125
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,17 @@
|
||||
struct S {
|
||||
before : i32,
|
||||
m : mat2x2<f32>,
|
||||
after : i32,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<uniform> u : array<S, 4>;
|
||||
|
||||
var<workgroup> w : array<S, 4>;
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn f() {
|
||||
w = u;
|
||||
w[1] = u[2];
|
||||
w[3].m = u[2].m;
|
||||
w[1].m[0] = u[0].m[1].yx;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
struct Inner {
|
||||
@size(64) m : mat3x2<f32>,
|
||||
}
|
||||
|
||||
struct Outer {
|
||||
a : array<Inner, 4>,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<uniform> a : array<Outer, 4>;
|
||||
|
||||
var<private> counter = 0;
|
||||
fn i() -> i32 { counter++; return counter; }
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn f() {
|
||||
let p_a = &a;
|
||||
let p_a_i = &((*p_a)[i()]);
|
||||
let p_a_i_a = &((*p_a_i).a);
|
||||
let p_a_i_a_i = &((*p_a_i_a)[i()]);
|
||||
let p_a_i_a_i_m = &((*p_a_i_a_i).m);
|
||||
let p_a_i_a_i_m_i = &((*p_a_i_a_i_m)[i()]);
|
||||
|
||||
|
||||
let l_a : array<Outer, 4> = *p_a;
|
||||
let l_a_i : Outer = *p_a_i;
|
||||
let l_a_i_a : array<Inner, 4> = *p_a_i_a;
|
||||
let l_a_i_a_i : Inner = *p_a_i_a_i;
|
||||
let l_a_i_a_i_m : mat3x2<f32> = *p_a_i_a_i_m;
|
||||
let l_a_i_a_i_m_i : vec2<f32> = *p_a_i_a_i_m_i;
|
||||
let l_a_i_a_i_m_i_i : f32 = (*p_a_i_a_i_m_i)[i()];
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
struct Inner {
|
||||
float3x2 m;
|
||||
};
|
||||
struct Outer {
|
||||
Inner a[4];
|
||||
};
|
||||
|
||||
cbuffer cbuffer_a : register(b0, space0) {
|
||||
uint4 a[64];
|
||||
};
|
||||
static int counter = 0;
|
||||
|
||||
int i() {
|
||||
counter = (counter + 1);
|
||||
return counter;
|
||||
}
|
||||
|
||||
float3x2 tint_symbol_8(uint4 buffer[64], uint offset) {
|
||||
const uint scalar_offset = ((offset + 0u)) / 4;
|
||||
uint4 ubo_load = buffer[scalar_offset / 4];
|
||||
const uint scalar_offset_1 = ((offset + 8u)) / 4;
|
||||
uint4 ubo_load_1 = buffer[scalar_offset_1 / 4];
|
||||
const uint scalar_offset_2 = ((offset + 16u)) / 4;
|
||||
uint4 ubo_load_2 = buffer[scalar_offset_2 / 4];
|
||||
return float3x2(asfloat(((scalar_offset & 2) ? ubo_load.zw : ubo_load.xy)), asfloat(((scalar_offset_1 & 2) ? ubo_load_1.zw : ubo_load_1.xy)), asfloat(((scalar_offset_2 & 2) ? ubo_load_2.zw : ubo_load_2.xy)));
|
||||
}
|
||||
|
||||
Inner tint_symbol_7(uint4 buffer[64], uint offset) {
|
||||
const Inner tint_symbol_11 = {tint_symbol_8(buffer, (offset + 0u))};
|
||||
return tint_symbol_11;
|
||||
}
|
||||
|
||||
typedef Inner tint_symbol_6_ret[4];
|
||||
tint_symbol_6_ret tint_symbol_6(uint4 buffer[64], uint offset) {
|
||||
Inner arr[4] = (Inner[4])0;
|
||||
{
|
||||
[loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
|
||||
arr[i_1] = tint_symbol_7(buffer, (offset + (i_1 * 64u)));
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
Outer tint_symbol_5(uint4 buffer[64], uint offset) {
|
||||
const Outer tint_symbol_12 = {tint_symbol_6(buffer, (offset + 0u))};
|
||||
return tint_symbol_12;
|
||||
}
|
||||
|
||||
typedef Outer tint_symbol_4_ret[4];
|
||||
tint_symbol_4_ret tint_symbol_4(uint4 buffer[64], uint offset) {
|
||||
Outer arr_1[4] = (Outer[4])0;
|
||||
{
|
||||
[loop] for(uint i_2 = 0u; (i_2 < 4u); i_2 = (i_2 + 1u)) {
|
||||
arr_1[i_2] = tint_symbol_5(buffer, (offset + (i_2 * 256u)));
|
||||
}
|
||||
}
|
||||
return arr_1;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void f() {
|
||||
const int p_a_i_save = i();
|
||||
const int p_a_i_a_i_save = i();
|
||||
const int p_a_i_a_i_m_i_save = i();
|
||||
const Outer l_a[4] = tint_symbol_4(a, 0u);
|
||||
const Outer l_a_i = tint_symbol_5(a, (256u * uint(p_a_i_save)));
|
||||
const Inner l_a_i_a[4] = tint_symbol_6(a, (256u * uint(p_a_i_save)));
|
||||
const Inner l_a_i_a_i = tint_symbol_7(a, ((256u * uint(p_a_i_save)) + (64u * uint(p_a_i_a_i_save))));
|
||||
const float3x2 l_a_i_a_i_m = tint_symbol_8(a, ((256u * uint(p_a_i_save)) + (64u * uint(p_a_i_a_i_save))));
|
||||
const uint scalar_offset_3 = ((((256u * uint(p_a_i_save)) + (64u * uint(p_a_i_a_i_save))) + (8u * uint(p_a_i_a_i_m_i_save)))) / 4;
|
||||
uint4 ubo_load_3 = a[scalar_offset_3 / 4];
|
||||
const float2 l_a_i_a_i_m_i = asfloat(((scalar_offset_3 & 2) ? ubo_load_3.zw : ubo_load_3.xy));
|
||||
const int tint_symbol = p_a_i_save;
|
||||
const int tint_symbol_1 = p_a_i_a_i_save;
|
||||
const int tint_symbol_2 = p_a_i_a_i_m_i_save;
|
||||
const int tint_symbol_3 = i();
|
||||
const uint scalar_offset_4 = (((((256u * uint(tint_symbol)) + (64u * uint(tint_symbol_1))) + (8u * uint(tint_symbol_2))) + (4u * uint(tint_symbol_3)))) / 4;
|
||||
const float l_a_i_a_i_m_i_i = asfloat(a[scalar_offset_4 / 4][scalar_offset_4 % 4]);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
struct Inner {
|
||||
float3x2 m;
|
||||
};
|
||||
struct Outer {
|
||||
Inner a[4];
|
||||
};
|
||||
|
||||
cbuffer cbuffer_a : register(b0, space0) {
|
||||
uint4 a[64];
|
||||
};
|
||||
static int counter = 0;
|
||||
|
||||
int i() {
|
||||
counter = (counter + 1);
|
||||
return counter;
|
||||
}
|
||||
|
||||
float3x2 tint_symbol_8(uint4 buffer[64], uint offset) {
|
||||
const uint scalar_offset = ((offset + 0u)) / 4;
|
||||
uint4 ubo_load = buffer[scalar_offset / 4];
|
||||
const uint scalar_offset_1 = ((offset + 8u)) / 4;
|
||||
uint4 ubo_load_1 = buffer[scalar_offset_1 / 4];
|
||||
const uint scalar_offset_2 = ((offset + 16u)) / 4;
|
||||
uint4 ubo_load_2 = buffer[scalar_offset_2 / 4];
|
||||
return float3x2(asfloat(((scalar_offset & 2) ? ubo_load.zw : ubo_load.xy)), asfloat(((scalar_offset_1 & 2) ? ubo_load_1.zw : ubo_load_1.xy)), asfloat(((scalar_offset_2 & 2) ? ubo_load_2.zw : ubo_load_2.xy)));
|
||||
}
|
||||
|
||||
Inner tint_symbol_7(uint4 buffer[64], uint offset) {
|
||||
const Inner tint_symbol_11 = {tint_symbol_8(buffer, (offset + 0u))};
|
||||
return tint_symbol_11;
|
||||
}
|
||||
|
||||
typedef Inner tint_symbol_6_ret[4];
|
||||
tint_symbol_6_ret tint_symbol_6(uint4 buffer[64], uint offset) {
|
||||
Inner arr[4] = (Inner[4])0;
|
||||
{
|
||||
[loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
|
||||
arr[i_1] = tint_symbol_7(buffer, (offset + (i_1 * 64u)));
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
Outer tint_symbol_5(uint4 buffer[64], uint offset) {
|
||||
const Outer tint_symbol_12 = {tint_symbol_6(buffer, (offset + 0u))};
|
||||
return tint_symbol_12;
|
||||
}
|
||||
|
||||
typedef Outer tint_symbol_4_ret[4];
|
||||
tint_symbol_4_ret tint_symbol_4(uint4 buffer[64], uint offset) {
|
||||
Outer arr_1[4] = (Outer[4])0;
|
||||
{
|
||||
[loop] for(uint i_2 = 0u; (i_2 < 4u); i_2 = (i_2 + 1u)) {
|
||||
arr_1[i_2] = tint_symbol_5(buffer, (offset + (i_2 * 256u)));
|
||||
}
|
||||
}
|
||||
return arr_1;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void f() {
|
||||
const int p_a_i_save = i();
|
||||
const int p_a_i_a_i_save = i();
|
||||
const int p_a_i_a_i_m_i_save = i();
|
||||
const Outer l_a[4] = tint_symbol_4(a, 0u);
|
||||
const Outer l_a_i = tint_symbol_5(a, (256u * uint(p_a_i_save)));
|
||||
const Inner l_a_i_a[4] = tint_symbol_6(a, (256u * uint(p_a_i_save)));
|
||||
const Inner l_a_i_a_i = tint_symbol_7(a, ((256u * uint(p_a_i_save)) + (64u * uint(p_a_i_a_i_save))));
|
||||
const float3x2 l_a_i_a_i_m = tint_symbol_8(a, ((256u * uint(p_a_i_save)) + (64u * uint(p_a_i_a_i_save))));
|
||||
const uint scalar_offset_3 = ((((256u * uint(p_a_i_save)) + (64u * uint(p_a_i_a_i_save))) + (8u * uint(p_a_i_a_i_m_i_save)))) / 4;
|
||||
uint4 ubo_load_3 = a[scalar_offset_3 / 4];
|
||||
const float2 l_a_i_a_i_m_i = asfloat(((scalar_offset_3 & 2) ? ubo_load_3.zw : ubo_load_3.xy));
|
||||
const int tint_symbol = p_a_i_save;
|
||||
const int tint_symbol_1 = p_a_i_a_i_save;
|
||||
const int tint_symbol_2 = p_a_i_a_i_m_i_save;
|
||||
const int tint_symbol_3 = i();
|
||||
const uint scalar_offset_4 = (((((256u * uint(tint_symbol)) + (64u * uint(tint_symbol_1))) + (8u * uint(tint_symbol_2))) + (4u * uint(tint_symbol_3)))) / 4;
|
||||
const float l_a_i_a_i_m_i_i = asfloat(a[scalar_offset_4 / 4][scalar_offset_4 % 4]);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,151 @@
|
||||
#version 310 es
|
||||
|
||||
struct Inner {
|
||||
mat3x2 m;
|
||||
uint pad;
|
||||
uint pad_1;
|
||||
uint pad_2;
|
||||
uint pad_3;
|
||||
uint pad_4;
|
||||
uint pad_5;
|
||||
uint pad_6;
|
||||
uint pad_7;
|
||||
uint pad_8;
|
||||
uint pad_9;
|
||||
};
|
||||
|
||||
struct Inner_std140 {
|
||||
vec2 m_0;
|
||||
vec2 m_1;
|
||||
vec2 m_2;
|
||||
uint pad;
|
||||
uint pad_1;
|
||||
uint pad_2;
|
||||
uint pad_3;
|
||||
uint pad_4;
|
||||
uint pad_5;
|
||||
uint pad_6;
|
||||
uint pad_7;
|
||||
uint pad_8;
|
||||
uint pad_9;
|
||||
};
|
||||
|
||||
struct Outer {
|
||||
Inner a[4];
|
||||
};
|
||||
|
||||
struct Outer_std140 {
|
||||
Inner_std140 a[4];
|
||||
};
|
||||
|
||||
layout(binding = 0, std140) uniform a_block_std140_ubo {
|
||||
Outer_std140 inner[4];
|
||||
} a;
|
||||
|
||||
int counter = 0;
|
||||
int i() {
|
||||
counter = (counter + 1);
|
||||
return counter;
|
||||
}
|
||||
|
||||
Inner conv_Inner(Inner_std140 val) {
|
||||
return Inner(mat3x2(val.m_0, val.m_1, val.m_2), val.pad, val.pad_1, val.pad_2, val.pad_3, val.pad_4, val.pad_5, val.pad_6, val.pad_7, val.pad_8, val.pad_9);
|
||||
}
|
||||
|
||||
Inner[4] conv_arr_4_Inner(Inner_std140 val[4]) {
|
||||
Inner arr[4] = Inner[4](Inner(mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u), Inner(mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u), Inner(mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u), Inner(mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u));
|
||||
{
|
||||
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
|
||||
arr[i] = conv_Inner(val[i]);
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
Outer conv_Outer(Outer_std140 val) {
|
||||
return Outer(conv_arr_4_Inner(val.a));
|
||||
}
|
||||
|
||||
Outer[4] conv_arr_4_Outer(Outer_std140 val[4]) {
|
||||
Outer arr[4] = Outer[4](Outer(Inner[4](Inner(mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u), Inner(mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u), Inner(mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u), Inner(mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u))), Outer(Inner[4](Inner(mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u), Inner(mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u), Inner(mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u), Inner(mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u))), Outer(Inner[4](Inner(mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u), Inner(mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u), Inner(mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u), Inner(mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u))), Outer(Inner[4](Inner(mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u), Inner(mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u), Inner(mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u), Inner(mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u))));
|
||||
{
|
||||
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
|
||||
arr[i] = conv_Outer(val[i]);
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
mat3x2 load_a_inner_p0_a_p1_m(uint p0, uint p1) {
|
||||
uint s_save = p0;
|
||||
uint s_save_1 = p1;
|
||||
return mat3x2(a.inner[s_save].a[s_save_1].m_0, a.inner[s_save].a[s_save_1].m_1, a.inner[s_save].a[s_save_1].m_2);
|
||||
}
|
||||
|
||||
vec2 load_a_inner_p0_a_p1_m_p2(uint p0, uint p1, uint p2) {
|
||||
switch(p2) {
|
||||
case 0u: {
|
||||
return a.inner[p0].a[p1].m_0;
|
||||
break;
|
||||
}
|
||||
case 1u: {
|
||||
return a.inner[p0].a[p1].m_1;
|
||||
break;
|
||||
}
|
||||
case 2u: {
|
||||
return a.inner[p0].a[p1].m_2;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
return vec2(0.0f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
float load_a_inner_p0_a_p1_m_p2_p3(uint p0, uint p1, uint p2, uint p3) {
|
||||
switch(p2) {
|
||||
case 0u: {
|
||||
return a.inner[p0].a[p1].m_0[p3];
|
||||
break;
|
||||
}
|
||||
case 1u: {
|
||||
return a.inner[p0].a[p1].m_1[p3];
|
||||
break;
|
||||
}
|
||||
case 2u: {
|
||||
return a.inner[p0].a[p1].m_2[p3];
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
return 0.0f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void f() {
|
||||
Outer p_a[4] = conv_arr_4_Outer(a.inner);
|
||||
int tint_symbol = i();
|
||||
Outer p_a_i = conv_Outer(a.inner[tint_symbol]);
|
||||
Inner p_a_i_a[4] = conv_arr_4_Inner(a.inner[tint_symbol].a);
|
||||
int tint_symbol_1 = i();
|
||||
Inner p_a_i_a_i = conv_Inner(a.inner[tint_symbol].a[tint_symbol_1]);
|
||||
mat3x2 p_a_i_a_i_m = load_a_inner_p0_a_p1_m(uint(tint_symbol), uint(tint_symbol_1));
|
||||
int tint_symbol_2 = i();
|
||||
vec2 p_a_i_a_i_m_i = load_a_inner_p0_a_p1_m_p2(uint(tint_symbol), uint(tint_symbol_1), uint(tint_symbol_2));
|
||||
Outer l_a[4] = conv_arr_4_Outer(a.inner);
|
||||
Outer l_a_i = conv_Outer(a.inner[tint_symbol]);
|
||||
Inner l_a_i_a[4] = conv_arr_4_Inner(a.inner[tint_symbol].a);
|
||||
Inner l_a_i_a_i = conv_Inner(a.inner[tint_symbol].a[tint_symbol_1]);
|
||||
mat3x2 l_a_i_a_i_m = load_a_inner_p0_a_p1_m(uint(tint_symbol), uint(tint_symbol_1));
|
||||
vec2 l_a_i_a_i_m_i = load_a_inner_p0_a_p1_m_p2(uint(tint_symbol), uint(tint_symbol_1), uint(tint_symbol_2));
|
||||
int tint_symbol_3 = i();
|
||||
float l_a_i_a_i_m_i_i = load_a_inner_p0_a_p1_m_p2_p3(uint(tint_symbol), uint(tint_symbol_1), uint(tint_symbol_2), uint(tint_symbol_3));
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
f();
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
template<typename T, size_t N>
|
||||
struct tint_array {
|
||||
const constant T& operator[](size_t i) const constant { return elements[i]; }
|
||||
device T& operator[](size_t i) device { return elements[i]; }
|
||||
const device T& operator[](size_t i) const device { return elements[i]; }
|
||||
thread T& operator[](size_t i) thread { return elements[i]; }
|
||||
const thread T& operator[](size_t i) const thread { return elements[i]; }
|
||||
threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
|
||||
const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
|
||||
T elements[N];
|
||||
};
|
||||
|
||||
struct Inner {
|
||||
/* 0x0000 */ float3x2 m;
|
||||
/* 0x0018 */ tint_array<int8_t, 40> tint_pad;
|
||||
};
|
||||
|
||||
struct Outer {
|
||||
/* 0x0000 */ tint_array<Inner, 4> a;
|
||||
};
|
||||
|
||||
int i() {
|
||||
thread int tint_symbol_4 = 0;
|
||||
tint_symbol_4 = as_type<int>((as_type<uint>(tint_symbol_4) + as_type<uint>(1)));
|
||||
return tint_symbol_4;
|
||||
}
|
||||
|
||||
kernel void f(const constant tint_array<Outer, 4>* tint_symbol_5 [[buffer(0)]]) {
|
||||
int const tint_symbol = i();
|
||||
int const p_a_i_save = tint_symbol;
|
||||
int const tint_symbol_1 = i();
|
||||
int const p_a_i_a_i_save = tint_symbol_1;
|
||||
int const tint_symbol_2 = i();
|
||||
int const p_a_i_a_i_m_i_save = tint_symbol_2;
|
||||
tint_array<Outer, 4> const l_a = *(tint_symbol_5);
|
||||
Outer const l_a_i = (*(tint_symbol_5))[p_a_i_save];
|
||||
tint_array<Inner, 4> const l_a_i_a = (*(tint_symbol_5))[p_a_i_save].a;
|
||||
Inner const l_a_i_a_i = (*(tint_symbol_5))[p_a_i_save].a[p_a_i_a_i_save];
|
||||
float3x2 const l_a_i_a_i_m = (*(tint_symbol_5))[p_a_i_save].a[p_a_i_a_i_save].m;
|
||||
float2 const l_a_i_a_i_m_i = (*(tint_symbol_5))[p_a_i_save].a[p_a_i_a_i_save].m[p_a_i_a_i_m_i_save];
|
||||
int const tint_symbol_3 = i();
|
||||
float const l_a_i_a_i_m_i_i = (*(tint_symbol_5))[p_a_i_save].a[p_a_i_a_i_save].m[p_a_i_a_i_m_i_save][tint_symbol_3];
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,320 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 204
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %f "f"
|
||||
OpExecutionMode %f LocalSize 1 1 1
|
||||
OpName %a_block_std140 "a_block_std140"
|
||||
OpMemberName %a_block_std140 0 "inner"
|
||||
OpName %Outer_std140 "Outer_std140"
|
||||
OpMemberName %Outer_std140 0 "a"
|
||||
OpName %Inner_std140 "Inner_std140"
|
||||
OpMemberName %Inner_std140 0 "m_0"
|
||||
OpMemberName %Inner_std140 1 "m_1"
|
||||
OpMemberName %Inner_std140 2 "m_2"
|
||||
OpName %a "a"
|
||||
OpName %counter "counter"
|
||||
OpName %i "i"
|
||||
OpName %Inner "Inner"
|
||||
OpMemberName %Inner 0 "m"
|
||||
OpName %conv_Inner "conv_Inner"
|
||||
OpName %val "val"
|
||||
OpName %conv_arr_4_Inner "conv_arr_4_Inner"
|
||||
OpName %val_0 "val"
|
||||
OpName %arr "arr"
|
||||
OpName %i_0 "i"
|
||||
OpName %var_for_index_1 "var_for_index_1"
|
||||
OpName %Outer "Outer"
|
||||
OpMemberName %Outer 0 "a"
|
||||
OpName %conv_Outer "conv_Outer"
|
||||
OpName %val_1 "val"
|
||||
OpName %conv_arr_4_Outer "conv_arr_4_Outer"
|
||||
OpName %val_2 "val"
|
||||
OpName %arr_0 "arr"
|
||||
OpName %i_1 "i"
|
||||
OpName %var_for_index "var_for_index"
|
||||
OpName %load_a_inner_p0_a_p1_m "load_a_inner_p0_a_p1_m"
|
||||
OpName %p0 "p0"
|
||||
OpName %p1 "p1"
|
||||
OpName %load_a_inner_p0_a_p1_m_p2 "load_a_inner_p0_a_p1_m_p2"
|
||||
OpName %p0_0 "p0"
|
||||
OpName %p1_0 "p1"
|
||||
OpName %p2 "p2"
|
||||
OpName %load_a_inner_p0_a_p1_m_p2_p3 "load_a_inner_p0_a_p1_m_p2_p3"
|
||||
OpName %p0_1 "p0"
|
||||
OpName %p1_1 "p1"
|
||||
OpName %p2_0 "p2"
|
||||
OpName %p3 "p3"
|
||||
OpName %f "f"
|
||||
OpDecorate %a_block_std140 Block
|
||||
OpMemberDecorate %a_block_std140 0 Offset 0
|
||||
OpMemberDecorate %Outer_std140 0 Offset 0
|
||||
OpMemberDecorate %Inner_std140 0 Offset 0
|
||||
OpMemberDecorate %Inner_std140 1 Offset 8
|
||||
OpMemberDecorate %Inner_std140 2 Offset 16
|
||||
OpDecorate %_arr_Inner_std140_uint_4 ArrayStride 64
|
||||
OpDecorate %_arr_Outer_std140_uint_4 ArrayStride 256
|
||||
OpDecorate %a NonWritable
|
||||
OpDecorate %a DescriptorSet 0
|
||||
OpDecorate %a Binding 0
|
||||
OpMemberDecorate %Inner 0 Offset 0
|
||||
OpMemberDecorate %Inner 0 ColMajor
|
||||
OpMemberDecorate %Inner 0 MatrixStride 8
|
||||
OpDecorate %_arr_Inner_uint_4 ArrayStride 64
|
||||
OpMemberDecorate %Outer 0 Offset 0
|
||||
OpDecorate %_arr_Outer_uint_4 ArrayStride 256
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%Inner_std140 = OpTypeStruct %v2float %v2float %v2float
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%_arr_Inner_std140_uint_4 = OpTypeArray %Inner_std140 %uint_4
|
||||
%Outer_std140 = OpTypeStruct %_arr_Inner_std140_uint_4
|
||||
%_arr_Outer_std140_uint_4 = OpTypeArray %Outer_std140 %uint_4
|
||||
%a_block_std140 = OpTypeStruct %_arr_Outer_std140_uint_4
|
||||
%_ptr_Uniform_a_block_std140 = OpTypePointer Uniform %a_block_std140
|
||||
%a = OpVariable %_ptr_Uniform_a_block_std140 Uniform
|
||||
%int = OpTypeInt 32 1
|
||||
%13 = OpConstantNull %int
|
||||
%_ptr_Private_int = OpTypePointer Private %int
|
||||
%counter = OpVariable %_ptr_Private_int Private %13
|
||||
%16 = OpTypeFunction %int
|
||||
%int_1 = OpConstant %int 1
|
||||
%mat3v2float = OpTypeMatrix %v2float 3
|
||||
%Inner = OpTypeStruct %mat3v2float
|
||||
%23 = OpTypeFunction %Inner %Inner_std140
|
||||
%_arr_Inner_uint_4 = OpTypeArray %Inner %uint_4
|
||||
%34 = OpTypeFunction %_arr_Inner_uint_4 %_arr_Inner_std140_uint_4
|
||||
%_ptr_Function__arr_Inner_uint_4 = OpTypePointer Function %_arr_Inner_uint_4
|
||||
%41 = OpConstantNull %_arr_Inner_uint_4
|
||||
%_ptr_Function_uint = OpTypePointer Function %uint
|
||||
%44 = OpConstantNull %uint
|
||||
%bool = OpTypeBool
|
||||
%_ptr_Function__arr_Inner_std140_uint_4 = OpTypePointer Function %_arr_Inner_std140_uint_4
|
||||
%57 = OpConstantNull %_arr_Inner_std140_uint_4
|
||||
%_ptr_Function_Inner = OpTypePointer Function %Inner
|
||||
%_ptr_Function_Inner_std140 = OpTypePointer Function %Inner_std140
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%Outer = OpTypeStruct %_arr_Inner_uint_4
|
||||
%70 = OpTypeFunction %Outer %Outer_std140
|
||||
%_arr_Outer_uint_4 = OpTypeArray %Outer %uint_4
|
||||
%78 = OpTypeFunction %_arr_Outer_uint_4 %_arr_Outer_std140_uint_4
|
||||
%_ptr_Function__arr_Outer_uint_4 = OpTypePointer Function %_arr_Outer_uint_4
|
||||
%85 = OpConstantNull %_arr_Outer_uint_4
|
||||
%_ptr_Function__arr_Outer_std140_uint_4 = OpTypePointer Function %_arr_Outer_std140_uint_4
|
||||
%98 = OpConstantNull %_arr_Outer_std140_uint_4
|
||||
%_ptr_Function_Outer = OpTypePointer Function %Outer
|
||||
%_ptr_Function_Outer_std140 = OpTypePointer Function %Outer_std140
|
||||
%110 = OpTypeFunction %mat3v2float %uint %uint
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Uniform_Inner_std140 = OpTypePointer Uniform %Inner_std140
|
||||
%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%131 = OpTypeFunction %v2float %uint %uint %uint
|
||||
%148 = OpConstantNull %v2float
|
||||
%149 = OpTypeFunction %float %uint %uint %uint %uint
|
||||
%_ptr_Uniform_float = OpTypePointer Uniform %float
|
||||
%168 = OpConstantNull %float
|
||||
%void = OpTypeVoid
|
||||
%169 = OpTypeFunction %void
|
||||
%_ptr_Uniform__arr_Outer_std140_uint_4 = OpTypePointer Uniform %_arr_Outer_std140_uint_4
|
||||
%_ptr_Uniform_Outer_std140 = OpTypePointer Uniform %Outer_std140
|
||||
%_ptr_Uniform__arr_Inner_std140_uint_4 = OpTypePointer Uniform %_arr_Inner_std140_uint_4
|
||||
%i = OpFunction %int None %16
|
||||
%18 = OpLabel
|
||||
%19 = OpLoad %int %counter
|
||||
%21 = OpIAdd %int %19 %int_1
|
||||
OpStore %counter %21
|
||||
%22 = OpLoad %int %counter
|
||||
OpReturnValue %22
|
||||
OpFunctionEnd
|
||||
%conv_Inner = OpFunction %Inner None %23
|
||||
%val = OpFunctionParameter %Inner_std140
|
||||
%28 = OpLabel
|
||||
%29 = OpCompositeExtract %v2float %val 0
|
||||
%30 = OpCompositeExtract %v2float %val 1
|
||||
%31 = OpCompositeExtract %v2float %val 2
|
||||
%32 = OpCompositeConstruct %mat3v2float %29 %30 %31
|
||||
%33 = OpCompositeConstruct %Inner %32
|
||||
OpReturnValue %33
|
||||
OpFunctionEnd
|
||||
%conv_arr_4_Inner = OpFunction %_arr_Inner_uint_4 None %34
|
||||
%val_0 = OpFunctionParameter %_arr_Inner_std140_uint_4
|
||||
%38 = OpLabel
|
||||
%arr = OpVariable %_ptr_Function__arr_Inner_uint_4 Function %41
|
||||
%i_0 = OpVariable %_ptr_Function_uint Function %44
|
||||
%var_for_index_1 = OpVariable %_ptr_Function__arr_Inner_std140_uint_4 Function %57
|
||||
OpBranch %45
|
||||
%45 = OpLabel
|
||||
OpLoopMerge %46 %47 None
|
||||
OpBranch %48
|
||||
%48 = OpLabel
|
||||
%50 = OpLoad %uint %i_0
|
||||
%51 = OpULessThan %bool %50 %uint_4
|
||||
%49 = OpLogicalNot %bool %51
|
||||
OpSelectionMerge %53 None
|
||||
OpBranchConditional %49 %54 %53
|
||||
%54 = OpLabel
|
||||
OpBranch %46
|
||||
%53 = OpLabel
|
||||
OpStore %var_for_index_1 %val_0
|
||||
%58 = OpLoad %uint %i_0
|
||||
%60 = OpAccessChain %_ptr_Function_Inner %arr %58
|
||||
%62 = OpLoad %uint %i_0
|
||||
%64 = OpAccessChain %_ptr_Function_Inner_std140 %var_for_index_1 %62
|
||||
%65 = OpLoad %Inner_std140 %64
|
||||
%61 = OpFunctionCall %Inner %conv_Inner %65
|
||||
OpStore %60 %61
|
||||
OpBranch %47
|
||||
%47 = OpLabel
|
||||
%66 = OpLoad %uint %i_0
|
||||
%68 = OpIAdd %uint %66 %uint_1
|
||||
OpStore %i_0 %68
|
||||
OpBranch %45
|
||||
%46 = OpLabel
|
||||
%69 = OpLoad %_arr_Inner_uint_4 %arr
|
||||
OpReturnValue %69
|
||||
OpFunctionEnd
|
||||
%conv_Outer = OpFunction %Outer None %70
|
||||
%val_1 = OpFunctionParameter %Outer_std140
|
||||
%74 = OpLabel
|
||||
%76 = OpCompositeExtract %_arr_Inner_std140_uint_4 %val_1 0
|
||||
%75 = OpFunctionCall %_arr_Inner_uint_4 %conv_arr_4_Inner %76
|
||||
%77 = OpCompositeConstruct %Outer %75
|
||||
OpReturnValue %77
|
||||
OpFunctionEnd
|
||||
%conv_arr_4_Outer = OpFunction %_arr_Outer_uint_4 None %78
|
||||
%val_2 = OpFunctionParameter %_arr_Outer_std140_uint_4
|
||||
%82 = OpLabel
|
||||
%arr_0 = OpVariable %_ptr_Function__arr_Outer_uint_4 Function %85
|
||||
%i_1 = OpVariable %_ptr_Function_uint Function %44
|
||||
%var_for_index = OpVariable %_ptr_Function__arr_Outer_std140_uint_4 Function %98
|
||||
OpBranch %87
|
||||
%87 = OpLabel
|
||||
OpLoopMerge %88 %89 None
|
||||
OpBranch %90
|
||||
%90 = OpLabel
|
||||
%92 = OpLoad %uint %i_1
|
||||
%93 = OpULessThan %bool %92 %uint_4
|
||||
%91 = OpLogicalNot %bool %93
|
||||
OpSelectionMerge %94 None
|
||||
OpBranchConditional %91 %95 %94
|
||||
%95 = OpLabel
|
||||
OpBranch %88
|
||||
%94 = OpLabel
|
||||
OpStore %var_for_index %val_2
|
||||
%99 = OpLoad %uint %i_1
|
||||
%101 = OpAccessChain %_ptr_Function_Outer %arr_0 %99
|
||||
%103 = OpLoad %uint %i_1
|
||||
%105 = OpAccessChain %_ptr_Function_Outer_std140 %var_for_index %103
|
||||
%106 = OpLoad %Outer_std140 %105
|
||||
%102 = OpFunctionCall %Outer %conv_Outer %106
|
||||
OpStore %101 %102
|
||||
OpBranch %89
|
||||
%89 = OpLabel
|
||||
%107 = OpLoad %uint %i_1
|
||||
%108 = OpIAdd %uint %107 %uint_1
|
||||
OpStore %i_1 %108
|
||||
OpBranch %87
|
||||
%88 = OpLabel
|
||||
%109 = OpLoad %_arr_Outer_uint_4 %arr_0
|
||||
OpReturnValue %109
|
||||
OpFunctionEnd
|
||||
%load_a_inner_p0_a_p1_m = OpFunction %mat3v2float None %110
|
||||
%p0 = OpFunctionParameter %uint
|
||||
%p1 = OpFunctionParameter %uint
|
||||
%114 = OpLabel
|
||||
%118 = OpAccessChain %_ptr_Uniform_Inner_std140 %a %uint_0 %p0 %uint_0 %p1
|
||||
%121 = OpAccessChain %_ptr_Uniform_v2float %118 %uint_0
|
||||
%122 = OpLoad %v2float %121
|
||||
%124 = OpAccessChain %_ptr_Uniform_v2float %118 %uint_1
|
||||
%125 = OpLoad %v2float %124
|
||||
%128 = OpAccessChain %_ptr_Uniform_v2float %118 %uint_2
|
||||
%129 = OpLoad %v2float %128
|
||||
%130 = OpCompositeConstruct %mat3v2float %122 %125 %129
|
||||
OpReturnValue %130
|
||||
OpFunctionEnd
|
||||
%load_a_inner_p0_a_p1_m_p2 = OpFunction %v2float None %131
|
||||
%p0_0 = OpFunctionParameter %uint
|
||||
%p1_0 = OpFunctionParameter %uint
|
||||
%p2 = OpFunctionParameter %uint
|
||||
%136 = OpLabel
|
||||
OpSelectionMerge %137 None
|
||||
OpSwitch %p2 %138 0 %139 1 %140 2 %141
|
||||
%139 = OpLabel
|
||||
%142 = OpAccessChain %_ptr_Uniform_v2float %a %uint_0 %p0_0 %uint_0 %p1_0 %uint_0
|
||||
%143 = OpLoad %v2float %142
|
||||
OpReturnValue %143
|
||||
%140 = OpLabel
|
||||
%144 = OpAccessChain %_ptr_Uniform_v2float %a %uint_0 %p0_0 %uint_0 %p1_0 %uint_1
|
||||
%145 = OpLoad %v2float %144
|
||||
OpReturnValue %145
|
||||
%141 = OpLabel
|
||||
%146 = OpAccessChain %_ptr_Uniform_v2float %a %uint_0 %p0_0 %uint_0 %p1_0 %uint_2
|
||||
%147 = OpLoad %v2float %146
|
||||
OpReturnValue %147
|
||||
%138 = OpLabel
|
||||
OpReturnValue %148
|
||||
%137 = OpLabel
|
||||
OpReturnValue %148
|
||||
OpFunctionEnd
|
||||
%load_a_inner_p0_a_p1_m_p2_p3 = OpFunction %float None %149
|
||||
%p0_1 = OpFunctionParameter %uint
|
||||
%p1_1 = OpFunctionParameter %uint
|
||||
%p2_0 = OpFunctionParameter %uint
|
||||
%p3 = OpFunctionParameter %uint
|
||||
%155 = OpLabel
|
||||
OpSelectionMerge %156 None
|
||||
OpSwitch %p2_0 %157 0 %158 1 %159 2 %160
|
||||
%158 = OpLabel
|
||||
%162 = OpAccessChain %_ptr_Uniform_float %a %uint_0 %p0_1 %uint_0 %p1_1 %uint_0 %p3
|
||||
%163 = OpLoad %float %162
|
||||
OpReturnValue %163
|
||||
%159 = OpLabel
|
||||
%164 = OpAccessChain %_ptr_Uniform_float %a %uint_0 %p0_1 %uint_0 %p1_1 %uint_1 %p3
|
||||
%165 = OpLoad %float %164
|
||||
OpReturnValue %165
|
||||
%160 = OpLabel
|
||||
%166 = OpAccessChain %_ptr_Uniform_float %a %uint_0 %p0_1 %uint_0 %p1_1 %uint_2 %p3
|
||||
%167 = OpLoad %float %166
|
||||
OpReturnValue %167
|
||||
%157 = OpLabel
|
||||
OpReturnValue %168
|
||||
%156 = OpLabel
|
||||
OpReturnValue %168
|
||||
OpFunctionEnd
|
||||
%f = OpFunction %void None %169
|
||||
%172 = OpLabel
|
||||
%173 = OpFunctionCall %int %i
|
||||
%174 = OpFunctionCall %int %i
|
||||
%175 = OpFunctionCall %int %i
|
||||
%178 = OpAccessChain %_ptr_Uniform__arr_Outer_std140_uint_4 %a %uint_0
|
||||
%179 = OpLoad %_arr_Outer_std140_uint_4 %178
|
||||
%176 = OpFunctionCall %_arr_Outer_uint_4 %conv_arr_4_Outer %179
|
||||
%182 = OpAccessChain %_ptr_Uniform_Outer_std140 %a %uint_0 %173
|
||||
%183 = OpLoad %Outer_std140 %182
|
||||
%180 = OpFunctionCall %Outer %conv_Outer %183
|
||||
%186 = OpAccessChain %_ptr_Uniform__arr_Inner_std140_uint_4 %a %uint_0 %173 %uint_0
|
||||
%187 = OpLoad %_arr_Inner_std140_uint_4 %186
|
||||
%184 = OpFunctionCall %_arr_Inner_uint_4 %conv_arr_4_Inner %187
|
||||
%189 = OpAccessChain %_ptr_Uniform_Inner_std140 %a %uint_0 %173 %uint_0 %174
|
||||
%190 = OpLoad %Inner_std140 %189
|
||||
%188 = OpFunctionCall %Inner %conv_Inner %190
|
||||
%192 = OpBitcast %uint %173
|
||||
%193 = OpBitcast %uint %174
|
||||
%191 = OpFunctionCall %mat3v2float %load_a_inner_p0_a_p1_m %192 %193
|
||||
%195 = OpBitcast %uint %173
|
||||
%196 = OpBitcast %uint %174
|
||||
%197 = OpBitcast %uint %175
|
||||
%194 = OpFunctionCall %v2float %load_a_inner_p0_a_p1_m_p2 %195 %196 %197
|
||||
%198 = OpFunctionCall %int %i
|
||||
%200 = OpBitcast %uint %173
|
||||
%201 = OpBitcast %uint %174
|
||||
%202 = OpBitcast %uint %175
|
||||
%203 = OpBitcast %uint %198
|
||||
%199 = OpFunctionCall %float %load_a_inner_p0_a_p1_m_p2_p3 %200 %201 %202 %203
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,34 @@
|
||||
struct Inner {
|
||||
@size(64)
|
||||
m : mat3x2<f32>,
|
||||
}
|
||||
|
||||
struct Outer {
|
||||
a : array<Inner, 4>,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<uniform> a : array<Outer, 4>;
|
||||
|
||||
var<private> counter = 0;
|
||||
|
||||
fn i() -> i32 {
|
||||
counter++;
|
||||
return counter;
|
||||
}
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn f() {
|
||||
let p_a = &(a);
|
||||
let p_a_i = &((*(p_a))[i()]);
|
||||
let p_a_i_a = &((*(p_a_i)).a);
|
||||
let p_a_i_a_i = &((*(p_a_i_a))[i()]);
|
||||
let p_a_i_a_i_m = &((*(p_a_i_a_i)).m);
|
||||
let p_a_i_a_i_m_i = &((*(p_a_i_a_i_m))[i()]);
|
||||
let l_a : array<Outer, 4> = *(p_a);
|
||||
let l_a_i : Outer = *(p_a_i);
|
||||
let l_a_i_a : array<Inner, 4> = *(p_a_i_a);
|
||||
let l_a_i_a_i : Inner = *(p_a_i_a_i);
|
||||
let l_a_i_a_i_m : mat3x2<f32> = *(p_a_i_a_i_m);
|
||||
let l_a_i_a_i_m_i : vec2<f32> = *(p_a_i_a_i_m_i);
|
||||
let l_a_i_a_i_m_i_i : f32 = (*(p_a_i_a_i_m_i))[i()];
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
struct Inner {
|
||||
@size(64) m : mat3x2<f32>,
|
||||
}
|
||||
|
||||
struct Outer {
|
||||
a : array<Inner, 4>,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<uniform> a : array<Outer, 4>;
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn f() {
|
||||
let p_a = &a;
|
||||
let p_a_3 = &((*p_a)[3]);
|
||||
let p_a_3_a = &((*p_a_3).a);
|
||||
let p_a_3_a_2 = &((*p_a_3_a)[2]);
|
||||
let p_a_3_a_2_m = &((*p_a_3_a_2).m);
|
||||
let p_a_3_a_2_m_1 = &((*p_a_3_a_2_m)[1]);
|
||||
|
||||
|
||||
let l_a : array<Outer, 4> = *p_a;
|
||||
let l_a_3 : Outer = *p_a_3;
|
||||
let l_a_3_a : array<Inner, 4> = *p_a_3_a;
|
||||
let l_a_3_a_2 : Inner = *p_a_3_a_2;
|
||||
let l_a_3_a_2_m : mat3x2<f32> = *p_a_3_a_2_m;
|
||||
let l_a_3_a_2_m_1 : vec2<f32> = *p_a_3_a_2_m_1;
|
||||
let l_a_3_a_2_m_1_0 : f32 = (*p_a_3_a_2_m_1)[0];
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
struct Inner {
|
||||
float3x2 m;
|
||||
};
|
||||
struct Outer {
|
||||
Inner a[4];
|
||||
};
|
||||
|
||||
cbuffer cbuffer_a : register(b0, space0) {
|
||||
uint4 a[64];
|
||||
};
|
||||
|
||||
float3x2 tint_symbol_4(uint4 buffer[64], uint offset) {
|
||||
const uint scalar_offset = ((offset + 0u)) / 4;
|
||||
uint4 ubo_load = buffer[scalar_offset / 4];
|
||||
const uint scalar_offset_1 = ((offset + 8u)) / 4;
|
||||
uint4 ubo_load_1 = buffer[scalar_offset_1 / 4];
|
||||
const uint scalar_offset_2 = ((offset + 16u)) / 4;
|
||||
uint4 ubo_load_2 = buffer[scalar_offset_2 / 4];
|
||||
return float3x2(asfloat(((scalar_offset & 2) ? ubo_load.zw : ubo_load.xy)), asfloat(((scalar_offset_1 & 2) ? ubo_load_1.zw : ubo_load_1.xy)), asfloat(((scalar_offset_2 & 2) ? ubo_load_2.zw : ubo_load_2.xy)));
|
||||
}
|
||||
|
||||
Inner tint_symbol_3(uint4 buffer[64], uint offset) {
|
||||
const Inner tint_symbol_7 = {tint_symbol_4(buffer, (offset + 0u))};
|
||||
return tint_symbol_7;
|
||||
}
|
||||
|
||||
typedef Inner tint_symbol_2_ret[4];
|
||||
tint_symbol_2_ret tint_symbol_2(uint4 buffer[64], uint offset) {
|
||||
Inner arr[4] = (Inner[4])0;
|
||||
{
|
||||
[loop] for(uint i = 0u; (i < 4u); i = (i + 1u)) {
|
||||
arr[i] = tint_symbol_3(buffer, (offset + (i * 64u)));
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
Outer tint_symbol_1(uint4 buffer[64], uint offset) {
|
||||
const Outer tint_symbol_8 = {tint_symbol_2(buffer, (offset + 0u))};
|
||||
return tint_symbol_8;
|
||||
}
|
||||
|
||||
typedef Outer tint_symbol_ret[4];
|
||||
tint_symbol_ret tint_symbol(uint4 buffer[64], uint offset) {
|
||||
Outer arr_1[4] = (Outer[4])0;
|
||||
{
|
||||
[loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
|
||||
arr_1[i_1] = tint_symbol_1(buffer, (offset + (i_1 * 256u)));
|
||||
}
|
||||
}
|
||||
return arr_1;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void f() {
|
||||
const Outer l_a[4] = tint_symbol(a, 0u);
|
||||
const Outer l_a_3 = tint_symbol_1(a, 768u);
|
||||
const Inner l_a_3_a[4] = tint_symbol_2(a, 768u);
|
||||
const Inner l_a_3_a_2 = tint_symbol_3(a, 896u);
|
||||
const float3x2 l_a_3_a_2_m = tint_symbol_4(a, 896u);
|
||||
const float2 l_a_3_a_2_m_1 = asfloat(a[56].zw);
|
||||
const float l_a_3_a_2_m_1_0 = asfloat(a[56].z);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
struct Inner {
|
||||
float3x2 m;
|
||||
};
|
||||
struct Outer {
|
||||
Inner a[4];
|
||||
};
|
||||
|
||||
cbuffer cbuffer_a : register(b0, space0) {
|
||||
uint4 a[64];
|
||||
};
|
||||
|
||||
float3x2 tint_symbol_4(uint4 buffer[64], uint offset) {
|
||||
const uint scalar_offset = ((offset + 0u)) / 4;
|
||||
uint4 ubo_load = buffer[scalar_offset / 4];
|
||||
const uint scalar_offset_1 = ((offset + 8u)) / 4;
|
||||
uint4 ubo_load_1 = buffer[scalar_offset_1 / 4];
|
||||
const uint scalar_offset_2 = ((offset + 16u)) / 4;
|
||||
uint4 ubo_load_2 = buffer[scalar_offset_2 / 4];
|
||||
return float3x2(asfloat(((scalar_offset & 2) ? ubo_load.zw : ubo_load.xy)), asfloat(((scalar_offset_1 & 2) ? ubo_load_1.zw : ubo_load_1.xy)), asfloat(((scalar_offset_2 & 2) ? ubo_load_2.zw : ubo_load_2.xy)));
|
||||
}
|
||||
|
||||
Inner tint_symbol_3(uint4 buffer[64], uint offset) {
|
||||
const Inner tint_symbol_7 = {tint_symbol_4(buffer, (offset + 0u))};
|
||||
return tint_symbol_7;
|
||||
}
|
||||
|
||||
typedef Inner tint_symbol_2_ret[4];
|
||||
tint_symbol_2_ret tint_symbol_2(uint4 buffer[64], uint offset) {
|
||||
Inner arr[4] = (Inner[4])0;
|
||||
{
|
||||
[loop] for(uint i = 0u; (i < 4u); i = (i + 1u)) {
|
||||
arr[i] = tint_symbol_3(buffer, (offset + (i * 64u)));
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
Outer tint_symbol_1(uint4 buffer[64], uint offset) {
|
||||
const Outer tint_symbol_8 = {tint_symbol_2(buffer, (offset + 0u))};
|
||||
return tint_symbol_8;
|
||||
}
|
||||
|
||||
typedef Outer tint_symbol_ret[4];
|
||||
tint_symbol_ret tint_symbol(uint4 buffer[64], uint offset) {
|
||||
Outer arr_1[4] = (Outer[4])0;
|
||||
{
|
||||
[loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
|
||||
arr_1[i_1] = tint_symbol_1(buffer, (offset + (i_1 * 256u)));
|
||||
}
|
||||
}
|
||||
return arr_1;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void f() {
|
||||
const Outer l_a[4] = tint_symbol(a, 0u);
|
||||
const Outer l_a_3 = tint_symbol_1(a, 768u);
|
||||
const Inner l_a_3_a[4] = tint_symbol_2(a, 768u);
|
||||
const Inner l_a_3_a_2 = tint_symbol_3(a, 896u);
|
||||
const float3x2 l_a_3_a_2_m = tint_symbol_4(a, 896u);
|
||||
const float2 l_a_3_a_2_m_1 = asfloat(a[56].zw);
|
||||
const float l_a_3_a_2_m_1_0 = asfloat(a[56].z);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
#version 310 es
|
||||
|
||||
struct Inner {
|
||||
mat3x2 m;
|
||||
uint pad;
|
||||
uint pad_1;
|
||||
uint pad_2;
|
||||
uint pad_3;
|
||||
uint pad_4;
|
||||
uint pad_5;
|
||||
uint pad_6;
|
||||
uint pad_7;
|
||||
uint pad_8;
|
||||
uint pad_9;
|
||||
};
|
||||
|
||||
struct Inner_std140 {
|
||||
vec2 m_0;
|
||||
vec2 m_1;
|
||||
vec2 m_2;
|
||||
uint pad;
|
||||
uint pad_1;
|
||||
uint pad_2;
|
||||
uint pad_3;
|
||||
uint pad_4;
|
||||
uint pad_5;
|
||||
uint pad_6;
|
||||
uint pad_7;
|
||||
uint pad_8;
|
||||
uint pad_9;
|
||||
};
|
||||
|
||||
struct Outer {
|
||||
Inner a[4];
|
||||
};
|
||||
|
||||
struct Outer_std140 {
|
||||
Inner_std140 a[4];
|
||||
};
|
||||
|
||||
layout(binding = 0, std140) uniform a_block_std140_ubo {
|
||||
Outer_std140 inner[4];
|
||||
} a;
|
||||
|
||||
Inner conv_Inner(Inner_std140 val) {
|
||||
return Inner(mat3x2(val.m_0, val.m_1, val.m_2), val.pad, val.pad_1, val.pad_2, val.pad_3, val.pad_4, val.pad_5, val.pad_6, val.pad_7, val.pad_8, val.pad_9);
|
||||
}
|
||||
|
||||
Inner[4] conv_arr_4_Inner(Inner_std140 val[4]) {
|
||||
Inner arr[4] = Inner[4](Inner(mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u), Inner(mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u), Inner(mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u), Inner(mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u));
|
||||
{
|
||||
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
|
||||
arr[i] = conv_Inner(val[i]);
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
Outer conv_Outer(Outer_std140 val) {
|
||||
return Outer(conv_arr_4_Inner(val.a));
|
||||
}
|
||||
|
||||
Outer[4] conv_arr_4_Outer(Outer_std140 val[4]) {
|
||||
Outer arr[4] = Outer[4](Outer(Inner[4](Inner(mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u), Inner(mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u), Inner(mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u), Inner(mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u))), Outer(Inner[4](Inner(mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u), Inner(mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u), Inner(mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u), Inner(mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u))), Outer(Inner[4](Inner(mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u), Inner(mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u), Inner(mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u), Inner(mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u))), Outer(Inner[4](Inner(mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u), Inner(mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u), Inner(mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u), Inner(mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u))));
|
||||
{
|
||||
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
|
||||
arr[i] = conv_Outer(val[i]);
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
mat3x2 load_a_inner_3_a_2_m() {
|
||||
return mat3x2(a.inner[3u].a[2u].m_0, a.inner[3u].a[2u].m_1, a.inner[3u].a[2u].m_2);
|
||||
}
|
||||
|
||||
void f() {
|
||||
Outer p_a[4] = conv_arr_4_Outer(a.inner);
|
||||
Outer p_a_3 = conv_Outer(a.inner[3u]);
|
||||
Inner p_a_3_a[4] = conv_arr_4_Inner(a.inner[3u].a);
|
||||
Inner p_a_3_a_2 = conv_Inner(a.inner[3u].a[2u]);
|
||||
mat3x2 p_a_3_a_2_m = load_a_inner_3_a_2_m();
|
||||
vec2 p_a_3_a_2_m_1 = a.inner[3u].a[2u].m_1;
|
||||
Outer l_a[4] = conv_arr_4_Outer(a.inner);
|
||||
Outer l_a_3 = conv_Outer(a.inner[3u]);
|
||||
Inner l_a_3_a[4] = conv_arr_4_Inner(a.inner[3u].a);
|
||||
Inner l_a_3_a_2 = conv_Inner(a.inner[3u].a[2u]);
|
||||
mat3x2 l_a_3_a_2_m = load_a_inner_3_a_2_m();
|
||||
vec2 l_a_3_a_2_m_1 = a.inner[3u].a[2u].m_1;
|
||||
float l_a_3_a_2_m_1_0 = a.inner[3u].a[2u].m_1[0u];
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
f();
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
template<typename T, size_t N>
|
||||
struct tint_array {
|
||||
const constant T& operator[](size_t i) const constant { return elements[i]; }
|
||||
device T& operator[](size_t i) device { return elements[i]; }
|
||||
const device T& operator[](size_t i) const device { return elements[i]; }
|
||||
thread T& operator[](size_t i) thread { return elements[i]; }
|
||||
const thread T& operator[](size_t i) const thread { return elements[i]; }
|
||||
threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
|
||||
const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
|
||||
T elements[N];
|
||||
};
|
||||
|
||||
struct Inner {
|
||||
/* 0x0000 */ float3x2 m;
|
||||
/* 0x0018 */ tint_array<int8_t, 40> tint_pad;
|
||||
};
|
||||
|
||||
struct Outer {
|
||||
/* 0x0000 */ tint_array<Inner, 4> a;
|
||||
};
|
||||
|
||||
kernel void f(const constant tint_array<Outer, 4>* tint_symbol [[buffer(0)]]) {
|
||||
tint_array<Outer, 4> const l_a = *(tint_symbol);
|
||||
Outer const l_a_3 = (*(tint_symbol))[3];
|
||||
tint_array<Inner, 4> const l_a_3_a = (*(tint_symbol))[3].a;
|
||||
Inner const l_a_3_a_2 = (*(tint_symbol))[3].a[2];
|
||||
float3x2 const l_a_3_a_2_m = (*(tint_symbol))[3].a[2].m;
|
||||
float2 const l_a_3_a_2_m_1 = (*(tint_symbol))[3].a[2].m[1];
|
||||
float const l_a_3_a_2_m_1_0 = (*(tint_symbol))[3].a[2].m[1][0];
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,228 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 144
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %f "f"
|
||||
OpExecutionMode %f LocalSize 1 1 1
|
||||
OpName %a_block_std140 "a_block_std140"
|
||||
OpMemberName %a_block_std140 0 "inner"
|
||||
OpName %Outer_std140 "Outer_std140"
|
||||
OpMemberName %Outer_std140 0 "a"
|
||||
OpName %Inner_std140 "Inner_std140"
|
||||
OpMemberName %Inner_std140 0 "m_0"
|
||||
OpMemberName %Inner_std140 1 "m_1"
|
||||
OpMemberName %Inner_std140 2 "m_2"
|
||||
OpName %a "a"
|
||||
OpName %Inner "Inner"
|
||||
OpMemberName %Inner 0 "m"
|
||||
OpName %conv_Inner "conv_Inner"
|
||||
OpName %val "val"
|
||||
OpName %conv_arr_4_Inner "conv_arr_4_Inner"
|
||||
OpName %val_0 "val"
|
||||
OpName %arr "arr"
|
||||
OpName %i "i"
|
||||
OpName %var_for_index_1 "var_for_index_1"
|
||||
OpName %Outer "Outer"
|
||||
OpMemberName %Outer 0 "a"
|
||||
OpName %conv_Outer "conv_Outer"
|
||||
OpName %val_1 "val"
|
||||
OpName %conv_arr_4_Outer "conv_arr_4_Outer"
|
||||
OpName %val_2 "val"
|
||||
OpName %arr_0 "arr"
|
||||
OpName %i_0 "i"
|
||||
OpName %var_for_index "var_for_index"
|
||||
OpName %load_a_inner_3_a_2_m "load_a_inner_3_a_2_m"
|
||||
OpName %f "f"
|
||||
OpDecorate %a_block_std140 Block
|
||||
OpMemberDecorate %a_block_std140 0 Offset 0
|
||||
OpMemberDecorate %Outer_std140 0 Offset 0
|
||||
OpMemberDecorate %Inner_std140 0 Offset 0
|
||||
OpMemberDecorate %Inner_std140 1 Offset 8
|
||||
OpMemberDecorate %Inner_std140 2 Offset 16
|
||||
OpDecorate %_arr_Inner_std140_uint_4 ArrayStride 64
|
||||
OpDecorate %_arr_Outer_std140_uint_4 ArrayStride 256
|
||||
OpDecorate %a NonWritable
|
||||
OpDecorate %a DescriptorSet 0
|
||||
OpDecorate %a Binding 0
|
||||
OpMemberDecorate %Inner 0 Offset 0
|
||||
OpMemberDecorate %Inner 0 ColMajor
|
||||
OpMemberDecorate %Inner 0 MatrixStride 8
|
||||
OpDecorate %_arr_Inner_uint_4 ArrayStride 64
|
||||
OpMemberDecorate %Outer 0 Offset 0
|
||||
OpDecorate %_arr_Outer_uint_4 ArrayStride 256
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%Inner_std140 = OpTypeStruct %v2float %v2float %v2float
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%_arr_Inner_std140_uint_4 = OpTypeArray %Inner_std140 %uint_4
|
||||
%Outer_std140 = OpTypeStruct %_arr_Inner_std140_uint_4
|
||||
%_arr_Outer_std140_uint_4 = OpTypeArray %Outer_std140 %uint_4
|
||||
%a_block_std140 = OpTypeStruct %_arr_Outer_std140_uint_4
|
||||
%_ptr_Uniform_a_block_std140 = OpTypePointer Uniform %a_block_std140
|
||||
%a = OpVariable %_ptr_Uniform_a_block_std140 Uniform
|
||||
%mat3v2float = OpTypeMatrix %v2float 3
|
||||
%Inner = OpTypeStruct %mat3v2float
|
||||
%12 = OpTypeFunction %Inner %Inner_std140
|
||||
%_arr_Inner_uint_4 = OpTypeArray %Inner %uint_4
|
||||
%23 = OpTypeFunction %_arr_Inner_uint_4 %_arr_Inner_std140_uint_4
|
||||
%_ptr_Function__arr_Inner_uint_4 = OpTypePointer Function %_arr_Inner_uint_4
|
||||
%30 = OpConstantNull %_arr_Inner_uint_4
|
||||
%_ptr_Function_uint = OpTypePointer Function %uint
|
||||
%33 = OpConstantNull %uint
|
||||
%bool = OpTypeBool
|
||||
%_ptr_Function__arr_Inner_std140_uint_4 = OpTypePointer Function %_arr_Inner_std140_uint_4
|
||||
%46 = OpConstantNull %_arr_Inner_std140_uint_4
|
||||
%_ptr_Function_Inner = OpTypePointer Function %Inner
|
||||
%_ptr_Function_Inner_std140 = OpTypePointer Function %Inner_std140
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%Outer = OpTypeStruct %_arr_Inner_uint_4
|
||||
%59 = OpTypeFunction %Outer %Outer_std140
|
||||
%_arr_Outer_uint_4 = OpTypeArray %Outer %uint_4
|
||||
%67 = OpTypeFunction %_arr_Outer_uint_4 %_arr_Outer_std140_uint_4
|
||||
%_ptr_Function__arr_Outer_uint_4 = OpTypePointer Function %_arr_Outer_uint_4
|
||||
%74 = OpConstantNull %_arr_Outer_uint_4
|
||||
%_ptr_Function__arr_Outer_std140_uint_4 = OpTypePointer Function %_arr_Outer_std140_uint_4
|
||||
%87 = OpConstantNull %_arr_Outer_std140_uint_4
|
||||
%_ptr_Function_Outer = OpTypePointer Function %Outer
|
||||
%_ptr_Function_Outer_std140 = OpTypePointer Function %Outer_std140
|
||||
%99 = OpTypeFunction %mat3v2float
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_ptr_Uniform_Inner_std140 = OpTypePointer Uniform %Inner_std140
|
||||
%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
|
||||
%void = OpTypeVoid
|
||||
%119 = OpTypeFunction %void
|
||||
%_ptr_Uniform__arr_Outer_std140_uint_4 = OpTypePointer Uniform %_arr_Outer_std140_uint_4
|
||||
%_ptr_Uniform_Outer_std140 = OpTypePointer Uniform %Outer_std140
|
||||
%_ptr_Uniform__arr_Inner_std140_uint_4 = OpTypePointer Uniform %_arr_Inner_std140_uint_4
|
||||
%_ptr_Uniform_float = OpTypePointer Uniform %float
|
||||
%conv_Inner = OpFunction %Inner None %12
|
||||
%val = OpFunctionParameter %Inner_std140
|
||||
%17 = OpLabel
|
||||
%18 = OpCompositeExtract %v2float %val 0
|
||||
%19 = OpCompositeExtract %v2float %val 1
|
||||
%20 = OpCompositeExtract %v2float %val 2
|
||||
%21 = OpCompositeConstruct %mat3v2float %18 %19 %20
|
||||
%22 = OpCompositeConstruct %Inner %21
|
||||
OpReturnValue %22
|
||||
OpFunctionEnd
|
||||
%conv_arr_4_Inner = OpFunction %_arr_Inner_uint_4 None %23
|
||||
%val_0 = OpFunctionParameter %_arr_Inner_std140_uint_4
|
||||
%27 = OpLabel
|
||||
%arr = OpVariable %_ptr_Function__arr_Inner_uint_4 Function %30
|
||||
%i = OpVariable %_ptr_Function_uint Function %33
|
||||
%var_for_index_1 = OpVariable %_ptr_Function__arr_Inner_std140_uint_4 Function %46
|
||||
OpBranch %34
|
||||
%34 = OpLabel
|
||||
OpLoopMerge %35 %36 None
|
||||
OpBranch %37
|
||||
%37 = OpLabel
|
||||
%39 = OpLoad %uint %i
|
||||
%40 = OpULessThan %bool %39 %uint_4
|
||||
%38 = OpLogicalNot %bool %40
|
||||
OpSelectionMerge %42 None
|
||||
OpBranchConditional %38 %43 %42
|
||||
%43 = OpLabel
|
||||
OpBranch %35
|
||||
%42 = OpLabel
|
||||
OpStore %var_for_index_1 %val_0
|
||||
%47 = OpLoad %uint %i
|
||||
%49 = OpAccessChain %_ptr_Function_Inner %arr %47
|
||||
%51 = OpLoad %uint %i
|
||||
%53 = OpAccessChain %_ptr_Function_Inner_std140 %var_for_index_1 %51
|
||||
%54 = OpLoad %Inner_std140 %53
|
||||
%50 = OpFunctionCall %Inner %conv_Inner %54
|
||||
OpStore %49 %50
|
||||
OpBranch %36
|
||||
%36 = OpLabel
|
||||
%55 = OpLoad %uint %i
|
||||
%57 = OpIAdd %uint %55 %uint_1
|
||||
OpStore %i %57
|
||||
OpBranch %34
|
||||
%35 = OpLabel
|
||||
%58 = OpLoad %_arr_Inner_uint_4 %arr
|
||||
OpReturnValue %58
|
||||
OpFunctionEnd
|
||||
%conv_Outer = OpFunction %Outer None %59
|
||||
%val_1 = OpFunctionParameter %Outer_std140
|
||||
%63 = OpLabel
|
||||
%65 = OpCompositeExtract %_arr_Inner_std140_uint_4 %val_1 0
|
||||
%64 = OpFunctionCall %_arr_Inner_uint_4 %conv_arr_4_Inner %65
|
||||
%66 = OpCompositeConstruct %Outer %64
|
||||
OpReturnValue %66
|
||||
OpFunctionEnd
|
||||
%conv_arr_4_Outer = OpFunction %_arr_Outer_uint_4 None %67
|
||||
%val_2 = OpFunctionParameter %_arr_Outer_std140_uint_4
|
||||
%71 = OpLabel
|
||||
%arr_0 = OpVariable %_ptr_Function__arr_Outer_uint_4 Function %74
|
||||
%i_0 = OpVariable %_ptr_Function_uint Function %33
|
||||
%var_for_index = OpVariable %_ptr_Function__arr_Outer_std140_uint_4 Function %87
|
||||
OpBranch %76
|
||||
%76 = OpLabel
|
||||
OpLoopMerge %77 %78 None
|
||||
OpBranch %79
|
||||
%79 = OpLabel
|
||||
%81 = OpLoad %uint %i_0
|
||||
%82 = OpULessThan %bool %81 %uint_4
|
||||
%80 = OpLogicalNot %bool %82
|
||||
OpSelectionMerge %83 None
|
||||
OpBranchConditional %80 %84 %83
|
||||
%84 = OpLabel
|
||||
OpBranch %77
|
||||
%83 = OpLabel
|
||||
OpStore %var_for_index %val_2
|
||||
%88 = OpLoad %uint %i_0
|
||||
%90 = OpAccessChain %_ptr_Function_Outer %arr_0 %88
|
||||
%92 = OpLoad %uint %i_0
|
||||
%94 = OpAccessChain %_ptr_Function_Outer_std140 %var_for_index %92
|
||||
%95 = OpLoad %Outer_std140 %94
|
||||
%91 = OpFunctionCall %Outer %conv_Outer %95
|
||||
OpStore %90 %91
|
||||
OpBranch %78
|
||||
%78 = OpLabel
|
||||
%96 = OpLoad %uint %i_0
|
||||
%97 = OpIAdd %uint %96 %uint_1
|
||||
OpStore %i_0 %97
|
||||
OpBranch %76
|
||||
%77 = OpLabel
|
||||
%98 = OpLoad %_arr_Outer_uint_4 %arr_0
|
||||
OpReturnValue %98
|
||||
OpFunctionEnd
|
||||
%load_a_inner_3_a_2_m = OpFunction %mat3v2float None %99
|
||||
%101 = OpLabel
|
||||
%107 = OpAccessChain %_ptr_Uniform_Inner_std140 %a %uint_0 %uint_3 %uint_0 %uint_2
|
||||
%110 = OpAccessChain %_ptr_Uniform_v2float %107 %uint_0
|
||||
%111 = OpLoad %v2float %110
|
||||
%113 = OpAccessChain %_ptr_Uniform_v2float %107 %uint_1
|
||||
%114 = OpLoad %v2float %113
|
||||
%116 = OpAccessChain %_ptr_Uniform_v2float %107 %uint_2
|
||||
%117 = OpLoad %v2float %116
|
||||
%118 = OpCompositeConstruct %mat3v2float %111 %114 %117
|
||||
OpReturnValue %118
|
||||
OpFunctionEnd
|
||||
%f = OpFunction %void None %119
|
||||
%122 = OpLabel
|
||||
%125 = OpAccessChain %_ptr_Uniform__arr_Outer_std140_uint_4 %a %uint_0
|
||||
%126 = OpLoad %_arr_Outer_std140_uint_4 %125
|
||||
%123 = OpFunctionCall %_arr_Outer_uint_4 %conv_arr_4_Outer %126
|
||||
%129 = OpAccessChain %_ptr_Uniform_Outer_std140 %a %uint_0 %uint_3
|
||||
%130 = OpLoad %Outer_std140 %129
|
||||
%127 = OpFunctionCall %Outer %conv_Outer %130
|
||||
%133 = OpAccessChain %_ptr_Uniform__arr_Inner_std140_uint_4 %a %uint_0 %uint_3 %uint_0
|
||||
%134 = OpLoad %_arr_Inner_std140_uint_4 %133
|
||||
%131 = OpFunctionCall %_arr_Inner_uint_4 %conv_arr_4_Inner %134
|
||||
%136 = OpAccessChain %_ptr_Uniform_Inner_std140 %a %uint_0 %uint_3 %uint_0 %uint_2
|
||||
%137 = OpLoad %Inner_std140 %136
|
||||
%135 = OpFunctionCall %Inner %conv_Inner %137
|
||||
%138 = OpFunctionCall %mat3v2float %load_a_inner_3_a_2_m
|
||||
%139 = OpAccessChain %_ptr_Uniform_v2float %a %uint_0 %uint_3 %uint_0 %uint_2 %uint_1
|
||||
%140 = OpLoad %v2float %139
|
||||
%142 = OpAccessChain %_ptr_Uniform_float %a %uint_0 %uint_3 %uint_0 %uint_2 %uint_1 %33
|
||||
%143 = OpLoad %float %142
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,27 @@
|
||||
struct Inner {
|
||||
@size(64)
|
||||
m : mat3x2<f32>,
|
||||
}
|
||||
|
||||
struct Outer {
|
||||
a : array<Inner, 4>,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<uniform> a : array<Outer, 4>;
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn f() {
|
||||
let p_a = &(a);
|
||||
let p_a_3 = &((*(p_a))[3]);
|
||||
let p_a_3_a = &((*(p_a_3)).a);
|
||||
let p_a_3_a_2 = &((*(p_a_3_a))[2]);
|
||||
let p_a_3_a_2_m = &((*(p_a_3_a_2)).m);
|
||||
let p_a_3_a_2_m_1 = &((*(p_a_3_a_2_m))[1]);
|
||||
let l_a : array<Outer, 4> = *(p_a);
|
||||
let l_a_3 : Outer = *(p_a_3);
|
||||
let l_a_3_a : array<Inner, 4> = *(p_a_3_a);
|
||||
let l_a_3_a_2 : Inner = *(p_a_3_a_2);
|
||||
let l_a_3_a_2_m : mat3x2<f32> = *(p_a_3_a_2_m);
|
||||
let l_a_3_a_2_m_1 : vec2<f32> = *(p_a_3_a_2_m_1);
|
||||
let l_a_3_a_2_m_1_0 : f32 = (*(p_a_3_a_2_m_1))[0];
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
struct S {
|
||||
before : i32,
|
||||
@size(32) m : mat3x2<f32>,
|
||||
after : i32,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<uniform> u : array<S, 4>;
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn f() {
|
||||
let t = transpose(u[2].m);
|
||||
let l = length(u[0].m[1].yx);
|
||||
let a = abs(u[0].m[1].yx.x);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
cbuffer cbuffer_u : register(b0, space0) {
|
||||
uint4 u[12];
|
||||
};
|
||||
|
||||
float3x2 tint_symbol(uint4 buffer[12], uint offset) {
|
||||
const uint scalar_offset = ((offset + 0u)) / 4;
|
||||
uint4 ubo_load = buffer[scalar_offset / 4];
|
||||
const uint scalar_offset_1 = ((offset + 8u)) / 4;
|
||||
uint4 ubo_load_1 = buffer[scalar_offset_1 / 4];
|
||||
const uint scalar_offset_2 = ((offset + 16u)) / 4;
|
||||
uint4 ubo_load_2 = buffer[scalar_offset_2 / 4];
|
||||
return float3x2(asfloat(((scalar_offset & 2) ? ubo_load.zw : ubo_load.xy)), asfloat(((scalar_offset_1 & 2) ? ubo_load_1.zw : ubo_load_1.xy)), asfloat(((scalar_offset_2 & 2) ? ubo_load_2.zw : ubo_load_2.xy)));
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void f() {
|
||||
const float2x3 t = transpose(tint_symbol(u, 104u));
|
||||
const float l = length(asfloat(u[1].xy).yx);
|
||||
const float a = abs(asfloat(u[1].xy).yx.x);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
cbuffer cbuffer_u : register(b0, space0) {
|
||||
uint4 u[12];
|
||||
};
|
||||
|
||||
float3x2 tint_symbol(uint4 buffer[12], uint offset) {
|
||||
const uint scalar_offset = ((offset + 0u)) / 4;
|
||||
uint4 ubo_load = buffer[scalar_offset / 4];
|
||||
const uint scalar_offset_1 = ((offset + 8u)) / 4;
|
||||
uint4 ubo_load_1 = buffer[scalar_offset_1 / 4];
|
||||
const uint scalar_offset_2 = ((offset + 16u)) / 4;
|
||||
uint4 ubo_load_2 = buffer[scalar_offset_2 / 4];
|
||||
return float3x2(asfloat(((scalar_offset & 2) ? ubo_load.zw : ubo_load.xy)), asfloat(((scalar_offset_1 & 2) ? ubo_load_1.zw : ubo_load_1.xy)), asfloat(((scalar_offset_2 & 2) ? ubo_load_2.zw : ubo_load_2.xy)));
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void f() {
|
||||
const float2x3 t = transpose(tint_symbol(u, 104u));
|
||||
const float l = length(asfloat(u[1].xy).yx);
|
||||
const float a = abs(asfloat(u[1].xy).yx.x);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
#version 310 es
|
||||
|
||||
struct S {
|
||||
int before;
|
||||
uint pad;
|
||||
mat3x2 m;
|
||||
uint pad_1;
|
||||
uint pad_2;
|
||||
int after;
|
||||
uint pad_3;
|
||||
};
|
||||
|
||||
struct S_std140 {
|
||||
int before;
|
||||
uint pad;
|
||||
vec2 m_0;
|
||||
vec2 m_1;
|
||||
vec2 m_2;
|
||||
uint pad_1;
|
||||
uint pad_2;
|
||||
int after;
|
||||
uint pad_3;
|
||||
};
|
||||
|
||||
layout(binding = 0, std140) uniform u_block_std140_ubo {
|
||||
S_std140 inner[4];
|
||||
} u;
|
||||
|
||||
mat3x2 load_u_inner_2_m() {
|
||||
return mat3x2(u.inner[2u].m_0, u.inner[2u].m_1, u.inner[2u].m_2);
|
||||
}
|
||||
|
||||
void f() {
|
||||
mat2x3 t = transpose(load_u_inner_2_m());
|
||||
float l = length(u.inner[0u].m_1.yx);
|
||||
float a = abs(u.inner[0u].m_1.yx[0u]);
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
f();
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
template<typename T, size_t N>
|
||||
struct tint_array {
|
||||
const constant T& operator[](size_t i) const constant { return elements[i]; }
|
||||
device T& operator[](size_t i) device { return elements[i]; }
|
||||
const device T& operator[](size_t i) const device { return elements[i]; }
|
||||
thread T& operator[](size_t i) thread { return elements[i]; }
|
||||
const thread T& operator[](size_t i) const thread { return elements[i]; }
|
||||
threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
|
||||
const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
|
||||
T elements[N];
|
||||
};
|
||||
|
||||
struct S {
|
||||
/* 0x0000 */ int before;
|
||||
/* 0x0004 */ tint_array<int8_t, 4> tint_pad;
|
||||
/* 0x0008 */ float3x2 m;
|
||||
/* 0x0020 */ tint_array<int8_t, 8> tint_pad_1;
|
||||
/* 0x0028 */ int after;
|
||||
/* 0x002c */ tint_array<int8_t, 4> tint_pad_2;
|
||||
};
|
||||
|
||||
kernel void f(const constant tint_array<S, 4>* tint_symbol [[buffer(0)]]) {
|
||||
float2x3 const t = transpose((*(tint_symbol))[2].m);
|
||||
float const l = length(float2((*(tint_symbol))[0].m[1]).yx);
|
||||
float const a = fabs(float2((*(tint_symbol))[0].m[1]).yx[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 52
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%42 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %f "f"
|
||||
OpExecutionMode %f LocalSize 1 1 1
|
||||
OpName %u_block_std140 "u_block_std140"
|
||||
OpMemberName %u_block_std140 0 "inner"
|
||||
OpName %S_std140 "S_std140"
|
||||
OpMemberName %S_std140 0 "before"
|
||||
OpMemberName %S_std140 1 "m_0"
|
||||
OpMemberName %S_std140 2 "m_1"
|
||||
OpMemberName %S_std140 3 "m_2"
|
||||
OpMemberName %S_std140 4 "after"
|
||||
OpName %u "u"
|
||||
OpName %load_u_inner_2_m "load_u_inner_2_m"
|
||||
OpName %f "f"
|
||||
OpDecorate %u_block_std140 Block
|
||||
OpMemberDecorate %u_block_std140 0 Offset 0
|
||||
OpMemberDecorate %S_std140 0 Offset 0
|
||||
OpMemberDecorate %S_std140 1 Offset 8
|
||||
OpMemberDecorate %S_std140 2 Offset 16
|
||||
OpMemberDecorate %S_std140 3 Offset 24
|
||||
OpMemberDecorate %S_std140 4 Offset 40
|
||||
OpDecorate %_arr_S_std140_uint_4 ArrayStride 48
|
||||
OpDecorate %u NonWritable
|
||||
OpDecorate %u DescriptorSet 0
|
||||
OpDecorate %u Binding 0
|
||||
%int = OpTypeInt 32 1
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%S_std140 = OpTypeStruct %int %v2float %v2float %v2float %int
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%_arr_S_std140_uint_4 = OpTypeArray %S_std140 %uint_4
|
||||
%u_block_std140 = OpTypeStruct %_arr_S_std140_uint_4
|
||||
%_ptr_Uniform_u_block_std140 = OpTypePointer Uniform %u_block_std140
|
||||
%u = OpVariable %_ptr_Uniform_u_block_std140 Uniform
|
||||
%mat3v2float = OpTypeMatrix %v2float 3
|
||||
%11 = OpTypeFunction %mat3v2float
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%void = OpTypeVoid
|
||||
%33 = OpTypeFunction %void
|
||||
%v3float = OpTypeVector %float 3
|
||||
%mat2v3float = OpTypeMatrix %v3float 2
|
||||
%43 = OpConstantNull %uint
|
||||
%load_u_inner_2_m = OpFunction %mat3v2float None %11
|
||||
%14 = OpLabel
|
||||
%19 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
|
||||
%23 = OpAccessChain %_ptr_Uniform_v2float %19 %uint_1
|
||||
%24 = OpLoad %v2float %23
|
||||
%26 = OpAccessChain %_ptr_Uniform_v2float %19 %uint_2
|
||||
%27 = OpLoad %v2float %26
|
||||
%30 = OpAccessChain %_ptr_Uniform_v2float %19 %uint_3
|
||||
%31 = OpLoad %v2float %30
|
||||
%32 = OpCompositeConstruct %mat3v2float %24 %27 %31
|
||||
OpReturnValue %32
|
||||
OpFunctionEnd
|
||||
%f = OpFunction %void None %33
|
||||
%36 = OpLabel
|
||||
%40 = OpFunctionCall %mat3v2float %load_u_inner_2_m
|
||||
%37 = OpTranspose %mat2v3float %40
|
||||
%44 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0 %43 %uint_2
|
||||
%45 = OpLoad %v2float %44
|
||||
%46 = OpVectorShuffle %v2float %45 %45 1 0
|
||||
%41 = OpExtInst %float %42 Length %46
|
||||
%48 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0 %43 %uint_2
|
||||
%49 = OpLoad %v2float %48
|
||||
%50 = OpVectorShuffle %v2float %49 %49 1 0
|
||||
%51 = OpCompositeExtract %float %50 0
|
||||
%47 = OpExtInst %float %42 FAbs %51
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,15 @@
|
||||
struct S {
|
||||
before : i32,
|
||||
@size(32)
|
||||
m : mat3x2<f32>,
|
||||
after : i32,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<uniform> u : array<S, 4>;
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn f() {
|
||||
let t = transpose(u[2].m);
|
||||
let l = length(u[0].m[1].yx);
|
||||
let a = abs(u[0].m[1].yx.x);
|
||||
}
|
||||
22
test/tint/buffer/uniform/std140/struct/mat3x2/to_fn.wgsl
Normal file
22
test/tint/buffer/uniform/std140/struct/mat3x2/to_fn.wgsl
Normal file
@@ -0,0 +1,22 @@
|
||||
struct S {
|
||||
before : i32,
|
||||
@size(64) m : mat3x2<f32>,
|
||||
after : i32,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<uniform> u : array<S, 4>;
|
||||
|
||||
fn a(a : array<S, 4>) {}
|
||||
fn b(s : S) {}
|
||||
fn c(m : mat3x2<f32>) {}
|
||||
fn d(v : vec2<f32>) {}
|
||||
fn e(f : f32) {}
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn f() {
|
||||
a(u);
|
||||
b(u[2]);
|
||||
c(u[2].m);
|
||||
d(u[0].m[1].yx);
|
||||
e(u[0].m[1].yx.x);
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
struct S {
|
||||
int before;
|
||||
float3x2 m;
|
||||
int after;
|
||||
};
|
||||
|
||||
cbuffer cbuffer_u : register(b0, space0) {
|
||||
uint4 u[20];
|
||||
};
|
||||
|
||||
void a(S a_1[4]) {
|
||||
}
|
||||
|
||||
void b(S s) {
|
||||
}
|
||||
|
||||
void c(float3x2 m) {
|
||||
}
|
||||
|
||||
void d(float2 v) {
|
||||
}
|
||||
|
||||
void e(float f_1) {
|
||||
}
|
||||
|
||||
float3x2 tint_symbol_3(uint4 buffer[20], uint offset) {
|
||||
const uint scalar_offset = ((offset + 0u)) / 4;
|
||||
uint4 ubo_load = buffer[scalar_offset / 4];
|
||||
const uint scalar_offset_1 = ((offset + 8u)) / 4;
|
||||
uint4 ubo_load_1 = buffer[scalar_offset_1 / 4];
|
||||
const uint scalar_offset_2 = ((offset + 16u)) / 4;
|
||||
uint4 ubo_load_2 = buffer[scalar_offset_2 / 4];
|
||||
return float3x2(asfloat(((scalar_offset & 2) ? ubo_load.zw : ubo_load.xy)), asfloat(((scalar_offset_1 & 2) ? ubo_load_1.zw : ubo_load_1.xy)), asfloat(((scalar_offset_2 & 2) ? ubo_load_2.zw : ubo_load_2.xy)));
|
||||
}
|
||||
|
||||
S tint_symbol_1(uint4 buffer[20], uint offset) {
|
||||
const uint scalar_offset_3 = ((offset + 0u)) / 4;
|
||||
const uint scalar_offset_4 = ((offset + 72u)) / 4;
|
||||
const S tint_symbol_5 = {asint(buffer[scalar_offset_3 / 4][scalar_offset_3 % 4]), tint_symbol_3(buffer, (offset + 8u)), asint(buffer[scalar_offset_4 / 4][scalar_offset_4 % 4])};
|
||||
return tint_symbol_5;
|
||||
}
|
||||
|
||||
typedef S tint_symbol_ret[4];
|
||||
tint_symbol_ret tint_symbol(uint4 buffer[20], uint offset) {
|
||||
S arr[4] = (S[4])0;
|
||||
{
|
||||
[loop] for(uint i = 0u; (i < 4u); i = (i + 1u)) {
|
||||
arr[i] = tint_symbol_1(buffer, (offset + (i * 80u)));
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void f() {
|
||||
a(tint_symbol(u, 0u));
|
||||
b(tint_symbol_1(u, 160u));
|
||||
c(tint_symbol_3(u, 168u));
|
||||
d(asfloat(u[1].xy).yx);
|
||||
e(asfloat(u[1].xy).yx.x);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
struct S {
|
||||
int before;
|
||||
float3x2 m;
|
||||
int after;
|
||||
};
|
||||
|
||||
cbuffer cbuffer_u : register(b0, space0) {
|
||||
uint4 u[20];
|
||||
};
|
||||
|
||||
void a(S a_1[4]) {
|
||||
}
|
||||
|
||||
void b(S s) {
|
||||
}
|
||||
|
||||
void c(float3x2 m) {
|
||||
}
|
||||
|
||||
void d(float2 v) {
|
||||
}
|
||||
|
||||
void e(float f_1) {
|
||||
}
|
||||
|
||||
float3x2 tint_symbol_3(uint4 buffer[20], uint offset) {
|
||||
const uint scalar_offset = ((offset + 0u)) / 4;
|
||||
uint4 ubo_load = buffer[scalar_offset / 4];
|
||||
const uint scalar_offset_1 = ((offset + 8u)) / 4;
|
||||
uint4 ubo_load_1 = buffer[scalar_offset_1 / 4];
|
||||
const uint scalar_offset_2 = ((offset + 16u)) / 4;
|
||||
uint4 ubo_load_2 = buffer[scalar_offset_2 / 4];
|
||||
return float3x2(asfloat(((scalar_offset & 2) ? ubo_load.zw : ubo_load.xy)), asfloat(((scalar_offset_1 & 2) ? ubo_load_1.zw : ubo_load_1.xy)), asfloat(((scalar_offset_2 & 2) ? ubo_load_2.zw : ubo_load_2.xy)));
|
||||
}
|
||||
|
||||
S tint_symbol_1(uint4 buffer[20], uint offset) {
|
||||
const uint scalar_offset_3 = ((offset + 0u)) / 4;
|
||||
const uint scalar_offset_4 = ((offset + 72u)) / 4;
|
||||
const S tint_symbol_5 = {asint(buffer[scalar_offset_3 / 4][scalar_offset_3 % 4]), tint_symbol_3(buffer, (offset + 8u)), asint(buffer[scalar_offset_4 / 4][scalar_offset_4 % 4])};
|
||||
return tint_symbol_5;
|
||||
}
|
||||
|
||||
typedef S tint_symbol_ret[4];
|
||||
tint_symbol_ret tint_symbol(uint4 buffer[20], uint offset) {
|
||||
S arr[4] = (S[4])0;
|
||||
{
|
||||
[loop] for(uint i = 0u; (i < 4u); i = (i + 1u)) {
|
||||
arr[i] = tint_symbol_1(buffer, (offset + (i * 80u)));
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void f() {
|
||||
a(tint_symbol(u, 0u));
|
||||
b(tint_symbol_1(u, 160u));
|
||||
c(tint_symbol_3(u, 168u));
|
||||
d(asfloat(u[1].xy).yx);
|
||||
e(asfloat(u[1].xy).yx.x);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
#version 310 es
|
||||
|
||||
struct S {
|
||||
int before;
|
||||
uint pad;
|
||||
mat3x2 m;
|
||||
uint pad_1;
|
||||
uint pad_2;
|
||||
uint pad_3;
|
||||
uint pad_4;
|
||||
uint pad_5;
|
||||
uint pad_6;
|
||||
uint pad_7;
|
||||
uint pad_8;
|
||||
uint pad_9;
|
||||
uint pad_10;
|
||||
int after;
|
||||
uint pad_11;
|
||||
};
|
||||
|
||||
struct S_std140 {
|
||||
int before;
|
||||
uint pad;
|
||||
vec2 m_0;
|
||||
vec2 m_1;
|
||||
vec2 m_2;
|
||||
uint pad_1;
|
||||
uint pad_2;
|
||||
uint pad_3;
|
||||
uint pad_4;
|
||||
uint pad_5;
|
||||
uint pad_6;
|
||||
uint pad_7;
|
||||
uint pad_8;
|
||||
uint pad_9;
|
||||
uint pad_10;
|
||||
int after;
|
||||
uint pad_11;
|
||||
};
|
||||
|
||||
layout(binding = 0, std140) uniform u_block_std140_ubo {
|
||||
S_std140 inner[4];
|
||||
} u;
|
||||
|
||||
void a(S a_1[4]) {
|
||||
}
|
||||
|
||||
void b(S s) {
|
||||
}
|
||||
|
||||
void c(mat3x2 m) {
|
||||
}
|
||||
|
||||
void d(vec2 v) {
|
||||
}
|
||||
|
||||
void e(float f_1) {
|
||||
}
|
||||
|
||||
S conv_S(S_std140 val) {
|
||||
return S(val.before, val.pad, mat3x2(val.m_0, val.m_1, val.m_2), val.pad_1, val.pad_2, val.pad_3, val.pad_4, val.pad_5, val.pad_6, val.pad_7, val.pad_8, val.pad_9, val.pad_10, val.after, val.pad_11);
|
||||
}
|
||||
|
||||
S[4] conv_arr_4_S(S_std140 val[4]) {
|
||||
S arr[4] = S[4](S(0, 0u, mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0, 0u), S(0, 0u, mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0, 0u), S(0, 0u, mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0, 0u), S(0, 0u, mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0, 0u));
|
||||
{
|
||||
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
|
||||
arr[i] = conv_S(val[i]);
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
mat3x2 load_u_inner_2_m() {
|
||||
return mat3x2(u.inner[2u].m_0, u.inner[2u].m_1, u.inner[2u].m_2);
|
||||
}
|
||||
|
||||
void f() {
|
||||
a(conv_arr_4_S(u.inner));
|
||||
b(conv_S(u.inner[2u]));
|
||||
c(load_u_inner_2_m());
|
||||
d(u.inner[0u].m_1.yx);
|
||||
e(u.inner[0u].m_1.yx[0u]);
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
f();
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
template<typename T, size_t N>
|
||||
struct tint_array {
|
||||
const constant T& operator[](size_t i) const constant { return elements[i]; }
|
||||
device T& operator[](size_t i) device { return elements[i]; }
|
||||
const device T& operator[](size_t i) const device { return elements[i]; }
|
||||
thread T& operator[](size_t i) thread { return elements[i]; }
|
||||
const thread T& operator[](size_t i) const thread { return elements[i]; }
|
||||
threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
|
||||
const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
|
||||
T elements[N];
|
||||
};
|
||||
|
||||
struct S {
|
||||
/* 0x0000 */ int before;
|
||||
/* 0x0004 */ tint_array<int8_t, 4> tint_pad;
|
||||
/* 0x0008 */ float3x2 m;
|
||||
/* 0x0020 */ tint_array<int8_t, 40> tint_pad_1;
|
||||
/* 0x0048 */ int after;
|
||||
/* 0x004c */ tint_array<int8_t, 4> tint_pad_2;
|
||||
};
|
||||
|
||||
void a(tint_array<S, 4> a_1) {
|
||||
}
|
||||
|
||||
void b(S s) {
|
||||
}
|
||||
|
||||
void c(float3x2 m) {
|
||||
}
|
||||
|
||||
void d(float2 v) {
|
||||
}
|
||||
|
||||
void e(float f_1) {
|
||||
}
|
||||
|
||||
kernel void f(const constant tint_array<S, 4>* tint_symbol [[buffer(0)]]) {
|
||||
a(*(tint_symbol));
|
||||
b((*(tint_symbol))[2]);
|
||||
c((*(tint_symbol))[2].m);
|
||||
d(float2((*(tint_symbol))[0].m[1]).yx);
|
||||
e(float2((*(tint_symbol))[0].m[1]).yx[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,206 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 124
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %f "f"
|
||||
OpExecutionMode %f LocalSize 1 1 1
|
||||
OpName %u_block_std140 "u_block_std140"
|
||||
OpMemberName %u_block_std140 0 "inner"
|
||||
OpName %S_std140 "S_std140"
|
||||
OpMemberName %S_std140 0 "before"
|
||||
OpMemberName %S_std140 1 "m_0"
|
||||
OpMemberName %S_std140 2 "m_1"
|
||||
OpMemberName %S_std140 3 "m_2"
|
||||
OpMemberName %S_std140 4 "after"
|
||||
OpName %u "u"
|
||||
OpName %S "S"
|
||||
OpMemberName %S 0 "before"
|
||||
OpMemberName %S 1 "m"
|
||||
OpMemberName %S 2 "after"
|
||||
OpName %a "a"
|
||||
OpName %a_1 "a_1"
|
||||
OpName %b "b"
|
||||
OpName %s "s"
|
||||
OpName %c "c"
|
||||
OpName %m "m"
|
||||
OpName %d "d"
|
||||
OpName %v "v"
|
||||
OpName %e "e"
|
||||
OpName %f_1 "f_1"
|
||||
OpName %conv_S "conv_S"
|
||||
OpName %val "val"
|
||||
OpName %conv_arr_4_S "conv_arr_4_S"
|
||||
OpName %val_0 "val"
|
||||
OpName %arr "arr"
|
||||
OpName %i "i"
|
||||
OpName %var_for_index "var_for_index"
|
||||
OpName %load_u_inner_2_m "load_u_inner_2_m"
|
||||
OpName %f "f"
|
||||
OpDecorate %u_block_std140 Block
|
||||
OpMemberDecorate %u_block_std140 0 Offset 0
|
||||
OpMemberDecorate %S_std140 0 Offset 0
|
||||
OpMemberDecorate %S_std140 1 Offset 8
|
||||
OpMemberDecorate %S_std140 2 Offset 16
|
||||
OpMemberDecorate %S_std140 3 Offset 24
|
||||
OpMemberDecorate %S_std140 4 Offset 72
|
||||
OpDecorate %_arr_S_std140_uint_4 ArrayStride 80
|
||||
OpDecorate %u NonWritable
|
||||
OpDecorate %u DescriptorSet 0
|
||||
OpDecorate %u Binding 0
|
||||
OpMemberDecorate %S 0 Offset 0
|
||||
OpMemberDecorate %S 1 Offset 8
|
||||
OpMemberDecorate %S 1 ColMajor
|
||||
OpMemberDecorate %S 1 MatrixStride 8
|
||||
OpMemberDecorate %S 2 Offset 72
|
||||
OpDecorate %_arr_S_uint_4 ArrayStride 80
|
||||
%int = OpTypeInt 32 1
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%S_std140 = OpTypeStruct %int %v2float %v2float %v2float %int
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%_arr_S_std140_uint_4 = OpTypeArray %S_std140 %uint_4
|
||||
%u_block_std140 = OpTypeStruct %_arr_S_std140_uint_4
|
||||
%_ptr_Uniform_u_block_std140 = OpTypePointer Uniform %u_block_std140
|
||||
%u = OpVariable %_ptr_Uniform_u_block_std140 Uniform
|
||||
%void = OpTypeVoid
|
||||
%mat3v2float = OpTypeMatrix %v2float 3
|
||||
%S = OpTypeStruct %int %mat3v2float %int
|
||||
%_arr_S_uint_4 = OpTypeArray %S %uint_4
|
||||
%11 = OpTypeFunction %void %_arr_S_uint_4
|
||||
%19 = OpTypeFunction %void %S
|
||||
%23 = OpTypeFunction %void %mat3v2float
|
||||
%27 = OpTypeFunction %void %v2float
|
||||
%31 = OpTypeFunction %void %float
|
||||
%35 = OpTypeFunction %S %S_std140
|
||||
%46 = OpTypeFunction %_arr_S_uint_4 %_arr_S_std140_uint_4
|
||||
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
|
||||
%52 = OpConstantNull %_arr_S_uint_4
|
||||
%_ptr_Function_uint = OpTypePointer Function %uint
|
||||
%55 = OpConstantNull %uint
|
||||
%bool = OpTypeBool
|
||||
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
|
||||
%68 = OpConstantNull %_arr_S_std140_uint_4
|
||||
%_ptr_Function_S = OpTypePointer Function %S
|
||||
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%81 = OpTypeFunction %mat3v2float
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140
|
||||
%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%101 = OpTypeFunction %void
|
||||
%_ptr_Uniform__arr_S_std140_uint_4 = OpTypePointer Uniform %_arr_S_std140_uint_4
|
||||
%a = OpFunction %void None %11
|
||||
%a_1 = OpFunctionParameter %_arr_S_uint_4
|
||||
%18 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%b = OpFunction %void None %19
|
||||
%s = OpFunctionParameter %S
|
||||
%22 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%c = OpFunction %void None %23
|
||||
%m = OpFunctionParameter %mat3v2float
|
||||
%26 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%d = OpFunction %void None %27
|
||||
%v = OpFunctionParameter %v2float
|
||||
%30 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%e = OpFunction %void None %31
|
||||
%f_1 = OpFunctionParameter %float
|
||||
%34 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%conv_S = OpFunction %S None %35
|
||||
%val = OpFunctionParameter %S_std140
|
||||
%38 = OpLabel
|
||||
%39 = OpCompositeExtract %int %val 0
|
||||
%40 = OpCompositeExtract %v2float %val 1
|
||||
%41 = OpCompositeExtract %v2float %val 2
|
||||
%42 = OpCompositeExtract %v2float %val 3
|
||||
%43 = OpCompositeConstruct %mat3v2float %40 %41 %42
|
||||
%44 = OpCompositeExtract %int %val 4
|
||||
%45 = OpCompositeConstruct %S %39 %43 %44
|
||||
OpReturnValue %45
|
||||
OpFunctionEnd
|
||||
%conv_arr_4_S = OpFunction %_arr_S_uint_4 None %46
|
||||
%val_0 = OpFunctionParameter %_arr_S_std140_uint_4
|
||||
%49 = OpLabel
|
||||
%arr = OpVariable %_ptr_Function__arr_S_uint_4 Function %52
|
||||
%i = OpVariable %_ptr_Function_uint Function %55
|
||||
%var_for_index = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function %68
|
||||
OpBranch %56
|
||||
%56 = OpLabel
|
||||
OpLoopMerge %57 %58 None
|
||||
OpBranch %59
|
||||
%59 = OpLabel
|
||||
%61 = OpLoad %uint %i
|
||||
%62 = OpULessThan %bool %61 %uint_4
|
||||
%60 = OpLogicalNot %bool %62
|
||||
OpSelectionMerge %64 None
|
||||
OpBranchConditional %60 %65 %64
|
||||
%65 = OpLabel
|
||||
OpBranch %57
|
||||
%64 = OpLabel
|
||||
OpStore %var_for_index %val_0
|
||||
%69 = OpLoad %uint %i
|
||||
%71 = OpAccessChain %_ptr_Function_S %arr %69
|
||||
%73 = OpLoad %uint %i
|
||||
%75 = OpAccessChain %_ptr_Function_S_std140 %var_for_index %73
|
||||
%76 = OpLoad %S_std140 %75
|
||||
%72 = OpFunctionCall %S %conv_S %76
|
||||
OpStore %71 %72
|
||||
OpBranch %58
|
||||
%58 = OpLabel
|
||||
%77 = OpLoad %uint %i
|
||||
%79 = OpIAdd %uint %77 %uint_1
|
||||
OpStore %i %79
|
||||
OpBranch %56
|
||||
%57 = OpLabel
|
||||
%80 = OpLoad %_arr_S_uint_4 %arr
|
||||
OpReturnValue %80
|
||||
OpFunctionEnd
|
||||
%load_u_inner_2_m = OpFunction %mat3v2float None %81
|
||||
%83 = OpLabel
|
||||
%88 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
|
||||
%91 = OpAccessChain %_ptr_Uniform_v2float %88 %uint_1
|
||||
%92 = OpLoad %v2float %91
|
||||
%94 = OpAccessChain %_ptr_Uniform_v2float %88 %uint_2
|
||||
%95 = OpLoad %v2float %94
|
||||
%98 = OpAccessChain %_ptr_Uniform_v2float %88 %uint_3
|
||||
%99 = OpLoad %v2float %98
|
||||
%100 = OpCompositeConstruct %mat3v2float %92 %95 %99
|
||||
OpReturnValue %100
|
||||
OpFunctionEnd
|
||||
%f = OpFunction %void None %101
|
||||
%103 = OpLabel
|
||||
%107 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %u %uint_0
|
||||
%108 = OpLoad %_arr_S_std140_uint_4 %107
|
||||
%105 = OpFunctionCall %_arr_S_uint_4 %conv_arr_4_S %108
|
||||
%104 = OpFunctionCall %void %a %105
|
||||
%111 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
|
||||
%112 = OpLoad %S_std140 %111
|
||||
%110 = OpFunctionCall %S %conv_S %112
|
||||
%109 = OpFunctionCall %void %b %110
|
||||
%114 = OpFunctionCall %mat3v2float %load_u_inner_2_m
|
||||
%113 = OpFunctionCall %void %c %114
|
||||
%116 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0 %55 %uint_2
|
||||
%117 = OpLoad %v2float %116
|
||||
%118 = OpVectorShuffle %v2float %117 %117 1 0
|
||||
%115 = OpFunctionCall %void %d %118
|
||||
%120 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0 %55 %uint_2
|
||||
%121 = OpLoad %v2float %120
|
||||
%122 = OpVectorShuffle %v2float %121 %121 1 0
|
||||
%123 = OpCompositeExtract %float %122 0
|
||||
%119 = OpFunctionCall %void %e %123
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,32 @@
|
||||
struct S {
|
||||
before : i32,
|
||||
@size(64)
|
||||
m : mat3x2<f32>,
|
||||
after : i32,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<uniform> u : array<S, 4>;
|
||||
|
||||
fn a(a : array<S, 4>) {
|
||||
}
|
||||
|
||||
fn b(s : S) {
|
||||
}
|
||||
|
||||
fn c(m : mat3x2<f32>) {
|
||||
}
|
||||
|
||||
fn d(v : vec2<f32>) {
|
||||
}
|
||||
|
||||
fn e(f : f32) {
|
||||
}
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn f() {
|
||||
a(u);
|
||||
b(u[2]);
|
||||
c(u[2].m);
|
||||
d(u[0].m[1].yx);
|
||||
e(u[0].m[1].yx.x);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
struct S {
|
||||
before : i32,
|
||||
@size(64) m : mat3x2<f32>,
|
||||
after : i32,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<uniform> u : array<S, 4>;
|
||||
var<private> p : array<S, 4>;
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn f() {
|
||||
p = u;
|
||||
p[1] = u[2];
|
||||
p[3].m = u[2].m;
|
||||
p[1].m[0] = u[0].m[1].yx;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
struct S {
|
||||
int before;
|
||||
float3x2 m;
|
||||
int after;
|
||||
};
|
||||
|
||||
cbuffer cbuffer_u : register(b0, space0) {
|
||||
uint4 u[20];
|
||||
};
|
||||
static S p[4] = (S[4])0;
|
||||
|
||||
float3x2 tint_symbol_3(uint4 buffer[20], uint offset) {
|
||||
const uint scalar_offset = ((offset + 0u)) / 4;
|
||||
uint4 ubo_load = buffer[scalar_offset / 4];
|
||||
const uint scalar_offset_1 = ((offset + 8u)) / 4;
|
||||
uint4 ubo_load_1 = buffer[scalar_offset_1 / 4];
|
||||
const uint scalar_offset_2 = ((offset + 16u)) / 4;
|
||||
uint4 ubo_load_2 = buffer[scalar_offset_2 / 4];
|
||||
return float3x2(asfloat(((scalar_offset & 2) ? ubo_load.zw : ubo_load.xy)), asfloat(((scalar_offset_1 & 2) ? ubo_load_1.zw : ubo_load_1.xy)), asfloat(((scalar_offset_2 & 2) ? ubo_load_2.zw : ubo_load_2.xy)));
|
||||
}
|
||||
|
||||
S tint_symbol_1(uint4 buffer[20], uint offset) {
|
||||
const uint scalar_offset_3 = ((offset + 0u)) / 4;
|
||||
const uint scalar_offset_4 = ((offset + 72u)) / 4;
|
||||
const S tint_symbol_5 = {asint(buffer[scalar_offset_3 / 4][scalar_offset_3 % 4]), tint_symbol_3(buffer, (offset + 8u)), asint(buffer[scalar_offset_4 / 4][scalar_offset_4 % 4])};
|
||||
return tint_symbol_5;
|
||||
}
|
||||
|
||||
typedef S tint_symbol_ret[4];
|
||||
tint_symbol_ret tint_symbol(uint4 buffer[20], uint offset) {
|
||||
S arr[4] = (S[4])0;
|
||||
{
|
||||
[loop] for(uint i = 0u; (i < 4u); i = (i + 1u)) {
|
||||
arr[i] = tint_symbol_1(buffer, (offset + (i * 80u)));
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void f() {
|
||||
p = tint_symbol(u, 0u);
|
||||
p[1] = tint_symbol_1(u, 160u);
|
||||
p[3].m = tint_symbol_3(u, 168u);
|
||||
p[1].m[0] = asfloat(u[1].xy).yx;
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
struct S {
|
||||
int before;
|
||||
float3x2 m;
|
||||
int after;
|
||||
};
|
||||
|
||||
cbuffer cbuffer_u : register(b0, space0) {
|
||||
uint4 u[20];
|
||||
};
|
||||
static S p[4] = (S[4])0;
|
||||
|
||||
float3x2 tint_symbol_3(uint4 buffer[20], uint offset) {
|
||||
const uint scalar_offset = ((offset + 0u)) / 4;
|
||||
uint4 ubo_load = buffer[scalar_offset / 4];
|
||||
const uint scalar_offset_1 = ((offset + 8u)) / 4;
|
||||
uint4 ubo_load_1 = buffer[scalar_offset_1 / 4];
|
||||
const uint scalar_offset_2 = ((offset + 16u)) / 4;
|
||||
uint4 ubo_load_2 = buffer[scalar_offset_2 / 4];
|
||||
return float3x2(asfloat(((scalar_offset & 2) ? ubo_load.zw : ubo_load.xy)), asfloat(((scalar_offset_1 & 2) ? ubo_load_1.zw : ubo_load_1.xy)), asfloat(((scalar_offset_2 & 2) ? ubo_load_2.zw : ubo_load_2.xy)));
|
||||
}
|
||||
|
||||
S tint_symbol_1(uint4 buffer[20], uint offset) {
|
||||
const uint scalar_offset_3 = ((offset + 0u)) / 4;
|
||||
const uint scalar_offset_4 = ((offset + 72u)) / 4;
|
||||
const S tint_symbol_5 = {asint(buffer[scalar_offset_3 / 4][scalar_offset_3 % 4]), tint_symbol_3(buffer, (offset + 8u)), asint(buffer[scalar_offset_4 / 4][scalar_offset_4 % 4])};
|
||||
return tint_symbol_5;
|
||||
}
|
||||
|
||||
typedef S tint_symbol_ret[4];
|
||||
tint_symbol_ret tint_symbol(uint4 buffer[20], uint offset) {
|
||||
S arr[4] = (S[4])0;
|
||||
{
|
||||
[loop] for(uint i = 0u; (i < 4u); i = (i + 1u)) {
|
||||
arr[i] = tint_symbol_1(buffer, (offset + (i * 80u)));
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void f() {
|
||||
p = tint_symbol(u, 0u);
|
||||
p[1] = tint_symbol_1(u, 160u);
|
||||
p[3].m = tint_symbol_3(u, 168u);
|
||||
p[1].m[0] = asfloat(u[1].xy).yx;
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
#version 310 es
|
||||
|
||||
struct S {
|
||||
int before;
|
||||
uint pad;
|
||||
mat3x2 m;
|
||||
uint pad_1;
|
||||
uint pad_2;
|
||||
uint pad_3;
|
||||
uint pad_4;
|
||||
uint pad_5;
|
||||
uint pad_6;
|
||||
uint pad_7;
|
||||
uint pad_8;
|
||||
uint pad_9;
|
||||
uint pad_10;
|
||||
int after;
|
||||
uint pad_11;
|
||||
};
|
||||
|
||||
struct S_std140 {
|
||||
int before;
|
||||
uint pad;
|
||||
vec2 m_0;
|
||||
vec2 m_1;
|
||||
vec2 m_2;
|
||||
uint pad_1;
|
||||
uint pad_2;
|
||||
uint pad_3;
|
||||
uint pad_4;
|
||||
uint pad_5;
|
||||
uint pad_6;
|
||||
uint pad_7;
|
||||
uint pad_8;
|
||||
uint pad_9;
|
||||
uint pad_10;
|
||||
int after;
|
||||
uint pad_11;
|
||||
};
|
||||
|
||||
layout(binding = 0, std140) uniform u_block_std140_ubo {
|
||||
S_std140 inner[4];
|
||||
} u;
|
||||
|
||||
S p[4] = S[4](S(0, 0u, mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0, 0u), S(0, 0u, mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0, 0u), S(0, 0u, mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0, 0u), S(0, 0u, mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0, 0u));
|
||||
S conv_S(S_std140 val) {
|
||||
return S(val.before, val.pad, mat3x2(val.m_0, val.m_1, val.m_2), val.pad_1, val.pad_2, val.pad_3, val.pad_4, val.pad_5, val.pad_6, val.pad_7, val.pad_8, val.pad_9, val.pad_10, val.after, val.pad_11);
|
||||
}
|
||||
|
||||
S[4] conv_arr_4_S(S_std140 val[4]) {
|
||||
S arr[4] = S[4](S(0, 0u, mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0, 0u), S(0, 0u, mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0, 0u), S(0, 0u, mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0, 0u), S(0, 0u, mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0, 0u));
|
||||
{
|
||||
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
|
||||
arr[i] = conv_S(val[i]);
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
mat3x2 load_u_inner_2_m() {
|
||||
return mat3x2(u.inner[2u].m_0, u.inner[2u].m_1, u.inner[2u].m_2);
|
||||
}
|
||||
|
||||
void f() {
|
||||
p = conv_arr_4_S(u.inner);
|
||||
p[1] = conv_S(u.inner[2u]);
|
||||
p[3].m = load_u_inner_2_m();
|
||||
p[1].m[0] = u.inner[0u].m_1.yx;
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
f();
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
template<typename T, size_t N>
|
||||
struct tint_array {
|
||||
const constant T& operator[](size_t i) const constant { return elements[i]; }
|
||||
device T& operator[](size_t i) device { return elements[i]; }
|
||||
const device T& operator[](size_t i) const device { return elements[i]; }
|
||||
thread T& operator[](size_t i) thread { return elements[i]; }
|
||||
const thread T& operator[](size_t i) const thread { return elements[i]; }
|
||||
threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
|
||||
const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
|
||||
T elements[N];
|
||||
};
|
||||
|
||||
struct S {
|
||||
/* 0x0000 */ int before;
|
||||
/* 0x0004 */ tint_array<int8_t, 4> tint_pad;
|
||||
/* 0x0008 */ float3x2 m;
|
||||
/* 0x0020 */ tint_array<int8_t, 40> tint_pad_1;
|
||||
/* 0x0048 */ int after;
|
||||
/* 0x004c */ tint_array<int8_t, 4> tint_pad_2;
|
||||
};
|
||||
|
||||
kernel void f(const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) {
|
||||
thread tint_array<S, 4> tint_symbol = {};
|
||||
tint_symbol = *(tint_symbol_1);
|
||||
tint_symbol[1] = (*(tint_symbol_1))[2];
|
||||
tint_symbol[3].m = (*(tint_symbol_1))[2].m;
|
||||
tint_symbol[1].m[0] = float2((*(tint_symbol_1))[0].m[1]).yx;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,173 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 106
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %f "f"
|
||||
OpExecutionMode %f LocalSize 1 1 1
|
||||
OpName %u_block_std140 "u_block_std140"
|
||||
OpMemberName %u_block_std140 0 "inner"
|
||||
OpName %S_std140 "S_std140"
|
||||
OpMemberName %S_std140 0 "before"
|
||||
OpMemberName %S_std140 1 "m_0"
|
||||
OpMemberName %S_std140 2 "m_1"
|
||||
OpMemberName %S_std140 3 "m_2"
|
||||
OpMemberName %S_std140 4 "after"
|
||||
OpName %u "u"
|
||||
OpName %S "S"
|
||||
OpMemberName %S 0 "before"
|
||||
OpMemberName %S 1 "m"
|
||||
OpMemberName %S 2 "after"
|
||||
OpName %p "p"
|
||||
OpName %conv_S "conv_S"
|
||||
OpName %val "val"
|
||||
OpName %conv_arr_4_S "conv_arr_4_S"
|
||||
OpName %val_0 "val"
|
||||
OpName %arr "arr"
|
||||
OpName %i "i"
|
||||
OpName %var_for_index "var_for_index"
|
||||
OpName %load_u_inner_2_m "load_u_inner_2_m"
|
||||
OpName %f "f"
|
||||
OpDecorate %u_block_std140 Block
|
||||
OpMemberDecorate %u_block_std140 0 Offset 0
|
||||
OpMemberDecorate %S_std140 0 Offset 0
|
||||
OpMemberDecorate %S_std140 1 Offset 8
|
||||
OpMemberDecorate %S_std140 2 Offset 16
|
||||
OpMemberDecorate %S_std140 3 Offset 24
|
||||
OpMemberDecorate %S_std140 4 Offset 72
|
||||
OpDecorate %_arr_S_std140_uint_4 ArrayStride 80
|
||||
OpDecorate %u NonWritable
|
||||
OpDecorate %u DescriptorSet 0
|
||||
OpDecorate %u Binding 0
|
||||
OpMemberDecorate %S 0 Offset 0
|
||||
OpMemberDecorate %S 1 Offset 8
|
||||
OpMemberDecorate %S 1 ColMajor
|
||||
OpMemberDecorate %S 1 MatrixStride 8
|
||||
OpMemberDecorate %S 2 Offset 72
|
||||
OpDecorate %_arr_S_uint_4 ArrayStride 80
|
||||
%int = OpTypeInt 32 1
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%S_std140 = OpTypeStruct %int %v2float %v2float %v2float %int
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%_arr_S_std140_uint_4 = OpTypeArray %S_std140 %uint_4
|
||||
%u_block_std140 = OpTypeStruct %_arr_S_std140_uint_4
|
||||
%_ptr_Uniform_u_block_std140 = OpTypePointer Uniform %u_block_std140
|
||||
%u = OpVariable %_ptr_Uniform_u_block_std140 Uniform
|
||||
%mat3v2float = OpTypeMatrix %v2float 3
|
||||
%S = OpTypeStruct %int %mat3v2float %int
|
||||
%_arr_S_uint_4 = OpTypeArray %S %uint_4
|
||||
%_ptr_Private__arr_S_uint_4 = OpTypePointer Private %_arr_S_uint_4
|
||||
%16 = OpConstantNull %_arr_S_uint_4
|
||||
%p = OpVariable %_ptr_Private__arr_S_uint_4 Private %16
|
||||
%17 = OpTypeFunction %S %S_std140
|
||||
%28 = OpTypeFunction %_arr_S_uint_4 %_arr_S_std140_uint_4
|
||||
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
|
||||
%_ptr_Function_uint = OpTypePointer Function %uint
|
||||
%36 = OpConstantNull %uint
|
||||
%bool = OpTypeBool
|
||||
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
|
||||
%49 = OpConstantNull %_arr_S_std140_uint_4
|
||||
%_ptr_Function_S = OpTypePointer Function %S
|
||||
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%62 = OpTypeFunction %mat3v2float
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140
|
||||
%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%void = OpTypeVoid
|
||||
%82 = OpTypeFunction %void
|
||||
%_ptr_Uniform__arr_S_std140_uint_4 = OpTypePointer Uniform %_arr_S_std140_uint_4
|
||||
%int_1 = OpConstant %int 1
|
||||
%_ptr_Private_S = OpTypePointer Private %S
|
||||
%int_3 = OpConstant %int 3
|
||||
%_ptr_Private_mat3v2float = OpTypePointer Private %mat3v2float
|
||||
%100 = OpConstantNull %int
|
||||
%_ptr_Private_v2float = OpTypePointer Private %v2float
|
||||
%conv_S = OpFunction %S None %17
|
||||
%val = OpFunctionParameter %S_std140
|
||||
%20 = OpLabel
|
||||
%21 = OpCompositeExtract %int %val 0
|
||||
%22 = OpCompositeExtract %v2float %val 1
|
||||
%23 = OpCompositeExtract %v2float %val 2
|
||||
%24 = OpCompositeExtract %v2float %val 3
|
||||
%25 = OpCompositeConstruct %mat3v2float %22 %23 %24
|
||||
%26 = OpCompositeExtract %int %val 4
|
||||
%27 = OpCompositeConstruct %S %21 %25 %26
|
||||
OpReturnValue %27
|
||||
OpFunctionEnd
|
||||
%conv_arr_4_S = OpFunction %_arr_S_uint_4 None %28
|
||||
%val_0 = OpFunctionParameter %_arr_S_std140_uint_4
|
||||
%31 = OpLabel
|
||||
%arr = OpVariable %_ptr_Function__arr_S_uint_4 Function %16
|
||||
%i = OpVariable %_ptr_Function_uint Function %36
|
||||
%var_for_index = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function %49
|
||||
OpBranch %37
|
||||
%37 = OpLabel
|
||||
OpLoopMerge %38 %39 None
|
||||
OpBranch %40
|
||||
%40 = OpLabel
|
||||
%42 = OpLoad %uint %i
|
||||
%43 = OpULessThan %bool %42 %uint_4
|
||||
%41 = OpLogicalNot %bool %43
|
||||
OpSelectionMerge %45 None
|
||||
OpBranchConditional %41 %46 %45
|
||||
%46 = OpLabel
|
||||
OpBranch %38
|
||||
%45 = OpLabel
|
||||
OpStore %var_for_index %val_0
|
||||
%50 = OpLoad %uint %i
|
||||
%52 = OpAccessChain %_ptr_Function_S %arr %50
|
||||
%54 = OpLoad %uint %i
|
||||
%56 = OpAccessChain %_ptr_Function_S_std140 %var_for_index %54
|
||||
%57 = OpLoad %S_std140 %56
|
||||
%53 = OpFunctionCall %S %conv_S %57
|
||||
OpStore %52 %53
|
||||
OpBranch %39
|
||||
%39 = OpLabel
|
||||
%58 = OpLoad %uint %i
|
||||
%60 = OpIAdd %uint %58 %uint_1
|
||||
OpStore %i %60
|
||||
OpBranch %37
|
||||
%38 = OpLabel
|
||||
%61 = OpLoad %_arr_S_uint_4 %arr
|
||||
OpReturnValue %61
|
||||
OpFunctionEnd
|
||||
%load_u_inner_2_m = OpFunction %mat3v2float None %62
|
||||
%64 = OpLabel
|
||||
%69 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
|
||||
%72 = OpAccessChain %_ptr_Uniform_v2float %69 %uint_1
|
||||
%73 = OpLoad %v2float %72
|
||||
%75 = OpAccessChain %_ptr_Uniform_v2float %69 %uint_2
|
||||
%76 = OpLoad %v2float %75
|
||||
%79 = OpAccessChain %_ptr_Uniform_v2float %69 %uint_3
|
||||
%80 = OpLoad %v2float %79
|
||||
%81 = OpCompositeConstruct %mat3v2float %73 %76 %80
|
||||
OpReturnValue %81
|
||||
OpFunctionEnd
|
||||
%f = OpFunction %void None %82
|
||||
%85 = OpLabel
|
||||
%88 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %u %uint_0
|
||||
%89 = OpLoad %_arr_S_std140_uint_4 %88
|
||||
%86 = OpFunctionCall %_arr_S_uint_4 %conv_arr_4_S %89
|
||||
OpStore %p %86
|
||||
%92 = OpAccessChain %_ptr_Private_S %p %int_1
|
||||
%94 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
|
||||
%95 = OpLoad %S_std140 %94
|
||||
%93 = OpFunctionCall %S %conv_S %95
|
||||
OpStore %92 %93
|
||||
%98 = OpAccessChain %_ptr_Private_mat3v2float %p %int_3 %uint_1
|
||||
%99 = OpFunctionCall %mat3v2float %load_u_inner_2_m
|
||||
OpStore %98 %99
|
||||
%102 = OpAccessChain %_ptr_Private_v2float %p %int_1 %uint_1 %100
|
||||
%103 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0 %36 %uint_2
|
||||
%104 = OpLoad %v2float %103
|
||||
%105 = OpVectorShuffle %v2float %104 %104 1 0
|
||||
OpStore %102 %105
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,18 @@
|
||||
struct S {
|
||||
before : i32,
|
||||
@size(64)
|
||||
m : mat3x2<f32>,
|
||||
after : i32,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<uniform> u : array<S, 4>;
|
||||
|
||||
var<private> p : array<S, 4>;
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn f() {
|
||||
p = u;
|
||||
p[1] = u[2];
|
||||
p[3].m = u[2].m;
|
||||
p[1].m[0] = u[0].m[1].yx;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
struct S {
|
||||
before : i32,
|
||||
@size(64) m : mat3x2<f32>,
|
||||
after : i32,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<uniform> u : array<S, 4>;
|
||||
@group(0) @binding(1) var<storage, read_write> s : array<S, 4>;
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn f() {
|
||||
s = u;
|
||||
s[1] = u[2];
|
||||
s[3].m = u[2].m;
|
||||
s[1].m[0] = u[0].m[1].yx;
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
struct S {
|
||||
int before;
|
||||
float3x2 m;
|
||||
int after;
|
||||
};
|
||||
|
||||
cbuffer cbuffer_u : register(b0, space0) {
|
||||
uint4 u[20];
|
||||
};
|
||||
RWByteAddressBuffer s : register(u1, space0);
|
||||
|
||||
void tint_symbol_3(RWByteAddressBuffer buffer, uint offset, float3x2 value) {
|
||||
buffer.Store2((offset + 0u), asuint(value[0u]));
|
||||
buffer.Store2((offset + 8u), asuint(value[1u]));
|
||||
buffer.Store2((offset + 16u), asuint(value[2u]));
|
||||
}
|
||||
|
||||
void tint_symbol_1(RWByteAddressBuffer buffer, uint offset, S value) {
|
||||
buffer.Store((offset + 0u), asuint(value.before));
|
||||
tint_symbol_3(buffer, (offset + 8u), value.m);
|
||||
buffer.Store((offset + 72u), asuint(value.after));
|
||||
}
|
||||
|
||||
void tint_symbol(RWByteAddressBuffer buffer, uint offset, S value[4]) {
|
||||
S array[4] = value;
|
||||
{
|
||||
[loop] for(uint i = 0u; (i < 4u); i = (i + 1u)) {
|
||||
tint_symbol_1(buffer, (offset + (i * 80u)), array[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
float3x2 tint_symbol_8(uint4 buffer[20], uint offset) {
|
||||
const uint scalar_offset = ((offset + 0u)) / 4;
|
||||
uint4 ubo_load = buffer[scalar_offset / 4];
|
||||
const uint scalar_offset_1 = ((offset + 8u)) / 4;
|
||||
uint4 ubo_load_1 = buffer[scalar_offset_1 / 4];
|
||||
const uint scalar_offset_2 = ((offset + 16u)) / 4;
|
||||
uint4 ubo_load_2 = buffer[scalar_offset_2 / 4];
|
||||
return float3x2(asfloat(((scalar_offset & 2) ? ubo_load.zw : ubo_load.xy)), asfloat(((scalar_offset_1 & 2) ? ubo_load_1.zw : ubo_load_1.xy)), asfloat(((scalar_offset_2 & 2) ? ubo_load_2.zw : ubo_load_2.xy)));
|
||||
}
|
||||
|
||||
S tint_symbol_6(uint4 buffer[20], uint offset) {
|
||||
const uint scalar_offset_3 = ((offset + 0u)) / 4;
|
||||
const uint scalar_offset_4 = ((offset + 72u)) / 4;
|
||||
const S tint_symbol_10 = {asint(buffer[scalar_offset_3 / 4][scalar_offset_3 % 4]), tint_symbol_8(buffer, (offset + 8u)), asint(buffer[scalar_offset_4 / 4][scalar_offset_4 % 4])};
|
||||
return tint_symbol_10;
|
||||
}
|
||||
|
||||
typedef S tint_symbol_5_ret[4];
|
||||
tint_symbol_5_ret tint_symbol_5(uint4 buffer[20], uint offset) {
|
||||
S arr[4] = (S[4])0;
|
||||
{
|
||||
[loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
|
||||
arr[i_1] = tint_symbol_6(buffer, (offset + (i_1 * 80u)));
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void f() {
|
||||
tint_symbol(s, 0u, tint_symbol_5(u, 0u));
|
||||
tint_symbol_1(s, 80u, tint_symbol_6(u, 160u));
|
||||
tint_symbol_3(s, 248u, tint_symbol_8(u, 168u));
|
||||
s.Store2(88u, asuint(asfloat(u[1].xy).yx));
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
struct S {
|
||||
int before;
|
||||
float3x2 m;
|
||||
int after;
|
||||
};
|
||||
|
||||
cbuffer cbuffer_u : register(b0, space0) {
|
||||
uint4 u[20];
|
||||
};
|
||||
RWByteAddressBuffer s : register(u1, space0);
|
||||
|
||||
void tint_symbol_3(RWByteAddressBuffer buffer, uint offset, float3x2 value) {
|
||||
buffer.Store2((offset + 0u), asuint(value[0u]));
|
||||
buffer.Store2((offset + 8u), asuint(value[1u]));
|
||||
buffer.Store2((offset + 16u), asuint(value[2u]));
|
||||
}
|
||||
|
||||
void tint_symbol_1(RWByteAddressBuffer buffer, uint offset, S value) {
|
||||
buffer.Store((offset + 0u), asuint(value.before));
|
||||
tint_symbol_3(buffer, (offset + 8u), value.m);
|
||||
buffer.Store((offset + 72u), asuint(value.after));
|
||||
}
|
||||
|
||||
void tint_symbol(RWByteAddressBuffer buffer, uint offset, S value[4]) {
|
||||
S array[4] = value;
|
||||
{
|
||||
[loop] for(uint i = 0u; (i < 4u); i = (i + 1u)) {
|
||||
tint_symbol_1(buffer, (offset + (i * 80u)), array[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
float3x2 tint_symbol_8(uint4 buffer[20], uint offset) {
|
||||
const uint scalar_offset = ((offset + 0u)) / 4;
|
||||
uint4 ubo_load = buffer[scalar_offset / 4];
|
||||
const uint scalar_offset_1 = ((offset + 8u)) / 4;
|
||||
uint4 ubo_load_1 = buffer[scalar_offset_1 / 4];
|
||||
const uint scalar_offset_2 = ((offset + 16u)) / 4;
|
||||
uint4 ubo_load_2 = buffer[scalar_offset_2 / 4];
|
||||
return float3x2(asfloat(((scalar_offset & 2) ? ubo_load.zw : ubo_load.xy)), asfloat(((scalar_offset_1 & 2) ? ubo_load_1.zw : ubo_load_1.xy)), asfloat(((scalar_offset_2 & 2) ? ubo_load_2.zw : ubo_load_2.xy)));
|
||||
}
|
||||
|
||||
S tint_symbol_6(uint4 buffer[20], uint offset) {
|
||||
const uint scalar_offset_3 = ((offset + 0u)) / 4;
|
||||
const uint scalar_offset_4 = ((offset + 72u)) / 4;
|
||||
const S tint_symbol_10 = {asint(buffer[scalar_offset_3 / 4][scalar_offset_3 % 4]), tint_symbol_8(buffer, (offset + 8u)), asint(buffer[scalar_offset_4 / 4][scalar_offset_4 % 4])};
|
||||
return tint_symbol_10;
|
||||
}
|
||||
|
||||
typedef S tint_symbol_5_ret[4];
|
||||
tint_symbol_5_ret tint_symbol_5(uint4 buffer[20], uint offset) {
|
||||
S arr[4] = (S[4])0;
|
||||
{
|
||||
[loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
|
||||
arr[i_1] = tint_symbol_6(buffer, (offset + (i_1 * 80u)));
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void f() {
|
||||
tint_symbol(s, 0u, tint_symbol_5(u, 0u));
|
||||
tint_symbol_1(s, 80u, tint_symbol_6(u, 160u));
|
||||
tint_symbol_3(s, 248u, tint_symbol_8(u, 168u));
|
||||
s.Store2(88u, asuint(asfloat(u[1].xy).yx));
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
#version 310 es
|
||||
|
||||
struct S {
|
||||
int before;
|
||||
uint pad;
|
||||
mat3x2 m;
|
||||
uint pad_1;
|
||||
uint pad_2;
|
||||
uint pad_3;
|
||||
uint pad_4;
|
||||
uint pad_5;
|
||||
uint pad_6;
|
||||
uint pad_7;
|
||||
uint pad_8;
|
||||
uint pad_9;
|
||||
uint pad_10;
|
||||
int after;
|
||||
uint pad_11;
|
||||
};
|
||||
|
||||
struct S_std140 {
|
||||
int before;
|
||||
uint pad;
|
||||
vec2 m_0;
|
||||
vec2 m_1;
|
||||
vec2 m_2;
|
||||
uint pad_1;
|
||||
uint pad_2;
|
||||
uint pad_3;
|
||||
uint pad_4;
|
||||
uint pad_5;
|
||||
uint pad_6;
|
||||
uint pad_7;
|
||||
uint pad_8;
|
||||
uint pad_9;
|
||||
uint pad_10;
|
||||
int after;
|
||||
uint pad_11;
|
||||
};
|
||||
|
||||
layout(binding = 0, std140) uniform u_block_std140_ubo {
|
||||
S_std140 inner[4];
|
||||
} u;
|
||||
|
||||
layout(binding = 1, std430) buffer u_block_ssbo {
|
||||
S inner[4];
|
||||
} s;
|
||||
|
||||
S conv_S(S_std140 val) {
|
||||
return S(val.before, val.pad, mat3x2(val.m_0, val.m_1, val.m_2), val.pad_1, val.pad_2, val.pad_3, val.pad_4, val.pad_5, val.pad_6, val.pad_7, val.pad_8, val.pad_9, val.pad_10, val.after, val.pad_11);
|
||||
}
|
||||
|
||||
S[4] conv_arr_4_S(S_std140 val[4]) {
|
||||
S arr[4] = S[4](S(0, 0u, mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0, 0u), S(0, 0u, mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0, 0u), S(0, 0u, mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0, 0u), S(0, 0u, mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0, 0u));
|
||||
{
|
||||
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
|
||||
arr[i] = conv_S(val[i]);
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
mat3x2 load_u_inner_2_m() {
|
||||
return mat3x2(u.inner[2u].m_0, u.inner[2u].m_1, u.inner[2u].m_2);
|
||||
}
|
||||
|
||||
void f() {
|
||||
s.inner = conv_arr_4_S(u.inner);
|
||||
s.inner[1] = conv_S(u.inner[2u]);
|
||||
s.inner[3].m = load_u_inner_2_m();
|
||||
s.inner[1].m[0] = u.inner[0u].m_1.yx;
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
f();
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
template<typename T, size_t N>
|
||||
struct tint_array {
|
||||
const constant T& operator[](size_t i) const constant { return elements[i]; }
|
||||
device T& operator[](size_t i) device { return elements[i]; }
|
||||
const device T& operator[](size_t i) const device { return elements[i]; }
|
||||
thread T& operator[](size_t i) thread { return elements[i]; }
|
||||
const thread T& operator[](size_t i) const thread { return elements[i]; }
|
||||
threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
|
||||
const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
|
||||
T elements[N];
|
||||
};
|
||||
|
||||
struct S {
|
||||
/* 0x0000 */ int before;
|
||||
/* 0x0004 */ tint_array<int8_t, 4> tint_pad;
|
||||
/* 0x0008 */ float3x2 m;
|
||||
/* 0x0020 */ tint_array<int8_t, 40> tint_pad_1;
|
||||
/* 0x0048 */ int after;
|
||||
/* 0x004c */ tint_array<int8_t, 4> tint_pad_2;
|
||||
};
|
||||
|
||||
kernel void f(device tint_array<S, 4>* tint_symbol [[buffer(1)]], const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) {
|
||||
*(tint_symbol) = *(tint_symbol_1);
|
||||
(*(tint_symbol))[1] = (*(tint_symbol_1))[2];
|
||||
(*(tint_symbol))[3].m = (*(tint_symbol_1))[2].m;
|
||||
(*(tint_symbol))[1].m[0] = float2((*(tint_symbol_1))[0].m[1]).yx;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,182 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 109
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %f "f"
|
||||
OpExecutionMode %f LocalSize 1 1 1
|
||||
OpName %u_block_std140 "u_block_std140"
|
||||
OpMemberName %u_block_std140 0 "inner"
|
||||
OpName %S_std140 "S_std140"
|
||||
OpMemberName %S_std140 0 "before"
|
||||
OpMemberName %S_std140 1 "m_0"
|
||||
OpMemberName %S_std140 2 "m_1"
|
||||
OpMemberName %S_std140 3 "m_2"
|
||||
OpMemberName %S_std140 4 "after"
|
||||
OpName %u "u"
|
||||
OpName %u_block "u_block"
|
||||
OpMemberName %u_block 0 "inner"
|
||||
OpName %S "S"
|
||||
OpMemberName %S 0 "before"
|
||||
OpMemberName %S 1 "m"
|
||||
OpMemberName %S 2 "after"
|
||||
OpName %s "s"
|
||||
OpName %conv_S "conv_S"
|
||||
OpName %val "val"
|
||||
OpName %conv_arr_4_S "conv_arr_4_S"
|
||||
OpName %val_0 "val"
|
||||
OpName %arr "arr"
|
||||
OpName %i "i"
|
||||
OpName %var_for_index "var_for_index"
|
||||
OpName %load_u_inner_2_m "load_u_inner_2_m"
|
||||
OpName %f "f"
|
||||
OpDecorate %u_block_std140 Block
|
||||
OpMemberDecorate %u_block_std140 0 Offset 0
|
||||
OpMemberDecorate %S_std140 0 Offset 0
|
||||
OpMemberDecorate %S_std140 1 Offset 8
|
||||
OpMemberDecorate %S_std140 2 Offset 16
|
||||
OpMemberDecorate %S_std140 3 Offset 24
|
||||
OpMemberDecorate %S_std140 4 Offset 72
|
||||
OpDecorate %_arr_S_std140_uint_4 ArrayStride 80
|
||||
OpDecorate %u NonWritable
|
||||
OpDecorate %u DescriptorSet 0
|
||||
OpDecorate %u Binding 0
|
||||
OpDecorate %u_block Block
|
||||
OpMemberDecorate %u_block 0 Offset 0
|
||||
OpMemberDecorate %S 0 Offset 0
|
||||
OpMemberDecorate %S 1 Offset 8
|
||||
OpMemberDecorate %S 1 ColMajor
|
||||
OpMemberDecorate %S 1 MatrixStride 8
|
||||
OpMemberDecorate %S 2 Offset 72
|
||||
OpDecorate %_arr_S_uint_4 ArrayStride 80
|
||||
OpDecorate %s DescriptorSet 0
|
||||
OpDecorate %s Binding 1
|
||||
%int = OpTypeInt 32 1
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%S_std140 = OpTypeStruct %int %v2float %v2float %v2float %int
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%_arr_S_std140_uint_4 = OpTypeArray %S_std140 %uint_4
|
||||
%u_block_std140 = OpTypeStruct %_arr_S_std140_uint_4
|
||||
%_ptr_Uniform_u_block_std140 = OpTypePointer Uniform %u_block_std140
|
||||
%u = OpVariable %_ptr_Uniform_u_block_std140 Uniform
|
||||
%mat3v2float = OpTypeMatrix %v2float 3
|
||||
%S = OpTypeStruct %int %mat3v2float %int
|
||||
%_arr_S_uint_4 = OpTypeArray %S %uint_4
|
||||
%u_block = OpTypeStruct %_arr_S_uint_4
|
||||
%_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block
|
||||
%s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer
|
||||
%17 = OpTypeFunction %S %S_std140
|
||||
%28 = OpTypeFunction %_arr_S_uint_4 %_arr_S_std140_uint_4
|
||||
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
|
||||
%34 = OpConstantNull %_arr_S_uint_4
|
||||
%_ptr_Function_uint = OpTypePointer Function %uint
|
||||
%37 = OpConstantNull %uint
|
||||
%bool = OpTypeBool
|
||||
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
|
||||
%50 = OpConstantNull %_arr_S_std140_uint_4
|
||||
%_ptr_Function_S = OpTypePointer Function %S
|
||||
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%63 = OpTypeFunction %mat3v2float
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140
|
||||
%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%void = OpTypeVoid
|
||||
%83 = OpTypeFunction %void
|
||||
%_ptr_StorageBuffer__arr_S_uint_4 = OpTypePointer StorageBuffer %_arr_S_uint_4
|
||||
%_ptr_Uniform__arr_S_std140_uint_4 = OpTypePointer Uniform %_arr_S_std140_uint_4
|
||||
%int_1 = OpConstant %int 1
|
||||
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
|
||||
%int_3 = OpConstant %int 3
|
||||
%_ptr_StorageBuffer_mat3v2float = OpTypePointer StorageBuffer %mat3v2float
|
||||
%103 = OpConstantNull %int
|
||||
%_ptr_StorageBuffer_v2float = OpTypePointer StorageBuffer %v2float
|
||||
%conv_S = OpFunction %S None %17
|
||||
%val = OpFunctionParameter %S_std140
|
||||
%20 = OpLabel
|
||||
%21 = OpCompositeExtract %int %val 0
|
||||
%22 = OpCompositeExtract %v2float %val 1
|
||||
%23 = OpCompositeExtract %v2float %val 2
|
||||
%24 = OpCompositeExtract %v2float %val 3
|
||||
%25 = OpCompositeConstruct %mat3v2float %22 %23 %24
|
||||
%26 = OpCompositeExtract %int %val 4
|
||||
%27 = OpCompositeConstruct %S %21 %25 %26
|
||||
OpReturnValue %27
|
||||
OpFunctionEnd
|
||||
%conv_arr_4_S = OpFunction %_arr_S_uint_4 None %28
|
||||
%val_0 = OpFunctionParameter %_arr_S_std140_uint_4
|
||||
%31 = OpLabel
|
||||
%arr = OpVariable %_ptr_Function__arr_S_uint_4 Function %34
|
||||
%i = OpVariable %_ptr_Function_uint Function %37
|
||||
%var_for_index = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function %50
|
||||
OpBranch %38
|
||||
%38 = OpLabel
|
||||
OpLoopMerge %39 %40 None
|
||||
OpBranch %41
|
||||
%41 = OpLabel
|
||||
%43 = OpLoad %uint %i
|
||||
%44 = OpULessThan %bool %43 %uint_4
|
||||
%42 = OpLogicalNot %bool %44
|
||||
OpSelectionMerge %46 None
|
||||
OpBranchConditional %42 %47 %46
|
||||
%47 = OpLabel
|
||||
OpBranch %39
|
||||
%46 = OpLabel
|
||||
OpStore %var_for_index %val_0
|
||||
%51 = OpLoad %uint %i
|
||||
%53 = OpAccessChain %_ptr_Function_S %arr %51
|
||||
%55 = OpLoad %uint %i
|
||||
%57 = OpAccessChain %_ptr_Function_S_std140 %var_for_index %55
|
||||
%58 = OpLoad %S_std140 %57
|
||||
%54 = OpFunctionCall %S %conv_S %58
|
||||
OpStore %53 %54
|
||||
OpBranch %40
|
||||
%40 = OpLabel
|
||||
%59 = OpLoad %uint %i
|
||||
%61 = OpIAdd %uint %59 %uint_1
|
||||
OpStore %i %61
|
||||
OpBranch %38
|
||||
%39 = OpLabel
|
||||
%62 = OpLoad %_arr_S_uint_4 %arr
|
||||
OpReturnValue %62
|
||||
OpFunctionEnd
|
||||
%load_u_inner_2_m = OpFunction %mat3v2float None %63
|
||||
%65 = OpLabel
|
||||
%70 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
|
||||
%73 = OpAccessChain %_ptr_Uniform_v2float %70 %uint_1
|
||||
%74 = OpLoad %v2float %73
|
||||
%76 = OpAccessChain %_ptr_Uniform_v2float %70 %uint_2
|
||||
%77 = OpLoad %v2float %76
|
||||
%80 = OpAccessChain %_ptr_Uniform_v2float %70 %uint_3
|
||||
%81 = OpLoad %v2float %80
|
||||
%82 = OpCompositeConstruct %mat3v2float %74 %77 %81
|
||||
OpReturnValue %82
|
||||
OpFunctionEnd
|
||||
%f = OpFunction %void None %83
|
||||
%86 = OpLabel
|
||||
%88 = OpAccessChain %_ptr_StorageBuffer__arr_S_uint_4 %s %uint_0
|
||||
%91 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %u %uint_0
|
||||
%92 = OpLoad %_arr_S_std140_uint_4 %91
|
||||
%89 = OpFunctionCall %_arr_S_uint_4 %conv_arr_4_S %92
|
||||
OpStore %88 %89
|
||||
%95 = OpAccessChain %_ptr_StorageBuffer_S %s %uint_0 %int_1
|
||||
%97 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
|
||||
%98 = OpLoad %S_std140 %97
|
||||
%96 = OpFunctionCall %S %conv_S %98
|
||||
OpStore %95 %96
|
||||
%101 = OpAccessChain %_ptr_StorageBuffer_mat3v2float %s %uint_0 %int_3 %uint_1
|
||||
%102 = OpFunctionCall %mat3v2float %load_u_inner_2_m
|
||||
OpStore %101 %102
|
||||
%105 = OpAccessChain %_ptr_StorageBuffer_v2float %s %uint_0 %int_1 %uint_1 %103
|
||||
%106 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0 %37 %uint_2
|
||||
%107 = OpLoad %v2float %106
|
||||
%108 = OpVectorShuffle %v2float %107 %107 1 0
|
||||
OpStore %105 %108
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,18 @@
|
||||
struct S {
|
||||
before : i32,
|
||||
@size(64)
|
||||
m : mat3x2<f32>,
|
||||
after : i32,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<uniform> u : array<S, 4>;
|
||||
|
||||
@group(0) @binding(1) var<storage, read_write> s : array<S, 4>;
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn f() {
|
||||
s = u;
|
||||
s[1] = u[2];
|
||||
s[3].m = u[2].m;
|
||||
s[1].m[0] = u[0].m[1].yx;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
struct S {
|
||||
before : i32,
|
||||
@size(64) m : mat3x2<f32>,
|
||||
after : i32,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<uniform> u : array<S, 4>;
|
||||
var<workgroup> w : array<S, 4>;
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn f() {
|
||||
w = u;
|
||||
w[1] = u[2];
|
||||
w[3].m = u[2].m;
|
||||
w[1].m[0] = u[0].m[1].yx;
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
struct S {
|
||||
int before;
|
||||
float3x2 m;
|
||||
int after;
|
||||
};
|
||||
|
||||
cbuffer cbuffer_u : register(b0, space0) {
|
||||
uint4 u[20];
|
||||
};
|
||||
groupshared S w[4];
|
||||
|
||||
struct tint_symbol_1 {
|
||||
uint local_invocation_index : SV_GroupIndex;
|
||||
};
|
||||
|
||||
float3x2 tint_symbol_5(uint4 buffer[20], uint offset) {
|
||||
const uint scalar_offset = ((offset + 0u)) / 4;
|
||||
uint4 ubo_load = buffer[scalar_offset / 4];
|
||||
const uint scalar_offset_1 = ((offset + 8u)) / 4;
|
||||
uint4 ubo_load_1 = buffer[scalar_offset_1 / 4];
|
||||
const uint scalar_offset_2 = ((offset + 16u)) / 4;
|
||||
uint4 ubo_load_2 = buffer[scalar_offset_2 / 4];
|
||||
return float3x2(asfloat(((scalar_offset & 2) ? ubo_load.zw : ubo_load.xy)), asfloat(((scalar_offset_1 & 2) ? ubo_load_1.zw : ubo_load_1.xy)), asfloat(((scalar_offset_2 & 2) ? ubo_load_2.zw : ubo_load_2.xy)));
|
||||
}
|
||||
|
||||
S tint_symbol_3(uint4 buffer[20], uint offset) {
|
||||
const uint scalar_offset_3 = ((offset + 0u)) / 4;
|
||||
const uint scalar_offset_4 = ((offset + 72u)) / 4;
|
||||
const S tint_symbol_8 = {asint(buffer[scalar_offset_3 / 4][scalar_offset_3 % 4]), tint_symbol_5(buffer, (offset + 8u)), asint(buffer[scalar_offset_4 / 4][scalar_offset_4 % 4])};
|
||||
return tint_symbol_8;
|
||||
}
|
||||
|
||||
typedef S tint_symbol_2_ret[4];
|
||||
tint_symbol_2_ret tint_symbol_2(uint4 buffer[20], uint offset) {
|
||||
S arr[4] = (S[4])0;
|
||||
{
|
||||
[loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
|
||||
arr[i_1] = tint_symbol_3(buffer, (offset + (i_1 * 80u)));
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
void f_inner(uint local_invocation_index) {
|
||||
{
|
||||
[loop] for(uint idx = local_invocation_index; (idx < 4u); idx = (idx + 1u)) {
|
||||
const uint i = idx;
|
||||
const S tint_symbol_7 = (S)0;
|
||||
w[i] = tint_symbol_7;
|
||||
}
|
||||
}
|
||||
GroupMemoryBarrierWithGroupSync();
|
||||
w = tint_symbol_2(u, 0u);
|
||||
w[1] = tint_symbol_3(u, 160u);
|
||||
w[3].m = tint_symbol_5(u, 168u);
|
||||
w[1].m[0] = asfloat(u[1].xy).yx;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void f(tint_symbol_1 tint_symbol) {
|
||||
f_inner(tint_symbol.local_invocation_index);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
struct S {
|
||||
int before;
|
||||
float3x2 m;
|
||||
int after;
|
||||
};
|
||||
|
||||
cbuffer cbuffer_u : register(b0, space0) {
|
||||
uint4 u[20];
|
||||
};
|
||||
groupshared S w[4];
|
||||
|
||||
struct tint_symbol_1 {
|
||||
uint local_invocation_index : SV_GroupIndex;
|
||||
};
|
||||
|
||||
float3x2 tint_symbol_5(uint4 buffer[20], uint offset) {
|
||||
const uint scalar_offset = ((offset + 0u)) / 4;
|
||||
uint4 ubo_load = buffer[scalar_offset / 4];
|
||||
const uint scalar_offset_1 = ((offset + 8u)) / 4;
|
||||
uint4 ubo_load_1 = buffer[scalar_offset_1 / 4];
|
||||
const uint scalar_offset_2 = ((offset + 16u)) / 4;
|
||||
uint4 ubo_load_2 = buffer[scalar_offset_2 / 4];
|
||||
return float3x2(asfloat(((scalar_offset & 2) ? ubo_load.zw : ubo_load.xy)), asfloat(((scalar_offset_1 & 2) ? ubo_load_1.zw : ubo_load_1.xy)), asfloat(((scalar_offset_2 & 2) ? ubo_load_2.zw : ubo_load_2.xy)));
|
||||
}
|
||||
|
||||
S tint_symbol_3(uint4 buffer[20], uint offset) {
|
||||
const uint scalar_offset_3 = ((offset + 0u)) / 4;
|
||||
const uint scalar_offset_4 = ((offset + 72u)) / 4;
|
||||
const S tint_symbol_8 = {asint(buffer[scalar_offset_3 / 4][scalar_offset_3 % 4]), tint_symbol_5(buffer, (offset + 8u)), asint(buffer[scalar_offset_4 / 4][scalar_offset_4 % 4])};
|
||||
return tint_symbol_8;
|
||||
}
|
||||
|
||||
typedef S tint_symbol_2_ret[4];
|
||||
tint_symbol_2_ret tint_symbol_2(uint4 buffer[20], uint offset) {
|
||||
S arr[4] = (S[4])0;
|
||||
{
|
||||
[loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
|
||||
arr[i_1] = tint_symbol_3(buffer, (offset + (i_1 * 80u)));
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
void f_inner(uint local_invocation_index) {
|
||||
{
|
||||
[loop] for(uint idx = local_invocation_index; (idx < 4u); idx = (idx + 1u)) {
|
||||
const uint i = idx;
|
||||
const S tint_symbol_7 = (S)0;
|
||||
w[i] = tint_symbol_7;
|
||||
}
|
||||
}
|
||||
GroupMemoryBarrierWithGroupSync();
|
||||
w = tint_symbol_2(u, 0u);
|
||||
w[1] = tint_symbol_3(u, 160u);
|
||||
w[3].m = tint_symbol_5(u, 168u);
|
||||
w[1].m[0] = asfloat(u[1].xy).yx;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void f(tint_symbol_1 tint_symbol) {
|
||||
f_inner(tint_symbol.local_invocation_index);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
#version 310 es
|
||||
|
||||
struct S {
|
||||
int before;
|
||||
uint pad;
|
||||
mat3x2 m;
|
||||
uint pad_1;
|
||||
uint pad_2;
|
||||
uint pad_3;
|
||||
uint pad_4;
|
||||
uint pad_5;
|
||||
uint pad_6;
|
||||
uint pad_7;
|
||||
uint pad_8;
|
||||
uint pad_9;
|
||||
uint pad_10;
|
||||
int after;
|
||||
uint pad_11;
|
||||
};
|
||||
|
||||
struct S_std140 {
|
||||
int before;
|
||||
uint pad;
|
||||
vec2 m_0;
|
||||
vec2 m_1;
|
||||
vec2 m_2;
|
||||
uint pad_1;
|
||||
uint pad_2;
|
||||
uint pad_3;
|
||||
uint pad_4;
|
||||
uint pad_5;
|
||||
uint pad_6;
|
||||
uint pad_7;
|
||||
uint pad_8;
|
||||
uint pad_9;
|
||||
uint pad_10;
|
||||
int after;
|
||||
uint pad_11;
|
||||
};
|
||||
|
||||
layout(binding = 0, std140) uniform u_block_std140_ubo {
|
||||
S_std140 inner[4];
|
||||
} u;
|
||||
|
||||
shared S w[4];
|
||||
S conv_S(S_std140 val) {
|
||||
return S(val.before, val.pad, mat3x2(val.m_0, val.m_1, val.m_2), val.pad_1, val.pad_2, val.pad_3, val.pad_4, val.pad_5, val.pad_6, val.pad_7, val.pad_8, val.pad_9, val.pad_10, val.after, val.pad_11);
|
||||
}
|
||||
|
||||
S[4] conv_arr_4_S(S_std140 val[4]) {
|
||||
S arr[4] = S[4](S(0, 0u, mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0, 0u), S(0, 0u, mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0, 0u), S(0, 0u, mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0, 0u), S(0, 0u, mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0, 0u));
|
||||
{
|
||||
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
|
||||
arr[i] = conv_S(val[i]);
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
mat3x2 load_u_inner_2_m() {
|
||||
return mat3x2(u.inner[2u].m_0, u.inner[2u].m_1, u.inner[2u].m_2);
|
||||
}
|
||||
|
||||
void f(uint local_invocation_index) {
|
||||
{
|
||||
for(uint idx = local_invocation_index; (idx < 4u); idx = (idx + 1u)) {
|
||||
uint i = idx;
|
||||
S tint_symbol = S(0, 0u, mat3x2(vec2(0.0f), vec2(0.0f), vec2(0.0f)), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0, 0u);
|
||||
w[i] = tint_symbol;
|
||||
}
|
||||
}
|
||||
barrier();
|
||||
w = conv_arr_4_S(u.inner);
|
||||
w[1] = conv_S(u.inner[2u]);
|
||||
w[3].m = load_u_inner_2_m();
|
||||
w[1].m[0] = u.inner[0u].m_1.yx;
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
f(gl_LocalInvocationIndex);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
template<typename T, size_t N>
|
||||
struct tint_array {
|
||||
const constant T& operator[](size_t i) const constant { return elements[i]; }
|
||||
device T& operator[](size_t i) device { return elements[i]; }
|
||||
const device T& operator[](size_t i) const device { return elements[i]; }
|
||||
thread T& operator[](size_t i) thread { return elements[i]; }
|
||||
const thread T& operator[](size_t i) const thread { return elements[i]; }
|
||||
threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
|
||||
const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
|
||||
T elements[N];
|
||||
};
|
||||
|
||||
struct S {
|
||||
/* 0x0000 */ int before;
|
||||
/* 0x0004 */ tint_array<int8_t, 4> tint_pad;
|
||||
/* 0x0008 */ float3x2 m;
|
||||
/* 0x0020 */ tint_array<int8_t, 40> tint_pad_1;
|
||||
/* 0x0048 */ int after;
|
||||
/* 0x004c */ tint_array<int8_t, 4> tint_pad_2;
|
||||
};
|
||||
|
||||
struct tint_symbol_6 {
|
||||
tint_array<S, 4> w;
|
||||
};
|
||||
|
||||
void f_inner(uint local_invocation_index, threadgroup tint_array<S, 4>* const tint_symbol_1, const constant tint_array<S, 4>* const tint_symbol_2) {
|
||||
for(uint idx = local_invocation_index; (idx < 4u); idx = (idx + 1u)) {
|
||||
uint const i = idx;
|
||||
S const tint_symbol = S{};
|
||||
(*(tint_symbol_1))[i] = tint_symbol;
|
||||
}
|
||||
threadgroup_barrier(mem_flags::mem_threadgroup);
|
||||
*(tint_symbol_1) = *(tint_symbol_2);
|
||||
(*(tint_symbol_1))[1] = (*(tint_symbol_2))[2];
|
||||
(*(tint_symbol_1))[3].m = (*(tint_symbol_2))[2].m;
|
||||
(*(tint_symbol_1))[1].m[0] = float2((*(tint_symbol_2))[0].m[1]).yx;
|
||||
}
|
||||
|
||||
kernel void f(const constant tint_array<S, 4>* tint_symbol_5 [[buffer(0)]], threadgroup tint_symbol_6* tint_symbol_4 [[threadgroup(0)]], uint local_invocation_index [[thread_index_in_threadgroup]]) {
|
||||
threadgroup tint_array<S, 4>* const tint_symbol_3 = &((*(tint_symbol_4)).w);
|
||||
f_inner(local_invocation_index, tint_symbol_3, tint_symbol_5);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,216 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 131
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %f "f" %local_invocation_index_1
|
||||
OpExecutionMode %f LocalSize 1 1 1
|
||||
OpName %local_invocation_index_1 "local_invocation_index_1"
|
||||
OpName %u_block_std140 "u_block_std140"
|
||||
OpMemberName %u_block_std140 0 "inner"
|
||||
OpName %S_std140 "S_std140"
|
||||
OpMemberName %S_std140 0 "before"
|
||||
OpMemberName %S_std140 1 "m_0"
|
||||
OpMemberName %S_std140 2 "m_1"
|
||||
OpMemberName %S_std140 3 "m_2"
|
||||
OpMemberName %S_std140 4 "after"
|
||||
OpName %u "u"
|
||||
OpName %S "S"
|
||||
OpMemberName %S 0 "before"
|
||||
OpMemberName %S 1 "m"
|
||||
OpMemberName %S 2 "after"
|
||||
OpName %w "w"
|
||||
OpName %conv_S "conv_S"
|
||||
OpName %val "val"
|
||||
OpName %conv_arr_4_S "conv_arr_4_S"
|
||||
OpName %val_0 "val"
|
||||
OpName %arr "arr"
|
||||
OpName %i "i"
|
||||
OpName %var_for_index "var_for_index"
|
||||
OpName %load_u_inner_2_m "load_u_inner_2_m"
|
||||
OpName %f_inner "f_inner"
|
||||
OpName %local_invocation_index "local_invocation_index"
|
||||
OpName %idx "idx"
|
||||
OpName %f "f"
|
||||
OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex
|
||||
OpDecorate %u_block_std140 Block
|
||||
OpMemberDecorate %u_block_std140 0 Offset 0
|
||||
OpMemberDecorate %S_std140 0 Offset 0
|
||||
OpMemberDecorate %S_std140 1 Offset 8
|
||||
OpMemberDecorate %S_std140 2 Offset 16
|
||||
OpMemberDecorate %S_std140 3 Offset 24
|
||||
OpMemberDecorate %S_std140 4 Offset 72
|
||||
OpDecorate %_arr_S_std140_uint_4 ArrayStride 80
|
||||
OpDecorate %u NonWritable
|
||||
OpDecorate %u DescriptorSet 0
|
||||
OpDecorate %u Binding 0
|
||||
OpMemberDecorate %S 0 Offset 0
|
||||
OpMemberDecorate %S 1 Offset 8
|
||||
OpMemberDecorate %S 1 ColMajor
|
||||
OpMemberDecorate %S 1 MatrixStride 8
|
||||
OpMemberDecorate %S 2 Offset 72
|
||||
OpDecorate %_arr_S_uint_4 ArrayStride 80
|
||||
%uint = OpTypeInt 32 0
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input
|
||||
%int = OpTypeInt 32 1
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%S_std140 = OpTypeStruct %int %v2float %v2float %v2float %int
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%_arr_S_std140_uint_4 = OpTypeArray %S_std140 %uint_4
|
||||
%u_block_std140 = OpTypeStruct %_arr_S_std140_uint_4
|
||||
%_ptr_Uniform_u_block_std140 = OpTypePointer Uniform %u_block_std140
|
||||
%u = OpVariable %_ptr_Uniform_u_block_std140 Uniform
|
||||
%mat3v2float = OpTypeMatrix %v2float 3
|
||||
%S = OpTypeStruct %int %mat3v2float %int
|
||||
%_arr_S_uint_4 = OpTypeArray %S %uint_4
|
||||
%_ptr_Workgroup__arr_S_uint_4 = OpTypePointer Workgroup %_arr_S_uint_4
|
||||
%w = OpVariable %_ptr_Workgroup__arr_S_uint_4 Workgroup
|
||||
%18 = OpTypeFunction %S %S_std140
|
||||
%29 = OpTypeFunction %_arr_S_uint_4 %_arr_S_std140_uint_4
|
||||
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
|
||||
%35 = OpConstantNull %_arr_S_uint_4
|
||||
%_ptr_Function_uint = OpTypePointer Function %uint
|
||||
%38 = OpConstantNull %uint
|
||||
%bool = OpTypeBool
|
||||
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
|
||||
%51 = OpConstantNull %_arr_S_std140_uint_4
|
||||
%_ptr_Function_S = OpTypePointer Function %S
|
||||
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%64 = OpTypeFunction %mat3v2float
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140
|
||||
%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%void = OpTypeVoid
|
||||
%84 = OpTypeFunction %void %uint
|
||||
%_ptr_Workgroup_S = OpTypePointer Workgroup %S
|
||||
%102 = OpConstantNull %S
|
||||
%uint_264 = OpConstant %uint 264
|
||||
%_ptr_Uniform__arr_S_std140_uint_4 = OpTypePointer Uniform %_arr_S_std140_uint_4
|
||||
%int_1 = OpConstant %int 1
|
||||
%int_3 = OpConstant %int 3
|
||||
%_ptr_Workgroup_mat3v2float = OpTypePointer Workgroup %mat3v2float
|
||||
%120 = OpConstantNull %int
|
||||
%_ptr_Workgroup_v2float = OpTypePointer Workgroup %v2float
|
||||
%126 = OpTypeFunction %void
|
||||
%conv_S = OpFunction %S None %18
|
||||
%val = OpFunctionParameter %S_std140
|
||||
%21 = OpLabel
|
||||
%22 = OpCompositeExtract %int %val 0
|
||||
%23 = OpCompositeExtract %v2float %val 1
|
||||
%24 = OpCompositeExtract %v2float %val 2
|
||||
%25 = OpCompositeExtract %v2float %val 3
|
||||
%26 = OpCompositeConstruct %mat3v2float %23 %24 %25
|
||||
%27 = OpCompositeExtract %int %val 4
|
||||
%28 = OpCompositeConstruct %S %22 %26 %27
|
||||
OpReturnValue %28
|
||||
OpFunctionEnd
|
||||
%conv_arr_4_S = OpFunction %_arr_S_uint_4 None %29
|
||||
%val_0 = OpFunctionParameter %_arr_S_std140_uint_4
|
||||
%32 = OpLabel
|
||||
%arr = OpVariable %_ptr_Function__arr_S_uint_4 Function %35
|
||||
%i = OpVariable %_ptr_Function_uint Function %38
|
||||
%var_for_index = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function %51
|
||||
OpBranch %39
|
||||
%39 = OpLabel
|
||||
OpLoopMerge %40 %41 None
|
||||
OpBranch %42
|
||||
%42 = OpLabel
|
||||
%44 = OpLoad %uint %i
|
||||
%45 = OpULessThan %bool %44 %uint_4
|
||||
%43 = OpLogicalNot %bool %45
|
||||
OpSelectionMerge %47 None
|
||||
OpBranchConditional %43 %48 %47
|
||||
%48 = OpLabel
|
||||
OpBranch %40
|
||||
%47 = OpLabel
|
||||
OpStore %var_for_index %val_0
|
||||
%52 = OpLoad %uint %i
|
||||
%54 = OpAccessChain %_ptr_Function_S %arr %52
|
||||
%56 = OpLoad %uint %i
|
||||
%58 = OpAccessChain %_ptr_Function_S_std140 %var_for_index %56
|
||||
%59 = OpLoad %S_std140 %58
|
||||
%55 = OpFunctionCall %S %conv_S %59
|
||||
OpStore %54 %55
|
||||
OpBranch %41
|
||||
%41 = OpLabel
|
||||
%60 = OpLoad %uint %i
|
||||
%62 = OpIAdd %uint %60 %uint_1
|
||||
OpStore %i %62
|
||||
OpBranch %39
|
||||
%40 = OpLabel
|
||||
%63 = OpLoad %_arr_S_uint_4 %arr
|
||||
OpReturnValue %63
|
||||
OpFunctionEnd
|
||||
%load_u_inner_2_m = OpFunction %mat3v2float None %64
|
||||
%66 = OpLabel
|
||||
%71 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
|
||||
%74 = OpAccessChain %_ptr_Uniform_v2float %71 %uint_1
|
||||
%75 = OpLoad %v2float %74
|
||||
%77 = OpAccessChain %_ptr_Uniform_v2float %71 %uint_2
|
||||
%78 = OpLoad %v2float %77
|
||||
%81 = OpAccessChain %_ptr_Uniform_v2float %71 %uint_3
|
||||
%82 = OpLoad %v2float %81
|
||||
%83 = OpCompositeConstruct %mat3v2float %75 %78 %82
|
||||
OpReturnValue %83
|
||||
OpFunctionEnd
|
||||
%f_inner = OpFunction %void None %84
|
||||
%local_invocation_index = OpFunctionParameter %uint
|
||||
%88 = OpLabel
|
||||
%idx = OpVariable %_ptr_Function_uint Function %38
|
||||
OpStore %idx %local_invocation_index
|
||||
OpBranch %90
|
||||
%90 = OpLabel
|
||||
OpLoopMerge %91 %92 None
|
||||
OpBranch %93
|
||||
%93 = OpLabel
|
||||
%95 = OpLoad %uint %idx
|
||||
%96 = OpULessThan %bool %95 %uint_4
|
||||
%94 = OpLogicalNot %bool %96
|
||||
OpSelectionMerge %97 None
|
||||
OpBranchConditional %94 %98 %97
|
||||
%98 = OpLabel
|
||||
OpBranch %91
|
||||
%97 = OpLabel
|
||||
%99 = OpLoad %uint %idx
|
||||
%101 = OpAccessChain %_ptr_Workgroup_S %w %99
|
||||
OpStore %101 %102
|
||||
OpBranch %92
|
||||
%92 = OpLabel
|
||||
%103 = OpLoad %uint %idx
|
||||
%104 = OpIAdd %uint %103 %uint_1
|
||||
OpStore %idx %104
|
||||
OpBranch %90
|
||||
%91 = OpLabel
|
||||
OpControlBarrier %uint_2 %uint_2 %uint_264
|
||||
%109 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %u %uint_0
|
||||
%110 = OpLoad %_arr_S_std140_uint_4 %109
|
||||
%107 = OpFunctionCall %_arr_S_uint_4 %conv_arr_4_S %110
|
||||
OpStore %w %107
|
||||
%112 = OpAccessChain %_ptr_Workgroup_S %w %int_1
|
||||
%114 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
|
||||
%115 = OpLoad %S_std140 %114
|
||||
%113 = OpFunctionCall %S %conv_S %115
|
||||
OpStore %112 %113
|
||||
%118 = OpAccessChain %_ptr_Workgroup_mat3v2float %w %int_3 %uint_1
|
||||
%119 = OpFunctionCall %mat3v2float %load_u_inner_2_m
|
||||
OpStore %118 %119
|
||||
%122 = OpAccessChain %_ptr_Workgroup_v2float %w %int_1 %uint_1 %120
|
||||
%123 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0 %38 %uint_2
|
||||
%124 = OpLoad %v2float %123
|
||||
%125 = OpVectorShuffle %v2float %124 %124 1 0
|
||||
OpStore %122 %125
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%f = OpFunction %void None %126
|
||||
%128 = OpLabel
|
||||
%130 = OpLoad %uint %local_invocation_index_1
|
||||
%129 = OpFunctionCall %void %f_inner %130
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,18 @@
|
||||
struct S {
|
||||
before : i32,
|
||||
@size(64)
|
||||
m : mat3x2<f32>,
|
||||
after : i32,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<uniform> u : array<S, 4>;
|
||||
|
||||
var<workgroup> w : array<S, 4>;
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn f() {
|
||||
w = u;
|
||||
w[1] = u[2];
|
||||
w[3].m = u[2].m;
|
||||
w[1].m[0] = u[0].m[1].yx;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
struct Inner {
|
||||
m : mat4x2<f32>,
|
||||
}
|
||||
|
||||
struct Outer {
|
||||
a : array<Inner, 4>,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<uniform> a : array<Outer, 4>;
|
||||
|
||||
var<private> counter = 0;
|
||||
fn i() -> i32 { counter++; return counter; }
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn f() {
|
||||
let p_a = &a;
|
||||
let p_a_i = &((*p_a)[i()]);
|
||||
let p_a_i_a = &((*p_a_i).a);
|
||||
let p_a_i_a_i = &((*p_a_i_a)[i()]);
|
||||
let p_a_i_a_i_m = &((*p_a_i_a_i).m);
|
||||
let p_a_i_a_i_m_i = &((*p_a_i_a_i_m)[i()]);
|
||||
|
||||
|
||||
let l_a : array<Outer, 4> = *p_a;
|
||||
let l_a_i : Outer = *p_a_i;
|
||||
let l_a_i_a : array<Inner, 4> = *p_a_i_a;
|
||||
let l_a_i_a_i : Inner = *p_a_i_a_i;
|
||||
let l_a_i_a_i_m : mat4x2<f32> = *p_a_i_a_i_m;
|
||||
let l_a_i_a_i_m_i : vec2<f32> = *p_a_i_a_i_m_i;
|
||||
let l_a_i_a_i_m_i_i : f32 = (*p_a_i_a_i_m_i)[i()];
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
struct Inner {
|
||||
float4x2 m;
|
||||
};
|
||||
struct Outer {
|
||||
Inner a[4];
|
||||
};
|
||||
|
||||
cbuffer cbuffer_a : register(b0, space0) {
|
||||
uint4 a[32];
|
||||
};
|
||||
static int counter = 0;
|
||||
|
||||
int i() {
|
||||
counter = (counter + 1);
|
||||
return counter;
|
||||
}
|
||||
|
||||
float4x2 tint_symbol_8(uint4 buffer[32], uint offset) {
|
||||
const uint scalar_offset = ((offset + 0u)) / 4;
|
||||
uint4 ubo_load = buffer[scalar_offset / 4];
|
||||
const uint scalar_offset_1 = ((offset + 8u)) / 4;
|
||||
uint4 ubo_load_1 = buffer[scalar_offset_1 / 4];
|
||||
const uint scalar_offset_2 = ((offset + 16u)) / 4;
|
||||
uint4 ubo_load_2 = buffer[scalar_offset_2 / 4];
|
||||
const uint scalar_offset_3 = ((offset + 24u)) / 4;
|
||||
uint4 ubo_load_3 = buffer[scalar_offset_3 / 4];
|
||||
return float4x2(asfloat(((scalar_offset & 2) ? ubo_load.zw : ubo_load.xy)), asfloat(((scalar_offset_1 & 2) ? ubo_load_1.zw : ubo_load_1.xy)), asfloat(((scalar_offset_2 & 2) ? ubo_load_2.zw : ubo_load_2.xy)), asfloat(((scalar_offset_3 & 2) ? ubo_load_3.zw : ubo_load_3.xy)));
|
||||
}
|
||||
|
||||
Inner tint_symbol_7(uint4 buffer[32], uint offset) {
|
||||
const Inner tint_symbol_11 = {tint_symbol_8(buffer, (offset + 0u))};
|
||||
return tint_symbol_11;
|
||||
}
|
||||
|
||||
typedef Inner tint_symbol_6_ret[4];
|
||||
tint_symbol_6_ret tint_symbol_6(uint4 buffer[32], uint offset) {
|
||||
Inner arr[4] = (Inner[4])0;
|
||||
{
|
||||
[loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
|
||||
arr[i_1] = tint_symbol_7(buffer, (offset + (i_1 * 32u)));
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
Outer tint_symbol_5(uint4 buffer[32], uint offset) {
|
||||
const Outer tint_symbol_12 = {tint_symbol_6(buffer, (offset + 0u))};
|
||||
return tint_symbol_12;
|
||||
}
|
||||
|
||||
typedef Outer tint_symbol_4_ret[4];
|
||||
tint_symbol_4_ret tint_symbol_4(uint4 buffer[32], uint offset) {
|
||||
Outer arr_1[4] = (Outer[4])0;
|
||||
{
|
||||
[loop] for(uint i_2 = 0u; (i_2 < 4u); i_2 = (i_2 + 1u)) {
|
||||
arr_1[i_2] = tint_symbol_5(buffer, (offset + (i_2 * 128u)));
|
||||
}
|
||||
}
|
||||
return arr_1;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void f() {
|
||||
const int p_a_i_save = i();
|
||||
const int p_a_i_a_i_save = i();
|
||||
const int p_a_i_a_i_m_i_save = i();
|
||||
const Outer l_a[4] = tint_symbol_4(a, 0u);
|
||||
const Outer l_a_i = tint_symbol_5(a, (128u * uint(p_a_i_save)));
|
||||
const Inner l_a_i_a[4] = tint_symbol_6(a, (128u * uint(p_a_i_save)));
|
||||
const Inner l_a_i_a_i = tint_symbol_7(a, ((128u * uint(p_a_i_save)) + (32u * uint(p_a_i_a_i_save))));
|
||||
const float4x2 l_a_i_a_i_m = tint_symbol_8(a, ((128u * uint(p_a_i_save)) + (32u * uint(p_a_i_a_i_save))));
|
||||
const uint scalar_offset_4 = ((((128u * uint(p_a_i_save)) + (32u * uint(p_a_i_a_i_save))) + (8u * uint(p_a_i_a_i_m_i_save)))) / 4;
|
||||
uint4 ubo_load_4 = a[scalar_offset_4 / 4];
|
||||
const float2 l_a_i_a_i_m_i = asfloat(((scalar_offset_4 & 2) ? ubo_load_4.zw : ubo_load_4.xy));
|
||||
const int tint_symbol = p_a_i_save;
|
||||
const int tint_symbol_1 = p_a_i_a_i_save;
|
||||
const int tint_symbol_2 = p_a_i_a_i_m_i_save;
|
||||
const int tint_symbol_3 = i();
|
||||
const uint scalar_offset_5 = (((((128u * uint(tint_symbol)) + (32u * uint(tint_symbol_1))) + (8u * uint(tint_symbol_2))) + (4u * uint(tint_symbol_3)))) / 4;
|
||||
const float l_a_i_a_i_m_i_i = asfloat(a[scalar_offset_5 / 4][scalar_offset_5 % 4]);
|
||||
return;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user