mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-09 13:38:00 +00:00
tint->dawn: Shuffle source tree in preperation of merging repos
docs/ -> docs/tint/ fuzzers/ -> src/tint/fuzzers/ samples/ -> src/tint/cmd/ src/ -> src/tint/ test/ -> test/tint/ BUG=tint:1418,tint:1433 Change-Id: Id2aa79f989aef3245b80ef4aa37a27ff16cd700b Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/80482 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Ben Clayton <bclayton@google.com> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
This commit is contained in:
committed by
Tint LUCI CQ
parent
38f1e9c75c
commit
dbc13af287
30
test/tint/buffer/storage/dynamic_index/read.wgsl
Normal file
30
test/tint/buffer/storage/dynamic_index/read.wgsl
Normal file
@@ -0,0 +1,30 @@
|
||||
struct Inner {
|
||||
a : vec3<i32>;
|
||||
b : i32;
|
||||
c : vec3<u32>;
|
||||
d : u32;
|
||||
e : vec3<f32>;
|
||||
f : f32;
|
||||
g : mat2x3<f32>;
|
||||
h : mat3x2<f32>;
|
||||
i : array<vec4<i32>, 4>;
|
||||
};
|
||||
|
||||
struct S {
|
||||
arr : array<Inner>;
|
||||
};
|
||||
|
||||
@binding(0) @group(0) var<storage, read> s : S;
|
||||
|
||||
@stage(compute) @workgroup_size(1)
|
||||
fn main(@builtin(local_invocation_index) idx : u32) {
|
||||
let a = s.arr[idx].a;
|
||||
let b = s.arr[idx].b;
|
||||
let c = s.arr[idx].c;
|
||||
let d = s.arr[idx].d;
|
||||
let e = s.arr[idx].e;
|
||||
let f = s.arr[idx].f;
|
||||
let g = s.arr[idx].g;
|
||||
let h = s.arr[idx].h;
|
||||
let i = s.arr[idx].i;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
#version 310 es
|
||||
|
||||
struct Inner {
|
||||
ivec3 a;
|
||||
int b;
|
||||
uvec3 c;
|
||||
uint d;
|
||||
vec3 e;
|
||||
float f;
|
||||
mat2x3 g;
|
||||
mat3x2 h;
|
||||
ivec4 i[4];
|
||||
};
|
||||
|
||||
layout(binding = 0, std430) buffer S_1 {
|
||||
Inner arr[];
|
||||
} s;
|
||||
void tint_symbol(uint idx) {
|
||||
ivec3 a = s.arr[idx].a;
|
||||
int b = s.arr[idx].b;
|
||||
uvec3 c = s.arr[idx].c;
|
||||
uint d = s.arr[idx].d;
|
||||
vec3 e = s.arr[idx].e;
|
||||
float f = s.arr[idx].f;
|
||||
mat2x3 g = s.arr[idx].g;
|
||||
mat3x2 h = s.arr[idx].h;
|
||||
ivec4 i[4] = s.arr[idx].i;
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
tint_symbol(gl_LocalInvocationIndex);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
ByteAddressBuffer s : register(t0, space0);
|
||||
|
||||
struct tint_symbol_1 {
|
||||
uint idx : SV_GroupIndex;
|
||||
};
|
||||
|
||||
float2x3 tint_symbol_8(ByteAddressBuffer buffer, uint offset) {
|
||||
return float2x3(asfloat(buffer.Load3((offset + 0u))), asfloat(buffer.Load3((offset + 16u))));
|
||||
}
|
||||
|
||||
float3x2 tint_symbol_9(ByteAddressBuffer buffer, uint offset) {
|
||||
return float3x2(asfloat(buffer.Load2((offset + 0u))), asfloat(buffer.Load2((offset + 8u))), asfloat(buffer.Load2((offset + 16u))));
|
||||
}
|
||||
|
||||
typedef int4 tint_symbol_11_ret[4];
|
||||
tint_symbol_11_ret tint_symbol_11(ByteAddressBuffer buffer, uint offset) {
|
||||
int4 arr_1[4] = (int4[4])0;
|
||||
{
|
||||
[loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
|
||||
arr_1[i_1] = asint(buffer.Load4((offset + (i_1 * 16u))));
|
||||
}
|
||||
}
|
||||
return arr_1;
|
||||
}
|
||||
|
||||
void main_inner(uint idx) {
|
||||
const int3 a = asint(s.Load3((176u * idx)));
|
||||
const int b = asint(s.Load(((176u * idx) + 12u)));
|
||||
const uint3 c = s.Load3(((176u * idx) + 16u));
|
||||
const uint d = s.Load(((176u * idx) + 28u));
|
||||
const float3 e = asfloat(s.Load3(((176u * idx) + 32u)));
|
||||
const float f = asfloat(s.Load(((176u * idx) + 44u)));
|
||||
const float2x3 g = tint_symbol_8(s, ((176u * idx) + 48u));
|
||||
const float3x2 h = tint_symbol_9(s, ((176u * idx) + 80u));
|
||||
const int4 i[4] = tint_symbol_11(s, ((176u * idx) + 112u));
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main(tint_symbol_1 tint_symbol) {
|
||||
main_inner(tint_symbol.idx);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
template<typename T, int N, int M>
|
||||
inline vec<T, M> operator*(matrix<T, N, M> lhs, packed_vec<T, N> rhs) {
|
||||
return lhs * vec<T, N>(rhs);
|
||||
}
|
||||
|
||||
template<typename T, int N, int M>
|
||||
inline vec<T, N> operator*(packed_vec<T, M> lhs, matrix<T, N, M> rhs) {
|
||||
return vec<T, M>(lhs) * rhs;
|
||||
}
|
||||
|
||||
struct tint_array_wrapper {
|
||||
/* 0x0000 */ int4 arr[4];
|
||||
};
|
||||
|
||||
struct Inner {
|
||||
/* 0x0000 */ packed_int3 a;
|
||||
/* 0x000c */ int b;
|
||||
/* 0x0010 */ packed_uint3 c;
|
||||
/* 0x001c */ uint d;
|
||||
/* 0x0020 */ packed_float3 e;
|
||||
/* 0x002c */ float f;
|
||||
/* 0x0030 */ float2x3 g;
|
||||
/* 0x0050 */ float3x2 h;
|
||||
/* 0x0068 */ int8_t tint_pad[8];
|
||||
/* 0x0070 */ tint_array_wrapper i;
|
||||
};
|
||||
|
||||
struct S {
|
||||
/* 0x0000 */ Inner arr[1];
|
||||
};
|
||||
|
||||
void tint_symbol_inner(uint idx, const device S* const tint_symbol_1) {
|
||||
int3 const a = (*(tint_symbol_1)).arr[idx].a;
|
||||
int const b = (*(tint_symbol_1)).arr[idx].b;
|
||||
uint3 const c = (*(tint_symbol_1)).arr[idx].c;
|
||||
uint const d = (*(tint_symbol_1)).arr[idx].d;
|
||||
float3 const e = (*(tint_symbol_1)).arr[idx].e;
|
||||
float const f = (*(tint_symbol_1)).arr[idx].f;
|
||||
float2x3 const g = (*(tint_symbol_1)).arr[idx].g;
|
||||
float3x2 const h = (*(tint_symbol_1)).arr[idx].h;
|
||||
tint_array_wrapper const i = (*(tint_symbol_1)).arr[idx].i;
|
||||
}
|
||||
|
||||
kernel void tint_symbol(const device S* tint_symbol_2 [[buffer(0)]], uint idx [[thread_index_in_threadgroup]]) {
|
||||
tint_symbol_inner(idx, tint_symbol_2);
|
||||
return;
|
||||
}
|
||||
|
||||
115
test/tint/buffer/storage/dynamic_index/read.wgsl.expected.spvasm
Normal file
115
test/tint/buffer/storage/dynamic_index/read.wgsl.expected.spvasm
Normal file
@@ -0,0 +1,115 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 65
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main" %idx_1
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpName %idx_1 "idx_1"
|
||||
OpName %S "S"
|
||||
OpMemberName %S 0 "arr"
|
||||
OpName %Inner "Inner"
|
||||
OpMemberName %Inner 0 "a"
|
||||
OpMemberName %Inner 1 "b"
|
||||
OpMemberName %Inner 2 "c"
|
||||
OpMemberName %Inner 3 "d"
|
||||
OpMemberName %Inner 4 "e"
|
||||
OpMemberName %Inner 5 "f"
|
||||
OpMemberName %Inner 6 "g"
|
||||
OpMemberName %Inner 7 "h"
|
||||
OpMemberName %Inner 8 "i"
|
||||
OpName %s "s"
|
||||
OpName %main_inner "main_inner"
|
||||
OpName %idx "idx"
|
||||
OpName %main "main"
|
||||
OpDecorate %idx_1 BuiltIn LocalInvocationIndex
|
||||
OpDecorate %S Block
|
||||
OpMemberDecorate %S 0 Offset 0
|
||||
OpMemberDecorate %Inner 0 Offset 0
|
||||
OpMemberDecorate %Inner 1 Offset 12
|
||||
OpMemberDecorate %Inner 2 Offset 16
|
||||
OpMemberDecorate %Inner 3 Offset 28
|
||||
OpMemberDecorate %Inner 4 Offset 32
|
||||
OpMemberDecorate %Inner 5 Offset 44
|
||||
OpMemberDecorate %Inner 6 Offset 48
|
||||
OpMemberDecorate %Inner 6 ColMajor
|
||||
OpMemberDecorate %Inner 6 MatrixStride 16
|
||||
OpMemberDecorate %Inner 7 Offset 80
|
||||
OpMemberDecorate %Inner 7 ColMajor
|
||||
OpMemberDecorate %Inner 7 MatrixStride 8
|
||||
OpMemberDecorate %Inner 8 Offset 112
|
||||
OpDecorate %_arr_v4int_uint_4 ArrayStride 16
|
||||
OpDecorate %_runtimearr_Inner ArrayStride 176
|
||||
OpDecorate %s NonWritable
|
||||
OpDecorate %s Binding 0
|
||||
OpDecorate %s DescriptorSet 0
|
||||
%uint = OpTypeInt 32 0
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%idx_1 = OpVariable %_ptr_Input_uint Input
|
||||
%int = OpTypeInt 32 1
|
||||
%v3int = OpTypeVector %int 3
|
||||
%v3uint = OpTypeVector %uint 3
|
||||
%float = OpTypeFloat 32
|
||||
%v3float = OpTypeVector %float 3
|
||||
%mat2v3float = OpTypeMatrix %v3float 2
|
||||
%v2float = OpTypeVector %float 2
|
||||
%mat3v2float = OpTypeMatrix %v2float 3
|
||||
%v4int = OpTypeVector %int 4
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%_arr_v4int_uint_4 = OpTypeArray %v4int %uint_4
|
||||
%Inner = OpTypeStruct %v3int %int %v3uint %uint %v3float %float %mat2v3float %mat3v2float %_arr_v4int_uint_4
|
||||
%_runtimearr_Inner = OpTypeRuntimeArray %Inner
|
||||
%S = OpTypeStruct %_runtimearr_Inner
|
||||
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
|
||||
%s = OpVariable %_ptr_StorageBuffer_S StorageBuffer
|
||||
%void = OpTypeVoid
|
||||
%20 = OpTypeFunction %void %uint
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_StorageBuffer_v3int = OpTypePointer StorageBuffer %v3int
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_ptr_StorageBuffer_v3uint = OpTypePointer StorageBuffer %v3uint
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
|
||||
%_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float
|
||||
%uint_5 = OpConstant %uint 5
|
||||
%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
|
||||
%uint_6 = OpConstant %uint 6
|
||||
%_ptr_StorageBuffer_mat2v3float = OpTypePointer StorageBuffer %mat2v3float
|
||||
%uint_7 = OpConstant %uint 7
|
||||
%_ptr_StorageBuffer_mat3v2float = OpTypePointer StorageBuffer %mat3v2float
|
||||
%uint_8 = OpConstant %uint 8
|
||||
%_ptr_StorageBuffer__arr_v4int_uint_4 = OpTypePointer StorageBuffer %_arr_v4int_uint_4
|
||||
%60 = OpTypeFunction %void
|
||||
%main_inner = OpFunction %void None %20
|
||||
%idx = OpFunctionParameter %uint
|
||||
%24 = OpLabel
|
||||
%27 = OpAccessChain %_ptr_StorageBuffer_v3int %s %uint_0 %idx %uint_0
|
||||
%28 = OpLoad %v3int %27
|
||||
%31 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %idx %uint_1
|
||||
%32 = OpLoad %int %31
|
||||
%35 = OpAccessChain %_ptr_StorageBuffer_v3uint %s %uint_0 %idx %uint_2
|
||||
%36 = OpLoad %v3uint %35
|
||||
%39 = OpAccessChain %_ptr_StorageBuffer_uint %s %uint_0 %idx %uint_3
|
||||
%40 = OpLoad %uint %39
|
||||
%42 = OpAccessChain %_ptr_StorageBuffer_v3float %s %uint_0 %idx %uint_4
|
||||
%43 = OpLoad %v3float %42
|
||||
%46 = OpAccessChain %_ptr_StorageBuffer_float %s %uint_0 %idx %uint_5
|
||||
%47 = OpLoad %float %46
|
||||
%50 = OpAccessChain %_ptr_StorageBuffer_mat2v3float %s %uint_0 %idx %uint_6
|
||||
%51 = OpLoad %mat2v3float %50
|
||||
%54 = OpAccessChain %_ptr_StorageBuffer_mat3v2float %s %uint_0 %idx %uint_7
|
||||
%55 = OpLoad %mat3v2float %54
|
||||
%58 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %s %uint_0 %idx %uint_8
|
||||
%59 = OpLoad %_arr_v4int_uint_4 %58
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%main = OpFunction %void None %60
|
||||
%62 = OpLabel
|
||||
%64 = OpLoad %uint %idx_1
|
||||
%63 = OpFunctionCall %void %main_inner %64
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,30 @@
|
||||
struct Inner {
|
||||
a : vec3<i32>;
|
||||
b : i32;
|
||||
c : vec3<u32>;
|
||||
d : u32;
|
||||
e : vec3<f32>;
|
||||
f : f32;
|
||||
g : mat2x3<f32>;
|
||||
h : mat3x2<f32>;
|
||||
i : array<vec4<i32>, 4>;
|
||||
}
|
||||
|
||||
struct S {
|
||||
arr : array<Inner>;
|
||||
}
|
||||
|
||||
@binding(0) @group(0) var<storage, read> s : S;
|
||||
|
||||
@stage(compute) @workgroup_size(1)
|
||||
fn main(@builtin(local_invocation_index) idx : u32) {
|
||||
let a = s.arr[idx].a;
|
||||
let b = s.arr[idx].b;
|
||||
let c = s.arr[idx].c;
|
||||
let d = s.arr[idx].d;
|
||||
let e = s.arr[idx].e;
|
||||
let f = s.arr[idx].f;
|
||||
let g = s.arr[idx].g;
|
||||
let h = s.arr[idx].h;
|
||||
let i = s.arr[idx].i;
|
||||
}
|
||||
30
test/tint/buffer/storage/dynamic_index/write.wgsl
Normal file
30
test/tint/buffer/storage/dynamic_index/write.wgsl
Normal file
@@ -0,0 +1,30 @@
|
||||
struct Inner {
|
||||
a : vec3<i32>;
|
||||
b : i32;
|
||||
c : vec3<u32>;
|
||||
d : u32;
|
||||
e : vec3<f32>;
|
||||
f : f32;
|
||||
g : mat2x3<f32>;
|
||||
h : mat3x2<f32>;
|
||||
i : array<vec4<i32>, 4>;
|
||||
};
|
||||
|
||||
struct S {
|
||||
arr : array<Inner>;
|
||||
};
|
||||
|
||||
@binding(0) @group(0) var<storage, read_write> s : S;
|
||||
|
||||
@stage(compute) @workgroup_size(1)
|
||||
fn main(@builtin(local_invocation_index) idx : u32) {
|
||||
s.arr[idx].a = vec3<i32>();
|
||||
s.arr[idx].b = i32();
|
||||
s.arr[idx].c = vec3<u32>();
|
||||
s.arr[idx].d = u32();
|
||||
s.arr[idx].e = vec3<f32>();
|
||||
s.arr[idx].f = f32();
|
||||
s.arr[idx].g = mat2x3<f32>();
|
||||
s.arr[idx].h = mat3x2<f32>();
|
||||
s.arr[idx].i = array<vec4<i32>, 4>();
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
#version 310 es
|
||||
|
||||
struct Inner {
|
||||
ivec3 a;
|
||||
int b;
|
||||
uvec3 c;
|
||||
uint d;
|
||||
vec3 e;
|
||||
float f;
|
||||
mat2x3 g;
|
||||
mat3x2 h;
|
||||
ivec4 i[4];
|
||||
};
|
||||
|
||||
layout(binding = 0, std430) buffer S_1 {
|
||||
Inner arr[];
|
||||
} s;
|
||||
void tint_symbol(uint idx) {
|
||||
s.arr[idx].a = ivec3(0, 0, 0);
|
||||
s.arr[idx].b = 0;
|
||||
s.arr[idx].c = uvec3(0u, 0u, 0u);
|
||||
s.arr[idx].d = 0u;
|
||||
s.arr[idx].e = vec3(0.0f, 0.0f, 0.0f);
|
||||
s.arr[idx].f = 0.0f;
|
||||
s.arr[idx].g = mat2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
|
||||
s.arr[idx].h = mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
|
||||
ivec4 tint_symbol_1[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
|
||||
s.arr[idx].i = tint_symbol_1;
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
tint_symbol(gl_LocalInvocationIndex);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
RWByteAddressBuffer s : register(u0, space0);
|
||||
|
||||
struct tint_symbol_1 {
|
||||
uint idx : SV_GroupIndex;
|
||||
};
|
||||
|
||||
void tint_symbol_8(RWByteAddressBuffer buffer, uint offset, float2x3 value) {
|
||||
buffer.Store3((offset + 0u), asuint(value[0u]));
|
||||
buffer.Store3((offset + 16u), asuint(value[1u]));
|
||||
}
|
||||
|
||||
void tint_symbol_9(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_11(RWByteAddressBuffer buffer, uint offset, int4 value[4]) {
|
||||
int4 array[4] = value;
|
||||
{
|
||||
[loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
|
||||
buffer.Store4((offset + (i_1 * 16u)), asuint(array[i_1]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void main_inner(uint idx) {
|
||||
s.Store3((176u * idx), asuint(int3(0, 0, 0)));
|
||||
s.Store(((176u * idx) + 12u), asuint(0));
|
||||
s.Store3(((176u * idx) + 16u), asuint(uint3(0u, 0u, 0u)));
|
||||
s.Store(((176u * idx) + 28u), asuint(0u));
|
||||
s.Store3(((176u * idx) + 32u), asuint(float3(0.0f, 0.0f, 0.0f)));
|
||||
s.Store(((176u * idx) + 44u), asuint(0.0f));
|
||||
tint_symbol_8(s, ((176u * idx) + 48u), float2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f));
|
||||
tint_symbol_9(s, ((176u * idx) + 80u), float3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f));
|
||||
const int4 tint_symbol_13[4] = (int4[4])0;
|
||||
tint_symbol_11(s, ((176u * idx) + 112u), tint_symbol_13);
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main(tint_symbol_1 tint_symbol) {
|
||||
main_inner(tint_symbol.idx);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
template<typename T, int N, int M>
|
||||
inline vec<T, M> operator*(matrix<T, N, M> lhs, packed_vec<T, N> rhs) {
|
||||
return lhs * vec<T, N>(rhs);
|
||||
}
|
||||
|
||||
template<typename T, int N, int M>
|
||||
inline vec<T, N> operator*(packed_vec<T, M> lhs, matrix<T, N, M> rhs) {
|
||||
return vec<T, M>(lhs) * rhs;
|
||||
}
|
||||
|
||||
struct tint_array_wrapper {
|
||||
/* 0x0000 */ int4 arr[4];
|
||||
};
|
||||
|
||||
struct Inner {
|
||||
/* 0x0000 */ packed_int3 a;
|
||||
/* 0x000c */ int b;
|
||||
/* 0x0010 */ packed_uint3 c;
|
||||
/* 0x001c */ uint d;
|
||||
/* 0x0020 */ packed_float3 e;
|
||||
/* 0x002c */ float f;
|
||||
/* 0x0030 */ float2x3 g;
|
||||
/* 0x0050 */ float3x2 h;
|
||||
/* 0x0068 */ int8_t tint_pad[8];
|
||||
/* 0x0070 */ tint_array_wrapper i;
|
||||
};
|
||||
|
||||
struct S {
|
||||
/* 0x0000 */ Inner arr[1];
|
||||
};
|
||||
|
||||
void tint_symbol_inner(uint idx, device S* const tint_symbol_2) {
|
||||
(*(tint_symbol_2)).arr[idx].a = int3();
|
||||
(*(tint_symbol_2)).arr[idx].b = int();
|
||||
(*(tint_symbol_2)).arr[idx].c = uint3();
|
||||
(*(tint_symbol_2)).arr[idx].d = uint();
|
||||
(*(tint_symbol_2)).arr[idx].e = float3();
|
||||
(*(tint_symbol_2)).arr[idx].f = float();
|
||||
(*(tint_symbol_2)).arr[idx].g = float2x3();
|
||||
(*(tint_symbol_2)).arr[idx].h = float3x2();
|
||||
tint_array_wrapper const tint_symbol_1 = {.arr={}};
|
||||
(*(tint_symbol_2)).arr[idx].i = tint_symbol_1;
|
||||
}
|
||||
|
||||
kernel void tint_symbol(device S* tint_symbol_3 [[buffer(0)]], uint idx [[thread_index_in_threadgroup]]) {
|
||||
tint_symbol_inner(idx, tint_symbol_3);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 65
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main" %idx_1
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpName %idx_1 "idx_1"
|
||||
OpName %S "S"
|
||||
OpMemberName %S 0 "arr"
|
||||
OpName %Inner "Inner"
|
||||
OpMemberName %Inner 0 "a"
|
||||
OpMemberName %Inner 1 "b"
|
||||
OpMemberName %Inner 2 "c"
|
||||
OpMemberName %Inner 3 "d"
|
||||
OpMemberName %Inner 4 "e"
|
||||
OpMemberName %Inner 5 "f"
|
||||
OpMemberName %Inner 6 "g"
|
||||
OpMemberName %Inner 7 "h"
|
||||
OpMemberName %Inner 8 "i"
|
||||
OpName %s "s"
|
||||
OpName %main_inner "main_inner"
|
||||
OpName %idx "idx"
|
||||
OpName %main "main"
|
||||
OpDecorate %idx_1 BuiltIn LocalInvocationIndex
|
||||
OpDecorate %S Block
|
||||
OpMemberDecorate %S 0 Offset 0
|
||||
OpMemberDecorate %Inner 0 Offset 0
|
||||
OpMemberDecorate %Inner 1 Offset 12
|
||||
OpMemberDecorate %Inner 2 Offset 16
|
||||
OpMemberDecorate %Inner 3 Offset 28
|
||||
OpMemberDecorate %Inner 4 Offset 32
|
||||
OpMemberDecorate %Inner 5 Offset 44
|
||||
OpMemberDecorate %Inner 6 Offset 48
|
||||
OpMemberDecorate %Inner 6 ColMajor
|
||||
OpMemberDecorate %Inner 6 MatrixStride 16
|
||||
OpMemberDecorate %Inner 7 Offset 80
|
||||
OpMemberDecorate %Inner 7 ColMajor
|
||||
OpMemberDecorate %Inner 7 MatrixStride 8
|
||||
OpMemberDecorate %Inner 8 Offset 112
|
||||
OpDecorate %_arr_v4int_uint_4 ArrayStride 16
|
||||
OpDecorate %_runtimearr_Inner ArrayStride 176
|
||||
OpDecorate %s Binding 0
|
||||
OpDecorate %s DescriptorSet 0
|
||||
%uint = OpTypeInt 32 0
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%idx_1 = OpVariable %_ptr_Input_uint Input
|
||||
%int = OpTypeInt 32 1
|
||||
%v3int = OpTypeVector %int 3
|
||||
%v3uint = OpTypeVector %uint 3
|
||||
%float = OpTypeFloat 32
|
||||
%v3float = OpTypeVector %float 3
|
||||
%mat2v3float = OpTypeMatrix %v3float 2
|
||||
%v2float = OpTypeVector %float 2
|
||||
%mat3v2float = OpTypeMatrix %v2float 3
|
||||
%v4int = OpTypeVector %int 4
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%_arr_v4int_uint_4 = OpTypeArray %v4int %uint_4
|
||||
%Inner = OpTypeStruct %v3int %int %v3uint %uint %v3float %float %mat2v3float %mat3v2float %_arr_v4int_uint_4
|
||||
%_runtimearr_Inner = OpTypeRuntimeArray %Inner
|
||||
%S = OpTypeStruct %_runtimearr_Inner
|
||||
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
|
||||
%s = OpVariable %_ptr_StorageBuffer_S StorageBuffer
|
||||
%void = OpTypeVoid
|
||||
%20 = OpTypeFunction %void %uint
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_StorageBuffer_v3int = OpTypePointer StorageBuffer %v3int
|
||||
%28 = OpConstantNull %v3int
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
|
||||
%32 = OpConstantNull %int
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_ptr_StorageBuffer_v3uint = OpTypePointer StorageBuffer %v3uint
|
||||
%36 = OpConstantNull %v3uint
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
|
||||
%40 = OpConstantNull %uint
|
||||
%_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float
|
||||
%43 = OpConstantNull %v3float
|
||||
%uint_5 = OpConstant %uint 5
|
||||
%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
|
||||
%47 = OpConstantNull %float
|
||||
%uint_6 = OpConstant %uint 6
|
||||
%_ptr_StorageBuffer_mat2v3float = OpTypePointer StorageBuffer %mat2v3float
|
||||
%51 = OpConstantNull %mat2v3float
|
||||
%uint_7 = OpConstant %uint 7
|
||||
%_ptr_StorageBuffer_mat3v2float = OpTypePointer StorageBuffer %mat3v2float
|
||||
%55 = OpConstantNull %mat3v2float
|
||||
%uint_8 = OpConstant %uint 8
|
||||
%_ptr_StorageBuffer__arr_v4int_uint_4 = OpTypePointer StorageBuffer %_arr_v4int_uint_4
|
||||
%59 = OpConstantNull %_arr_v4int_uint_4
|
||||
%60 = OpTypeFunction %void
|
||||
%main_inner = OpFunction %void None %20
|
||||
%idx = OpFunctionParameter %uint
|
||||
%24 = OpLabel
|
||||
%27 = OpAccessChain %_ptr_StorageBuffer_v3int %s %uint_0 %idx %uint_0
|
||||
OpStore %27 %28
|
||||
%31 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %idx %uint_1
|
||||
OpStore %31 %32
|
||||
%35 = OpAccessChain %_ptr_StorageBuffer_v3uint %s %uint_0 %idx %uint_2
|
||||
OpStore %35 %36
|
||||
%39 = OpAccessChain %_ptr_StorageBuffer_uint %s %uint_0 %idx %uint_3
|
||||
OpStore %39 %40
|
||||
%42 = OpAccessChain %_ptr_StorageBuffer_v3float %s %uint_0 %idx %uint_4
|
||||
OpStore %42 %43
|
||||
%46 = OpAccessChain %_ptr_StorageBuffer_float %s %uint_0 %idx %uint_5
|
||||
OpStore %46 %47
|
||||
%50 = OpAccessChain %_ptr_StorageBuffer_mat2v3float %s %uint_0 %idx %uint_6
|
||||
OpStore %50 %51
|
||||
%54 = OpAccessChain %_ptr_StorageBuffer_mat3v2float %s %uint_0 %idx %uint_7
|
||||
OpStore %54 %55
|
||||
%58 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %s %uint_0 %idx %uint_8
|
||||
OpStore %58 %59
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%main = OpFunction %void None %60
|
||||
%62 = OpLabel
|
||||
%64 = OpLoad %uint %idx_1
|
||||
%63 = OpFunctionCall %void %main_inner %64
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,30 @@
|
||||
struct Inner {
|
||||
a : vec3<i32>;
|
||||
b : i32;
|
||||
c : vec3<u32>;
|
||||
d : u32;
|
||||
e : vec3<f32>;
|
||||
f : f32;
|
||||
g : mat2x3<f32>;
|
||||
h : mat3x2<f32>;
|
||||
i : array<vec4<i32>, 4>;
|
||||
}
|
||||
|
||||
struct S {
|
||||
arr : array<Inner>;
|
||||
}
|
||||
|
||||
@binding(0) @group(0) var<storage, read_write> s : S;
|
||||
|
||||
@stage(compute) @workgroup_size(1)
|
||||
fn main(@builtin(local_invocation_index) idx : u32) {
|
||||
s.arr[idx].a = vec3<i32>();
|
||||
s.arr[idx].b = i32();
|
||||
s.arr[idx].c = vec3<u32>();
|
||||
s.arr[idx].d = u32();
|
||||
s.arr[idx].e = vec3<f32>();
|
||||
s.arr[idx].f = f32();
|
||||
s.arr[idx].g = mat2x3<f32>();
|
||||
s.arr[idx].h = mat3x2<f32>();
|
||||
s.arr[idx].i = array<vec4<i32>, 4>();
|
||||
}
|
||||
32
test/tint/buffer/storage/static_index/read.wgsl
Normal file
32
test/tint/buffer/storage/static_index/read.wgsl
Normal file
@@ -0,0 +1,32 @@
|
||||
struct Inner {
|
||||
x : i32;
|
||||
};
|
||||
|
||||
struct S {
|
||||
a : vec3<i32>;
|
||||
b : i32;
|
||||
c : vec3<u32>;
|
||||
d : u32;
|
||||
e : vec3<f32>;
|
||||
f : f32;
|
||||
g : mat2x3<f32>;
|
||||
h : mat3x2<f32>;
|
||||
i : Inner;
|
||||
j : array<Inner, 4>;
|
||||
};
|
||||
|
||||
@binding(0) @group(0) var<storage, read> s : S;
|
||||
|
||||
@stage(compute) @workgroup_size(1)
|
||||
fn main() {
|
||||
let a = s.a;
|
||||
let b = s.b;
|
||||
let c = s.c;
|
||||
let d = s.d;
|
||||
let e = s.e;
|
||||
let f = s.f;
|
||||
let g = s.g;
|
||||
let h = s.h;
|
||||
let i = s.i;
|
||||
let j = s.j;
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
#version 310 es
|
||||
|
||||
struct Inner {
|
||||
int x;
|
||||
};
|
||||
|
||||
struct S {
|
||||
ivec3 a;
|
||||
int b;
|
||||
uvec3 c;
|
||||
uint d;
|
||||
vec3 e;
|
||||
float f;
|
||||
mat2x3 g;
|
||||
mat3x2 h;
|
||||
Inner i;
|
||||
Inner j[4];
|
||||
};
|
||||
|
||||
layout(binding = 0, std430) buffer S_1 {
|
||||
ivec3 a;
|
||||
int b;
|
||||
uvec3 c;
|
||||
uint d;
|
||||
vec3 e;
|
||||
float f;
|
||||
mat2x3 g;
|
||||
mat3x2 h;
|
||||
Inner i;
|
||||
Inner j[4];
|
||||
} s;
|
||||
void tint_symbol() {
|
||||
ivec3 a = s.a;
|
||||
int b = s.b;
|
||||
uvec3 c = s.c;
|
||||
uint d = s.d;
|
||||
vec3 e = s.e;
|
||||
float f = s.f;
|
||||
mat2x3 g = s.g;
|
||||
mat3x2 h = s.h;
|
||||
Inner i = s.i;
|
||||
Inner j[4] = s.j;
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
tint_symbol();
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
struct Inner {
|
||||
int x;
|
||||
};
|
||||
|
||||
ByteAddressBuffer s : register(t0, space0);
|
||||
|
||||
float2x3 tint_symbol_6(ByteAddressBuffer buffer, uint offset) {
|
||||
return float2x3(asfloat(buffer.Load3((offset + 0u))), asfloat(buffer.Load3((offset + 16u))));
|
||||
}
|
||||
|
||||
float3x2 tint_symbol_7(ByteAddressBuffer buffer, uint offset) {
|
||||
return float3x2(asfloat(buffer.Load2((offset + 0u))), asfloat(buffer.Load2((offset + 8u))), asfloat(buffer.Load2((offset + 16u))));
|
||||
}
|
||||
|
||||
Inner tint_symbol_9(ByteAddressBuffer buffer, uint offset) {
|
||||
const Inner tint_symbol_11 = {asint(buffer.Load((offset + 0u)))};
|
||||
return tint_symbol_11;
|
||||
}
|
||||
|
||||
typedef Inner tint_symbol_10_ret[4];
|
||||
tint_symbol_10_ret tint_symbol_10(ByteAddressBuffer buffer, 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_9(buffer, (offset + (i_1 * 4u)));
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
const int3 a = asint(s.Load3(0u));
|
||||
const int b = asint(s.Load(12u));
|
||||
const uint3 c = s.Load3(16u);
|
||||
const uint d = s.Load(28u);
|
||||
const float3 e = asfloat(s.Load3(32u));
|
||||
const float f = asfloat(s.Load(44u));
|
||||
const float2x3 g = tint_symbol_6(s, 48u);
|
||||
const float3x2 h = tint_symbol_7(s, 80u);
|
||||
const Inner i = tint_symbol_9(s, 104u);
|
||||
const Inner j[4] = tint_symbol_10(s, 108u);
|
||||
return;
|
||||
}
|
||||
50
test/tint/buffer/storage/static_index/read.wgsl.expected.msl
Normal file
50
test/tint/buffer/storage/static_index/read.wgsl.expected.msl
Normal file
@@ -0,0 +1,50 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
template<typename T, int N, int M>
|
||||
inline vec<T, M> operator*(matrix<T, N, M> lhs, packed_vec<T, N> rhs) {
|
||||
return lhs * vec<T, N>(rhs);
|
||||
}
|
||||
|
||||
template<typename T, int N, int M>
|
||||
inline vec<T, N> operator*(packed_vec<T, M> lhs, matrix<T, N, M> rhs) {
|
||||
return vec<T, M>(lhs) * rhs;
|
||||
}
|
||||
|
||||
struct Inner {
|
||||
/* 0x0000 */ int x;
|
||||
};
|
||||
|
||||
struct tint_array_wrapper {
|
||||
/* 0x0000 */ Inner arr[4];
|
||||
};
|
||||
|
||||
struct S {
|
||||
/* 0x0000 */ packed_int3 a;
|
||||
/* 0x000c */ int b;
|
||||
/* 0x0010 */ packed_uint3 c;
|
||||
/* 0x001c */ uint d;
|
||||
/* 0x0020 */ packed_float3 e;
|
||||
/* 0x002c */ float f;
|
||||
/* 0x0030 */ float2x3 g;
|
||||
/* 0x0050 */ float3x2 h;
|
||||
/* 0x0068 */ Inner i;
|
||||
/* 0x006c */ tint_array_wrapper j;
|
||||
/* 0x007c */ int8_t tint_pad[4];
|
||||
};
|
||||
|
||||
kernel void tint_symbol(const device S* tint_symbol_1 [[buffer(0)]]) {
|
||||
int3 const a = (*(tint_symbol_1)).a;
|
||||
int const b = (*(tint_symbol_1)).b;
|
||||
uint3 const c = (*(tint_symbol_1)).c;
|
||||
uint const d = (*(tint_symbol_1)).d;
|
||||
float3 const e = (*(tint_symbol_1)).e;
|
||||
float const f = (*(tint_symbol_1)).f;
|
||||
float2x3 const g = (*(tint_symbol_1)).g;
|
||||
float3x2 const h = (*(tint_symbol_1)).h;
|
||||
Inner const i = (*(tint_symbol_1)).i;
|
||||
tint_array_wrapper const j = (*(tint_symbol_1)).j;
|
||||
return;
|
||||
}
|
||||
|
||||
104
test/tint/buffer/storage/static_index/read.wgsl.expected.spvasm
Normal file
104
test/tint/buffer/storage/static_index/read.wgsl.expected.spvasm
Normal file
@@ -0,0 +1,104 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 59
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpName %S "S"
|
||||
OpMemberName %S 0 "a"
|
||||
OpMemberName %S 1 "b"
|
||||
OpMemberName %S 2 "c"
|
||||
OpMemberName %S 3 "d"
|
||||
OpMemberName %S 4 "e"
|
||||
OpMemberName %S 5 "f"
|
||||
OpMemberName %S 6 "g"
|
||||
OpMemberName %S 7 "h"
|
||||
OpMemberName %S 8 "i"
|
||||
OpName %Inner "Inner"
|
||||
OpMemberName %Inner 0 "x"
|
||||
OpMemberName %S 9 "j"
|
||||
OpName %s "s"
|
||||
OpName %main "main"
|
||||
OpDecorate %S Block
|
||||
OpMemberDecorate %S 0 Offset 0
|
||||
OpMemberDecorate %S 1 Offset 12
|
||||
OpMemberDecorate %S 2 Offset 16
|
||||
OpMemberDecorate %S 3 Offset 28
|
||||
OpMemberDecorate %S 4 Offset 32
|
||||
OpMemberDecorate %S 5 Offset 44
|
||||
OpMemberDecorate %S 6 Offset 48
|
||||
OpMemberDecorate %S 6 ColMajor
|
||||
OpMemberDecorate %S 6 MatrixStride 16
|
||||
OpMemberDecorate %S 7 Offset 80
|
||||
OpMemberDecorate %S 7 ColMajor
|
||||
OpMemberDecorate %S 7 MatrixStride 8
|
||||
OpMemberDecorate %S 8 Offset 104
|
||||
OpMemberDecorate %Inner 0 Offset 0
|
||||
OpMemberDecorate %S 9 Offset 108
|
||||
OpDecorate %_arr_Inner_uint_4 ArrayStride 4
|
||||
OpDecorate %s NonWritable
|
||||
OpDecorate %s Binding 0
|
||||
OpDecorate %s DescriptorSet 0
|
||||
%int = OpTypeInt 32 1
|
||||
%v3int = OpTypeVector %int 3
|
||||
%uint = OpTypeInt 32 0
|
||||
%v3uint = OpTypeVector %uint 3
|
||||
%float = OpTypeFloat 32
|
||||
%v3float = OpTypeVector %float 3
|
||||
%mat2v3float = OpTypeMatrix %v3float 2
|
||||
%v2float = OpTypeVector %float 2
|
||||
%mat3v2float = OpTypeMatrix %v2float 3
|
||||
%Inner = OpTypeStruct %int
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%_arr_Inner_uint_4 = OpTypeArray %Inner %uint_4
|
||||
%S = OpTypeStruct %v3int %int %v3uint %uint %v3float %float %mat2v3float %mat3v2float %Inner %_arr_Inner_uint_4
|
||||
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
|
||||
%s = OpVariable %_ptr_StorageBuffer_S StorageBuffer
|
||||
%void = OpTypeVoid
|
||||
%16 = OpTypeFunction %void
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_StorageBuffer_v3int = OpTypePointer StorageBuffer %v3int
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_ptr_StorageBuffer_v3uint = OpTypePointer StorageBuffer %v3uint
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
|
||||
%_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float
|
||||
%uint_5 = OpConstant %uint 5
|
||||
%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
|
||||
%uint_6 = OpConstant %uint 6
|
||||
%_ptr_StorageBuffer_mat2v3float = OpTypePointer StorageBuffer %mat2v3float
|
||||
%uint_7 = OpConstant %uint 7
|
||||
%_ptr_StorageBuffer_mat3v2float = OpTypePointer StorageBuffer %mat3v2float
|
||||
%uint_8 = OpConstant %uint 8
|
||||
%_ptr_StorageBuffer_Inner = OpTypePointer StorageBuffer %Inner
|
||||
%uint_9 = OpConstant %uint 9
|
||||
%_ptr_StorageBuffer__arr_Inner_uint_4 = OpTypePointer StorageBuffer %_arr_Inner_uint_4
|
||||
%main = OpFunction %void None %16
|
||||
%19 = OpLabel
|
||||
%22 = OpAccessChain %_ptr_StorageBuffer_v3int %s %uint_0
|
||||
%23 = OpLoad %v3int %22
|
||||
%26 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_1
|
||||
%27 = OpLoad %int %26
|
||||
%30 = OpAccessChain %_ptr_StorageBuffer_v3uint %s %uint_2
|
||||
%31 = OpLoad %v3uint %30
|
||||
%34 = OpAccessChain %_ptr_StorageBuffer_uint %s %uint_3
|
||||
%35 = OpLoad %uint %34
|
||||
%37 = OpAccessChain %_ptr_StorageBuffer_v3float %s %uint_4
|
||||
%38 = OpLoad %v3float %37
|
||||
%41 = OpAccessChain %_ptr_StorageBuffer_float %s %uint_5
|
||||
%42 = OpLoad %float %41
|
||||
%45 = OpAccessChain %_ptr_StorageBuffer_mat2v3float %s %uint_6
|
||||
%46 = OpLoad %mat2v3float %45
|
||||
%49 = OpAccessChain %_ptr_StorageBuffer_mat3v2float %s %uint_7
|
||||
%50 = OpLoad %mat3v2float %49
|
||||
%53 = OpAccessChain %_ptr_StorageBuffer_Inner %s %uint_8
|
||||
%54 = OpLoad %Inner %53
|
||||
%57 = OpAccessChain %_ptr_StorageBuffer__arr_Inner_uint_4 %s %uint_9
|
||||
%58 = OpLoad %_arr_Inner_uint_4 %57
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,32 @@
|
||||
struct Inner {
|
||||
x : i32;
|
||||
}
|
||||
|
||||
struct S {
|
||||
a : vec3<i32>;
|
||||
b : i32;
|
||||
c : vec3<u32>;
|
||||
d : u32;
|
||||
e : vec3<f32>;
|
||||
f : f32;
|
||||
g : mat2x3<f32>;
|
||||
h : mat3x2<f32>;
|
||||
i : Inner;
|
||||
j : array<Inner, 4>;
|
||||
}
|
||||
|
||||
@binding(0) @group(0) var<storage, read> s : S;
|
||||
|
||||
@stage(compute) @workgroup_size(1)
|
||||
fn main() {
|
||||
let a = s.a;
|
||||
let b = s.b;
|
||||
let c = s.c;
|
||||
let d = s.d;
|
||||
let e = s.e;
|
||||
let f = s.f;
|
||||
let g = s.g;
|
||||
let h = s.h;
|
||||
let i = s.i;
|
||||
let j = s.j;
|
||||
}
|
||||
32
test/tint/buffer/storage/static_index/write.wgsl
Normal file
32
test/tint/buffer/storage/static_index/write.wgsl
Normal file
@@ -0,0 +1,32 @@
|
||||
struct Inner {
|
||||
x : i32;
|
||||
};
|
||||
|
||||
struct S {
|
||||
a : vec3<i32>;
|
||||
b : i32;
|
||||
c : vec3<u32>;
|
||||
d : u32;
|
||||
e : vec3<f32>;
|
||||
f : f32;
|
||||
g : mat2x3<f32>;
|
||||
h : mat3x2<f32>;
|
||||
i : Inner;
|
||||
j : array<Inner, 4>;
|
||||
};
|
||||
|
||||
@binding(0) @group(0) var<storage, write> s : S;
|
||||
|
||||
@stage(compute) @workgroup_size(1)
|
||||
fn main() {
|
||||
s.a = vec3<i32>();
|
||||
s.b = i32();
|
||||
s.c = vec3<u32>();
|
||||
s.d = u32();
|
||||
s.e = vec3<f32>();
|
||||
s.f = f32();
|
||||
s.g = mat2x3<f32>();
|
||||
s.h = mat3x2<f32>();
|
||||
s.i = Inner();
|
||||
s.j = array<Inner, 4>();
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
#version 310 es
|
||||
|
||||
struct Inner {
|
||||
int x;
|
||||
};
|
||||
|
||||
struct S {
|
||||
ivec3 a;
|
||||
int b;
|
||||
uvec3 c;
|
||||
uint d;
|
||||
vec3 e;
|
||||
float f;
|
||||
mat2x3 g;
|
||||
mat3x2 h;
|
||||
Inner i;
|
||||
Inner j[4];
|
||||
};
|
||||
|
||||
layout(binding = 0, std430) buffer S_1 {
|
||||
ivec3 a;
|
||||
int b;
|
||||
uvec3 c;
|
||||
uint d;
|
||||
vec3 e;
|
||||
float f;
|
||||
mat2x3 g;
|
||||
mat3x2 h;
|
||||
Inner i;
|
||||
Inner j[4];
|
||||
} s;
|
||||
void tint_symbol() {
|
||||
s.a = ivec3(0, 0, 0);
|
||||
s.b = 0;
|
||||
s.c = uvec3(0u, 0u, 0u);
|
||||
s.d = 0u;
|
||||
s.e = vec3(0.0f, 0.0f, 0.0f);
|
||||
s.f = 0.0f;
|
||||
s.g = mat2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
|
||||
s.h = mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
|
||||
Inner tint_symbol_1 = Inner(0);
|
||||
s.i = tint_symbol_1;
|
||||
Inner tint_symbol_2[4] = Inner[4](Inner(0), Inner(0), Inner(0), Inner(0));
|
||||
s.j = tint_symbol_2;
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
tint_symbol();
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
struct Inner {
|
||||
int x;
|
||||
};
|
||||
|
||||
RWByteAddressBuffer s : register(u0, space0);
|
||||
|
||||
void tint_symbol_6(RWByteAddressBuffer buffer, uint offset, float2x3 value) {
|
||||
buffer.Store3((offset + 0u), asuint(value[0u]));
|
||||
buffer.Store3((offset + 16u), asuint(value[1u]));
|
||||
}
|
||||
|
||||
void tint_symbol_7(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_9(RWByteAddressBuffer buffer, uint offset, Inner value) {
|
||||
buffer.Store((offset + 0u), asuint(value.x));
|
||||
}
|
||||
|
||||
void tint_symbol_10(RWByteAddressBuffer buffer, uint offset, Inner value[4]) {
|
||||
Inner array[4] = value;
|
||||
{
|
||||
[loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
|
||||
tint_symbol_9(buffer, (offset + (i_1 * 4u)), array[i_1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
s.Store3(0u, asuint(int3(0, 0, 0)));
|
||||
s.Store(12u, asuint(0));
|
||||
s.Store3(16u, asuint(uint3(0u, 0u, 0u)));
|
||||
s.Store(28u, asuint(0u));
|
||||
s.Store3(32u, asuint(float3(0.0f, 0.0f, 0.0f)));
|
||||
s.Store(44u, asuint(0.0f));
|
||||
tint_symbol_6(s, 48u, float2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f));
|
||||
tint_symbol_7(s, 80u, float3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f));
|
||||
const Inner tint_symbol_11 = (Inner)0;
|
||||
tint_symbol_9(s, 104u, tint_symbol_11);
|
||||
const Inner tint_symbol_12[4] = (Inner[4])0;
|
||||
tint_symbol_10(s, 108u, tint_symbol_12);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
template<typename T, int N, int M>
|
||||
inline vec<T, M> operator*(matrix<T, N, M> lhs, packed_vec<T, N> rhs) {
|
||||
return lhs * vec<T, N>(rhs);
|
||||
}
|
||||
|
||||
template<typename T, int N, int M>
|
||||
inline vec<T, N> operator*(packed_vec<T, M> lhs, matrix<T, N, M> rhs) {
|
||||
return vec<T, M>(lhs) * rhs;
|
||||
}
|
||||
|
||||
struct Inner {
|
||||
/* 0x0000 */ int x;
|
||||
};
|
||||
|
||||
struct tint_array_wrapper {
|
||||
/* 0x0000 */ Inner arr[4];
|
||||
};
|
||||
|
||||
struct S {
|
||||
/* 0x0000 */ packed_int3 a;
|
||||
/* 0x000c */ int b;
|
||||
/* 0x0010 */ packed_uint3 c;
|
||||
/* 0x001c */ uint d;
|
||||
/* 0x0020 */ packed_float3 e;
|
||||
/* 0x002c */ float f;
|
||||
/* 0x0030 */ float2x3 g;
|
||||
/* 0x0050 */ float3x2 h;
|
||||
/* 0x0068 */ Inner i;
|
||||
/* 0x006c */ tint_array_wrapper j;
|
||||
/* 0x007c */ int8_t tint_pad[4];
|
||||
};
|
||||
|
||||
kernel void tint_symbol(device S* tint_symbol_3 [[buffer(0)]]) {
|
||||
(*(tint_symbol_3)).a = int3();
|
||||
(*(tint_symbol_3)).b = int();
|
||||
(*(tint_symbol_3)).c = uint3();
|
||||
(*(tint_symbol_3)).d = uint();
|
||||
(*(tint_symbol_3)).e = float3();
|
||||
(*(tint_symbol_3)).f = float();
|
||||
(*(tint_symbol_3)).g = float2x3();
|
||||
(*(tint_symbol_3)).h = float3x2();
|
||||
Inner const tint_symbol_1 = {};
|
||||
(*(tint_symbol_3)).i = tint_symbol_1;
|
||||
tint_array_wrapper const tint_symbol_2 = {.arr={}};
|
||||
(*(tint_symbol_3)).j = tint_symbol_2;
|
||||
return;
|
||||
}
|
||||
|
||||
114
test/tint/buffer/storage/static_index/write.wgsl.expected.spvasm
Normal file
114
test/tint/buffer/storage/static_index/write.wgsl.expected.spvasm
Normal file
@@ -0,0 +1,114 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 59
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpName %S "S"
|
||||
OpMemberName %S 0 "a"
|
||||
OpMemberName %S 1 "b"
|
||||
OpMemberName %S 2 "c"
|
||||
OpMemberName %S 3 "d"
|
||||
OpMemberName %S 4 "e"
|
||||
OpMemberName %S 5 "f"
|
||||
OpMemberName %S 6 "g"
|
||||
OpMemberName %S 7 "h"
|
||||
OpMemberName %S 8 "i"
|
||||
OpName %Inner "Inner"
|
||||
OpMemberName %Inner 0 "x"
|
||||
OpMemberName %S 9 "j"
|
||||
OpName %s "s"
|
||||
OpName %main "main"
|
||||
OpDecorate %S Block
|
||||
OpMemberDecorate %S 0 Offset 0
|
||||
OpMemberDecorate %S 1 Offset 12
|
||||
OpMemberDecorate %S 2 Offset 16
|
||||
OpMemberDecorate %S 3 Offset 28
|
||||
OpMemberDecorate %S 4 Offset 32
|
||||
OpMemberDecorate %S 5 Offset 44
|
||||
OpMemberDecorate %S 6 Offset 48
|
||||
OpMemberDecorate %S 6 ColMajor
|
||||
OpMemberDecorate %S 6 MatrixStride 16
|
||||
OpMemberDecorate %S 7 Offset 80
|
||||
OpMemberDecorate %S 7 ColMajor
|
||||
OpMemberDecorate %S 7 MatrixStride 8
|
||||
OpMemberDecorate %S 8 Offset 104
|
||||
OpMemberDecorate %Inner 0 Offset 0
|
||||
OpMemberDecorate %S 9 Offset 108
|
||||
OpDecorate %_arr_Inner_uint_4 ArrayStride 4
|
||||
OpDecorate %s NonReadable
|
||||
OpDecorate %s Binding 0
|
||||
OpDecorate %s DescriptorSet 0
|
||||
%int = OpTypeInt 32 1
|
||||
%v3int = OpTypeVector %int 3
|
||||
%uint = OpTypeInt 32 0
|
||||
%v3uint = OpTypeVector %uint 3
|
||||
%float = OpTypeFloat 32
|
||||
%v3float = OpTypeVector %float 3
|
||||
%mat2v3float = OpTypeMatrix %v3float 2
|
||||
%v2float = OpTypeVector %float 2
|
||||
%mat3v2float = OpTypeMatrix %v2float 3
|
||||
%Inner = OpTypeStruct %int
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%_arr_Inner_uint_4 = OpTypeArray %Inner %uint_4
|
||||
%S = OpTypeStruct %v3int %int %v3uint %uint %v3float %float %mat2v3float %mat3v2float %Inner %_arr_Inner_uint_4
|
||||
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
|
||||
%s = OpVariable %_ptr_StorageBuffer_S StorageBuffer
|
||||
%void = OpTypeVoid
|
||||
%16 = OpTypeFunction %void
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_StorageBuffer_v3int = OpTypePointer StorageBuffer %v3int
|
||||
%23 = OpConstantNull %v3int
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
|
||||
%27 = OpConstantNull %int
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_ptr_StorageBuffer_v3uint = OpTypePointer StorageBuffer %v3uint
|
||||
%31 = OpConstantNull %v3uint
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
|
||||
%35 = OpConstantNull %uint
|
||||
%_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float
|
||||
%38 = OpConstantNull %v3float
|
||||
%uint_5 = OpConstant %uint 5
|
||||
%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
|
||||
%42 = OpConstantNull %float
|
||||
%uint_6 = OpConstant %uint 6
|
||||
%_ptr_StorageBuffer_mat2v3float = OpTypePointer StorageBuffer %mat2v3float
|
||||
%46 = OpConstantNull %mat2v3float
|
||||
%uint_7 = OpConstant %uint 7
|
||||
%_ptr_StorageBuffer_mat3v2float = OpTypePointer StorageBuffer %mat3v2float
|
||||
%50 = OpConstantNull %mat3v2float
|
||||
%uint_8 = OpConstant %uint 8
|
||||
%_ptr_StorageBuffer_Inner = OpTypePointer StorageBuffer %Inner
|
||||
%54 = OpConstantNull %Inner
|
||||
%uint_9 = OpConstant %uint 9
|
||||
%_ptr_StorageBuffer__arr_Inner_uint_4 = OpTypePointer StorageBuffer %_arr_Inner_uint_4
|
||||
%58 = OpConstantNull %_arr_Inner_uint_4
|
||||
%main = OpFunction %void None %16
|
||||
%19 = OpLabel
|
||||
%22 = OpAccessChain %_ptr_StorageBuffer_v3int %s %uint_0
|
||||
OpStore %22 %23
|
||||
%26 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_1
|
||||
OpStore %26 %27
|
||||
%30 = OpAccessChain %_ptr_StorageBuffer_v3uint %s %uint_2
|
||||
OpStore %30 %31
|
||||
%34 = OpAccessChain %_ptr_StorageBuffer_uint %s %uint_3
|
||||
OpStore %34 %35
|
||||
%37 = OpAccessChain %_ptr_StorageBuffer_v3float %s %uint_4
|
||||
OpStore %37 %38
|
||||
%41 = OpAccessChain %_ptr_StorageBuffer_float %s %uint_5
|
||||
OpStore %41 %42
|
||||
%45 = OpAccessChain %_ptr_StorageBuffer_mat2v3float %s %uint_6
|
||||
OpStore %45 %46
|
||||
%49 = OpAccessChain %_ptr_StorageBuffer_mat3v2float %s %uint_7
|
||||
OpStore %49 %50
|
||||
%53 = OpAccessChain %_ptr_StorageBuffer_Inner %s %uint_8
|
||||
OpStore %53 %54
|
||||
%57 = OpAccessChain %_ptr_StorageBuffer__arr_Inner_uint_4 %s %uint_9
|
||||
OpStore %57 %58
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,32 @@
|
||||
struct Inner {
|
||||
x : i32;
|
||||
}
|
||||
|
||||
struct S {
|
||||
a : vec3<i32>;
|
||||
b : i32;
|
||||
c : vec3<u32>;
|
||||
d : u32;
|
||||
e : vec3<f32>;
|
||||
f : f32;
|
||||
g : mat2x3<f32>;
|
||||
h : mat3x2<f32>;
|
||||
i : Inner;
|
||||
j : array<Inner, 4>;
|
||||
}
|
||||
|
||||
@binding(0) @group(0) var<storage, write> s : S;
|
||||
|
||||
@stage(compute) @workgroup_size(1)
|
||||
fn main() {
|
||||
s.a = vec3<i32>();
|
||||
s.b = i32();
|
||||
s.c = vec3<u32>();
|
||||
s.d = u32();
|
||||
s.e = vec3<f32>();
|
||||
s.f = f32();
|
||||
s.g = mat2x3<f32>();
|
||||
s.h = mat3x2<f32>();
|
||||
s.i = Inner();
|
||||
s.j = array<Inner, 4>();
|
||||
}
|
||||
10
test/tint/buffer/storage/types/array.wgsl
Normal file
10
test/tint/buffer/storage/types/array.wgsl
Normal file
@@ -0,0 +1,10 @@
|
||||
@group(0) @binding(0)
|
||||
var<storage, read> in : array<f32, 4>;
|
||||
|
||||
@group(0) @binding(1)
|
||||
var<storage, read_write> out : array<f32, 4>;
|
||||
|
||||
@stage(compute) @workgroup_size(1)
|
||||
fn main() {
|
||||
out = in;
|
||||
}
|
||||
21
test/tint/buffer/storage/types/array.wgsl.expected.glsl
Normal file
21
test/tint/buffer/storage/types/array.wgsl.expected.glsl
Normal file
@@ -0,0 +1,21 @@
|
||||
#version 310 es
|
||||
|
||||
struct tint_symbol_block {
|
||||
float inner[4];
|
||||
};
|
||||
|
||||
layout(binding = 0, std430) buffer tint_symbol_block_1 {
|
||||
float inner[4];
|
||||
} tint_symbol;
|
||||
layout(binding = 1, std430) buffer tint_symbol_block_2 {
|
||||
float inner[4];
|
||||
} tint_symbol_1;
|
||||
void tint_symbol_2() {
|
||||
tint_symbol_1.inner = tint_symbol.inner;
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
tint_symbol_2();
|
||||
return;
|
||||
}
|
||||
28
test/tint/buffer/storage/types/array.wgsl.expected.hlsl
Normal file
28
test/tint/buffer/storage/types/array.wgsl.expected.hlsl
Normal file
@@ -0,0 +1,28 @@
|
||||
ByteAddressBuffer tint_symbol : register(t0, space0);
|
||||
RWByteAddressBuffer tint_symbol_1 : register(u1, space0);
|
||||
|
||||
void tint_symbol_2(RWByteAddressBuffer buffer, uint offset, float value[4]) {
|
||||
float array[4] = value;
|
||||
{
|
||||
[loop] for(uint i = 0u; (i < 4u); i = (i + 1u)) {
|
||||
buffer.Store((offset + (i * 4u)), asuint(array[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
typedef float tint_symbol_4_ret[4];
|
||||
tint_symbol_4_ret tint_symbol_4(ByteAddressBuffer buffer, uint offset) {
|
||||
float arr[4] = (float[4])0;
|
||||
{
|
||||
[loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
|
||||
arr[i_1] = asfloat(buffer.Load((offset + (i_1 * 4u))));
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
tint_symbol_2(tint_symbol_1, 0u, tint_symbol_4(tint_symbol, 0u));
|
||||
return;
|
||||
}
|
||||
12
test/tint/buffer/storage/types/array.wgsl.expected.msl
Normal file
12
test/tint/buffer/storage/types/array.wgsl.expected.msl
Normal file
@@ -0,0 +1,12 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_array_wrapper {
|
||||
/* 0x0000 */ float arr[4];
|
||||
};
|
||||
|
||||
kernel void tint_symbol(device tint_array_wrapper* tint_symbol_1 [[buffer(0)]], const device tint_array_wrapper* tint_symbol_2 [[buffer(1)]]) {
|
||||
*(tint_symbol_1) = *(tint_symbol_2);
|
||||
return;
|
||||
}
|
||||
|
||||
42
test/tint/buffer/storage/types/array.wgsl.expected.spvasm
Normal file
42
test/tint/buffer/storage/types/array.wgsl.expected.spvasm
Normal file
@@ -0,0 +1,42 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 18
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpName %in_block "in_block"
|
||||
OpMemberName %in_block 0 "inner"
|
||||
OpName %in "in"
|
||||
OpName %out "out"
|
||||
OpName %main "main"
|
||||
OpDecorate %in_block Block
|
||||
OpMemberDecorate %in_block 0 Offset 0
|
||||
OpDecorate %_arr_float_uint_4 ArrayStride 4
|
||||
OpDecorate %in NonWritable
|
||||
OpDecorate %in DescriptorSet 0
|
||||
OpDecorate %in Binding 0
|
||||
OpDecorate %out DescriptorSet 0
|
||||
OpDecorate %out Binding 1
|
||||
%float = OpTypeFloat 32
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%_arr_float_uint_4 = OpTypeArray %float %uint_4
|
||||
%in_block = OpTypeStruct %_arr_float_uint_4
|
||||
%_ptr_StorageBuffer_in_block = OpTypePointer StorageBuffer %in_block
|
||||
%in = OpVariable %_ptr_StorageBuffer_in_block StorageBuffer
|
||||
%out = OpVariable %_ptr_StorageBuffer_in_block StorageBuffer
|
||||
%void = OpTypeVoid
|
||||
%9 = OpTypeFunction %void
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_StorageBuffer__arr_float_uint_4 = OpTypePointer StorageBuffer %_arr_float_uint_4
|
||||
%main = OpFunction %void None %9
|
||||
%12 = OpLabel
|
||||
%15 = OpAccessChain %_ptr_StorageBuffer__arr_float_uint_4 %out %uint_0
|
||||
%16 = OpAccessChain %_ptr_StorageBuffer__arr_float_uint_4 %in %uint_0
|
||||
%17 = OpLoad %_arr_float_uint_4 %16
|
||||
OpStore %15 %17
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
8
test/tint/buffer/storage/types/array.wgsl.expected.wgsl
Normal file
8
test/tint/buffer/storage/types/array.wgsl.expected.wgsl
Normal file
@@ -0,0 +1,8 @@
|
||||
@group(0) @binding(0) var<storage, read> in : array<f32, 4>;
|
||||
|
||||
@group(0) @binding(1) var<storage, read_write> out : array<f32, 4>;
|
||||
|
||||
@stage(compute) @workgroup_size(1)
|
||||
fn main() {
|
||||
out = in;
|
||||
}
|
||||
10
test/tint/buffer/storage/types/f32.wgsl
Normal file
10
test/tint/buffer/storage/types/f32.wgsl
Normal file
@@ -0,0 +1,10 @@
|
||||
@group(0) @binding(0)
|
||||
var<storage, read> in : f32;
|
||||
|
||||
@group(0) @binding(1)
|
||||
var<storage, read_write> out : f32;
|
||||
|
||||
@stage(compute) @workgroup_size(1)
|
||||
fn main() {
|
||||
out = in;
|
||||
}
|
||||
21
test/tint/buffer/storage/types/f32.wgsl.expected.glsl
Normal file
21
test/tint/buffer/storage/types/f32.wgsl.expected.glsl
Normal file
@@ -0,0 +1,21 @@
|
||||
#version 310 es
|
||||
|
||||
struct tint_symbol_block {
|
||||
float inner;
|
||||
};
|
||||
|
||||
layout(binding = 0, std430) buffer tint_symbol_block_1 {
|
||||
float inner;
|
||||
} tint_symbol;
|
||||
layout(binding = 1, std430) buffer tint_symbol_block_2 {
|
||||
float inner;
|
||||
} tint_symbol_1;
|
||||
void tint_symbol_2() {
|
||||
tint_symbol_1.inner = tint_symbol.inner;
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
tint_symbol_2();
|
||||
return;
|
||||
}
|
||||
8
test/tint/buffer/storage/types/f32.wgsl.expected.hlsl
Normal file
8
test/tint/buffer/storage/types/f32.wgsl.expected.hlsl
Normal file
@@ -0,0 +1,8 @@
|
||||
ByteAddressBuffer tint_symbol : register(t0, space0);
|
||||
RWByteAddressBuffer tint_symbol_1 : register(u1, space0);
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
tint_symbol_1.Store(0u, asuint(asfloat(tint_symbol.Load(0u))));
|
||||
return;
|
||||
}
|
||||
8
test/tint/buffer/storage/types/f32.wgsl.expected.msl
Normal file
8
test/tint/buffer/storage/types/f32.wgsl.expected.msl
Normal file
@@ -0,0 +1,8 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
kernel void tint_symbol(device float* tint_symbol_1 [[buffer(0)]], const device float* tint_symbol_2 [[buffer(1)]]) {
|
||||
*(tint_symbol_1) = *(tint_symbol_2);
|
||||
return;
|
||||
}
|
||||
|
||||
39
test/tint/buffer/storage/types/f32.wgsl.expected.spvasm
Normal file
39
test/tint/buffer/storage/types/f32.wgsl.expected.spvasm
Normal file
@@ -0,0 +1,39 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 16
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpName %in_block "in_block"
|
||||
OpMemberName %in_block 0 "inner"
|
||||
OpName %in "in"
|
||||
OpName %out "out"
|
||||
OpName %main "main"
|
||||
OpDecorate %in_block Block
|
||||
OpMemberDecorate %in_block 0 Offset 0
|
||||
OpDecorate %in NonWritable
|
||||
OpDecorate %in DescriptorSet 0
|
||||
OpDecorate %in Binding 0
|
||||
OpDecorate %out DescriptorSet 0
|
||||
OpDecorate %out Binding 1
|
||||
%float = OpTypeFloat 32
|
||||
%in_block = OpTypeStruct %float
|
||||
%_ptr_StorageBuffer_in_block = OpTypePointer StorageBuffer %in_block
|
||||
%in = OpVariable %_ptr_StorageBuffer_in_block StorageBuffer
|
||||
%out = OpVariable %_ptr_StorageBuffer_in_block StorageBuffer
|
||||
%void = OpTypeVoid
|
||||
%6 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
|
||||
%main = OpFunction %void None %6
|
||||
%9 = OpLabel
|
||||
%13 = OpAccessChain %_ptr_StorageBuffer_float %out %uint_0
|
||||
%14 = OpAccessChain %_ptr_StorageBuffer_float %in %uint_0
|
||||
%15 = OpLoad %float %14
|
||||
OpStore %13 %15
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
8
test/tint/buffer/storage/types/f32.wgsl.expected.wgsl
Normal file
8
test/tint/buffer/storage/types/f32.wgsl.expected.wgsl
Normal file
@@ -0,0 +1,8 @@
|
||||
@group(0) @binding(0) var<storage, read> in : f32;
|
||||
|
||||
@group(0) @binding(1) var<storage, read_write> out : f32;
|
||||
|
||||
@stage(compute) @workgroup_size(1)
|
||||
fn main() {
|
||||
out = in;
|
||||
}
|
||||
10
test/tint/buffer/storage/types/i32.wgsl
Normal file
10
test/tint/buffer/storage/types/i32.wgsl
Normal file
@@ -0,0 +1,10 @@
|
||||
@group(0) @binding(0)
|
||||
var<storage, read> in : i32;
|
||||
|
||||
@group(0) @binding(1)
|
||||
var<storage, read_write> out : i32;
|
||||
|
||||
@stage(compute) @workgroup_size(1)
|
||||
fn main() {
|
||||
out = in;
|
||||
}
|
||||
21
test/tint/buffer/storage/types/i32.wgsl.expected.glsl
Normal file
21
test/tint/buffer/storage/types/i32.wgsl.expected.glsl
Normal file
@@ -0,0 +1,21 @@
|
||||
#version 310 es
|
||||
|
||||
struct tint_symbol_block {
|
||||
int inner;
|
||||
};
|
||||
|
||||
layout(binding = 0, std430) buffer tint_symbol_block_1 {
|
||||
int inner;
|
||||
} tint_symbol;
|
||||
layout(binding = 1, std430) buffer tint_symbol_block_2 {
|
||||
int inner;
|
||||
} tint_symbol_1;
|
||||
void tint_symbol_2() {
|
||||
tint_symbol_1.inner = tint_symbol.inner;
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
tint_symbol_2();
|
||||
return;
|
||||
}
|
||||
8
test/tint/buffer/storage/types/i32.wgsl.expected.hlsl
Normal file
8
test/tint/buffer/storage/types/i32.wgsl.expected.hlsl
Normal file
@@ -0,0 +1,8 @@
|
||||
ByteAddressBuffer tint_symbol : register(t0, space0);
|
||||
RWByteAddressBuffer tint_symbol_1 : register(u1, space0);
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
tint_symbol_1.Store(0u, asuint(asint(tint_symbol.Load(0u))));
|
||||
return;
|
||||
}
|
||||
8
test/tint/buffer/storage/types/i32.wgsl.expected.msl
Normal file
8
test/tint/buffer/storage/types/i32.wgsl.expected.msl
Normal file
@@ -0,0 +1,8 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
kernel void tint_symbol(device int* tint_symbol_1 [[buffer(0)]], const device int* tint_symbol_2 [[buffer(1)]]) {
|
||||
*(tint_symbol_1) = *(tint_symbol_2);
|
||||
return;
|
||||
}
|
||||
|
||||
39
test/tint/buffer/storage/types/i32.wgsl.expected.spvasm
Normal file
39
test/tint/buffer/storage/types/i32.wgsl.expected.spvasm
Normal file
@@ -0,0 +1,39 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 16
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpName %in_block "in_block"
|
||||
OpMemberName %in_block 0 "inner"
|
||||
OpName %in "in"
|
||||
OpName %out "out"
|
||||
OpName %main "main"
|
||||
OpDecorate %in_block Block
|
||||
OpMemberDecorate %in_block 0 Offset 0
|
||||
OpDecorate %in NonWritable
|
||||
OpDecorate %in DescriptorSet 0
|
||||
OpDecorate %in Binding 0
|
||||
OpDecorate %out DescriptorSet 0
|
||||
OpDecorate %out Binding 1
|
||||
%int = OpTypeInt 32 1
|
||||
%in_block = OpTypeStruct %int
|
||||
%_ptr_StorageBuffer_in_block = OpTypePointer StorageBuffer %in_block
|
||||
%in = OpVariable %_ptr_StorageBuffer_in_block StorageBuffer
|
||||
%out = OpVariable %_ptr_StorageBuffer_in_block StorageBuffer
|
||||
%void = OpTypeVoid
|
||||
%6 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
|
||||
%main = OpFunction %void None %6
|
||||
%9 = OpLabel
|
||||
%13 = OpAccessChain %_ptr_StorageBuffer_int %out %uint_0
|
||||
%14 = OpAccessChain %_ptr_StorageBuffer_int %in %uint_0
|
||||
%15 = OpLoad %int %14
|
||||
OpStore %13 %15
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
8
test/tint/buffer/storage/types/i32.wgsl.expected.wgsl
Normal file
8
test/tint/buffer/storage/types/i32.wgsl.expected.wgsl
Normal file
@@ -0,0 +1,8 @@
|
||||
@group(0) @binding(0) var<storage, read> in : i32;
|
||||
|
||||
@group(0) @binding(1) var<storage, read_write> out : i32;
|
||||
|
||||
@stage(compute) @workgroup_size(1)
|
||||
fn main() {
|
||||
out = in;
|
||||
}
|
||||
10
test/tint/buffer/storage/types/mat2x2.wgsl
Normal file
10
test/tint/buffer/storage/types/mat2x2.wgsl
Normal file
@@ -0,0 +1,10 @@
|
||||
@group(0) @binding(0)
|
||||
var<storage, read> in : mat2x2<f32>;
|
||||
|
||||
@group(0) @binding(1)
|
||||
var<storage, read_write> out : mat2x2<f32>;
|
||||
|
||||
@stage(compute) @workgroup_size(1)
|
||||
fn main() {
|
||||
out = in;
|
||||
}
|
||||
21
test/tint/buffer/storage/types/mat2x2.wgsl.expected.glsl
Normal file
21
test/tint/buffer/storage/types/mat2x2.wgsl.expected.glsl
Normal file
@@ -0,0 +1,21 @@
|
||||
#version 310 es
|
||||
|
||||
struct tint_symbol_block {
|
||||
mat2 inner;
|
||||
};
|
||||
|
||||
layout(binding = 0, std430) buffer tint_symbol_block_1 {
|
||||
mat2 inner;
|
||||
} tint_symbol;
|
||||
layout(binding = 1, std430) buffer tint_symbol_block_2 {
|
||||
mat2 inner;
|
||||
} tint_symbol_1;
|
||||
void tint_symbol_2() {
|
||||
tint_symbol_1.inner = tint_symbol.inner;
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
tint_symbol_2();
|
||||
return;
|
||||
}
|
||||
17
test/tint/buffer/storage/types/mat2x2.wgsl.expected.hlsl
Normal file
17
test/tint/buffer/storage/types/mat2x2.wgsl.expected.hlsl
Normal file
@@ -0,0 +1,17 @@
|
||||
ByteAddressBuffer tint_symbol : register(t0, space0);
|
||||
RWByteAddressBuffer tint_symbol_1 : register(u1, space0);
|
||||
|
||||
void tint_symbol_2(RWByteAddressBuffer buffer, uint offset, float2x2 value) {
|
||||
buffer.Store2((offset + 0u), asuint(value[0u]));
|
||||
buffer.Store2((offset + 8u), asuint(value[1u]));
|
||||
}
|
||||
|
||||
float2x2 tint_symbol_4(ByteAddressBuffer buffer, uint offset) {
|
||||
return float2x2(asfloat(buffer.Load2((offset + 0u))), asfloat(buffer.Load2((offset + 8u))));
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
tint_symbol_2(tint_symbol_1, 0u, tint_symbol_4(tint_symbol, 0u));
|
||||
return;
|
||||
}
|
||||
8
test/tint/buffer/storage/types/mat2x2.wgsl.expected.msl
Normal file
8
test/tint/buffer/storage/types/mat2x2.wgsl.expected.msl
Normal file
@@ -0,0 +1,8 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
kernel void tint_symbol(device float2x2* tint_symbol_1 [[buffer(0)]], const device float2x2* tint_symbol_2 [[buffer(1)]]) {
|
||||
*(tint_symbol_1) = *(tint_symbol_2);
|
||||
return;
|
||||
}
|
||||
|
||||
43
test/tint/buffer/storage/types/mat2x2.wgsl.expected.spvasm
Normal file
43
test/tint/buffer/storage/types/mat2x2.wgsl.expected.spvasm
Normal file
@@ -0,0 +1,43 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 18
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpName %in_block "in_block"
|
||||
OpMemberName %in_block 0 "inner"
|
||||
OpName %in "in"
|
||||
OpName %out "out"
|
||||
OpName %main "main"
|
||||
OpDecorate %in_block Block
|
||||
OpMemberDecorate %in_block 0 Offset 0
|
||||
OpMemberDecorate %in_block 0 ColMajor
|
||||
OpMemberDecorate %in_block 0 MatrixStride 8
|
||||
OpDecorate %in NonWritable
|
||||
OpDecorate %in DescriptorSet 0
|
||||
OpDecorate %in Binding 0
|
||||
OpDecorate %out DescriptorSet 0
|
||||
OpDecorate %out Binding 1
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%mat2v2float = OpTypeMatrix %v2float 2
|
||||
%in_block = OpTypeStruct %mat2v2float
|
||||
%_ptr_StorageBuffer_in_block = OpTypePointer StorageBuffer %in_block
|
||||
%in = OpVariable %_ptr_StorageBuffer_in_block StorageBuffer
|
||||
%out = OpVariable %_ptr_StorageBuffer_in_block StorageBuffer
|
||||
%void = OpTypeVoid
|
||||
%8 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_StorageBuffer_mat2v2float = OpTypePointer StorageBuffer %mat2v2float
|
||||
%main = OpFunction %void None %8
|
||||
%11 = OpLabel
|
||||
%15 = OpAccessChain %_ptr_StorageBuffer_mat2v2float %out %uint_0
|
||||
%16 = OpAccessChain %_ptr_StorageBuffer_mat2v2float %in %uint_0
|
||||
%17 = OpLoad %mat2v2float %16
|
||||
OpStore %15 %17
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
8
test/tint/buffer/storage/types/mat2x2.wgsl.expected.wgsl
Normal file
8
test/tint/buffer/storage/types/mat2x2.wgsl.expected.wgsl
Normal file
@@ -0,0 +1,8 @@
|
||||
@group(0) @binding(0) var<storage, read> in : mat2x2<f32>;
|
||||
|
||||
@group(0) @binding(1) var<storage, read_write> out : mat2x2<f32>;
|
||||
|
||||
@stage(compute) @workgroup_size(1)
|
||||
fn main() {
|
||||
out = in;
|
||||
}
|
||||
10
test/tint/buffer/storage/types/mat2x3.wgsl
Normal file
10
test/tint/buffer/storage/types/mat2x3.wgsl
Normal file
@@ -0,0 +1,10 @@
|
||||
@group(0) @binding(0)
|
||||
var<storage, read> in : mat2x3<f32>;
|
||||
|
||||
@group(0) @binding(1)
|
||||
var<storage, read_write> out : mat2x3<f32>;
|
||||
|
||||
@stage(compute) @workgroup_size(1)
|
||||
fn main() {
|
||||
out = in;
|
||||
}
|
||||
21
test/tint/buffer/storage/types/mat2x3.wgsl.expected.glsl
Normal file
21
test/tint/buffer/storage/types/mat2x3.wgsl.expected.glsl
Normal file
@@ -0,0 +1,21 @@
|
||||
#version 310 es
|
||||
|
||||
struct tint_symbol_block {
|
||||
mat2x3 inner;
|
||||
};
|
||||
|
||||
layout(binding = 0, std430) buffer tint_symbol_block_1 {
|
||||
mat2x3 inner;
|
||||
} tint_symbol;
|
||||
layout(binding = 1, std430) buffer tint_symbol_block_2 {
|
||||
mat2x3 inner;
|
||||
} tint_symbol_1;
|
||||
void tint_symbol_2() {
|
||||
tint_symbol_1.inner = tint_symbol.inner;
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
tint_symbol_2();
|
||||
return;
|
||||
}
|
||||
17
test/tint/buffer/storage/types/mat2x3.wgsl.expected.hlsl
Normal file
17
test/tint/buffer/storage/types/mat2x3.wgsl.expected.hlsl
Normal file
@@ -0,0 +1,17 @@
|
||||
ByteAddressBuffer tint_symbol : register(t0, space0);
|
||||
RWByteAddressBuffer tint_symbol_1 : register(u1, space0);
|
||||
|
||||
void tint_symbol_2(RWByteAddressBuffer buffer, uint offset, float2x3 value) {
|
||||
buffer.Store3((offset + 0u), asuint(value[0u]));
|
||||
buffer.Store3((offset + 16u), asuint(value[1u]));
|
||||
}
|
||||
|
||||
float2x3 tint_symbol_4(ByteAddressBuffer buffer, uint offset) {
|
||||
return float2x3(asfloat(buffer.Load3((offset + 0u))), asfloat(buffer.Load3((offset + 16u))));
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
tint_symbol_2(tint_symbol_1, 0u, tint_symbol_4(tint_symbol, 0u));
|
||||
return;
|
||||
}
|
||||
8
test/tint/buffer/storage/types/mat2x3.wgsl.expected.msl
Normal file
8
test/tint/buffer/storage/types/mat2x3.wgsl.expected.msl
Normal file
@@ -0,0 +1,8 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
kernel void tint_symbol(device float2x3* tint_symbol_1 [[buffer(0)]], const device float2x3* tint_symbol_2 [[buffer(1)]]) {
|
||||
*(tint_symbol_1) = *(tint_symbol_2);
|
||||
return;
|
||||
}
|
||||
|
||||
43
test/tint/buffer/storage/types/mat2x3.wgsl.expected.spvasm
Normal file
43
test/tint/buffer/storage/types/mat2x3.wgsl.expected.spvasm
Normal file
@@ -0,0 +1,43 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 18
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpName %in_block "in_block"
|
||||
OpMemberName %in_block 0 "inner"
|
||||
OpName %in "in"
|
||||
OpName %out "out"
|
||||
OpName %main "main"
|
||||
OpDecorate %in_block Block
|
||||
OpMemberDecorate %in_block 0 Offset 0
|
||||
OpMemberDecorate %in_block 0 ColMajor
|
||||
OpMemberDecorate %in_block 0 MatrixStride 16
|
||||
OpDecorate %in NonWritable
|
||||
OpDecorate %in DescriptorSet 0
|
||||
OpDecorate %in Binding 0
|
||||
OpDecorate %out DescriptorSet 0
|
||||
OpDecorate %out Binding 1
|
||||
%float = OpTypeFloat 32
|
||||
%v3float = OpTypeVector %float 3
|
||||
%mat2v3float = OpTypeMatrix %v3float 2
|
||||
%in_block = OpTypeStruct %mat2v3float
|
||||
%_ptr_StorageBuffer_in_block = OpTypePointer StorageBuffer %in_block
|
||||
%in = OpVariable %_ptr_StorageBuffer_in_block StorageBuffer
|
||||
%out = OpVariable %_ptr_StorageBuffer_in_block StorageBuffer
|
||||
%void = OpTypeVoid
|
||||
%8 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_StorageBuffer_mat2v3float = OpTypePointer StorageBuffer %mat2v3float
|
||||
%main = OpFunction %void None %8
|
||||
%11 = OpLabel
|
||||
%15 = OpAccessChain %_ptr_StorageBuffer_mat2v3float %out %uint_0
|
||||
%16 = OpAccessChain %_ptr_StorageBuffer_mat2v3float %in %uint_0
|
||||
%17 = OpLoad %mat2v3float %16
|
||||
OpStore %15 %17
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
8
test/tint/buffer/storage/types/mat2x3.wgsl.expected.wgsl
Normal file
8
test/tint/buffer/storage/types/mat2x3.wgsl.expected.wgsl
Normal file
@@ -0,0 +1,8 @@
|
||||
@group(0) @binding(0) var<storage, read> in : mat2x3<f32>;
|
||||
|
||||
@group(0) @binding(1) var<storage, read_write> out : mat2x3<f32>;
|
||||
|
||||
@stage(compute) @workgroup_size(1)
|
||||
fn main() {
|
||||
out = in;
|
||||
}
|
||||
10
test/tint/buffer/storage/types/mat3x2.wgsl
Normal file
10
test/tint/buffer/storage/types/mat3x2.wgsl
Normal file
@@ -0,0 +1,10 @@
|
||||
@group(0) @binding(0)
|
||||
var<storage, read> in : mat3x2<f32>;
|
||||
|
||||
@group(0) @binding(1)
|
||||
var<storage, read_write> out : mat3x2<f32>;
|
||||
|
||||
@stage(compute) @workgroup_size(1)
|
||||
fn main() {
|
||||
out = in;
|
||||
}
|
||||
21
test/tint/buffer/storage/types/mat3x2.wgsl.expected.glsl
Normal file
21
test/tint/buffer/storage/types/mat3x2.wgsl.expected.glsl
Normal file
@@ -0,0 +1,21 @@
|
||||
#version 310 es
|
||||
|
||||
struct tint_symbol_block {
|
||||
mat3x2 inner;
|
||||
};
|
||||
|
||||
layout(binding = 0, std430) buffer tint_symbol_block_1 {
|
||||
mat3x2 inner;
|
||||
} tint_symbol;
|
||||
layout(binding = 1, std430) buffer tint_symbol_block_2 {
|
||||
mat3x2 inner;
|
||||
} tint_symbol_1;
|
||||
void tint_symbol_2() {
|
||||
tint_symbol_1.inner = tint_symbol.inner;
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
tint_symbol_2();
|
||||
return;
|
||||
}
|
||||
18
test/tint/buffer/storage/types/mat3x2.wgsl.expected.hlsl
Normal file
18
test/tint/buffer/storage/types/mat3x2.wgsl.expected.hlsl
Normal file
@@ -0,0 +1,18 @@
|
||||
ByteAddressBuffer tint_symbol : register(t0, space0);
|
||||
RWByteAddressBuffer tint_symbol_1 : register(u1, space0);
|
||||
|
||||
void tint_symbol_2(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]));
|
||||
}
|
||||
|
||||
float3x2 tint_symbol_4(ByteAddressBuffer buffer, uint offset) {
|
||||
return float3x2(asfloat(buffer.Load2((offset + 0u))), asfloat(buffer.Load2((offset + 8u))), asfloat(buffer.Load2((offset + 16u))));
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
tint_symbol_2(tint_symbol_1, 0u, tint_symbol_4(tint_symbol, 0u));
|
||||
return;
|
||||
}
|
||||
8
test/tint/buffer/storage/types/mat3x2.wgsl.expected.msl
Normal file
8
test/tint/buffer/storage/types/mat3x2.wgsl.expected.msl
Normal file
@@ -0,0 +1,8 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
kernel void tint_symbol(device float3x2* tint_symbol_1 [[buffer(0)]], const device float3x2* tint_symbol_2 [[buffer(1)]]) {
|
||||
*(tint_symbol_1) = *(tint_symbol_2);
|
||||
return;
|
||||
}
|
||||
|
||||
43
test/tint/buffer/storage/types/mat3x2.wgsl.expected.spvasm
Normal file
43
test/tint/buffer/storage/types/mat3x2.wgsl.expected.spvasm
Normal file
@@ -0,0 +1,43 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 18
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpName %in_block "in_block"
|
||||
OpMemberName %in_block 0 "inner"
|
||||
OpName %in "in"
|
||||
OpName %out "out"
|
||||
OpName %main "main"
|
||||
OpDecorate %in_block Block
|
||||
OpMemberDecorate %in_block 0 Offset 0
|
||||
OpMemberDecorate %in_block 0 ColMajor
|
||||
OpMemberDecorate %in_block 0 MatrixStride 8
|
||||
OpDecorate %in NonWritable
|
||||
OpDecorate %in DescriptorSet 0
|
||||
OpDecorate %in Binding 0
|
||||
OpDecorate %out DescriptorSet 0
|
||||
OpDecorate %out Binding 1
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%mat3v2float = OpTypeMatrix %v2float 3
|
||||
%in_block = OpTypeStruct %mat3v2float
|
||||
%_ptr_StorageBuffer_in_block = OpTypePointer StorageBuffer %in_block
|
||||
%in = OpVariable %_ptr_StorageBuffer_in_block StorageBuffer
|
||||
%out = OpVariable %_ptr_StorageBuffer_in_block StorageBuffer
|
||||
%void = OpTypeVoid
|
||||
%8 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_StorageBuffer_mat3v2float = OpTypePointer StorageBuffer %mat3v2float
|
||||
%main = OpFunction %void None %8
|
||||
%11 = OpLabel
|
||||
%15 = OpAccessChain %_ptr_StorageBuffer_mat3v2float %out %uint_0
|
||||
%16 = OpAccessChain %_ptr_StorageBuffer_mat3v2float %in %uint_0
|
||||
%17 = OpLoad %mat3v2float %16
|
||||
OpStore %15 %17
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
8
test/tint/buffer/storage/types/mat3x2.wgsl.expected.wgsl
Normal file
8
test/tint/buffer/storage/types/mat3x2.wgsl.expected.wgsl
Normal file
@@ -0,0 +1,8 @@
|
||||
@group(0) @binding(0) var<storage, read> in : mat3x2<f32>;
|
||||
|
||||
@group(0) @binding(1) var<storage, read_write> out : mat3x2<f32>;
|
||||
|
||||
@stage(compute) @workgroup_size(1)
|
||||
fn main() {
|
||||
out = in;
|
||||
}
|
||||
10
test/tint/buffer/storage/types/mat4x4.wgsl
Normal file
10
test/tint/buffer/storage/types/mat4x4.wgsl
Normal file
@@ -0,0 +1,10 @@
|
||||
@group(0) @binding(0)
|
||||
var<storage, read> in : mat4x4<f32>;
|
||||
|
||||
@group(0) @binding(1)
|
||||
var<storage, read_write> out : mat4x4<f32>;
|
||||
|
||||
@stage(compute) @workgroup_size(1)
|
||||
fn main() {
|
||||
out = in;
|
||||
}
|
||||
21
test/tint/buffer/storage/types/mat4x4.wgsl.expected.glsl
Normal file
21
test/tint/buffer/storage/types/mat4x4.wgsl.expected.glsl
Normal file
@@ -0,0 +1,21 @@
|
||||
#version 310 es
|
||||
|
||||
struct tint_symbol_block {
|
||||
mat4 inner;
|
||||
};
|
||||
|
||||
layout(binding = 0, std430) buffer tint_symbol_block_1 {
|
||||
mat4 inner;
|
||||
} tint_symbol;
|
||||
layout(binding = 1, std430) buffer tint_symbol_block_2 {
|
||||
mat4 inner;
|
||||
} tint_symbol_1;
|
||||
void tint_symbol_2() {
|
||||
tint_symbol_1.inner = tint_symbol.inner;
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
tint_symbol_2();
|
||||
return;
|
||||
}
|
||||
19
test/tint/buffer/storage/types/mat4x4.wgsl.expected.hlsl
Normal file
19
test/tint/buffer/storage/types/mat4x4.wgsl.expected.hlsl
Normal file
@@ -0,0 +1,19 @@
|
||||
ByteAddressBuffer tint_symbol : register(t0, space0);
|
||||
RWByteAddressBuffer tint_symbol_1 : register(u1, space0);
|
||||
|
||||
void tint_symbol_2(RWByteAddressBuffer buffer, uint offset, float4x4 value) {
|
||||
buffer.Store4((offset + 0u), asuint(value[0u]));
|
||||
buffer.Store4((offset + 16u), asuint(value[1u]));
|
||||
buffer.Store4((offset + 32u), asuint(value[2u]));
|
||||
buffer.Store4((offset + 48u), asuint(value[3u]));
|
||||
}
|
||||
|
||||
float4x4 tint_symbol_4(ByteAddressBuffer buffer, uint offset) {
|
||||
return float4x4(asfloat(buffer.Load4((offset + 0u))), asfloat(buffer.Load4((offset + 16u))), asfloat(buffer.Load4((offset + 32u))), asfloat(buffer.Load4((offset + 48u))));
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
tint_symbol_2(tint_symbol_1, 0u, tint_symbol_4(tint_symbol, 0u));
|
||||
return;
|
||||
}
|
||||
8
test/tint/buffer/storage/types/mat4x4.wgsl.expected.msl
Normal file
8
test/tint/buffer/storage/types/mat4x4.wgsl.expected.msl
Normal file
@@ -0,0 +1,8 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
kernel void tint_symbol(device float4x4* tint_symbol_1 [[buffer(0)]], const device float4x4* tint_symbol_2 [[buffer(1)]]) {
|
||||
*(tint_symbol_1) = *(tint_symbol_2);
|
||||
return;
|
||||
}
|
||||
|
||||
43
test/tint/buffer/storage/types/mat4x4.wgsl.expected.spvasm
Normal file
43
test/tint/buffer/storage/types/mat4x4.wgsl.expected.spvasm
Normal file
@@ -0,0 +1,43 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 18
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpName %in_block "in_block"
|
||||
OpMemberName %in_block 0 "inner"
|
||||
OpName %in "in"
|
||||
OpName %out "out"
|
||||
OpName %main "main"
|
||||
OpDecorate %in_block Block
|
||||
OpMemberDecorate %in_block 0 Offset 0
|
||||
OpMemberDecorate %in_block 0 ColMajor
|
||||
OpMemberDecorate %in_block 0 MatrixStride 16
|
||||
OpDecorate %in NonWritable
|
||||
OpDecorate %in DescriptorSet 0
|
||||
OpDecorate %in Binding 0
|
||||
OpDecorate %out DescriptorSet 0
|
||||
OpDecorate %out Binding 1
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%mat4v4float = OpTypeMatrix %v4float 4
|
||||
%in_block = OpTypeStruct %mat4v4float
|
||||
%_ptr_StorageBuffer_in_block = OpTypePointer StorageBuffer %in_block
|
||||
%in = OpVariable %_ptr_StorageBuffer_in_block StorageBuffer
|
||||
%out = OpVariable %_ptr_StorageBuffer_in_block StorageBuffer
|
||||
%void = OpTypeVoid
|
||||
%8 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_StorageBuffer_mat4v4float = OpTypePointer StorageBuffer %mat4v4float
|
||||
%main = OpFunction %void None %8
|
||||
%11 = OpLabel
|
||||
%15 = OpAccessChain %_ptr_StorageBuffer_mat4v4float %out %uint_0
|
||||
%16 = OpAccessChain %_ptr_StorageBuffer_mat4v4float %in %uint_0
|
||||
%17 = OpLoad %mat4v4float %16
|
||||
OpStore %15 %17
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
8
test/tint/buffer/storage/types/mat4x4.wgsl.expected.wgsl
Normal file
8
test/tint/buffer/storage/types/mat4x4.wgsl.expected.wgsl
Normal file
@@ -0,0 +1,8 @@
|
||||
@group(0) @binding(0) var<storage, read> in : mat4x4<f32>;
|
||||
|
||||
@group(0) @binding(1) var<storage, read_write> out : mat4x4<f32>;
|
||||
|
||||
@stage(compute) @workgroup_size(1)
|
||||
fn main() {
|
||||
out = in;
|
||||
}
|
||||
14
test/tint/buffer/storage/types/runtime_array.wgsl
Normal file
14
test/tint/buffer/storage/types/runtime_array.wgsl
Normal file
@@ -0,0 +1,14 @@
|
||||
struct S {
|
||||
f : f32;
|
||||
};
|
||||
|
||||
@group(0) @binding(0)
|
||||
var<storage, read> in : array<S>;
|
||||
|
||||
@group(0) @binding(1)
|
||||
var<storage, read_write> out : array<S>;
|
||||
|
||||
@stage(compute) @workgroup_size(1)
|
||||
fn main() {
|
||||
out[0] = in[0];
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
#version 310 es
|
||||
|
||||
struct S {
|
||||
float f;
|
||||
};
|
||||
|
||||
layout(binding = 0, std430) buffer tint_symbol_block_1 {
|
||||
S inner[];
|
||||
} tint_symbol;
|
||||
layout(binding = 1, std430) buffer tint_symbol_block_2 {
|
||||
S inner[];
|
||||
} tint_symbol_1;
|
||||
void tint_symbol_2() {
|
||||
tint_symbol_1.inner[0] = tint_symbol.inner[0];
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
tint_symbol_2();
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
struct S {
|
||||
float f;
|
||||
};
|
||||
|
||||
ByteAddressBuffer tint_symbol : register(t0, space0);
|
||||
RWByteAddressBuffer tint_symbol_1 : register(u1, space0);
|
||||
|
||||
void tint_symbol_2(RWByteAddressBuffer buffer, uint offset, S value) {
|
||||
buffer.Store((offset + 0u), asuint(value.f));
|
||||
}
|
||||
|
||||
S tint_symbol_4(ByteAddressBuffer buffer, uint offset) {
|
||||
const S tint_symbol_6 = {asfloat(buffer.Load((offset + 0u)))};
|
||||
return tint_symbol_6;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
tint_symbol_2(tint_symbol_1, (4u * uint(0)), tint_symbol_4(tint_symbol, (4u * uint(0))));
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct S {
|
||||
/* 0x0000 */ float f;
|
||||
};
|
||||
|
||||
struct tint_symbol_2 {
|
||||
/* 0x0000 */ S arr[1];
|
||||
};
|
||||
|
||||
struct tint_symbol_4 {
|
||||
/* 0x0000 */ S arr[1];
|
||||
};
|
||||
|
||||
kernel void tint_symbol(device tint_symbol_2* tint_symbol_1 [[buffer(0)]], const device tint_symbol_4* tint_symbol_3 [[buffer(1)]]) {
|
||||
(*(tint_symbol_1)).arr[0] = (*(tint_symbol_3)).arr[0];
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 20
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpName %in_block "in_block"
|
||||
OpMemberName %in_block 0 "inner"
|
||||
OpName %S "S"
|
||||
OpMemberName %S 0 "f"
|
||||
OpName %in "in"
|
||||
OpName %out "out"
|
||||
OpName %main "main"
|
||||
OpDecorate %in_block Block
|
||||
OpMemberDecorate %in_block 0 Offset 0
|
||||
OpMemberDecorate %S 0 Offset 0
|
||||
OpDecorate %_runtimearr_S ArrayStride 4
|
||||
OpDecorate %in NonWritable
|
||||
OpDecorate %in DescriptorSet 0
|
||||
OpDecorate %in Binding 0
|
||||
OpDecorate %out DescriptorSet 0
|
||||
OpDecorate %out Binding 1
|
||||
%float = OpTypeFloat 32
|
||||
%S = OpTypeStruct %float
|
||||
%_runtimearr_S = OpTypeRuntimeArray %S
|
||||
%in_block = OpTypeStruct %_runtimearr_S
|
||||
%_ptr_StorageBuffer_in_block = OpTypePointer StorageBuffer %in_block
|
||||
%in = OpVariable %_ptr_StorageBuffer_in_block StorageBuffer
|
||||
%out = OpVariable %_ptr_StorageBuffer_in_block StorageBuffer
|
||||
%void = OpTypeVoid
|
||||
%8 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
|
||||
%main = OpFunction %void None %8
|
||||
%11 = OpLabel
|
||||
%17 = OpAccessChain %_ptr_StorageBuffer_S %out %uint_0 %int_0
|
||||
%18 = OpAccessChain %_ptr_StorageBuffer_S %in %uint_0 %int_0
|
||||
%19 = OpLoad %S %18
|
||||
OpStore %17 %19
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,12 @@
|
||||
struct S {
|
||||
f : f32;
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<storage, read> in : array<S>;
|
||||
|
||||
@group(0) @binding(1) var<storage, read_write> out : array<S>;
|
||||
|
||||
@stage(compute) @workgroup_size(1)
|
||||
fn main() {
|
||||
out[0] = in[0];
|
||||
}
|
||||
17
test/tint/buffer/storage/types/struct.wgsl
Normal file
17
test/tint/buffer/storage/types/struct.wgsl
Normal file
@@ -0,0 +1,17 @@
|
||||
struct Inner {
|
||||
f : f32;
|
||||
};
|
||||
struct S {
|
||||
inner : Inner;
|
||||
};
|
||||
|
||||
@group(0) @binding(0)
|
||||
var<storage, read> in : S;
|
||||
|
||||
@group(0) @binding(1)
|
||||
var<storage, read_write> out : S;
|
||||
|
||||
@stage(compute) @workgroup_size(1)
|
||||
fn main() {
|
||||
out = in;
|
||||
}
|
||||
34
test/tint/buffer/storage/types/struct.wgsl.expected.glsl
Normal file
34
test/tint/buffer/storage/types/struct.wgsl.expected.glsl
Normal file
@@ -0,0 +1,34 @@
|
||||
SKIP: FAILED
|
||||
|
||||
#version 310 es
|
||||
|
||||
struct Inner {
|
||||
float f;
|
||||
};
|
||||
|
||||
struct S {
|
||||
Inner inner;
|
||||
};
|
||||
|
||||
layout(binding = 0, std430) buffer S_1 {
|
||||
Inner inner;
|
||||
} tint_symbol;
|
||||
layout(binding = 1, std430) buffer S_2 {
|
||||
Inner inner;
|
||||
} tint_symbol_1;
|
||||
void tint_symbol_2() {
|
||||
tint_symbol_1 = tint_symbol;
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
tint_symbol_2();
|
||||
return;
|
||||
}
|
||||
Error parsing GLSL shader:
|
||||
ERROR: 0:18: 'assign' : cannot convert from 'layout( binding=0 column_major std430) buffer block{layout( column_major std430 offset=0) buffer structure{ global highp float f} inner}' to 'layout( binding=1 column_major std430) buffer block{layout( column_major std430 offset=0) buffer structure{ global highp float f} inner}'
|
||||
ERROR: 0:18: '' : compilation terminated
|
||||
ERROR: 2 compilation errors. No code generated.
|
||||
|
||||
|
||||
|
||||
33
test/tint/buffer/storage/types/struct.wgsl.expected.hlsl
Normal file
33
test/tint/buffer/storage/types/struct.wgsl.expected.hlsl
Normal file
@@ -0,0 +1,33 @@
|
||||
struct Inner {
|
||||
float f;
|
||||
};
|
||||
struct S {
|
||||
Inner inner;
|
||||
};
|
||||
|
||||
ByteAddressBuffer tint_symbol : register(t0, space0);
|
||||
RWByteAddressBuffer tint_symbol_1 : register(u1, space0);
|
||||
|
||||
void tint_symbol_3(RWByteAddressBuffer buffer, uint offset, Inner value) {
|
||||
buffer.Store((offset + 0u), asuint(value.f));
|
||||
}
|
||||
|
||||
void tint_symbol_2(RWByteAddressBuffer buffer, uint offset, S value) {
|
||||
tint_symbol_3(buffer, (offset + 0u), value.inner);
|
||||
}
|
||||
|
||||
Inner tint_symbol_6(ByteAddressBuffer buffer, uint offset) {
|
||||
const Inner tint_symbol_8 = {asfloat(buffer.Load((offset + 0u)))};
|
||||
return tint_symbol_8;
|
||||
}
|
||||
|
||||
S tint_symbol_5(ByteAddressBuffer buffer, uint offset) {
|
||||
const S tint_symbol_9 = {tint_symbol_6(buffer, (offset + 0u))};
|
||||
return tint_symbol_9;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
tint_symbol_2(tint_symbol_1, 0u, tint_symbol_5(tint_symbol, 0u));
|
||||
return;
|
||||
}
|
||||
16
test/tint/buffer/storage/types/struct.wgsl.expected.msl
Normal file
16
test/tint/buffer/storage/types/struct.wgsl.expected.msl
Normal file
@@ -0,0 +1,16 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct Inner {
|
||||
/* 0x0000 */ float f;
|
||||
};
|
||||
|
||||
struct S {
|
||||
/* 0x0000 */ Inner inner;
|
||||
};
|
||||
|
||||
kernel void tint_symbol(device S* tint_symbol_1 [[buffer(0)]], const device S* tint_symbol_2 [[buffer(1)]]) {
|
||||
*(tint_symbol_1) = *(tint_symbol_2);
|
||||
return;
|
||||
}
|
||||
|
||||
38
test/tint/buffer/storage/types/struct.wgsl.expected.spvasm
Normal file
38
test/tint/buffer/storage/types/struct.wgsl.expected.spvasm
Normal file
@@ -0,0 +1,38 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 12
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpName %S "S"
|
||||
OpMemberName %S 0 "inner"
|
||||
OpName %Inner "Inner"
|
||||
OpMemberName %Inner 0 "f"
|
||||
OpName %in "in"
|
||||
OpName %out "out"
|
||||
OpName %main "main"
|
||||
OpDecorate %S Block
|
||||
OpMemberDecorate %S 0 Offset 0
|
||||
OpMemberDecorate %Inner 0 Offset 0
|
||||
OpDecorate %in NonWritable
|
||||
OpDecorate %in DescriptorSet 0
|
||||
OpDecorate %in Binding 0
|
||||
OpDecorate %out DescriptorSet 0
|
||||
OpDecorate %out Binding 1
|
||||
%float = OpTypeFloat 32
|
||||
%Inner = OpTypeStruct %float
|
||||
%S = OpTypeStruct %Inner
|
||||
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
|
||||
%in = OpVariable %_ptr_StorageBuffer_S StorageBuffer
|
||||
%out = OpVariable %_ptr_StorageBuffer_S StorageBuffer
|
||||
%void = OpTypeVoid
|
||||
%7 = OpTypeFunction %void
|
||||
%main = OpFunction %void None %7
|
||||
%10 = OpLabel
|
||||
%11 = OpLoad %S %in
|
||||
OpStore %out %11
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
16
test/tint/buffer/storage/types/struct.wgsl.expected.wgsl
Normal file
16
test/tint/buffer/storage/types/struct.wgsl.expected.wgsl
Normal file
@@ -0,0 +1,16 @@
|
||||
struct Inner {
|
||||
f : f32;
|
||||
}
|
||||
|
||||
struct S {
|
||||
inner : Inner;
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<storage, read> in : S;
|
||||
|
||||
@group(0) @binding(1) var<storage, read_write> out : S;
|
||||
|
||||
@stage(compute) @workgroup_size(1)
|
||||
fn main() {
|
||||
out = in;
|
||||
}
|
||||
10
test/tint/buffer/storage/types/u32.wgsl
Normal file
10
test/tint/buffer/storage/types/u32.wgsl
Normal file
@@ -0,0 +1,10 @@
|
||||
@group(0) @binding(0)
|
||||
var<storage, read> in : u32;
|
||||
|
||||
@group(0) @binding(1)
|
||||
var<storage, read_write> out : u32;
|
||||
|
||||
@stage(compute) @workgroup_size(1)
|
||||
fn main() {
|
||||
out = in;
|
||||
}
|
||||
21
test/tint/buffer/storage/types/u32.wgsl.expected.glsl
Normal file
21
test/tint/buffer/storage/types/u32.wgsl.expected.glsl
Normal file
@@ -0,0 +1,21 @@
|
||||
#version 310 es
|
||||
|
||||
struct tint_symbol_block {
|
||||
uint inner;
|
||||
};
|
||||
|
||||
layout(binding = 0, std430) buffer tint_symbol_block_1 {
|
||||
uint inner;
|
||||
} tint_symbol;
|
||||
layout(binding = 1, std430) buffer tint_symbol_block_2 {
|
||||
uint inner;
|
||||
} tint_symbol_1;
|
||||
void tint_symbol_2() {
|
||||
tint_symbol_1.inner = tint_symbol.inner;
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
tint_symbol_2();
|
||||
return;
|
||||
}
|
||||
8
test/tint/buffer/storage/types/u32.wgsl.expected.hlsl
Normal file
8
test/tint/buffer/storage/types/u32.wgsl.expected.hlsl
Normal file
@@ -0,0 +1,8 @@
|
||||
ByteAddressBuffer tint_symbol : register(t0, space0);
|
||||
RWByteAddressBuffer tint_symbol_1 : register(u1, space0);
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
tint_symbol_1.Store(0u, asuint(tint_symbol.Load(0u)));
|
||||
return;
|
||||
}
|
||||
8
test/tint/buffer/storage/types/u32.wgsl.expected.msl
Normal file
8
test/tint/buffer/storage/types/u32.wgsl.expected.msl
Normal file
@@ -0,0 +1,8 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
kernel void tint_symbol(device uint* tint_symbol_1 [[buffer(0)]], const device uint* tint_symbol_2 [[buffer(1)]]) {
|
||||
*(tint_symbol_1) = *(tint_symbol_2);
|
||||
return;
|
||||
}
|
||||
|
||||
38
test/tint/buffer/storage/types/u32.wgsl.expected.spvasm
Normal file
38
test/tint/buffer/storage/types/u32.wgsl.expected.spvasm
Normal file
@@ -0,0 +1,38 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 15
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpName %in_block "in_block"
|
||||
OpMemberName %in_block 0 "inner"
|
||||
OpName %in "in"
|
||||
OpName %out "out"
|
||||
OpName %main "main"
|
||||
OpDecorate %in_block Block
|
||||
OpMemberDecorate %in_block 0 Offset 0
|
||||
OpDecorate %in NonWritable
|
||||
OpDecorate %in DescriptorSet 0
|
||||
OpDecorate %in Binding 0
|
||||
OpDecorate %out DescriptorSet 0
|
||||
OpDecorate %out Binding 1
|
||||
%uint = OpTypeInt 32 0
|
||||
%in_block = OpTypeStruct %uint
|
||||
%_ptr_StorageBuffer_in_block = OpTypePointer StorageBuffer %in_block
|
||||
%in = OpVariable %_ptr_StorageBuffer_in_block StorageBuffer
|
||||
%out = OpVariable %_ptr_StorageBuffer_in_block StorageBuffer
|
||||
%void = OpTypeVoid
|
||||
%6 = OpTypeFunction %void
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
|
||||
%main = OpFunction %void None %6
|
||||
%9 = OpLabel
|
||||
%12 = OpAccessChain %_ptr_StorageBuffer_uint %out %uint_0
|
||||
%13 = OpAccessChain %_ptr_StorageBuffer_uint %in %uint_0
|
||||
%14 = OpLoad %uint %13
|
||||
OpStore %12 %14
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
8
test/tint/buffer/storage/types/u32.wgsl.expected.wgsl
Normal file
8
test/tint/buffer/storage/types/u32.wgsl.expected.wgsl
Normal file
@@ -0,0 +1,8 @@
|
||||
@group(0) @binding(0) var<storage, read> in : u32;
|
||||
|
||||
@group(0) @binding(1) var<storage, read_write> out : u32;
|
||||
|
||||
@stage(compute) @workgroup_size(1)
|
||||
fn main() {
|
||||
out = in;
|
||||
}
|
||||
10
test/tint/buffer/storage/types/vec2.wgsl
Normal file
10
test/tint/buffer/storage/types/vec2.wgsl
Normal file
@@ -0,0 +1,10 @@
|
||||
@group(0) @binding(0)
|
||||
var<storage, read> in : vec2<i32>;
|
||||
|
||||
@group(0) @binding(1)
|
||||
var<storage, read_write> out : vec2<i32>;
|
||||
|
||||
@stage(compute) @workgroup_size(1)
|
||||
fn main() {
|
||||
out = in;
|
||||
}
|
||||
21
test/tint/buffer/storage/types/vec2.wgsl.expected.glsl
Normal file
21
test/tint/buffer/storage/types/vec2.wgsl.expected.glsl
Normal file
@@ -0,0 +1,21 @@
|
||||
#version 310 es
|
||||
|
||||
struct tint_symbol_block {
|
||||
ivec2 inner;
|
||||
};
|
||||
|
||||
layout(binding = 0, std430) buffer tint_symbol_block_1 {
|
||||
ivec2 inner;
|
||||
} tint_symbol;
|
||||
layout(binding = 1, std430) buffer tint_symbol_block_2 {
|
||||
ivec2 inner;
|
||||
} tint_symbol_1;
|
||||
void tint_symbol_2() {
|
||||
tint_symbol_1.inner = tint_symbol.inner;
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
tint_symbol_2();
|
||||
return;
|
||||
}
|
||||
8
test/tint/buffer/storage/types/vec2.wgsl.expected.hlsl
Normal file
8
test/tint/buffer/storage/types/vec2.wgsl.expected.hlsl
Normal file
@@ -0,0 +1,8 @@
|
||||
ByteAddressBuffer tint_symbol : register(t0, space0);
|
||||
RWByteAddressBuffer tint_symbol_1 : register(u1, space0);
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
tint_symbol_1.Store2(0u, asuint(asint(tint_symbol.Load2(0u))));
|
||||
return;
|
||||
}
|
||||
8
test/tint/buffer/storage/types/vec2.wgsl.expected.msl
Normal file
8
test/tint/buffer/storage/types/vec2.wgsl.expected.msl
Normal file
@@ -0,0 +1,8 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
kernel void tint_symbol(device int2* tint_symbol_1 [[buffer(0)]], const device int2* tint_symbol_2 [[buffer(1)]]) {
|
||||
*(tint_symbol_1) = *(tint_symbol_2);
|
||||
return;
|
||||
}
|
||||
|
||||
40
test/tint/buffer/storage/types/vec2.wgsl.expected.spvasm
Normal file
40
test/tint/buffer/storage/types/vec2.wgsl.expected.spvasm
Normal file
@@ -0,0 +1,40 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 17
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpName %in_block "in_block"
|
||||
OpMemberName %in_block 0 "inner"
|
||||
OpName %in "in"
|
||||
OpName %out "out"
|
||||
OpName %main "main"
|
||||
OpDecorate %in_block Block
|
||||
OpMemberDecorate %in_block 0 Offset 0
|
||||
OpDecorate %in NonWritable
|
||||
OpDecorate %in DescriptorSet 0
|
||||
OpDecorate %in Binding 0
|
||||
OpDecorate %out DescriptorSet 0
|
||||
OpDecorate %out Binding 1
|
||||
%int = OpTypeInt 32 1
|
||||
%v2int = OpTypeVector %int 2
|
||||
%in_block = OpTypeStruct %v2int
|
||||
%_ptr_StorageBuffer_in_block = OpTypePointer StorageBuffer %in_block
|
||||
%in = OpVariable %_ptr_StorageBuffer_in_block StorageBuffer
|
||||
%out = OpVariable %_ptr_StorageBuffer_in_block StorageBuffer
|
||||
%void = OpTypeVoid
|
||||
%7 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_StorageBuffer_v2int = OpTypePointer StorageBuffer %v2int
|
||||
%main = OpFunction %void None %7
|
||||
%10 = OpLabel
|
||||
%14 = OpAccessChain %_ptr_StorageBuffer_v2int %out %uint_0
|
||||
%15 = OpAccessChain %_ptr_StorageBuffer_v2int %in %uint_0
|
||||
%16 = OpLoad %v2int %15
|
||||
OpStore %14 %16
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
8
test/tint/buffer/storage/types/vec2.wgsl.expected.wgsl
Normal file
8
test/tint/buffer/storage/types/vec2.wgsl.expected.wgsl
Normal file
@@ -0,0 +1,8 @@
|
||||
@group(0) @binding(0) var<storage, read> in : vec2<i32>;
|
||||
|
||||
@group(0) @binding(1) var<storage, read_write> out : vec2<i32>;
|
||||
|
||||
@stage(compute) @workgroup_size(1)
|
||||
fn main() {
|
||||
out = in;
|
||||
}
|
||||
10
test/tint/buffer/storage/types/vec3.wgsl
Normal file
10
test/tint/buffer/storage/types/vec3.wgsl
Normal file
@@ -0,0 +1,10 @@
|
||||
@group(0) @binding(0)
|
||||
var<storage, read> in : vec3<u32>;
|
||||
|
||||
@group(0) @binding(1)
|
||||
var<storage, read_write> out : vec3<u32>;
|
||||
|
||||
@stage(compute) @workgroup_size(1)
|
||||
fn main() {
|
||||
out = in;
|
||||
}
|
||||
21
test/tint/buffer/storage/types/vec3.wgsl.expected.glsl
Normal file
21
test/tint/buffer/storage/types/vec3.wgsl.expected.glsl
Normal file
@@ -0,0 +1,21 @@
|
||||
#version 310 es
|
||||
|
||||
struct tint_symbol_block {
|
||||
uvec3 inner;
|
||||
};
|
||||
|
||||
layout(binding = 0, std430) buffer tint_symbol_block_1 {
|
||||
uvec3 inner;
|
||||
} tint_symbol;
|
||||
layout(binding = 1, std430) buffer tint_symbol_block_2 {
|
||||
uvec3 inner;
|
||||
} tint_symbol_1;
|
||||
void tint_symbol_2() {
|
||||
tint_symbol_1.inner = tint_symbol.inner;
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
tint_symbol_2();
|
||||
return;
|
||||
}
|
||||
8
test/tint/buffer/storage/types/vec3.wgsl.expected.hlsl
Normal file
8
test/tint/buffer/storage/types/vec3.wgsl.expected.hlsl
Normal file
@@ -0,0 +1,8 @@
|
||||
ByteAddressBuffer tint_symbol : register(t0, space0);
|
||||
RWByteAddressBuffer tint_symbol_1 : register(u1, space0);
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
tint_symbol_1.Store3(0u, asuint(tint_symbol.Load3(0u)));
|
||||
return;
|
||||
}
|
||||
8
test/tint/buffer/storage/types/vec3.wgsl.expected.msl
Normal file
8
test/tint/buffer/storage/types/vec3.wgsl.expected.msl
Normal file
@@ -0,0 +1,8 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
kernel void tint_symbol(device uint3* tint_symbol_1 [[buffer(0)]], const device uint3* tint_symbol_2 [[buffer(1)]]) {
|
||||
*(tint_symbol_1) = *(tint_symbol_2);
|
||||
return;
|
||||
}
|
||||
|
||||
39
test/tint/buffer/storage/types/vec3.wgsl.expected.spvasm
Normal file
39
test/tint/buffer/storage/types/vec3.wgsl.expected.spvasm
Normal file
@@ -0,0 +1,39 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 16
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpName %in_block "in_block"
|
||||
OpMemberName %in_block 0 "inner"
|
||||
OpName %in "in"
|
||||
OpName %out "out"
|
||||
OpName %main "main"
|
||||
OpDecorate %in_block Block
|
||||
OpMemberDecorate %in_block 0 Offset 0
|
||||
OpDecorate %in NonWritable
|
||||
OpDecorate %in DescriptorSet 0
|
||||
OpDecorate %in Binding 0
|
||||
OpDecorate %out DescriptorSet 0
|
||||
OpDecorate %out Binding 1
|
||||
%uint = OpTypeInt 32 0
|
||||
%v3uint = OpTypeVector %uint 3
|
||||
%in_block = OpTypeStruct %v3uint
|
||||
%_ptr_StorageBuffer_in_block = OpTypePointer StorageBuffer %in_block
|
||||
%in = OpVariable %_ptr_StorageBuffer_in_block StorageBuffer
|
||||
%out = OpVariable %_ptr_StorageBuffer_in_block StorageBuffer
|
||||
%void = OpTypeVoid
|
||||
%7 = OpTypeFunction %void
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_StorageBuffer_v3uint = OpTypePointer StorageBuffer %v3uint
|
||||
%main = OpFunction %void None %7
|
||||
%10 = OpLabel
|
||||
%13 = OpAccessChain %_ptr_StorageBuffer_v3uint %out %uint_0
|
||||
%14 = OpAccessChain %_ptr_StorageBuffer_v3uint %in %uint_0
|
||||
%15 = OpLoad %v3uint %14
|
||||
OpStore %13 %15
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
8
test/tint/buffer/storage/types/vec3.wgsl.expected.wgsl
Normal file
8
test/tint/buffer/storage/types/vec3.wgsl.expected.wgsl
Normal file
@@ -0,0 +1,8 @@
|
||||
@group(0) @binding(0) var<storage, read> in : vec3<u32>;
|
||||
|
||||
@group(0) @binding(1) var<storage, read_write> out : vec3<u32>;
|
||||
|
||||
@stage(compute) @workgroup_size(1)
|
||||
fn main() {
|
||||
out = in;
|
||||
}
|
||||
10
test/tint/buffer/storage/types/vec4.wgsl
Normal file
10
test/tint/buffer/storage/types/vec4.wgsl
Normal file
@@ -0,0 +1,10 @@
|
||||
@group(0) @binding(0)
|
||||
var<storage, read> in : vec4<f32>;
|
||||
|
||||
@group(0) @binding(1)
|
||||
var<storage, read_write> out : vec4<f32>;
|
||||
|
||||
@stage(compute) @workgroup_size(1)
|
||||
fn main() {
|
||||
out = in;
|
||||
}
|
||||
21
test/tint/buffer/storage/types/vec4.wgsl.expected.glsl
Normal file
21
test/tint/buffer/storage/types/vec4.wgsl.expected.glsl
Normal file
@@ -0,0 +1,21 @@
|
||||
#version 310 es
|
||||
|
||||
struct tint_symbol_block {
|
||||
vec4 inner;
|
||||
};
|
||||
|
||||
layout(binding = 0, std430) buffer tint_symbol_block_1 {
|
||||
vec4 inner;
|
||||
} tint_symbol;
|
||||
layout(binding = 1, std430) buffer tint_symbol_block_2 {
|
||||
vec4 inner;
|
||||
} tint_symbol_1;
|
||||
void tint_symbol_2() {
|
||||
tint_symbol_1.inner = tint_symbol.inner;
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
tint_symbol_2();
|
||||
return;
|
||||
}
|
||||
8
test/tint/buffer/storage/types/vec4.wgsl.expected.hlsl
Normal file
8
test/tint/buffer/storage/types/vec4.wgsl.expected.hlsl
Normal file
@@ -0,0 +1,8 @@
|
||||
ByteAddressBuffer tint_symbol : register(t0, space0);
|
||||
RWByteAddressBuffer tint_symbol_1 : register(u1, space0);
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
tint_symbol_1.Store4(0u, asuint(asfloat(tint_symbol.Load4(0u))));
|
||||
return;
|
||||
}
|
||||
8
test/tint/buffer/storage/types/vec4.wgsl.expected.msl
Normal file
8
test/tint/buffer/storage/types/vec4.wgsl.expected.msl
Normal file
@@ -0,0 +1,8 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
kernel void tint_symbol(device float4* tint_symbol_1 [[buffer(0)]], const device float4* tint_symbol_2 [[buffer(1)]]) {
|
||||
*(tint_symbol_1) = *(tint_symbol_2);
|
||||
return;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user