[tint] Avoid DCE in matrix constructor tests
Unused module-scope variables are discarded in some backends
(e.g. MSL, and SPIR-V via IR), and unused functions are at risk of
being dead-code-eliminated in the future. Change all of these tests to
write out the matrix to a storage buffer from an entry point.
Also added some missing explicit typing to some explicit typing tests.
Change-Id: Ife7217196b0512f0d7e123340de40bc0fd0c58af
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/158205
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f16.wgsl b/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f16.wgsl
index ef4f0cd..fcd1b3e 100644
--- a/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f16.wgsl
@@ -1,8 +1,11 @@
enable f16;
-var<private> m = mat2x2(mat2x2<f16>(0.0h, 1.0h,
- 2.0h, 3.0h));
+var<private> m = mat2x2<f16>(mat2x2<f16>(0.0h, 1.0h,
+ 2.0h, 3.0h));
-fn f() -> mat2x2<f16> {
- let m_1 = mat2x2(m);
- return m_1;
+@group(0) @binding(0)
+var<storage, read_write> out : mat2x2<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat2x2<f16>(m);
}
diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f16.wgsl.expected.dxc.hlsl
index 909b45b..54b7286 100644
--- a/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f16.wgsl.expected.dxc.hlsl
@@ -1,11 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 2, 2> m = matrix<float16_t, 2, 2>(vector<float16_t, 2>(float16_t(0.0h), float16_t(1.0h)), vector<float16_t, 2>(float16_t(2.0h), float16_t(3.0h)));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 2, 2> value) {
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 4u), value[1u]);
}
-static matrix<float16_t, 2, 2> m = matrix<float16_t, 2, 2>(vector<float16_t, 2>(float16_t(0.0h), float16_t(1.0h)), vector<float16_t, 2>(float16_t(2.0h), float16_t(3.0h)));
-
-matrix<float16_t, 2, 2> f() {
- const matrix<float16_t, 2, 2> m_1 = matrix<float16_t, 2, 2>(m);
- return m_1;
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, matrix<float16_t, 2, 2>(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f16.wgsl.expected.glsl
index 8fd1749..95b5ca2 100644
--- a/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f16.wgsl.expected.glsl
@@ -1,13 +1,17 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
- return;
-}
f16mat2 m = f16mat2(f16vec2(0.0hf, 1.0hf), f16vec2(2.0hf, 3.0hf));
-f16mat2 f() {
- f16mat2 m_1 = f16mat2(m);
- return m_1;
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat2 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = f16mat2(m);
}
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ f();
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f16.wgsl.expected.msl
index 83d200f..633fcee 100644
--- a/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f16.wgsl.expected.msl
@@ -5,8 +5,10 @@
half2x2 m;
};
-half2x2 f(thread tint_private_vars_struct* const tint_private_vars) {
- half2x2 const m_1 = half2x2((*(tint_private_vars)).m);
- return m_1;
+kernel void f(device half2x2* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half2x2(half2(0.0h, 1.0h), half2(2.0h, 3.0h));
+ *(tint_symbol) = half2x2(tint_private_vars.m);
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f16.wgsl.expected.spvasm
index 81b52d7..84ed5a6 100644
--- a/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 22
+; Bound: 26
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,11 +9,19 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 4
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v2half = OpTypeVector %half 2
%mat2v2half = OpTypeMatrix %v2half 2
@@ -26,15 +34,18 @@
%10 = OpConstantComposite %mat2v2half %6 %9
%_ptr_Private_mat2v2half = OpTypePointer Private %mat2v2half
%m = OpVariable %_ptr_Private_mat2v2half Private %10
+ %out_block = OpTypeStruct %mat2v2half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %13 = OpTypeFunction %void
- %17 = OpTypeFunction %mat2v2half
-%unused_entry_point = OpFunction %void None %13
- %16 = OpLabel
- OpReturn
- OpFunctionEnd
- %f = OpFunction %mat2v2half None %17
+ %16 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat2v2half = OpTypePointer StorageBuffer %mat2v2half
+ %f = OpFunction %void None %16
%19 = OpLabel
- %21 = OpLoad %mat2v2half %m
- OpReturnValue %21
+ %23 = OpAccessChain %_ptr_StorageBuffer_mat2v2half %out %uint_0
+ %25 = OpLoad %mat2v2half %m
+ OpStore %23 %25
+ OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f16.wgsl.expected.wgsl
index ffe1269..c1c8fd7 100644
--- a/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f16.wgsl.expected.wgsl
@@ -1,8 +1,10 @@
enable f16;
-var<private> m = mat2x2(mat2x2<f16>(0.0h, 1.0h, 2.0h, 3.0h));
+var<private> m = mat2x2<f16>(mat2x2<f16>(0.0h, 1.0h, 2.0h, 3.0h));
-fn f() -> mat2x2<f16> {
- let m_1 = mat2x2(m);
- return m_1;
+@group(0) @binding(0) var<storage, read_write> out : mat2x2<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat2x2<f16>(m);
}
diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f32.wgsl b/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f32.wgsl
index 195dba5..d58e95e 100644
--- a/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f32.wgsl
@@ -1,7 +1,10 @@
-var<private> m = mat2x2(mat2x2<f32>(0.0f, 1.0f,
+var<private> m = mat2x2<f32>(mat2x2<f32>(0.0f, 1.0f,
2.0f, 3.0f));
-fn f() -> mat2x2<f32> {
- let m_1 = mat2x2(m);
- return m_1;
+@group(0) @binding(0)
+var<storage, read_write> out : mat2x2<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat2x2<f32>(m);
}
diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f32.wgsl.expected.dxc.hlsl
index 738053f..e1454fb 100644
--- a/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f32.wgsl.expected.dxc.hlsl
@@ -1,11 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float2x2 m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
}
-static float2x2 m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f));
-
-float2x2 f() {
- const float2x2 m_1 = float2x2(m);
- return m_1;
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float2x2(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f32.wgsl.expected.fxc.hlsl
index 738053f..e1454fb 100644
--- a/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f32.wgsl.expected.fxc.hlsl
@@ -1,11 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float2x2 m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
}
-static float2x2 m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f));
-
-float2x2 f() {
- const float2x2 m_1 = float2x2(m);
- return m_1;
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float2x2(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f32.wgsl.expected.glsl
index f820bd4..f6b16e7 100644
--- a/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f32.wgsl.expected.glsl
@@ -1,12 +1,16 @@
#version 310 es
-layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
- return;
-}
mat2 m = mat2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f));
-mat2 f() {
- mat2 m_1 = mat2(m);
- return m_1;
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat2 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = mat2(m);
}
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ f();
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f32.wgsl.expected.msl
index c317697..e1d10bd 100644
--- a/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f32.wgsl.expected.msl
@@ -5,8 +5,10 @@
float2x2 m;
};
-float2x2 f(thread tint_private_vars_struct* const tint_private_vars) {
- float2x2 const m_1 = float2x2((*(tint_private_vars)).m);
- return m_1;
+kernel void f(device float2x2* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f));
+ *(tint_symbol) = float2x2(tint_private_vars.m);
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f32.wgsl.expected.spvasm
index 07b1ba1..2f257c4 100644
--- a/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f32.wgsl.expected.spvasm
@@ -1,15 +1,23 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 22
+; Bound: 26
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%mat2v2float = OpTypeMatrix %v2float 2
@@ -22,15 +30,18 @@
%10 = OpConstantComposite %mat2v2float %6 %9
%_ptr_Private_mat2v2float = OpTypePointer Private %mat2v2float
%m = OpVariable %_ptr_Private_mat2v2float Private %10
+ %out_block = OpTypeStruct %mat2v2float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %13 = OpTypeFunction %void
- %17 = OpTypeFunction %mat2v2float
-%unused_entry_point = OpFunction %void None %13
- %16 = OpLabel
- OpReturn
- OpFunctionEnd
- %f = OpFunction %mat2v2float None %17
+ %16 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat2v2float = OpTypePointer StorageBuffer %mat2v2float
+ %f = OpFunction %void None %16
%19 = OpLabel
- %21 = OpLoad %mat2v2float %m
- OpReturnValue %21
+ %23 = OpAccessChain %_ptr_StorageBuffer_mat2v2float %out %uint_0
+ %25 = OpLoad %mat2v2float %m
+ OpStore %23 %25
+ OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f32.wgsl.expected.wgsl
index 5950793..e93d259 100644
--- a/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f32.wgsl.expected.wgsl
@@ -1,6 +1,8 @@
-var<private> m = mat2x2(mat2x2<f32>(0.0f, 1.0f, 2.0f, 3.0f));
+var<private> m = mat2x2<f32>(mat2x2<f32>(0.0f, 1.0f, 2.0f, 3.0f));
-fn f() -> mat2x2<f32> {
- let m_1 = mat2x2(m);
- return m_1;
+@group(0) @binding(0) var<storage, read_write> out : mat2x2<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat2x2<f32>(m);
}
diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f16.wgsl b/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f16.wgsl
index 06d901c..e7a4f92 100644
--- a/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f16.wgsl
@@ -1,3 +1,11 @@
enable f16;
var<private> m = mat2x2<f16>(0.0h, 1.0h,
2.0h, 3.0h);
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat2x2<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f16.wgsl.expected.dxc.hlsl
index e07b4a1..246f50d 100644
--- a/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f16.wgsl.expected.dxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 2, 2> m = matrix<float16_t, 2, 2>(vector<float16_t, 2>(float16_t(0.0h), float16_t(1.0h)), vector<float16_t, 2>(float16_t(2.0h), float16_t(3.0h)));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 2, 2> value) {
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 4u), value[1u]);
}
-static matrix<float16_t, 2, 2> m = matrix<float16_t, 2, 2>(vector<float16_t, 2>(float16_t(0.0h), float16_t(1.0h)), vector<float16_t, 2>(float16_t(2.0h), float16_t(3.0h)));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f16.wgsl.expected.glsl
index 8b22b19..ef9fbfc 100644
--- a/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f16.wgsl.expected.glsl
@@ -1,8 +1,17 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
+f16mat2 m = f16mat2(f16vec2(0.0hf, 1.0hf), f16vec2(2.0hf, 3.0hf));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat2 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-f16mat2 m = f16mat2(f16vec2(0.0hf, 1.0hf), f16vec2(2.0hf, 3.0hf));
diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f16.wgsl.expected.msl
index 37b7060..ad783ad 100644
--- a/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f16.wgsl.expected.msl
@@ -5,3 +5,10 @@
half2x2 m;
};
+kernel void f(device half2x2* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half2x2(half2(0.0h, 1.0h), half2(2.0h, 3.0h));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f16.wgsl.expected.spvasm
index a0b6221..6ac167c 100644
--- a/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 17
+; Bound: 25
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,10 +9,19 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 4
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v2half = OpTypeVector %half 2
%mat2v2half = OpTypeMatrix %v2half 2
@@ -25,9 +34,18 @@
%10 = OpConstantComposite %mat2v2half %6 %9
%_ptr_Private_mat2v2half = OpTypePointer Private %mat2v2half
%m = OpVariable %_ptr_Private_mat2v2half Private %10
+ %out_block = OpTypeStruct %mat2v2half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %13 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %13
- %16 = OpLabel
+ %16 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat2v2half = OpTypePointer StorageBuffer %mat2v2half
+ %f = OpFunction %void None %16
+ %19 = OpLabel
+ %23 = OpAccessChain %_ptr_StorageBuffer_mat2v2half %out %uint_0
+ %24 = OpLoad %mat2v2half %m
+ OpStore %23 %24
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f16.wgsl.expected.wgsl
index afe7f0a..70edac6 100644
--- a/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f16.wgsl.expected.wgsl
@@ -1,3 +1,10 @@
enable f16;
var<private> m = mat2x2<f16>(0.0h, 1.0h, 2.0h, 3.0h);
+
+@group(0) @binding(0) var<storage, read_write> out : mat2x2<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl b/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl
index 8f8c2f9..ef1a08c 100644
--- a/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl
@@ -1,2 +1,10 @@
var<private> m = mat2x2<f32>(0.0f, 1.0f,
2.0f, 3.0f);
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat2x2<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl.expected.dxc.hlsl
index 28c5d1f..b0cc034 100644
--- a/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl.expected.dxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float2x2 m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
}
-static float2x2 m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl.expected.fxc.hlsl
index 28c5d1f..b0cc034 100644
--- a/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl.expected.fxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float2x2 m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
}
-static float2x2 m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl.expected.glsl
index cb3e1d2..798ac4d 100644
--- a/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl.expected.glsl
@@ -1,7 +1,16 @@
#version 310 es
+mat2 m = mat2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat2 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat2 m = mat2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f));
diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl.expected.msl
index c97a144..f59cab2 100644
--- a/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl.expected.msl
@@ -5,3 +5,10 @@
float2x2 m;
};
+kernel void f(device float2x2* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl.expected.spvasm
index c04960a..6b6ba75 100644
--- a/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl.expected.spvasm
@@ -1,14 +1,23 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 17
+; Bound: 25
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%mat2v2float = OpTypeMatrix %v2float 2
@@ -21,9 +30,18 @@
%10 = OpConstantComposite %mat2v2float %6 %9
%_ptr_Private_mat2v2float = OpTypePointer Private %mat2v2float
%m = OpVariable %_ptr_Private_mat2v2float Private %10
+ %out_block = OpTypeStruct %mat2v2float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %13 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %13
- %16 = OpLabel
+ %16 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat2v2float = OpTypePointer StorageBuffer %mat2v2float
+ %f = OpFunction %void None %16
+ %19 = OpLabel
+ %23 = OpAccessChain %_ptr_StorageBuffer_mat2v2float %out %uint_0
+ %24 = OpLoad %mat2v2float %m
+ OpStore %23 %24
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl.expected.wgsl
index 027ab22..bb22a09 100644
--- a/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl.expected.wgsl
@@ -1 +1,8 @@
var<private> m = mat2x2<f32>(0.0f, 1.0f, 2.0f, 3.0f);
+
+@group(0) @binding(0) var<storage, read_write> out : mat2x2<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f16.wgsl b/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f16.wgsl
index 7998488..c3ef29f 100644
--- a/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f16.wgsl
@@ -1,3 +1,11 @@
enable f16;
var<private> m = mat2x2<f16>(vec2<f16>(0.0h, 1.0h),
vec2<f16>(2.0h, 3.0h));
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat2x2<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f16.wgsl.expected.dxc.hlsl
index e07b4a1..246f50d 100644
--- a/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f16.wgsl.expected.dxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 2, 2> m = matrix<float16_t, 2, 2>(vector<float16_t, 2>(float16_t(0.0h), float16_t(1.0h)), vector<float16_t, 2>(float16_t(2.0h), float16_t(3.0h)));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 2, 2> value) {
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 4u), value[1u]);
}
-static matrix<float16_t, 2, 2> m = matrix<float16_t, 2, 2>(vector<float16_t, 2>(float16_t(0.0h), float16_t(1.0h)), vector<float16_t, 2>(float16_t(2.0h), float16_t(3.0h)));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f16.wgsl.expected.glsl
index 8b22b19..ef9fbfc 100644
--- a/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f16.wgsl.expected.glsl
@@ -1,8 +1,17 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
+f16mat2 m = f16mat2(f16vec2(0.0hf, 1.0hf), f16vec2(2.0hf, 3.0hf));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat2 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-f16mat2 m = f16mat2(f16vec2(0.0hf, 1.0hf), f16vec2(2.0hf, 3.0hf));
diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f16.wgsl.expected.msl
index 37b7060..ad783ad 100644
--- a/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f16.wgsl.expected.msl
@@ -5,3 +5,10 @@
half2x2 m;
};
+kernel void f(device half2x2* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half2x2(half2(0.0h, 1.0h), half2(2.0h, 3.0h));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f16.wgsl.expected.spvasm
index a0b6221..6ac167c 100644
--- a/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 17
+; Bound: 25
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,10 +9,19 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 4
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v2half = OpTypeVector %half 2
%mat2v2half = OpTypeMatrix %v2half 2
@@ -25,9 +34,18 @@
%10 = OpConstantComposite %mat2v2half %6 %9
%_ptr_Private_mat2v2half = OpTypePointer Private %mat2v2half
%m = OpVariable %_ptr_Private_mat2v2half Private %10
+ %out_block = OpTypeStruct %mat2v2half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %13 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %13
- %16 = OpLabel
+ %16 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat2v2half = OpTypePointer StorageBuffer %mat2v2half
+ %f = OpFunction %void None %16
+ %19 = OpLabel
+ %23 = OpAccessChain %_ptr_StorageBuffer_mat2v2half %out %uint_0
+ %24 = OpLoad %mat2v2half %m
+ OpStore %23 %24
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f16.wgsl.expected.wgsl
index 7be5a43..29ef901 100644
--- a/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f16.wgsl.expected.wgsl
@@ -1,3 +1,10 @@
enable f16;
var<private> m = mat2x2<f16>(vec2<f16>(0.0h, 1.0h), vec2<f16>(2.0h, 3.0h));
+
+@group(0) @binding(0) var<storage, read_write> out : mat2x2<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl b/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl
index 6912816..5b3087f 100644
--- a/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl
@@ -1,2 +1,10 @@
var<private> m = mat2x2<f32>(vec2<f32>(0.0f, 1.0f),
vec2<f32>(2.0f, 3.0f));
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat2x2<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.dxc.hlsl
index 28c5d1f..b0cc034 100644
--- a/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.dxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float2x2 m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
}
-static float2x2 m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.fxc.hlsl
index 28c5d1f..b0cc034 100644
--- a/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.fxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float2x2 m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
}
-static float2x2 m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.glsl
index cb3e1d2..798ac4d 100644
--- a/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.glsl
@@ -1,7 +1,16 @@
#version 310 es
+mat2 m = mat2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat2 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat2 m = mat2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f));
diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.msl
index c97a144..f59cab2 100644
--- a/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.msl
@@ -5,3 +5,10 @@
float2x2 m;
};
+kernel void f(device float2x2* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.spvasm
index c04960a..6b6ba75 100644
--- a/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.spvasm
@@ -1,14 +1,23 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 17
+; Bound: 25
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%mat2v2float = OpTypeMatrix %v2float 2
@@ -21,9 +30,18 @@
%10 = OpConstantComposite %mat2v2float %6 %9
%_ptr_Private_mat2v2float = OpTypePointer Private %mat2v2float
%m = OpVariable %_ptr_Private_mat2v2float Private %10
+ %out_block = OpTypeStruct %mat2v2float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %13 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %13
- %16 = OpLabel
+ %16 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat2v2float = OpTypePointer StorageBuffer %mat2v2float
+ %f = OpFunction %void None %16
+ %19 = OpLabel
+ %23 = OpAccessChain %_ptr_StorageBuffer_mat2v2float %out %uint_0
+ %24 = OpLoad %mat2v2float %m
+ OpStore %23 %24
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.wgsl
index b3b5d6e..c308d38 100644
--- a/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.wgsl
@@ -1 +1,8 @@
var<private> m = mat2x2<f32>(vec2<f32>(0.0f, 1.0f), vec2<f32>(2.0f, 3.0f));
+
+@group(0) @binding(0) var<storage, read_write> out : mat2x2<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f16.wgsl b/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f16.wgsl
index 4c2c065..520791e 100644
--- a/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f16.wgsl
@@ -2,7 +2,10 @@
var<private> m = mat2x2(mat2x2(0.0h, 1.0h,
2.0h, 3.0h));
-fn f() -> mat2x2<f16> {
- let m_1 = mat2x2(m);
- return m_1;
+@group(0) @binding(0)
+var<storage, read_write> out : mat2x2<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat2x2(m);
}
diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f16.wgsl.expected.dxc.hlsl
index 909b45b..54b7286 100644
--- a/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f16.wgsl.expected.dxc.hlsl
@@ -1,11 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 2, 2> m = matrix<float16_t, 2, 2>(vector<float16_t, 2>(float16_t(0.0h), float16_t(1.0h)), vector<float16_t, 2>(float16_t(2.0h), float16_t(3.0h)));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 2, 2> value) {
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 4u), value[1u]);
}
-static matrix<float16_t, 2, 2> m = matrix<float16_t, 2, 2>(vector<float16_t, 2>(float16_t(0.0h), float16_t(1.0h)), vector<float16_t, 2>(float16_t(2.0h), float16_t(3.0h)));
-
-matrix<float16_t, 2, 2> f() {
- const matrix<float16_t, 2, 2> m_1 = matrix<float16_t, 2, 2>(m);
- return m_1;
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, matrix<float16_t, 2, 2>(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f16.wgsl.expected.glsl
index 8fd1749..95b5ca2 100644
--- a/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f16.wgsl.expected.glsl
@@ -1,13 +1,17 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
- return;
-}
f16mat2 m = f16mat2(f16vec2(0.0hf, 1.0hf), f16vec2(2.0hf, 3.0hf));
-f16mat2 f() {
- f16mat2 m_1 = f16mat2(m);
- return m_1;
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat2 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = f16mat2(m);
}
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ f();
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f16.wgsl.expected.msl
index 83d200f..633fcee 100644
--- a/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f16.wgsl.expected.msl
@@ -5,8 +5,10 @@
half2x2 m;
};
-half2x2 f(thread tint_private_vars_struct* const tint_private_vars) {
- half2x2 const m_1 = half2x2((*(tint_private_vars)).m);
- return m_1;
+kernel void f(device half2x2* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half2x2(half2(0.0h, 1.0h), half2(2.0h, 3.0h));
+ *(tint_symbol) = half2x2(tint_private_vars.m);
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f16.wgsl.expected.spvasm
index 81b52d7..84ed5a6 100644
--- a/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 22
+; Bound: 26
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,11 +9,19 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 4
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v2half = OpTypeVector %half 2
%mat2v2half = OpTypeMatrix %v2half 2
@@ -26,15 +34,18 @@
%10 = OpConstantComposite %mat2v2half %6 %9
%_ptr_Private_mat2v2half = OpTypePointer Private %mat2v2half
%m = OpVariable %_ptr_Private_mat2v2half Private %10
+ %out_block = OpTypeStruct %mat2v2half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %13 = OpTypeFunction %void
- %17 = OpTypeFunction %mat2v2half
-%unused_entry_point = OpFunction %void None %13
- %16 = OpLabel
- OpReturn
- OpFunctionEnd
- %f = OpFunction %mat2v2half None %17
+ %16 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat2v2half = OpTypePointer StorageBuffer %mat2v2half
+ %f = OpFunction %void None %16
%19 = OpLabel
- %21 = OpLoad %mat2v2half %m
- OpReturnValue %21
+ %23 = OpAccessChain %_ptr_StorageBuffer_mat2v2half %out %uint_0
+ %25 = OpLoad %mat2v2half %m
+ OpStore %23 %25
+ OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f16.wgsl.expected.wgsl
index 35e5253..2b04827 100644
--- a/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f16.wgsl.expected.wgsl
@@ -2,7 +2,9 @@
var<private> m = mat2x2(mat2x2(0.0h, 1.0h, 2.0h, 3.0h));
-fn f() -> mat2x2<f16> {
- let m_1 = mat2x2(m);
- return m_1;
+@group(0) @binding(0) var<storage, read_write> out : mat2x2<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat2x2(m);
}
diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f32.wgsl b/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f32.wgsl
index bd51d6b..7415a95 100644
--- a/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f32.wgsl
@@ -1,7 +1,10 @@
var<private> m = mat2x2(mat2x2(0.0f, 1.0f,
2.0f, 3.0f));
-fn f() -> mat2x2<f32> {
- let m_1 = mat2x2(m);
- return m_1;
+@group(0) @binding(0)
+var<storage, read_write> out : mat2x2<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat2x2(m);
}
diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f32.wgsl.expected.dxc.hlsl
index 738053f..e1454fb 100644
--- a/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f32.wgsl.expected.dxc.hlsl
@@ -1,11 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float2x2 m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
}
-static float2x2 m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f));
-
-float2x2 f() {
- const float2x2 m_1 = float2x2(m);
- return m_1;
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float2x2(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f32.wgsl.expected.fxc.hlsl
index 738053f..e1454fb 100644
--- a/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f32.wgsl.expected.fxc.hlsl
@@ -1,11 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float2x2 m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
}
-static float2x2 m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f));
-
-float2x2 f() {
- const float2x2 m_1 = float2x2(m);
- return m_1;
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float2x2(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f32.wgsl.expected.glsl
index f820bd4..f6b16e7 100644
--- a/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f32.wgsl.expected.glsl
@@ -1,12 +1,16 @@
#version 310 es
-layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
- return;
-}
mat2 m = mat2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f));
-mat2 f() {
- mat2 m_1 = mat2(m);
- return m_1;
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat2 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = mat2(m);
}
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ f();
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f32.wgsl.expected.msl
index c317697..e1d10bd 100644
--- a/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f32.wgsl.expected.msl
@@ -5,8 +5,10 @@
float2x2 m;
};
-float2x2 f(thread tint_private_vars_struct* const tint_private_vars) {
- float2x2 const m_1 = float2x2((*(tint_private_vars)).m);
- return m_1;
+kernel void f(device float2x2* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f));
+ *(tint_symbol) = float2x2(tint_private_vars.m);
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f32.wgsl.expected.spvasm
index 07b1ba1..2f257c4 100644
--- a/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f32.wgsl.expected.spvasm
@@ -1,15 +1,23 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 22
+; Bound: 26
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%mat2v2float = OpTypeMatrix %v2float 2
@@ -22,15 +30,18 @@
%10 = OpConstantComposite %mat2v2float %6 %9
%_ptr_Private_mat2v2float = OpTypePointer Private %mat2v2float
%m = OpVariable %_ptr_Private_mat2v2float Private %10
+ %out_block = OpTypeStruct %mat2v2float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %13 = OpTypeFunction %void
- %17 = OpTypeFunction %mat2v2float
-%unused_entry_point = OpFunction %void None %13
- %16 = OpLabel
- OpReturn
- OpFunctionEnd
- %f = OpFunction %mat2v2float None %17
+ %16 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat2v2float = OpTypePointer StorageBuffer %mat2v2float
+ %f = OpFunction %void None %16
%19 = OpLabel
- %21 = OpLoad %mat2v2float %m
- OpReturnValue %21
+ %23 = OpAccessChain %_ptr_StorageBuffer_mat2v2float %out %uint_0
+ %25 = OpLoad %mat2v2float %m
+ OpStore %23 %25
+ OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f32.wgsl.expected.wgsl
index fb8399a..c46596a 100644
--- a/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f32.wgsl.expected.wgsl
@@ -1,6 +1,8 @@
var<private> m = mat2x2(mat2x2(0.0f, 1.0f, 2.0f, 3.0f));
-fn f() -> mat2x2<f32> {
- let m_1 = mat2x2(m);
- return m_1;
+@group(0) @binding(0) var<storage, read_write> out : mat2x2<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat2x2(m);
}
diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/abstract-float.wgsl b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/abstract-float.wgsl
index 99f7353..5200a20 100644
--- a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/abstract-float.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/abstract-float.wgsl
@@ -1,2 +1,10 @@
-var<private> m = mat2x2(0.0, 1.0,
- 2.0, 3.0);
+const m = mat2x2(0.0, 1.0,
+ 2.0, 3.0);
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat2x2<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl
index 28c5d1f..88de65e 100644
--- a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl
@@ -1,6 +1,12 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
}
-static float2x2 m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f)));
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl
index 28c5d1f..88de65e 100644
--- a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl
@@ -1,6 +1,12 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
}
-static float2x2 m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f)));
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/abstract-float.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/abstract-float.wgsl.expected.glsl
index cb3e1d2..6d57f04 100644
--- a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/abstract-float.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/abstract-float.wgsl.expected.glsl
@@ -1,7 +1,15 @@
#version 310 es
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat2 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = mat2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f));
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat2 m = mat2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f));
diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/abstract-float.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/abstract-float.wgsl.expected.msl
index c97a144..358336e 100644
--- a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/abstract-float.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/abstract-float.wgsl.expected.msl
@@ -1,7 +1,8 @@
#include <metal_stdlib>
using namespace metal;
-struct tint_private_vars_struct {
- float2x2 m;
-};
+kernel void f(device float2x2* tint_symbol [[buffer(0)]]) {
+ *(tint_symbol) = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f));
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/abstract-float.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/abstract-float.wgsl.expected.spvasm
index c04960a..5ea5ab3 100644
--- a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/abstract-float.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/abstract-float.wgsl.expected.spvasm
@@ -1,29 +1,43 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 17
+; Bound: 22
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
- OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%mat2v2float = OpTypeMatrix %v2float 2
- %4 = OpConstantNull %float
+ %out_block = OpTypeStruct %mat2v2float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat2v2float = OpTypePointer StorageBuffer %mat2v2float
+ %15 = OpConstantNull %float
%float_1 = OpConstant %float 1
- %6 = OpConstantComposite %v2float %4 %float_1
+ %17 = OpConstantComposite %v2float %15 %float_1
%float_2 = OpConstant %float 2
%float_3 = OpConstant %float 3
- %9 = OpConstantComposite %v2float %float_2 %float_3
- %10 = OpConstantComposite %mat2v2float %6 %9
-%_ptr_Private_mat2v2float = OpTypePointer Private %mat2v2float
- %m = OpVariable %_ptr_Private_mat2v2float Private %10
- %void = OpTypeVoid
- %13 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %13
- %16 = OpLabel
+ %20 = OpConstantComposite %v2float %float_2 %float_3
+ %21 = OpConstantComposite %mat2v2float %17 %20
+ %f = OpFunction %void None %7
+ %10 = OpLabel
+ %14 = OpAccessChain %_ptr_StorageBuffer_mat2v2float %out %uint_0
+ OpStore %14 %21
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/abstract-float.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/abstract-float.wgsl.expected.wgsl
index e1064e8..165cf5c 100644
--- a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/abstract-float.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/abstract-float.wgsl.expected.wgsl
@@ -1 +1,8 @@
-var<private> m = mat2x2(0.0, 1.0, 2.0, 3.0);
+const m = mat2x2(0.0, 1.0, 2.0, 3.0);
+
+@group(0) @binding(0) var<storage, read_write> out : mat2x2<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f16.wgsl b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f16.wgsl
index 5b28fdb..4affe17 100644
--- a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f16.wgsl
@@ -1,3 +1,11 @@
enable f16;
var<private> m = mat2x2(0.0h, 1.0h,
2.0h, 3.0h);
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat2x2<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f16.wgsl.expected.dxc.hlsl
index e07b4a1..246f50d 100644
--- a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f16.wgsl.expected.dxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 2, 2> m = matrix<float16_t, 2, 2>(vector<float16_t, 2>(float16_t(0.0h), float16_t(1.0h)), vector<float16_t, 2>(float16_t(2.0h), float16_t(3.0h)));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 2, 2> value) {
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 4u), value[1u]);
}
-static matrix<float16_t, 2, 2> m = matrix<float16_t, 2, 2>(vector<float16_t, 2>(float16_t(0.0h), float16_t(1.0h)), vector<float16_t, 2>(float16_t(2.0h), float16_t(3.0h)));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f16.wgsl.expected.glsl
index 8b22b19..ef9fbfc 100644
--- a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f16.wgsl.expected.glsl
@@ -1,8 +1,17 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
+f16mat2 m = f16mat2(f16vec2(0.0hf, 1.0hf), f16vec2(2.0hf, 3.0hf));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat2 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-f16mat2 m = f16mat2(f16vec2(0.0hf, 1.0hf), f16vec2(2.0hf, 3.0hf));
diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f16.wgsl.expected.msl
index 37b7060..ad783ad 100644
--- a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f16.wgsl.expected.msl
@@ -5,3 +5,10 @@
half2x2 m;
};
+kernel void f(device half2x2* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half2x2(half2(0.0h, 1.0h), half2(2.0h, 3.0h));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f16.wgsl.expected.spvasm
index a0b6221..6ac167c 100644
--- a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 17
+; Bound: 25
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,10 +9,19 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 4
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v2half = OpTypeVector %half 2
%mat2v2half = OpTypeMatrix %v2half 2
@@ -25,9 +34,18 @@
%10 = OpConstantComposite %mat2v2half %6 %9
%_ptr_Private_mat2v2half = OpTypePointer Private %mat2v2half
%m = OpVariable %_ptr_Private_mat2v2half Private %10
+ %out_block = OpTypeStruct %mat2v2half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %13 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %13
- %16 = OpLabel
+ %16 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat2v2half = OpTypePointer StorageBuffer %mat2v2half
+ %f = OpFunction %void None %16
+ %19 = OpLabel
+ %23 = OpAccessChain %_ptr_StorageBuffer_mat2v2half %out %uint_0
+ %24 = OpLoad %mat2v2half %m
+ OpStore %23 %24
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f16.wgsl.expected.wgsl
index 8ce8a82..a589b04 100644
--- a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f16.wgsl.expected.wgsl
@@ -1,3 +1,10 @@
enable f16;
var<private> m = mat2x2(0.0h, 1.0h, 2.0h, 3.0h);
+
+@group(0) @binding(0) var<storage, read_write> out : mat2x2<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl
index 0fb8992..46b3532 100644
--- a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl
@@ -1,2 +1,10 @@
var<private> m = mat2x2(0.0f, 1.0f,
2.0f, 3.0f);
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat2x2<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl.expected.dxc.hlsl
index 28c5d1f..b0cc034 100644
--- a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl.expected.dxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float2x2 m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
}
-static float2x2 m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl.expected.fxc.hlsl
index 28c5d1f..b0cc034 100644
--- a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl.expected.fxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float2x2 m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
}
-static float2x2 m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl.expected.glsl
index cb3e1d2..798ac4d 100644
--- a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl.expected.glsl
@@ -1,7 +1,16 @@
#version 310 es
+mat2 m = mat2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat2 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat2 m = mat2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f));
diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl.expected.msl
index c97a144..f59cab2 100644
--- a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl.expected.msl
@@ -5,3 +5,10 @@
float2x2 m;
};
+kernel void f(device float2x2* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl.expected.spvasm
index c04960a..6b6ba75 100644
--- a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl.expected.spvasm
@@ -1,14 +1,23 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 17
+; Bound: 25
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%mat2v2float = OpTypeMatrix %v2float 2
@@ -21,9 +30,18 @@
%10 = OpConstantComposite %mat2v2float %6 %9
%_ptr_Private_mat2v2float = OpTypePointer Private %mat2v2float
%m = OpVariable %_ptr_Private_mat2v2float Private %10
+ %out_block = OpTypeStruct %mat2v2float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %13 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %13
- %16 = OpLabel
+ %16 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat2v2float = OpTypePointer StorageBuffer %mat2v2float
+ %f = OpFunction %void None %16
+ %19 = OpLabel
+ %23 = OpAccessChain %_ptr_StorageBuffer_mat2v2float %out %uint_0
+ %24 = OpLoad %mat2v2float %m
+ OpStore %23 %24
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl.expected.wgsl
index 4a3c56d..030f5c2 100644
--- a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl.expected.wgsl
@@ -1 +1,8 @@
var<private> m = mat2x2(0.0f, 1.0f, 2.0f, 3.0f);
+
+@group(0) @binding(0) var<storage, read_write> out : mat2x2<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/abstract-float.wgsl b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/abstract-float.wgsl
index 8c1ad0e..e42b7b7 100644
--- a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/abstract-float.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/abstract-float.wgsl
@@ -1,2 +1,10 @@
-var<private> m = mat2x2(vec2(0.0, 1.0),
- vec2(2.0, 3.0));
+const m = mat2x2(vec2(0.0, 1.0),
+ vec2(2.0, 3.0));
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat2x2<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl
index 28c5d1f..88de65e 100644
--- a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl
@@ -1,6 +1,12 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
}
-static float2x2 m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f)));
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl
index 28c5d1f..88de65e 100644
--- a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl
@@ -1,6 +1,12 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
}
-static float2x2 m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f)));
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/abstract-float.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/abstract-float.wgsl.expected.glsl
index cb3e1d2..6d57f04 100644
--- a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/abstract-float.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/abstract-float.wgsl.expected.glsl
@@ -1,7 +1,15 @@
#version 310 es
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat2 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = mat2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f));
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat2 m = mat2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f));
diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/abstract-float.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/abstract-float.wgsl.expected.msl
index c97a144..358336e 100644
--- a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/abstract-float.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/abstract-float.wgsl.expected.msl
@@ -1,7 +1,8 @@
#include <metal_stdlib>
using namespace metal;
-struct tint_private_vars_struct {
- float2x2 m;
-};
+kernel void f(device float2x2* tint_symbol [[buffer(0)]]) {
+ *(tint_symbol) = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f));
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/abstract-float.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/abstract-float.wgsl.expected.spvasm
index c04960a..5ea5ab3 100644
--- a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/abstract-float.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/abstract-float.wgsl.expected.spvasm
@@ -1,29 +1,43 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 17
+; Bound: 22
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
- OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%mat2v2float = OpTypeMatrix %v2float 2
- %4 = OpConstantNull %float
+ %out_block = OpTypeStruct %mat2v2float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat2v2float = OpTypePointer StorageBuffer %mat2v2float
+ %15 = OpConstantNull %float
%float_1 = OpConstant %float 1
- %6 = OpConstantComposite %v2float %4 %float_1
+ %17 = OpConstantComposite %v2float %15 %float_1
%float_2 = OpConstant %float 2
%float_3 = OpConstant %float 3
- %9 = OpConstantComposite %v2float %float_2 %float_3
- %10 = OpConstantComposite %mat2v2float %6 %9
-%_ptr_Private_mat2v2float = OpTypePointer Private %mat2v2float
- %m = OpVariable %_ptr_Private_mat2v2float Private %10
- %void = OpTypeVoid
- %13 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %13
- %16 = OpLabel
+ %20 = OpConstantComposite %v2float %float_2 %float_3
+ %21 = OpConstantComposite %mat2v2float %17 %20
+ %f = OpFunction %void None %7
+ %10 = OpLabel
+ %14 = OpAccessChain %_ptr_StorageBuffer_mat2v2float %out %uint_0
+ OpStore %14 %21
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/abstract-float.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/abstract-float.wgsl.expected.wgsl
index 38d5333..56815e5 100644
--- a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/abstract-float.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/abstract-float.wgsl.expected.wgsl
@@ -1 +1,8 @@
-var<private> m = mat2x2(vec2(0.0, 1.0), vec2(2.0, 3.0));
+const m = mat2x2(vec2(0.0, 1.0), vec2(2.0, 3.0));
+
+@group(0) @binding(0) var<storage, read_write> out : mat2x2<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f16.wgsl b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f16.wgsl
index d1af65f..cb30d5f 100644
--- a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f16.wgsl
@@ -1,3 +1,11 @@
enable f16;
var<private> m = mat2x2(vec2<f16>(0.0h, 1.0h),
vec2<f16>(2.0h, 3.0h));
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat2x2<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f16.wgsl.expected.dxc.hlsl
index e07b4a1..246f50d 100644
--- a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f16.wgsl.expected.dxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 2, 2> m = matrix<float16_t, 2, 2>(vector<float16_t, 2>(float16_t(0.0h), float16_t(1.0h)), vector<float16_t, 2>(float16_t(2.0h), float16_t(3.0h)));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 2, 2> value) {
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 4u), value[1u]);
}
-static matrix<float16_t, 2, 2> m = matrix<float16_t, 2, 2>(vector<float16_t, 2>(float16_t(0.0h), float16_t(1.0h)), vector<float16_t, 2>(float16_t(2.0h), float16_t(3.0h)));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f16.wgsl.expected.glsl
index 8b22b19..ef9fbfc 100644
--- a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f16.wgsl.expected.glsl
@@ -1,8 +1,17 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
+f16mat2 m = f16mat2(f16vec2(0.0hf, 1.0hf), f16vec2(2.0hf, 3.0hf));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat2 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-f16mat2 m = f16mat2(f16vec2(0.0hf, 1.0hf), f16vec2(2.0hf, 3.0hf));
diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f16.wgsl.expected.msl
index 37b7060..ad783ad 100644
--- a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f16.wgsl.expected.msl
@@ -5,3 +5,10 @@
half2x2 m;
};
+kernel void f(device half2x2* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half2x2(half2(0.0h, 1.0h), half2(2.0h, 3.0h));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f16.wgsl.expected.spvasm
index a0b6221..6ac167c 100644
--- a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 17
+; Bound: 25
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,10 +9,19 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 4
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v2half = OpTypeVector %half 2
%mat2v2half = OpTypeMatrix %v2half 2
@@ -25,9 +34,18 @@
%10 = OpConstantComposite %mat2v2half %6 %9
%_ptr_Private_mat2v2half = OpTypePointer Private %mat2v2half
%m = OpVariable %_ptr_Private_mat2v2half Private %10
+ %out_block = OpTypeStruct %mat2v2half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %13 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %13
- %16 = OpLabel
+ %16 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat2v2half = OpTypePointer StorageBuffer %mat2v2half
+ %f = OpFunction %void None %16
+ %19 = OpLabel
+ %23 = OpAccessChain %_ptr_StorageBuffer_mat2v2half %out %uint_0
+ %24 = OpLoad %mat2v2half %m
+ OpStore %23 %24
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f16.wgsl.expected.wgsl
index e3a0990..0f1c877 100644
--- a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f16.wgsl.expected.wgsl
@@ -1,3 +1,10 @@
enable f16;
var<private> m = mat2x2(vec2<f16>(0.0h, 1.0h), vec2<f16>(2.0h, 3.0h));
+
+@group(0) @binding(0) var<storage, read_write> out : mat2x2<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl
index c592c6c..3fa6dd7 100644
--- a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl
@@ -1,2 +1,10 @@
var<private> m = mat2x2(vec2<f32>(0.0, 1.0),
vec2<f32>(2.0, 3.0));
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat2x2<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl.expected.dxc.hlsl
index 28c5d1f..b0cc034 100644
--- a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl.expected.dxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float2x2 m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
}
-static float2x2 m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl.expected.fxc.hlsl
index 28c5d1f..b0cc034 100644
--- a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl.expected.fxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float2x2 m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
}
-static float2x2 m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl.expected.glsl
index cb3e1d2..798ac4d 100644
--- a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl.expected.glsl
@@ -1,7 +1,16 @@
#version 310 es
+mat2 m = mat2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat2 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat2 m = mat2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f));
diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl.expected.msl
index c97a144..f59cab2 100644
--- a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl.expected.msl
@@ -5,3 +5,10 @@
float2x2 m;
};
+kernel void f(device float2x2* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl.expected.spvasm
index c04960a..6b6ba75 100644
--- a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl.expected.spvasm
@@ -1,14 +1,23 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 17
+; Bound: 25
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%mat2v2float = OpTypeMatrix %v2float 2
@@ -21,9 +30,18 @@
%10 = OpConstantComposite %mat2v2float %6 %9
%_ptr_Private_mat2v2float = OpTypePointer Private %mat2v2float
%m = OpVariable %_ptr_Private_mat2v2float Private %10
+ %out_block = OpTypeStruct %mat2v2float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %13 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %13
- %16 = OpLabel
+ %16 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat2v2float = OpTypePointer StorageBuffer %mat2v2float
+ %f = OpFunction %void None %16
+ %19 = OpLabel
+ %23 = OpAccessChain %_ptr_StorageBuffer_mat2v2float %out %uint_0
+ %24 = OpLoad %mat2v2float %m
+ OpStore %23 %24
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl.expected.wgsl
index 48f4288..7b5c424 100644
--- a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl.expected.wgsl
@@ -1 +1,8 @@
var<private> m = mat2x2(vec2<f32>(0.0, 1.0), vec2<f32>(2.0, 3.0));
+
+@group(0) @binding(0) var<storage, read_write> out : mat2x2<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x2/load/f16.wgsl b/test/tint/expressions/type_ctor/mat2x2/load/f16.wgsl
index 32f7497..9097a4f 100644
--- a/test/tint/expressions/type_ctor/mat2x2/load/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x2/load/f16.wgsl
@@ -1,5 +1,10 @@
enable f16;
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat2x2<f16>;
+
+@compute @workgroup_size(1)
fn f() {
- var m = mat2x2<f16>();
- let m_1 = mat2x2(m);
+ var m = mat2x2<f16>();
+ out = mat2x2(m);
}
diff --git a/test/tint/expressions/type_ctor/mat2x2/load/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/load/f16.wgsl.expected.dxc.hlsl
index 2d8ecf1..23429bd 100644
--- a/test/tint/expressions/type_ctor/mat2x2/load/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x2/load/f16.wgsl.expected.dxc.hlsl
@@ -1,9 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 2, 2> value) {
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 4u), value[1u]);
}
+[numthreads(1, 1, 1)]
void f() {
matrix<float16_t, 2, 2> m = matrix<float16_t, 2, 2>((float16_t(0.0h)).xx, (float16_t(0.0h)).xx);
- const matrix<float16_t, 2, 2> m_1 = matrix<float16_t, 2, 2>(m);
+ tint_symbol_store(0u, matrix<float16_t, 2, 2>(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat2x2/load/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x2/load/f16.wgsl.expected.glsl
index d9cb0c7..59ef5b0 100644
--- a/test/tint/expressions/type_ctor/mat2x2/load/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat2x2/load/f16.wgsl.expected.glsl
@@ -1,12 +1,17 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
- return;
-}
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat2 inner;
+} tint_symbol;
+
void f() {
f16mat2 m = f16mat2(f16vec2(0.0hf), f16vec2(0.0hf));
- f16mat2 m_1 = f16mat2(m);
+ tint_symbol.inner = f16mat2(m);
}
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ f();
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x2/load/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x2/load/f16.wgsl.expected.msl
index e751fe8..847f66b 100644
--- a/test/tint/expressions/type_ctor/mat2x2/load/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat2x2/load/f16.wgsl.expected.msl
@@ -1,8 +1,9 @@
#include <metal_stdlib>
using namespace metal;
-void f() {
+kernel void f(device half2x2* tint_symbol [[buffer(0)]]) {
half2x2 m = half2x2(half2(0.0h), half2(0.0h));
- half2x2 const m_1 = half2x2(m);
+ *(tint_symbol) = half2x2(m);
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat2x2/load/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x2/load/f16.wgsl.expected.spvasm
index 361a44b..6add350 100644
--- a/test/tint/expressions/type_ctor/mat2x2/load/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat2x2/load/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 15
+; Bound: 20
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,26 +9,38 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
- OpName %unused_entry_point "unused_entry_point"
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
OpName %f "f"
OpName %m "m"
- %void = OpTypeVoid
- %1 = OpTypeFunction %void
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 4
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v2half = OpTypeVector %half 2
%mat2v2half = OpTypeMatrix %v2half 2
- %10 = OpConstantNull %mat2v2half
+ %out_block = OpTypeStruct %mat2v2half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void
+ %11 = OpConstantNull %mat2v2half
%_ptr_Function_mat2v2half = OpTypePointer Function %mat2v2half
-%unused_entry_point = OpFunction %void None %1
- %4 = OpLabel
- OpReturn
- OpFunctionEnd
- %f = OpFunction %void None %1
- %6 = OpLabel
- %m = OpVariable %_ptr_Function_mat2v2half Function %10
- OpStore %m %10
- %14 = OpLoad %mat2v2half %m
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat2v2half = OpTypePointer StorageBuffer %mat2v2half
+ %f = OpFunction %void None %7
+ %10 = OpLabel
+ %m = OpVariable %_ptr_Function_mat2v2half Function %11
+ OpStore %m %11
+ %17 = OpAccessChain %_ptr_StorageBuffer_mat2v2half %out %uint_0
+ %19 = OpLoad %mat2v2half %m
+ OpStore %17 %19
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat2x2/load/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x2/load/f16.wgsl.expected.wgsl
index 1744993..efdd1bc 100644
--- a/test/tint/expressions/type_ctor/mat2x2/load/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x2/load/f16.wgsl.expected.wgsl
@@ -1,6 +1,9 @@
enable f16;
+@group(0) @binding(0) var<storage, read_write> out : mat2x2<f16>;
+
+@compute @workgroup_size(1)
fn f() {
var m = mat2x2<f16>();
- let m_1 = mat2x2(m);
+ out = mat2x2(m);
}
diff --git a/test/tint/expressions/type_ctor/mat2x2/load/f32.wgsl b/test/tint/expressions/type_ctor/mat2x2/load/f32.wgsl
index 0d79135..05ab1d6 100644
--- a/test/tint/expressions/type_ctor/mat2x2/load/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x2/load/f32.wgsl
@@ -1,4 +1,8 @@
+@group(0) @binding(0)
+var<storage, read_write> out : mat2x2<f32>;
+
+@compute @workgroup_size(1)
fn f() {
- var m = mat2x2<f32>();
- let m_1 = mat2x2(m);
+ var m = mat2x2<f32>();
+ out = mat2x2(m);
}
diff --git a/test/tint/expressions/type_ctor/mat2x2/load/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/load/f32.wgsl.expected.dxc.hlsl
index b737fd2..72f0a23 100644
--- a/test/tint/expressions/type_ctor/mat2x2/load/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x2/load/f32.wgsl.expected.dxc.hlsl
@@ -1,9 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
}
+[numthreads(1, 1, 1)]
void f() {
float2x2 m = float2x2((0.0f).xx, (0.0f).xx);
- const float2x2 m_1 = float2x2(m);
+ tint_symbol_store(0u, float2x2(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat2x2/load/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/load/f32.wgsl.expected.fxc.hlsl
index b737fd2..72f0a23 100644
--- a/test/tint/expressions/type_ctor/mat2x2/load/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x2/load/f32.wgsl.expected.fxc.hlsl
@@ -1,9 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
}
+[numthreads(1, 1, 1)]
void f() {
float2x2 m = float2x2((0.0f).xx, (0.0f).xx);
- const float2x2 m_1 = float2x2(m);
+ tint_symbol_store(0u, float2x2(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat2x2/load/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x2/load/f32.wgsl.expected.glsl
index ee78c72..19300d9 100644
--- a/test/tint/expressions/type_ctor/mat2x2/load/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat2x2/load/f32.wgsl.expected.glsl
@@ -1,11 +1,16 @@
#version 310 es
-layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
- return;
-}
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat2 inner;
+} tint_symbol;
+
void f() {
mat2 m = mat2(vec2(0.0f), vec2(0.0f));
- mat2 m_1 = mat2(m);
+ tint_symbol.inner = mat2(m);
}
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ f();
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x2/load/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x2/load/f32.wgsl.expected.msl
index 091d06a..279fbdb 100644
--- a/test/tint/expressions/type_ctor/mat2x2/load/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat2x2/load/f32.wgsl.expected.msl
@@ -1,8 +1,9 @@
#include <metal_stdlib>
using namespace metal;
-void f() {
+kernel void f(device float2x2* tint_symbol [[buffer(0)]]) {
float2x2 m = float2x2(float2(0.0f), float2(0.0f));
- float2x2 const m_1 = float2x2(m);
+ *(tint_symbol) = float2x2(m);
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat2x2/load/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x2/load/f32.wgsl.expected.spvasm
index 853903c..14c9254 100644
--- a/test/tint/expressions/type_ctor/mat2x2/load/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat2x2/load/f32.wgsl.expected.spvasm
@@ -1,30 +1,42 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 15
+; Bound: 20
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
- OpName %unused_entry_point "unused_entry_point"
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
OpName %f "f"
OpName %m "m"
- %void = OpTypeVoid
- %1 = OpTypeFunction %void
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%mat2v2float = OpTypeMatrix %v2float 2
- %10 = OpConstantNull %mat2v2float
+ %out_block = OpTypeStruct %mat2v2float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void
+ %11 = OpConstantNull %mat2v2float
%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float
-%unused_entry_point = OpFunction %void None %1
- %4 = OpLabel
- OpReturn
- OpFunctionEnd
- %f = OpFunction %void None %1
- %6 = OpLabel
- %m = OpVariable %_ptr_Function_mat2v2float Function %10
- OpStore %m %10
- %14 = OpLoad %mat2v2float %m
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat2v2float = OpTypePointer StorageBuffer %mat2v2float
+ %f = OpFunction %void None %7
+ %10 = OpLabel
+ %m = OpVariable %_ptr_Function_mat2v2float Function %11
+ OpStore %m %11
+ %17 = OpAccessChain %_ptr_StorageBuffer_mat2v2float %out %uint_0
+ %19 = OpLoad %mat2v2float %m
+ OpStore %17 %19
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat2x2/load/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x2/load/f32.wgsl.expected.wgsl
index a7b8f43..02615d7 100644
--- a/test/tint/expressions/type_ctor/mat2x2/load/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x2/load/f32.wgsl.expected.wgsl
@@ -1,4 +1,7 @@
+@group(0) @binding(0) var<storage, read_write> out : mat2x2<f32>;
+
+@compute @workgroup_size(1)
fn f() {
var m = mat2x2<f32>();
- let m_1 = mat2x2(m);
+ out = mat2x2(m);
}
diff --git a/test/tint/expressions/type_ctor/mat2x2/zero/f16.wgsl b/test/tint/expressions/type_ctor/mat2x2/zero/f16.wgsl
index 7f54a51..e8afb71 100644
--- a/test/tint/expressions/type_ctor/mat2x2/zero/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x2/zero/f16.wgsl
@@ -1,2 +1,10 @@
enable f16;
var<private> m = mat2x2<f16>();
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat2x2<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x2/zero/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/zero/f16.wgsl.expected.dxc.hlsl
index ce399c0..8c65415 100644
--- a/test/tint/expressions/type_ctor/mat2x2/zero/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x2/zero/f16.wgsl.expected.dxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 2, 2> m = matrix<float16_t, 2, 2>((float16_t(0.0h)).xx, (float16_t(0.0h)).xx);
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 2, 2> value) {
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 4u), value[1u]);
}
-static matrix<float16_t, 2, 2> m = matrix<float16_t, 2, 2>((float16_t(0.0h)).xx, (float16_t(0.0h)).xx);
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x2/zero/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x2/zero/f16.wgsl.expected.glsl
index be0493d..f4991d0 100644
--- a/test/tint/expressions/type_ctor/mat2x2/zero/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat2x2/zero/f16.wgsl.expected.glsl
@@ -1,8 +1,17 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
+f16mat2 m = f16mat2(f16vec2(0.0hf), f16vec2(0.0hf));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat2 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-f16mat2 m = f16mat2(f16vec2(0.0hf), f16vec2(0.0hf));
diff --git a/test/tint/expressions/type_ctor/mat2x2/zero/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x2/zero/f16.wgsl.expected.msl
index 37b7060..388e607 100644
--- a/test/tint/expressions/type_ctor/mat2x2/zero/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat2x2/zero/f16.wgsl.expected.msl
@@ -5,3 +5,10 @@
half2x2 m;
};
+kernel void f(device half2x2* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half2x2(half2(0.0h), half2(0.0h));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat2x2/zero/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x2/zero/f16.wgsl.expected.spvasm
index 094ad88..5182d15 100644
--- a/test/tint/expressions/type_ctor/mat2x2/zero/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat2x2/zero/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 11
+; Bound: 19
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,19 +9,37 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 4
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v2half = OpTypeVector %half 2
%mat2v2half = OpTypeMatrix %v2half 2
%4 = OpConstantNull %mat2v2half
%_ptr_Private_mat2v2half = OpTypePointer Private %mat2v2half
%m = OpVariable %_ptr_Private_mat2v2half Private %4
+ %out_block = OpTypeStruct %mat2v2half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %7 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %7
- %10 = OpLabel
+ %10 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat2v2half = OpTypePointer StorageBuffer %mat2v2half
+ %f = OpFunction %void None %10
+ %13 = OpLabel
+ %17 = OpAccessChain %_ptr_StorageBuffer_mat2v2half %out %uint_0
+ %18 = OpLoad %mat2v2half %m
+ OpStore %17 %18
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat2x2/zero/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x2/zero/f16.wgsl.expected.wgsl
index efb9304..e0ddfc6 100644
--- a/test/tint/expressions/type_ctor/mat2x2/zero/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x2/zero/f16.wgsl.expected.wgsl
@@ -1,3 +1,10 @@
enable f16;
var<private> m = mat2x2<f16>();
+
+@group(0) @binding(0) var<storage, read_write> out : mat2x2<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x2/zero/f32.wgsl b/test/tint/expressions/type_ctor/mat2x2/zero/f32.wgsl
index 8f77ea2..625d48d 100644
--- a/test/tint/expressions/type_ctor/mat2x2/zero/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x2/zero/f32.wgsl
@@ -1 +1,9 @@
var<private> m = mat2x2<f32>();
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat2x2<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x2/zero/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/zero/f32.wgsl.expected.dxc.hlsl
index 1140175..acc6c1a 100644
--- a/test/tint/expressions/type_ctor/mat2x2/zero/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x2/zero/f32.wgsl.expected.dxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float2x2 m = float2x2((0.0f).xx, (0.0f).xx);
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
}
-static float2x2 m = float2x2((0.0f).xx, (0.0f).xx);
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x2/zero/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/zero/f32.wgsl.expected.fxc.hlsl
index 1140175..acc6c1a 100644
--- a/test/tint/expressions/type_ctor/mat2x2/zero/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x2/zero/f32.wgsl.expected.fxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float2x2 m = float2x2((0.0f).xx, (0.0f).xx);
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
}
-static float2x2 m = float2x2((0.0f).xx, (0.0f).xx);
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x2/zero/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x2/zero/f32.wgsl.expected.glsl
index bd82c13..4b3f35e 100644
--- a/test/tint/expressions/type_ctor/mat2x2/zero/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat2x2/zero/f32.wgsl.expected.glsl
@@ -1,7 +1,16 @@
#version 310 es
+mat2 m = mat2(vec2(0.0f), vec2(0.0f));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat2 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat2 m = mat2(vec2(0.0f), vec2(0.0f));
diff --git a/test/tint/expressions/type_ctor/mat2x2/zero/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x2/zero/f32.wgsl.expected.msl
index c97a144..88ae995 100644
--- a/test/tint/expressions/type_ctor/mat2x2/zero/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat2x2/zero/f32.wgsl.expected.msl
@@ -5,3 +5,10 @@
float2x2 m;
};
+kernel void f(device float2x2* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float2x2(float2(0.0f), float2(0.0f));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat2x2/zero/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x2/zero/f32.wgsl.expected.spvasm
index cd2602a..6f63ae2 100644
--- a/test/tint/expressions/type_ctor/mat2x2/zero/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat2x2/zero/f32.wgsl.expected.spvasm
@@ -1,23 +1,41 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 11
+; Bound: 19
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%mat2v2float = OpTypeMatrix %v2float 2
%4 = OpConstantNull %mat2v2float
%_ptr_Private_mat2v2float = OpTypePointer Private %mat2v2float
%m = OpVariable %_ptr_Private_mat2v2float Private %4
+ %out_block = OpTypeStruct %mat2v2float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %7 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %7
- %10 = OpLabel
+ %10 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat2v2float = OpTypePointer StorageBuffer %mat2v2float
+ %f = OpFunction %void None %10
+ %13 = OpLabel
+ %17 = OpAccessChain %_ptr_StorageBuffer_mat2v2float %out %uint_0
+ %18 = OpLoad %mat2v2float %m
+ OpStore %17 %18
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat2x2/zero/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x2/zero/f32.wgsl.expected.wgsl
index 8f77ea2..3e61d78 100644
--- a/test/tint/expressions/type_ctor/mat2x2/zero/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x2/zero/f32.wgsl.expected.wgsl
@@ -1 +1,8 @@
var<private> m = mat2x2<f32>();
+
+@group(0) @binding(0) var<storage, read_write> out : mat2x2<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f16.wgsl b/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f16.wgsl
index f1e6ea4..2af11292 100644
--- a/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f16.wgsl
@@ -1,8 +1,11 @@
enable f16;
-var<private> m = mat2x3(mat2x3<f16>(0.0h, 1.0h, 2.0h,
- 3.0h, 4.0h, 5.0h));
+var<private> m = mat2x3<f16>(mat2x3<f16>(0.0h, 1.0h, 2.0h,
+ 3.0h, 4.0h, 5.0h));
-fn f() -> mat2x3<f16> {
- let m_1 = mat2x3(m);
- return m_1;
+@group(0) @binding(0)
+var<storage, read_write> out : mat2x3<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat2x3<f16>(m);
}
diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f16.wgsl.expected.dxc.hlsl
index 18ec1c6..ebd6934 100644
--- a/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f16.wgsl.expected.dxc.hlsl
@@ -1,11 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 2, 3> m = matrix<float16_t, 2, 3>(vector<float16_t, 3>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector<float16_t, 3>(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 2, 3> value) {
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 8u), value[1u]);
}
-static matrix<float16_t, 2, 3> m = matrix<float16_t, 2, 3>(vector<float16_t, 3>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector<float16_t, 3>(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)));
-
-matrix<float16_t, 2, 3> f() {
- const matrix<float16_t, 2, 3> m_1 = matrix<float16_t, 2, 3>(m);
- return m_1;
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, matrix<float16_t, 2, 3>(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f16.wgsl.expected.glsl
index 03af346..054395e 100644
--- a/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f16.wgsl.expected.glsl
@@ -1,13 +1,22 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
- return;
-}
f16mat2x3 m = f16mat2x3(f16vec3(0.0hf, 1.0hf, 2.0hf), f16vec3(3.0hf, 4.0hf, 5.0hf));
-f16mat2x3 f() {
- f16mat2x3 m_1 = f16mat2x3(m);
- return m_1;
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat2x3 inner;
+} tint_symbol;
+
+void assign_and_preserve_padding_tint_symbol(f16mat2x3 value) {
+ tint_symbol.inner[0] = value[0u];
+ tint_symbol.inner[1] = value[1u];
}
+void f() {
+ assign_and_preserve_padding_tint_symbol(f16mat2x3(m));
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ f();
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f16.wgsl.expected.msl
index afa405d..7117011 100644
--- a/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f16.wgsl.expected.msl
@@ -1,12 +1,37 @@
#include <metal_stdlib>
using namespace metal;
+
+template<typename T, size_t N>
+struct tint_array {
+ const constant T& operator[](size_t i) const constant { return elements[i]; }
+ device T& operator[](size_t i) device { return elements[i]; }
+ const device T& operator[](size_t i) const device { return elements[i]; }
+ thread T& operator[](size_t i) thread { return elements[i]; }
+ const thread T& operator[](size_t i) const thread { return elements[i]; }
+ threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+ const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+ T elements[N];
+};
+
struct tint_private_vars_struct {
half2x3 m;
};
-half2x3 f(thread tint_private_vars_struct* const tint_private_vars) {
- half2x3 const m_1 = half2x3((*(tint_private_vars)).m);
- return m_1;
+struct tint_packed_vec3_f16_array_element {
+ /* 0x0000 */ packed_half3 elements;
+ /* 0x0006 */ tint_array<int8_t, 2> tint_pad;
+};
+
+void assign_and_preserve_padding(device tint_array<tint_packed_vec3_f16_array_element, 2>* const dest, half2x3 value) {
+ (*(dest))[0u].elements = packed_half3(value[0u]);
+ (*(dest))[1u].elements = packed_half3(value[1u]);
+}
+
+kernel void f(device tint_array<tint_packed_vec3_f16_array_element, 2>* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half2x3(half3(0.0h, 1.0h, 2.0h), half3(3.0h, 4.0h, 5.0h));
+ assign_and_preserve_padding(tint_symbol, half2x3(tint_private_vars.m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f16.wgsl.expected.spvasm
index 13b1d5c..e051d38 100644
--- a/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 24
+; Bound: 41
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,11 +9,21 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %assign_and_preserve_padding_out "assign_and_preserve_padding_out"
+ OpName %value "value"
OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v3half = OpTypeVector %half 3
%mat2v3half = OpTypeMatrix %v3half 2
@@ -28,15 +38,34 @@
%12 = OpConstantComposite %mat2v3half %7 %11
%_ptr_Private_mat2v3half = OpTypePointer Private %mat2v3half
%m = OpVariable %_ptr_Private_mat2v3half Private %12
+ %out_block = OpTypeStruct %mat2v3half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %15 = OpTypeFunction %void
- %19 = OpTypeFunction %mat2v3half
-%unused_entry_point = OpFunction %void None %15
- %18 = OpLabel
+ %18 = OpTypeFunction %void %mat2v3half
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %26 = OpConstantNull %int
+%_ptr_StorageBuffer_v3half = OpTypePointer StorageBuffer %v3half
+ %29 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+ %35 = OpTypeFunction %void
+%assign_and_preserve_padding_out = OpFunction %void None %18
+ %value = OpFunctionParameter %mat2v3half
+ %22 = OpLabel
+ %28 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %26
+ %30 = OpCompositeExtract %v3half %value 0
+ OpStore %28 %30
+ %32 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %int_1
+ %34 = OpCompositeExtract %v3half %value 1
+ OpStore %32 %34
OpReturn
OpFunctionEnd
- %f = OpFunction %mat2v3half None %19
- %21 = OpLabel
- %23 = OpLoad %mat2v3half %m
- OpReturnValue %23
+ %f = OpFunction %void None %35
+ %37 = OpLabel
+ %40 = OpLoad %mat2v3half %m
+ %38 = OpFunctionCall %void %assign_and_preserve_padding_out %40
+ OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f16.wgsl.expected.wgsl
index f147705..36663ce 100644
--- a/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f16.wgsl.expected.wgsl
@@ -1,8 +1,10 @@
enable f16;
-var<private> m = mat2x3(mat2x3<f16>(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h));
+var<private> m = mat2x3<f16>(mat2x3<f16>(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h));
-fn f() -> mat2x3<f16> {
- let m_1 = mat2x3(m);
- return m_1;
+@group(0) @binding(0) var<storage, read_write> out : mat2x3<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat2x3<f16>(m);
}
diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f32.wgsl b/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f32.wgsl
index 2c63c91..e8933f8 100644
--- a/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f32.wgsl
@@ -1,7 +1,10 @@
-var<private> m = mat2x3(mat2x3<f32>(0.0f, 1.0f, 2.0f,
- 3.0f, 4.0f, 5.0f));
+var<private> m = mat2x3<f32>(mat2x3<f32>(0.0f, 1.0f, 2.0f,
+ 3.0f, 4.0f, 5.0f));
-fn f() -> mat2x3<f32> {
- let m_1 = mat2x3(m);
- return m_1;
+@group(0) @binding(0)
+var<storage, read_write> out : mat2x3<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat2x3<f32>(m);
}
diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f32.wgsl.expected.dxc.hlsl
index 4fee374..1138783 100644
--- a/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f32.wgsl.expected.dxc.hlsl
@@ -1,11 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float2x3 m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
}
-static float2x3 m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f));
-
-float2x3 f() {
- const float2x3 m_1 = float2x3(m);
- return m_1;
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float2x3(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f32.wgsl.expected.fxc.hlsl
index 4fee374..1138783 100644
--- a/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f32.wgsl.expected.fxc.hlsl
@@ -1,11 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float2x3 m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
}
-static float2x3 m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f));
-
-float2x3 f() {
- const float2x3 m_1 = float2x3(m);
- return m_1;
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float2x3(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f32.wgsl.expected.glsl
index 03da8f6..caf61e7 100644
--- a/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f32.wgsl.expected.glsl
@@ -1,12 +1,21 @@
#version 310 es
-layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
- return;
-}
mat2x3 m = mat2x3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f));
-mat2x3 f() {
- mat2x3 m_1 = mat2x3(m);
- return m_1;
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat2x3 inner;
+} tint_symbol;
+
+void assign_and_preserve_padding_tint_symbol(mat2x3 value) {
+ tint_symbol.inner[0] = value[0u];
+ tint_symbol.inner[1] = value[1u];
}
+void f() {
+ assign_and_preserve_padding_tint_symbol(mat2x3(m));
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ f();
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f32.wgsl.expected.msl
index 0c95534..7550291 100644
--- a/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f32.wgsl.expected.msl
@@ -1,12 +1,37 @@
#include <metal_stdlib>
using namespace metal;
+
+template<typename T, size_t N>
+struct tint_array {
+ const constant T& operator[](size_t i) const constant { return elements[i]; }
+ device T& operator[](size_t i) device { return elements[i]; }
+ const device T& operator[](size_t i) const device { return elements[i]; }
+ thread T& operator[](size_t i) thread { return elements[i]; }
+ const thread T& operator[](size_t i) const thread { return elements[i]; }
+ threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+ const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+ T elements[N];
+};
+
struct tint_private_vars_struct {
float2x3 m;
};
-float2x3 f(thread tint_private_vars_struct* const tint_private_vars) {
- float2x3 const m_1 = float2x3((*(tint_private_vars)).m);
- return m_1;
+struct tint_packed_vec3_f32_array_element {
+ /* 0x0000 */ packed_float3 elements;
+ /* 0x000c */ tint_array<int8_t, 4> tint_pad;
+};
+
+void assign_and_preserve_padding(device tint_array<tint_packed_vec3_f32_array_element, 2>* const dest, float2x3 value) {
+ (*(dest))[0u].elements = packed_float3(value[0u]);
+ (*(dest))[1u].elements = packed_float3(value[1u]);
+}
+
+kernel void f(device tint_array<tint_packed_vec3_f32_array_element, 2>* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f));
+ assign_and_preserve_padding(tint_symbol, float2x3(tint_private_vars.m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f32.wgsl.expected.spvasm
index 8c235ee..5b24b01 100644
--- a/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f32.wgsl.expected.spvasm
@@ -1,15 +1,25 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 24
+; Bound: 41
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %assign_and_preserve_padding_out "assign_and_preserve_padding_out"
+ OpName %value "value"
OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%mat2v3float = OpTypeMatrix %v3float 2
@@ -24,15 +34,34 @@
%12 = OpConstantComposite %mat2v3float %7 %11
%_ptr_Private_mat2v3float = OpTypePointer Private %mat2v3float
%m = OpVariable %_ptr_Private_mat2v3float Private %12
+ %out_block = OpTypeStruct %mat2v3float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %15 = OpTypeFunction %void
- %19 = OpTypeFunction %mat2v3float
-%unused_entry_point = OpFunction %void None %15
- %18 = OpLabel
+ %18 = OpTypeFunction %void %mat2v3float
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %26 = OpConstantNull %int
+%_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float
+ %29 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+ %35 = OpTypeFunction %void
+%assign_and_preserve_padding_out = OpFunction %void None %18
+ %value = OpFunctionParameter %mat2v3float
+ %22 = OpLabel
+ %28 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %26
+ %30 = OpCompositeExtract %v3float %value 0
+ OpStore %28 %30
+ %32 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_1
+ %34 = OpCompositeExtract %v3float %value 1
+ OpStore %32 %34
OpReturn
OpFunctionEnd
- %f = OpFunction %mat2v3float None %19
- %21 = OpLabel
- %23 = OpLoad %mat2v3float %m
- OpReturnValue %23
+ %f = OpFunction %void None %35
+ %37 = OpLabel
+ %40 = OpLoad %mat2v3float %m
+ %38 = OpFunctionCall %void %assign_and_preserve_padding_out %40
+ OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f32.wgsl.expected.wgsl
index e934f83..7a3e5a9 100644
--- a/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f32.wgsl.expected.wgsl
@@ -1,6 +1,8 @@
-var<private> m = mat2x3(mat2x3<f32>(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f));
+var<private> m = mat2x3<f32>(mat2x3<f32>(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f));
-fn f() -> mat2x3<f32> {
- let m_1 = mat2x3(m);
- return m_1;
+@group(0) @binding(0) var<storage, read_write> out : mat2x3<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat2x3<f32>(m);
}
diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f16.wgsl b/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f16.wgsl
index 0faefd9..bbb4ccf 100644
--- a/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f16.wgsl
@@ -1,3 +1,11 @@
enable f16;
var<private> m = mat2x3<f16>(0.0h, 1.0h, 2.0h,
3.0h, 4.0h, 5.0h);
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat2x3<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f16.wgsl.expected.dxc.hlsl
index aafd9d1..c4c6949 100644
--- a/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f16.wgsl.expected.dxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 2, 3> m = matrix<float16_t, 2, 3>(vector<float16_t, 3>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector<float16_t, 3>(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 2, 3> value) {
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 8u), value[1u]);
}
-static matrix<float16_t, 2, 3> m = matrix<float16_t, 2, 3>(vector<float16_t, 3>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector<float16_t, 3>(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f16.wgsl.expected.glsl
index 9986763..2f56f24 100644
--- a/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f16.wgsl.expected.glsl
@@ -1,8 +1,22 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
+f16mat2x3 m = f16mat2x3(f16vec3(0.0hf, 1.0hf, 2.0hf), f16vec3(3.0hf, 4.0hf, 5.0hf));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat2x3 inner;
+} tint_symbol;
+
+void assign_and_preserve_padding_tint_symbol(f16mat2x3 value) {
+ tint_symbol.inner[0] = value[0u];
+ tint_symbol.inner[1] = value[1u];
+}
+
+void f() {
+ assign_and_preserve_padding_tint_symbol(m);
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-f16mat2x3 m = f16mat2x3(f16vec3(0.0hf, 1.0hf, 2.0hf), f16vec3(3.0hf, 4.0hf, 5.0hf));
diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f16.wgsl.expected.msl
index 12a2c58..d79f27f 100644
--- a/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f16.wgsl.expected.msl
@@ -1,7 +1,37 @@
#include <metal_stdlib>
using namespace metal;
+
+template<typename T, size_t N>
+struct tint_array {
+ const constant T& operator[](size_t i) const constant { return elements[i]; }
+ device T& operator[](size_t i) device { return elements[i]; }
+ const device T& operator[](size_t i) const device { return elements[i]; }
+ thread T& operator[](size_t i) thread { return elements[i]; }
+ const thread T& operator[](size_t i) const thread { return elements[i]; }
+ threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+ const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+ T elements[N];
+};
+
struct tint_private_vars_struct {
half2x3 m;
};
+struct tint_packed_vec3_f16_array_element {
+ /* 0x0000 */ packed_half3 elements;
+ /* 0x0006 */ tint_array<int8_t, 2> tint_pad;
+};
+
+void assign_and_preserve_padding(device tint_array<tint_packed_vec3_f16_array_element, 2>* const dest, half2x3 value) {
+ (*(dest))[0u].elements = packed_half3(value[0u]);
+ (*(dest))[1u].elements = packed_half3(value[1u]);
+}
+
+kernel void f(device tint_array<tint_packed_vec3_f16_array_element, 2>* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half2x3(half3(0.0h, 1.0h, 2.0h), half3(3.0h, 4.0h, 5.0h));
+ assign_and_preserve_padding(tint_symbol, tint_private_vars.m);
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f16.wgsl.expected.spvasm
index b54bc34..dcc7672 100644
--- a/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 19
+; Bound: 40
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,10 +9,21 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %assign_and_preserve_padding_out "assign_and_preserve_padding_out"
+ OpName %value "value"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v3half = OpTypeVector %half 3
%mat2v3half = OpTypeMatrix %v3half 2
@@ -27,9 +38,34 @@
%12 = OpConstantComposite %mat2v3half %7 %11
%_ptr_Private_mat2v3half = OpTypePointer Private %mat2v3half
%m = OpVariable %_ptr_Private_mat2v3half Private %12
+ %out_block = OpTypeStruct %mat2v3half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %15 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %15
- %18 = OpLabel
+ %18 = OpTypeFunction %void %mat2v3half
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %26 = OpConstantNull %int
+%_ptr_StorageBuffer_v3half = OpTypePointer StorageBuffer %v3half
+ %29 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+ %35 = OpTypeFunction %void
+%assign_and_preserve_padding_out = OpFunction %void None %18
+ %value = OpFunctionParameter %mat2v3half
+ %22 = OpLabel
+ %28 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %26
+ %30 = OpCompositeExtract %v3half %value 0
+ OpStore %28 %30
+ %32 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %int_1
+ %34 = OpCompositeExtract %v3half %value 1
+ OpStore %32 %34
+ OpReturn
+ OpFunctionEnd
+ %f = OpFunction %void None %35
+ %37 = OpLabel
+ %39 = OpLoad %mat2v3half %m
+ %38 = OpFunctionCall %void %assign_and_preserve_padding_out %39
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f16.wgsl.expected.wgsl
index 41b5bcc..7f1b380 100644
--- a/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f16.wgsl.expected.wgsl
@@ -1,3 +1,10 @@
enable f16;
var<private> m = mat2x3<f16>(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h);
+
+@group(0) @binding(0) var<storage, read_write> out : mat2x3<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl b/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl
index eb4e496..a320ed5 100644
--- a/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl
@@ -1,2 +1,10 @@
var<private> m = mat2x3<f32>(0.0f, 1.0f, 2.0f,
3.0f, 4.0f, 5.0f);
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat2x3<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl.expected.dxc.hlsl
index c2d1be7..9a79741 100644
--- a/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl.expected.dxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float2x3 m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
}
-static float2x3 m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl.expected.fxc.hlsl
index c2d1be7..9a79741 100644
--- a/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl.expected.fxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float2x3 m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
}
-static float2x3 m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl.expected.glsl
index 275e22b..374b761 100644
--- a/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl.expected.glsl
@@ -1,7 +1,21 @@
#version 310 es
+mat2x3 m = mat2x3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat2x3 inner;
+} tint_symbol;
+
+void assign_and_preserve_padding_tint_symbol(mat2x3 value) {
+ tint_symbol.inner[0] = value[0u];
+ tint_symbol.inner[1] = value[1u];
+}
+
+void f() {
+ assign_and_preserve_padding_tint_symbol(m);
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat2x3 m = mat2x3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f));
diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl.expected.msl
index f0ad3c1..cf56e26 100644
--- a/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl.expected.msl
@@ -1,7 +1,37 @@
#include <metal_stdlib>
using namespace metal;
+
+template<typename T, size_t N>
+struct tint_array {
+ const constant T& operator[](size_t i) const constant { return elements[i]; }
+ device T& operator[](size_t i) device { return elements[i]; }
+ const device T& operator[](size_t i) const device { return elements[i]; }
+ thread T& operator[](size_t i) thread { return elements[i]; }
+ const thread T& operator[](size_t i) const thread { return elements[i]; }
+ threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+ const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+ T elements[N];
+};
+
struct tint_private_vars_struct {
float2x3 m;
};
+struct tint_packed_vec3_f32_array_element {
+ /* 0x0000 */ packed_float3 elements;
+ /* 0x000c */ tint_array<int8_t, 4> tint_pad;
+};
+
+void assign_and_preserve_padding(device tint_array<tint_packed_vec3_f32_array_element, 2>* const dest, float2x3 value) {
+ (*(dest))[0u].elements = packed_float3(value[0u]);
+ (*(dest))[1u].elements = packed_float3(value[1u]);
+}
+
+kernel void f(device tint_array<tint_packed_vec3_f32_array_element, 2>* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f));
+ assign_and_preserve_padding(tint_symbol, tint_private_vars.m);
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl.expected.spvasm
index 578716d..5f90c61 100644
--- a/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl.expected.spvasm
@@ -1,14 +1,25 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 19
+; Bound: 40
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %assign_and_preserve_padding_out "assign_and_preserve_padding_out"
+ OpName %value "value"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%mat2v3float = OpTypeMatrix %v3float 2
@@ -23,9 +34,34 @@
%12 = OpConstantComposite %mat2v3float %7 %11
%_ptr_Private_mat2v3float = OpTypePointer Private %mat2v3float
%m = OpVariable %_ptr_Private_mat2v3float Private %12
+ %out_block = OpTypeStruct %mat2v3float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %15 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %15
- %18 = OpLabel
+ %18 = OpTypeFunction %void %mat2v3float
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %26 = OpConstantNull %int
+%_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float
+ %29 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+ %35 = OpTypeFunction %void
+%assign_and_preserve_padding_out = OpFunction %void None %18
+ %value = OpFunctionParameter %mat2v3float
+ %22 = OpLabel
+ %28 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %26
+ %30 = OpCompositeExtract %v3float %value 0
+ OpStore %28 %30
+ %32 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_1
+ %34 = OpCompositeExtract %v3float %value 1
+ OpStore %32 %34
+ OpReturn
+ OpFunctionEnd
+ %f = OpFunction %void None %35
+ %37 = OpLabel
+ %39 = OpLoad %mat2v3float %m
+ %38 = OpFunctionCall %void %assign_and_preserve_padding_out %39
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl.expected.wgsl
index a886d09..b29199a 100644
--- a/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl.expected.wgsl
@@ -1 +1,8 @@
var<private> m = mat2x3<f32>(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f);
+
+@group(0) @binding(0) var<storage, read_write> out : mat2x3<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f16.wgsl b/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f16.wgsl
index 969a034..6d41946 100644
--- a/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f16.wgsl
@@ -1,3 +1,11 @@
enable f16;
var<private> m = mat2x3<f16>(vec3<f16>(0.0h, 1.0h, 2.0h),
vec3<f16>(3.0h, 4.0h, 5.0h));
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat2x3<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f16.wgsl.expected.dxc.hlsl
index aafd9d1..c4c6949 100644
--- a/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f16.wgsl.expected.dxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 2, 3> m = matrix<float16_t, 2, 3>(vector<float16_t, 3>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector<float16_t, 3>(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 2, 3> value) {
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 8u), value[1u]);
}
-static matrix<float16_t, 2, 3> m = matrix<float16_t, 2, 3>(vector<float16_t, 3>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector<float16_t, 3>(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f16.wgsl.expected.glsl
index 9986763..2f56f24 100644
--- a/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f16.wgsl.expected.glsl
@@ -1,8 +1,22 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
+f16mat2x3 m = f16mat2x3(f16vec3(0.0hf, 1.0hf, 2.0hf), f16vec3(3.0hf, 4.0hf, 5.0hf));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat2x3 inner;
+} tint_symbol;
+
+void assign_and_preserve_padding_tint_symbol(f16mat2x3 value) {
+ tint_symbol.inner[0] = value[0u];
+ tint_symbol.inner[1] = value[1u];
+}
+
+void f() {
+ assign_and_preserve_padding_tint_symbol(m);
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-f16mat2x3 m = f16mat2x3(f16vec3(0.0hf, 1.0hf, 2.0hf), f16vec3(3.0hf, 4.0hf, 5.0hf));
diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f16.wgsl.expected.msl
index 12a2c58..d79f27f 100644
--- a/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f16.wgsl.expected.msl
@@ -1,7 +1,37 @@
#include <metal_stdlib>
using namespace metal;
+
+template<typename T, size_t N>
+struct tint_array {
+ const constant T& operator[](size_t i) const constant { return elements[i]; }
+ device T& operator[](size_t i) device { return elements[i]; }
+ const device T& operator[](size_t i) const device { return elements[i]; }
+ thread T& operator[](size_t i) thread { return elements[i]; }
+ const thread T& operator[](size_t i) const thread { return elements[i]; }
+ threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+ const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+ T elements[N];
+};
+
struct tint_private_vars_struct {
half2x3 m;
};
+struct tint_packed_vec3_f16_array_element {
+ /* 0x0000 */ packed_half3 elements;
+ /* 0x0006 */ tint_array<int8_t, 2> tint_pad;
+};
+
+void assign_and_preserve_padding(device tint_array<tint_packed_vec3_f16_array_element, 2>* const dest, half2x3 value) {
+ (*(dest))[0u].elements = packed_half3(value[0u]);
+ (*(dest))[1u].elements = packed_half3(value[1u]);
+}
+
+kernel void f(device tint_array<tint_packed_vec3_f16_array_element, 2>* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half2x3(half3(0.0h, 1.0h, 2.0h), half3(3.0h, 4.0h, 5.0h));
+ assign_and_preserve_padding(tint_symbol, tint_private_vars.m);
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f16.wgsl.expected.spvasm
index b54bc34..dcc7672 100644
--- a/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 19
+; Bound: 40
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,10 +9,21 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %assign_and_preserve_padding_out "assign_and_preserve_padding_out"
+ OpName %value "value"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v3half = OpTypeVector %half 3
%mat2v3half = OpTypeMatrix %v3half 2
@@ -27,9 +38,34 @@
%12 = OpConstantComposite %mat2v3half %7 %11
%_ptr_Private_mat2v3half = OpTypePointer Private %mat2v3half
%m = OpVariable %_ptr_Private_mat2v3half Private %12
+ %out_block = OpTypeStruct %mat2v3half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %15 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %15
- %18 = OpLabel
+ %18 = OpTypeFunction %void %mat2v3half
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %26 = OpConstantNull %int
+%_ptr_StorageBuffer_v3half = OpTypePointer StorageBuffer %v3half
+ %29 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+ %35 = OpTypeFunction %void
+%assign_and_preserve_padding_out = OpFunction %void None %18
+ %value = OpFunctionParameter %mat2v3half
+ %22 = OpLabel
+ %28 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %26
+ %30 = OpCompositeExtract %v3half %value 0
+ OpStore %28 %30
+ %32 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %int_1
+ %34 = OpCompositeExtract %v3half %value 1
+ OpStore %32 %34
+ OpReturn
+ OpFunctionEnd
+ %f = OpFunction %void None %35
+ %37 = OpLabel
+ %39 = OpLoad %mat2v3half %m
+ %38 = OpFunctionCall %void %assign_and_preserve_padding_out %39
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f16.wgsl.expected.wgsl
index ef31178..b2bc7c0 100644
--- a/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f16.wgsl.expected.wgsl
@@ -1,3 +1,10 @@
enable f16;
var<private> m = mat2x3<f16>(vec3<f16>(0.0h, 1.0h, 2.0h), vec3<f16>(3.0h, 4.0h, 5.0h));
+
+@group(0) @binding(0) var<storage, read_write> out : mat2x3<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl b/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl
index 2439d6d..65f636c 100644
--- a/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl
@@ -1,2 +1,10 @@
var<private> m = mat2x3<f32>(vec3<f32>(0.0f, 1.0f, 2.0f),
vec3<f32>(3.0f, 4.0f, 5.0f));
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat2x3<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.dxc.hlsl
index c2d1be7..9a79741 100644
--- a/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.dxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float2x3 m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
}
-static float2x3 m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.fxc.hlsl
index c2d1be7..9a79741 100644
--- a/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.fxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float2x3 m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
}
-static float2x3 m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.glsl
index 275e22b..374b761 100644
--- a/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.glsl
@@ -1,7 +1,21 @@
#version 310 es
+mat2x3 m = mat2x3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat2x3 inner;
+} tint_symbol;
+
+void assign_and_preserve_padding_tint_symbol(mat2x3 value) {
+ tint_symbol.inner[0] = value[0u];
+ tint_symbol.inner[1] = value[1u];
+}
+
+void f() {
+ assign_and_preserve_padding_tint_symbol(m);
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat2x3 m = mat2x3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f));
diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.msl
index f0ad3c1..cf56e26 100644
--- a/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.msl
@@ -1,7 +1,37 @@
#include <metal_stdlib>
using namespace metal;
+
+template<typename T, size_t N>
+struct tint_array {
+ const constant T& operator[](size_t i) const constant { return elements[i]; }
+ device T& operator[](size_t i) device { return elements[i]; }
+ const device T& operator[](size_t i) const device { return elements[i]; }
+ thread T& operator[](size_t i) thread { return elements[i]; }
+ const thread T& operator[](size_t i) const thread { return elements[i]; }
+ threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+ const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+ T elements[N];
+};
+
struct tint_private_vars_struct {
float2x3 m;
};
+struct tint_packed_vec3_f32_array_element {
+ /* 0x0000 */ packed_float3 elements;
+ /* 0x000c */ tint_array<int8_t, 4> tint_pad;
+};
+
+void assign_and_preserve_padding(device tint_array<tint_packed_vec3_f32_array_element, 2>* const dest, float2x3 value) {
+ (*(dest))[0u].elements = packed_float3(value[0u]);
+ (*(dest))[1u].elements = packed_float3(value[1u]);
+}
+
+kernel void f(device tint_array<tint_packed_vec3_f32_array_element, 2>* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f));
+ assign_and_preserve_padding(tint_symbol, tint_private_vars.m);
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.spvasm
index 578716d..5f90c61 100644
--- a/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.spvasm
@@ -1,14 +1,25 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 19
+; Bound: 40
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %assign_and_preserve_padding_out "assign_and_preserve_padding_out"
+ OpName %value "value"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%mat2v3float = OpTypeMatrix %v3float 2
@@ -23,9 +34,34 @@
%12 = OpConstantComposite %mat2v3float %7 %11
%_ptr_Private_mat2v3float = OpTypePointer Private %mat2v3float
%m = OpVariable %_ptr_Private_mat2v3float Private %12
+ %out_block = OpTypeStruct %mat2v3float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %15 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %15
- %18 = OpLabel
+ %18 = OpTypeFunction %void %mat2v3float
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %26 = OpConstantNull %int
+%_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float
+ %29 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+ %35 = OpTypeFunction %void
+%assign_and_preserve_padding_out = OpFunction %void None %18
+ %value = OpFunctionParameter %mat2v3float
+ %22 = OpLabel
+ %28 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %26
+ %30 = OpCompositeExtract %v3float %value 0
+ OpStore %28 %30
+ %32 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_1
+ %34 = OpCompositeExtract %v3float %value 1
+ OpStore %32 %34
+ OpReturn
+ OpFunctionEnd
+ %f = OpFunction %void None %35
+ %37 = OpLabel
+ %39 = OpLoad %mat2v3float %m
+ %38 = OpFunctionCall %void %assign_and_preserve_padding_out %39
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.wgsl
index 79d55b3..0cefe20 100644
--- a/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.wgsl
@@ -1 +1,8 @@
var<private> m = mat2x3<f32>(vec3<f32>(0.0f, 1.0f, 2.0f), vec3<f32>(3.0f, 4.0f, 5.0f));
+
+@group(0) @binding(0) var<storage, read_write> out : mat2x3<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f16.wgsl b/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f16.wgsl
index 3f8ce32..bf0b65e 100644
--- a/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f16.wgsl
@@ -2,7 +2,10 @@
var<private> m = mat2x3(mat2x3(0.0h, 1.0h, 2.0h,
3.0h, 4.0h, 5.0h));
-fn f() -> mat2x3<f16> {
- let m_1 = mat2x3(m);
- return m_1;
+@group(0) @binding(0)
+var<storage, read_write> out : mat2x3<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat2x3(m);
}
diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f16.wgsl.expected.dxc.hlsl
index 18ec1c6..ebd6934 100644
--- a/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f16.wgsl.expected.dxc.hlsl
@@ -1,11 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 2, 3> m = matrix<float16_t, 2, 3>(vector<float16_t, 3>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector<float16_t, 3>(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 2, 3> value) {
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 8u), value[1u]);
}
-static matrix<float16_t, 2, 3> m = matrix<float16_t, 2, 3>(vector<float16_t, 3>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector<float16_t, 3>(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)));
-
-matrix<float16_t, 2, 3> f() {
- const matrix<float16_t, 2, 3> m_1 = matrix<float16_t, 2, 3>(m);
- return m_1;
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, matrix<float16_t, 2, 3>(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f16.wgsl.expected.glsl
index 03af346..054395e 100644
--- a/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f16.wgsl.expected.glsl
@@ -1,13 +1,22 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
- return;
-}
f16mat2x3 m = f16mat2x3(f16vec3(0.0hf, 1.0hf, 2.0hf), f16vec3(3.0hf, 4.0hf, 5.0hf));
-f16mat2x3 f() {
- f16mat2x3 m_1 = f16mat2x3(m);
- return m_1;
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat2x3 inner;
+} tint_symbol;
+
+void assign_and_preserve_padding_tint_symbol(f16mat2x3 value) {
+ tint_symbol.inner[0] = value[0u];
+ tint_symbol.inner[1] = value[1u];
}
+void f() {
+ assign_and_preserve_padding_tint_symbol(f16mat2x3(m));
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ f();
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f16.wgsl.expected.msl
index afa405d..7117011 100644
--- a/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f16.wgsl.expected.msl
@@ -1,12 +1,37 @@
#include <metal_stdlib>
using namespace metal;
+
+template<typename T, size_t N>
+struct tint_array {
+ const constant T& operator[](size_t i) const constant { return elements[i]; }
+ device T& operator[](size_t i) device { return elements[i]; }
+ const device T& operator[](size_t i) const device { return elements[i]; }
+ thread T& operator[](size_t i) thread { return elements[i]; }
+ const thread T& operator[](size_t i) const thread { return elements[i]; }
+ threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+ const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+ T elements[N];
+};
+
struct tint_private_vars_struct {
half2x3 m;
};
-half2x3 f(thread tint_private_vars_struct* const tint_private_vars) {
- half2x3 const m_1 = half2x3((*(tint_private_vars)).m);
- return m_1;
+struct tint_packed_vec3_f16_array_element {
+ /* 0x0000 */ packed_half3 elements;
+ /* 0x0006 */ tint_array<int8_t, 2> tint_pad;
+};
+
+void assign_and_preserve_padding(device tint_array<tint_packed_vec3_f16_array_element, 2>* const dest, half2x3 value) {
+ (*(dest))[0u].elements = packed_half3(value[0u]);
+ (*(dest))[1u].elements = packed_half3(value[1u]);
+}
+
+kernel void f(device tint_array<tint_packed_vec3_f16_array_element, 2>* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half2x3(half3(0.0h, 1.0h, 2.0h), half3(3.0h, 4.0h, 5.0h));
+ assign_and_preserve_padding(tint_symbol, half2x3(tint_private_vars.m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f16.wgsl.expected.spvasm
index 13b1d5c..e051d38 100644
--- a/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 24
+; Bound: 41
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,11 +9,21 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %assign_and_preserve_padding_out "assign_and_preserve_padding_out"
+ OpName %value "value"
OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v3half = OpTypeVector %half 3
%mat2v3half = OpTypeMatrix %v3half 2
@@ -28,15 +38,34 @@
%12 = OpConstantComposite %mat2v3half %7 %11
%_ptr_Private_mat2v3half = OpTypePointer Private %mat2v3half
%m = OpVariable %_ptr_Private_mat2v3half Private %12
+ %out_block = OpTypeStruct %mat2v3half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %15 = OpTypeFunction %void
- %19 = OpTypeFunction %mat2v3half
-%unused_entry_point = OpFunction %void None %15
- %18 = OpLabel
+ %18 = OpTypeFunction %void %mat2v3half
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %26 = OpConstantNull %int
+%_ptr_StorageBuffer_v3half = OpTypePointer StorageBuffer %v3half
+ %29 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+ %35 = OpTypeFunction %void
+%assign_and_preserve_padding_out = OpFunction %void None %18
+ %value = OpFunctionParameter %mat2v3half
+ %22 = OpLabel
+ %28 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %26
+ %30 = OpCompositeExtract %v3half %value 0
+ OpStore %28 %30
+ %32 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %int_1
+ %34 = OpCompositeExtract %v3half %value 1
+ OpStore %32 %34
OpReturn
OpFunctionEnd
- %f = OpFunction %mat2v3half None %19
- %21 = OpLabel
- %23 = OpLoad %mat2v3half %m
- OpReturnValue %23
+ %f = OpFunction %void None %35
+ %37 = OpLabel
+ %40 = OpLoad %mat2v3half %m
+ %38 = OpFunctionCall %void %assign_and_preserve_padding_out %40
+ OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f16.wgsl.expected.wgsl
index 7605c36..0709a0c 100644
--- a/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f16.wgsl.expected.wgsl
@@ -2,7 +2,9 @@
var<private> m = mat2x3(mat2x3(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h));
-fn f() -> mat2x3<f16> {
- let m_1 = mat2x3(m);
- return m_1;
+@group(0) @binding(0) var<storage, read_write> out : mat2x3<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat2x3(m);
}
diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f32.wgsl b/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f32.wgsl
index 6babe00..b5c1d75 100644
--- a/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f32.wgsl
@@ -1,7 +1,10 @@
var<private> m = mat2x3(mat2x3(0.0f, 1.0f, 2.0f,
3.0f, 4.0f, 5.0f));
-fn f() -> mat2x3<f32> {
- let m_1 = mat2x3(m);
- return m_1;
+@group(0) @binding(0)
+var<storage, read_write> out : mat2x3<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat2x3(m);
}
diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f32.wgsl.expected.dxc.hlsl
index 4fee374..1138783 100644
--- a/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f32.wgsl.expected.dxc.hlsl
@@ -1,11 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float2x3 m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
}
-static float2x3 m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f));
-
-float2x3 f() {
- const float2x3 m_1 = float2x3(m);
- return m_1;
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float2x3(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f32.wgsl.expected.fxc.hlsl
index 4fee374..1138783 100644
--- a/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f32.wgsl.expected.fxc.hlsl
@@ -1,11 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float2x3 m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
}
-static float2x3 m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f));
-
-float2x3 f() {
- const float2x3 m_1 = float2x3(m);
- return m_1;
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float2x3(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f32.wgsl.expected.glsl
index 03da8f6..caf61e7 100644
--- a/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f32.wgsl.expected.glsl
@@ -1,12 +1,21 @@
#version 310 es
-layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
- return;
-}
mat2x3 m = mat2x3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f));
-mat2x3 f() {
- mat2x3 m_1 = mat2x3(m);
- return m_1;
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat2x3 inner;
+} tint_symbol;
+
+void assign_and_preserve_padding_tint_symbol(mat2x3 value) {
+ tint_symbol.inner[0] = value[0u];
+ tint_symbol.inner[1] = value[1u];
}
+void f() {
+ assign_and_preserve_padding_tint_symbol(mat2x3(m));
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ f();
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f32.wgsl.expected.msl
index 0c95534..7550291 100644
--- a/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f32.wgsl.expected.msl
@@ -1,12 +1,37 @@
#include <metal_stdlib>
using namespace metal;
+
+template<typename T, size_t N>
+struct tint_array {
+ const constant T& operator[](size_t i) const constant { return elements[i]; }
+ device T& operator[](size_t i) device { return elements[i]; }
+ const device T& operator[](size_t i) const device { return elements[i]; }
+ thread T& operator[](size_t i) thread { return elements[i]; }
+ const thread T& operator[](size_t i) const thread { return elements[i]; }
+ threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+ const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+ T elements[N];
+};
+
struct tint_private_vars_struct {
float2x3 m;
};
-float2x3 f(thread tint_private_vars_struct* const tint_private_vars) {
- float2x3 const m_1 = float2x3((*(tint_private_vars)).m);
- return m_1;
+struct tint_packed_vec3_f32_array_element {
+ /* 0x0000 */ packed_float3 elements;
+ /* 0x000c */ tint_array<int8_t, 4> tint_pad;
+};
+
+void assign_and_preserve_padding(device tint_array<tint_packed_vec3_f32_array_element, 2>* const dest, float2x3 value) {
+ (*(dest))[0u].elements = packed_float3(value[0u]);
+ (*(dest))[1u].elements = packed_float3(value[1u]);
+}
+
+kernel void f(device tint_array<tint_packed_vec3_f32_array_element, 2>* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f));
+ assign_and_preserve_padding(tint_symbol, float2x3(tint_private_vars.m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f32.wgsl.expected.spvasm
index 8c235ee..5b24b01 100644
--- a/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f32.wgsl.expected.spvasm
@@ -1,15 +1,25 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 24
+; Bound: 41
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %assign_and_preserve_padding_out "assign_and_preserve_padding_out"
+ OpName %value "value"
OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%mat2v3float = OpTypeMatrix %v3float 2
@@ -24,15 +34,34 @@
%12 = OpConstantComposite %mat2v3float %7 %11
%_ptr_Private_mat2v3float = OpTypePointer Private %mat2v3float
%m = OpVariable %_ptr_Private_mat2v3float Private %12
+ %out_block = OpTypeStruct %mat2v3float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %15 = OpTypeFunction %void
- %19 = OpTypeFunction %mat2v3float
-%unused_entry_point = OpFunction %void None %15
- %18 = OpLabel
+ %18 = OpTypeFunction %void %mat2v3float
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %26 = OpConstantNull %int
+%_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float
+ %29 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+ %35 = OpTypeFunction %void
+%assign_and_preserve_padding_out = OpFunction %void None %18
+ %value = OpFunctionParameter %mat2v3float
+ %22 = OpLabel
+ %28 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %26
+ %30 = OpCompositeExtract %v3float %value 0
+ OpStore %28 %30
+ %32 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_1
+ %34 = OpCompositeExtract %v3float %value 1
+ OpStore %32 %34
OpReturn
OpFunctionEnd
- %f = OpFunction %mat2v3float None %19
- %21 = OpLabel
- %23 = OpLoad %mat2v3float %m
- OpReturnValue %23
+ %f = OpFunction %void None %35
+ %37 = OpLabel
+ %40 = OpLoad %mat2v3float %m
+ %38 = OpFunctionCall %void %assign_and_preserve_padding_out %40
+ OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f32.wgsl.expected.wgsl
index a6cf4e6..1a441af 100644
--- a/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f32.wgsl.expected.wgsl
@@ -1,6 +1,8 @@
var<private> m = mat2x3(mat2x3(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f));
-fn f() -> mat2x3<f32> {
- let m_1 = mat2x3(m);
- return m_1;
+@group(0) @binding(0) var<storage, read_write> out : mat2x3<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat2x3(m);
}
diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/abstract-float.wgsl b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/abstract-float.wgsl
index c13c5b1..89f06fb 100644
--- a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/abstract-float.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/abstract-float.wgsl
@@ -1,2 +1,10 @@
-var<private> m = mat2x3(0.0, 1.0, 2.0,
- 3.0, 4.0, 5.0);
+const m = mat2x3(0.0, 1.0, 2.0,
+ 3.0, 4.0, 5.0);
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat2x3<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl
index c2d1be7..a2c360b 100644
--- a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl
@@ -1,6 +1,12 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
}
-static float2x3 m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f)));
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl
index c2d1be7..a2c360b 100644
--- a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl
@@ -1,6 +1,12 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
}
-static float2x3 m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f)));
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/abstract-float.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/abstract-float.wgsl.expected.glsl
index 275e22b..0773020 100644
--- a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/abstract-float.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/abstract-float.wgsl.expected.glsl
@@ -1,7 +1,20 @@
#version 310 es
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat2x3 inner;
+} tint_symbol;
+
+void assign_and_preserve_padding_tint_symbol(mat2x3 value) {
+ tint_symbol.inner[0] = value[0u];
+ tint_symbol.inner[1] = value[1u];
+}
+
+void f() {
+ assign_and_preserve_padding_tint_symbol(mat2x3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f)));
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat2x3 m = mat2x3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f));
diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/abstract-float.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/abstract-float.wgsl.expected.msl
index f0ad3c1..31c3622 100644
--- a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/abstract-float.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/abstract-float.wgsl.expected.msl
@@ -1,7 +1,31 @@
#include <metal_stdlib>
using namespace metal;
-struct tint_private_vars_struct {
- float2x3 m;
+
+template<typename T, size_t N>
+struct tint_array {
+ const constant T& operator[](size_t i) const constant { return elements[i]; }
+ device T& operator[](size_t i) device { return elements[i]; }
+ const device T& operator[](size_t i) const device { return elements[i]; }
+ thread T& operator[](size_t i) thread { return elements[i]; }
+ const thread T& operator[](size_t i) const thread { return elements[i]; }
+ threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+ const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+ T elements[N];
};
+struct tint_packed_vec3_f32_array_element {
+ /* 0x0000 */ packed_float3 elements;
+ /* 0x000c */ tint_array<int8_t, 4> tint_pad;
+};
+
+void assign_and_preserve_padding(device tint_array<tint_packed_vec3_f32_array_element, 2>* const dest, float2x3 value) {
+ (*(dest))[0u].elements = packed_float3(value[0u]);
+ (*(dest))[1u].elements = packed_float3(value[1u]);
+}
+
+kernel void f(device tint_array<tint_packed_vec3_f32_array_element, 2>* tint_symbol [[buffer(0)]]) {
+ assign_and_preserve_padding(tint_symbol, float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f)));
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/abstract-float.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/abstract-float.wgsl.expected.spvasm
index 578716d..a4b3763 100644
--- a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/abstract-float.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/abstract-float.wgsl.expected.spvasm
@@ -1,31 +1,63 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 19
+; Bound: 37
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
- OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %assign_and_preserve_padding_out "assign_and_preserve_padding_out"
+ OpName %value "value"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%mat2v3float = OpTypeMatrix %v3float 2
- %4 = OpConstantNull %float
+ %out_block = OpTypeStruct %mat2v3float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void %mat2v3float
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %15 = OpConstantNull %int
+%_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float
+ %18 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+ %24 = OpTypeFunction %void
+ %28 = OpConstantNull %float
%float_1 = OpConstant %float 1
%float_2 = OpConstant %float 2
- %7 = OpConstantComposite %v3float %4 %float_1 %float_2
+ %31 = OpConstantComposite %v3float %28 %float_1 %float_2
%float_3 = OpConstant %float 3
%float_4 = OpConstant %float 4
%float_5 = OpConstant %float 5
- %11 = OpConstantComposite %v3float %float_3 %float_4 %float_5
- %12 = OpConstantComposite %mat2v3float %7 %11
-%_ptr_Private_mat2v3float = OpTypePointer Private %mat2v3float
- %m = OpVariable %_ptr_Private_mat2v3float Private %12
- %void = OpTypeVoid
- %15 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %15
- %18 = OpLabel
+ %35 = OpConstantComposite %v3float %float_3 %float_4 %float_5
+ %36 = OpConstantComposite %mat2v3float %31 %35
+%assign_and_preserve_padding_out = OpFunction %void None %7
+ %value = OpFunctionParameter %mat2v3float
+ %11 = OpLabel
+ %17 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %15
+ %19 = OpCompositeExtract %v3float %value 0
+ OpStore %17 %19
+ %21 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_1
+ %23 = OpCompositeExtract %v3float %value 1
+ OpStore %21 %23
+ OpReturn
+ OpFunctionEnd
+ %f = OpFunction %void None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %assign_and_preserve_padding_out %36
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/abstract-float.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/abstract-float.wgsl.expected.wgsl
index 2dae43b..3067eed 100644
--- a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/abstract-float.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/abstract-float.wgsl.expected.wgsl
@@ -1 +1,8 @@
-var<private> m = mat2x3(0.0, 1.0, 2.0, 3.0, 4.0, 5.0);
+const m = mat2x3(0.0, 1.0, 2.0, 3.0, 4.0, 5.0);
+
+@group(0) @binding(0) var<storage, read_write> out : mat2x3<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f16.wgsl b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f16.wgsl
index d2a6bf5..f50093d 100644
--- a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f16.wgsl
@@ -1,3 +1,11 @@
enable f16;
var<private> m = mat2x3(0.0h, 1.0h, 2.0h,
3.0h, 4.0h, 5.0h);
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat2x3<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f16.wgsl.expected.dxc.hlsl
index aafd9d1..c4c6949 100644
--- a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f16.wgsl.expected.dxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 2, 3> m = matrix<float16_t, 2, 3>(vector<float16_t, 3>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector<float16_t, 3>(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 2, 3> value) {
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 8u), value[1u]);
}
-static matrix<float16_t, 2, 3> m = matrix<float16_t, 2, 3>(vector<float16_t, 3>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector<float16_t, 3>(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f16.wgsl.expected.glsl
index 9986763..2f56f24 100644
--- a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f16.wgsl.expected.glsl
@@ -1,8 +1,22 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
+f16mat2x3 m = f16mat2x3(f16vec3(0.0hf, 1.0hf, 2.0hf), f16vec3(3.0hf, 4.0hf, 5.0hf));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat2x3 inner;
+} tint_symbol;
+
+void assign_and_preserve_padding_tint_symbol(f16mat2x3 value) {
+ tint_symbol.inner[0] = value[0u];
+ tint_symbol.inner[1] = value[1u];
+}
+
+void f() {
+ assign_and_preserve_padding_tint_symbol(m);
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-f16mat2x3 m = f16mat2x3(f16vec3(0.0hf, 1.0hf, 2.0hf), f16vec3(3.0hf, 4.0hf, 5.0hf));
diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f16.wgsl.expected.msl
index 12a2c58..d79f27f 100644
--- a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f16.wgsl.expected.msl
@@ -1,7 +1,37 @@
#include <metal_stdlib>
using namespace metal;
+
+template<typename T, size_t N>
+struct tint_array {
+ const constant T& operator[](size_t i) const constant { return elements[i]; }
+ device T& operator[](size_t i) device { return elements[i]; }
+ const device T& operator[](size_t i) const device { return elements[i]; }
+ thread T& operator[](size_t i) thread { return elements[i]; }
+ const thread T& operator[](size_t i) const thread { return elements[i]; }
+ threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+ const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+ T elements[N];
+};
+
struct tint_private_vars_struct {
half2x3 m;
};
+struct tint_packed_vec3_f16_array_element {
+ /* 0x0000 */ packed_half3 elements;
+ /* 0x0006 */ tint_array<int8_t, 2> tint_pad;
+};
+
+void assign_and_preserve_padding(device tint_array<tint_packed_vec3_f16_array_element, 2>* const dest, half2x3 value) {
+ (*(dest))[0u].elements = packed_half3(value[0u]);
+ (*(dest))[1u].elements = packed_half3(value[1u]);
+}
+
+kernel void f(device tint_array<tint_packed_vec3_f16_array_element, 2>* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half2x3(half3(0.0h, 1.0h, 2.0h), half3(3.0h, 4.0h, 5.0h));
+ assign_and_preserve_padding(tint_symbol, tint_private_vars.m);
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f16.wgsl.expected.spvasm
index b54bc34..dcc7672 100644
--- a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 19
+; Bound: 40
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,10 +9,21 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %assign_and_preserve_padding_out "assign_and_preserve_padding_out"
+ OpName %value "value"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v3half = OpTypeVector %half 3
%mat2v3half = OpTypeMatrix %v3half 2
@@ -27,9 +38,34 @@
%12 = OpConstantComposite %mat2v3half %7 %11
%_ptr_Private_mat2v3half = OpTypePointer Private %mat2v3half
%m = OpVariable %_ptr_Private_mat2v3half Private %12
+ %out_block = OpTypeStruct %mat2v3half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %15 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %15
- %18 = OpLabel
+ %18 = OpTypeFunction %void %mat2v3half
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %26 = OpConstantNull %int
+%_ptr_StorageBuffer_v3half = OpTypePointer StorageBuffer %v3half
+ %29 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+ %35 = OpTypeFunction %void
+%assign_and_preserve_padding_out = OpFunction %void None %18
+ %value = OpFunctionParameter %mat2v3half
+ %22 = OpLabel
+ %28 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %26
+ %30 = OpCompositeExtract %v3half %value 0
+ OpStore %28 %30
+ %32 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %int_1
+ %34 = OpCompositeExtract %v3half %value 1
+ OpStore %32 %34
+ OpReturn
+ OpFunctionEnd
+ %f = OpFunction %void None %35
+ %37 = OpLabel
+ %39 = OpLoad %mat2v3half %m
+ %38 = OpFunctionCall %void %assign_and_preserve_padding_out %39
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f16.wgsl.expected.wgsl
index f254ff6..9218308 100644
--- a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f16.wgsl.expected.wgsl
@@ -1,3 +1,10 @@
enable f16;
var<private> m = mat2x3(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h);
+
+@group(0) @binding(0) var<storage, read_write> out : mat2x3<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl
index 79031cb..1d7cf21 100644
--- a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl
@@ -1,2 +1,10 @@
var<private> m = mat2x3(0.0f, 1.0f, 2.0f,
3.0f, 4.0f, 5.0f);
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat2x3<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl.expected.dxc.hlsl
index c2d1be7..9a79741 100644
--- a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl.expected.dxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float2x3 m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
}
-static float2x3 m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl.expected.fxc.hlsl
index c2d1be7..9a79741 100644
--- a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl.expected.fxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float2x3 m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
}
-static float2x3 m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl.expected.glsl
index 275e22b..374b761 100644
--- a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl.expected.glsl
@@ -1,7 +1,21 @@
#version 310 es
+mat2x3 m = mat2x3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat2x3 inner;
+} tint_symbol;
+
+void assign_and_preserve_padding_tint_symbol(mat2x3 value) {
+ tint_symbol.inner[0] = value[0u];
+ tint_symbol.inner[1] = value[1u];
+}
+
+void f() {
+ assign_and_preserve_padding_tint_symbol(m);
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat2x3 m = mat2x3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f));
diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl.expected.msl
index f0ad3c1..cf56e26 100644
--- a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl.expected.msl
@@ -1,7 +1,37 @@
#include <metal_stdlib>
using namespace metal;
+
+template<typename T, size_t N>
+struct tint_array {
+ const constant T& operator[](size_t i) const constant { return elements[i]; }
+ device T& operator[](size_t i) device { return elements[i]; }
+ const device T& operator[](size_t i) const device { return elements[i]; }
+ thread T& operator[](size_t i) thread { return elements[i]; }
+ const thread T& operator[](size_t i) const thread { return elements[i]; }
+ threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+ const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+ T elements[N];
+};
+
struct tint_private_vars_struct {
float2x3 m;
};
+struct tint_packed_vec3_f32_array_element {
+ /* 0x0000 */ packed_float3 elements;
+ /* 0x000c */ tint_array<int8_t, 4> tint_pad;
+};
+
+void assign_and_preserve_padding(device tint_array<tint_packed_vec3_f32_array_element, 2>* const dest, float2x3 value) {
+ (*(dest))[0u].elements = packed_float3(value[0u]);
+ (*(dest))[1u].elements = packed_float3(value[1u]);
+}
+
+kernel void f(device tint_array<tint_packed_vec3_f32_array_element, 2>* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f));
+ assign_and_preserve_padding(tint_symbol, tint_private_vars.m);
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl.expected.spvasm
index 578716d..5f90c61 100644
--- a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl.expected.spvasm
@@ -1,14 +1,25 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 19
+; Bound: 40
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %assign_and_preserve_padding_out "assign_and_preserve_padding_out"
+ OpName %value "value"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%mat2v3float = OpTypeMatrix %v3float 2
@@ -23,9 +34,34 @@
%12 = OpConstantComposite %mat2v3float %7 %11
%_ptr_Private_mat2v3float = OpTypePointer Private %mat2v3float
%m = OpVariable %_ptr_Private_mat2v3float Private %12
+ %out_block = OpTypeStruct %mat2v3float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %15 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %15
- %18 = OpLabel
+ %18 = OpTypeFunction %void %mat2v3float
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %26 = OpConstantNull %int
+%_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float
+ %29 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+ %35 = OpTypeFunction %void
+%assign_and_preserve_padding_out = OpFunction %void None %18
+ %value = OpFunctionParameter %mat2v3float
+ %22 = OpLabel
+ %28 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %26
+ %30 = OpCompositeExtract %v3float %value 0
+ OpStore %28 %30
+ %32 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_1
+ %34 = OpCompositeExtract %v3float %value 1
+ OpStore %32 %34
+ OpReturn
+ OpFunctionEnd
+ %f = OpFunction %void None %35
+ %37 = OpLabel
+ %39 = OpLoad %mat2v3float %m
+ %38 = OpFunctionCall %void %assign_and_preserve_padding_out %39
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl.expected.wgsl
index d183723..465c9ca 100644
--- a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl.expected.wgsl
@@ -1 +1,8 @@
var<private> m = mat2x3(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f);
+
+@group(0) @binding(0) var<storage, read_write> out : mat2x3<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/abstract-float.wgsl b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/abstract-float.wgsl
index bb589a1..42659ac 100644
--- a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/abstract-float.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/abstract-float.wgsl
@@ -1,2 +1,10 @@
-var<private> m = mat2x3(vec3(0.0, 1.0, 2.0),
- vec3(3.0, 4.0, 5.0));
+const m = mat2x3(vec3(0.0, 1.0, 2.0),
+ vec3(3.0, 4.0, 5.0));
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat2x3<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl
index c2d1be7..a2c360b 100644
--- a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl
@@ -1,6 +1,12 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
}
-static float2x3 m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f)));
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl
index c2d1be7..a2c360b 100644
--- a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl
@@ -1,6 +1,12 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
}
-static float2x3 m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f)));
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/abstract-float.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/abstract-float.wgsl.expected.glsl
index 275e22b..0773020 100644
--- a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/abstract-float.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/abstract-float.wgsl.expected.glsl
@@ -1,7 +1,20 @@
#version 310 es
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat2x3 inner;
+} tint_symbol;
+
+void assign_and_preserve_padding_tint_symbol(mat2x3 value) {
+ tint_symbol.inner[0] = value[0u];
+ tint_symbol.inner[1] = value[1u];
+}
+
+void f() {
+ assign_and_preserve_padding_tint_symbol(mat2x3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f)));
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat2x3 m = mat2x3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f));
diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/abstract-float.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/abstract-float.wgsl.expected.msl
index f0ad3c1..31c3622 100644
--- a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/abstract-float.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/abstract-float.wgsl.expected.msl
@@ -1,7 +1,31 @@
#include <metal_stdlib>
using namespace metal;
-struct tint_private_vars_struct {
- float2x3 m;
+
+template<typename T, size_t N>
+struct tint_array {
+ const constant T& operator[](size_t i) const constant { return elements[i]; }
+ device T& operator[](size_t i) device { return elements[i]; }
+ const device T& operator[](size_t i) const device { return elements[i]; }
+ thread T& operator[](size_t i) thread { return elements[i]; }
+ const thread T& operator[](size_t i) const thread { return elements[i]; }
+ threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+ const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+ T elements[N];
};
+struct tint_packed_vec3_f32_array_element {
+ /* 0x0000 */ packed_float3 elements;
+ /* 0x000c */ tint_array<int8_t, 4> tint_pad;
+};
+
+void assign_and_preserve_padding(device tint_array<tint_packed_vec3_f32_array_element, 2>* const dest, float2x3 value) {
+ (*(dest))[0u].elements = packed_float3(value[0u]);
+ (*(dest))[1u].elements = packed_float3(value[1u]);
+}
+
+kernel void f(device tint_array<tint_packed_vec3_f32_array_element, 2>* tint_symbol [[buffer(0)]]) {
+ assign_and_preserve_padding(tint_symbol, float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f)));
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/abstract-float.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/abstract-float.wgsl.expected.spvasm
index 578716d..a4b3763 100644
--- a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/abstract-float.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/abstract-float.wgsl.expected.spvasm
@@ -1,31 +1,63 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 19
+; Bound: 37
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
- OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %assign_and_preserve_padding_out "assign_and_preserve_padding_out"
+ OpName %value "value"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%mat2v3float = OpTypeMatrix %v3float 2
- %4 = OpConstantNull %float
+ %out_block = OpTypeStruct %mat2v3float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void %mat2v3float
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %15 = OpConstantNull %int
+%_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float
+ %18 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+ %24 = OpTypeFunction %void
+ %28 = OpConstantNull %float
%float_1 = OpConstant %float 1
%float_2 = OpConstant %float 2
- %7 = OpConstantComposite %v3float %4 %float_1 %float_2
+ %31 = OpConstantComposite %v3float %28 %float_1 %float_2
%float_3 = OpConstant %float 3
%float_4 = OpConstant %float 4
%float_5 = OpConstant %float 5
- %11 = OpConstantComposite %v3float %float_3 %float_4 %float_5
- %12 = OpConstantComposite %mat2v3float %7 %11
-%_ptr_Private_mat2v3float = OpTypePointer Private %mat2v3float
- %m = OpVariable %_ptr_Private_mat2v3float Private %12
- %void = OpTypeVoid
- %15 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %15
- %18 = OpLabel
+ %35 = OpConstantComposite %v3float %float_3 %float_4 %float_5
+ %36 = OpConstantComposite %mat2v3float %31 %35
+%assign_and_preserve_padding_out = OpFunction %void None %7
+ %value = OpFunctionParameter %mat2v3float
+ %11 = OpLabel
+ %17 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %15
+ %19 = OpCompositeExtract %v3float %value 0
+ OpStore %17 %19
+ %21 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_1
+ %23 = OpCompositeExtract %v3float %value 1
+ OpStore %21 %23
+ OpReturn
+ OpFunctionEnd
+ %f = OpFunction %void None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %assign_and_preserve_padding_out %36
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/abstract-float.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/abstract-float.wgsl.expected.wgsl
index b194c30..77caf37 100644
--- a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/abstract-float.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/abstract-float.wgsl.expected.wgsl
@@ -1 +1,8 @@
-var<private> m = mat2x3(vec3(0.0, 1.0, 2.0), vec3(3.0, 4.0, 5.0));
+const m = mat2x3(vec3(0.0, 1.0, 2.0), vec3(3.0, 4.0, 5.0));
+
+@group(0) @binding(0) var<storage, read_write> out : mat2x3<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f16.wgsl b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f16.wgsl
index 795b6ef..43050a7 100644
--- a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f16.wgsl
@@ -1,3 +1,11 @@
enable f16;
var<private> m = mat2x3(vec3<f16>(0.0h, 1.0h, 2.0h),
vec3<f16>(3.0h, 4.0h, 5.0h));
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat2x3<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f16.wgsl.expected.dxc.hlsl
index aafd9d1..c4c6949 100644
--- a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f16.wgsl.expected.dxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 2, 3> m = matrix<float16_t, 2, 3>(vector<float16_t, 3>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector<float16_t, 3>(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 2, 3> value) {
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 8u), value[1u]);
}
-static matrix<float16_t, 2, 3> m = matrix<float16_t, 2, 3>(vector<float16_t, 3>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector<float16_t, 3>(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f16.wgsl.expected.glsl
index 9986763..2f56f24 100644
--- a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f16.wgsl.expected.glsl
@@ -1,8 +1,22 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
+f16mat2x3 m = f16mat2x3(f16vec3(0.0hf, 1.0hf, 2.0hf), f16vec3(3.0hf, 4.0hf, 5.0hf));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat2x3 inner;
+} tint_symbol;
+
+void assign_and_preserve_padding_tint_symbol(f16mat2x3 value) {
+ tint_symbol.inner[0] = value[0u];
+ tint_symbol.inner[1] = value[1u];
+}
+
+void f() {
+ assign_and_preserve_padding_tint_symbol(m);
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-f16mat2x3 m = f16mat2x3(f16vec3(0.0hf, 1.0hf, 2.0hf), f16vec3(3.0hf, 4.0hf, 5.0hf));
diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f16.wgsl.expected.msl
index 12a2c58..d79f27f 100644
--- a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f16.wgsl.expected.msl
@@ -1,7 +1,37 @@
#include <metal_stdlib>
using namespace metal;
+
+template<typename T, size_t N>
+struct tint_array {
+ const constant T& operator[](size_t i) const constant { return elements[i]; }
+ device T& operator[](size_t i) device { return elements[i]; }
+ const device T& operator[](size_t i) const device { return elements[i]; }
+ thread T& operator[](size_t i) thread { return elements[i]; }
+ const thread T& operator[](size_t i) const thread { return elements[i]; }
+ threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+ const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+ T elements[N];
+};
+
struct tint_private_vars_struct {
half2x3 m;
};
+struct tint_packed_vec3_f16_array_element {
+ /* 0x0000 */ packed_half3 elements;
+ /* 0x0006 */ tint_array<int8_t, 2> tint_pad;
+};
+
+void assign_and_preserve_padding(device tint_array<tint_packed_vec3_f16_array_element, 2>* const dest, half2x3 value) {
+ (*(dest))[0u].elements = packed_half3(value[0u]);
+ (*(dest))[1u].elements = packed_half3(value[1u]);
+}
+
+kernel void f(device tint_array<tint_packed_vec3_f16_array_element, 2>* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half2x3(half3(0.0h, 1.0h, 2.0h), half3(3.0h, 4.0h, 5.0h));
+ assign_and_preserve_padding(tint_symbol, tint_private_vars.m);
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f16.wgsl.expected.spvasm
index b54bc34..dcc7672 100644
--- a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 19
+; Bound: 40
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,10 +9,21 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %assign_and_preserve_padding_out "assign_and_preserve_padding_out"
+ OpName %value "value"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v3half = OpTypeVector %half 3
%mat2v3half = OpTypeMatrix %v3half 2
@@ -27,9 +38,34 @@
%12 = OpConstantComposite %mat2v3half %7 %11
%_ptr_Private_mat2v3half = OpTypePointer Private %mat2v3half
%m = OpVariable %_ptr_Private_mat2v3half Private %12
+ %out_block = OpTypeStruct %mat2v3half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %15 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %15
- %18 = OpLabel
+ %18 = OpTypeFunction %void %mat2v3half
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %26 = OpConstantNull %int
+%_ptr_StorageBuffer_v3half = OpTypePointer StorageBuffer %v3half
+ %29 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+ %35 = OpTypeFunction %void
+%assign_and_preserve_padding_out = OpFunction %void None %18
+ %value = OpFunctionParameter %mat2v3half
+ %22 = OpLabel
+ %28 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %26
+ %30 = OpCompositeExtract %v3half %value 0
+ OpStore %28 %30
+ %32 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %int_1
+ %34 = OpCompositeExtract %v3half %value 1
+ OpStore %32 %34
+ OpReturn
+ OpFunctionEnd
+ %f = OpFunction %void None %35
+ %37 = OpLabel
+ %39 = OpLoad %mat2v3half %m
+ %38 = OpFunctionCall %void %assign_and_preserve_padding_out %39
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f16.wgsl.expected.wgsl
index 9edfbc9..da1f3dd 100644
--- a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f16.wgsl.expected.wgsl
@@ -1,3 +1,10 @@
enable f16;
var<private> m = mat2x3(vec3<f16>(0.0h, 1.0h, 2.0h), vec3<f16>(3.0h, 4.0h, 5.0h));
+
+@group(0) @binding(0) var<storage, read_write> out : mat2x3<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl
index ab3d403..d2f8bd8 100644
--- a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl
@@ -1,2 +1,10 @@
var<private> m = mat2x3(vec3<f32>(0.0f, 1.0f, 2.0f),
vec3<f32>(3.0f, 4.0f, 5.0f));
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat2x3<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl.expected.dxc.hlsl
index c2d1be7..9a79741 100644
--- a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl.expected.dxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float2x3 m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
}
-static float2x3 m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl.expected.fxc.hlsl
index c2d1be7..9a79741 100644
--- a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl.expected.fxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float2x3 m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
}
-static float2x3 m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl.expected.glsl
index 275e22b..374b761 100644
--- a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl.expected.glsl
@@ -1,7 +1,21 @@
#version 310 es
+mat2x3 m = mat2x3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat2x3 inner;
+} tint_symbol;
+
+void assign_and_preserve_padding_tint_symbol(mat2x3 value) {
+ tint_symbol.inner[0] = value[0u];
+ tint_symbol.inner[1] = value[1u];
+}
+
+void f() {
+ assign_and_preserve_padding_tint_symbol(m);
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat2x3 m = mat2x3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f));
diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl.expected.msl
index f0ad3c1..cf56e26 100644
--- a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl.expected.msl
@@ -1,7 +1,37 @@
#include <metal_stdlib>
using namespace metal;
+
+template<typename T, size_t N>
+struct tint_array {
+ const constant T& operator[](size_t i) const constant { return elements[i]; }
+ device T& operator[](size_t i) device { return elements[i]; }
+ const device T& operator[](size_t i) const device { return elements[i]; }
+ thread T& operator[](size_t i) thread { return elements[i]; }
+ const thread T& operator[](size_t i) const thread { return elements[i]; }
+ threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+ const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+ T elements[N];
+};
+
struct tint_private_vars_struct {
float2x3 m;
};
+struct tint_packed_vec3_f32_array_element {
+ /* 0x0000 */ packed_float3 elements;
+ /* 0x000c */ tint_array<int8_t, 4> tint_pad;
+};
+
+void assign_and_preserve_padding(device tint_array<tint_packed_vec3_f32_array_element, 2>* const dest, float2x3 value) {
+ (*(dest))[0u].elements = packed_float3(value[0u]);
+ (*(dest))[1u].elements = packed_float3(value[1u]);
+}
+
+kernel void f(device tint_array<tint_packed_vec3_f32_array_element, 2>* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f));
+ assign_and_preserve_padding(tint_symbol, tint_private_vars.m);
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl.expected.spvasm
index 578716d..5f90c61 100644
--- a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl.expected.spvasm
@@ -1,14 +1,25 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 19
+; Bound: 40
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %assign_and_preserve_padding_out "assign_and_preserve_padding_out"
+ OpName %value "value"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%mat2v3float = OpTypeMatrix %v3float 2
@@ -23,9 +34,34 @@
%12 = OpConstantComposite %mat2v3float %7 %11
%_ptr_Private_mat2v3float = OpTypePointer Private %mat2v3float
%m = OpVariable %_ptr_Private_mat2v3float Private %12
+ %out_block = OpTypeStruct %mat2v3float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %15 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %15
- %18 = OpLabel
+ %18 = OpTypeFunction %void %mat2v3float
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %26 = OpConstantNull %int
+%_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float
+ %29 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+ %35 = OpTypeFunction %void
+%assign_and_preserve_padding_out = OpFunction %void None %18
+ %value = OpFunctionParameter %mat2v3float
+ %22 = OpLabel
+ %28 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %26
+ %30 = OpCompositeExtract %v3float %value 0
+ OpStore %28 %30
+ %32 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_1
+ %34 = OpCompositeExtract %v3float %value 1
+ OpStore %32 %34
+ OpReturn
+ OpFunctionEnd
+ %f = OpFunction %void None %35
+ %37 = OpLabel
+ %39 = OpLoad %mat2v3float %m
+ %38 = OpFunctionCall %void %assign_and_preserve_padding_out %39
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl.expected.wgsl
index 709c5a8..1a1ad33 100644
--- a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl.expected.wgsl
@@ -1 +1,8 @@
var<private> m = mat2x3(vec3<f32>(0.0f, 1.0f, 2.0f), vec3<f32>(3.0f, 4.0f, 5.0f));
+
+@group(0) @binding(0) var<storage, read_write> out : mat2x3<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x3/load/f16.wgsl b/test/tint/expressions/type_ctor/mat2x3/load/f16.wgsl
index 836529b..d3c6538 100644
--- a/test/tint/expressions/type_ctor/mat2x3/load/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x3/load/f16.wgsl
@@ -1,5 +1,10 @@
enable f16;
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat2x3<f16>;
+
+@compute @workgroup_size(1)
fn f() {
- var m = mat2x3<f16>();
- let m_1 = mat2x3(m);
+ var m = mat2x3<f16>();
+ out = mat2x3(m);
}
diff --git a/test/tint/expressions/type_ctor/mat2x3/load/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/load/f16.wgsl.expected.dxc.hlsl
index 1dfddbc..17ee3cb 100644
--- a/test/tint/expressions/type_ctor/mat2x3/load/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x3/load/f16.wgsl.expected.dxc.hlsl
@@ -1,9 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 2, 3> value) {
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 8u), value[1u]);
}
+[numthreads(1, 1, 1)]
void f() {
matrix<float16_t, 2, 3> m = matrix<float16_t, 2, 3>((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx);
- const matrix<float16_t, 2, 3> m_1 = matrix<float16_t, 2, 3>(m);
+ tint_symbol_store(0u, matrix<float16_t, 2, 3>(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat2x3/load/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x3/load/f16.wgsl.expected.glsl
index 6b72dfa..bf08436 100644
--- a/test/tint/expressions/type_ctor/mat2x3/load/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat2x3/load/f16.wgsl.expected.glsl
@@ -1,12 +1,22 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
- return;
-}
-void f() {
- f16mat2x3 m = f16mat2x3(f16vec3(0.0hf), f16vec3(0.0hf));
- f16mat2x3 m_1 = f16mat2x3(m);
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat2x3 inner;
+} tint_symbol;
+
+void assign_and_preserve_padding_tint_symbol(f16mat2x3 value) {
+ tint_symbol.inner[0] = value[0u];
+ tint_symbol.inner[1] = value[1u];
}
+void f() {
+ f16mat2x3 m = f16mat2x3(f16vec3(0.0hf), f16vec3(0.0hf));
+ assign_and_preserve_padding_tint_symbol(f16mat2x3(m));
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ f();
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x3/load/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x3/load/f16.wgsl.expected.msl
index 27442fa..04ac5c3 100644
--- a/test/tint/expressions/type_ctor/mat2x3/load/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat2x3/load/f16.wgsl.expected.msl
@@ -1,8 +1,32 @@
#include <metal_stdlib>
using namespace metal;
-void f() {
+
+template<typename T, size_t N>
+struct tint_array {
+ const constant T& operator[](size_t i) const constant { return elements[i]; }
+ device T& operator[](size_t i) device { return elements[i]; }
+ const device T& operator[](size_t i) const device { return elements[i]; }
+ thread T& operator[](size_t i) thread { return elements[i]; }
+ const thread T& operator[](size_t i) const thread { return elements[i]; }
+ threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+ const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+ T elements[N];
+};
+
+struct tint_packed_vec3_f16_array_element {
+ /* 0x0000 */ packed_half3 elements;
+ /* 0x0006 */ tint_array<int8_t, 2> tint_pad;
+};
+
+void assign_and_preserve_padding(device tint_array<tint_packed_vec3_f16_array_element, 2>* const dest, half2x3 value) {
+ (*(dest))[0u].elements = packed_half3(value[0u]);
+ (*(dest))[1u].elements = packed_half3(value[1u]);
+}
+
+kernel void f(device tint_array<tint_packed_vec3_f16_array_element, 2>* tint_symbol [[buffer(0)]]) {
half2x3 m = half2x3(half3(0.0h), half3(0.0h));
- half2x3 const m_1 = half2x3(m);
+ assign_and_preserve_padding(tint_symbol, half2x3(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat2x3/load/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x3/load/f16.wgsl.expected.spvasm
index c7f050a..9dce444 100644
--- a/test/tint/expressions/type_ctor/mat2x3/load/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat2x3/load/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 15
+; Bound: 33
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,26 +9,56 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
- OpName %unused_entry_point "unused_entry_point"
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %assign_and_preserve_padding_out "assign_and_preserve_padding_out"
+ OpName %value "value"
OpName %f "f"
OpName %m "m"
- %void = OpTypeVoid
- %1 = OpTypeFunction %void
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v3half = OpTypeVector %half 3
%mat2v3half = OpTypeMatrix %v3half 2
- %10 = OpConstantNull %mat2v3half
+ %out_block = OpTypeStruct %mat2v3half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void %mat2v3half
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %15 = OpConstantNull %int
+%_ptr_StorageBuffer_v3half = OpTypePointer StorageBuffer %v3half
+ %18 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+ %24 = OpTypeFunction %void
+ %27 = OpConstantNull %mat2v3half
%_ptr_Function_mat2v3half = OpTypePointer Function %mat2v3half
-%unused_entry_point = OpFunction %void None %1
- %4 = OpLabel
+%assign_and_preserve_padding_out = OpFunction %void None %7
+ %value = OpFunctionParameter %mat2v3half
+ %11 = OpLabel
+ %17 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %15
+ %19 = OpCompositeExtract %v3half %value 0
+ OpStore %17 %19
+ %21 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %int_1
+ %23 = OpCompositeExtract %v3half %value 1
+ OpStore %21 %23
OpReturn
OpFunctionEnd
- %f = OpFunction %void None %1
- %6 = OpLabel
- %m = OpVariable %_ptr_Function_mat2v3half Function %10
- OpStore %m %10
- %14 = OpLoad %mat2v3half %m
+ %f = OpFunction %void None %24
+ %26 = OpLabel
+ %m = OpVariable %_ptr_Function_mat2v3half Function %27
+ OpStore %m %27
+ %32 = OpLoad %mat2v3half %m
+ %30 = OpFunctionCall %void %assign_and_preserve_padding_out %32
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat2x3/load/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x3/load/f16.wgsl.expected.wgsl
index 3774e39..2c03bd7 100644
--- a/test/tint/expressions/type_ctor/mat2x3/load/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x3/load/f16.wgsl.expected.wgsl
@@ -1,6 +1,9 @@
enable f16;
+@group(0) @binding(0) var<storage, read_write> out : mat2x3<f16>;
+
+@compute @workgroup_size(1)
fn f() {
var m = mat2x3<f16>();
- let m_1 = mat2x3(m);
+ out = mat2x3(m);
}
diff --git a/test/tint/expressions/type_ctor/mat2x3/load/f32.wgsl b/test/tint/expressions/type_ctor/mat2x3/load/f32.wgsl
index 61ba845..8487561 100644
--- a/test/tint/expressions/type_ctor/mat2x3/load/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x3/load/f32.wgsl
@@ -1,4 +1,8 @@
+@group(0) @binding(0)
+var<storage, read_write> out : mat2x3<f32>;
+
+@compute @workgroup_size(1)
fn f() {
- var m = mat2x3<f32>();
- let m_1 = mat2x3(m);
+ var m = mat2x3<f32>();
+ out = mat2x3(m);
}
diff --git a/test/tint/expressions/type_ctor/mat2x3/load/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/load/f32.wgsl.expected.dxc.hlsl
index 488b65c..31dc2d1 100644
--- a/test/tint/expressions/type_ctor/mat2x3/load/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x3/load/f32.wgsl.expected.dxc.hlsl
@@ -1,9 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
}
+[numthreads(1, 1, 1)]
void f() {
float2x3 m = float2x3((0.0f).xxx, (0.0f).xxx);
- const float2x3 m_1 = float2x3(m);
+ tint_symbol_store(0u, float2x3(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat2x3/load/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/load/f32.wgsl.expected.fxc.hlsl
index 488b65c..31dc2d1 100644
--- a/test/tint/expressions/type_ctor/mat2x3/load/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x3/load/f32.wgsl.expected.fxc.hlsl
@@ -1,9 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
}
+[numthreads(1, 1, 1)]
void f() {
float2x3 m = float2x3((0.0f).xxx, (0.0f).xxx);
- const float2x3 m_1 = float2x3(m);
+ tint_symbol_store(0u, float2x3(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat2x3/load/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x3/load/f32.wgsl.expected.glsl
index a6d4fef..4bb6007 100644
--- a/test/tint/expressions/type_ctor/mat2x3/load/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat2x3/load/f32.wgsl.expected.glsl
@@ -1,11 +1,21 @@
#version 310 es
-layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
- return;
-}
-void f() {
- mat2x3 m = mat2x3(vec3(0.0f), vec3(0.0f));
- mat2x3 m_1 = mat2x3(m);
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat2x3 inner;
+} tint_symbol;
+
+void assign_and_preserve_padding_tint_symbol(mat2x3 value) {
+ tint_symbol.inner[0] = value[0u];
+ tint_symbol.inner[1] = value[1u];
}
+void f() {
+ mat2x3 m = mat2x3(vec3(0.0f), vec3(0.0f));
+ assign_and_preserve_padding_tint_symbol(mat2x3(m));
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ f();
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x3/load/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x3/load/f32.wgsl.expected.msl
index 62720d7..42e7b89 100644
--- a/test/tint/expressions/type_ctor/mat2x3/load/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat2x3/load/f32.wgsl.expected.msl
@@ -1,8 +1,32 @@
#include <metal_stdlib>
using namespace metal;
-void f() {
+
+template<typename T, size_t N>
+struct tint_array {
+ const constant T& operator[](size_t i) const constant { return elements[i]; }
+ device T& operator[](size_t i) device { return elements[i]; }
+ const device T& operator[](size_t i) const device { return elements[i]; }
+ thread T& operator[](size_t i) thread { return elements[i]; }
+ const thread T& operator[](size_t i) const thread { return elements[i]; }
+ threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+ const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+ T elements[N];
+};
+
+struct tint_packed_vec3_f32_array_element {
+ /* 0x0000 */ packed_float3 elements;
+ /* 0x000c */ tint_array<int8_t, 4> tint_pad;
+};
+
+void assign_and_preserve_padding(device tint_array<tint_packed_vec3_f32_array_element, 2>* const dest, float2x3 value) {
+ (*(dest))[0u].elements = packed_float3(value[0u]);
+ (*(dest))[1u].elements = packed_float3(value[1u]);
+}
+
+kernel void f(device tint_array<tint_packed_vec3_f32_array_element, 2>* tint_symbol [[buffer(0)]]) {
float2x3 m = float2x3(float3(0.0f), float3(0.0f));
- float2x3 const m_1 = float2x3(m);
+ assign_and_preserve_padding(tint_symbol, float2x3(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat2x3/load/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x3/load/f32.wgsl.expected.spvasm
index 7545cbd..ae8a6e1 100644
--- a/test/tint/expressions/type_ctor/mat2x3/load/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat2x3/load/f32.wgsl.expected.spvasm
@@ -1,30 +1,60 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 15
+; Bound: 33
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
- OpName %unused_entry_point "unused_entry_point"
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %assign_and_preserve_padding_out "assign_and_preserve_padding_out"
+ OpName %value "value"
OpName %f "f"
OpName %m "m"
- %void = OpTypeVoid
- %1 = OpTypeFunction %void
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%mat2v3float = OpTypeMatrix %v3float 2
- %10 = OpConstantNull %mat2v3float
+ %out_block = OpTypeStruct %mat2v3float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void %mat2v3float
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %15 = OpConstantNull %int
+%_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float
+ %18 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+ %24 = OpTypeFunction %void
+ %27 = OpConstantNull %mat2v3float
%_ptr_Function_mat2v3float = OpTypePointer Function %mat2v3float
-%unused_entry_point = OpFunction %void None %1
- %4 = OpLabel
+%assign_and_preserve_padding_out = OpFunction %void None %7
+ %value = OpFunctionParameter %mat2v3float
+ %11 = OpLabel
+ %17 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %15
+ %19 = OpCompositeExtract %v3float %value 0
+ OpStore %17 %19
+ %21 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_1
+ %23 = OpCompositeExtract %v3float %value 1
+ OpStore %21 %23
OpReturn
OpFunctionEnd
- %f = OpFunction %void None %1
- %6 = OpLabel
- %m = OpVariable %_ptr_Function_mat2v3float Function %10
- OpStore %m %10
- %14 = OpLoad %mat2v3float %m
+ %f = OpFunction %void None %24
+ %26 = OpLabel
+ %m = OpVariable %_ptr_Function_mat2v3float Function %27
+ OpStore %m %27
+ %32 = OpLoad %mat2v3float %m
+ %30 = OpFunctionCall %void %assign_and_preserve_padding_out %32
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat2x3/load/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x3/load/f32.wgsl.expected.wgsl
index bdd3075..29f17bd 100644
--- a/test/tint/expressions/type_ctor/mat2x3/load/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x3/load/f32.wgsl.expected.wgsl
@@ -1,4 +1,7 @@
+@group(0) @binding(0) var<storage, read_write> out : mat2x3<f32>;
+
+@compute @workgroup_size(1)
fn f() {
var m = mat2x3<f32>();
- let m_1 = mat2x3(m);
+ out = mat2x3(m);
}
diff --git a/test/tint/expressions/type_ctor/mat2x3/zero/f16.wgsl b/test/tint/expressions/type_ctor/mat2x3/zero/f16.wgsl
index 2fe4fc8..6af5dbb 100644
--- a/test/tint/expressions/type_ctor/mat2x3/zero/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x3/zero/f16.wgsl
@@ -1,2 +1,10 @@
enable f16;
var<private> m = mat2x3<f16>();
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat2x3<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x3/zero/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/zero/f16.wgsl.expected.dxc.hlsl
index 9a9865b..03eafd2 100644
--- a/test/tint/expressions/type_ctor/mat2x3/zero/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x3/zero/f16.wgsl.expected.dxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 2, 3> m = matrix<float16_t, 2, 3>((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx);
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 2, 3> value) {
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 8u), value[1u]);
}
-static matrix<float16_t, 2, 3> m = matrix<float16_t, 2, 3>((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx);
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x3/zero/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x3/zero/f16.wgsl.expected.glsl
index d98ea56..6f68fcb 100644
--- a/test/tint/expressions/type_ctor/mat2x3/zero/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat2x3/zero/f16.wgsl.expected.glsl
@@ -1,8 +1,22 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
+f16mat2x3 m = f16mat2x3(f16vec3(0.0hf), f16vec3(0.0hf));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat2x3 inner;
+} tint_symbol;
+
+void assign_and_preserve_padding_tint_symbol(f16mat2x3 value) {
+ tint_symbol.inner[0] = value[0u];
+ tint_symbol.inner[1] = value[1u];
+}
+
+void f() {
+ assign_and_preserve_padding_tint_symbol(m);
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-f16mat2x3 m = f16mat2x3(f16vec3(0.0hf), f16vec3(0.0hf));
diff --git a/test/tint/expressions/type_ctor/mat2x3/zero/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x3/zero/f16.wgsl.expected.msl
index 12a2c58..86bf8d8 100644
--- a/test/tint/expressions/type_ctor/mat2x3/zero/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat2x3/zero/f16.wgsl.expected.msl
@@ -1,7 +1,37 @@
#include <metal_stdlib>
using namespace metal;
+
+template<typename T, size_t N>
+struct tint_array {
+ const constant T& operator[](size_t i) const constant { return elements[i]; }
+ device T& operator[](size_t i) device { return elements[i]; }
+ const device T& operator[](size_t i) const device { return elements[i]; }
+ thread T& operator[](size_t i) thread { return elements[i]; }
+ const thread T& operator[](size_t i) const thread { return elements[i]; }
+ threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+ const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+ T elements[N];
+};
+
struct tint_private_vars_struct {
half2x3 m;
};
+struct tint_packed_vec3_f16_array_element {
+ /* 0x0000 */ packed_half3 elements;
+ /* 0x0006 */ tint_array<int8_t, 2> tint_pad;
+};
+
+void assign_and_preserve_padding(device tint_array<tint_packed_vec3_f16_array_element, 2>* const dest, half2x3 value) {
+ (*(dest))[0u].elements = packed_half3(value[0u]);
+ (*(dest))[1u].elements = packed_half3(value[1u]);
+}
+
+kernel void f(device tint_array<tint_packed_vec3_f16_array_element, 2>* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half2x3(half3(0.0h), half3(0.0h));
+ assign_and_preserve_padding(tint_symbol, tint_private_vars.m);
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat2x3/zero/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x3/zero/f16.wgsl.expected.spvasm
index b417fb4..9007c58 100644
--- a/test/tint/expressions/type_ctor/mat2x3/zero/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat2x3/zero/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 11
+; Bound: 32
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,19 +9,55 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %assign_and_preserve_padding_out "assign_and_preserve_padding_out"
+ OpName %value "value"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v3half = OpTypeVector %half 3
%mat2v3half = OpTypeMatrix %v3half 2
%4 = OpConstantNull %mat2v3half
%_ptr_Private_mat2v3half = OpTypePointer Private %mat2v3half
%m = OpVariable %_ptr_Private_mat2v3half Private %4
+ %out_block = OpTypeStruct %mat2v3half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %7 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %7
- %10 = OpLabel
+ %10 = OpTypeFunction %void %mat2v3half
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %18 = OpConstantNull %int
+%_ptr_StorageBuffer_v3half = OpTypePointer StorageBuffer %v3half
+ %21 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+ %27 = OpTypeFunction %void
+%assign_and_preserve_padding_out = OpFunction %void None %10
+ %value = OpFunctionParameter %mat2v3half
+ %14 = OpLabel
+ %20 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %18
+ %22 = OpCompositeExtract %v3half %value 0
+ OpStore %20 %22
+ %24 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %int_1
+ %26 = OpCompositeExtract %v3half %value 1
+ OpStore %24 %26
+ OpReturn
+ OpFunctionEnd
+ %f = OpFunction %void None %27
+ %29 = OpLabel
+ %31 = OpLoad %mat2v3half %m
+ %30 = OpFunctionCall %void %assign_and_preserve_padding_out %31
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat2x3/zero/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x3/zero/f16.wgsl.expected.wgsl
index 1b95f50..d96fb8f 100644
--- a/test/tint/expressions/type_ctor/mat2x3/zero/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x3/zero/f16.wgsl.expected.wgsl
@@ -1,3 +1,10 @@
enable f16;
var<private> m = mat2x3<f16>();
+
+@group(0) @binding(0) var<storage, read_write> out : mat2x3<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x3/zero/f32.wgsl b/test/tint/expressions/type_ctor/mat2x3/zero/f32.wgsl
index e9b1825..a3e581b 100644
--- a/test/tint/expressions/type_ctor/mat2x3/zero/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x3/zero/f32.wgsl
@@ -1 +1,9 @@
var<private> m = mat2x3<f32>();
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat2x3<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x3/zero/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/zero/f32.wgsl.expected.dxc.hlsl
index 3fe1f11..08cd718 100644
--- a/test/tint/expressions/type_ctor/mat2x3/zero/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x3/zero/f32.wgsl.expected.dxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float2x3 m = float2x3((0.0f).xxx, (0.0f).xxx);
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
}
-static float2x3 m = float2x3((0.0f).xxx, (0.0f).xxx);
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x3/zero/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/zero/f32.wgsl.expected.fxc.hlsl
index 3fe1f11..08cd718 100644
--- a/test/tint/expressions/type_ctor/mat2x3/zero/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x3/zero/f32.wgsl.expected.fxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float2x3 m = float2x3((0.0f).xxx, (0.0f).xxx);
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
}
-static float2x3 m = float2x3((0.0f).xxx, (0.0f).xxx);
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x3/zero/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x3/zero/f32.wgsl.expected.glsl
index 6d2c8f5..4a164f2 100644
--- a/test/tint/expressions/type_ctor/mat2x3/zero/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat2x3/zero/f32.wgsl.expected.glsl
@@ -1,7 +1,21 @@
#version 310 es
+mat2x3 m = mat2x3(vec3(0.0f), vec3(0.0f));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat2x3 inner;
+} tint_symbol;
+
+void assign_and_preserve_padding_tint_symbol(mat2x3 value) {
+ tint_symbol.inner[0] = value[0u];
+ tint_symbol.inner[1] = value[1u];
+}
+
+void f() {
+ assign_and_preserve_padding_tint_symbol(m);
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat2x3 m = mat2x3(vec3(0.0f), vec3(0.0f));
diff --git a/test/tint/expressions/type_ctor/mat2x3/zero/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x3/zero/f32.wgsl.expected.msl
index f0ad3c1..fd8688d 100644
--- a/test/tint/expressions/type_ctor/mat2x3/zero/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat2x3/zero/f32.wgsl.expected.msl
@@ -1,7 +1,37 @@
#include <metal_stdlib>
using namespace metal;
+
+template<typename T, size_t N>
+struct tint_array {
+ const constant T& operator[](size_t i) const constant { return elements[i]; }
+ device T& operator[](size_t i) device { return elements[i]; }
+ const device T& operator[](size_t i) const device { return elements[i]; }
+ thread T& operator[](size_t i) thread { return elements[i]; }
+ const thread T& operator[](size_t i) const thread { return elements[i]; }
+ threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+ const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+ T elements[N];
+};
+
struct tint_private_vars_struct {
float2x3 m;
};
+struct tint_packed_vec3_f32_array_element {
+ /* 0x0000 */ packed_float3 elements;
+ /* 0x000c */ tint_array<int8_t, 4> tint_pad;
+};
+
+void assign_and_preserve_padding(device tint_array<tint_packed_vec3_f32_array_element, 2>* const dest, float2x3 value) {
+ (*(dest))[0u].elements = packed_float3(value[0u]);
+ (*(dest))[1u].elements = packed_float3(value[1u]);
+}
+
+kernel void f(device tint_array<tint_packed_vec3_f32_array_element, 2>* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float2x3(float3(0.0f), float3(0.0f));
+ assign_and_preserve_padding(tint_symbol, tint_private_vars.m);
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat2x3/zero/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x3/zero/f32.wgsl.expected.spvasm
index ee69713..8d4183d0 100644
--- a/test/tint/expressions/type_ctor/mat2x3/zero/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat2x3/zero/f32.wgsl.expected.spvasm
@@ -1,23 +1,59 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 11
+; Bound: 32
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %assign_and_preserve_padding_out "assign_and_preserve_padding_out"
+ OpName %value "value"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%mat2v3float = OpTypeMatrix %v3float 2
%4 = OpConstantNull %mat2v3float
%_ptr_Private_mat2v3float = OpTypePointer Private %mat2v3float
%m = OpVariable %_ptr_Private_mat2v3float Private %4
+ %out_block = OpTypeStruct %mat2v3float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %7 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %7
- %10 = OpLabel
+ %10 = OpTypeFunction %void %mat2v3float
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %18 = OpConstantNull %int
+%_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float
+ %21 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+ %27 = OpTypeFunction %void
+%assign_and_preserve_padding_out = OpFunction %void None %10
+ %value = OpFunctionParameter %mat2v3float
+ %14 = OpLabel
+ %20 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %18
+ %22 = OpCompositeExtract %v3float %value 0
+ OpStore %20 %22
+ %24 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_1
+ %26 = OpCompositeExtract %v3float %value 1
+ OpStore %24 %26
+ OpReturn
+ OpFunctionEnd
+ %f = OpFunction %void None %27
+ %29 = OpLabel
+ %31 = OpLoad %mat2v3float %m
+ %30 = OpFunctionCall %void %assign_and_preserve_padding_out %31
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat2x3/zero/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x3/zero/f32.wgsl.expected.wgsl
index e9b1825..8a80604 100644
--- a/test/tint/expressions/type_ctor/mat2x3/zero/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x3/zero/f32.wgsl.expected.wgsl
@@ -1 +1,8 @@
var<private> m = mat2x3<f32>();
+
+@group(0) @binding(0) var<storage, read_write> out : mat2x3<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f16.wgsl b/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f16.wgsl
index 55c2104..f7a0378 100644
--- a/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f16.wgsl
@@ -1,8 +1,11 @@
enable f16;
-var<private> m = mat2x4(mat2x4<f16>(0.0h, 1.0h, 2.0h, 3.0h,
- 4.0h, 5.0h, 6.0h, 7.0h));
+var<private> m = mat2x4<f16>(mat2x4<f16>(0.0h, 1.0h, 2.0h, 3.0h,
+ 4.0h, 5.0h, 6.0h, 7.0h));
-fn f() -> mat2x4<f16> {
- let m_1 = mat2x4(m);
- return m_1;
+@group(0) @binding(0)
+var<storage, read_write> out : mat2x4<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat2x4<f16>(m);
}
diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f16.wgsl.expected.dxc.hlsl
index 06dab04..3239ff3 100644
--- a/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f16.wgsl.expected.dxc.hlsl
@@ -1,11 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 2, 4> m = matrix<float16_t, 2, 4>(vector<float16_t, 4>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 4>(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 2, 4> value) {
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 8u), value[1u]);
}
-static matrix<float16_t, 2, 4> m = matrix<float16_t, 2, 4>(vector<float16_t, 4>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 4>(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)));
-
-matrix<float16_t, 2, 4> f() {
- const matrix<float16_t, 2, 4> m_1 = matrix<float16_t, 2, 4>(m);
- return m_1;
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, matrix<float16_t, 2, 4>(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f16.wgsl.expected.glsl
index 5bafb95..ccd1267 100644
--- a/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f16.wgsl.expected.glsl
@@ -1,13 +1,17 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
- return;
-}
f16mat2x4 m = f16mat2x4(f16vec4(0.0hf, 1.0hf, 2.0hf, 3.0hf), f16vec4(4.0hf, 5.0hf, 6.0hf, 7.0hf));
-f16mat2x4 f() {
- f16mat2x4 m_1 = f16mat2x4(m);
- return m_1;
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat2x4 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = f16mat2x4(m);
}
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ f();
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f16.wgsl.expected.msl
index 3bc8b99..a6a4906 100644
--- a/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f16.wgsl.expected.msl
@@ -5,8 +5,10 @@
half2x4 m;
};
-half2x4 f(thread tint_private_vars_struct* const tint_private_vars) {
- half2x4 const m_1 = half2x4((*(tint_private_vars)).m);
- return m_1;
+kernel void f(device half2x4* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half2x4(half4(0.0h, 1.0h, 2.0h, 3.0h), half4(4.0h, 5.0h, 6.0h, 7.0h));
+ *(tint_symbol) = half2x4(tint_private_vars.m);
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f16.wgsl.expected.spvasm
index e94c114..1baf770 100644
--- a/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 26
+; Bound: 30
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,11 +9,19 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v4half = OpTypeVector %half 4
%mat2v4half = OpTypeMatrix %v4half 2
@@ -30,15 +38,18 @@
%14 = OpConstantComposite %mat2v4half %8 %13
%_ptr_Private_mat2v4half = OpTypePointer Private %mat2v4half
%m = OpVariable %_ptr_Private_mat2v4half Private %14
+ %out_block = OpTypeStruct %mat2v4half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %17 = OpTypeFunction %void
- %21 = OpTypeFunction %mat2v4half
-%unused_entry_point = OpFunction %void None %17
- %20 = OpLabel
- OpReturn
- OpFunctionEnd
- %f = OpFunction %mat2v4half None %21
+ %20 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat2v4half = OpTypePointer StorageBuffer %mat2v4half
+ %f = OpFunction %void None %20
%23 = OpLabel
- %25 = OpLoad %mat2v4half %m
- OpReturnValue %25
+ %27 = OpAccessChain %_ptr_StorageBuffer_mat2v4half %out %uint_0
+ %29 = OpLoad %mat2v4half %m
+ OpStore %27 %29
+ OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f16.wgsl.expected.wgsl
index 9ba7b46..3bb3ba5 100644
--- a/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f16.wgsl.expected.wgsl
@@ -1,8 +1,10 @@
enable f16;
-var<private> m = mat2x4(mat2x4<f16>(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h));
+var<private> m = mat2x4<f16>(mat2x4<f16>(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h));
-fn f() -> mat2x4<f16> {
- let m_1 = mat2x4(m);
- return m_1;
+@group(0) @binding(0) var<storage, read_write> out : mat2x4<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat2x4<f16>(m);
}
diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f32.wgsl b/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f32.wgsl
index c8f8bc5..c93f27d 100644
--- a/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f32.wgsl
@@ -1,7 +1,10 @@
-var<private> m = mat2x4(mat2x4<f32>(0.0f, 1.0f, 2.0f, 3.0f,
- 4.0f, 5.0f, 6.0f, 7.0f));
+var<private> m = mat2x4<f32>(mat2x4<f32>(0.0f, 1.0f, 2.0f, 3.0f,
+ 4.0f, 5.0f, 6.0f, 7.0f));
-fn f() -> mat2x4<f32> {
- let m_1 = mat2x4(m);
- return m_1;
+@group(0) @binding(0)
+var<storage, read_write> out : mat2x4<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat2x4<f32>(m);
}
diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f32.wgsl.expected.dxc.hlsl
index b37e3b7..180aad1 100644
--- a/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f32.wgsl.expected.dxc.hlsl
@@ -1,11 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float2x4 m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
}
-static float2x4 m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f));
-
-float2x4 f() {
- const float2x4 m_1 = float2x4(m);
- return m_1;
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float2x4(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f32.wgsl.expected.fxc.hlsl
index b37e3b7..180aad1 100644
--- a/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f32.wgsl.expected.fxc.hlsl
@@ -1,11 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float2x4 m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
}
-static float2x4 m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f));
-
-float2x4 f() {
- const float2x4 m_1 = float2x4(m);
- return m_1;
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float2x4(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f32.wgsl.expected.glsl
index 06eabf0..d6488ea 100644
--- a/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f32.wgsl.expected.glsl
@@ -1,12 +1,16 @@
#version 310 es
-layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
- return;
-}
mat2x4 m = mat2x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f));
-mat2x4 f() {
- mat2x4 m_1 = mat2x4(m);
- return m_1;
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat2x4 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = mat2x4(m);
}
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ f();
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f32.wgsl.expected.msl
index 8d39f84..dce30ae 100644
--- a/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f32.wgsl.expected.msl
@@ -5,8 +5,10 @@
float2x4 m;
};
-float2x4 f(thread tint_private_vars_struct* const tint_private_vars) {
- float2x4 const m_1 = float2x4((*(tint_private_vars)).m);
- return m_1;
+kernel void f(device float2x4* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f));
+ *(tint_symbol) = float2x4(tint_private_vars.m);
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f32.wgsl.expected.spvasm
index 6dbb4ce..2fcc27e 100644
--- a/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f32.wgsl.expected.spvasm
@@ -1,15 +1,23 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 26
+; Bound: 30
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%mat2v4float = OpTypeMatrix %v4float 2
@@ -26,15 +34,18 @@
%14 = OpConstantComposite %mat2v4float %8 %13
%_ptr_Private_mat2v4float = OpTypePointer Private %mat2v4float
%m = OpVariable %_ptr_Private_mat2v4float Private %14
+ %out_block = OpTypeStruct %mat2v4float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %17 = OpTypeFunction %void
- %21 = OpTypeFunction %mat2v4float
-%unused_entry_point = OpFunction %void None %17
- %20 = OpLabel
- OpReturn
- OpFunctionEnd
- %f = OpFunction %mat2v4float None %21
+ %20 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat2v4float = OpTypePointer StorageBuffer %mat2v4float
+ %f = OpFunction %void None %20
%23 = OpLabel
- %25 = OpLoad %mat2v4float %m
- OpReturnValue %25
+ %27 = OpAccessChain %_ptr_StorageBuffer_mat2v4float %out %uint_0
+ %29 = OpLoad %mat2v4float %m
+ OpStore %27 %29
+ OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f32.wgsl.expected.wgsl
index 476ed2c..9adc452 100644
--- a/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f32.wgsl.expected.wgsl
@@ -1,6 +1,8 @@
-var<private> m = mat2x4(mat2x4<f32>(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f));
+var<private> m = mat2x4<f32>(mat2x4<f32>(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f));
-fn f() -> mat2x4<f32> {
- let m_1 = mat2x4(m);
- return m_1;
+@group(0) @binding(0) var<storage, read_write> out : mat2x4<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat2x4<f32>(m);
}
diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f16.wgsl b/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f16.wgsl
index 3dbdba0..975e520 100644
--- a/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f16.wgsl
@@ -1,3 +1,11 @@
enable f16;
var<private> m = mat2x4<f16>(0.0h, 1.0h, 2.0h, 3.0h,
4.0h, 5.0h, 6.0h, 7.0h);
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat2x4<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f16.wgsl.expected.dxc.hlsl
index 9fb8b2c..d0b84a6 100644
--- a/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f16.wgsl.expected.dxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 2, 4> m = matrix<float16_t, 2, 4>(vector<float16_t, 4>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 4>(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 2, 4> value) {
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 8u), value[1u]);
}
-static matrix<float16_t, 2, 4> m = matrix<float16_t, 2, 4>(vector<float16_t, 4>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 4>(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f16.wgsl.expected.glsl
index a4b80ad..ba77b50 100644
--- a/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f16.wgsl.expected.glsl
@@ -1,8 +1,17 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
+f16mat2x4 m = f16mat2x4(f16vec4(0.0hf, 1.0hf, 2.0hf, 3.0hf), f16vec4(4.0hf, 5.0hf, 6.0hf, 7.0hf));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat2x4 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-f16mat2x4 m = f16mat2x4(f16vec4(0.0hf, 1.0hf, 2.0hf, 3.0hf), f16vec4(4.0hf, 5.0hf, 6.0hf, 7.0hf));
diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f16.wgsl.expected.msl
index 88fa42b..522822d 100644
--- a/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f16.wgsl.expected.msl
@@ -5,3 +5,10 @@
half2x4 m;
};
+kernel void f(device half2x4* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half2x4(half4(0.0h, 1.0h, 2.0h, 3.0h), half4(4.0h, 5.0h, 6.0h, 7.0h));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f16.wgsl.expected.spvasm
index a816002..ea0adc7 100644
--- a/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 21
+; Bound: 29
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,10 +9,19 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v4half = OpTypeVector %half 4
%mat2v4half = OpTypeMatrix %v4half 2
@@ -29,9 +38,18 @@
%14 = OpConstantComposite %mat2v4half %8 %13
%_ptr_Private_mat2v4half = OpTypePointer Private %mat2v4half
%m = OpVariable %_ptr_Private_mat2v4half Private %14
+ %out_block = OpTypeStruct %mat2v4half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %17 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %17
- %20 = OpLabel
+ %20 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat2v4half = OpTypePointer StorageBuffer %mat2v4half
+ %f = OpFunction %void None %20
+ %23 = OpLabel
+ %27 = OpAccessChain %_ptr_StorageBuffer_mat2v4half %out %uint_0
+ %28 = OpLoad %mat2v4half %m
+ OpStore %27 %28
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f16.wgsl.expected.wgsl
index 0f49129..d07dd5f 100644
--- a/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f16.wgsl.expected.wgsl
@@ -1,3 +1,10 @@
enable f16;
var<private> m = mat2x4<f16>(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h);
+
+@group(0) @binding(0) var<storage, read_write> out : mat2x4<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl b/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl
index a65308e..1493b10 100644
--- a/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl
@@ -1,2 +1,10 @@
var<private> m = mat2x4<f32>(0.0f, 1.0f, 2.0f, 3.0f,
4.0f, 5.0f, 6.0f, 7.0f);
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat2x4<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl.expected.dxc.hlsl
index 7f63f53..121f8a7 100644
--- a/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl.expected.dxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float2x4 m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
}
-static float2x4 m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl.expected.fxc.hlsl
index 7f63f53..121f8a7 100644
--- a/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl.expected.fxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float2x4 m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
}
-static float2x4 m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl.expected.glsl
index 15a4535..9d859b4 100644
--- a/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl.expected.glsl
@@ -1,7 +1,16 @@
#version 310 es
+mat2x4 m = mat2x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat2x4 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat2x4 m = mat2x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f));
diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl.expected.msl
index 299bd66..a76acee 100644
--- a/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl.expected.msl
@@ -5,3 +5,10 @@
float2x4 m;
};
+kernel void f(device float2x4* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl.expected.spvasm
index c97b583..82ccad1 100644
--- a/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl.expected.spvasm
@@ -1,14 +1,23 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 21
+; Bound: 29
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%mat2v4float = OpTypeMatrix %v4float 2
@@ -25,9 +34,18 @@
%14 = OpConstantComposite %mat2v4float %8 %13
%_ptr_Private_mat2v4float = OpTypePointer Private %mat2v4float
%m = OpVariable %_ptr_Private_mat2v4float Private %14
+ %out_block = OpTypeStruct %mat2v4float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %17 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %17
- %20 = OpLabel
+ %20 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat2v4float = OpTypePointer StorageBuffer %mat2v4float
+ %f = OpFunction %void None %20
+ %23 = OpLabel
+ %27 = OpAccessChain %_ptr_StorageBuffer_mat2v4float %out %uint_0
+ %28 = OpLoad %mat2v4float %m
+ OpStore %27 %28
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl.expected.wgsl
index 0eea600..b1931b5 100644
--- a/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl.expected.wgsl
@@ -1 +1,8 @@
var<private> m = mat2x4<f32>(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f);
+
+@group(0) @binding(0) var<storage, read_write> out : mat2x4<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f16.wgsl b/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f16.wgsl
index 2c00ec6..5c180b3 100644
--- a/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f16.wgsl
@@ -1,3 +1,11 @@
enable f16;
var<private> m = mat2x4<f16>(vec4<f16>(0.0h, 1.0h, 2.0h, 3.0h),
vec4<f16>(4.0h, 5.0h, 6.0h, 7.0h));
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat2x4<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f16.wgsl.expected.dxc.hlsl
index 9fb8b2c..d0b84a6 100644
--- a/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f16.wgsl.expected.dxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 2, 4> m = matrix<float16_t, 2, 4>(vector<float16_t, 4>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 4>(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 2, 4> value) {
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 8u), value[1u]);
}
-static matrix<float16_t, 2, 4> m = matrix<float16_t, 2, 4>(vector<float16_t, 4>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 4>(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f16.wgsl.expected.glsl
index a4b80ad..ba77b50 100644
--- a/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f16.wgsl.expected.glsl
@@ -1,8 +1,17 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
+f16mat2x4 m = f16mat2x4(f16vec4(0.0hf, 1.0hf, 2.0hf, 3.0hf), f16vec4(4.0hf, 5.0hf, 6.0hf, 7.0hf));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat2x4 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-f16mat2x4 m = f16mat2x4(f16vec4(0.0hf, 1.0hf, 2.0hf, 3.0hf), f16vec4(4.0hf, 5.0hf, 6.0hf, 7.0hf));
diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f16.wgsl.expected.msl
index 88fa42b..522822d 100644
--- a/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f16.wgsl.expected.msl
@@ -5,3 +5,10 @@
half2x4 m;
};
+kernel void f(device half2x4* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half2x4(half4(0.0h, 1.0h, 2.0h, 3.0h), half4(4.0h, 5.0h, 6.0h, 7.0h));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f16.wgsl.expected.spvasm
index a816002..ea0adc7 100644
--- a/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 21
+; Bound: 29
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,10 +9,19 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v4half = OpTypeVector %half 4
%mat2v4half = OpTypeMatrix %v4half 2
@@ -29,9 +38,18 @@
%14 = OpConstantComposite %mat2v4half %8 %13
%_ptr_Private_mat2v4half = OpTypePointer Private %mat2v4half
%m = OpVariable %_ptr_Private_mat2v4half Private %14
+ %out_block = OpTypeStruct %mat2v4half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %17 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %17
- %20 = OpLabel
+ %20 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat2v4half = OpTypePointer StorageBuffer %mat2v4half
+ %f = OpFunction %void None %20
+ %23 = OpLabel
+ %27 = OpAccessChain %_ptr_StorageBuffer_mat2v4half %out %uint_0
+ %28 = OpLoad %mat2v4half %m
+ OpStore %27 %28
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f16.wgsl.expected.wgsl
index 6f791d5..3d42a1c 100644
--- a/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f16.wgsl.expected.wgsl
@@ -1,3 +1,10 @@
enable f16;
var<private> m = mat2x4<f16>(vec4<f16>(0.0h, 1.0h, 2.0h, 3.0h), vec4<f16>(4.0h, 5.0h, 6.0h, 7.0h));
+
+@group(0) @binding(0) var<storage, read_write> out : mat2x4<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl b/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl
index 00a8d11..e09c731 100644
--- a/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl
@@ -1,2 +1,10 @@
var<private> m = mat2x4<f32>(vec4<f32>(0.0f, 1.0f, 2.0f, 3.0f),
vec4<f32>(4.0f, 5.0f, 6.0f, 7.0f));
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat2x4<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.dxc.hlsl
index 7f63f53..121f8a7 100644
--- a/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.dxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float2x4 m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
}
-static float2x4 m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.fxc.hlsl
index 7f63f53..121f8a7 100644
--- a/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.fxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float2x4 m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
}
-static float2x4 m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.glsl
index 15a4535..9d859b4 100644
--- a/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.glsl
@@ -1,7 +1,16 @@
#version 310 es
+mat2x4 m = mat2x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat2x4 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat2x4 m = mat2x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f));
diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.msl
index 299bd66..a76acee 100644
--- a/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.msl
@@ -5,3 +5,10 @@
float2x4 m;
};
+kernel void f(device float2x4* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.spvasm
index c97b583..82ccad1 100644
--- a/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.spvasm
@@ -1,14 +1,23 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 21
+; Bound: 29
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%mat2v4float = OpTypeMatrix %v4float 2
@@ -25,9 +34,18 @@
%14 = OpConstantComposite %mat2v4float %8 %13
%_ptr_Private_mat2v4float = OpTypePointer Private %mat2v4float
%m = OpVariable %_ptr_Private_mat2v4float Private %14
+ %out_block = OpTypeStruct %mat2v4float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %17 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %17
- %20 = OpLabel
+ %20 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat2v4float = OpTypePointer StorageBuffer %mat2v4float
+ %f = OpFunction %void None %20
+ %23 = OpLabel
+ %27 = OpAccessChain %_ptr_StorageBuffer_mat2v4float %out %uint_0
+ %28 = OpLoad %mat2v4float %m
+ OpStore %27 %28
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.wgsl
index 760becb..6cf7549 100644
--- a/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.wgsl
@@ -1 +1,8 @@
var<private> m = mat2x4<f32>(vec4<f32>(0.0f, 1.0f, 2.0f, 3.0f), vec4<f32>(4.0f, 5.0f, 6.0f, 7.0f));
+
+@group(0) @binding(0) var<storage, read_write> out : mat2x4<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f16.wgsl b/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f16.wgsl
index c0811f6..8c55c8e 100644
--- a/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f16.wgsl
@@ -2,7 +2,10 @@
var<private> m = mat2x4(mat2x4(0.0h, 1.0h, 2.0h, 3.0h,
4.0h, 5.0h, 6.0h, 7.0h));
-fn f() -> mat2x4<f16> {
- let m_1 = mat2x4(m);
- return m_1;
+@group(0) @binding(0)
+var<storage, read_write> out : mat2x4<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat2x4(m);
}
diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f16.wgsl.expected.dxc.hlsl
index 06dab04..3239ff3 100644
--- a/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f16.wgsl.expected.dxc.hlsl
@@ -1,11 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 2, 4> m = matrix<float16_t, 2, 4>(vector<float16_t, 4>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 4>(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 2, 4> value) {
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 8u), value[1u]);
}
-static matrix<float16_t, 2, 4> m = matrix<float16_t, 2, 4>(vector<float16_t, 4>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 4>(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)));
-
-matrix<float16_t, 2, 4> f() {
- const matrix<float16_t, 2, 4> m_1 = matrix<float16_t, 2, 4>(m);
- return m_1;
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, matrix<float16_t, 2, 4>(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f16.wgsl.expected.glsl
index 5bafb95..ccd1267 100644
--- a/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f16.wgsl.expected.glsl
@@ -1,13 +1,17 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
- return;
-}
f16mat2x4 m = f16mat2x4(f16vec4(0.0hf, 1.0hf, 2.0hf, 3.0hf), f16vec4(4.0hf, 5.0hf, 6.0hf, 7.0hf));
-f16mat2x4 f() {
- f16mat2x4 m_1 = f16mat2x4(m);
- return m_1;
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat2x4 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = f16mat2x4(m);
}
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ f();
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f16.wgsl.expected.msl
index 3bc8b99..a6a4906 100644
--- a/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f16.wgsl.expected.msl
@@ -5,8 +5,10 @@
half2x4 m;
};
-half2x4 f(thread tint_private_vars_struct* const tint_private_vars) {
- half2x4 const m_1 = half2x4((*(tint_private_vars)).m);
- return m_1;
+kernel void f(device half2x4* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half2x4(half4(0.0h, 1.0h, 2.0h, 3.0h), half4(4.0h, 5.0h, 6.0h, 7.0h));
+ *(tint_symbol) = half2x4(tint_private_vars.m);
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f16.wgsl.expected.spvasm
index e94c114..1baf770 100644
--- a/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 26
+; Bound: 30
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,11 +9,19 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v4half = OpTypeVector %half 4
%mat2v4half = OpTypeMatrix %v4half 2
@@ -30,15 +38,18 @@
%14 = OpConstantComposite %mat2v4half %8 %13
%_ptr_Private_mat2v4half = OpTypePointer Private %mat2v4half
%m = OpVariable %_ptr_Private_mat2v4half Private %14
+ %out_block = OpTypeStruct %mat2v4half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %17 = OpTypeFunction %void
- %21 = OpTypeFunction %mat2v4half
-%unused_entry_point = OpFunction %void None %17
- %20 = OpLabel
- OpReturn
- OpFunctionEnd
- %f = OpFunction %mat2v4half None %21
+ %20 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat2v4half = OpTypePointer StorageBuffer %mat2v4half
+ %f = OpFunction %void None %20
%23 = OpLabel
- %25 = OpLoad %mat2v4half %m
- OpReturnValue %25
+ %27 = OpAccessChain %_ptr_StorageBuffer_mat2v4half %out %uint_0
+ %29 = OpLoad %mat2v4half %m
+ OpStore %27 %29
+ OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f16.wgsl.expected.wgsl
index 31b8791..a4c5eea 100644
--- a/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f16.wgsl.expected.wgsl
@@ -2,7 +2,9 @@
var<private> m = mat2x4(mat2x4(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h));
-fn f() -> mat2x4<f16> {
- let m_1 = mat2x4(m);
- return m_1;
+@group(0) @binding(0) var<storage, read_write> out : mat2x4<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat2x4(m);
}
diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f32.wgsl b/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f32.wgsl
index 345e097..b354cbe 100644
--- a/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f32.wgsl
@@ -1,7 +1,10 @@
var<private> m = mat2x4(mat2x4(0.0f, 1.0f, 2.0f, 3.0f,
4.0f, 5.0f, 6.0f, 7.0f));
-fn f() -> mat2x4<f32> {
- let m_1 = mat2x4(m);
- return m_1;
+@group(0) @binding(0)
+var<storage, read_write> out : mat2x4<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat2x4(m);
}
diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f32.wgsl.expected.dxc.hlsl
index b37e3b7..180aad1 100644
--- a/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f32.wgsl.expected.dxc.hlsl
@@ -1,11 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float2x4 m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
}
-static float2x4 m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f));
-
-float2x4 f() {
- const float2x4 m_1 = float2x4(m);
- return m_1;
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float2x4(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f32.wgsl.expected.fxc.hlsl
index b37e3b7..180aad1 100644
--- a/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f32.wgsl.expected.fxc.hlsl
@@ -1,11 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float2x4 m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
}
-static float2x4 m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f));
-
-float2x4 f() {
- const float2x4 m_1 = float2x4(m);
- return m_1;
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float2x4(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f32.wgsl.expected.glsl
index 06eabf0..d6488ea 100644
--- a/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f32.wgsl.expected.glsl
@@ -1,12 +1,16 @@
#version 310 es
-layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
- return;
-}
mat2x4 m = mat2x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f));
-mat2x4 f() {
- mat2x4 m_1 = mat2x4(m);
- return m_1;
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat2x4 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = mat2x4(m);
}
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ f();
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f32.wgsl.expected.msl
index 8d39f84..dce30ae 100644
--- a/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f32.wgsl.expected.msl
@@ -5,8 +5,10 @@
float2x4 m;
};
-float2x4 f(thread tint_private_vars_struct* const tint_private_vars) {
- float2x4 const m_1 = float2x4((*(tint_private_vars)).m);
- return m_1;
+kernel void f(device float2x4* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f));
+ *(tint_symbol) = float2x4(tint_private_vars.m);
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f32.wgsl.expected.spvasm
index 6dbb4ce..2fcc27e 100644
--- a/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f32.wgsl.expected.spvasm
@@ -1,15 +1,23 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 26
+; Bound: 30
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%mat2v4float = OpTypeMatrix %v4float 2
@@ -26,15 +34,18 @@
%14 = OpConstantComposite %mat2v4float %8 %13
%_ptr_Private_mat2v4float = OpTypePointer Private %mat2v4float
%m = OpVariable %_ptr_Private_mat2v4float Private %14
+ %out_block = OpTypeStruct %mat2v4float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %17 = OpTypeFunction %void
- %21 = OpTypeFunction %mat2v4float
-%unused_entry_point = OpFunction %void None %17
- %20 = OpLabel
- OpReturn
- OpFunctionEnd
- %f = OpFunction %mat2v4float None %21
+ %20 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat2v4float = OpTypePointer StorageBuffer %mat2v4float
+ %f = OpFunction %void None %20
%23 = OpLabel
- %25 = OpLoad %mat2v4float %m
- OpReturnValue %25
+ %27 = OpAccessChain %_ptr_StorageBuffer_mat2v4float %out %uint_0
+ %29 = OpLoad %mat2v4float %m
+ OpStore %27 %29
+ OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f32.wgsl.expected.wgsl
index 3e388e1..92cc05b 100644
--- a/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f32.wgsl.expected.wgsl
@@ -1,6 +1,8 @@
var<private> m = mat2x4(mat2x4(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f));
-fn f() -> mat2x4<f32> {
- let m_1 = mat2x4(m);
- return m_1;
+@group(0) @binding(0) var<storage, read_write> out : mat2x4<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat2x4(m);
}
diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/abstract-float.wgsl b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/abstract-float.wgsl
index 0fb3201..450048a 100644
--- a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/abstract-float.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/abstract-float.wgsl
@@ -1,2 +1,10 @@
-var<private> m = mat2x4(0.0, 1.0, 2.0, 3.0,
- 4.0, 5.0, 6.0, 7.0);
+const m = mat2x4(0.0, 1.0, 2.0, 3.0,
+ 4.0, 5.0, 6.0, 7.0);
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat2x4<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl
index 7f63f53..bd3dd4a 100644
--- a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl
@@ -1,6 +1,12 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
}
-static float2x4 m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f)));
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl
index 7f63f53..bd3dd4a 100644
--- a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl
@@ -1,6 +1,12 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
}
-static float2x4 m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f)));
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/abstract-float.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/abstract-float.wgsl.expected.glsl
index 15a4535..208de94 100644
--- a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/abstract-float.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/abstract-float.wgsl.expected.glsl
@@ -1,7 +1,15 @@
#version 310 es
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat2x4 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = mat2x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f));
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat2x4 m = mat2x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f));
diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/abstract-float.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/abstract-float.wgsl.expected.msl
index 299bd66..a6a2dc1 100644
--- a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/abstract-float.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/abstract-float.wgsl.expected.msl
@@ -1,7 +1,8 @@
#include <metal_stdlib>
using namespace metal;
-struct tint_private_vars_struct {
- float2x4 m;
-};
+kernel void f(device float2x4* tint_symbol [[buffer(0)]]) {
+ *(tint_symbol) = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f));
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/abstract-float.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/abstract-float.wgsl.expected.spvasm
index c97b583..b7e7163 100644
--- a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/abstract-float.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/abstract-float.wgsl.expected.spvasm
@@ -1,33 +1,47 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 21
+; Bound: 26
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
- OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%mat2v4float = OpTypeMatrix %v4float 2
- %4 = OpConstantNull %float
+ %out_block = OpTypeStruct %mat2v4float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat2v4float = OpTypePointer StorageBuffer %mat2v4float
+ %15 = OpConstantNull %float
%float_1 = OpConstant %float 1
%float_2 = OpConstant %float 2
%float_3 = OpConstant %float 3
- %8 = OpConstantComposite %v4float %4 %float_1 %float_2 %float_3
+ %19 = OpConstantComposite %v4float %15 %float_1 %float_2 %float_3
%float_4 = OpConstant %float 4
%float_5 = OpConstant %float 5
%float_6 = OpConstant %float 6
%float_7 = OpConstant %float 7
- %13 = OpConstantComposite %v4float %float_4 %float_5 %float_6 %float_7
- %14 = OpConstantComposite %mat2v4float %8 %13
-%_ptr_Private_mat2v4float = OpTypePointer Private %mat2v4float
- %m = OpVariable %_ptr_Private_mat2v4float Private %14
- %void = OpTypeVoid
- %17 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %17
- %20 = OpLabel
+ %24 = OpConstantComposite %v4float %float_4 %float_5 %float_6 %float_7
+ %25 = OpConstantComposite %mat2v4float %19 %24
+ %f = OpFunction %void None %7
+ %10 = OpLabel
+ %14 = OpAccessChain %_ptr_StorageBuffer_mat2v4float %out %uint_0
+ OpStore %14 %25
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/abstract-float.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/abstract-float.wgsl.expected.wgsl
index 7103b47..e402db8 100644
--- a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/abstract-float.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/abstract-float.wgsl.expected.wgsl
@@ -1 +1,8 @@
-var<private> m = mat2x4(0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0);
+const m = mat2x4(0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0);
+
+@group(0) @binding(0) var<storage, read_write> out : mat2x4<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f16.wgsl b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f16.wgsl
index d66ba4d..b3ebedf 100644
--- a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f16.wgsl
@@ -1,3 +1,11 @@
enable f16;
var<private> m = mat2x4(0.0h, 1.0h, 2.0h, 3.0h,
4.0h, 5.0h, 6.0h, 7.0h);
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat2x4<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f16.wgsl.expected.dxc.hlsl
index 9fb8b2c..d0b84a6 100644
--- a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f16.wgsl.expected.dxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 2, 4> m = matrix<float16_t, 2, 4>(vector<float16_t, 4>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 4>(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 2, 4> value) {
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 8u), value[1u]);
}
-static matrix<float16_t, 2, 4> m = matrix<float16_t, 2, 4>(vector<float16_t, 4>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 4>(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f16.wgsl.expected.glsl
index a4b80ad..ba77b50 100644
--- a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f16.wgsl.expected.glsl
@@ -1,8 +1,17 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
+f16mat2x4 m = f16mat2x4(f16vec4(0.0hf, 1.0hf, 2.0hf, 3.0hf), f16vec4(4.0hf, 5.0hf, 6.0hf, 7.0hf));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat2x4 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-f16mat2x4 m = f16mat2x4(f16vec4(0.0hf, 1.0hf, 2.0hf, 3.0hf), f16vec4(4.0hf, 5.0hf, 6.0hf, 7.0hf));
diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f16.wgsl.expected.msl
index 88fa42b..522822d 100644
--- a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f16.wgsl.expected.msl
@@ -5,3 +5,10 @@
half2x4 m;
};
+kernel void f(device half2x4* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half2x4(half4(0.0h, 1.0h, 2.0h, 3.0h), half4(4.0h, 5.0h, 6.0h, 7.0h));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f16.wgsl.expected.spvasm
index a816002..ea0adc7 100644
--- a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 21
+; Bound: 29
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,10 +9,19 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v4half = OpTypeVector %half 4
%mat2v4half = OpTypeMatrix %v4half 2
@@ -29,9 +38,18 @@
%14 = OpConstantComposite %mat2v4half %8 %13
%_ptr_Private_mat2v4half = OpTypePointer Private %mat2v4half
%m = OpVariable %_ptr_Private_mat2v4half Private %14
+ %out_block = OpTypeStruct %mat2v4half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %17 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %17
- %20 = OpLabel
+ %20 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat2v4half = OpTypePointer StorageBuffer %mat2v4half
+ %f = OpFunction %void None %20
+ %23 = OpLabel
+ %27 = OpAccessChain %_ptr_StorageBuffer_mat2v4half %out %uint_0
+ %28 = OpLoad %mat2v4half %m
+ OpStore %27 %28
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f16.wgsl.expected.wgsl
index 6d7353b..815b9b1 100644
--- a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f16.wgsl.expected.wgsl
@@ -1,3 +1,10 @@
enable f16;
var<private> m = mat2x4(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h);
+
+@group(0) @binding(0) var<storage, read_write> out : mat2x4<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl
index ea9a9c4..fa50a69 100644
--- a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl
@@ -1,2 +1,10 @@
var<private> m = mat2x4(0.0f, 1.0f, 2.0f, 3.0f,
4.0f, 5.0f, 6.0f, 7.0f);
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat2x4<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl.expected.dxc.hlsl
index 7f63f53..121f8a7 100644
--- a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl.expected.dxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float2x4 m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
}
-static float2x4 m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl.expected.fxc.hlsl
index 7f63f53..121f8a7 100644
--- a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl.expected.fxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float2x4 m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
}
-static float2x4 m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl.expected.glsl
index 15a4535..9d859b4 100644
--- a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl.expected.glsl
@@ -1,7 +1,16 @@
#version 310 es
+mat2x4 m = mat2x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat2x4 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat2x4 m = mat2x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f));
diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl.expected.msl
index 299bd66..a76acee 100644
--- a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl.expected.msl
@@ -5,3 +5,10 @@
float2x4 m;
};
+kernel void f(device float2x4* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl.expected.spvasm
index c97b583..82ccad1 100644
--- a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl.expected.spvasm
@@ -1,14 +1,23 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 21
+; Bound: 29
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%mat2v4float = OpTypeMatrix %v4float 2
@@ -25,9 +34,18 @@
%14 = OpConstantComposite %mat2v4float %8 %13
%_ptr_Private_mat2v4float = OpTypePointer Private %mat2v4float
%m = OpVariable %_ptr_Private_mat2v4float Private %14
+ %out_block = OpTypeStruct %mat2v4float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %17 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %17
- %20 = OpLabel
+ %20 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat2v4float = OpTypePointer StorageBuffer %mat2v4float
+ %f = OpFunction %void None %20
+ %23 = OpLabel
+ %27 = OpAccessChain %_ptr_StorageBuffer_mat2v4float %out %uint_0
+ %28 = OpLoad %mat2v4float %m
+ OpStore %27 %28
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl.expected.wgsl
index 7e04fcf..68d022e 100644
--- a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl.expected.wgsl
@@ -1 +1,8 @@
var<private> m = mat2x4(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f);
+
+@group(0) @binding(0) var<storage, read_write> out : mat2x4<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/abstract-float.wgsl b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/abstract-float.wgsl
index db96125..dd23f20 100644
--- a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/abstract-float.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/abstract-float.wgsl
@@ -1,2 +1,10 @@
-var<private> m = mat2x4(vec4(0.0, 1.0, 2.0, 3.0),
- vec4(4.0, 5.0, 6.0, 7.0));
+const m = mat2x4(vec4(0.0, 1.0, 2.0, 3.0),
+ vec4(4.0, 5.0, 6.0, 7.0));
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat2x4<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl
index 7f63f53..bd3dd4a 100644
--- a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl
@@ -1,6 +1,12 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
}
-static float2x4 m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f)));
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl
index 7f63f53..bd3dd4a 100644
--- a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl
@@ -1,6 +1,12 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
}
-static float2x4 m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f)));
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/abstract-float.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/abstract-float.wgsl.expected.glsl
index 15a4535..208de94 100644
--- a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/abstract-float.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/abstract-float.wgsl.expected.glsl
@@ -1,7 +1,15 @@
#version 310 es
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat2x4 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = mat2x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f));
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat2x4 m = mat2x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f));
diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/abstract-float.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/abstract-float.wgsl.expected.msl
index 299bd66..a6a2dc1 100644
--- a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/abstract-float.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/abstract-float.wgsl.expected.msl
@@ -1,7 +1,8 @@
#include <metal_stdlib>
using namespace metal;
-struct tint_private_vars_struct {
- float2x4 m;
-};
+kernel void f(device float2x4* tint_symbol [[buffer(0)]]) {
+ *(tint_symbol) = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f));
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/abstract-float.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/abstract-float.wgsl.expected.spvasm
index c97b583..b7e7163 100644
--- a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/abstract-float.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/abstract-float.wgsl.expected.spvasm
@@ -1,33 +1,47 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 21
+; Bound: 26
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
- OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%mat2v4float = OpTypeMatrix %v4float 2
- %4 = OpConstantNull %float
+ %out_block = OpTypeStruct %mat2v4float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat2v4float = OpTypePointer StorageBuffer %mat2v4float
+ %15 = OpConstantNull %float
%float_1 = OpConstant %float 1
%float_2 = OpConstant %float 2
%float_3 = OpConstant %float 3
- %8 = OpConstantComposite %v4float %4 %float_1 %float_2 %float_3
+ %19 = OpConstantComposite %v4float %15 %float_1 %float_2 %float_3
%float_4 = OpConstant %float 4
%float_5 = OpConstant %float 5
%float_6 = OpConstant %float 6
%float_7 = OpConstant %float 7
- %13 = OpConstantComposite %v4float %float_4 %float_5 %float_6 %float_7
- %14 = OpConstantComposite %mat2v4float %8 %13
-%_ptr_Private_mat2v4float = OpTypePointer Private %mat2v4float
- %m = OpVariable %_ptr_Private_mat2v4float Private %14
- %void = OpTypeVoid
- %17 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %17
- %20 = OpLabel
+ %24 = OpConstantComposite %v4float %float_4 %float_5 %float_6 %float_7
+ %25 = OpConstantComposite %mat2v4float %19 %24
+ %f = OpFunction %void None %7
+ %10 = OpLabel
+ %14 = OpAccessChain %_ptr_StorageBuffer_mat2v4float %out %uint_0
+ OpStore %14 %25
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/abstract-float.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/abstract-float.wgsl.expected.wgsl
index 7f64fdb..7d7814d 100644
--- a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/abstract-float.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/abstract-float.wgsl.expected.wgsl
@@ -1 +1,8 @@
-var<private> m = mat2x4(vec4(0.0, 1.0, 2.0, 3.0), vec4(4.0, 5.0, 6.0, 7.0));
+const m = mat2x4(vec4(0.0, 1.0, 2.0, 3.0), vec4(4.0, 5.0, 6.0, 7.0));
+
+@group(0) @binding(0) var<storage, read_write> out : mat2x4<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f16.wgsl b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f16.wgsl
index d6d5547..b3be168 100644
--- a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f16.wgsl
@@ -1,3 +1,11 @@
enable f16;
var<private> m = mat2x4(vec4<f16>(0.0h, 1.0h, 2.0h, 3.0h),
vec4<f16>(4.0h, 5.0h, 6.0h, 7.0h));
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat2x4<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f16.wgsl.expected.dxc.hlsl
index 9fb8b2c..d0b84a6 100644
--- a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f16.wgsl.expected.dxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 2, 4> m = matrix<float16_t, 2, 4>(vector<float16_t, 4>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 4>(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 2, 4> value) {
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 8u), value[1u]);
}
-static matrix<float16_t, 2, 4> m = matrix<float16_t, 2, 4>(vector<float16_t, 4>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 4>(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f16.wgsl.expected.glsl
index a4b80ad..ba77b50 100644
--- a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f16.wgsl.expected.glsl
@@ -1,8 +1,17 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
+f16mat2x4 m = f16mat2x4(f16vec4(0.0hf, 1.0hf, 2.0hf, 3.0hf), f16vec4(4.0hf, 5.0hf, 6.0hf, 7.0hf));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat2x4 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-f16mat2x4 m = f16mat2x4(f16vec4(0.0hf, 1.0hf, 2.0hf, 3.0hf), f16vec4(4.0hf, 5.0hf, 6.0hf, 7.0hf));
diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f16.wgsl.expected.msl
index 88fa42b..522822d 100644
--- a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f16.wgsl.expected.msl
@@ -5,3 +5,10 @@
half2x4 m;
};
+kernel void f(device half2x4* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half2x4(half4(0.0h, 1.0h, 2.0h, 3.0h), half4(4.0h, 5.0h, 6.0h, 7.0h));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f16.wgsl.expected.spvasm
index a816002..ea0adc7 100644
--- a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 21
+; Bound: 29
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,10 +9,19 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v4half = OpTypeVector %half 4
%mat2v4half = OpTypeMatrix %v4half 2
@@ -29,9 +38,18 @@
%14 = OpConstantComposite %mat2v4half %8 %13
%_ptr_Private_mat2v4half = OpTypePointer Private %mat2v4half
%m = OpVariable %_ptr_Private_mat2v4half Private %14
+ %out_block = OpTypeStruct %mat2v4half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %17 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %17
- %20 = OpLabel
+ %20 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat2v4half = OpTypePointer StorageBuffer %mat2v4half
+ %f = OpFunction %void None %20
+ %23 = OpLabel
+ %27 = OpAccessChain %_ptr_StorageBuffer_mat2v4half %out %uint_0
+ %28 = OpLoad %mat2v4half %m
+ OpStore %27 %28
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f16.wgsl.expected.wgsl
index 4c61cd0..6b9e5a3 100644
--- a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f16.wgsl.expected.wgsl
@@ -1,3 +1,10 @@
enable f16;
var<private> m = mat2x4(vec4<f16>(0.0h, 1.0h, 2.0h, 3.0h), vec4<f16>(4.0h, 5.0h, 6.0h, 7.0h));
+
+@group(0) @binding(0) var<storage, read_write> out : mat2x4<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl
index 946f9ad..f7c906d 100644
--- a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl
@@ -1,2 +1,10 @@
var<private> m = mat2x4(vec4<f32>(0.0f, 1.0f, 2.0f, 3.0f),
vec4<f32>(4.0f, 5.0f, 6.0f, 7.0f));
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat2x4<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl.expected.dxc.hlsl
index 7f63f53..121f8a7 100644
--- a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl.expected.dxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float2x4 m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
}
-static float2x4 m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl.expected.fxc.hlsl
index 7f63f53..121f8a7 100644
--- a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl.expected.fxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float2x4 m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
}
-static float2x4 m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl.expected.glsl
index 15a4535..9d859b4 100644
--- a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl.expected.glsl
@@ -1,7 +1,16 @@
#version 310 es
+mat2x4 m = mat2x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat2x4 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat2x4 m = mat2x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f));
diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl.expected.msl
index 299bd66..a76acee 100644
--- a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl.expected.msl
@@ -5,3 +5,10 @@
float2x4 m;
};
+kernel void f(device float2x4* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl.expected.spvasm
index c97b583..82ccad1 100644
--- a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl.expected.spvasm
@@ -1,14 +1,23 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 21
+; Bound: 29
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%mat2v4float = OpTypeMatrix %v4float 2
@@ -25,9 +34,18 @@
%14 = OpConstantComposite %mat2v4float %8 %13
%_ptr_Private_mat2v4float = OpTypePointer Private %mat2v4float
%m = OpVariable %_ptr_Private_mat2v4float Private %14
+ %out_block = OpTypeStruct %mat2v4float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %17 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %17
- %20 = OpLabel
+ %20 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat2v4float = OpTypePointer StorageBuffer %mat2v4float
+ %f = OpFunction %void None %20
+ %23 = OpLabel
+ %27 = OpAccessChain %_ptr_StorageBuffer_mat2v4float %out %uint_0
+ %28 = OpLoad %mat2v4float %m
+ OpStore %27 %28
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl.expected.wgsl
index 5e4e09a..5afaede 100644
--- a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl.expected.wgsl
@@ -1 +1,8 @@
var<private> m = mat2x4(vec4<f32>(0.0f, 1.0f, 2.0f, 3.0f), vec4<f32>(4.0f, 5.0f, 6.0f, 7.0f));
+
+@group(0) @binding(0) var<storage, read_write> out : mat2x4<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x4/load/f16.wgsl b/test/tint/expressions/type_ctor/mat2x4/load/f16.wgsl
index 6cbe666..72f4a69 100644
--- a/test/tint/expressions/type_ctor/mat2x4/load/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x4/load/f16.wgsl
@@ -1,5 +1,10 @@
enable f16;
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat2x4<f16>;
+
+@compute @workgroup_size(1)
fn f() {
- var m = mat2x4<f16>();
- let m_1 = mat2x4(m);
+ var m = mat2x4<f16>();
+ out = mat2x4(m);
}
diff --git a/test/tint/expressions/type_ctor/mat2x4/load/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/load/f16.wgsl.expected.dxc.hlsl
index 47aedf9..9a30b62 100644
--- a/test/tint/expressions/type_ctor/mat2x4/load/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x4/load/f16.wgsl.expected.dxc.hlsl
@@ -1,9 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 2, 4> value) {
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 8u), value[1u]);
}
+[numthreads(1, 1, 1)]
void f() {
matrix<float16_t, 2, 4> m = matrix<float16_t, 2, 4>((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx);
- const matrix<float16_t, 2, 4> m_1 = matrix<float16_t, 2, 4>(m);
+ tint_symbol_store(0u, matrix<float16_t, 2, 4>(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat2x4/load/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x4/load/f16.wgsl.expected.glsl
index 716fbaf..8069744 100644
--- a/test/tint/expressions/type_ctor/mat2x4/load/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat2x4/load/f16.wgsl.expected.glsl
@@ -1,12 +1,17 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
- return;
-}
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat2x4 inner;
+} tint_symbol;
+
void f() {
f16mat2x4 m = f16mat2x4(f16vec4(0.0hf), f16vec4(0.0hf));
- f16mat2x4 m_1 = f16mat2x4(m);
+ tint_symbol.inner = f16mat2x4(m);
}
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ f();
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x4/load/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x4/load/f16.wgsl.expected.msl
index 0e7df1d..1781a86 100644
--- a/test/tint/expressions/type_ctor/mat2x4/load/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat2x4/load/f16.wgsl.expected.msl
@@ -1,8 +1,9 @@
#include <metal_stdlib>
using namespace metal;
-void f() {
+kernel void f(device half2x4* tint_symbol [[buffer(0)]]) {
half2x4 m = half2x4(half4(0.0h), half4(0.0h));
- half2x4 const m_1 = half2x4(m);
+ *(tint_symbol) = half2x4(m);
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat2x4/load/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x4/load/f16.wgsl.expected.spvasm
index b3d7fe0..ac3437e 100644
--- a/test/tint/expressions/type_ctor/mat2x4/load/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat2x4/load/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 15
+; Bound: 20
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,26 +9,38 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
- OpName %unused_entry_point "unused_entry_point"
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
OpName %f "f"
OpName %m "m"
- %void = OpTypeVoid
- %1 = OpTypeFunction %void
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v4half = OpTypeVector %half 4
%mat2v4half = OpTypeMatrix %v4half 2
- %10 = OpConstantNull %mat2v4half
+ %out_block = OpTypeStruct %mat2v4half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void
+ %11 = OpConstantNull %mat2v4half
%_ptr_Function_mat2v4half = OpTypePointer Function %mat2v4half
-%unused_entry_point = OpFunction %void None %1
- %4 = OpLabel
- OpReturn
- OpFunctionEnd
- %f = OpFunction %void None %1
- %6 = OpLabel
- %m = OpVariable %_ptr_Function_mat2v4half Function %10
- OpStore %m %10
- %14 = OpLoad %mat2v4half %m
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat2v4half = OpTypePointer StorageBuffer %mat2v4half
+ %f = OpFunction %void None %7
+ %10 = OpLabel
+ %m = OpVariable %_ptr_Function_mat2v4half Function %11
+ OpStore %m %11
+ %17 = OpAccessChain %_ptr_StorageBuffer_mat2v4half %out %uint_0
+ %19 = OpLoad %mat2v4half %m
+ OpStore %17 %19
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat2x4/load/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x4/load/f16.wgsl.expected.wgsl
index 9d30a05..e9136c5 100644
--- a/test/tint/expressions/type_ctor/mat2x4/load/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x4/load/f16.wgsl.expected.wgsl
@@ -1,6 +1,9 @@
enable f16;
+@group(0) @binding(0) var<storage, read_write> out : mat2x4<f16>;
+
+@compute @workgroup_size(1)
fn f() {
var m = mat2x4<f16>();
- let m_1 = mat2x4(m);
+ out = mat2x4(m);
}
diff --git a/test/tint/expressions/type_ctor/mat2x4/load/f32.wgsl b/test/tint/expressions/type_ctor/mat2x4/load/f32.wgsl
index a4a11f6..812d749 100644
--- a/test/tint/expressions/type_ctor/mat2x4/load/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x4/load/f32.wgsl
@@ -1,4 +1,8 @@
+@group(0) @binding(0)
+var<storage, read_write> out : mat2x4<f32>;
+
+@compute @workgroup_size(1)
fn f() {
- var m = mat2x4<f32>();
- let m_1 = mat2x4(m);
+ var m = mat2x4<f32>();
+ out = mat2x4(m);
}
diff --git a/test/tint/expressions/type_ctor/mat2x4/load/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/load/f32.wgsl.expected.dxc.hlsl
index 17da42a..1c3adcc 100644
--- a/test/tint/expressions/type_ctor/mat2x4/load/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x4/load/f32.wgsl.expected.dxc.hlsl
@@ -1,9 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
}
+[numthreads(1, 1, 1)]
void f() {
float2x4 m = float2x4((0.0f).xxxx, (0.0f).xxxx);
- const float2x4 m_1 = float2x4(m);
+ tint_symbol_store(0u, float2x4(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat2x4/load/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/load/f32.wgsl.expected.fxc.hlsl
index 17da42a..1c3adcc 100644
--- a/test/tint/expressions/type_ctor/mat2x4/load/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x4/load/f32.wgsl.expected.fxc.hlsl
@@ -1,9 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
}
+[numthreads(1, 1, 1)]
void f() {
float2x4 m = float2x4((0.0f).xxxx, (0.0f).xxxx);
- const float2x4 m_1 = float2x4(m);
+ tint_symbol_store(0u, float2x4(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat2x4/load/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x4/load/f32.wgsl.expected.glsl
index f05ce0b..21eaba6 100644
--- a/test/tint/expressions/type_ctor/mat2x4/load/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat2x4/load/f32.wgsl.expected.glsl
@@ -1,11 +1,16 @@
#version 310 es
-layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
- return;
-}
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat2x4 inner;
+} tint_symbol;
+
void f() {
mat2x4 m = mat2x4(vec4(0.0f), vec4(0.0f));
- mat2x4 m_1 = mat2x4(m);
+ tint_symbol.inner = mat2x4(m);
}
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ f();
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x4/load/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x4/load/f32.wgsl.expected.msl
index 46b1478..e5f7583 100644
--- a/test/tint/expressions/type_ctor/mat2x4/load/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat2x4/load/f32.wgsl.expected.msl
@@ -1,8 +1,9 @@
#include <metal_stdlib>
using namespace metal;
-void f() {
+kernel void f(device float2x4* tint_symbol [[buffer(0)]]) {
float2x4 m = float2x4(float4(0.0f), float4(0.0f));
- float2x4 const m_1 = float2x4(m);
+ *(tint_symbol) = float2x4(m);
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat2x4/load/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x4/load/f32.wgsl.expected.spvasm
index 121e516..17811eb 100644
--- a/test/tint/expressions/type_ctor/mat2x4/load/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat2x4/load/f32.wgsl.expected.spvasm
@@ -1,30 +1,42 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 15
+; Bound: 20
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
- OpName %unused_entry_point "unused_entry_point"
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
OpName %f "f"
OpName %m "m"
- %void = OpTypeVoid
- %1 = OpTypeFunction %void
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%mat2v4float = OpTypeMatrix %v4float 2
- %10 = OpConstantNull %mat2v4float
+ %out_block = OpTypeStruct %mat2v4float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void
+ %11 = OpConstantNull %mat2v4float
%_ptr_Function_mat2v4float = OpTypePointer Function %mat2v4float
-%unused_entry_point = OpFunction %void None %1
- %4 = OpLabel
- OpReturn
- OpFunctionEnd
- %f = OpFunction %void None %1
- %6 = OpLabel
- %m = OpVariable %_ptr_Function_mat2v4float Function %10
- OpStore %m %10
- %14 = OpLoad %mat2v4float %m
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat2v4float = OpTypePointer StorageBuffer %mat2v4float
+ %f = OpFunction %void None %7
+ %10 = OpLabel
+ %m = OpVariable %_ptr_Function_mat2v4float Function %11
+ OpStore %m %11
+ %17 = OpAccessChain %_ptr_StorageBuffer_mat2v4float %out %uint_0
+ %19 = OpLoad %mat2v4float %m
+ OpStore %17 %19
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat2x4/load/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x4/load/f32.wgsl.expected.wgsl
index 0cd645c..8612d15 100644
--- a/test/tint/expressions/type_ctor/mat2x4/load/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x4/load/f32.wgsl.expected.wgsl
@@ -1,4 +1,7 @@
+@group(0) @binding(0) var<storage, read_write> out : mat2x4<f32>;
+
+@compute @workgroup_size(1)
fn f() {
var m = mat2x4<f32>();
- let m_1 = mat2x4(m);
+ out = mat2x4(m);
}
diff --git a/test/tint/expressions/type_ctor/mat2x4/zero/f16.wgsl b/test/tint/expressions/type_ctor/mat2x4/zero/f16.wgsl
index 08392d4..8689e03 100644
--- a/test/tint/expressions/type_ctor/mat2x4/zero/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x4/zero/f16.wgsl
@@ -1,2 +1,10 @@
enable f16;
var<private> m = mat2x4<f16>();
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat2x4<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x4/zero/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/zero/f16.wgsl.expected.dxc.hlsl
index acaa3fa..b0084ed 100644
--- a/test/tint/expressions/type_ctor/mat2x4/zero/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x4/zero/f16.wgsl.expected.dxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 2, 4> m = matrix<float16_t, 2, 4>((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx);
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 2, 4> value) {
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 8u), value[1u]);
}
-static matrix<float16_t, 2, 4> m = matrix<float16_t, 2, 4>((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx);
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x4/zero/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x4/zero/f16.wgsl.expected.glsl
index 4d4c48c..7319ed4 100644
--- a/test/tint/expressions/type_ctor/mat2x4/zero/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat2x4/zero/f16.wgsl.expected.glsl
@@ -1,8 +1,17 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
+f16mat2x4 m = f16mat2x4(f16vec4(0.0hf), f16vec4(0.0hf));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat2x4 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-f16mat2x4 m = f16mat2x4(f16vec4(0.0hf), f16vec4(0.0hf));
diff --git a/test/tint/expressions/type_ctor/mat2x4/zero/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x4/zero/f16.wgsl.expected.msl
index 88fa42b..22e9f76 100644
--- a/test/tint/expressions/type_ctor/mat2x4/zero/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat2x4/zero/f16.wgsl.expected.msl
@@ -5,3 +5,10 @@
half2x4 m;
};
+kernel void f(device half2x4* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half2x4(half4(0.0h), half4(0.0h));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat2x4/zero/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x4/zero/f16.wgsl.expected.spvasm
index 175bb39..27e9bd1 100644
--- a/test/tint/expressions/type_ctor/mat2x4/zero/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat2x4/zero/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 11
+; Bound: 19
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,19 +9,37 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v4half = OpTypeVector %half 4
%mat2v4half = OpTypeMatrix %v4half 2
%4 = OpConstantNull %mat2v4half
%_ptr_Private_mat2v4half = OpTypePointer Private %mat2v4half
%m = OpVariable %_ptr_Private_mat2v4half Private %4
+ %out_block = OpTypeStruct %mat2v4half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %7 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %7
- %10 = OpLabel
+ %10 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat2v4half = OpTypePointer StorageBuffer %mat2v4half
+ %f = OpFunction %void None %10
+ %13 = OpLabel
+ %17 = OpAccessChain %_ptr_StorageBuffer_mat2v4half %out %uint_0
+ %18 = OpLoad %mat2v4half %m
+ OpStore %17 %18
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat2x4/zero/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x4/zero/f16.wgsl.expected.wgsl
index ec878ca..0dfccdc 100644
--- a/test/tint/expressions/type_ctor/mat2x4/zero/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x4/zero/f16.wgsl.expected.wgsl
@@ -1,3 +1,10 @@
enable f16;
var<private> m = mat2x4<f16>();
+
+@group(0) @binding(0) var<storage, read_write> out : mat2x4<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x4/zero/f32.wgsl b/test/tint/expressions/type_ctor/mat2x4/zero/f32.wgsl
index f9c67c8..44644b2 100644
--- a/test/tint/expressions/type_ctor/mat2x4/zero/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x4/zero/f32.wgsl
@@ -1 +1,9 @@
var<private> m = mat2x4<f32>();
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat2x4<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x4/zero/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/zero/f32.wgsl.expected.dxc.hlsl
index aaeb1e0..b66128f 100644
--- a/test/tint/expressions/type_ctor/mat2x4/zero/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x4/zero/f32.wgsl.expected.dxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float2x4 m = float2x4((0.0f).xxxx, (0.0f).xxxx);
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
}
-static float2x4 m = float2x4((0.0f).xxxx, (0.0f).xxxx);
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x4/zero/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/zero/f32.wgsl.expected.fxc.hlsl
index aaeb1e0..b66128f 100644
--- a/test/tint/expressions/type_ctor/mat2x4/zero/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat2x4/zero/f32.wgsl.expected.fxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float2x4 m = float2x4((0.0f).xxxx, (0.0f).xxxx);
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float2x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
}
-static float2x4 m = float2x4((0.0f).xxxx, (0.0f).xxxx);
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat2x4/zero/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x4/zero/f32.wgsl.expected.glsl
index addaec5..1ac36de 100644
--- a/test/tint/expressions/type_ctor/mat2x4/zero/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat2x4/zero/f32.wgsl.expected.glsl
@@ -1,7 +1,16 @@
#version 310 es
+mat2x4 m = mat2x4(vec4(0.0f), vec4(0.0f));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat2x4 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat2x4 m = mat2x4(vec4(0.0f), vec4(0.0f));
diff --git a/test/tint/expressions/type_ctor/mat2x4/zero/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x4/zero/f32.wgsl.expected.msl
index 299bd66..0feade0 100644
--- a/test/tint/expressions/type_ctor/mat2x4/zero/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat2x4/zero/f32.wgsl.expected.msl
@@ -5,3 +5,10 @@
float2x4 m;
};
+kernel void f(device float2x4* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float2x4(float4(0.0f), float4(0.0f));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat2x4/zero/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x4/zero/f32.wgsl.expected.spvasm
index edf312f..3c9bd73 100644
--- a/test/tint/expressions/type_ctor/mat2x4/zero/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat2x4/zero/f32.wgsl.expected.spvasm
@@ -1,23 +1,41 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 11
+; Bound: 19
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%mat2v4float = OpTypeMatrix %v4float 2
%4 = OpConstantNull %mat2v4float
%_ptr_Private_mat2v4float = OpTypePointer Private %mat2v4float
%m = OpVariable %_ptr_Private_mat2v4float Private %4
+ %out_block = OpTypeStruct %mat2v4float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %7 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %7
- %10 = OpLabel
+ %10 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat2v4float = OpTypePointer StorageBuffer %mat2v4float
+ %f = OpFunction %void None %10
+ %13 = OpLabel
+ %17 = OpAccessChain %_ptr_StorageBuffer_mat2v4float %out %uint_0
+ %18 = OpLoad %mat2v4float %m
+ OpStore %17 %18
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat2x4/zero/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x4/zero/f32.wgsl.expected.wgsl
index f9c67c8..b4b387b 100644
--- a/test/tint/expressions/type_ctor/mat2x4/zero/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat2x4/zero/f32.wgsl.expected.wgsl
@@ -1 +1,8 @@
var<private> m = mat2x4<f32>();
+
+@group(0) @binding(0) var<storage, read_write> out : mat2x4<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f16.wgsl b/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f16.wgsl
index 190d2cc..2047a4b 100644
--- a/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f16.wgsl
@@ -1,9 +1,12 @@
enable f16;
-var<private> m = mat3x2(mat3x2<f16>(0.0h, 1.0h,
- 2.0h, 3.0h,
- 4.0h, 5.0h));
+var<private> m = mat3x2<f16>(mat3x2<f16>(0.0h, 1.0h,
+ 2.0h, 3.0h,
+ 4.0h, 5.0h));
-fn f() -> mat3x2<f16> {
- let m_1 = mat3x2(m);
- return m_1;
+@group(0) @binding(0)
+var<storage, read_write> out : mat3x2<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat3x2<f16>(m);
}
diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f16.wgsl.expected.dxc.hlsl
index 097a2cc..ea0b377 100644
--- a/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f16.wgsl.expected.dxc.hlsl
@@ -1,11 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 3, 2> m = matrix<float16_t, 3, 2>(vector<float16_t, 2>(float16_t(0.0h), float16_t(1.0h)), vector<float16_t, 2>(float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 2>(float16_t(4.0h), float16_t(5.0h)));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 3, 2> value) {
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 4u), value[1u]);
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 8u), value[2u]);
}
-static matrix<float16_t, 3, 2> m = matrix<float16_t, 3, 2>(vector<float16_t, 2>(float16_t(0.0h), float16_t(1.0h)), vector<float16_t, 2>(float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 2>(float16_t(4.0h), float16_t(5.0h)));
-
-matrix<float16_t, 3, 2> f() {
- const matrix<float16_t, 3, 2> m_1 = matrix<float16_t, 3, 2>(m);
- return m_1;
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, matrix<float16_t, 3, 2>(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f16.wgsl.expected.glsl
index 768ba2f..e1c3637 100644
--- a/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f16.wgsl.expected.glsl
@@ -1,13 +1,17 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
- return;
-}
f16mat3x2 m = f16mat3x2(f16vec2(0.0hf, 1.0hf), f16vec2(2.0hf, 3.0hf), f16vec2(4.0hf, 5.0hf));
-f16mat3x2 f() {
- f16mat3x2 m_1 = f16mat3x2(m);
- return m_1;
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat3x2 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = f16mat3x2(m);
}
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ f();
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f16.wgsl.expected.msl
index f2d3fbe..e40ba82 100644
--- a/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f16.wgsl.expected.msl
@@ -5,8 +5,10 @@
half3x2 m;
};
-half3x2 f(thread tint_private_vars_struct* const tint_private_vars) {
- half3x2 const m_1 = half3x2((*(tint_private_vars)).m);
- return m_1;
+kernel void f(device half3x2* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half3x2(half2(0.0h, 1.0h), half2(2.0h, 3.0h), half2(4.0h, 5.0h));
+ *(tint_symbol) = half3x2(tint_private_vars.m);
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f16.wgsl.expected.spvasm
index 7aa87ad..16abd95 100644
--- a/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 25
+; Bound: 29
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,11 +9,19 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 4
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v2half = OpTypeVector %half 2
%mat3v2half = OpTypeMatrix %v2half 3
@@ -29,15 +37,18 @@
%13 = OpConstantComposite %mat3v2half %6 %9 %12
%_ptr_Private_mat3v2half = OpTypePointer Private %mat3v2half
%m = OpVariable %_ptr_Private_mat3v2half Private %13
+ %out_block = OpTypeStruct %mat3v2half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %16 = OpTypeFunction %void
- %20 = OpTypeFunction %mat3v2half
-%unused_entry_point = OpFunction %void None %16
- %19 = OpLabel
- OpReturn
- OpFunctionEnd
- %f = OpFunction %mat3v2half None %20
+ %19 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat3v2half = OpTypePointer StorageBuffer %mat3v2half
+ %f = OpFunction %void None %19
%22 = OpLabel
- %24 = OpLoad %mat3v2half %m
- OpReturnValue %24
+ %26 = OpAccessChain %_ptr_StorageBuffer_mat3v2half %out %uint_0
+ %28 = OpLoad %mat3v2half %m
+ OpStore %26 %28
+ OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f16.wgsl.expected.wgsl
index 9380d81..e530bcc 100644
--- a/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f16.wgsl.expected.wgsl
@@ -1,8 +1,10 @@
enable f16;
-var<private> m = mat3x2(mat3x2<f16>(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h));
+var<private> m = mat3x2<f16>(mat3x2<f16>(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h));
-fn f() -> mat3x2<f16> {
- let m_1 = mat3x2(m);
- return m_1;
+@group(0) @binding(0) var<storage, read_write> out : mat3x2<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat3x2<f16>(m);
}
diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f32.wgsl b/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f32.wgsl
index 53bc3aa..3cb5ee8 100644
--- a/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f32.wgsl
@@ -1,8 +1,11 @@
-var<private> m = mat3x2(mat3x2<f32>(0.0f, 1.0f,
- 2.0f, 3.0f,
- 4.0f, 5.0f));
+var<private> m = mat3x2<f32>(mat3x2<f32>(0.0f, 1.0f,
+ 2.0f, 3.0f,
+ 4.0f, 5.0f));
-fn f() -> mat3x2<f32> {
- let m_1 = mat3x2(m);
- return m_1;
+@group(0) @binding(0)
+var<storage, read_write> out : mat3x2<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat3x2<f32>(m);
}
diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f32.wgsl.expected.dxc.hlsl
index 6a51b66..449d90b 100644
--- a/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f32.wgsl.expected.dxc.hlsl
@@ -1,11 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float3x2 m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
+ tint_symbol.Store2((offset + 16u), asuint(value[2u]));
}
-static float3x2 m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f));
-
-float3x2 f() {
- const float3x2 m_1 = float3x2(m);
- return m_1;
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float3x2(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f32.wgsl.expected.fxc.hlsl
index 6a51b66..449d90b 100644
--- a/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f32.wgsl.expected.fxc.hlsl
@@ -1,11 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float3x2 m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
+ tint_symbol.Store2((offset + 16u), asuint(value[2u]));
}
-static float3x2 m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f));
-
-float3x2 f() {
- const float3x2 m_1 = float3x2(m);
- return m_1;
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float3x2(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f32.wgsl.expected.glsl
index 076d424..f402baa 100644
--- a/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f32.wgsl.expected.glsl
@@ -1,12 +1,16 @@
#version 310 es
-layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
- return;
-}
mat3x2 m = mat3x2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f), vec2(4.0f, 5.0f));
-mat3x2 f() {
- mat3x2 m_1 = mat3x2(m);
- return m_1;
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat3x2 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = mat3x2(m);
}
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ f();
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f32.wgsl.expected.msl
index 7c81698..990365a 100644
--- a/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f32.wgsl.expected.msl
@@ -5,8 +5,10 @@
float3x2 m;
};
-float3x2 f(thread tint_private_vars_struct* const tint_private_vars) {
- float3x2 const m_1 = float3x2((*(tint_private_vars)).m);
- return m_1;
+kernel void f(device float3x2* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f));
+ *(tint_symbol) = float3x2(tint_private_vars.m);
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f32.wgsl.expected.spvasm
index 2c46731..b1e80eb 100644
--- a/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f32.wgsl.expected.spvasm
@@ -1,15 +1,23 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 25
+; Bound: 29
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%mat3v2float = OpTypeMatrix %v2float 3
@@ -25,15 +33,18 @@
%13 = OpConstantComposite %mat3v2float %6 %9 %12
%_ptr_Private_mat3v2float = OpTypePointer Private %mat3v2float
%m = OpVariable %_ptr_Private_mat3v2float Private %13
+ %out_block = OpTypeStruct %mat3v2float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %16 = OpTypeFunction %void
- %20 = OpTypeFunction %mat3v2float
-%unused_entry_point = OpFunction %void None %16
- %19 = OpLabel
- OpReturn
- OpFunctionEnd
- %f = OpFunction %mat3v2float None %20
+ %19 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat3v2float = OpTypePointer StorageBuffer %mat3v2float
+ %f = OpFunction %void None %19
%22 = OpLabel
- %24 = OpLoad %mat3v2float %m
- OpReturnValue %24
+ %26 = OpAccessChain %_ptr_StorageBuffer_mat3v2float %out %uint_0
+ %28 = OpLoad %mat3v2float %m
+ OpStore %26 %28
+ OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f32.wgsl.expected.wgsl
index 1be72c6..5e69f9a 100644
--- a/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f32.wgsl.expected.wgsl
@@ -1,6 +1,8 @@
-var<private> m = mat3x2(mat3x2<f32>(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f));
+var<private> m = mat3x2<f32>(mat3x2<f32>(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f));
-fn f() -> mat3x2<f32> {
- let m_1 = mat3x2(m);
- return m_1;
+@group(0) @binding(0) var<storage, read_write> out : mat3x2<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat3x2<f32>(m);
}
diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f16.wgsl b/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f16.wgsl
index 868bb41..9b84541 100644
--- a/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f16.wgsl
@@ -2,3 +2,11 @@
var<private> m = mat3x2<f16>(0.0h, 1.0h,
2.0h, 3.0h,
4.0h, 5.0h);
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat3x2<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f16.wgsl.expected.dxc.hlsl
index ab80f07..a991f36 100644
--- a/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f16.wgsl.expected.dxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 3, 2> m = matrix<float16_t, 3, 2>(vector<float16_t, 2>(float16_t(0.0h), float16_t(1.0h)), vector<float16_t, 2>(float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 2>(float16_t(4.0h), float16_t(5.0h)));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 3, 2> value) {
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 4u), value[1u]);
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 8u), value[2u]);
}
-static matrix<float16_t, 3, 2> m = matrix<float16_t, 3, 2>(vector<float16_t, 2>(float16_t(0.0h), float16_t(1.0h)), vector<float16_t, 2>(float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 2>(float16_t(4.0h), float16_t(5.0h)));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f16.wgsl.expected.glsl
index f33f363..bc3d4d0 100644
--- a/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f16.wgsl.expected.glsl
@@ -1,8 +1,17 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
+f16mat3x2 m = f16mat3x2(f16vec2(0.0hf, 1.0hf), f16vec2(2.0hf, 3.0hf), f16vec2(4.0hf, 5.0hf));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat3x2 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-f16mat3x2 m = f16mat3x2(f16vec2(0.0hf, 1.0hf), f16vec2(2.0hf, 3.0hf), f16vec2(4.0hf, 5.0hf));
diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f16.wgsl.expected.msl
index 90a5391..26072f1 100644
--- a/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f16.wgsl.expected.msl
@@ -5,3 +5,10 @@
half3x2 m;
};
+kernel void f(device half3x2* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half3x2(half2(0.0h, 1.0h), half2(2.0h, 3.0h), half2(4.0h, 5.0h));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f16.wgsl.expected.spvasm
index f04bca4..cf8cab1 100644
--- a/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 20
+; Bound: 28
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,10 +9,19 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 4
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v2half = OpTypeVector %half 2
%mat3v2half = OpTypeMatrix %v2half 3
@@ -28,9 +37,18 @@
%13 = OpConstantComposite %mat3v2half %6 %9 %12
%_ptr_Private_mat3v2half = OpTypePointer Private %mat3v2half
%m = OpVariable %_ptr_Private_mat3v2half Private %13
+ %out_block = OpTypeStruct %mat3v2half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %16 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %16
- %19 = OpLabel
+ %19 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat3v2half = OpTypePointer StorageBuffer %mat3v2half
+ %f = OpFunction %void None %19
+ %22 = OpLabel
+ %26 = OpAccessChain %_ptr_StorageBuffer_mat3v2half %out %uint_0
+ %27 = OpLoad %mat3v2half %m
+ OpStore %26 %27
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f16.wgsl.expected.wgsl
index 75f2d01..94df310 100644
--- a/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f16.wgsl.expected.wgsl
@@ -1,3 +1,10 @@
enable f16;
var<private> m = mat3x2<f16>(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h);
+
+@group(0) @binding(0) var<storage, read_write> out : mat3x2<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl b/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl
index e724832..dda7925 100644
--- a/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl
@@ -1,3 +1,11 @@
var<private> m = mat3x2<f32>(0.0f, 1.0f,
2.0f, 3.0f,
4.0f, 5.0f);
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat3x2<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl.expected.dxc.hlsl
index 3c86bed..eeaf4b6 100644
--- a/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl.expected.dxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float3x2 m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
+ tint_symbol.Store2((offset + 16u), asuint(value[2u]));
}
-static float3x2 m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl.expected.fxc.hlsl
index 3c86bed..eeaf4b6 100644
--- a/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl.expected.fxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float3x2 m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
+ tint_symbol.Store2((offset + 16u), asuint(value[2u]));
}
-static float3x2 m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl.expected.glsl
index 3df809b..72376ee 100644
--- a/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl.expected.glsl
@@ -1,7 +1,16 @@
#version 310 es
+mat3x2 m = mat3x2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f), vec2(4.0f, 5.0f));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat3x2 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat3x2 m = mat3x2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f), vec2(4.0f, 5.0f));
diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl.expected.msl
index c62ec48..6d01e6d 100644
--- a/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl.expected.msl
@@ -5,3 +5,10 @@
float3x2 m;
};
+kernel void f(device float3x2* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl.expected.spvasm
index cfc645f..d9f5ce4 100644
--- a/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl.expected.spvasm
@@ -1,14 +1,23 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 20
+; Bound: 28
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%mat3v2float = OpTypeMatrix %v2float 3
@@ -24,9 +33,18 @@
%13 = OpConstantComposite %mat3v2float %6 %9 %12
%_ptr_Private_mat3v2float = OpTypePointer Private %mat3v2float
%m = OpVariable %_ptr_Private_mat3v2float Private %13
+ %out_block = OpTypeStruct %mat3v2float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %16 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %16
- %19 = OpLabel
+ %19 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat3v2float = OpTypePointer StorageBuffer %mat3v2float
+ %f = OpFunction %void None %19
+ %22 = OpLabel
+ %26 = OpAccessChain %_ptr_StorageBuffer_mat3v2float %out %uint_0
+ %27 = OpLoad %mat3v2float %m
+ OpStore %26 %27
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl.expected.wgsl
index 14bc7c9..91e29a1 100644
--- a/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl.expected.wgsl
@@ -1 +1,8 @@
var<private> m = mat3x2<f32>(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f);
+
+@group(0) @binding(0) var<storage, read_write> out : mat3x2<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f16.wgsl b/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f16.wgsl
index 436037e..3f70176 100644
--- a/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f16.wgsl
@@ -2,3 +2,11 @@
var<private> m = mat3x2<f16>(vec2<f16>(0.0h, 1.0h),
vec2<f16>(2.0h, 3.0h),
vec2<f16>(4.0h, 5.0h));
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat3x2<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f16.wgsl.expected.dxc.hlsl
index ab80f07..a991f36 100644
--- a/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f16.wgsl.expected.dxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 3, 2> m = matrix<float16_t, 3, 2>(vector<float16_t, 2>(float16_t(0.0h), float16_t(1.0h)), vector<float16_t, 2>(float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 2>(float16_t(4.0h), float16_t(5.0h)));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 3, 2> value) {
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 4u), value[1u]);
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 8u), value[2u]);
}
-static matrix<float16_t, 3, 2> m = matrix<float16_t, 3, 2>(vector<float16_t, 2>(float16_t(0.0h), float16_t(1.0h)), vector<float16_t, 2>(float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 2>(float16_t(4.0h), float16_t(5.0h)));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f16.wgsl.expected.glsl
index f33f363..bc3d4d0 100644
--- a/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f16.wgsl.expected.glsl
@@ -1,8 +1,17 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
+f16mat3x2 m = f16mat3x2(f16vec2(0.0hf, 1.0hf), f16vec2(2.0hf, 3.0hf), f16vec2(4.0hf, 5.0hf));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat3x2 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-f16mat3x2 m = f16mat3x2(f16vec2(0.0hf, 1.0hf), f16vec2(2.0hf, 3.0hf), f16vec2(4.0hf, 5.0hf));
diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f16.wgsl.expected.msl
index 90a5391..26072f1 100644
--- a/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f16.wgsl.expected.msl
@@ -5,3 +5,10 @@
half3x2 m;
};
+kernel void f(device half3x2* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half3x2(half2(0.0h, 1.0h), half2(2.0h, 3.0h), half2(4.0h, 5.0h));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f16.wgsl.expected.spvasm
index f04bca4..cf8cab1 100644
--- a/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 20
+; Bound: 28
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,10 +9,19 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 4
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v2half = OpTypeVector %half 2
%mat3v2half = OpTypeMatrix %v2half 3
@@ -28,9 +37,18 @@
%13 = OpConstantComposite %mat3v2half %6 %9 %12
%_ptr_Private_mat3v2half = OpTypePointer Private %mat3v2half
%m = OpVariable %_ptr_Private_mat3v2half Private %13
+ %out_block = OpTypeStruct %mat3v2half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %16 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %16
- %19 = OpLabel
+ %19 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat3v2half = OpTypePointer StorageBuffer %mat3v2half
+ %f = OpFunction %void None %19
+ %22 = OpLabel
+ %26 = OpAccessChain %_ptr_StorageBuffer_mat3v2half %out %uint_0
+ %27 = OpLoad %mat3v2half %m
+ OpStore %26 %27
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f16.wgsl.expected.wgsl
index d10b859..b72bdda 100644
--- a/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f16.wgsl.expected.wgsl
@@ -1,3 +1,10 @@
enable f16;
var<private> m = mat3x2<f16>(vec2<f16>(0.0h, 1.0h), vec2<f16>(2.0h, 3.0h), vec2<f16>(4.0h, 5.0h));
+
+@group(0) @binding(0) var<storage, read_write> out : mat3x2<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl b/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl
index 9abe994..2fcdcc2 100644
--- a/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl
@@ -1,3 +1,11 @@
var<private> m = mat3x2<f32>(vec2<f32>(0.0f, 1.0f),
vec2<f32>(2.0f, 3.0f),
vec2<f32>(4.0f, 5.0f));
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat3x2<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.dxc.hlsl
index 3c86bed..eeaf4b6 100644
--- a/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.dxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float3x2 m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
+ tint_symbol.Store2((offset + 16u), asuint(value[2u]));
}
-static float3x2 m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.fxc.hlsl
index 3c86bed..eeaf4b6 100644
--- a/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.fxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float3x2 m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
+ tint_symbol.Store2((offset + 16u), asuint(value[2u]));
}
-static float3x2 m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.glsl
index 3df809b..72376ee 100644
--- a/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.glsl
@@ -1,7 +1,16 @@
#version 310 es
+mat3x2 m = mat3x2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f), vec2(4.0f, 5.0f));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat3x2 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat3x2 m = mat3x2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f), vec2(4.0f, 5.0f));
diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.msl
index c62ec48..6d01e6d 100644
--- a/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.msl
@@ -5,3 +5,10 @@
float3x2 m;
};
+kernel void f(device float3x2* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.spvasm
index cfc645f..d9f5ce4 100644
--- a/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.spvasm
@@ -1,14 +1,23 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 20
+; Bound: 28
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%mat3v2float = OpTypeMatrix %v2float 3
@@ -24,9 +33,18 @@
%13 = OpConstantComposite %mat3v2float %6 %9 %12
%_ptr_Private_mat3v2float = OpTypePointer Private %mat3v2float
%m = OpVariable %_ptr_Private_mat3v2float Private %13
+ %out_block = OpTypeStruct %mat3v2float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %16 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %16
- %19 = OpLabel
+ %19 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat3v2float = OpTypePointer StorageBuffer %mat3v2float
+ %f = OpFunction %void None %19
+ %22 = OpLabel
+ %26 = OpAccessChain %_ptr_StorageBuffer_mat3v2float %out %uint_0
+ %27 = OpLoad %mat3v2float %m
+ OpStore %26 %27
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.wgsl
index 6e2dea9..5ab3e19 100644
--- a/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.wgsl
@@ -1 +1,8 @@
var<private> m = mat3x2<f32>(vec2<f32>(0.0f, 1.0f), vec2<f32>(2.0f, 3.0f), vec2<f32>(4.0f, 5.0f));
+
+@group(0) @binding(0) var<storage, read_write> out : mat3x2<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f16.wgsl b/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f16.wgsl
index a48d81b..25860b2 100644
--- a/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f16.wgsl
@@ -3,7 +3,10 @@
2.0h, 3.0h,
4.0h, 5.0h));
-fn f() -> mat3x2<f16> {
- let m_1 = mat3x2(m);
- return m_1;
+@group(0) @binding(0)
+var<storage, read_write> out : mat3x2<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat3x2(m);
}
diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f16.wgsl.expected.dxc.hlsl
index 097a2cc..ea0b377 100644
--- a/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f16.wgsl.expected.dxc.hlsl
@@ -1,11 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 3, 2> m = matrix<float16_t, 3, 2>(vector<float16_t, 2>(float16_t(0.0h), float16_t(1.0h)), vector<float16_t, 2>(float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 2>(float16_t(4.0h), float16_t(5.0h)));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 3, 2> value) {
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 4u), value[1u]);
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 8u), value[2u]);
}
-static matrix<float16_t, 3, 2> m = matrix<float16_t, 3, 2>(vector<float16_t, 2>(float16_t(0.0h), float16_t(1.0h)), vector<float16_t, 2>(float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 2>(float16_t(4.0h), float16_t(5.0h)));
-
-matrix<float16_t, 3, 2> f() {
- const matrix<float16_t, 3, 2> m_1 = matrix<float16_t, 3, 2>(m);
- return m_1;
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, matrix<float16_t, 3, 2>(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f16.wgsl.expected.glsl
index 768ba2f..e1c3637 100644
--- a/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f16.wgsl.expected.glsl
@@ -1,13 +1,17 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
- return;
-}
f16mat3x2 m = f16mat3x2(f16vec2(0.0hf, 1.0hf), f16vec2(2.0hf, 3.0hf), f16vec2(4.0hf, 5.0hf));
-f16mat3x2 f() {
- f16mat3x2 m_1 = f16mat3x2(m);
- return m_1;
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat3x2 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = f16mat3x2(m);
}
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ f();
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f16.wgsl.expected.msl
index f2d3fbe..e40ba82 100644
--- a/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f16.wgsl.expected.msl
@@ -5,8 +5,10 @@
half3x2 m;
};
-half3x2 f(thread tint_private_vars_struct* const tint_private_vars) {
- half3x2 const m_1 = half3x2((*(tint_private_vars)).m);
- return m_1;
+kernel void f(device half3x2* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half3x2(half2(0.0h, 1.0h), half2(2.0h, 3.0h), half2(4.0h, 5.0h));
+ *(tint_symbol) = half3x2(tint_private_vars.m);
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f16.wgsl.expected.spvasm
index 7aa87ad..16abd95 100644
--- a/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 25
+; Bound: 29
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,11 +9,19 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 4
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v2half = OpTypeVector %half 2
%mat3v2half = OpTypeMatrix %v2half 3
@@ -29,15 +37,18 @@
%13 = OpConstantComposite %mat3v2half %6 %9 %12
%_ptr_Private_mat3v2half = OpTypePointer Private %mat3v2half
%m = OpVariable %_ptr_Private_mat3v2half Private %13
+ %out_block = OpTypeStruct %mat3v2half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %16 = OpTypeFunction %void
- %20 = OpTypeFunction %mat3v2half
-%unused_entry_point = OpFunction %void None %16
- %19 = OpLabel
- OpReturn
- OpFunctionEnd
- %f = OpFunction %mat3v2half None %20
+ %19 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat3v2half = OpTypePointer StorageBuffer %mat3v2half
+ %f = OpFunction %void None %19
%22 = OpLabel
- %24 = OpLoad %mat3v2half %m
- OpReturnValue %24
+ %26 = OpAccessChain %_ptr_StorageBuffer_mat3v2half %out %uint_0
+ %28 = OpLoad %mat3v2half %m
+ OpStore %26 %28
+ OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f16.wgsl.expected.wgsl
index dfdd0a4..79154c4 100644
--- a/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f16.wgsl.expected.wgsl
@@ -2,7 +2,9 @@
var<private> m = mat3x2(mat3x2(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h));
-fn f() -> mat3x2<f16> {
- let m_1 = mat3x2(m);
- return m_1;
+@group(0) @binding(0) var<storage, read_write> out : mat3x2<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat3x2(m);
}
diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f32.wgsl b/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f32.wgsl
index 73d3fd1..c2fbe18 100644
--- a/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f32.wgsl
@@ -2,7 +2,10 @@
2.0f, 3.0f,
4.0f, 5.0f));
-fn f() -> mat3x2<f32> {
- let m_1 = mat3x2(m);
- return m_1;
+@group(0) @binding(0)
+var<storage, read_write> out : mat3x2<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat3x2(m);
}
diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f32.wgsl.expected.dxc.hlsl
index 6a51b66..449d90b 100644
--- a/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f32.wgsl.expected.dxc.hlsl
@@ -1,11 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float3x2 m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
+ tint_symbol.Store2((offset + 16u), asuint(value[2u]));
}
-static float3x2 m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f));
-
-float3x2 f() {
- const float3x2 m_1 = float3x2(m);
- return m_1;
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float3x2(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f32.wgsl.expected.fxc.hlsl
index 6a51b66..449d90b 100644
--- a/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f32.wgsl.expected.fxc.hlsl
@@ -1,11 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float3x2 m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
+ tint_symbol.Store2((offset + 16u), asuint(value[2u]));
}
-static float3x2 m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f));
-
-float3x2 f() {
- const float3x2 m_1 = float3x2(m);
- return m_1;
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float3x2(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f32.wgsl.expected.glsl
index 076d424..f402baa 100644
--- a/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f32.wgsl.expected.glsl
@@ -1,12 +1,16 @@
#version 310 es
-layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
- return;
-}
mat3x2 m = mat3x2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f), vec2(4.0f, 5.0f));
-mat3x2 f() {
- mat3x2 m_1 = mat3x2(m);
- return m_1;
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat3x2 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = mat3x2(m);
}
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ f();
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f32.wgsl.expected.msl
index 7c81698..990365a 100644
--- a/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f32.wgsl.expected.msl
@@ -5,8 +5,10 @@
float3x2 m;
};
-float3x2 f(thread tint_private_vars_struct* const tint_private_vars) {
- float3x2 const m_1 = float3x2((*(tint_private_vars)).m);
- return m_1;
+kernel void f(device float3x2* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f));
+ *(tint_symbol) = float3x2(tint_private_vars.m);
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f32.wgsl.expected.spvasm
index 2c46731..b1e80eb 100644
--- a/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f32.wgsl.expected.spvasm
@@ -1,15 +1,23 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 25
+; Bound: 29
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%mat3v2float = OpTypeMatrix %v2float 3
@@ -25,15 +33,18 @@
%13 = OpConstantComposite %mat3v2float %6 %9 %12
%_ptr_Private_mat3v2float = OpTypePointer Private %mat3v2float
%m = OpVariable %_ptr_Private_mat3v2float Private %13
+ %out_block = OpTypeStruct %mat3v2float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %16 = OpTypeFunction %void
- %20 = OpTypeFunction %mat3v2float
-%unused_entry_point = OpFunction %void None %16
- %19 = OpLabel
- OpReturn
- OpFunctionEnd
- %f = OpFunction %mat3v2float None %20
+ %19 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat3v2float = OpTypePointer StorageBuffer %mat3v2float
+ %f = OpFunction %void None %19
%22 = OpLabel
- %24 = OpLoad %mat3v2float %m
- OpReturnValue %24
+ %26 = OpAccessChain %_ptr_StorageBuffer_mat3v2float %out %uint_0
+ %28 = OpLoad %mat3v2float %m
+ OpStore %26 %28
+ OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f32.wgsl.expected.wgsl
index bc65cbb..f4d1333 100644
--- a/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f32.wgsl.expected.wgsl
@@ -1,6 +1,8 @@
var<private> m = mat3x2(mat3x2(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f));
-fn f() -> mat3x2<f32> {
- let m_1 = mat3x2(m);
- return m_1;
+@group(0) @binding(0) var<storage, read_write> out : mat3x2<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat3x2(m);
}
diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/abstract-float.wgsl b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/abstract-float.wgsl
index 9507f0e..6e6caca 100644
--- a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/abstract-float.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/abstract-float.wgsl
@@ -1,3 +1,11 @@
-var<private> m = mat3x2(0.0, 1.0,
- 2.0, 3.0,
- 4.0, 5.0);
+const m = mat3x2(0.0, 1.0,
+ 2.0, 3.0,
+ 4.0, 5.0);
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat3x2<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl
index 3c86bed..8307220 100644
--- a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
+ tint_symbol.Store2((offset + 16u), asuint(value[2u]));
}
-static float3x2 m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f)));
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl
index 3c86bed..8307220 100644
--- a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
+ tint_symbol.Store2((offset + 16u), asuint(value[2u]));
}
-static float3x2 m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f)));
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/abstract-float.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/abstract-float.wgsl.expected.glsl
index 3df809b..3da2602 100644
--- a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/abstract-float.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/abstract-float.wgsl.expected.glsl
@@ -1,7 +1,15 @@
#version 310 es
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat3x2 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = mat3x2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f), vec2(4.0f, 5.0f));
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat3x2 m = mat3x2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f), vec2(4.0f, 5.0f));
diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/abstract-float.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/abstract-float.wgsl.expected.msl
index c62ec48..2dc2353 100644
--- a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/abstract-float.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/abstract-float.wgsl.expected.msl
@@ -1,7 +1,8 @@
#include <metal_stdlib>
using namespace metal;
-struct tint_private_vars_struct {
- float3x2 m;
-};
+kernel void f(device float3x2* tint_symbol [[buffer(0)]]) {
+ *(tint_symbol) = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f));
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/abstract-float.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/abstract-float.wgsl.expected.spvasm
index cfc645f..663168a 100644
--- a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/abstract-float.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/abstract-float.wgsl.expected.spvasm
@@ -1,32 +1,46 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 20
+; Bound: 25
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
- OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%mat3v2float = OpTypeMatrix %v2float 3
- %4 = OpConstantNull %float
+ %out_block = OpTypeStruct %mat3v2float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat3v2float = OpTypePointer StorageBuffer %mat3v2float
+ %15 = OpConstantNull %float
%float_1 = OpConstant %float 1
- %6 = OpConstantComposite %v2float %4 %float_1
+ %17 = OpConstantComposite %v2float %15 %float_1
%float_2 = OpConstant %float 2
%float_3 = OpConstant %float 3
- %9 = OpConstantComposite %v2float %float_2 %float_3
+ %20 = OpConstantComposite %v2float %float_2 %float_3
%float_4 = OpConstant %float 4
%float_5 = OpConstant %float 5
- %12 = OpConstantComposite %v2float %float_4 %float_5
- %13 = OpConstantComposite %mat3v2float %6 %9 %12
-%_ptr_Private_mat3v2float = OpTypePointer Private %mat3v2float
- %m = OpVariable %_ptr_Private_mat3v2float Private %13
- %void = OpTypeVoid
- %16 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %16
- %19 = OpLabel
+ %23 = OpConstantComposite %v2float %float_4 %float_5
+ %24 = OpConstantComposite %mat3v2float %17 %20 %23
+ %f = OpFunction %void None %7
+ %10 = OpLabel
+ %14 = OpAccessChain %_ptr_StorageBuffer_mat3v2float %out %uint_0
+ OpStore %14 %24
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/abstract-float.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/abstract-float.wgsl.expected.wgsl
index 28d3915..8199410 100644
--- a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/abstract-float.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/abstract-float.wgsl.expected.wgsl
@@ -1 +1,8 @@
-var<private> m = mat3x2(0.0, 1.0, 2.0, 3.0, 4.0, 5.0);
+const m = mat3x2(0.0, 1.0, 2.0, 3.0, 4.0, 5.0);
+
+@group(0) @binding(0) var<storage, read_write> out : mat3x2<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f16.wgsl b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f16.wgsl
index e5faa67..f411159 100644
--- a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f16.wgsl
@@ -2,3 +2,11 @@
var<private> m = mat3x2(0.0h, 1.0h,
2.0h, 3.0h,
4.0h, 5.0h);
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat3x2<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f16.wgsl.expected.dxc.hlsl
index ab80f07..a991f36 100644
--- a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f16.wgsl.expected.dxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 3, 2> m = matrix<float16_t, 3, 2>(vector<float16_t, 2>(float16_t(0.0h), float16_t(1.0h)), vector<float16_t, 2>(float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 2>(float16_t(4.0h), float16_t(5.0h)));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 3, 2> value) {
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 4u), value[1u]);
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 8u), value[2u]);
}
-static matrix<float16_t, 3, 2> m = matrix<float16_t, 3, 2>(vector<float16_t, 2>(float16_t(0.0h), float16_t(1.0h)), vector<float16_t, 2>(float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 2>(float16_t(4.0h), float16_t(5.0h)));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f16.wgsl.expected.glsl
index f33f363..bc3d4d0 100644
--- a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f16.wgsl.expected.glsl
@@ -1,8 +1,17 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
+f16mat3x2 m = f16mat3x2(f16vec2(0.0hf, 1.0hf), f16vec2(2.0hf, 3.0hf), f16vec2(4.0hf, 5.0hf));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat3x2 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-f16mat3x2 m = f16mat3x2(f16vec2(0.0hf, 1.0hf), f16vec2(2.0hf, 3.0hf), f16vec2(4.0hf, 5.0hf));
diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f16.wgsl.expected.msl
index 90a5391..26072f1 100644
--- a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f16.wgsl.expected.msl
@@ -5,3 +5,10 @@
half3x2 m;
};
+kernel void f(device half3x2* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half3x2(half2(0.0h, 1.0h), half2(2.0h, 3.0h), half2(4.0h, 5.0h));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f16.wgsl.expected.spvasm
index f04bca4..cf8cab1 100644
--- a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 20
+; Bound: 28
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,10 +9,19 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 4
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v2half = OpTypeVector %half 2
%mat3v2half = OpTypeMatrix %v2half 3
@@ -28,9 +37,18 @@
%13 = OpConstantComposite %mat3v2half %6 %9 %12
%_ptr_Private_mat3v2half = OpTypePointer Private %mat3v2half
%m = OpVariable %_ptr_Private_mat3v2half Private %13
+ %out_block = OpTypeStruct %mat3v2half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %16 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %16
- %19 = OpLabel
+ %19 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat3v2half = OpTypePointer StorageBuffer %mat3v2half
+ %f = OpFunction %void None %19
+ %22 = OpLabel
+ %26 = OpAccessChain %_ptr_StorageBuffer_mat3v2half %out %uint_0
+ %27 = OpLoad %mat3v2half %m
+ OpStore %26 %27
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f16.wgsl.expected.wgsl
index ca1eccf..f0c693b 100644
--- a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f16.wgsl.expected.wgsl
@@ -1,3 +1,10 @@
enable f16;
var<private> m = mat3x2(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h);
+
+@group(0) @binding(0) var<storage, read_write> out : mat3x2<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl
index e5f9de6..e34e21e 100644
--- a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl
@@ -1,3 +1,11 @@
var<private> m = mat3x2(0.0f, 1.0f,
2.0f, 3.0f,
4.0f, 5.0f);
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat3x2<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl.expected.dxc.hlsl
index 3c86bed..eeaf4b6 100644
--- a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl.expected.dxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float3x2 m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
+ tint_symbol.Store2((offset + 16u), asuint(value[2u]));
}
-static float3x2 m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl.expected.fxc.hlsl
index 3c86bed..eeaf4b6 100644
--- a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl.expected.fxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float3x2 m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
+ tint_symbol.Store2((offset + 16u), asuint(value[2u]));
}
-static float3x2 m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl.expected.glsl
index 3df809b..72376ee 100644
--- a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl.expected.glsl
@@ -1,7 +1,16 @@
#version 310 es
+mat3x2 m = mat3x2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f), vec2(4.0f, 5.0f));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat3x2 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat3x2 m = mat3x2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f), vec2(4.0f, 5.0f));
diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl.expected.msl
index c62ec48..6d01e6d 100644
--- a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl.expected.msl
@@ -5,3 +5,10 @@
float3x2 m;
};
+kernel void f(device float3x2* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl.expected.spvasm
index cfc645f..d9f5ce4 100644
--- a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl.expected.spvasm
@@ -1,14 +1,23 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 20
+; Bound: 28
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%mat3v2float = OpTypeMatrix %v2float 3
@@ -24,9 +33,18 @@
%13 = OpConstantComposite %mat3v2float %6 %9 %12
%_ptr_Private_mat3v2float = OpTypePointer Private %mat3v2float
%m = OpVariable %_ptr_Private_mat3v2float Private %13
+ %out_block = OpTypeStruct %mat3v2float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %16 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %16
- %19 = OpLabel
+ %19 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat3v2float = OpTypePointer StorageBuffer %mat3v2float
+ %f = OpFunction %void None %19
+ %22 = OpLabel
+ %26 = OpAccessChain %_ptr_StorageBuffer_mat3v2float %out %uint_0
+ %27 = OpLoad %mat3v2float %m
+ OpStore %26 %27
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl.expected.wgsl
index 045b91d..9dd6063 100644
--- a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl.expected.wgsl
@@ -1 +1,8 @@
var<private> m = mat3x2(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f);
+
+@group(0) @binding(0) var<storage, read_write> out : mat3x2<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/abstract-float.wgsl b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/abstract-float.wgsl
index bb77362..3235e8c 100644
--- a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/abstract-float.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/abstract-float.wgsl
@@ -1,3 +1,11 @@
-var<private> m = mat3x2(vec2(0.0, 1.0),
- vec2(2.0, 3.0),
- vec2(4.0, 5.0));
+const m = mat3x2(vec2(0.0, 1.0),
+ vec2(2.0, 3.0),
+ vec2(4.0, 5.0));
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat3x2<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl
index 3c86bed..8307220 100644
--- a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
+ tint_symbol.Store2((offset + 16u), asuint(value[2u]));
}
-static float3x2 m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f)));
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl
index 3c86bed..8307220 100644
--- a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
+ tint_symbol.Store2((offset + 16u), asuint(value[2u]));
}
-static float3x2 m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f)));
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/abstract-float.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/abstract-float.wgsl.expected.glsl
index 3df809b..3da2602 100644
--- a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/abstract-float.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/abstract-float.wgsl.expected.glsl
@@ -1,7 +1,15 @@
#version 310 es
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat3x2 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = mat3x2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f), vec2(4.0f, 5.0f));
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat3x2 m = mat3x2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f), vec2(4.0f, 5.0f));
diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/abstract-float.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/abstract-float.wgsl.expected.msl
index c62ec48..2dc2353 100644
--- a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/abstract-float.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/abstract-float.wgsl.expected.msl
@@ -1,7 +1,8 @@
#include <metal_stdlib>
using namespace metal;
-struct tint_private_vars_struct {
- float3x2 m;
-};
+kernel void f(device float3x2* tint_symbol [[buffer(0)]]) {
+ *(tint_symbol) = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f));
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/abstract-float.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/abstract-float.wgsl.expected.spvasm
index cfc645f..663168a 100644
--- a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/abstract-float.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/abstract-float.wgsl.expected.spvasm
@@ -1,32 +1,46 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 20
+; Bound: 25
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
- OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%mat3v2float = OpTypeMatrix %v2float 3
- %4 = OpConstantNull %float
+ %out_block = OpTypeStruct %mat3v2float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat3v2float = OpTypePointer StorageBuffer %mat3v2float
+ %15 = OpConstantNull %float
%float_1 = OpConstant %float 1
- %6 = OpConstantComposite %v2float %4 %float_1
+ %17 = OpConstantComposite %v2float %15 %float_1
%float_2 = OpConstant %float 2
%float_3 = OpConstant %float 3
- %9 = OpConstantComposite %v2float %float_2 %float_3
+ %20 = OpConstantComposite %v2float %float_2 %float_3
%float_4 = OpConstant %float 4
%float_5 = OpConstant %float 5
- %12 = OpConstantComposite %v2float %float_4 %float_5
- %13 = OpConstantComposite %mat3v2float %6 %9 %12
-%_ptr_Private_mat3v2float = OpTypePointer Private %mat3v2float
- %m = OpVariable %_ptr_Private_mat3v2float Private %13
- %void = OpTypeVoid
- %16 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %16
- %19 = OpLabel
+ %23 = OpConstantComposite %v2float %float_4 %float_5
+ %24 = OpConstantComposite %mat3v2float %17 %20 %23
+ %f = OpFunction %void None %7
+ %10 = OpLabel
+ %14 = OpAccessChain %_ptr_StorageBuffer_mat3v2float %out %uint_0
+ OpStore %14 %24
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/abstract-float.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/abstract-float.wgsl.expected.wgsl
index 4cb4236..336bdb8 100644
--- a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/abstract-float.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/abstract-float.wgsl.expected.wgsl
@@ -1 +1,8 @@
-var<private> m = mat3x2(vec2(0.0, 1.0), vec2(2.0, 3.0), vec2(4.0, 5.0));
+const m = mat3x2(vec2(0.0, 1.0), vec2(2.0, 3.0), vec2(4.0, 5.0));
+
+@group(0) @binding(0) var<storage, read_write> out : mat3x2<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f16.wgsl b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f16.wgsl
index b37674a..b102789 100644
--- a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f16.wgsl
@@ -2,3 +2,11 @@
var<private> m = mat3x2(vec2<f16>(0.0h, 1.0h),
vec2<f16>(2.0h, 3.0h),
vec2<f16>(4.0h, 5.0h));
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat3x2<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f16.wgsl.expected.dxc.hlsl
index ab80f07..a991f36 100644
--- a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f16.wgsl.expected.dxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 3, 2> m = matrix<float16_t, 3, 2>(vector<float16_t, 2>(float16_t(0.0h), float16_t(1.0h)), vector<float16_t, 2>(float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 2>(float16_t(4.0h), float16_t(5.0h)));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 3, 2> value) {
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 4u), value[1u]);
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 8u), value[2u]);
}
-static matrix<float16_t, 3, 2> m = matrix<float16_t, 3, 2>(vector<float16_t, 2>(float16_t(0.0h), float16_t(1.0h)), vector<float16_t, 2>(float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 2>(float16_t(4.0h), float16_t(5.0h)));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f16.wgsl.expected.glsl
index f33f363..bc3d4d0 100644
--- a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f16.wgsl.expected.glsl
@@ -1,8 +1,17 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
+f16mat3x2 m = f16mat3x2(f16vec2(0.0hf, 1.0hf), f16vec2(2.0hf, 3.0hf), f16vec2(4.0hf, 5.0hf));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat3x2 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-f16mat3x2 m = f16mat3x2(f16vec2(0.0hf, 1.0hf), f16vec2(2.0hf, 3.0hf), f16vec2(4.0hf, 5.0hf));
diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f16.wgsl.expected.msl
index 90a5391..26072f1 100644
--- a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f16.wgsl.expected.msl
@@ -5,3 +5,10 @@
half3x2 m;
};
+kernel void f(device half3x2* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half3x2(half2(0.0h, 1.0h), half2(2.0h, 3.0h), half2(4.0h, 5.0h));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f16.wgsl.expected.spvasm
index f04bca4..cf8cab1 100644
--- a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 20
+; Bound: 28
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,10 +9,19 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 4
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v2half = OpTypeVector %half 2
%mat3v2half = OpTypeMatrix %v2half 3
@@ -28,9 +37,18 @@
%13 = OpConstantComposite %mat3v2half %6 %9 %12
%_ptr_Private_mat3v2half = OpTypePointer Private %mat3v2half
%m = OpVariable %_ptr_Private_mat3v2half Private %13
+ %out_block = OpTypeStruct %mat3v2half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %16 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %16
- %19 = OpLabel
+ %19 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat3v2half = OpTypePointer StorageBuffer %mat3v2half
+ %f = OpFunction %void None %19
+ %22 = OpLabel
+ %26 = OpAccessChain %_ptr_StorageBuffer_mat3v2half %out %uint_0
+ %27 = OpLoad %mat3v2half %m
+ OpStore %26 %27
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f16.wgsl.expected.wgsl
index 42a3882..8a7c262 100644
--- a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f16.wgsl.expected.wgsl
@@ -1,3 +1,10 @@
enable f16;
var<private> m = mat3x2(vec2<f16>(0.0h, 1.0h), vec2<f16>(2.0h, 3.0h), vec2<f16>(4.0h, 5.0h));
+
+@group(0) @binding(0) var<storage, read_write> out : mat3x2<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl
index 029a9b0..a576a31 100644
--- a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl
@@ -1,3 +1,11 @@
var<private> m = mat3x2(vec2<f32>(0.0f, 1.0f),
vec2<f32>(2.0f, 3.0f),
vec2<f32>(4.0f, 5.0f));
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat3x2<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl.expected.dxc.hlsl
index 3c86bed..eeaf4b6 100644
--- a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl.expected.dxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float3x2 m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
+ tint_symbol.Store2((offset + 16u), asuint(value[2u]));
}
-static float3x2 m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl.expected.fxc.hlsl
index 3c86bed..eeaf4b6 100644
--- a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl.expected.fxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float3x2 m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
+ tint_symbol.Store2((offset + 16u), asuint(value[2u]));
}
-static float3x2 m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl.expected.glsl
index 3df809b..72376ee 100644
--- a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl.expected.glsl
@@ -1,7 +1,16 @@
#version 310 es
+mat3x2 m = mat3x2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f), vec2(4.0f, 5.0f));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat3x2 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat3x2 m = mat3x2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f), vec2(4.0f, 5.0f));
diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl.expected.msl
index c62ec48..6d01e6d 100644
--- a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl.expected.msl
@@ -5,3 +5,10 @@
float3x2 m;
};
+kernel void f(device float3x2* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl.expected.spvasm
index cfc645f..d9f5ce4 100644
--- a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl.expected.spvasm
@@ -1,14 +1,23 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 20
+; Bound: 28
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%mat3v2float = OpTypeMatrix %v2float 3
@@ -24,9 +33,18 @@
%13 = OpConstantComposite %mat3v2float %6 %9 %12
%_ptr_Private_mat3v2float = OpTypePointer Private %mat3v2float
%m = OpVariable %_ptr_Private_mat3v2float Private %13
+ %out_block = OpTypeStruct %mat3v2float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %16 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %16
- %19 = OpLabel
+ %19 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat3v2float = OpTypePointer StorageBuffer %mat3v2float
+ %f = OpFunction %void None %19
+ %22 = OpLabel
+ %26 = OpAccessChain %_ptr_StorageBuffer_mat3v2float %out %uint_0
+ %27 = OpLoad %mat3v2float %m
+ OpStore %26 %27
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl.expected.wgsl
index d813053..890db00 100644
--- a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl.expected.wgsl
@@ -1 +1,8 @@
var<private> m = mat3x2(vec2<f32>(0.0f, 1.0f), vec2<f32>(2.0f, 3.0f), vec2<f32>(4.0f, 5.0f));
+
+@group(0) @binding(0) var<storage, read_write> out : mat3x2<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x2/load/f16.wgsl b/test/tint/expressions/type_ctor/mat3x2/load/f16.wgsl
index 5055c8f..15b43fc 100644
--- a/test/tint/expressions/type_ctor/mat3x2/load/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x2/load/f16.wgsl
@@ -1,5 +1,10 @@
enable f16;
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat3x2<f16>;
+
+@compute @workgroup_size(1)
fn f() {
- var m = mat3x2<f16>();
- let m_1 = mat3x2(m);
+ var m = mat3x2<f16>();
+ out = mat3x2(m);
}
diff --git a/test/tint/expressions/type_ctor/mat3x2/load/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/load/f16.wgsl.expected.dxc.hlsl
index 54c737d..7fb3795 100644
--- a/test/tint/expressions/type_ctor/mat3x2/load/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x2/load/f16.wgsl.expected.dxc.hlsl
@@ -1,9 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 3, 2> value) {
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 4u), value[1u]);
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 8u), value[2u]);
}
+[numthreads(1, 1, 1)]
void f() {
matrix<float16_t, 3, 2> m = matrix<float16_t, 3, 2>((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx);
- const matrix<float16_t, 3, 2> m_1 = matrix<float16_t, 3, 2>(m);
+ tint_symbol_store(0u, matrix<float16_t, 3, 2>(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat3x2/load/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x2/load/f16.wgsl.expected.glsl
index eb943c0..eb2f8e8 100644
--- a/test/tint/expressions/type_ctor/mat3x2/load/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat3x2/load/f16.wgsl.expected.glsl
@@ -1,12 +1,17 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
- return;
-}
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat3x2 inner;
+} tint_symbol;
+
void f() {
f16mat3x2 m = f16mat3x2(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf));
- f16mat3x2 m_1 = f16mat3x2(m);
+ tint_symbol.inner = f16mat3x2(m);
}
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ f();
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x2/load/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x2/load/f16.wgsl.expected.msl
index a4a5b4e..2324c65 100644
--- a/test/tint/expressions/type_ctor/mat3x2/load/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat3x2/load/f16.wgsl.expected.msl
@@ -1,8 +1,9 @@
#include <metal_stdlib>
using namespace metal;
-void f() {
+kernel void f(device half3x2* tint_symbol [[buffer(0)]]) {
half3x2 m = half3x2(half2(0.0h), half2(0.0h), half2(0.0h));
- half3x2 const m_1 = half3x2(m);
+ *(tint_symbol) = half3x2(m);
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat3x2/load/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x2/load/f16.wgsl.expected.spvasm
index 3112cc7..00a90f5 100644
--- a/test/tint/expressions/type_ctor/mat3x2/load/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat3x2/load/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 15
+; Bound: 20
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,26 +9,38 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
- OpName %unused_entry_point "unused_entry_point"
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
OpName %f "f"
OpName %m "m"
- %void = OpTypeVoid
- %1 = OpTypeFunction %void
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 4
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v2half = OpTypeVector %half 2
%mat3v2half = OpTypeMatrix %v2half 3
- %10 = OpConstantNull %mat3v2half
+ %out_block = OpTypeStruct %mat3v2half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void
+ %11 = OpConstantNull %mat3v2half
%_ptr_Function_mat3v2half = OpTypePointer Function %mat3v2half
-%unused_entry_point = OpFunction %void None %1
- %4 = OpLabel
- OpReturn
- OpFunctionEnd
- %f = OpFunction %void None %1
- %6 = OpLabel
- %m = OpVariable %_ptr_Function_mat3v2half Function %10
- OpStore %m %10
- %14 = OpLoad %mat3v2half %m
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat3v2half = OpTypePointer StorageBuffer %mat3v2half
+ %f = OpFunction %void None %7
+ %10 = OpLabel
+ %m = OpVariable %_ptr_Function_mat3v2half Function %11
+ OpStore %m %11
+ %17 = OpAccessChain %_ptr_StorageBuffer_mat3v2half %out %uint_0
+ %19 = OpLoad %mat3v2half %m
+ OpStore %17 %19
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat3x2/load/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x2/load/f16.wgsl.expected.wgsl
index aa1e690..e25d044 100644
--- a/test/tint/expressions/type_ctor/mat3x2/load/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x2/load/f16.wgsl.expected.wgsl
@@ -1,6 +1,9 @@
enable f16;
+@group(0) @binding(0) var<storage, read_write> out : mat3x2<f16>;
+
+@compute @workgroup_size(1)
fn f() {
var m = mat3x2<f16>();
- let m_1 = mat3x2(m);
+ out = mat3x2(m);
}
diff --git a/test/tint/expressions/type_ctor/mat3x2/load/f32.wgsl b/test/tint/expressions/type_ctor/mat3x2/load/f32.wgsl
index 07073d9..4c7aa22 100644
--- a/test/tint/expressions/type_ctor/mat3x2/load/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x2/load/f32.wgsl
@@ -1,4 +1,8 @@
+@group(0) @binding(0)
+var<storage, read_write> out : mat3x2<f32>;
+
+@compute @workgroup_size(1)
fn f() {
- var m = mat3x2<f32>();
- let m_1 = mat3x2(m);
+ var m = mat3x2<f32>();
+ out = mat3x2(m);
}
diff --git a/test/tint/expressions/type_ctor/mat3x2/load/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/load/f32.wgsl.expected.dxc.hlsl
index 5ea45e8..8849d54 100644
--- a/test/tint/expressions/type_ctor/mat3x2/load/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x2/load/f32.wgsl.expected.dxc.hlsl
@@ -1,9 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
+ tint_symbol.Store2((offset + 16u), asuint(value[2u]));
}
+[numthreads(1, 1, 1)]
void f() {
float3x2 m = float3x2((0.0f).xx, (0.0f).xx, (0.0f).xx);
- const float3x2 m_1 = float3x2(m);
+ tint_symbol_store(0u, float3x2(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat3x2/load/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/load/f32.wgsl.expected.fxc.hlsl
index 5ea45e8..8849d54 100644
--- a/test/tint/expressions/type_ctor/mat3x2/load/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x2/load/f32.wgsl.expected.fxc.hlsl
@@ -1,9 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
+ tint_symbol.Store2((offset + 16u), asuint(value[2u]));
}
+[numthreads(1, 1, 1)]
void f() {
float3x2 m = float3x2((0.0f).xx, (0.0f).xx, (0.0f).xx);
- const float3x2 m_1 = float3x2(m);
+ tint_symbol_store(0u, float3x2(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat3x2/load/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x2/load/f32.wgsl.expected.glsl
index 018f1f2..d7c6384 100644
--- a/test/tint/expressions/type_ctor/mat3x2/load/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat3x2/load/f32.wgsl.expected.glsl
@@ -1,11 +1,16 @@
#version 310 es
-layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
- return;
-}
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat3x2 inner;
+} tint_symbol;
+
void f() {
mat3x2 m = mat3x2(vec2(0.0f), vec2(0.0f), vec2(0.0f));
- mat3x2 m_1 = mat3x2(m);
+ tint_symbol.inner = mat3x2(m);
}
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ f();
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x2/load/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x2/load/f32.wgsl.expected.msl
index b27479c..0c87cae 100644
--- a/test/tint/expressions/type_ctor/mat3x2/load/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat3x2/load/f32.wgsl.expected.msl
@@ -1,8 +1,9 @@
#include <metal_stdlib>
using namespace metal;
-void f() {
+kernel void f(device float3x2* tint_symbol [[buffer(0)]]) {
float3x2 m = float3x2(float2(0.0f), float2(0.0f), float2(0.0f));
- float3x2 const m_1 = float3x2(m);
+ *(tint_symbol) = float3x2(m);
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat3x2/load/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x2/load/f32.wgsl.expected.spvasm
index 6e73ae3..9f13c6a 100644
--- a/test/tint/expressions/type_ctor/mat3x2/load/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat3x2/load/f32.wgsl.expected.spvasm
@@ -1,30 +1,42 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 15
+; Bound: 20
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
- OpName %unused_entry_point "unused_entry_point"
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
OpName %f "f"
OpName %m "m"
- %void = OpTypeVoid
- %1 = OpTypeFunction %void
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%mat3v2float = OpTypeMatrix %v2float 3
- %10 = OpConstantNull %mat3v2float
+ %out_block = OpTypeStruct %mat3v2float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void
+ %11 = OpConstantNull %mat3v2float
%_ptr_Function_mat3v2float = OpTypePointer Function %mat3v2float
-%unused_entry_point = OpFunction %void None %1
- %4 = OpLabel
- OpReturn
- OpFunctionEnd
- %f = OpFunction %void None %1
- %6 = OpLabel
- %m = OpVariable %_ptr_Function_mat3v2float Function %10
- OpStore %m %10
- %14 = OpLoad %mat3v2float %m
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat3v2float = OpTypePointer StorageBuffer %mat3v2float
+ %f = OpFunction %void None %7
+ %10 = OpLabel
+ %m = OpVariable %_ptr_Function_mat3v2float Function %11
+ OpStore %m %11
+ %17 = OpAccessChain %_ptr_StorageBuffer_mat3v2float %out %uint_0
+ %19 = OpLoad %mat3v2float %m
+ OpStore %17 %19
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat3x2/load/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x2/load/f32.wgsl.expected.wgsl
index 03b3213..d08ee34 100644
--- a/test/tint/expressions/type_ctor/mat3x2/load/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x2/load/f32.wgsl.expected.wgsl
@@ -1,4 +1,7 @@
+@group(0) @binding(0) var<storage, read_write> out : mat3x2<f32>;
+
+@compute @workgroup_size(1)
fn f() {
var m = mat3x2<f32>();
- let m_1 = mat3x2(m);
+ out = mat3x2(m);
}
diff --git a/test/tint/expressions/type_ctor/mat3x2/zero/f16.wgsl b/test/tint/expressions/type_ctor/mat3x2/zero/f16.wgsl
index b1a48ac..087675a 100644
--- a/test/tint/expressions/type_ctor/mat3x2/zero/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x2/zero/f16.wgsl
@@ -1,2 +1,10 @@
enable f16;
var<private> m = mat3x2<f16>();
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat3x2<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x2/zero/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/zero/f16.wgsl.expected.dxc.hlsl
index b04e700..c061f8c 100644
--- a/test/tint/expressions/type_ctor/mat3x2/zero/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x2/zero/f16.wgsl.expected.dxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 3, 2> m = matrix<float16_t, 3, 2>((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx);
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 3, 2> value) {
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 4u), value[1u]);
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 8u), value[2u]);
}
-static matrix<float16_t, 3, 2> m = matrix<float16_t, 3, 2>((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx);
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x2/zero/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x2/zero/f16.wgsl.expected.glsl
index 284ed04..e48d479 100644
--- a/test/tint/expressions/type_ctor/mat3x2/zero/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat3x2/zero/f16.wgsl.expected.glsl
@@ -1,8 +1,17 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
+f16mat3x2 m = f16mat3x2(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat3x2 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-f16mat3x2 m = f16mat3x2(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf));
diff --git a/test/tint/expressions/type_ctor/mat3x2/zero/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x2/zero/f16.wgsl.expected.msl
index 90a5391..66bf406 100644
--- a/test/tint/expressions/type_ctor/mat3x2/zero/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat3x2/zero/f16.wgsl.expected.msl
@@ -5,3 +5,10 @@
half3x2 m;
};
+kernel void f(device half3x2* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half3x2(half2(0.0h), half2(0.0h), half2(0.0h));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat3x2/zero/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x2/zero/f16.wgsl.expected.spvasm
index 679a4b2..9730790 100644
--- a/test/tint/expressions/type_ctor/mat3x2/zero/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat3x2/zero/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 11
+; Bound: 19
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,19 +9,37 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 4
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v2half = OpTypeVector %half 2
%mat3v2half = OpTypeMatrix %v2half 3
%4 = OpConstantNull %mat3v2half
%_ptr_Private_mat3v2half = OpTypePointer Private %mat3v2half
%m = OpVariable %_ptr_Private_mat3v2half Private %4
+ %out_block = OpTypeStruct %mat3v2half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %7 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %7
- %10 = OpLabel
+ %10 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat3v2half = OpTypePointer StorageBuffer %mat3v2half
+ %f = OpFunction %void None %10
+ %13 = OpLabel
+ %17 = OpAccessChain %_ptr_StorageBuffer_mat3v2half %out %uint_0
+ %18 = OpLoad %mat3v2half %m
+ OpStore %17 %18
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat3x2/zero/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x2/zero/f16.wgsl.expected.wgsl
index 0da4464..6e1ff16 100644
--- a/test/tint/expressions/type_ctor/mat3x2/zero/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x2/zero/f16.wgsl.expected.wgsl
@@ -1,3 +1,10 @@
enable f16;
var<private> m = mat3x2<f16>();
+
+@group(0) @binding(0) var<storage, read_write> out : mat3x2<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x2/zero/f32.wgsl b/test/tint/expressions/type_ctor/mat3x2/zero/f32.wgsl
index 817cb6c..4600433 100644
--- a/test/tint/expressions/type_ctor/mat3x2/zero/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x2/zero/f32.wgsl
@@ -1 +1,9 @@
var<private> m = mat3x2<f32>();
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat3x2<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x2/zero/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/zero/f32.wgsl.expected.dxc.hlsl
index b279d96..c3d9071 100644
--- a/test/tint/expressions/type_ctor/mat3x2/zero/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x2/zero/f32.wgsl.expected.dxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float3x2 m = float3x2((0.0f).xx, (0.0f).xx, (0.0f).xx);
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
+ tint_symbol.Store2((offset + 16u), asuint(value[2u]));
}
-static float3x2 m = float3x2((0.0f).xx, (0.0f).xx, (0.0f).xx);
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x2/zero/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/zero/f32.wgsl.expected.fxc.hlsl
index b279d96..c3d9071 100644
--- a/test/tint/expressions/type_ctor/mat3x2/zero/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x2/zero/f32.wgsl.expected.fxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float3x2 m = float3x2((0.0f).xx, (0.0f).xx, (0.0f).xx);
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
+ tint_symbol.Store2((offset + 16u), asuint(value[2u]));
}
-static float3x2 m = float3x2((0.0f).xx, (0.0f).xx, (0.0f).xx);
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x2/zero/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x2/zero/f32.wgsl.expected.glsl
index 809c79a..65fd2d6 100644
--- a/test/tint/expressions/type_ctor/mat3x2/zero/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat3x2/zero/f32.wgsl.expected.glsl
@@ -1,7 +1,16 @@
#version 310 es
+mat3x2 m = mat3x2(vec2(0.0f), vec2(0.0f), vec2(0.0f));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat3x2 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat3x2 m = mat3x2(vec2(0.0f), vec2(0.0f), vec2(0.0f));
diff --git a/test/tint/expressions/type_ctor/mat3x2/zero/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x2/zero/f32.wgsl.expected.msl
index c62ec48..e000947 100644
--- a/test/tint/expressions/type_ctor/mat3x2/zero/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat3x2/zero/f32.wgsl.expected.msl
@@ -5,3 +5,10 @@
float3x2 m;
};
+kernel void f(device float3x2* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float3x2(float2(0.0f), float2(0.0f), float2(0.0f));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat3x2/zero/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x2/zero/f32.wgsl.expected.spvasm
index e4bc4d5..1bb22d2 100644
--- a/test/tint/expressions/type_ctor/mat3x2/zero/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat3x2/zero/f32.wgsl.expected.spvasm
@@ -1,23 +1,41 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 11
+; Bound: 19
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%mat3v2float = OpTypeMatrix %v2float 3
%4 = OpConstantNull %mat3v2float
%_ptr_Private_mat3v2float = OpTypePointer Private %mat3v2float
%m = OpVariable %_ptr_Private_mat3v2float Private %4
+ %out_block = OpTypeStruct %mat3v2float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %7 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %7
- %10 = OpLabel
+ %10 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat3v2float = OpTypePointer StorageBuffer %mat3v2float
+ %f = OpFunction %void None %10
+ %13 = OpLabel
+ %17 = OpAccessChain %_ptr_StorageBuffer_mat3v2float %out %uint_0
+ %18 = OpLoad %mat3v2float %m
+ OpStore %17 %18
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat3x2/zero/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x2/zero/f32.wgsl.expected.wgsl
index 817cb6c..acb0bd5 100644
--- a/test/tint/expressions/type_ctor/mat3x2/zero/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x2/zero/f32.wgsl.expected.wgsl
@@ -1 +1,8 @@
var<private> m = mat3x2<f32>();
+
+@group(0) @binding(0) var<storage, read_write> out : mat3x2<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f16.wgsl b/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f16.wgsl
index ed2caeb..3dd82e1 100644
--- a/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f16.wgsl
@@ -1,9 +1,12 @@
enable f16;
-var<private> m = mat3x3(mat3x3<f16>(0.0h, 1.0h, 2.0h,
- 3.0h, 4.0h, 5.0h,
- 6.0h, 7.0h, 8.0h));
+var<private> m = mat3x3<f16>(mat3x3<f16>(0.0h, 1.0h, 2.0h,
+ 3.0h, 4.0h, 5.0h,
+ 6.0h, 7.0h, 8.0h));
-fn f() -> mat3x3<f16> {
- let m_1 = mat3x3(m);
- return m_1;
+@group(0) @binding(0)
+var<storage, read_write> out : mat3x3<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat3x3<f16>(m);
}
diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f16.wgsl.expected.dxc.hlsl
index a80d0d7..39256aa 100644
--- a/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f16.wgsl.expected.dxc.hlsl
@@ -1,11 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 3, 3> m = matrix<float16_t, 3, 3>(vector<float16_t, 3>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector<float16_t, 3>(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)), vector<float16_t, 3>(float16_t(6.0h), float16_t(7.0h), float16_t(8.0h)));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 3, 3> value) {
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 8u), value[1u]);
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 16u), value[2u]);
}
-static matrix<float16_t, 3, 3> m = matrix<float16_t, 3, 3>(vector<float16_t, 3>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector<float16_t, 3>(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)), vector<float16_t, 3>(float16_t(6.0h), float16_t(7.0h), float16_t(8.0h)));
-
-matrix<float16_t, 3, 3> f() {
- const matrix<float16_t, 3, 3> m_1 = matrix<float16_t, 3, 3>(m);
- return m_1;
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, matrix<float16_t, 3, 3>(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f16.wgsl.expected.glsl
index e2dc0e2..dc9db74 100644
--- a/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f16.wgsl.expected.glsl
@@ -1,13 +1,23 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
- return;
-}
f16mat3 m = f16mat3(f16vec3(0.0hf, 1.0hf, 2.0hf), f16vec3(3.0hf, 4.0hf, 5.0hf), f16vec3(6.0hf, 7.0hf, 8.0hf));
-f16mat3 f() {
- f16mat3 m_1 = f16mat3(m);
- return m_1;
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat3 inner;
+} tint_symbol;
+
+void assign_and_preserve_padding_tint_symbol(f16mat3 value) {
+ tint_symbol.inner[0] = value[0u];
+ tint_symbol.inner[1] = value[1u];
+ tint_symbol.inner[2] = value[2u];
}
+void f() {
+ assign_and_preserve_padding_tint_symbol(f16mat3(m));
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ f();
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f16.wgsl.expected.msl
index 79dab0a..f763dda 100644
--- a/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f16.wgsl.expected.msl
@@ -1,12 +1,38 @@
#include <metal_stdlib>
using namespace metal;
+
+template<typename T, size_t N>
+struct tint_array {
+ const constant T& operator[](size_t i) const constant { return elements[i]; }
+ device T& operator[](size_t i) device { return elements[i]; }
+ const device T& operator[](size_t i) const device { return elements[i]; }
+ thread T& operator[](size_t i) thread { return elements[i]; }
+ const thread T& operator[](size_t i) const thread { return elements[i]; }
+ threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+ const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+ T elements[N];
+};
+
struct tint_private_vars_struct {
half3x3 m;
};
-half3x3 f(thread tint_private_vars_struct* const tint_private_vars) {
- half3x3 const m_1 = half3x3((*(tint_private_vars)).m);
- return m_1;
+struct tint_packed_vec3_f16_array_element {
+ /* 0x0000 */ packed_half3 elements;
+ /* 0x0006 */ tint_array<int8_t, 2> tint_pad;
+};
+
+void assign_and_preserve_padding(device tint_array<tint_packed_vec3_f16_array_element, 3>* const dest, half3x3 value) {
+ (*(dest))[0u].elements = packed_half3(value[0u]);
+ (*(dest))[1u].elements = packed_half3(value[1u]);
+ (*(dest))[2u].elements = packed_half3(value[2u]);
+}
+
+kernel void f(device tint_array<tint_packed_vec3_f16_array_element, 3>* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half3x3(half3(0.0h, 1.0h, 2.0h), half3(3.0h, 4.0h, 5.0h), half3(6.0h, 7.0h, 8.0h));
+ assign_and_preserve_padding(tint_symbol, half3x3(tint_private_vars.m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f16.wgsl.expected.spvasm
index b72423e..62eceb9 100644
--- a/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 28
+; Bound: 49
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,11 +9,21 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %assign_and_preserve_padding_out "assign_and_preserve_padding_out"
+ OpName %value "value"
OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v3half = OpTypeVector %half 3
%mat3v3half = OpTypeMatrix %v3half 3
@@ -32,15 +42,39 @@
%16 = OpConstantComposite %mat3v3half %7 %11 %15
%_ptr_Private_mat3v3half = OpTypePointer Private %mat3v3half
%m = OpVariable %_ptr_Private_mat3v3half Private %16
+ %out_block = OpTypeStruct %mat3v3half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %19 = OpTypeFunction %void
- %23 = OpTypeFunction %mat3v3half
-%unused_entry_point = OpFunction %void None %19
- %22 = OpLabel
+ %22 = OpTypeFunction %void %mat3v3half
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %30 = OpConstantNull %int
+%_ptr_StorageBuffer_v3half = OpTypePointer StorageBuffer %v3half
+ %33 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+ %int_2 = OpConstant %int 2
+ %uint_2 = OpConstant %uint 2
+ %43 = OpTypeFunction %void
+%assign_and_preserve_padding_out = OpFunction %void None %22
+ %value = OpFunctionParameter %mat3v3half
+ %26 = OpLabel
+ %32 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %30
+ %34 = OpCompositeExtract %v3half %value 0
+ OpStore %32 %34
+ %36 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %int_1
+ %38 = OpCompositeExtract %v3half %value 1
+ OpStore %36 %38
+ %40 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %int_2
+ %42 = OpCompositeExtract %v3half %value 2
+ OpStore %40 %42
OpReturn
OpFunctionEnd
- %f = OpFunction %mat3v3half None %23
- %25 = OpLabel
- %27 = OpLoad %mat3v3half %m
- OpReturnValue %27
+ %f = OpFunction %void None %43
+ %45 = OpLabel
+ %48 = OpLoad %mat3v3half %m
+ %46 = OpFunctionCall %void %assign_and_preserve_padding_out %48
+ OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f16.wgsl.expected.wgsl
index d6147b9..23d803a 100644
--- a/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f16.wgsl.expected.wgsl
@@ -1,8 +1,10 @@
enable f16;
-var<private> m = mat3x3(mat3x3<f16>(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h, 8.0h));
+var<private> m = mat3x3<f16>(mat3x3<f16>(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h, 8.0h));
-fn f() -> mat3x3<f16> {
- let m_1 = mat3x3(m);
- return m_1;
+@group(0) @binding(0) var<storage, read_write> out : mat3x3<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat3x3<f16>(m);
}
diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f32.wgsl b/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f32.wgsl
index f3b62f5..055f1fe 100644
--- a/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f32.wgsl
@@ -2,7 +2,10 @@
3.0f, 4.0f, 5.0f,
6.0f, 7.0f, 8.0f));
-fn f() -> mat3x3<f32> {
- let m_1 = mat3x3(m);
- return m_1;
+@group(0) @binding(0)
+var<storage, read_write> out : mat3x3<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat3x3<f32>(m);
}
diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f32.wgsl.expected.dxc.hlsl
index 2d4c4b2..f1c2622 100644
--- a/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f32.wgsl.expected.dxc.hlsl
@@ -1,11 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float3x3 m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store3((offset + 32u), asuint(value[2u]));
}
-static float3x3 m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f));
-
-float3x3 f() {
- const float3x3 m_1 = float3x3(m);
- return m_1;
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float3x3(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f32.wgsl.expected.fxc.hlsl
index 2d4c4b2..f1c2622 100644
--- a/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f32.wgsl.expected.fxc.hlsl
@@ -1,11 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float3x3 m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store3((offset + 32u), asuint(value[2u]));
}
-static float3x3 m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f));
-
-float3x3 f() {
- const float3x3 m_1 = float3x3(m);
- return m_1;
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float3x3(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f32.wgsl.expected.glsl
index 6bb27b8..34fd224 100644
--- a/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f32.wgsl.expected.glsl
@@ -1,12 +1,22 @@
#version 310 es
-layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
- return;
-}
mat3 m = mat3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f), vec3(6.0f, 7.0f, 8.0f));
-mat3 f() {
- mat3 m_1 = mat3(m);
- return m_1;
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat3 inner;
+} tint_symbol;
+
+void assign_and_preserve_padding_tint_symbol(mat3 value) {
+ tint_symbol.inner[0] = value[0u];
+ tint_symbol.inner[1] = value[1u];
+ tint_symbol.inner[2] = value[2u];
}
+void f() {
+ assign_and_preserve_padding_tint_symbol(mat3(m));
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ f();
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f32.wgsl.expected.msl
index 301de24..4034c3a 100644
--- a/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f32.wgsl.expected.msl
@@ -1,12 +1,38 @@
#include <metal_stdlib>
using namespace metal;
+
+template<typename T, size_t N>
+struct tint_array {
+ const constant T& operator[](size_t i) const constant { return elements[i]; }
+ device T& operator[](size_t i) device { return elements[i]; }
+ const device T& operator[](size_t i) const device { return elements[i]; }
+ thread T& operator[](size_t i) thread { return elements[i]; }
+ const thread T& operator[](size_t i) const thread { return elements[i]; }
+ threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+ const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+ T elements[N];
+};
+
struct tint_private_vars_struct {
float3x3 m;
};
-float3x3 f(thread tint_private_vars_struct* const tint_private_vars) {
- float3x3 const m_1 = float3x3((*(tint_private_vars)).m);
- return m_1;
+struct tint_packed_vec3_f32_array_element {
+ /* 0x0000 */ packed_float3 elements;
+ /* 0x000c */ tint_array<int8_t, 4> tint_pad;
+};
+
+void assign_and_preserve_padding(device tint_array<tint_packed_vec3_f32_array_element, 3>* const dest, float3x3 value) {
+ (*(dest))[0u].elements = packed_float3(value[0u]);
+ (*(dest))[1u].elements = packed_float3(value[1u]);
+ (*(dest))[2u].elements = packed_float3(value[2u]);
+}
+
+kernel void f(device tint_array<tint_packed_vec3_f32_array_element, 3>* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f));
+ assign_and_preserve_padding(tint_symbol, float3x3(tint_private_vars.m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f32.wgsl.expected.spvasm
index 4fe3bbd..1d9f2d0 100644
--- a/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f32.wgsl.expected.spvasm
@@ -1,15 +1,25 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 28
+; Bound: 49
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %assign_and_preserve_padding_out "assign_and_preserve_padding_out"
+ OpName %value "value"
OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%mat3v3float = OpTypeMatrix %v3float 3
@@ -28,15 +38,39 @@
%16 = OpConstantComposite %mat3v3float %7 %11 %15
%_ptr_Private_mat3v3float = OpTypePointer Private %mat3v3float
%m = OpVariable %_ptr_Private_mat3v3float Private %16
+ %out_block = OpTypeStruct %mat3v3float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %19 = OpTypeFunction %void
- %23 = OpTypeFunction %mat3v3float
-%unused_entry_point = OpFunction %void None %19
- %22 = OpLabel
+ %22 = OpTypeFunction %void %mat3v3float
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %30 = OpConstantNull %int
+%_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float
+ %33 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+ %int_2 = OpConstant %int 2
+ %uint_2 = OpConstant %uint 2
+ %43 = OpTypeFunction %void
+%assign_and_preserve_padding_out = OpFunction %void None %22
+ %value = OpFunctionParameter %mat3v3float
+ %26 = OpLabel
+ %32 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %30
+ %34 = OpCompositeExtract %v3float %value 0
+ OpStore %32 %34
+ %36 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_1
+ %38 = OpCompositeExtract %v3float %value 1
+ OpStore %36 %38
+ %40 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_2
+ %42 = OpCompositeExtract %v3float %value 2
+ OpStore %40 %42
OpReturn
OpFunctionEnd
- %f = OpFunction %mat3v3float None %23
- %25 = OpLabel
- %27 = OpLoad %mat3v3float %m
- OpReturnValue %27
+ %f = OpFunction %void None %43
+ %45 = OpLabel
+ %48 = OpLoad %mat3v3float %m
+ %46 = OpFunctionCall %void %assign_and_preserve_padding_out %48
+ OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f32.wgsl.expected.wgsl
index 028783d..79945a8 100644
--- a/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f32.wgsl.expected.wgsl
@@ -1,6 +1,8 @@
var<private> m = mat3x3(mat3x3<f32>(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f));
-fn f() -> mat3x3<f32> {
- let m_1 = mat3x3(m);
- return m_1;
+@group(0) @binding(0) var<storage, read_write> out : mat3x3<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat3x3<f32>(m);
}
diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f16.wgsl b/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f16.wgsl
index 97694e2..46e52cc 100644
--- a/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f16.wgsl
@@ -2,3 +2,11 @@
var<private> m = mat3x3<f16>(0.0h, 1.0h, 2.0h,
3.0h, 4.0h, 5.0h,
6.0h, 7.0h, 8.0h);
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat3x3<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f16.wgsl.expected.dxc.hlsl
index 1405c16..b5b8022 100644
--- a/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f16.wgsl.expected.dxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 3, 3> m = matrix<float16_t, 3, 3>(vector<float16_t, 3>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector<float16_t, 3>(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)), vector<float16_t, 3>(float16_t(6.0h), float16_t(7.0h), float16_t(8.0h)));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 3, 3> value) {
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 8u), value[1u]);
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 16u), value[2u]);
}
-static matrix<float16_t, 3, 3> m = matrix<float16_t, 3, 3>(vector<float16_t, 3>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector<float16_t, 3>(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)), vector<float16_t, 3>(float16_t(6.0h), float16_t(7.0h), float16_t(8.0h)));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f16.wgsl.expected.glsl
index 1a90ddb..7161c6d 100644
--- a/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f16.wgsl.expected.glsl
@@ -1,8 +1,23 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
+f16mat3 m = f16mat3(f16vec3(0.0hf, 1.0hf, 2.0hf), f16vec3(3.0hf, 4.0hf, 5.0hf), f16vec3(6.0hf, 7.0hf, 8.0hf));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat3 inner;
+} tint_symbol;
+
+void assign_and_preserve_padding_tint_symbol(f16mat3 value) {
+ tint_symbol.inner[0] = value[0u];
+ tint_symbol.inner[1] = value[1u];
+ tint_symbol.inner[2] = value[2u];
+}
+
+void f() {
+ assign_and_preserve_padding_tint_symbol(m);
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-f16mat3 m = f16mat3(f16vec3(0.0hf, 1.0hf, 2.0hf), f16vec3(3.0hf, 4.0hf, 5.0hf), f16vec3(6.0hf, 7.0hf, 8.0hf));
diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f16.wgsl.expected.msl
index f72a892..9519f53 100644
--- a/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f16.wgsl.expected.msl
@@ -1,7 +1,38 @@
#include <metal_stdlib>
using namespace metal;
+
+template<typename T, size_t N>
+struct tint_array {
+ const constant T& operator[](size_t i) const constant { return elements[i]; }
+ device T& operator[](size_t i) device { return elements[i]; }
+ const device T& operator[](size_t i) const device { return elements[i]; }
+ thread T& operator[](size_t i) thread { return elements[i]; }
+ const thread T& operator[](size_t i) const thread { return elements[i]; }
+ threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+ const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+ T elements[N];
+};
+
struct tint_private_vars_struct {
half3x3 m;
};
+struct tint_packed_vec3_f16_array_element {
+ /* 0x0000 */ packed_half3 elements;
+ /* 0x0006 */ tint_array<int8_t, 2> tint_pad;
+};
+
+void assign_and_preserve_padding(device tint_array<tint_packed_vec3_f16_array_element, 3>* const dest, half3x3 value) {
+ (*(dest))[0u].elements = packed_half3(value[0u]);
+ (*(dest))[1u].elements = packed_half3(value[1u]);
+ (*(dest))[2u].elements = packed_half3(value[2u]);
+}
+
+kernel void f(device tint_array<tint_packed_vec3_f16_array_element, 3>* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half3x3(half3(0.0h, 1.0h, 2.0h), half3(3.0h, 4.0h, 5.0h), half3(6.0h, 7.0h, 8.0h));
+ assign_and_preserve_padding(tint_symbol, tint_private_vars.m);
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f16.wgsl.expected.spvasm
index 891215c..5818e94 100644
--- a/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 23
+; Bound: 48
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,10 +9,21 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %assign_and_preserve_padding_out "assign_and_preserve_padding_out"
+ OpName %value "value"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v3half = OpTypeVector %half 3
%mat3v3half = OpTypeMatrix %v3half 3
@@ -31,9 +42,39 @@
%16 = OpConstantComposite %mat3v3half %7 %11 %15
%_ptr_Private_mat3v3half = OpTypePointer Private %mat3v3half
%m = OpVariable %_ptr_Private_mat3v3half Private %16
+ %out_block = OpTypeStruct %mat3v3half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %19 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %19
- %22 = OpLabel
+ %22 = OpTypeFunction %void %mat3v3half
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %30 = OpConstantNull %int
+%_ptr_StorageBuffer_v3half = OpTypePointer StorageBuffer %v3half
+ %33 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+ %int_2 = OpConstant %int 2
+ %uint_2 = OpConstant %uint 2
+ %43 = OpTypeFunction %void
+%assign_and_preserve_padding_out = OpFunction %void None %22
+ %value = OpFunctionParameter %mat3v3half
+ %26 = OpLabel
+ %32 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %30
+ %34 = OpCompositeExtract %v3half %value 0
+ OpStore %32 %34
+ %36 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %int_1
+ %38 = OpCompositeExtract %v3half %value 1
+ OpStore %36 %38
+ %40 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %int_2
+ %42 = OpCompositeExtract %v3half %value 2
+ OpStore %40 %42
+ OpReturn
+ OpFunctionEnd
+ %f = OpFunction %void None %43
+ %45 = OpLabel
+ %47 = OpLoad %mat3v3half %m
+ %46 = OpFunctionCall %void %assign_and_preserve_padding_out %47
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f16.wgsl.expected.wgsl
index abe3dbe..421473d 100644
--- a/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f16.wgsl.expected.wgsl
@@ -1,3 +1,10 @@
enable f16;
var<private> m = mat3x3<f16>(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h, 8.0h);
+
+@group(0) @binding(0) var<storage, read_write> out : mat3x3<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl b/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl
index 1d80d69..e516aad 100644
--- a/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl
@@ -1,3 +1,11 @@
var<private> m = mat3x3<f32>(0.0f, 1.0f, 2.0f,
3.0f, 4.0f, 5.0f,
6.0f, 7.0f, 8.0f);
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat3x3<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl.expected.dxc.hlsl
index 65b0c98..d0fdb3a 100644
--- a/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl.expected.dxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float3x3 m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store3((offset + 32u), asuint(value[2u]));
}
-static float3x3 m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl.expected.fxc.hlsl
index 65b0c98..d0fdb3a 100644
--- a/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl.expected.fxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float3x3 m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store3((offset + 32u), asuint(value[2u]));
}
-static float3x3 m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl.expected.glsl
index 31b0b4a..7253918 100644
--- a/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl.expected.glsl
@@ -1,7 +1,22 @@
#version 310 es
+mat3 m = mat3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f), vec3(6.0f, 7.0f, 8.0f));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat3 inner;
+} tint_symbol;
+
+void assign_and_preserve_padding_tint_symbol(mat3 value) {
+ tint_symbol.inner[0] = value[0u];
+ tint_symbol.inner[1] = value[1u];
+ tint_symbol.inner[2] = value[2u];
+}
+
+void f() {
+ assign_and_preserve_padding_tint_symbol(m);
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat3 m = mat3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f), vec3(6.0f, 7.0f, 8.0f));
diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl.expected.msl
index 98767cf..a8f67b8 100644
--- a/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl.expected.msl
@@ -1,7 +1,38 @@
#include <metal_stdlib>
using namespace metal;
+
+template<typename T, size_t N>
+struct tint_array {
+ const constant T& operator[](size_t i) const constant { return elements[i]; }
+ device T& operator[](size_t i) device { return elements[i]; }
+ const device T& operator[](size_t i) const device { return elements[i]; }
+ thread T& operator[](size_t i) thread { return elements[i]; }
+ const thread T& operator[](size_t i) const thread { return elements[i]; }
+ threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+ const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+ T elements[N];
+};
+
struct tint_private_vars_struct {
float3x3 m;
};
+struct tint_packed_vec3_f32_array_element {
+ /* 0x0000 */ packed_float3 elements;
+ /* 0x000c */ tint_array<int8_t, 4> tint_pad;
+};
+
+void assign_and_preserve_padding(device tint_array<tint_packed_vec3_f32_array_element, 3>* const dest, float3x3 value) {
+ (*(dest))[0u].elements = packed_float3(value[0u]);
+ (*(dest))[1u].elements = packed_float3(value[1u]);
+ (*(dest))[2u].elements = packed_float3(value[2u]);
+}
+
+kernel void f(device tint_array<tint_packed_vec3_f32_array_element, 3>* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f));
+ assign_and_preserve_padding(tint_symbol, tint_private_vars.m);
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl.expected.spvasm
index c0f68aa..457cca0 100644
--- a/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl.expected.spvasm
@@ -1,14 +1,25 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 23
+; Bound: 48
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %assign_and_preserve_padding_out "assign_and_preserve_padding_out"
+ OpName %value "value"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%mat3v3float = OpTypeMatrix %v3float 3
@@ -27,9 +38,39 @@
%16 = OpConstantComposite %mat3v3float %7 %11 %15
%_ptr_Private_mat3v3float = OpTypePointer Private %mat3v3float
%m = OpVariable %_ptr_Private_mat3v3float Private %16
+ %out_block = OpTypeStruct %mat3v3float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %19 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %19
- %22 = OpLabel
+ %22 = OpTypeFunction %void %mat3v3float
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %30 = OpConstantNull %int
+%_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float
+ %33 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+ %int_2 = OpConstant %int 2
+ %uint_2 = OpConstant %uint 2
+ %43 = OpTypeFunction %void
+%assign_and_preserve_padding_out = OpFunction %void None %22
+ %value = OpFunctionParameter %mat3v3float
+ %26 = OpLabel
+ %32 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %30
+ %34 = OpCompositeExtract %v3float %value 0
+ OpStore %32 %34
+ %36 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_1
+ %38 = OpCompositeExtract %v3float %value 1
+ OpStore %36 %38
+ %40 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_2
+ %42 = OpCompositeExtract %v3float %value 2
+ OpStore %40 %42
+ OpReturn
+ OpFunctionEnd
+ %f = OpFunction %void None %43
+ %45 = OpLabel
+ %47 = OpLoad %mat3v3float %m
+ %46 = OpFunctionCall %void %assign_and_preserve_padding_out %47
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl.expected.wgsl
index d1ef960..ab3b36a 100644
--- a/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl.expected.wgsl
@@ -1 +1,8 @@
var<private> m = mat3x3<f32>(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f);
+
+@group(0) @binding(0) var<storage, read_write> out : mat3x3<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f16.wgsl b/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f16.wgsl
index 3afadc1..0aff260 100644
--- a/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f16.wgsl
@@ -2,3 +2,11 @@
var<private> m = mat3x3<f16>(vec3<f16>(0.0h, 1.0h, 2.0h),
vec3<f16>(3.0h, 4.0h, 5.0h),
vec3<f16>(6.0h, 7.0h, 8.0h));
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat3x3<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f16.wgsl.expected.dxc.hlsl
index 1405c16..b5b8022 100644
--- a/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f16.wgsl.expected.dxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 3, 3> m = matrix<float16_t, 3, 3>(vector<float16_t, 3>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector<float16_t, 3>(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)), vector<float16_t, 3>(float16_t(6.0h), float16_t(7.0h), float16_t(8.0h)));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 3, 3> value) {
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 8u), value[1u]);
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 16u), value[2u]);
}
-static matrix<float16_t, 3, 3> m = matrix<float16_t, 3, 3>(vector<float16_t, 3>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector<float16_t, 3>(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)), vector<float16_t, 3>(float16_t(6.0h), float16_t(7.0h), float16_t(8.0h)));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f16.wgsl.expected.glsl
index 1a90ddb..7161c6d 100644
--- a/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f16.wgsl.expected.glsl
@@ -1,8 +1,23 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
+f16mat3 m = f16mat3(f16vec3(0.0hf, 1.0hf, 2.0hf), f16vec3(3.0hf, 4.0hf, 5.0hf), f16vec3(6.0hf, 7.0hf, 8.0hf));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat3 inner;
+} tint_symbol;
+
+void assign_and_preserve_padding_tint_symbol(f16mat3 value) {
+ tint_symbol.inner[0] = value[0u];
+ tint_symbol.inner[1] = value[1u];
+ tint_symbol.inner[2] = value[2u];
+}
+
+void f() {
+ assign_and_preserve_padding_tint_symbol(m);
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-f16mat3 m = f16mat3(f16vec3(0.0hf, 1.0hf, 2.0hf), f16vec3(3.0hf, 4.0hf, 5.0hf), f16vec3(6.0hf, 7.0hf, 8.0hf));
diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f16.wgsl.expected.msl
index f72a892..9519f53 100644
--- a/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f16.wgsl.expected.msl
@@ -1,7 +1,38 @@
#include <metal_stdlib>
using namespace metal;
+
+template<typename T, size_t N>
+struct tint_array {
+ const constant T& operator[](size_t i) const constant { return elements[i]; }
+ device T& operator[](size_t i) device { return elements[i]; }
+ const device T& operator[](size_t i) const device { return elements[i]; }
+ thread T& operator[](size_t i) thread { return elements[i]; }
+ const thread T& operator[](size_t i) const thread { return elements[i]; }
+ threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+ const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+ T elements[N];
+};
+
struct tint_private_vars_struct {
half3x3 m;
};
+struct tint_packed_vec3_f16_array_element {
+ /* 0x0000 */ packed_half3 elements;
+ /* 0x0006 */ tint_array<int8_t, 2> tint_pad;
+};
+
+void assign_and_preserve_padding(device tint_array<tint_packed_vec3_f16_array_element, 3>* const dest, half3x3 value) {
+ (*(dest))[0u].elements = packed_half3(value[0u]);
+ (*(dest))[1u].elements = packed_half3(value[1u]);
+ (*(dest))[2u].elements = packed_half3(value[2u]);
+}
+
+kernel void f(device tint_array<tint_packed_vec3_f16_array_element, 3>* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half3x3(half3(0.0h, 1.0h, 2.0h), half3(3.0h, 4.0h, 5.0h), half3(6.0h, 7.0h, 8.0h));
+ assign_and_preserve_padding(tint_symbol, tint_private_vars.m);
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f16.wgsl.expected.spvasm
index 891215c..5818e94 100644
--- a/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 23
+; Bound: 48
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,10 +9,21 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %assign_and_preserve_padding_out "assign_and_preserve_padding_out"
+ OpName %value "value"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v3half = OpTypeVector %half 3
%mat3v3half = OpTypeMatrix %v3half 3
@@ -31,9 +42,39 @@
%16 = OpConstantComposite %mat3v3half %7 %11 %15
%_ptr_Private_mat3v3half = OpTypePointer Private %mat3v3half
%m = OpVariable %_ptr_Private_mat3v3half Private %16
+ %out_block = OpTypeStruct %mat3v3half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %19 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %19
- %22 = OpLabel
+ %22 = OpTypeFunction %void %mat3v3half
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %30 = OpConstantNull %int
+%_ptr_StorageBuffer_v3half = OpTypePointer StorageBuffer %v3half
+ %33 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+ %int_2 = OpConstant %int 2
+ %uint_2 = OpConstant %uint 2
+ %43 = OpTypeFunction %void
+%assign_and_preserve_padding_out = OpFunction %void None %22
+ %value = OpFunctionParameter %mat3v3half
+ %26 = OpLabel
+ %32 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %30
+ %34 = OpCompositeExtract %v3half %value 0
+ OpStore %32 %34
+ %36 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %int_1
+ %38 = OpCompositeExtract %v3half %value 1
+ OpStore %36 %38
+ %40 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %int_2
+ %42 = OpCompositeExtract %v3half %value 2
+ OpStore %40 %42
+ OpReturn
+ OpFunctionEnd
+ %f = OpFunction %void None %43
+ %45 = OpLabel
+ %47 = OpLoad %mat3v3half %m
+ %46 = OpFunctionCall %void %assign_and_preserve_padding_out %47
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f16.wgsl.expected.wgsl
index 9008bed..8b8865c 100644
--- a/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f16.wgsl.expected.wgsl
@@ -1,3 +1,10 @@
enable f16;
var<private> m = mat3x3<f16>(vec3<f16>(0.0h, 1.0h, 2.0h), vec3<f16>(3.0h, 4.0h, 5.0h), vec3<f16>(6.0h, 7.0h, 8.0h));
+
+@group(0) @binding(0) var<storage, read_write> out : mat3x3<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl b/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl
index 8a1972e..4a1e014 100644
--- a/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl
@@ -1,3 +1,11 @@
var<private> m = mat3x3<f32>(vec3<f32>(0.0f, 1.0f, 2.0f),
vec3<f32>(3.0f, 4.0f, 5.0f),
vec3<f32>(6.0f, 7.0f, 8.0f));
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat3x3<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.dxc.hlsl
index 65b0c98..d0fdb3a 100644
--- a/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.dxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float3x3 m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store3((offset + 32u), asuint(value[2u]));
}
-static float3x3 m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.fxc.hlsl
index 65b0c98..d0fdb3a 100644
--- a/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.fxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float3x3 m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store3((offset + 32u), asuint(value[2u]));
}
-static float3x3 m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.glsl
index 31b0b4a..7253918 100644
--- a/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.glsl
@@ -1,7 +1,22 @@
#version 310 es
+mat3 m = mat3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f), vec3(6.0f, 7.0f, 8.0f));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat3 inner;
+} tint_symbol;
+
+void assign_and_preserve_padding_tint_symbol(mat3 value) {
+ tint_symbol.inner[0] = value[0u];
+ tint_symbol.inner[1] = value[1u];
+ tint_symbol.inner[2] = value[2u];
+}
+
+void f() {
+ assign_and_preserve_padding_tint_symbol(m);
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat3 m = mat3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f), vec3(6.0f, 7.0f, 8.0f));
diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.msl
index 98767cf..a8f67b8 100644
--- a/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.msl
@@ -1,7 +1,38 @@
#include <metal_stdlib>
using namespace metal;
+
+template<typename T, size_t N>
+struct tint_array {
+ const constant T& operator[](size_t i) const constant { return elements[i]; }
+ device T& operator[](size_t i) device { return elements[i]; }
+ const device T& operator[](size_t i) const device { return elements[i]; }
+ thread T& operator[](size_t i) thread { return elements[i]; }
+ const thread T& operator[](size_t i) const thread { return elements[i]; }
+ threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+ const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+ T elements[N];
+};
+
struct tint_private_vars_struct {
float3x3 m;
};
+struct tint_packed_vec3_f32_array_element {
+ /* 0x0000 */ packed_float3 elements;
+ /* 0x000c */ tint_array<int8_t, 4> tint_pad;
+};
+
+void assign_and_preserve_padding(device tint_array<tint_packed_vec3_f32_array_element, 3>* const dest, float3x3 value) {
+ (*(dest))[0u].elements = packed_float3(value[0u]);
+ (*(dest))[1u].elements = packed_float3(value[1u]);
+ (*(dest))[2u].elements = packed_float3(value[2u]);
+}
+
+kernel void f(device tint_array<tint_packed_vec3_f32_array_element, 3>* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f));
+ assign_and_preserve_padding(tint_symbol, tint_private_vars.m);
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.spvasm
index c0f68aa..457cca0 100644
--- a/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.spvasm
@@ -1,14 +1,25 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 23
+; Bound: 48
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %assign_and_preserve_padding_out "assign_and_preserve_padding_out"
+ OpName %value "value"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%mat3v3float = OpTypeMatrix %v3float 3
@@ -27,9 +38,39 @@
%16 = OpConstantComposite %mat3v3float %7 %11 %15
%_ptr_Private_mat3v3float = OpTypePointer Private %mat3v3float
%m = OpVariable %_ptr_Private_mat3v3float Private %16
+ %out_block = OpTypeStruct %mat3v3float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %19 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %19
- %22 = OpLabel
+ %22 = OpTypeFunction %void %mat3v3float
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %30 = OpConstantNull %int
+%_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float
+ %33 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+ %int_2 = OpConstant %int 2
+ %uint_2 = OpConstant %uint 2
+ %43 = OpTypeFunction %void
+%assign_and_preserve_padding_out = OpFunction %void None %22
+ %value = OpFunctionParameter %mat3v3float
+ %26 = OpLabel
+ %32 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %30
+ %34 = OpCompositeExtract %v3float %value 0
+ OpStore %32 %34
+ %36 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_1
+ %38 = OpCompositeExtract %v3float %value 1
+ OpStore %36 %38
+ %40 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_2
+ %42 = OpCompositeExtract %v3float %value 2
+ OpStore %40 %42
+ OpReturn
+ OpFunctionEnd
+ %f = OpFunction %void None %43
+ %45 = OpLabel
+ %47 = OpLoad %mat3v3float %m
+ %46 = OpFunctionCall %void %assign_and_preserve_padding_out %47
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.wgsl
index 914a6a7..5644493 100644
--- a/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.wgsl
@@ -1 +1,8 @@
var<private> m = mat3x3<f32>(vec3<f32>(0.0f, 1.0f, 2.0f), vec3<f32>(3.0f, 4.0f, 5.0f), vec3<f32>(6.0f, 7.0f, 8.0f));
+
+@group(0) @binding(0) var<storage, read_write> out : mat3x3<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f16.wgsl b/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f16.wgsl
index 8e269f5..88314da 100644
--- a/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f16.wgsl
@@ -3,7 +3,10 @@
3.0h, 4.0h, 5.0h,
6.0h, 7.0h, 8.0h));
-fn f() -> mat3x3<f16> {
- let m_1 = mat3x3(m);
- return m_1;
+@group(0) @binding(0)
+var<storage, read_write> out : mat3x3<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat3x3(m);
}
diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f16.wgsl.expected.dxc.hlsl
index a80d0d7..39256aa 100644
--- a/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f16.wgsl.expected.dxc.hlsl
@@ -1,11 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 3, 3> m = matrix<float16_t, 3, 3>(vector<float16_t, 3>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector<float16_t, 3>(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)), vector<float16_t, 3>(float16_t(6.0h), float16_t(7.0h), float16_t(8.0h)));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 3, 3> value) {
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 8u), value[1u]);
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 16u), value[2u]);
}
-static matrix<float16_t, 3, 3> m = matrix<float16_t, 3, 3>(vector<float16_t, 3>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector<float16_t, 3>(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)), vector<float16_t, 3>(float16_t(6.0h), float16_t(7.0h), float16_t(8.0h)));
-
-matrix<float16_t, 3, 3> f() {
- const matrix<float16_t, 3, 3> m_1 = matrix<float16_t, 3, 3>(m);
- return m_1;
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, matrix<float16_t, 3, 3>(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f16.wgsl.expected.glsl
index e2dc0e2..dc9db74 100644
--- a/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f16.wgsl.expected.glsl
@@ -1,13 +1,23 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
- return;
-}
f16mat3 m = f16mat3(f16vec3(0.0hf, 1.0hf, 2.0hf), f16vec3(3.0hf, 4.0hf, 5.0hf), f16vec3(6.0hf, 7.0hf, 8.0hf));
-f16mat3 f() {
- f16mat3 m_1 = f16mat3(m);
- return m_1;
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat3 inner;
+} tint_symbol;
+
+void assign_and_preserve_padding_tint_symbol(f16mat3 value) {
+ tint_symbol.inner[0] = value[0u];
+ tint_symbol.inner[1] = value[1u];
+ tint_symbol.inner[2] = value[2u];
}
+void f() {
+ assign_and_preserve_padding_tint_symbol(f16mat3(m));
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ f();
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f16.wgsl.expected.msl
index 79dab0a..f763dda 100644
--- a/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f16.wgsl.expected.msl
@@ -1,12 +1,38 @@
#include <metal_stdlib>
using namespace metal;
+
+template<typename T, size_t N>
+struct tint_array {
+ const constant T& operator[](size_t i) const constant { return elements[i]; }
+ device T& operator[](size_t i) device { return elements[i]; }
+ const device T& operator[](size_t i) const device { return elements[i]; }
+ thread T& operator[](size_t i) thread { return elements[i]; }
+ const thread T& operator[](size_t i) const thread { return elements[i]; }
+ threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+ const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+ T elements[N];
+};
+
struct tint_private_vars_struct {
half3x3 m;
};
-half3x3 f(thread tint_private_vars_struct* const tint_private_vars) {
- half3x3 const m_1 = half3x3((*(tint_private_vars)).m);
- return m_1;
+struct tint_packed_vec3_f16_array_element {
+ /* 0x0000 */ packed_half3 elements;
+ /* 0x0006 */ tint_array<int8_t, 2> tint_pad;
+};
+
+void assign_and_preserve_padding(device tint_array<tint_packed_vec3_f16_array_element, 3>* const dest, half3x3 value) {
+ (*(dest))[0u].elements = packed_half3(value[0u]);
+ (*(dest))[1u].elements = packed_half3(value[1u]);
+ (*(dest))[2u].elements = packed_half3(value[2u]);
+}
+
+kernel void f(device tint_array<tint_packed_vec3_f16_array_element, 3>* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half3x3(half3(0.0h, 1.0h, 2.0h), half3(3.0h, 4.0h, 5.0h), half3(6.0h, 7.0h, 8.0h));
+ assign_and_preserve_padding(tint_symbol, half3x3(tint_private_vars.m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f16.wgsl.expected.spvasm
index b72423e..62eceb9 100644
--- a/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 28
+; Bound: 49
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,11 +9,21 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %assign_and_preserve_padding_out "assign_and_preserve_padding_out"
+ OpName %value "value"
OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v3half = OpTypeVector %half 3
%mat3v3half = OpTypeMatrix %v3half 3
@@ -32,15 +42,39 @@
%16 = OpConstantComposite %mat3v3half %7 %11 %15
%_ptr_Private_mat3v3half = OpTypePointer Private %mat3v3half
%m = OpVariable %_ptr_Private_mat3v3half Private %16
+ %out_block = OpTypeStruct %mat3v3half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %19 = OpTypeFunction %void
- %23 = OpTypeFunction %mat3v3half
-%unused_entry_point = OpFunction %void None %19
- %22 = OpLabel
+ %22 = OpTypeFunction %void %mat3v3half
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %30 = OpConstantNull %int
+%_ptr_StorageBuffer_v3half = OpTypePointer StorageBuffer %v3half
+ %33 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+ %int_2 = OpConstant %int 2
+ %uint_2 = OpConstant %uint 2
+ %43 = OpTypeFunction %void
+%assign_and_preserve_padding_out = OpFunction %void None %22
+ %value = OpFunctionParameter %mat3v3half
+ %26 = OpLabel
+ %32 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %30
+ %34 = OpCompositeExtract %v3half %value 0
+ OpStore %32 %34
+ %36 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %int_1
+ %38 = OpCompositeExtract %v3half %value 1
+ OpStore %36 %38
+ %40 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %int_2
+ %42 = OpCompositeExtract %v3half %value 2
+ OpStore %40 %42
OpReturn
OpFunctionEnd
- %f = OpFunction %mat3v3half None %23
- %25 = OpLabel
- %27 = OpLoad %mat3v3half %m
- OpReturnValue %27
+ %f = OpFunction %void None %43
+ %45 = OpLabel
+ %48 = OpLoad %mat3v3half %m
+ %46 = OpFunctionCall %void %assign_and_preserve_padding_out %48
+ OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f16.wgsl.expected.wgsl
index a93d332..85d52b9 100644
--- a/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f16.wgsl.expected.wgsl
@@ -2,7 +2,9 @@
var<private> m = mat3x3(mat3x3(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h, 8.0h));
-fn f() -> mat3x3<f16> {
- let m_1 = mat3x3(m);
- return m_1;
+@group(0) @binding(0) var<storage, read_write> out : mat3x3<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat3x3(m);
}
diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f32.wgsl b/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f32.wgsl
index b06cadc..1ed7679 100644
--- a/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f32.wgsl
@@ -2,7 +2,10 @@
3.0f, 4.0f, 5.0f,
6.0f, 7.0f, 8.0f));
-fn f() -> mat3x3<f32> {
- let m_1 = mat3x3(m);
- return m_1;
+@group(0) @binding(0)
+var<storage, read_write> out : mat3x3<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat3x3(m);
}
diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f32.wgsl.expected.dxc.hlsl
index 2d4c4b2..f1c2622 100644
--- a/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f32.wgsl.expected.dxc.hlsl
@@ -1,11 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float3x3 m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store3((offset + 32u), asuint(value[2u]));
}
-static float3x3 m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f));
-
-float3x3 f() {
- const float3x3 m_1 = float3x3(m);
- return m_1;
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float3x3(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f32.wgsl.expected.fxc.hlsl
index 2d4c4b2..f1c2622 100644
--- a/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f32.wgsl.expected.fxc.hlsl
@@ -1,11 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float3x3 m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store3((offset + 32u), asuint(value[2u]));
}
-static float3x3 m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f));
-
-float3x3 f() {
- const float3x3 m_1 = float3x3(m);
- return m_1;
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float3x3(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f32.wgsl.expected.glsl
index 6bb27b8..34fd224 100644
--- a/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f32.wgsl.expected.glsl
@@ -1,12 +1,22 @@
#version 310 es
-layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
- return;
-}
mat3 m = mat3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f), vec3(6.0f, 7.0f, 8.0f));
-mat3 f() {
- mat3 m_1 = mat3(m);
- return m_1;
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat3 inner;
+} tint_symbol;
+
+void assign_and_preserve_padding_tint_symbol(mat3 value) {
+ tint_symbol.inner[0] = value[0u];
+ tint_symbol.inner[1] = value[1u];
+ tint_symbol.inner[2] = value[2u];
}
+void f() {
+ assign_and_preserve_padding_tint_symbol(mat3(m));
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ f();
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f32.wgsl.expected.msl
index 301de24..4034c3a 100644
--- a/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f32.wgsl.expected.msl
@@ -1,12 +1,38 @@
#include <metal_stdlib>
using namespace metal;
+
+template<typename T, size_t N>
+struct tint_array {
+ const constant T& operator[](size_t i) const constant { return elements[i]; }
+ device T& operator[](size_t i) device { return elements[i]; }
+ const device T& operator[](size_t i) const device { return elements[i]; }
+ thread T& operator[](size_t i) thread { return elements[i]; }
+ const thread T& operator[](size_t i) const thread { return elements[i]; }
+ threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+ const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+ T elements[N];
+};
+
struct tint_private_vars_struct {
float3x3 m;
};
-float3x3 f(thread tint_private_vars_struct* const tint_private_vars) {
- float3x3 const m_1 = float3x3((*(tint_private_vars)).m);
- return m_1;
+struct tint_packed_vec3_f32_array_element {
+ /* 0x0000 */ packed_float3 elements;
+ /* 0x000c */ tint_array<int8_t, 4> tint_pad;
+};
+
+void assign_and_preserve_padding(device tint_array<tint_packed_vec3_f32_array_element, 3>* const dest, float3x3 value) {
+ (*(dest))[0u].elements = packed_float3(value[0u]);
+ (*(dest))[1u].elements = packed_float3(value[1u]);
+ (*(dest))[2u].elements = packed_float3(value[2u]);
+}
+
+kernel void f(device tint_array<tint_packed_vec3_f32_array_element, 3>* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f));
+ assign_and_preserve_padding(tint_symbol, float3x3(tint_private_vars.m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f32.wgsl.expected.spvasm
index 4fe3bbd..1d9f2d0 100644
--- a/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f32.wgsl.expected.spvasm
@@ -1,15 +1,25 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 28
+; Bound: 49
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %assign_and_preserve_padding_out "assign_and_preserve_padding_out"
+ OpName %value "value"
OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%mat3v3float = OpTypeMatrix %v3float 3
@@ -28,15 +38,39 @@
%16 = OpConstantComposite %mat3v3float %7 %11 %15
%_ptr_Private_mat3v3float = OpTypePointer Private %mat3v3float
%m = OpVariable %_ptr_Private_mat3v3float Private %16
+ %out_block = OpTypeStruct %mat3v3float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %19 = OpTypeFunction %void
- %23 = OpTypeFunction %mat3v3float
-%unused_entry_point = OpFunction %void None %19
- %22 = OpLabel
+ %22 = OpTypeFunction %void %mat3v3float
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %30 = OpConstantNull %int
+%_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float
+ %33 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+ %int_2 = OpConstant %int 2
+ %uint_2 = OpConstant %uint 2
+ %43 = OpTypeFunction %void
+%assign_and_preserve_padding_out = OpFunction %void None %22
+ %value = OpFunctionParameter %mat3v3float
+ %26 = OpLabel
+ %32 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %30
+ %34 = OpCompositeExtract %v3float %value 0
+ OpStore %32 %34
+ %36 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_1
+ %38 = OpCompositeExtract %v3float %value 1
+ OpStore %36 %38
+ %40 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_2
+ %42 = OpCompositeExtract %v3float %value 2
+ OpStore %40 %42
OpReturn
OpFunctionEnd
- %f = OpFunction %mat3v3float None %23
- %25 = OpLabel
- %27 = OpLoad %mat3v3float %m
- OpReturnValue %27
+ %f = OpFunction %void None %43
+ %45 = OpLabel
+ %48 = OpLoad %mat3v3float %m
+ %46 = OpFunctionCall %void %assign_and_preserve_padding_out %48
+ OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f32.wgsl.expected.wgsl
index 03f3cd0..849e179 100644
--- a/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f32.wgsl.expected.wgsl
@@ -1,6 +1,8 @@
var<private> m = mat3x3(mat3x3(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f));
-fn f() -> mat3x3<f32> {
- let m_1 = mat3x3(m);
- return m_1;
+@group(0) @binding(0) var<storage, read_write> out : mat3x3<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat3x3(m);
}
diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/abstract-float.wgsl b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/abstract-float.wgsl
index cfb9789..44f7607 100644
--- a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/abstract-float.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/abstract-float.wgsl
@@ -1,3 +1,11 @@
-var<private> m = mat3x3(0.0, 1.0, 2.0,
- 3.0, 4.0, 5.0,
- 6.0, 7.0, 8.0);
+const m = mat3x3(0.0, 1.0, 2.0,
+ 3.0, 4.0, 5.0,
+ 6.0, 7.0, 8.0);
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat3x3<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl
index 65b0c98..3f06b43 100644
--- a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store3((offset + 32u), asuint(value[2u]));
}
-static float3x3 m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f)));
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl
index 65b0c98..3f06b43 100644
--- a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store3((offset + 32u), asuint(value[2u]));
}
-static float3x3 m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f)));
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/abstract-float.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/abstract-float.wgsl.expected.glsl
index 31b0b4a..ca18674 100644
--- a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/abstract-float.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/abstract-float.wgsl.expected.glsl
@@ -1,7 +1,21 @@
#version 310 es
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat3 inner;
+} tint_symbol;
+
+void assign_and_preserve_padding_tint_symbol(mat3 value) {
+ tint_symbol.inner[0] = value[0u];
+ tint_symbol.inner[1] = value[1u];
+ tint_symbol.inner[2] = value[2u];
+}
+
+void f() {
+ assign_and_preserve_padding_tint_symbol(mat3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f), vec3(6.0f, 7.0f, 8.0f)));
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat3 m = mat3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f), vec3(6.0f, 7.0f, 8.0f));
diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/abstract-float.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/abstract-float.wgsl.expected.msl
index 98767cf..2145cbf 100644
--- a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/abstract-float.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/abstract-float.wgsl.expected.msl
@@ -1,7 +1,32 @@
#include <metal_stdlib>
using namespace metal;
-struct tint_private_vars_struct {
- float3x3 m;
+
+template<typename T, size_t N>
+struct tint_array {
+ const constant T& operator[](size_t i) const constant { return elements[i]; }
+ device T& operator[](size_t i) device { return elements[i]; }
+ const device T& operator[](size_t i) const device { return elements[i]; }
+ thread T& operator[](size_t i) thread { return elements[i]; }
+ const thread T& operator[](size_t i) const thread { return elements[i]; }
+ threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+ const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+ T elements[N];
};
+struct tint_packed_vec3_f32_array_element {
+ /* 0x0000 */ packed_float3 elements;
+ /* 0x000c */ tint_array<int8_t, 4> tint_pad;
+};
+
+void assign_and_preserve_padding(device tint_array<tint_packed_vec3_f32_array_element, 3>* const dest, float3x3 value) {
+ (*(dest))[0u].elements = packed_float3(value[0u]);
+ (*(dest))[1u].elements = packed_float3(value[1u]);
+ (*(dest))[2u].elements = packed_float3(value[2u]);
+}
+
+kernel void f(device tint_array<tint_packed_vec3_f32_array_element, 3>* tint_symbol [[buffer(0)]]) {
+ assign_and_preserve_padding(tint_symbol, float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f)));
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/abstract-float.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/abstract-float.wgsl.expected.spvasm
index c0f68aa..845abdc 100644
--- a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/abstract-float.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/abstract-float.wgsl.expected.spvasm
@@ -1,35 +1,72 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 23
+; Bound: 45
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
- OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %assign_and_preserve_padding_out "assign_and_preserve_padding_out"
+ OpName %value "value"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%mat3v3float = OpTypeMatrix %v3float 3
- %4 = OpConstantNull %float
+ %out_block = OpTypeStruct %mat3v3float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void %mat3v3float
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %15 = OpConstantNull %int
+%_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float
+ %18 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+ %int_2 = OpConstant %int 2
+ %uint_2 = OpConstant %uint 2
+ %28 = OpTypeFunction %void
+ %32 = OpConstantNull %float
%float_1 = OpConstant %float 1
%float_2 = OpConstant %float 2
- %7 = OpConstantComposite %v3float %4 %float_1 %float_2
+ %35 = OpConstantComposite %v3float %32 %float_1 %float_2
%float_3 = OpConstant %float 3
%float_4 = OpConstant %float 4
%float_5 = OpConstant %float 5
- %11 = OpConstantComposite %v3float %float_3 %float_4 %float_5
+ %39 = OpConstantComposite %v3float %float_3 %float_4 %float_5
%float_6 = OpConstant %float 6
%float_7 = OpConstant %float 7
%float_8 = OpConstant %float 8
- %15 = OpConstantComposite %v3float %float_6 %float_7 %float_8
- %16 = OpConstantComposite %mat3v3float %7 %11 %15
-%_ptr_Private_mat3v3float = OpTypePointer Private %mat3v3float
- %m = OpVariable %_ptr_Private_mat3v3float Private %16
- %void = OpTypeVoid
- %19 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %19
- %22 = OpLabel
+ %43 = OpConstantComposite %v3float %float_6 %float_7 %float_8
+ %44 = OpConstantComposite %mat3v3float %35 %39 %43
+%assign_and_preserve_padding_out = OpFunction %void None %7
+ %value = OpFunctionParameter %mat3v3float
+ %11 = OpLabel
+ %17 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %15
+ %19 = OpCompositeExtract %v3float %value 0
+ OpStore %17 %19
+ %21 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_1
+ %23 = OpCompositeExtract %v3float %value 1
+ OpStore %21 %23
+ %25 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_2
+ %27 = OpCompositeExtract %v3float %value 2
+ OpStore %25 %27
+ OpReturn
+ OpFunctionEnd
+ %f = OpFunction %void None %28
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %assign_and_preserve_padding_out %44
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/abstract-float.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/abstract-float.wgsl.expected.wgsl
index 51e5689..bd3aa85 100644
--- a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/abstract-float.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/abstract-float.wgsl.expected.wgsl
@@ -1 +1,8 @@
-var<private> m = mat3x3(0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0);
+const m = mat3x3(0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0);
+
+@group(0) @binding(0) var<storage, read_write> out : mat3x3<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f16.wgsl b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f16.wgsl
index 9a5a98e..08f9bea 100644
--- a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f16.wgsl
@@ -2,3 +2,11 @@
var<private> m = mat3x3(0.0h, 1.0h, 2.0h,
3.0h, 4.0h, 5.0h,
6.0h, 7.0h, 8.0h);
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat3x3<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f16.wgsl.expected.dxc.hlsl
index 1405c16..b5b8022 100644
--- a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f16.wgsl.expected.dxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 3, 3> m = matrix<float16_t, 3, 3>(vector<float16_t, 3>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector<float16_t, 3>(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)), vector<float16_t, 3>(float16_t(6.0h), float16_t(7.0h), float16_t(8.0h)));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 3, 3> value) {
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 8u), value[1u]);
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 16u), value[2u]);
}
-static matrix<float16_t, 3, 3> m = matrix<float16_t, 3, 3>(vector<float16_t, 3>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector<float16_t, 3>(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)), vector<float16_t, 3>(float16_t(6.0h), float16_t(7.0h), float16_t(8.0h)));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f16.wgsl.expected.glsl
index 1a90ddb..7161c6d 100644
--- a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f16.wgsl.expected.glsl
@@ -1,8 +1,23 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
+f16mat3 m = f16mat3(f16vec3(0.0hf, 1.0hf, 2.0hf), f16vec3(3.0hf, 4.0hf, 5.0hf), f16vec3(6.0hf, 7.0hf, 8.0hf));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat3 inner;
+} tint_symbol;
+
+void assign_and_preserve_padding_tint_symbol(f16mat3 value) {
+ tint_symbol.inner[0] = value[0u];
+ tint_symbol.inner[1] = value[1u];
+ tint_symbol.inner[2] = value[2u];
+}
+
+void f() {
+ assign_and_preserve_padding_tint_symbol(m);
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-f16mat3 m = f16mat3(f16vec3(0.0hf, 1.0hf, 2.0hf), f16vec3(3.0hf, 4.0hf, 5.0hf), f16vec3(6.0hf, 7.0hf, 8.0hf));
diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f16.wgsl.expected.msl
index f72a892..9519f53 100644
--- a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f16.wgsl.expected.msl
@@ -1,7 +1,38 @@
#include <metal_stdlib>
using namespace metal;
+
+template<typename T, size_t N>
+struct tint_array {
+ const constant T& operator[](size_t i) const constant { return elements[i]; }
+ device T& operator[](size_t i) device { return elements[i]; }
+ const device T& operator[](size_t i) const device { return elements[i]; }
+ thread T& operator[](size_t i) thread { return elements[i]; }
+ const thread T& operator[](size_t i) const thread { return elements[i]; }
+ threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+ const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+ T elements[N];
+};
+
struct tint_private_vars_struct {
half3x3 m;
};
+struct tint_packed_vec3_f16_array_element {
+ /* 0x0000 */ packed_half3 elements;
+ /* 0x0006 */ tint_array<int8_t, 2> tint_pad;
+};
+
+void assign_and_preserve_padding(device tint_array<tint_packed_vec3_f16_array_element, 3>* const dest, half3x3 value) {
+ (*(dest))[0u].elements = packed_half3(value[0u]);
+ (*(dest))[1u].elements = packed_half3(value[1u]);
+ (*(dest))[2u].elements = packed_half3(value[2u]);
+}
+
+kernel void f(device tint_array<tint_packed_vec3_f16_array_element, 3>* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half3x3(half3(0.0h, 1.0h, 2.0h), half3(3.0h, 4.0h, 5.0h), half3(6.0h, 7.0h, 8.0h));
+ assign_and_preserve_padding(tint_symbol, tint_private_vars.m);
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f16.wgsl.expected.spvasm
index 891215c..5818e94 100644
--- a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 23
+; Bound: 48
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,10 +9,21 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %assign_and_preserve_padding_out "assign_and_preserve_padding_out"
+ OpName %value "value"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v3half = OpTypeVector %half 3
%mat3v3half = OpTypeMatrix %v3half 3
@@ -31,9 +42,39 @@
%16 = OpConstantComposite %mat3v3half %7 %11 %15
%_ptr_Private_mat3v3half = OpTypePointer Private %mat3v3half
%m = OpVariable %_ptr_Private_mat3v3half Private %16
+ %out_block = OpTypeStruct %mat3v3half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %19 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %19
- %22 = OpLabel
+ %22 = OpTypeFunction %void %mat3v3half
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %30 = OpConstantNull %int
+%_ptr_StorageBuffer_v3half = OpTypePointer StorageBuffer %v3half
+ %33 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+ %int_2 = OpConstant %int 2
+ %uint_2 = OpConstant %uint 2
+ %43 = OpTypeFunction %void
+%assign_and_preserve_padding_out = OpFunction %void None %22
+ %value = OpFunctionParameter %mat3v3half
+ %26 = OpLabel
+ %32 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %30
+ %34 = OpCompositeExtract %v3half %value 0
+ OpStore %32 %34
+ %36 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %int_1
+ %38 = OpCompositeExtract %v3half %value 1
+ OpStore %36 %38
+ %40 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %int_2
+ %42 = OpCompositeExtract %v3half %value 2
+ OpStore %40 %42
+ OpReturn
+ OpFunctionEnd
+ %f = OpFunction %void None %43
+ %45 = OpLabel
+ %47 = OpLoad %mat3v3half %m
+ %46 = OpFunctionCall %void %assign_and_preserve_padding_out %47
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f16.wgsl.expected.wgsl
index 21482a9..2a783af 100644
--- a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f16.wgsl.expected.wgsl
@@ -1,3 +1,10 @@
enable f16;
var<private> m = mat3x3(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h, 8.0h);
+
+@group(0) @binding(0) var<storage, read_write> out : mat3x3<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl
index 84ea539..533cf65 100644
--- a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl
@@ -1,3 +1,11 @@
var<private> m = mat3x3(0.0f, 1.0f, 2.0f,
3.0f, 4.0f, 5.0f,
6.0f, 7.0f, 8.0f);
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat3x3<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl.expected.dxc.hlsl
index 65b0c98..d0fdb3a 100644
--- a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl.expected.dxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float3x3 m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store3((offset + 32u), asuint(value[2u]));
}
-static float3x3 m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl.expected.fxc.hlsl
index 65b0c98..d0fdb3a 100644
--- a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl.expected.fxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float3x3 m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store3((offset + 32u), asuint(value[2u]));
}
-static float3x3 m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl.expected.glsl
index 31b0b4a..7253918 100644
--- a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl.expected.glsl
@@ -1,7 +1,22 @@
#version 310 es
+mat3 m = mat3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f), vec3(6.0f, 7.0f, 8.0f));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat3 inner;
+} tint_symbol;
+
+void assign_and_preserve_padding_tint_symbol(mat3 value) {
+ tint_symbol.inner[0] = value[0u];
+ tint_symbol.inner[1] = value[1u];
+ tint_symbol.inner[2] = value[2u];
+}
+
+void f() {
+ assign_and_preserve_padding_tint_symbol(m);
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat3 m = mat3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f), vec3(6.0f, 7.0f, 8.0f));
diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl.expected.msl
index 98767cf..a8f67b8 100644
--- a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl.expected.msl
@@ -1,7 +1,38 @@
#include <metal_stdlib>
using namespace metal;
+
+template<typename T, size_t N>
+struct tint_array {
+ const constant T& operator[](size_t i) const constant { return elements[i]; }
+ device T& operator[](size_t i) device { return elements[i]; }
+ const device T& operator[](size_t i) const device { return elements[i]; }
+ thread T& operator[](size_t i) thread { return elements[i]; }
+ const thread T& operator[](size_t i) const thread { return elements[i]; }
+ threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+ const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+ T elements[N];
+};
+
struct tint_private_vars_struct {
float3x3 m;
};
+struct tint_packed_vec3_f32_array_element {
+ /* 0x0000 */ packed_float3 elements;
+ /* 0x000c */ tint_array<int8_t, 4> tint_pad;
+};
+
+void assign_and_preserve_padding(device tint_array<tint_packed_vec3_f32_array_element, 3>* const dest, float3x3 value) {
+ (*(dest))[0u].elements = packed_float3(value[0u]);
+ (*(dest))[1u].elements = packed_float3(value[1u]);
+ (*(dest))[2u].elements = packed_float3(value[2u]);
+}
+
+kernel void f(device tint_array<tint_packed_vec3_f32_array_element, 3>* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f));
+ assign_and_preserve_padding(tint_symbol, tint_private_vars.m);
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl.expected.spvasm
index c0f68aa..457cca0 100644
--- a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl.expected.spvasm
@@ -1,14 +1,25 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 23
+; Bound: 48
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %assign_and_preserve_padding_out "assign_and_preserve_padding_out"
+ OpName %value "value"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%mat3v3float = OpTypeMatrix %v3float 3
@@ -27,9 +38,39 @@
%16 = OpConstantComposite %mat3v3float %7 %11 %15
%_ptr_Private_mat3v3float = OpTypePointer Private %mat3v3float
%m = OpVariable %_ptr_Private_mat3v3float Private %16
+ %out_block = OpTypeStruct %mat3v3float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %19 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %19
- %22 = OpLabel
+ %22 = OpTypeFunction %void %mat3v3float
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %30 = OpConstantNull %int
+%_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float
+ %33 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+ %int_2 = OpConstant %int 2
+ %uint_2 = OpConstant %uint 2
+ %43 = OpTypeFunction %void
+%assign_and_preserve_padding_out = OpFunction %void None %22
+ %value = OpFunctionParameter %mat3v3float
+ %26 = OpLabel
+ %32 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %30
+ %34 = OpCompositeExtract %v3float %value 0
+ OpStore %32 %34
+ %36 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_1
+ %38 = OpCompositeExtract %v3float %value 1
+ OpStore %36 %38
+ %40 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_2
+ %42 = OpCompositeExtract %v3float %value 2
+ OpStore %40 %42
+ OpReturn
+ OpFunctionEnd
+ %f = OpFunction %void None %43
+ %45 = OpLabel
+ %47 = OpLoad %mat3v3float %m
+ %46 = OpFunctionCall %void %assign_and_preserve_padding_out %47
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl.expected.wgsl
index ce6bd44..34fcf6b 100644
--- a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl.expected.wgsl
@@ -1 +1,8 @@
var<private> m = mat3x3(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f);
+
+@group(0) @binding(0) var<storage, read_write> out : mat3x3<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/abstract-float.wgsl b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/abstract-float.wgsl
index d8fa2b4..0af27c6 100644
--- a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/abstract-float.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/abstract-float.wgsl
@@ -1,3 +1,11 @@
-var<private> m = mat3x3(vec3(0.0, 1.0, 2.0),
- vec3(3.0, 4.0, 5.0),
- vec3(6.0, 7.0, 8.0));
+const m = mat3x3(vec3(0.0, 1.0, 2.0),
+ vec3(3.0, 4.0, 5.0),
+ vec3(6.0, 7.0, 8.0));
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat3x3<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl
index 65b0c98..3f06b43 100644
--- a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store3((offset + 32u), asuint(value[2u]));
}
-static float3x3 m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f)));
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl
index 65b0c98..3f06b43 100644
--- a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store3((offset + 32u), asuint(value[2u]));
}
-static float3x3 m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f)));
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/abstract-float.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/abstract-float.wgsl.expected.glsl
index 31b0b4a..ca18674 100644
--- a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/abstract-float.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/abstract-float.wgsl.expected.glsl
@@ -1,7 +1,21 @@
#version 310 es
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat3 inner;
+} tint_symbol;
+
+void assign_and_preserve_padding_tint_symbol(mat3 value) {
+ tint_symbol.inner[0] = value[0u];
+ tint_symbol.inner[1] = value[1u];
+ tint_symbol.inner[2] = value[2u];
+}
+
+void f() {
+ assign_and_preserve_padding_tint_symbol(mat3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f), vec3(6.0f, 7.0f, 8.0f)));
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat3 m = mat3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f), vec3(6.0f, 7.0f, 8.0f));
diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/abstract-float.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/abstract-float.wgsl.expected.msl
index 98767cf..2145cbf 100644
--- a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/abstract-float.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/abstract-float.wgsl.expected.msl
@@ -1,7 +1,32 @@
#include <metal_stdlib>
using namespace metal;
-struct tint_private_vars_struct {
- float3x3 m;
+
+template<typename T, size_t N>
+struct tint_array {
+ const constant T& operator[](size_t i) const constant { return elements[i]; }
+ device T& operator[](size_t i) device { return elements[i]; }
+ const device T& operator[](size_t i) const device { return elements[i]; }
+ thread T& operator[](size_t i) thread { return elements[i]; }
+ const thread T& operator[](size_t i) const thread { return elements[i]; }
+ threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+ const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+ T elements[N];
};
+struct tint_packed_vec3_f32_array_element {
+ /* 0x0000 */ packed_float3 elements;
+ /* 0x000c */ tint_array<int8_t, 4> tint_pad;
+};
+
+void assign_and_preserve_padding(device tint_array<tint_packed_vec3_f32_array_element, 3>* const dest, float3x3 value) {
+ (*(dest))[0u].elements = packed_float3(value[0u]);
+ (*(dest))[1u].elements = packed_float3(value[1u]);
+ (*(dest))[2u].elements = packed_float3(value[2u]);
+}
+
+kernel void f(device tint_array<tint_packed_vec3_f32_array_element, 3>* tint_symbol [[buffer(0)]]) {
+ assign_and_preserve_padding(tint_symbol, float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f)));
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/abstract-float.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/abstract-float.wgsl.expected.spvasm
index c0f68aa..845abdc 100644
--- a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/abstract-float.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/abstract-float.wgsl.expected.spvasm
@@ -1,35 +1,72 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 23
+; Bound: 45
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
- OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %assign_and_preserve_padding_out "assign_and_preserve_padding_out"
+ OpName %value "value"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%mat3v3float = OpTypeMatrix %v3float 3
- %4 = OpConstantNull %float
+ %out_block = OpTypeStruct %mat3v3float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void %mat3v3float
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %15 = OpConstantNull %int
+%_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float
+ %18 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+ %int_2 = OpConstant %int 2
+ %uint_2 = OpConstant %uint 2
+ %28 = OpTypeFunction %void
+ %32 = OpConstantNull %float
%float_1 = OpConstant %float 1
%float_2 = OpConstant %float 2
- %7 = OpConstantComposite %v3float %4 %float_1 %float_2
+ %35 = OpConstantComposite %v3float %32 %float_1 %float_2
%float_3 = OpConstant %float 3
%float_4 = OpConstant %float 4
%float_5 = OpConstant %float 5
- %11 = OpConstantComposite %v3float %float_3 %float_4 %float_5
+ %39 = OpConstantComposite %v3float %float_3 %float_4 %float_5
%float_6 = OpConstant %float 6
%float_7 = OpConstant %float 7
%float_8 = OpConstant %float 8
- %15 = OpConstantComposite %v3float %float_6 %float_7 %float_8
- %16 = OpConstantComposite %mat3v3float %7 %11 %15
-%_ptr_Private_mat3v3float = OpTypePointer Private %mat3v3float
- %m = OpVariable %_ptr_Private_mat3v3float Private %16
- %void = OpTypeVoid
- %19 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %19
- %22 = OpLabel
+ %43 = OpConstantComposite %v3float %float_6 %float_7 %float_8
+ %44 = OpConstantComposite %mat3v3float %35 %39 %43
+%assign_and_preserve_padding_out = OpFunction %void None %7
+ %value = OpFunctionParameter %mat3v3float
+ %11 = OpLabel
+ %17 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %15
+ %19 = OpCompositeExtract %v3float %value 0
+ OpStore %17 %19
+ %21 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_1
+ %23 = OpCompositeExtract %v3float %value 1
+ OpStore %21 %23
+ %25 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_2
+ %27 = OpCompositeExtract %v3float %value 2
+ OpStore %25 %27
+ OpReturn
+ OpFunctionEnd
+ %f = OpFunction %void None %28
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %assign_and_preserve_padding_out %44
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/abstract-float.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/abstract-float.wgsl.expected.wgsl
index 3b34421..22690cd 100644
--- a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/abstract-float.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/abstract-float.wgsl.expected.wgsl
@@ -1 +1,8 @@
-var<private> m = mat3x3(vec3(0.0, 1.0, 2.0), vec3(3.0, 4.0, 5.0), vec3(6.0, 7.0, 8.0));
+const m = mat3x3(vec3(0.0, 1.0, 2.0), vec3(3.0, 4.0, 5.0), vec3(6.0, 7.0, 8.0));
+
+@group(0) @binding(0) var<storage, read_write> out : mat3x3<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f16.wgsl b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f16.wgsl
index ae24d69..76554a4 100644
--- a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f16.wgsl
@@ -2,3 +2,11 @@
var<private> m = mat3x3(vec3<f16>(0.0h, 1.0h, 2.0h),
vec3<f16>(3.0h, 4.0h, 5.0h),
vec3<f16>(6.0h, 7.0h, 8.0h));
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat3x3<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f16.wgsl.expected.dxc.hlsl
index 1405c16..b5b8022 100644
--- a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f16.wgsl.expected.dxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 3, 3> m = matrix<float16_t, 3, 3>(vector<float16_t, 3>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector<float16_t, 3>(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)), vector<float16_t, 3>(float16_t(6.0h), float16_t(7.0h), float16_t(8.0h)));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 3, 3> value) {
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 8u), value[1u]);
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 16u), value[2u]);
}
-static matrix<float16_t, 3, 3> m = matrix<float16_t, 3, 3>(vector<float16_t, 3>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector<float16_t, 3>(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)), vector<float16_t, 3>(float16_t(6.0h), float16_t(7.0h), float16_t(8.0h)));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f16.wgsl.expected.glsl
index 1a90ddb..7161c6d 100644
--- a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f16.wgsl.expected.glsl
@@ -1,8 +1,23 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
+f16mat3 m = f16mat3(f16vec3(0.0hf, 1.0hf, 2.0hf), f16vec3(3.0hf, 4.0hf, 5.0hf), f16vec3(6.0hf, 7.0hf, 8.0hf));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat3 inner;
+} tint_symbol;
+
+void assign_and_preserve_padding_tint_symbol(f16mat3 value) {
+ tint_symbol.inner[0] = value[0u];
+ tint_symbol.inner[1] = value[1u];
+ tint_symbol.inner[2] = value[2u];
+}
+
+void f() {
+ assign_and_preserve_padding_tint_symbol(m);
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-f16mat3 m = f16mat3(f16vec3(0.0hf, 1.0hf, 2.0hf), f16vec3(3.0hf, 4.0hf, 5.0hf), f16vec3(6.0hf, 7.0hf, 8.0hf));
diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f16.wgsl.expected.msl
index f72a892..9519f53 100644
--- a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f16.wgsl.expected.msl
@@ -1,7 +1,38 @@
#include <metal_stdlib>
using namespace metal;
+
+template<typename T, size_t N>
+struct tint_array {
+ const constant T& operator[](size_t i) const constant { return elements[i]; }
+ device T& operator[](size_t i) device { return elements[i]; }
+ const device T& operator[](size_t i) const device { return elements[i]; }
+ thread T& operator[](size_t i) thread { return elements[i]; }
+ const thread T& operator[](size_t i) const thread { return elements[i]; }
+ threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+ const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+ T elements[N];
+};
+
struct tint_private_vars_struct {
half3x3 m;
};
+struct tint_packed_vec3_f16_array_element {
+ /* 0x0000 */ packed_half3 elements;
+ /* 0x0006 */ tint_array<int8_t, 2> tint_pad;
+};
+
+void assign_and_preserve_padding(device tint_array<tint_packed_vec3_f16_array_element, 3>* const dest, half3x3 value) {
+ (*(dest))[0u].elements = packed_half3(value[0u]);
+ (*(dest))[1u].elements = packed_half3(value[1u]);
+ (*(dest))[2u].elements = packed_half3(value[2u]);
+}
+
+kernel void f(device tint_array<tint_packed_vec3_f16_array_element, 3>* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half3x3(half3(0.0h, 1.0h, 2.0h), half3(3.0h, 4.0h, 5.0h), half3(6.0h, 7.0h, 8.0h));
+ assign_and_preserve_padding(tint_symbol, tint_private_vars.m);
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f16.wgsl.expected.spvasm
index 891215c..5818e94 100644
--- a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 23
+; Bound: 48
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,10 +9,21 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %assign_and_preserve_padding_out "assign_and_preserve_padding_out"
+ OpName %value "value"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v3half = OpTypeVector %half 3
%mat3v3half = OpTypeMatrix %v3half 3
@@ -31,9 +42,39 @@
%16 = OpConstantComposite %mat3v3half %7 %11 %15
%_ptr_Private_mat3v3half = OpTypePointer Private %mat3v3half
%m = OpVariable %_ptr_Private_mat3v3half Private %16
+ %out_block = OpTypeStruct %mat3v3half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %19 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %19
- %22 = OpLabel
+ %22 = OpTypeFunction %void %mat3v3half
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %30 = OpConstantNull %int
+%_ptr_StorageBuffer_v3half = OpTypePointer StorageBuffer %v3half
+ %33 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+ %int_2 = OpConstant %int 2
+ %uint_2 = OpConstant %uint 2
+ %43 = OpTypeFunction %void
+%assign_and_preserve_padding_out = OpFunction %void None %22
+ %value = OpFunctionParameter %mat3v3half
+ %26 = OpLabel
+ %32 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %30
+ %34 = OpCompositeExtract %v3half %value 0
+ OpStore %32 %34
+ %36 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %int_1
+ %38 = OpCompositeExtract %v3half %value 1
+ OpStore %36 %38
+ %40 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %int_2
+ %42 = OpCompositeExtract %v3half %value 2
+ OpStore %40 %42
+ OpReturn
+ OpFunctionEnd
+ %f = OpFunction %void None %43
+ %45 = OpLabel
+ %47 = OpLoad %mat3v3half %m
+ %46 = OpFunctionCall %void %assign_and_preserve_padding_out %47
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f16.wgsl.expected.wgsl
index a138f75..fec8fb2 100644
--- a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f16.wgsl.expected.wgsl
@@ -1,3 +1,10 @@
enable f16;
var<private> m = mat3x3(vec3<f16>(0.0h, 1.0h, 2.0h), vec3<f16>(3.0h, 4.0h, 5.0h), vec3<f16>(6.0h, 7.0h, 8.0h));
+
+@group(0) @binding(0) var<storage, read_write> out : mat3x3<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl
index aeff918..f59ad46 100644
--- a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl
@@ -1,3 +1,11 @@
var<private> m = mat3x3(vec3<f32>(0.0f, 1.0f, 2.0f),
vec3<f32>(3.0f, 4.0f, 5.0f),
vec3<f32>(6.0f, 7.0f, 8.0f));
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat3x3<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl.expected.dxc.hlsl
index 65b0c98..d0fdb3a 100644
--- a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl.expected.dxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float3x3 m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store3((offset + 32u), asuint(value[2u]));
}
-static float3x3 m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl.expected.fxc.hlsl
index 65b0c98..d0fdb3a 100644
--- a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl.expected.fxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float3x3 m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store3((offset + 32u), asuint(value[2u]));
}
-static float3x3 m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl.expected.glsl
index 31b0b4a..7253918 100644
--- a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl.expected.glsl
@@ -1,7 +1,22 @@
#version 310 es
+mat3 m = mat3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f), vec3(6.0f, 7.0f, 8.0f));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat3 inner;
+} tint_symbol;
+
+void assign_and_preserve_padding_tint_symbol(mat3 value) {
+ tint_symbol.inner[0] = value[0u];
+ tint_symbol.inner[1] = value[1u];
+ tint_symbol.inner[2] = value[2u];
+}
+
+void f() {
+ assign_and_preserve_padding_tint_symbol(m);
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat3 m = mat3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f), vec3(6.0f, 7.0f, 8.0f));
diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl.expected.msl
index 98767cf..a8f67b8 100644
--- a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl.expected.msl
@@ -1,7 +1,38 @@
#include <metal_stdlib>
using namespace metal;
+
+template<typename T, size_t N>
+struct tint_array {
+ const constant T& operator[](size_t i) const constant { return elements[i]; }
+ device T& operator[](size_t i) device { return elements[i]; }
+ const device T& operator[](size_t i) const device { return elements[i]; }
+ thread T& operator[](size_t i) thread { return elements[i]; }
+ const thread T& operator[](size_t i) const thread { return elements[i]; }
+ threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+ const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+ T elements[N];
+};
+
struct tint_private_vars_struct {
float3x3 m;
};
+struct tint_packed_vec3_f32_array_element {
+ /* 0x0000 */ packed_float3 elements;
+ /* 0x000c */ tint_array<int8_t, 4> tint_pad;
+};
+
+void assign_and_preserve_padding(device tint_array<tint_packed_vec3_f32_array_element, 3>* const dest, float3x3 value) {
+ (*(dest))[0u].elements = packed_float3(value[0u]);
+ (*(dest))[1u].elements = packed_float3(value[1u]);
+ (*(dest))[2u].elements = packed_float3(value[2u]);
+}
+
+kernel void f(device tint_array<tint_packed_vec3_f32_array_element, 3>* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f));
+ assign_and_preserve_padding(tint_symbol, tint_private_vars.m);
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl.expected.spvasm
index c0f68aa..457cca0 100644
--- a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl.expected.spvasm
@@ -1,14 +1,25 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 23
+; Bound: 48
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %assign_and_preserve_padding_out "assign_and_preserve_padding_out"
+ OpName %value "value"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%mat3v3float = OpTypeMatrix %v3float 3
@@ -27,9 +38,39 @@
%16 = OpConstantComposite %mat3v3float %7 %11 %15
%_ptr_Private_mat3v3float = OpTypePointer Private %mat3v3float
%m = OpVariable %_ptr_Private_mat3v3float Private %16
+ %out_block = OpTypeStruct %mat3v3float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %19 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %19
- %22 = OpLabel
+ %22 = OpTypeFunction %void %mat3v3float
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %30 = OpConstantNull %int
+%_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float
+ %33 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+ %int_2 = OpConstant %int 2
+ %uint_2 = OpConstant %uint 2
+ %43 = OpTypeFunction %void
+%assign_and_preserve_padding_out = OpFunction %void None %22
+ %value = OpFunctionParameter %mat3v3float
+ %26 = OpLabel
+ %32 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %30
+ %34 = OpCompositeExtract %v3float %value 0
+ OpStore %32 %34
+ %36 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_1
+ %38 = OpCompositeExtract %v3float %value 1
+ OpStore %36 %38
+ %40 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_2
+ %42 = OpCompositeExtract %v3float %value 2
+ OpStore %40 %42
+ OpReturn
+ OpFunctionEnd
+ %f = OpFunction %void None %43
+ %45 = OpLabel
+ %47 = OpLoad %mat3v3float %m
+ %46 = OpFunctionCall %void %assign_and_preserve_padding_out %47
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl.expected.wgsl
index f9d685e..c5cb527 100644
--- a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl.expected.wgsl
@@ -1 +1,8 @@
var<private> m = mat3x3(vec3<f32>(0.0f, 1.0f, 2.0f), vec3<f32>(3.0f, 4.0f, 5.0f), vec3<f32>(6.0f, 7.0f, 8.0f));
+
+@group(0) @binding(0) var<storage, read_write> out : mat3x3<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x3/load/f16.wgsl b/test/tint/expressions/type_ctor/mat3x3/load/f16.wgsl
index e2f1754..5bb1e3f 100644
--- a/test/tint/expressions/type_ctor/mat3x3/load/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x3/load/f16.wgsl
@@ -1,5 +1,10 @@
enable f16;
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat3x3<f16>;
+
+@compute @workgroup_size(1)
fn f() {
- var m = mat3x3<f16>();
- let m_1 = mat3x3(m);
+ var m = mat3x3<f16>();
+ out = mat3x3(m);
}
diff --git a/test/tint/expressions/type_ctor/mat3x3/load/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/load/f16.wgsl.expected.dxc.hlsl
index a1b9c34..74caef9 100644
--- a/test/tint/expressions/type_ctor/mat3x3/load/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x3/load/f16.wgsl.expected.dxc.hlsl
@@ -1,9 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 3, 3> value) {
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 8u), value[1u]);
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 16u), value[2u]);
}
+[numthreads(1, 1, 1)]
void f() {
matrix<float16_t, 3, 3> m = matrix<float16_t, 3, 3>((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx);
- const matrix<float16_t, 3, 3> m_1 = matrix<float16_t, 3, 3>(m);
+ tint_symbol_store(0u, matrix<float16_t, 3, 3>(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat3x3/load/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x3/load/f16.wgsl.expected.glsl
index 85dd0fd..de4f8f4 100644
--- a/test/tint/expressions/type_ctor/mat3x3/load/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat3x3/load/f16.wgsl.expected.glsl
@@ -1,12 +1,23 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
- return;
-}
-void f() {
- f16mat3 m = f16mat3(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf));
- f16mat3 m_1 = f16mat3(m);
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat3 inner;
+} tint_symbol;
+
+void assign_and_preserve_padding_tint_symbol(f16mat3 value) {
+ tint_symbol.inner[0] = value[0u];
+ tint_symbol.inner[1] = value[1u];
+ tint_symbol.inner[2] = value[2u];
}
+void f() {
+ f16mat3 m = f16mat3(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf));
+ assign_and_preserve_padding_tint_symbol(f16mat3(m));
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ f();
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x3/load/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x3/load/f16.wgsl.expected.msl
index a08ddaa..93e647a 100644
--- a/test/tint/expressions/type_ctor/mat3x3/load/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat3x3/load/f16.wgsl.expected.msl
@@ -1,8 +1,33 @@
#include <metal_stdlib>
using namespace metal;
-void f() {
+
+template<typename T, size_t N>
+struct tint_array {
+ const constant T& operator[](size_t i) const constant { return elements[i]; }
+ device T& operator[](size_t i) device { return elements[i]; }
+ const device T& operator[](size_t i) const device { return elements[i]; }
+ thread T& operator[](size_t i) thread { return elements[i]; }
+ const thread T& operator[](size_t i) const thread { return elements[i]; }
+ threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+ const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+ T elements[N];
+};
+
+struct tint_packed_vec3_f16_array_element {
+ /* 0x0000 */ packed_half3 elements;
+ /* 0x0006 */ tint_array<int8_t, 2> tint_pad;
+};
+
+void assign_and_preserve_padding(device tint_array<tint_packed_vec3_f16_array_element, 3>* const dest, half3x3 value) {
+ (*(dest))[0u].elements = packed_half3(value[0u]);
+ (*(dest))[1u].elements = packed_half3(value[1u]);
+ (*(dest))[2u].elements = packed_half3(value[2u]);
+}
+
+kernel void f(device tint_array<tint_packed_vec3_f16_array_element, 3>* tint_symbol [[buffer(0)]]) {
half3x3 m = half3x3(half3(0.0h), half3(0.0h), half3(0.0h));
- half3x3 const m_1 = half3x3(m);
+ assign_and_preserve_padding(tint_symbol, half3x3(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat3x3/load/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x3/load/f16.wgsl.expected.spvasm
index 96f5af4..ec4bd59 100644
--- a/test/tint/expressions/type_ctor/mat3x3/load/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat3x3/load/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 15
+; Bound: 37
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,26 +9,61 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
- OpName %unused_entry_point "unused_entry_point"
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %assign_and_preserve_padding_out "assign_and_preserve_padding_out"
+ OpName %value "value"
OpName %f "f"
OpName %m "m"
- %void = OpTypeVoid
- %1 = OpTypeFunction %void
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v3half = OpTypeVector %half 3
%mat3v3half = OpTypeMatrix %v3half 3
- %10 = OpConstantNull %mat3v3half
+ %out_block = OpTypeStruct %mat3v3half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void %mat3v3half
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %15 = OpConstantNull %int
+%_ptr_StorageBuffer_v3half = OpTypePointer StorageBuffer %v3half
+ %18 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+ %int_2 = OpConstant %int 2
+ %uint_2 = OpConstant %uint 2
+ %28 = OpTypeFunction %void
+ %31 = OpConstantNull %mat3v3half
%_ptr_Function_mat3v3half = OpTypePointer Function %mat3v3half
-%unused_entry_point = OpFunction %void None %1
- %4 = OpLabel
+%assign_and_preserve_padding_out = OpFunction %void None %7
+ %value = OpFunctionParameter %mat3v3half
+ %11 = OpLabel
+ %17 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %15
+ %19 = OpCompositeExtract %v3half %value 0
+ OpStore %17 %19
+ %21 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %int_1
+ %23 = OpCompositeExtract %v3half %value 1
+ OpStore %21 %23
+ %25 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %int_2
+ %27 = OpCompositeExtract %v3half %value 2
+ OpStore %25 %27
OpReturn
OpFunctionEnd
- %f = OpFunction %void None %1
- %6 = OpLabel
- %m = OpVariable %_ptr_Function_mat3v3half Function %10
- OpStore %m %10
- %14 = OpLoad %mat3v3half %m
+ %f = OpFunction %void None %28
+ %30 = OpLabel
+ %m = OpVariable %_ptr_Function_mat3v3half Function %31
+ OpStore %m %31
+ %36 = OpLoad %mat3v3half %m
+ %34 = OpFunctionCall %void %assign_and_preserve_padding_out %36
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat3x3/load/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x3/load/f16.wgsl.expected.wgsl
index 55ec37b..a4f6ac2 100644
--- a/test/tint/expressions/type_ctor/mat3x3/load/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x3/load/f16.wgsl.expected.wgsl
@@ -1,6 +1,9 @@
enable f16;
+@group(0) @binding(0) var<storage, read_write> out : mat3x3<f16>;
+
+@compute @workgroup_size(1)
fn f() {
var m = mat3x3<f16>();
- let m_1 = mat3x3(m);
+ out = mat3x3(m);
}
diff --git a/test/tint/expressions/type_ctor/mat3x3/load/f32.wgsl b/test/tint/expressions/type_ctor/mat3x3/load/f32.wgsl
index 0fcea29..ea96f82 100644
--- a/test/tint/expressions/type_ctor/mat3x3/load/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x3/load/f32.wgsl
@@ -1,4 +1,8 @@
+@group(0) @binding(0)
+var<storage, read_write> out : mat3x3<f32>;
+
+@compute @workgroup_size(1)
fn f() {
- var m = mat3x3<f32>();
- let m_1 = mat3x3(m);
+ var m = mat3x3<f32>();
+ out = mat3x3(m);
}
diff --git a/test/tint/expressions/type_ctor/mat3x3/load/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/load/f32.wgsl.expected.dxc.hlsl
index b8f5f60..d7fe556 100644
--- a/test/tint/expressions/type_ctor/mat3x3/load/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x3/load/f32.wgsl.expected.dxc.hlsl
@@ -1,9 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store3((offset + 32u), asuint(value[2u]));
}
+[numthreads(1, 1, 1)]
void f() {
float3x3 m = float3x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx);
- const float3x3 m_1 = float3x3(m);
+ tint_symbol_store(0u, float3x3(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat3x3/load/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/load/f32.wgsl.expected.fxc.hlsl
index b8f5f60..d7fe556 100644
--- a/test/tint/expressions/type_ctor/mat3x3/load/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x3/load/f32.wgsl.expected.fxc.hlsl
@@ -1,9 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store3((offset + 32u), asuint(value[2u]));
}
+[numthreads(1, 1, 1)]
void f() {
float3x3 m = float3x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx);
- const float3x3 m_1 = float3x3(m);
+ tint_symbol_store(0u, float3x3(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat3x3/load/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x3/load/f32.wgsl.expected.glsl
index 640c151..7d4fd6c 100644
--- a/test/tint/expressions/type_ctor/mat3x3/load/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat3x3/load/f32.wgsl.expected.glsl
@@ -1,11 +1,22 @@
#version 310 es
-layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
- return;
-}
-void f() {
- mat3 m = mat3(vec3(0.0f), vec3(0.0f), vec3(0.0f));
- mat3 m_1 = mat3(m);
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat3 inner;
+} tint_symbol;
+
+void assign_and_preserve_padding_tint_symbol(mat3 value) {
+ tint_symbol.inner[0] = value[0u];
+ tint_symbol.inner[1] = value[1u];
+ tint_symbol.inner[2] = value[2u];
}
+void f() {
+ mat3 m = mat3(vec3(0.0f), vec3(0.0f), vec3(0.0f));
+ assign_and_preserve_padding_tint_symbol(mat3(m));
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ f();
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x3/load/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x3/load/f32.wgsl.expected.msl
index f7cc4fc..06dd54f 100644
--- a/test/tint/expressions/type_ctor/mat3x3/load/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat3x3/load/f32.wgsl.expected.msl
@@ -1,8 +1,33 @@
#include <metal_stdlib>
using namespace metal;
-void f() {
+
+template<typename T, size_t N>
+struct tint_array {
+ const constant T& operator[](size_t i) const constant { return elements[i]; }
+ device T& operator[](size_t i) device { return elements[i]; }
+ const device T& operator[](size_t i) const device { return elements[i]; }
+ thread T& operator[](size_t i) thread { return elements[i]; }
+ const thread T& operator[](size_t i) const thread { return elements[i]; }
+ threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+ const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+ T elements[N];
+};
+
+struct tint_packed_vec3_f32_array_element {
+ /* 0x0000 */ packed_float3 elements;
+ /* 0x000c */ tint_array<int8_t, 4> tint_pad;
+};
+
+void assign_and_preserve_padding(device tint_array<tint_packed_vec3_f32_array_element, 3>* const dest, float3x3 value) {
+ (*(dest))[0u].elements = packed_float3(value[0u]);
+ (*(dest))[1u].elements = packed_float3(value[1u]);
+ (*(dest))[2u].elements = packed_float3(value[2u]);
+}
+
+kernel void f(device tint_array<tint_packed_vec3_f32_array_element, 3>* tint_symbol [[buffer(0)]]) {
float3x3 m = float3x3(float3(0.0f), float3(0.0f), float3(0.0f));
- float3x3 const m_1 = float3x3(m);
+ assign_and_preserve_padding(tint_symbol, float3x3(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat3x3/load/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x3/load/f32.wgsl.expected.spvasm
index 7d55f41..595067913 100644
--- a/test/tint/expressions/type_ctor/mat3x3/load/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat3x3/load/f32.wgsl.expected.spvasm
@@ -1,30 +1,65 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 15
+; Bound: 37
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
- OpName %unused_entry_point "unused_entry_point"
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %assign_and_preserve_padding_out "assign_and_preserve_padding_out"
+ OpName %value "value"
OpName %f "f"
OpName %m "m"
- %void = OpTypeVoid
- %1 = OpTypeFunction %void
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%mat3v3float = OpTypeMatrix %v3float 3
- %10 = OpConstantNull %mat3v3float
+ %out_block = OpTypeStruct %mat3v3float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void %mat3v3float
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %15 = OpConstantNull %int
+%_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float
+ %18 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+ %int_2 = OpConstant %int 2
+ %uint_2 = OpConstant %uint 2
+ %28 = OpTypeFunction %void
+ %31 = OpConstantNull %mat3v3float
%_ptr_Function_mat3v3float = OpTypePointer Function %mat3v3float
-%unused_entry_point = OpFunction %void None %1
- %4 = OpLabel
+%assign_and_preserve_padding_out = OpFunction %void None %7
+ %value = OpFunctionParameter %mat3v3float
+ %11 = OpLabel
+ %17 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %15
+ %19 = OpCompositeExtract %v3float %value 0
+ OpStore %17 %19
+ %21 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_1
+ %23 = OpCompositeExtract %v3float %value 1
+ OpStore %21 %23
+ %25 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_2
+ %27 = OpCompositeExtract %v3float %value 2
+ OpStore %25 %27
OpReturn
OpFunctionEnd
- %f = OpFunction %void None %1
- %6 = OpLabel
- %m = OpVariable %_ptr_Function_mat3v3float Function %10
- OpStore %m %10
- %14 = OpLoad %mat3v3float %m
+ %f = OpFunction %void None %28
+ %30 = OpLabel
+ %m = OpVariable %_ptr_Function_mat3v3float Function %31
+ OpStore %m %31
+ %36 = OpLoad %mat3v3float %m
+ %34 = OpFunctionCall %void %assign_and_preserve_padding_out %36
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat3x3/load/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x3/load/f32.wgsl.expected.wgsl
index c38fae6..f6dda23 100644
--- a/test/tint/expressions/type_ctor/mat3x3/load/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x3/load/f32.wgsl.expected.wgsl
@@ -1,4 +1,7 @@
+@group(0) @binding(0) var<storage, read_write> out : mat3x3<f32>;
+
+@compute @workgroup_size(1)
fn f() {
var m = mat3x3<f32>();
- let m_1 = mat3x3(m);
+ out = mat3x3(m);
}
diff --git a/test/tint/expressions/type_ctor/mat3x3/zero/f16.wgsl b/test/tint/expressions/type_ctor/mat3x3/zero/f16.wgsl
index a1afeef..2099040 100644
--- a/test/tint/expressions/type_ctor/mat3x3/zero/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x3/zero/f16.wgsl
@@ -1,2 +1,10 @@
enable f16;
var<private> m = mat3x3<f16>();
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat3x3<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x3/zero/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/zero/f16.wgsl.expected.dxc.hlsl
index dfbd701..cd38a21 100644
--- a/test/tint/expressions/type_ctor/mat3x3/zero/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x3/zero/f16.wgsl.expected.dxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 3, 3> m = matrix<float16_t, 3, 3>((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx);
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 3, 3> value) {
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 8u), value[1u]);
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 16u), value[2u]);
}
-static matrix<float16_t, 3, 3> m = matrix<float16_t, 3, 3>((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx);
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x3/zero/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x3/zero/f16.wgsl.expected.glsl
index 36df20d..68a7b0c 100644
--- a/test/tint/expressions/type_ctor/mat3x3/zero/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat3x3/zero/f16.wgsl.expected.glsl
@@ -1,8 +1,23 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
+f16mat3 m = f16mat3(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat3 inner;
+} tint_symbol;
+
+void assign_and_preserve_padding_tint_symbol(f16mat3 value) {
+ tint_symbol.inner[0] = value[0u];
+ tint_symbol.inner[1] = value[1u];
+ tint_symbol.inner[2] = value[2u];
+}
+
+void f() {
+ assign_and_preserve_padding_tint_symbol(m);
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-f16mat3 m = f16mat3(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf));
diff --git a/test/tint/expressions/type_ctor/mat3x3/zero/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x3/zero/f16.wgsl.expected.msl
index f72a892..ca8e04c 100644
--- a/test/tint/expressions/type_ctor/mat3x3/zero/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat3x3/zero/f16.wgsl.expected.msl
@@ -1,7 +1,38 @@
#include <metal_stdlib>
using namespace metal;
+
+template<typename T, size_t N>
+struct tint_array {
+ const constant T& operator[](size_t i) const constant { return elements[i]; }
+ device T& operator[](size_t i) device { return elements[i]; }
+ const device T& operator[](size_t i) const device { return elements[i]; }
+ thread T& operator[](size_t i) thread { return elements[i]; }
+ const thread T& operator[](size_t i) const thread { return elements[i]; }
+ threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+ const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+ T elements[N];
+};
+
struct tint_private_vars_struct {
half3x3 m;
};
+struct tint_packed_vec3_f16_array_element {
+ /* 0x0000 */ packed_half3 elements;
+ /* 0x0006 */ tint_array<int8_t, 2> tint_pad;
+};
+
+void assign_and_preserve_padding(device tint_array<tint_packed_vec3_f16_array_element, 3>* const dest, half3x3 value) {
+ (*(dest))[0u].elements = packed_half3(value[0u]);
+ (*(dest))[1u].elements = packed_half3(value[1u]);
+ (*(dest))[2u].elements = packed_half3(value[2u]);
+}
+
+kernel void f(device tint_array<tint_packed_vec3_f16_array_element, 3>* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half3x3(half3(0.0h), half3(0.0h), half3(0.0h));
+ assign_and_preserve_padding(tint_symbol, tint_private_vars.m);
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat3x3/zero/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x3/zero/f16.wgsl.expected.spvasm
index 523c388..50170db 100644
--- a/test/tint/expressions/type_ctor/mat3x3/zero/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat3x3/zero/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 11
+; Bound: 36
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,19 +9,60 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %assign_and_preserve_padding_out "assign_and_preserve_padding_out"
+ OpName %value "value"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v3half = OpTypeVector %half 3
%mat3v3half = OpTypeMatrix %v3half 3
%4 = OpConstantNull %mat3v3half
%_ptr_Private_mat3v3half = OpTypePointer Private %mat3v3half
%m = OpVariable %_ptr_Private_mat3v3half Private %4
+ %out_block = OpTypeStruct %mat3v3half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %7 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %7
- %10 = OpLabel
+ %10 = OpTypeFunction %void %mat3v3half
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %18 = OpConstantNull %int
+%_ptr_StorageBuffer_v3half = OpTypePointer StorageBuffer %v3half
+ %21 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+ %int_2 = OpConstant %int 2
+ %uint_2 = OpConstant %uint 2
+ %31 = OpTypeFunction %void
+%assign_and_preserve_padding_out = OpFunction %void None %10
+ %value = OpFunctionParameter %mat3v3half
+ %14 = OpLabel
+ %20 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %18
+ %22 = OpCompositeExtract %v3half %value 0
+ OpStore %20 %22
+ %24 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %int_1
+ %26 = OpCompositeExtract %v3half %value 1
+ OpStore %24 %26
+ %28 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %int_2
+ %30 = OpCompositeExtract %v3half %value 2
+ OpStore %28 %30
+ OpReturn
+ OpFunctionEnd
+ %f = OpFunction %void None %31
+ %33 = OpLabel
+ %35 = OpLoad %mat3v3half %m
+ %34 = OpFunctionCall %void %assign_and_preserve_padding_out %35
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat3x3/zero/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x3/zero/f16.wgsl.expected.wgsl
index b9b1ef3..f5abaa2 100644
--- a/test/tint/expressions/type_ctor/mat3x3/zero/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x3/zero/f16.wgsl.expected.wgsl
@@ -1,3 +1,10 @@
enable f16;
var<private> m = mat3x3<f16>();
+
+@group(0) @binding(0) var<storage, read_write> out : mat3x3<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x3/zero/f32.wgsl b/test/tint/expressions/type_ctor/mat3x3/zero/f32.wgsl
index 0ecffa3..90a36b8 100644
--- a/test/tint/expressions/type_ctor/mat3x3/zero/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x3/zero/f32.wgsl
@@ -1 +1,9 @@
var<private> m = mat3x3<f32>();
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat3x3<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x3/zero/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/zero/f32.wgsl.expected.dxc.hlsl
index b96d4e1..8ea2e7b 100644
--- a/test/tint/expressions/type_ctor/mat3x3/zero/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x3/zero/f32.wgsl.expected.dxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float3x3 m = float3x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx);
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store3((offset + 32u), asuint(value[2u]));
}
-static float3x3 m = float3x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx);
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x3/zero/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/zero/f32.wgsl.expected.fxc.hlsl
index b96d4e1..8ea2e7b 100644
--- a/test/tint/expressions/type_ctor/mat3x3/zero/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x3/zero/f32.wgsl.expected.fxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float3x3 m = float3x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx);
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store3((offset + 32u), asuint(value[2u]));
}
-static float3x3 m = float3x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx);
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x3/zero/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x3/zero/f32.wgsl.expected.glsl
index 421fc2b..7e8c2a5 100644
--- a/test/tint/expressions/type_ctor/mat3x3/zero/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat3x3/zero/f32.wgsl.expected.glsl
@@ -1,7 +1,22 @@
#version 310 es
+mat3 m = mat3(vec3(0.0f), vec3(0.0f), vec3(0.0f));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat3 inner;
+} tint_symbol;
+
+void assign_and_preserve_padding_tint_symbol(mat3 value) {
+ tint_symbol.inner[0] = value[0u];
+ tint_symbol.inner[1] = value[1u];
+ tint_symbol.inner[2] = value[2u];
+}
+
+void f() {
+ assign_and_preserve_padding_tint_symbol(m);
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat3 m = mat3(vec3(0.0f), vec3(0.0f), vec3(0.0f));
diff --git a/test/tint/expressions/type_ctor/mat3x3/zero/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x3/zero/f32.wgsl.expected.msl
index 98767cf..2f2192a 100644
--- a/test/tint/expressions/type_ctor/mat3x3/zero/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat3x3/zero/f32.wgsl.expected.msl
@@ -1,7 +1,38 @@
#include <metal_stdlib>
using namespace metal;
+
+template<typename T, size_t N>
+struct tint_array {
+ const constant T& operator[](size_t i) const constant { return elements[i]; }
+ device T& operator[](size_t i) device { return elements[i]; }
+ const device T& operator[](size_t i) const device { return elements[i]; }
+ thread T& operator[](size_t i) thread { return elements[i]; }
+ const thread T& operator[](size_t i) const thread { return elements[i]; }
+ threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+ const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+ T elements[N];
+};
+
struct tint_private_vars_struct {
float3x3 m;
};
+struct tint_packed_vec3_f32_array_element {
+ /* 0x0000 */ packed_float3 elements;
+ /* 0x000c */ tint_array<int8_t, 4> tint_pad;
+};
+
+void assign_and_preserve_padding(device tint_array<tint_packed_vec3_f32_array_element, 3>* const dest, float3x3 value) {
+ (*(dest))[0u].elements = packed_float3(value[0u]);
+ (*(dest))[1u].elements = packed_float3(value[1u]);
+ (*(dest))[2u].elements = packed_float3(value[2u]);
+}
+
+kernel void f(device tint_array<tint_packed_vec3_f32_array_element, 3>* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float3x3(float3(0.0f), float3(0.0f), float3(0.0f));
+ assign_and_preserve_padding(tint_symbol, tint_private_vars.m);
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat3x3/zero/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x3/zero/f32.wgsl.expected.spvasm
index 743b9d4..a4089f2 100644
--- a/test/tint/expressions/type_ctor/mat3x3/zero/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat3x3/zero/f32.wgsl.expected.spvasm
@@ -1,23 +1,64 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 11
+; Bound: 36
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %assign_and_preserve_padding_out "assign_and_preserve_padding_out"
+ OpName %value "value"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%mat3v3float = OpTypeMatrix %v3float 3
%4 = OpConstantNull %mat3v3float
%_ptr_Private_mat3v3float = OpTypePointer Private %mat3v3float
%m = OpVariable %_ptr_Private_mat3v3float Private %4
+ %out_block = OpTypeStruct %mat3v3float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %7 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %7
- %10 = OpLabel
+ %10 = OpTypeFunction %void %mat3v3float
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %18 = OpConstantNull %int
+%_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float
+ %21 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+ %int_2 = OpConstant %int 2
+ %uint_2 = OpConstant %uint 2
+ %31 = OpTypeFunction %void
+%assign_and_preserve_padding_out = OpFunction %void None %10
+ %value = OpFunctionParameter %mat3v3float
+ %14 = OpLabel
+ %20 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %18
+ %22 = OpCompositeExtract %v3float %value 0
+ OpStore %20 %22
+ %24 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_1
+ %26 = OpCompositeExtract %v3float %value 1
+ OpStore %24 %26
+ %28 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_2
+ %30 = OpCompositeExtract %v3float %value 2
+ OpStore %28 %30
+ OpReturn
+ OpFunctionEnd
+ %f = OpFunction %void None %31
+ %33 = OpLabel
+ %35 = OpLoad %mat3v3float %m
+ %34 = OpFunctionCall %void %assign_and_preserve_padding_out %35
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat3x3/zero/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x3/zero/f32.wgsl.expected.wgsl
index 0ecffa3..64dc8bd 100644
--- a/test/tint/expressions/type_ctor/mat3x3/zero/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x3/zero/f32.wgsl.expected.wgsl
@@ -1 +1,8 @@
var<private> m = mat3x3<f32>();
+
+@group(0) @binding(0) var<storage, read_write> out : mat3x3<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f16.wgsl b/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f16.wgsl
index bbf1cf6..1b0056b 100644
--- a/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f16.wgsl
@@ -1,9 +1,12 @@
enable f16;
-var<private> m = mat3x4(mat3x4<f16>(0.0h, 1.0h, 2.0h, 3.0h,
- 4.0h, 5.0h, 6.0h, 7.0h,
- 8.0h, 9.0h, 10.0h, 11.0h));
+var<private> m = mat3x4<f16>(mat3x4<f16>(0.0h, 1.0h, 2.0h, 3.0h,
+ 4.0h, 5.0h, 6.0h, 7.0h,
+ 8.0h, 9.0h, 10.0h, 11.0h));
-fn f() -> mat3x4<f16> {
- let m_1 = mat3x4(m);
- return m_1;
+@group(0) @binding(0)
+var<storage, read_write> out : mat3x4<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat3x4<f16>(m);
}
diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f16.wgsl.expected.dxc.hlsl
index 3db1f7c..36c2a0c 100644
--- a/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f16.wgsl.expected.dxc.hlsl
@@ -1,11 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 3, 4> m = matrix<float16_t, 3, 4>(vector<float16_t, 4>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 4>(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)), vector<float16_t, 4>(float16_t(8.0h), float16_t(9.0h), float16_t(10.0h), float16_t(11.0h)));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 3, 4> value) {
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 8u), value[1u]);
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 16u), value[2u]);
}
-static matrix<float16_t, 3, 4> m = matrix<float16_t, 3, 4>(vector<float16_t, 4>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 4>(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)), vector<float16_t, 4>(float16_t(8.0h), float16_t(9.0h), float16_t(10.0h), float16_t(11.0h)));
-
-matrix<float16_t, 3, 4> f() {
- const matrix<float16_t, 3, 4> m_1 = matrix<float16_t, 3, 4>(m);
- return m_1;
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, matrix<float16_t, 3, 4>(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f16.wgsl.expected.glsl
index 28a0c2a..b045183 100644
--- a/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f16.wgsl.expected.glsl
@@ -1,13 +1,17 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
- return;
-}
f16mat3x4 m = f16mat3x4(f16vec4(0.0hf, 1.0hf, 2.0hf, 3.0hf), f16vec4(4.0hf, 5.0hf, 6.0hf, 7.0hf), f16vec4(8.0hf, 9.0hf, 10.0hf, 11.0hf));
-f16mat3x4 f() {
- f16mat3x4 m_1 = f16mat3x4(m);
- return m_1;
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat3x4 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = f16mat3x4(m);
}
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ f();
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f16.wgsl.expected.msl
index 1018d4c..cf001a3 100644
--- a/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f16.wgsl.expected.msl
@@ -5,8 +5,10 @@
half3x4 m;
};
-half3x4 f(thread tint_private_vars_struct* const tint_private_vars) {
- half3x4 const m_1 = half3x4((*(tint_private_vars)).m);
- return m_1;
+kernel void f(device half3x4* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half3x4(half4(0.0h, 1.0h, 2.0h, 3.0h), half4(4.0h, 5.0h, 6.0h, 7.0h), half4(8.0h, 9.0h, 10.0h, 11.0h));
+ *(tint_symbol) = half3x4(tint_private_vars.m);
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f16.wgsl.expected.spvasm
index 913cbed..2955012 100644
--- a/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 31
+; Bound: 35
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,11 +9,19 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v4half = OpTypeVector %half 4
%mat3v4half = OpTypeMatrix %v4half 3
@@ -35,15 +43,18 @@
%19 = OpConstantComposite %mat3v4half %8 %13 %18
%_ptr_Private_mat3v4half = OpTypePointer Private %mat3v4half
%m = OpVariable %_ptr_Private_mat3v4half Private %19
+ %out_block = OpTypeStruct %mat3v4half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %22 = OpTypeFunction %void
- %26 = OpTypeFunction %mat3v4half
-%unused_entry_point = OpFunction %void None %22
- %25 = OpLabel
- OpReturn
- OpFunctionEnd
- %f = OpFunction %mat3v4half None %26
+ %25 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat3v4half = OpTypePointer StorageBuffer %mat3v4half
+ %f = OpFunction %void None %25
%28 = OpLabel
- %30 = OpLoad %mat3v4half %m
- OpReturnValue %30
+ %32 = OpAccessChain %_ptr_StorageBuffer_mat3v4half %out %uint_0
+ %34 = OpLoad %mat3v4half %m
+ OpStore %32 %34
+ OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f16.wgsl.expected.wgsl
index 7cb77d0..39775dc 100644
--- a/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f16.wgsl.expected.wgsl
@@ -1,8 +1,10 @@
enable f16;
-var<private> m = mat3x4(mat3x4<f16>(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h, 8.0h, 9.0h, 10.0h, 11.0h));
+var<private> m = mat3x4<f16>(mat3x4<f16>(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h, 8.0h, 9.0h, 10.0h, 11.0h));
-fn f() -> mat3x4<f16> {
- let m_1 = mat3x4(m);
- return m_1;
+@group(0) @binding(0) var<storage, read_write> out : mat3x4<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat3x4<f16>(m);
}
diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f32.wgsl b/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f32.wgsl
index 6997b0e..0e3fdc8 100644
--- a/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f32.wgsl
@@ -1,8 +1,11 @@
-var<private> m = mat3x4(mat3x4<f32>(0.0f, 1.0f, 2.0f, 3.0f,
- 4.0f, 5.0f, 6.0f, 7.0f,
- 8.0f, 9.0f, 10.0f, 11.0f));
+var<private> m = mat3x4<f32>(mat3x4<f32>(0.0f, 1.0f, 2.0f, 3.0f,
+ 4.0f, 5.0f, 6.0f, 7.0f,
+ 8.0f, 9.0f, 10.0f, 11.0f));
-fn f() -> mat3x4<f32> {
- let m_1 = mat3x4(m);
- return m_1;
+@group(0) @binding(0)
+var<storage, read_write> out : mat3x4<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat3x4<f32>(m);
}
diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f32.wgsl.expected.dxc.hlsl
index 11e3fe8..caafb5b 100644
--- a/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f32.wgsl.expected.dxc.hlsl
@@ -1,11 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float3x4 m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store4((offset + 32u), asuint(value[2u]));
}
-static float3x4 m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f));
-
-float3x4 f() {
- const float3x4 m_1 = float3x4(m);
- return m_1;
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float3x4(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f32.wgsl.expected.fxc.hlsl
index 11e3fe8..caafb5b 100644
--- a/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f32.wgsl.expected.fxc.hlsl
@@ -1,11 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float3x4 m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store4((offset + 32u), asuint(value[2u]));
}
-static float3x4 m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f));
-
-float3x4 f() {
- const float3x4 m_1 = float3x4(m);
- return m_1;
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float3x4(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f32.wgsl.expected.glsl
index cd41138..f23e8a0b 100644
--- a/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f32.wgsl.expected.glsl
@@ -1,12 +1,16 @@
#version 310 es
-layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
- return;
-}
mat3x4 m = mat3x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f), vec4(8.0f, 9.0f, 10.0f, 11.0f));
-mat3x4 f() {
- mat3x4 m_1 = mat3x4(m);
- return m_1;
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat3x4 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = mat3x4(m);
}
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ f();
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f32.wgsl.expected.msl
index 948eb5d..08b8f32 100644
--- a/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f32.wgsl.expected.msl
@@ -5,8 +5,10 @@
float3x4 m;
};
-float3x4 f(thread tint_private_vars_struct* const tint_private_vars) {
- float3x4 const m_1 = float3x4((*(tint_private_vars)).m);
- return m_1;
+kernel void f(device float3x4* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f));
+ *(tint_symbol) = float3x4(tint_private_vars.m);
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f32.wgsl.expected.spvasm
index 707e9ce..6e203ac 100644
--- a/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f32.wgsl.expected.spvasm
@@ -1,15 +1,23 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 31
+; Bound: 35
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%mat3v4float = OpTypeMatrix %v4float 3
@@ -31,15 +39,18 @@
%19 = OpConstantComposite %mat3v4float %8 %13 %18
%_ptr_Private_mat3v4float = OpTypePointer Private %mat3v4float
%m = OpVariable %_ptr_Private_mat3v4float Private %19
+ %out_block = OpTypeStruct %mat3v4float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %22 = OpTypeFunction %void
- %26 = OpTypeFunction %mat3v4float
-%unused_entry_point = OpFunction %void None %22
- %25 = OpLabel
- OpReturn
- OpFunctionEnd
- %f = OpFunction %mat3v4float None %26
+ %25 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat3v4float = OpTypePointer StorageBuffer %mat3v4float
+ %f = OpFunction %void None %25
%28 = OpLabel
- %30 = OpLoad %mat3v4float %m
- OpReturnValue %30
+ %32 = OpAccessChain %_ptr_StorageBuffer_mat3v4float %out %uint_0
+ %34 = OpLoad %mat3v4float %m
+ OpStore %32 %34
+ OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f32.wgsl.expected.wgsl
index 14caa3e..bcf1be8 100644
--- a/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f32.wgsl.expected.wgsl
@@ -1,6 +1,8 @@
-var<private> m = mat3x4(mat3x4<f32>(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f));
+var<private> m = mat3x4<f32>(mat3x4<f32>(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f));
-fn f() -> mat3x4<f32> {
- let m_1 = mat3x4(m);
- return m_1;
+@group(0) @binding(0) var<storage, read_write> out : mat3x4<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat3x4<f32>(m);
}
diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f16.wgsl b/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f16.wgsl
index abeb2ab..98eb826 100644
--- a/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f16.wgsl
@@ -2,3 +2,11 @@
var<private> m = mat3x4<f16>(0.0h, 1.0h, 2.0h, 3.0h,
4.0h, 5.0h, 6.0h, 7.0h,
8.0h, 9.0h, 10.0h, 11.0h);
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat3x4<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f16.wgsl.expected.dxc.hlsl
index 5a44d3f..2369113 100644
--- a/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f16.wgsl.expected.dxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 3, 4> m = matrix<float16_t, 3, 4>(vector<float16_t, 4>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 4>(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)), vector<float16_t, 4>(float16_t(8.0h), float16_t(9.0h), float16_t(10.0h), float16_t(11.0h)));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 3, 4> value) {
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 8u), value[1u]);
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 16u), value[2u]);
}
-static matrix<float16_t, 3, 4> m = matrix<float16_t, 3, 4>(vector<float16_t, 4>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 4>(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)), vector<float16_t, 4>(float16_t(8.0h), float16_t(9.0h), float16_t(10.0h), float16_t(11.0h)));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f16.wgsl.expected.glsl
index af6ad9c..bacb04d 100644
--- a/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f16.wgsl.expected.glsl
@@ -1,8 +1,17 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
+f16mat3x4 m = f16mat3x4(f16vec4(0.0hf, 1.0hf, 2.0hf, 3.0hf), f16vec4(4.0hf, 5.0hf, 6.0hf, 7.0hf), f16vec4(8.0hf, 9.0hf, 10.0hf, 11.0hf));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat3x4 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-f16mat3x4 m = f16mat3x4(f16vec4(0.0hf, 1.0hf, 2.0hf, 3.0hf), f16vec4(4.0hf, 5.0hf, 6.0hf, 7.0hf), f16vec4(8.0hf, 9.0hf, 10.0hf, 11.0hf));
diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f16.wgsl.expected.msl
index 20a3a5f..1cd0c8c 100644
--- a/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f16.wgsl.expected.msl
@@ -5,3 +5,10 @@
half3x4 m;
};
+kernel void f(device half3x4* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half3x4(half4(0.0h, 1.0h, 2.0h, 3.0h), half4(4.0h, 5.0h, 6.0h, 7.0h), half4(8.0h, 9.0h, 10.0h, 11.0h));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f16.wgsl.expected.spvasm
index 5796944..057fadc 100644
--- a/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 26
+; Bound: 34
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,10 +9,19 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v4half = OpTypeVector %half 4
%mat3v4half = OpTypeMatrix %v4half 3
@@ -34,9 +43,18 @@
%19 = OpConstantComposite %mat3v4half %8 %13 %18
%_ptr_Private_mat3v4half = OpTypePointer Private %mat3v4half
%m = OpVariable %_ptr_Private_mat3v4half Private %19
+ %out_block = OpTypeStruct %mat3v4half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %22 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %22
- %25 = OpLabel
+ %25 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat3v4half = OpTypePointer StorageBuffer %mat3v4half
+ %f = OpFunction %void None %25
+ %28 = OpLabel
+ %32 = OpAccessChain %_ptr_StorageBuffer_mat3v4half %out %uint_0
+ %33 = OpLoad %mat3v4half %m
+ OpStore %32 %33
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f16.wgsl.expected.wgsl
index 5b8fc7c..84068f7 100644
--- a/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f16.wgsl.expected.wgsl
@@ -1,3 +1,10 @@
enable f16;
var<private> m = mat3x4<f16>(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h, 8.0h, 9.0h, 10.0h, 11.0h);
+
+@group(0) @binding(0) var<storage, read_write> out : mat3x4<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl b/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl
index 99d896b..64c8035 100644
--- a/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl
@@ -1,3 +1,11 @@
var<private> m = mat3x4<f32>(0.0f, 1.0f, 2.0f, 3.0f,
4.0f, 5.0f, 6.0f, 7.0f,
8.0f, 9.0f, 10.0f, 11.0f);
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat3x4<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl.expected.dxc.hlsl
index b23383e..d043399 100644
--- a/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl.expected.dxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float3x4 m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store4((offset + 32u), asuint(value[2u]));
}
-static float3x4 m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl.expected.fxc.hlsl
index b23383e..d043399 100644
--- a/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl.expected.fxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float3x4 m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store4((offset + 32u), asuint(value[2u]));
}
-static float3x4 m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl.expected.glsl
index 766e72c..aceefb8 100644
--- a/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl.expected.glsl
@@ -1,7 +1,16 @@
#version 310 es
+mat3x4 m = mat3x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f), vec4(8.0f, 9.0f, 10.0f, 11.0f));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat3x4 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat3x4 m = mat3x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f), vec4(8.0f, 9.0f, 10.0f, 11.0f));
diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl.expected.msl
index 6d3618a..1cf8be0 100644
--- a/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl.expected.msl
@@ -5,3 +5,10 @@
float3x4 m;
};
+kernel void f(device float3x4* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl.expected.spvasm
index d29b311..56dd1f9 100644
--- a/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl.expected.spvasm
@@ -1,14 +1,23 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 26
+; Bound: 34
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%mat3v4float = OpTypeMatrix %v4float 3
@@ -30,9 +39,18 @@
%19 = OpConstantComposite %mat3v4float %8 %13 %18
%_ptr_Private_mat3v4float = OpTypePointer Private %mat3v4float
%m = OpVariable %_ptr_Private_mat3v4float Private %19
+ %out_block = OpTypeStruct %mat3v4float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %22 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %22
- %25 = OpLabel
+ %25 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat3v4float = OpTypePointer StorageBuffer %mat3v4float
+ %f = OpFunction %void None %25
+ %28 = OpLabel
+ %32 = OpAccessChain %_ptr_StorageBuffer_mat3v4float %out %uint_0
+ %33 = OpLoad %mat3v4float %m
+ OpStore %32 %33
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl.expected.wgsl
index e4268e1..54d274e 100644
--- a/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl.expected.wgsl
@@ -1 +1,8 @@
var<private> m = mat3x4<f32>(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f);
+
+@group(0) @binding(0) var<storage, read_write> out : mat3x4<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f16.wgsl b/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f16.wgsl
index 604231c..47b1987 100644
--- a/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f16.wgsl
@@ -2,3 +2,11 @@
var<private> m = mat3x4<f16>(vec4<f16>(0.0h, 1.0h, 2.0h, 3.0h),
vec4<f16>(4.0h, 5.0h, 6.0h, 7.0h),
vec4<f16>(8.0h, 9.0h, 10.0h, 11.0h));
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat3x4<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f16.wgsl.expected.dxc.hlsl
index 5a44d3f..2369113 100644
--- a/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f16.wgsl.expected.dxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 3, 4> m = matrix<float16_t, 3, 4>(vector<float16_t, 4>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 4>(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)), vector<float16_t, 4>(float16_t(8.0h), float16_t(9.0h), float16_t(10.0h), float16_t(11.0h)));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 3, 4> value) {
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 8u), value[1u]);
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 16u), value[2u]);
}
-static matrix<float16_t, 3, 4> m = matrix<float16_t, 3, 4>(vector<float16_t, 4>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 4>(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)), vector<float16_t, 4>(float16_t(8.0h), float16_t(9.0h), float16_t(10.0h), float16_t(11.0h)));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f16.wgsl.expected.glsl
index af6ad9c..bacb04d 100644
--- a/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f16.wgsl.expected.glsl
@@ -1,8 +1,17 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
+f16mat3x4 m = f16mat3x4(f16vec4(0.0hf, 1.0hf, 2.0hf, 3.0hf), f16vec4(4.0hf, 5.0hf, 6.0hf, 7.0hf), f16vec4(8.0hf, 9.0hf, 10.0hf, 11.0hf));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat3x4 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-f16mat3x4 m = f16mat3x4(f16vec4(0.0hf, 1.0hf, 2.0hf, 3.0hf), f16vec4(4.0hf, 5.0hf, 6.0hf, 7.0hf), f16vec4(8.0hf, 9.0hf, 10.0hf, 11.0hf));
diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f16.wgsl.expected.msl
index 20a3a5f..1cd0c8c 100644
--- a/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f16.wgsl.expected.msl
@@ -5,3 +5,10 @@
half3x4 m;
};
+kernel void f(device half3x4* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half3x4(half4(0.0h, 1.0h, 2.0h, 3.0h), half4(4.0h, 5.0h, 6.0h, 7.0h), half4(8.0h, 9.0h, 10.0h, 11.0h));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f16.wgsl.expected.spvasm
index 5796944..057fadc 100644
--- a/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 26
+; Bound: 34
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,10 +9,19 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v4half = OpTypeVector %half 4
%mat3v4half = OpTypeMatrix %v4half 3
@@ -34,9 +43,18 @@
%19 = OpConstantComposite %mat3v4half %8 %13 %18
%_ptr_Private_mat3v4half = OpTypePointer Private %mat3v4half
%m = OpVariable %_ptr_Private_mat3v4half Private %19
+ %out_block = OpTypeStruct %mat3v4half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %22 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %22
- %25 = OpLabel
+ %25 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat3v4half = OpTypePointer StorageBuffer %mat3v4half
+ %f = OpFunction %void None %25
+ %28 = OpLabel
+ %32 = OpAccessChain %_ptr_StorageBuffer_mat3v4half %out %uint_0
+ %33 = OpLoad %mat3v4half %m
+ OpStore %32 %33
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f16.wgsl.expected.wgsl
index f4797d6..2e1d670 100644
--- a/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f16.wgsl.expected.wgsl
@@ -1,3 +1,10 @@
enable f16;
var<private> m = mat3x4<f16>(vec4<f16>(0.0h, 1.0h, 2.0h, 3.0h), vec4<f16>(4.0h, 5.0h, 6.0h, 7.0h), vec4<f16>(8.0h, 9.0h, 10.0h, 11.0h));
+
+@group(0) @binding(0) var<storage, read_write> out : mat3x4<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl b/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl
index 672ac2e..0dba3f2 100644
--- a/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl
@@ -1,3 +1,11 @@
var<private> m = mat3x4<f32>(vec4<f32>(0.0f, 1.0f, 2.0f, 3.0f),
vec4<f32>(4.0f, 5.0f, 6.0f, 7.0f),
vec4<f32>(8.0f, 9.0f, 10.0f, 11.0f));
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat3x4<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.dxc.hlsl
index b23383e..d043399 100644
--- a/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.dxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float3x4 m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store4((offset + 32u), asuint(value[2u]));
}
-static float3x4 m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.fxc.hlsl
index b23383e..d043399 100644
--- a/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.fxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float3x4 m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store4((offset + 32u), asuint(value[2u]));
}
-static float3x4 m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.glsl
index 766e72c..aceefb8 100644
--- a/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.glsl
@@ -1,7 +1,16 @@
#version 310 es
+mat3x4 m = mat3x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f), vec4(8.0f, 9.0f, 10.0f, 11.0f));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat3x4 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat3x4 m = mat3x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f), vec4(8.0f, 9.0f, 10.0f, 11.0f));
diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.msl
index 6d3618a..1cf8be0 100644
--- a/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.msl
@@ -5,3 +5,10 @@
float3x4 m;
};
+kernel void f(device float3x4* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.spvasm
index d29b311..56dd1f9 100644
--- a/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.spvasm
@@ -1,14 +1,23 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 26
+; Bound: 34
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%mat3v4float = OpTypeMatrix %v4float 3
@@ -30,9 +39,18 @@
%19 = OpConstantComposite %mat3v4float %8 %13 %18
%_ptr_Private_mat3v4float = OpTypePointer Private %mat3v4float
%m = OpVariable %_ptr_Private_mat3v4float Private %19
+ %out_block = OpTypeStruct %mat3v4float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %22 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %22
- %25 = OpLabel
+ %25 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat3v4float = OpTypePointer StorageBuffer %mat3v4float
+ %f = OpFunction %void None %25
+ %28 = OpLabel
+ %32 = OpAccessChain %_ptr_StorageBuffer_mat3v4float %out %uint_0
+ %33 = OpLoad %mat3v4float %m
+ OpStore %32 %33
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.wgsl
index 8a529c9..c7a6fd4 100644
--- a/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.wgsl
@@ -1 +1,8 @@
var<private> m = mat3x4<f32>(vec4<f32>(0.0f, 1.0f, 2.0f, 3.0f), vec4<f32>(4.0f, 5.0f, 6.0f, 7.0f), vec4<f32>(8.0f, 9.0f, 10.0f, 11.0f));
+
+@group(0) @binding(0) var<storage, read_write> out : mat3x4<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f16.wgsl b/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f16.wgsl
index e958d50..f5c5ae5 100644
--- a/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f16.wgsl
@@ -3,7 +3,10 @@
4.0h, 5.0h, 6.0h, 7.0h,
8.0h, 9.0h, 10.0h, 11.0h));
-fn f() -> mat3x4<f16> {
- let m_1 = mat3x4(m);
- return m_1;
+@group(0) @binding(0)
+var<storage, read_write> out : mat3x4<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat3x4(m);
}
diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f16.wgsl.expected.dxc.hlsl
index 3db1f7c..36c2a0c 100644
--- a/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f16.wgsl.expected.dxc.hlsl
@@ -1,11 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 3, 4> m = matrix<float16_t, 3, 4>(vector<float16_t, 4>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 4>(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)), vector<float16_t, 4>(float16_t(8.0h), float16_t(9.0h), float16_t(10.0h), float16_t(11.0h)));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 3, 4> value) {
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 8u), value[1u]);
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 16u), value[2u]);
}
-static matrix<float16_t, 3, 4> m = matrix<float16_t, 3, 4>(vector<float16_t, 4>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 4>(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)), vector<float16_t, 4>(float16_t(8.0h), float16_t(9.0h), float16_t(10.0h), float16_t(11.0h)));
-
-matrix<float16_t, 3, 4> f() {
- const matrix<float16_t, 3, 4> m_1 = matrix<float16_t, 3, 4>(m);
- return m_1;
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, matrix<float16_t, 3, 4>(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f16.wgsl.expected.glsl
index 28a0c2a..b045183 100644
--- a/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f16.wgsl.expected.glsl
@@ -1,13 +1,17 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
- return;
-}
f16mat3x4 m = f16mat3x4(f16vec4(0.0hf, 1.0hf, 2.0hf, 3.0hf), f16vec4(4.0hf, 5.0hf, 6.0hf, 7.0hf), f16vec4(8.0hf, 9.0hf, 10.0hf, 11.0hf));
-f16mat3x4 f() {
- f16mat3x4 m_1 = f16mat3x4(m);
- return m_1;
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat3x4 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = f16mat3x4(m);
}
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ f();
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f16.wgsl.expected.msl
index 1018d4c..cf001a3 100644
--- a/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f16.wgsl.expected.msl
@@ -5,8 +5,10 @@
half3x4 m;
};
-half3x4 f(thread tint_private_vars_struct* const tint_private_vars) {
- half3x4 const m_1 = half3x4((*(tint_private_vars)).m);
- return m_1;
+kernel void f(device half3x4* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half3x4(half4(0.0h, 1.0h, 2.0h, 3.0h), half4(4.0h, 5.0h, 6.0h, 7.0h), half4(8.0h, 9.0h, 10.0h, 11.0h));
+ *(tint_symbol) = half3x4(tint_private_vars.m);
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f16.wgsl.expected.spvasm
index 913cbed..2955012 100644
--- a/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 31
+; Bound: 35
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,11 +9,19 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v4half = OpTypeVector %half 4
%mat3v4half = OpTypeMatrix %v4half 3
@@ -35,15 +43,18 @@
%19 = OpConstantComposite %mat3v4half %8 %13 %18
%_ptr_Private_mat3v4half = OpTypePointer Private %mat3v4half
%m = OpVariable %_ptr_Private_mat3v4half Private %19
+ %out_block = OpTypeStruct %mat3v4half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %22 = OpTypeFunction %void
- %26 = OpTypeFunction %mat3v4half
-%unused_entry_point = OpFunction %void None %22
- %25 = OpLabel
- OpReturn
- OpFunctionEnd
- %f = OpFunction %mat3v4half None %26
+ %25 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat3v4half = OpTypePointer StorageBuffer %mat3v4half
+ %f = OpFunction %void None %25
%28 = OpLabel
- %30 = OpLoad %mat3v4half %m
- OpReturnValue %30
+ %32 = OpAccessChain %_ptr_StorageBuffer_mat3v4half %out %uint_0
+ %34 = OpLoad %mat3v4half %m
+ OpStore %32 %34
+ OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f16.wgsl.expected.wgsl
index a1a2f16..2b78314 100644
--- a/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f16.wgsl.expected.wgsl
@@ -2,7 +2,9 @@
var<private> m = mat3x4(mat3x4(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h, 8.0h, 9.0h, 10.0h, 11.0h));
-fn f() -> mat3x4<f16> {
- let m_1 = mat3x4(m);
- return m_1;
+@group(0) @binding(0) var<storage, read_write> out : mat3x4<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat3x4(m);
}
diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f32.wgsl b/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f32.wgsl
index b46182b..c85f5ed 100644
--- a/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f32.wgsl
@@ -2,7 +2,10 @@
4.0f, 5.0f, 6.0f, 7.0f,
8.0f, 9.0f, 10.0f, 11.0f));
-fn f() -> mat3x4<f32> {
- let m_1 = mat3x4(m);
- return m_1;
+@group(0) @binding(0)
+var<storage, read_write> out : mat3x4<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat3x4(m);
}
diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f32.wgsl.expected.dxc.hlsl
index 11e3fe8..caafb5b 100644
--- a/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f32.wgsl.expected.dxc.hlsl
@@ -1,11 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float3x4 m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store4((offset + 32u), asuint(value[2u]));
}
-static float3x4 m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f));
-
-float3x4 f() {
- const float3x4 m_1 = float3x4(m);
- return m_1;
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float3x4(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f32.wgsl.expected.fxc.hlsl
index 11e3fe8..caafb5b 100644
--- a/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f32.wgsl.expected.fxc.hlsl
@@ -1,11 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float3x4 m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store4((offset + 32u), asuint(value[2u]));
}
-static float3x4 m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f));
-
-float3x4 f() {
- const float3x4 m_1 = float3x4(m);
- return m_1;
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float3x4(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f32.wgsl.expected.glsl
index cd41138..f23e8a0b 100644
--- a/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f32.wgsl.expected.glsl
@@ -1,12 +1,16 @@
#version 310 es
-layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
- return;
-}
mat3x4 m = mat3x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f), vec4(8.0f, 9.0f, 10.0f, 11.0f));
-mat3x4 f() {
- mat3x4 m_1 = mat3x4(m);
- return m_1;
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat3x4 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = mat3x4(m);
}
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ f();
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f32.wgsl.expected.msl
index 948eb5d..08b8f32 100644
--- a/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f32.wgsl.expected.msl
@@ -5,8 +5,10 @@
float3x4 m;
};
-float3x4 f(thread tint_private_vars_struct* const tint_private_vars) {
- float3x4 const m_1 = float3x4((*(tint_private_vars)).m);
- return m_1;
+kernel void f(device float3x4* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f));
+ *(tint_symbol) = float3x4(tint_private_vars.m);
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f32.wgsl.expected.spvasm
index 707e9ce..6e203ac 100644
--- a/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f32.wgsl.expected.spvasm
@@ -1,15 +1,23 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 31
+; Bound: 35
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%mat3v4float = OpTypeMatrix %v4float 3
@@ -31,15 +39,18 @@
%19 = OpConstantComposite %mat3v4float %8 %13 %18
%_ptr_Private_mat3v4float = OpTypePointer Private %mat3v4float
%m = OpVariable %_ptr_Private_mat3v4float Private %19
+ %out_block = OpTypeStruct %mat3v4float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %22 = OpTypeFunction %void
- %26 = OpTypeFunction %mat3v4float
-%unused_entry_point = OpFunction %void None %22
- %25 = OpLabel
- OpReturn
- OpFunctionEnd
- %f = OpFunction %mat3v4float None %26
+ %25 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat3v4float = OpTypePointer StorageBuffer %mat3v4float
+ %f = OpFunction %void None %25
%28 = OpLabel
- %30 = OpLoad %mat3v4float %m
- OpReturnValue %30
+ %32 = OpAccessChain %_ptr_StorageBuffer_mat3v4float %out %uint_0
+ %34 = OpLoad %mat3v4float %m
+ OpStore %32 %34
+ OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f32.wgsl.expected.wgsl
index 83bb686..af31491 100644
--- a/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f32.wgsl.expected.wgsl
@@ -1,6 +1,8 @@
var<private> m = mat3x4(mat3x4(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f));
-fn f() -> mat3x4<f32> {
- let m_1 = mat3x4(m);
- return m_1;
+@group(0) @binding(0) var<storage, read_write> out : mat3x4<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat3x4(m);
}
diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/abstract-float.wgsl b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/abstract-float.wgsl
index ac7c5bd..d3637a3 100644
--- a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/abstract-float.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/abstract-float.wgsl
@@ -1,3 +1,11 @@
-var<private> m = mat3x4(0.0, 1.0, 2.0, 3.0,
- 4.0, 5.0, 6.0, 7.0,
- 8.0, 9.0, 10.0, 11.0);
+const m = mat3x4(0.0, 1.0, 2.0, 3.0,
+ 4.0, 5.0, 6.0, 7.0,
+ 8.0, 9.0, 10.0, 11.0);
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat3x4<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl
index b23383e..69cfcbb 100644
--- a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store4((offset + 32u), asuint(value[2u]));
}
-static float3x4 m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f)));
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl
index b23383e..69cfcbb 100644
--- a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store4((offset + 32u), asuint(value[2u]));
}
-static float3x4 m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f)));
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/abstract-float.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/abstract-float.wgsl.expected.glsl
index 766e72c..5bd5b0f 100644
--- a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/abstract-float.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/abstract-float.wgsl.expected.glsl
@@ -1,7 +1,15 @@
#version 310 es
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat3x4 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = mat3x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f), vec4(8.0f, 9.0f, 10.0f, 11.0f));
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat3x4 m = mat3x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f), vec4(8.0f, 9.0f, 10.0f, 11.0f));
diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/abstract-float.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/abstract-float.wgsl.expected.msl
index 6d3618a..37e35a9 100644
--- a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/abstract-float.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/abstract-float.wgsl.expected.msl
@@ -1,7 +1,8 @@
#include <metal_stdlib>
using namespace metal;
-struct tint_private_vars_struct {
- float3x4 m;
-};
+kernel void f(device float3x4* tint_symbol [[buffer(0)]]) {
+ *(tint_symbol) = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f));
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/abstract-float.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/abstract-float.wgsl.expected.spvasm
index d29b311..a567aee 100644
--- a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/abstract-float.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/abstract-float.wgsl.expected.spvasm
@@ -1,38 +1,52 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 26
+; Bound: 31
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
- OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%mat3v4float = OpTypeMatrix %v4float 3
- %4 = OpConstantNull %float
+ %out_block = OpTypeStruct %mat3v4float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat3v4float = OpTypePointer StorageBuffer %mat3v4float
+ %15 = OpConstantNull %float
%float_1 = OpConstant %float 1
%float_2 = OpConstant %float 2
%float_3 = OpConstant %float 3
- %8 = OpConstantComposite %v4float %4 %float_1 %float_2 %float_3
+ %19 = OpConstantComposite %v4float %15 %float_1 %float_2 %float_3
%float_4 = OpConstant %float 4
%float_5 = OpConstant %float 5
%float_6 = OpConstant %float 6
%float_7 = OpConstant %float 7
- %13 = OpConstantComposite %v4float %float_4 %float_5 %float_6 %float_7
+ %24 = OpConstantComposite %v4float %float_4 %float_5 %float_6 %float_7
%float_8 = OpConstant %float 8
%float_9 = OpConstant %float 9
%float_10 = OpConstant %float 10
%float_11 = OpConstant %float 11
- %18 = OpConstantComposite %v4float %float_8 %float_9 %float_10 %float_11
- %19 = OpConstantComposite %mat3v4float %8 %13 %18
-%_ptr_Private_mat3v4float = OpTypePointer Private %mat3v4float
- %m = OpVariable %_ptr_Private_mat3v4float Private %19
- %void = OpTypeVoid
- %22 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %22
- %25 = OpLabel
+ %29 = OpConstantComposite %v4float %float_8 %float_9 %float_10 %float_11
+ %30 = OpConstantComposite %mat3v4float %19 %24 %29
+ %f = OpFunction %void None %7
+ %10 = OpLabel
+ %14 = OpAccessChain %_ptr_StorageBuffer_mat3v4float %out %uint_0
+ OpStore %14 %30
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/abstract-float.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/abstract-float.wgsl.expected.wgsl
index cdc7e44..30f9d10 100644
--- a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/abstract-float.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/abstract-float.wgsl.expected.wgsl
@@ -1 +1,8 @@
-var<private> m = mat3x4(0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0);
+const m = mat3x4(0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0);
+
+@group(0) @binding(0) var<storage, read_write> out : mat3x4<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f16.wgsl b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f16.wgsl
index 42bafec..3667606 100644
--- a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f16.wgsl
@@ -2,3 +2,11 @@
var<private> m = mat3x4(0.0h, 1.0h, 2.0h, 3.0h,
4.0h, 5.0h, 6.0h, 7.0h,
8.0h, 9.0h, 10.0h, 11.0h);
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat3x4<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f16.wgsl.expected.dxc.hlsl
index 5a44d3f..2369113 100644
--- a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f16.wgsl.expected.dxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 3, 4> m = matrix<float16_t, 3, 4>(vector<float16_t, 4>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 4>(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)), vector<float16_t, 4>(float16_t(8.0h), float16_t(9.0h), float16_t(10.0h), float16_t(11.0h)));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 3, 4> value) {
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 8u), value[1u]);
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 16u), value[2u]);
}
-static matrix<float16_t, 3, 4> m = matrix<float16_t, 3, 4>(vector<float16_t, 4>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 4>(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)), vector<float16_t, 4>(float16_t(8.0h), float16_t(9.0h), float16_t(10.0h), float16_t(11.0h)));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f16.wgsl.expected.glsl
index af6ad9c..bacb04d 100644
--- a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f16.wgsl.expected.glsl
@@ -1,8 +1,17 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
+f16mat3x4 m = f16mat3x4(f16vec4(0.0hf, 1.0hf, 2.0hf, 3.0hf), f16vec4(4.0hf, 5.0hf, 6.0hf, 7.0hf), f16vec4(8.0hf, 9.0hf, 10.0hf, 11.0hf));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat3x4 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-f16mat3x4 m = f16mat3x4(f16vec4(0.0hf, 1.0hf, 2.0hf, 3.0hf), f16vec4(4.0hf, 5.0hf, 6.0hf, 7.0hf), f16vec4(8.0hf, 9.0hf, 10.0hf, 11.0hf));
diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f16.wgsl.expected.msl
index 20a3a5f..1cd0c8c 100644
--- a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f16.wgsl.expected.msl
@@ -5,3 +5,10 @@
half3x4 m;
};
+kernel void f(device half3x4* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half3x4(half4(0.0h, 1.0h, 2.0h, 3.0h), half4(4.0h, 5.0h, 6.0h, 7.0h), half4(8.0h, 9.0h, 10.0h, 11.0h));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f16.wgsl.expected.spvasm
index 5796944..057fadc 100644
--- a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 26
+; Bound: 34
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,10 +9,19 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v4half = OpTypeVector %half 4
%mat3v4half = OpTypeMatrix %v4half 3
@@ -34,9 +43,18 @@
%19 = OpConstantComposite %mat3v4half %8 %13 %18
%_ptr_Private_mat3v4half = OpTypePointer Private %mat3v4half
%m = OpVariable %_ptr_Private_mat3v4half Private %19
+ %out_block = OpTypeStruct %mat3v4half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %22 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %22
- %25 = OpLabel
+ %25 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat3v4half = OpTypePointer StorageBuffer %mat3v4half
+ %f = OpFunction %void None %25
+ %28 = OpLabel
+ %32 = OpAccessChain %_ptr_StorageBuffer_mat3v4half %out %uint_0
+ %33 = OpLoad %mat3v4half %m
+ OpStore %32 %33
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f16.wgsl.expected.wgsl
index e578b48..cd803f7 100644
--- a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f16.wgsl.expected.wgsl
@@ -1,3 +1,10 @@
enable f16;
var<private> m = mat3x4(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h, 8.0h, 9.0h, 10.0h, 11.0h);
+
+@group(0) @binding(0) var<storage, read_write> out : mat3x4<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl
index 21f4e06..9ec3fb1 100644
--- a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl
@@ -1,3 +1,11 @@
var<private> m = mat3x4(0.0f, 1.0f, 2.0f, 3.0f,
4.0f, 5.0f, 6.0f, 7.0f,
8.0f, 9.0f, 10.0f, 11.0f);
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat3x4<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl.expected.dxc.hlsl
index b23383e..d043399 100644
--- a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl.expected.dxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float3x4 m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store4((offset + 32u), asuint(value[2u]));
}
-static float3x4 m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl.expected.fxc.hlsl
index b23383e..d043399 100644
--- a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl.expected.fxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float3x4 m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store4((offset + 32u), asuint(value[2u]));
}
-static float3x4 m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl.expected.glsl
index 766e72c..aceefb8 100644
--- a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl.expected.glsl
@@ -1,7 +1,16 @@
#version 310 es
+mat3x4 m = mat3x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f), vec4(8.0f, 9.0f, 10.0f, 11.0f));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat3x4 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat3x4 m = mat3x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f), vec4(8.0f, 9.0f, 10.0f, 11.0f));
diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl.expected.msl
index 6d3618a..1cf8be0 100644
--- a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl.expected.msl
@@ -5,3 +5,10 @@
float3x4 m;
};
+kernel void f(device float3x4* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl.expected.spvasm
index d29b311..56dd1f9 100644
--- a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl.expected.spvasm
@@ -1,14 +1,23 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 26
+; Bound: 34
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%mat3v4float = OpTypeMatrix %v4float 3
@@ -30,9 +39,18 @@
%19 = OpConstantComposite %mat3v4float %8 %13 %18
%_ptr_Private_mat3v4float = OpTypePointer Private %mat3v4float
%m = OpVariable %_ptr_Private_mat3v4float Private %19
+ %out_block = OpTypeStruct %mat3v4float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %22 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %22
- %25 = OpLabel
+ %25 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat3v4float = OpTypePointer StorageBuffer %mat3v4float
+ %f = OpFunction %void None %25
+ %28 = OpLabel
+ %32 = OpAccessChain %_ptr_StorageBuffer_mat3v4float %out %uint_0
+ %33 = OpLoad %mat3v4float %m
+ OpStore %32 %33
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl.expected.wgsl
index 7af29f0..8f04d40 100644
--- a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl.expected.wgsl
@@ -1 +1,8 @@
var<private> m = mat3x4(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f);
+
+@group(0) @binding(0) var<storage, read_write> out : mat3x4<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/abstract-float.wgsl b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/abstract-float.wgsl
index 0fdc26b..ab959c0 100644
--- a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/abstract-float.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/abstract-float.wgsl
@@ -1,3 +1,11 @@
-var<private> m = mat3x4(vec4(0.0, 1.0, 2.0, 3.0),
- vec4(4.0, 5.0, 6.0, 7.0),
- vec4(8.0, 9.0, 10.0, 11.0));
+const m = mat3x4(vec4(0.0, 1.0, 2.0, 3.0),
+ vec4(4.0, 5.0, 6.0, 7.0),
+ vec4(8.0, 9.0, 10.0, 11.0));
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat3x4<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl
index b23383e..69cfcbb 100644
--- a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store4((offset + 32u), asuint(value[2u]));
}
-static float3x4 m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f)));
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl
index b23383e..69cfcbb 100644
--- a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl
@@ -1,6 +1,13 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store4((offset + 32u), asuint(value[2u]));
}
-static float3x4 m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f)));
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/abstract-float.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/abstract-float.wgsl.expected.glsl
index 766e72c..5bd5b0f 100644
--- a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/abstract-float.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/abstract-float.wgsl.expected.glsl
@@ -1,7 +1,15 @@
#version 310 es
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat3x4 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = mat3x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f), vec4(8.0f, 9.0f, 10.0f, 11.0f));
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat3x4 m = mat3x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f), vec4(8.0f, 9.0f, 10.0f, 11.0f));
diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/abstract-float.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/abstract-float.wgsl.expected.msl
index 6d3618a..37e35a9 100644
--- a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/abstract-float.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/abstract-float.wgsl.expected.msl
@@ -1,7 +1,8 @@
#include <metal_stdlib>
using namespace metal;
-struct tint_private_vars_struct {
- float3x4 m;
-};
+kernel void f(device float3x4* tint_symbol [[buffer(0)]]) {
+ *(tint_symbol) = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f));
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/abstract-float.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/abstract-float.wgsl.expected.spvasm
index d29b311..a567aee 100644
--- a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/abstract-float.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/abstract-float.wgsl.expected.spvasm
@@ -1,38 +1,52 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 26
+; Bound: 31
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
- OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%mat3v4float = OpTypeMatrix %v4float 3
- %4 = OpConstantNull %float
+ %out_block = OpTypeStruct %mat3v4float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat3v4float = OpTypePointer StorageBuffer %mat3v4float
+ %15 = OpConstantNull %float
%float_1 = OpConstant %float 1
%float_2 = OpConstant %float 2
%float_3 = OpConstant %float 3
- %8 = OpConstantComposite %v4float %4 %float_1 %float_2 %float_3
+ %19 = OpConstantComposite %v4float %15 %float_1 %float_2 %float_3
%float_4 = OpConstant %float 4
%float_5 = OpConstant %float 5
%float_6 = OpConstant %float 6
%float_7 = OpConstant %float 7
- %13 = OpConstantComposite %v4float %float_4 %float_5 %float_6 %float_7
+ %24 = OpConstantComposite %v4float %float_4 %float_5 %float_6 %float_7
%float_8 = OpConstant %float 8
%float_9 = OpConstant %float 9
%float_10 = OpConstant %float 10
%float_11 = OpConstant %float 11
- %18 = OpConstantComposite %v4float %float_8 %float_9 %float_10 %float_11
- %19 = OpConstantComposite %mat3v4float %8 %13 %18
-%_ptr_Private_mat3v4float = OpTypePointer Private %mat3v4float
- %m = OpVariable %_ptr_Private_mat3v4float Private %19
- %void = OpTypeVoid
- %22 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %22
- %25 = OpLabel
+ %29 = OpConstantComposite %v4float %float_8 %float_9 %float_10 %float_11
+ %30 = OpConstantComposite %mat3v4float %19 %24 %29
+ %f = OpFunction %void None %7
+ %10 = OpLabel
+ %14 = OpAccessChain %_ptr_StorageBuffer_mat3v4float %out %uint_0
+ OpStore %14 %30
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/abstract-float.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/abstract-float.wgsl.expected.wgsl
index bec21cf..2fb2101 100644
--- a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/abstract-float.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/abstract-float.wgsl.expected.wgsl
@@ -1 +1,8 @@
-var<private> m = mat3x4(vec4(0.0, 1.0, 2.0, 3.0), vec4(4.0, 5.0, 6.0, 7.0), vec4(8.0, 9.0, 10.0, 11.0));
+const m = mat3x4(vec4(0.0, 1.0, 2.0, 3.0), vec4(4.0, 5.0, 6.0, 7.0), vec4(8.0, 9.0, 10.0, 11.0));
+
+@group(0) @binding(0) var<storage, read_write> out : mat3x4<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f16.wgsl b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f16.wgsl
index 59c3ec0..da11df7 100644
--- a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f16.wgsl
@@ -2,3 +2,11 @@
var<private> m = mat3x4(vec4<f16>(0.0h, 1.0h, 2.0h, 3.0h),
vec4<f16>(4.0h, 5.0h, 6.0h, 7.0h),
vec4<f16>(8.0h, 9.0h, 10.0h, 11.0h));
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat3x4<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f16.wgsl.expected.dxc.hlsl
index 5a44d3f..2369113 100644
--- a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f16.wgsl.expected.dxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 3, 4> m = matrix<float16_t, 3, 4>(vector<float16_t, 4>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 4>(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)), vector<float16_t, 4>(float16_t(8.0h), float16_t(9.0h), float16_t(10.0h), float16_t(11.0h)));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 3, 4> value) {
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 8u), value[1u]);
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 16u), value[2u]);
}
-static matrix<float16_t, 3, 4> m = matrix<float16_t, 3, 4>(vector<float16_t, 4>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 4>(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)), vector<float16_t, 4>(float16_t(8.0h), float16_t(9.0h), float16_t(10.0h), float16_t(11.0h)));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f16.wgsl.expected.glsl
index af6ad9c..bacb04d 100644
--- a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f16.wgsl.expected.glsl
@@ -1,8 +1,17 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
+f16mat3x4 m = f16mat3x4(f16vec4(0.0hf, 1.0hf, 2.0hf, 3.0hf), f16vec4(4.0hf, 5.0hf, 6.0hf, 7.0hf), f16vec4(8.0hf, 9.0hf, 10.0hf, 11.0hf));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat3x4 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-f16mat3x4 m = f16mat3x4(f16vec4(0.0hf, 1.0hf, 2.0hf, 3.0hf), f16vec4(4.0hf, 5.0hf, 6.0hf, 7.0hf), f16vec4(8.0hf, 9.0hf, 10.0hf, 11.0hf));
diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f16.wgsl.expected.msl
index 20a3a5f..1cd0c8c 100644
--- a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f16.wgsl.expected.msl
@@ -5,3 +5,10 @@
half3x4 m;
};
+kernel void f(device half3x4* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half3x4(half4(0.0h, 1.0h, 2.0h, 3.0h), half4(4.0h, 5.0h, 6.0h, 7.0h), half4(8.0h, 9.0h, 10.0h, 11.0h));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f16.wgsl.expected.spvasm
index 5796944..057fadc 100644
--- a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 26
+; Bound: 34
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,10 +9,19 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v4half = OpTypeVector %half 4
%mat3v4half = OpTypeMatrix %v4half 3
@@ -34,9 +43,18 @@
%19 = OpConstantComposite %mat3v4half %8 %13 %18
%_ptr_Private_mat3v4half = OpTypePointer Private %mat3v4half
%m = OpVariable %_ptr_Private_mat3v4half Private %19
+ %out_block = OpTypeStruct %mat3v4half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %22 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %22
- %25 = OpLabel
+ %25 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat3v4half = OpTypePointer StorageBuffer %mat3v4half
+ %f = OpFunction %void None %25
+ %28 = OpLabel
+ %32 = OpAccessChain %_ptr_StorageBuffer_mat3v4half %out %uint_0
+ %33 = OpLoad %mat3v4half %m
+ OpStore %32 %33
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f16.wgsl.expected.wgsl
index 95c3950..1ed1532 100644
--- a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f16.wgsl.expected.wgsl
@@ -1,3 +1,10 @@
enable f16;
var<private> m = mat3x4(vec4<f16>(0.0h, 1.0h, 2.0h, 3.0h), vec4<f16>(4.0h, 5.0h, 6.0h, 7.0h), vec4<f16>(8.0h, 9.0h, 10.0h, 11.0h));
+
+@group(0) @binding(0) var<storage, read_write> out : mat3x4<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl
index 7cb7da6..9853921 100644
--- a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl
@@ -1,3 +1,11 @@
var<private> m = mat3x4(vec4<f32>(0.0f, 1.0f, 2.0f, 3.0f),
vec4<f32>(4.0f, 5.0f, 6.0f, 7.0f),
vec4<f32>(8.0f, 9.0f, 10.0f, 11.0f));
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat3x4<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl.expected.dxc.hlsl
index b23383e..d043399 100644
--- a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl.expected.dxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float3x4 m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store4((offset + 32u), asuint(value[2u]));
}
-static float3x4 m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl.expected.fxc.hlsl
index b23383e..d043399 100644
--- a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl.expected.fxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float3x4 m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store4((offset + 32u), asuint(value[2u]));
}
-static float3x4 m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl.expected.glsl
index 766e72c..aceefb8 100644
--- a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl.expected.glsl
@@ -1,7 +1,16 @@
#version 310 es
+mat3x4 m = mat3x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f), vec4(8.0f, 9.0f, 10.0f, 11.0f));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat3x4 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat3x4 m = mat3x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f), vec4(8.0f, 9.0f, 10.0f, 11.0f));
diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl.expected.msl
index 6d3618a..1cf8be0 100644
--- a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl.expected.msl
@@ -5,3 +5,10 @@
float3x4 m;
};
+kernel void f(device float3x4* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl.expected.spvasm
index d29b311..56dd1f9 100644
--- a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl.expected.spvasm
@@ -1,14 +1,23 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 26
+; Bound: 34
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%mat3v4float = OpTypeMatrix %v4float 3
@@ -30,9 +39,18 @@
%19 = OpConstantComposite %mat3v4float %8 %13 %18
%_ptr_Private_mat3v4float = OpTypePointer Private %mat3v4float
%m = OpVariable %_ptr_Private_mat3v4float Private %19
+ %out_block = OpTypeStruct %mat3v4float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %22 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %22
- %25 = OpLabel
+ %25 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat3v4float = OpTypePointer StorageBuffer %mat3v4float
+ %f = OpFunction %void None %25
+ %28 = OpLabel
+ %32 = OpAccessChain %_ptr_StorageBuffer_mat3v4float %out %uint_0
+ %33 = OpLoad %mat3v4float %m
+ OpStore %32 %33
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl.expected.wgsl
index a0c86ae2..a1970cb 100644
--- a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl.expected.wgsl
@@ -1 +1,8 @@
var<private> m = mat3x4(vec4<f32>(0.0f, 1.0f, 2.0f, 3.0f), vec4<f32>(4.0f, 5.0f, 6.0f, 7.0f), vec4<f32>(8.0f, 9.0f, 10.0f, 11.0f));
+
+@group(0) @binding(0) var<storage, read_write> out : mat3x4<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x4/load/f16.wgsl b/test/tint/expressions/type_ctor/mat3x4/load/f16.wgsl
index 338f539..56b4fa8 100644
--- a/test/tint/expressions/type_ctor/mat3x4/load/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x4/load/f16.wgsl
@@ -1,5 +1,10 @@
enable f16;
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat3x4<f16>;
+
+@compute @workgroup_size(1)
fn f() {
- var m = mat3x4<f16>();
- let m_1 = mat3x4(m);
+ var m = mat3x4<f16>();
+ out = mat3x4(m);
}
diff --git a/test/tint/expressions/type_ctor/mat3x4/load/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/load/f16.wgsl.expected.dxc.hlsl
index 3e689b4..3389b75 100644
--- a/test/tint/expressions/type_ctor/mat3x4/load/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x4/load/f16.wgsl.expected.dxc.hlsl
@@ -1,9 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 3, 4> value) {
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 8u), value[1u]);
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 16u), value[2u]);
}
+[numthreads(1, 1, 1)]
void f() {
matrix<float16_t, 3, 4> m = matrix<float16_t, 3, 4>((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx);
- const matrix<float16_t, 3, 4> m_1 = matrix<float16_t, 3, 4>(m);
+ tint_symbol_store(0u, matrix<float16_t, 3, 4>(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat3x4/load/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x4/load/f16.wgsl.expected.glsl
index 657d16d..5b6f837 100644
--- a/test/tint/expressions/type_ctor/mat3x4/load/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat3x4/load/f16.wgsl.expected.glsl
@@ -1,12 +1,17 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
- return;
-}
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat3x4 inner;
+} tint_symbol;
+
void f() {
f16mat3x4 m = f16mat3x4(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf));
- f16mat3x4 m_1 = f16mat3x4(m);
+ tint_symbol.inner = f16mat3x4(m);
}
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ f();
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x4/load/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x4/load/f16.wgsl.expected.msl
index c501e23..d5a9b2e 100644
--- a/test/tint/expressions/type_ctor/mat3x4/load/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat3x4/load/f16.wgsl.expected.msl
@@ -1,8 +1,9 @@
#include <metal_stdlib>
using namespace metal;
-void f() {
+kernel void f(device half3x4* tint_symbol [[buffer(0)]]) {
half3x4 m = half3x4(half4(0.0h), half4(0.0h), half4(0.0h));
- half3x4 const m_1 = half3x4(m);
+ *(tint_symbol) = half3x4(m);
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat3x4/load/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x4/load/f16.wgsl.expected.spvasm
index ae94064..15cf9f6 100644
--- a/test/tint/expressions/type_ctor/mat3x4/load/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat3x4/load/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 15
+; Bound: 20
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,26 +9,38 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
- OpName %unused_entry_point "unused_entry_point"
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
OpName %f "f"
OpName %m "m"
- %void = OpTypeVoid
- %1 = OpTypeFunction %void
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v4half = OpTypeVector %half 4
%mat3v4half = OpTypeMatrix %v4half 3
- %10 = OpConstantNull %mat3v4half
+ %out_block = OpTypeStruct %mat3v4half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void
+ %11 = OpConstantNull %mat3v4half
%_ptr_Function_mat3v4half = OpTypePointer Function %mat3v4half
-%unused_entry_point = OpFunction %void None %1
- %4 = OpLabel
- OpReturn
- OpFunctionEnd
- %f = OpFunction %void None %1
- %6 = OpLabel
- %m = OpVariable %_ptr_Function_mat3v4half Function %10
- OpStore %m %10
- %14 = OpLoad %mat3v4half %m
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat3v4half = OpTypePointer StorageBuffer %mat3v4half
+ %f = OpFunction %void None %7
+ %10 = OpLabel
+ %m = OpVariable %_ptr_Function_mat3v4half Function %11
+ OpStore %m %11
+ %17 = OpAccessChain %_ptr_StorageBuffer_mat3v4half %out %uint_0
+ %19 = OpLoad %mat3v4half %m
+ OpStore %17 %19
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat3x4/load/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x4/load/f16.wgsl.expected.wgsl
index b437841..1d72473 100644
--- a/test/tint/expressions/type_ctor/mat3x4/load/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x4/load/f16.wgsl.expected.wgsl
@@ -1,6 +1,9 @@
enable f16;
+@group(0) @binding(0) var<storage, read_write> out : mat3x4<f16>;
+
+@compute @workgroup_size(1)
fn f() {
var m = mat3x4<f16>();
- let m_1 = mat3x4(m);
+ out = mat3x4(m);
}
diff --git a/test/tint/expressions/type_ctor/mat3x4/load/f32.wgsl b/test/tint/expressions/type_ctor/mat3x4/load/f32.wgsl
index 385ba60..cc37884 100644
--- a/test/tint/expressions/type_ctor/mat3x4/load/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x4/load/f32.wgsl
@@ -1,4 +1,8 @@
+@group(0) @binding(0)
+var<storage, read_write> out : mat3x4<f32>;
+
+@compute @workgroup_size(1)
fn f() {
- var m = mat3x4<f32>();
- let m_1 = mat3x4(m);
+ var m = mat3x4<f32>();
+ out = mat3x4(m);
}
diff --git a/test/tint/expressions/type_ctor/mat3x4/load/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/load/f32.wgsl.expected.dxc.hlsl
index 0aa5662..d4ce210 100644
--- a/test/tint/expressions/type_ctor/mat3x4/load/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x4/load/f32.wgsl.expected.dxc.hlsl
@@ -1,9 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store4((offset + 32u), asuint(value[2u]));
}
+[numthreads(1, 1, 1)]
void f() {
float3x4 m = float3x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx);
- const float3x4 m_1 = float3x4(m);
+ tint_symbol_store(0u, float3x4(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat3x4/load/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/load/f32.wgsl.expected.fxc.hlsl
index 0aa5662..d4ce210 100644
--- a/test/tint/expressions/type_ctor/mat3x4/load/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x4/load/f32.wgsl.expected.fxc.hlsl
@@ -1,9 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store4((offset + 32u), asuint(value[2u]));
}
+[numthreads(1, 1, 1)]
void f() {
float3x4 m = float3x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx);
- const float3x4 m_1 = float3x4(m);
+ tint_symbol_store(0u, float3x4(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat3x4/load/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x4/load/f32.wgsl.expected.glsl
index 73df09c..5e15224 100644
--- a/test/tint/expressions/type_ctor/mat3x4/load/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat3x4/load/f32.wgsl.expected.glsl
@@ -1,11 +1,16 @@
#version 310 es
-layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
- return;
-}
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat3x4 inner;
+} tint_symbol;
+
void f() {
mat3x4 m = mat3x4(vec4(0.0f), vec4(0.0f), vec4(0.0f));
- mat3x4 m_1 = mat3x4(m);
+ tint_symbol.inner = mat3x4(m);
}
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ f();
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x4/load/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x4/load/f32.wgsl.expected.msl
index 2dc900e..ec044eb 100644
--- a/test/tint/expressions/type_ctor/mat3x4/load/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat3x4/load/f32.wgsl.expected.msl
@@ -1,8 +1,9 @@
#include <metal_stdlib>
using namespace metal;
-void f() {
+kernel void f(device float3x4* tint_symbol [[buffer(0)]]) {
float3x4 m = float3x4(float4(0.0f), float4(0.0f), float4(0.0f));
- float3x4 const m_1 = float3x4(m);
+ *(tint_symbol) = float3x4(m);
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat3x4/load/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x4/load/f32.wgsl.expected.spvasm
index e2ef020..87ec1f7 100644
--- a/test/tint/expressions/type_ctor/mat3x4/load/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat3x4/load/f32.wgsl.expected.spvasm
@@ -1,30 +1,42 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 15
+; Bound: 20
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
- OpName %unused_entry_point "unused_entry_point"
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
OpName %f "f"
OpName %m "m"
- %void = OpTypeVoid
- %1 = OpTypeFunction %void
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%mat3v4float = OpTypeMatrix %v4float 3
- %10 = OpConstantNull %mat3v4float
+ %out_block = OpTypeStruct %mat3v4float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void
+ %11 = OpConstantNull %mat3v4float
%_ptr_Function_mat3v4float = OpTypePointer Function %mat3v4float
-%unused_entry_point = OpFunction %void None %1
- %4 = OpLabel
- OpReturn
- OpFunctionEnd
- %f = OpFunction %void None %1
- %6 = OpLabel
- %m = OpVariable %_ptr_Function_mat3v4float Function %10
- OpStore %m %10
- %14 = OpLoad %mat3v4float %m
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat3v4float = OpTypePointer StorageBuffer %mat3v4float
+ %f = OpFunction %void None %7
+ %10 = OpLabel
+ %m = OpVariable %_ptr_Function_mat3v4float Function %11
+ OpStore %m %11
+ %17 = OpAccessChain %_ptr_StorageBuffer_mat3v4float %out %uint_0
+ %19 = OpLoad %mat3v4float %m
+ OpStore %17 %19
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat3x4/load/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x4/load/f32.wgsl.expected.wgsl
index 9d22dea..aff4903 100644
--- a/test/tint/expressions/type_ctor/mat3x4/load/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x4/load/f32.wgsl.expected.wgsl
@@ -1,4 +1,7 @@
+@group(0) @binding(0) var<storage, read_write> out : mat3x4<f32>;
+
+@compute @workgroup_size(1)
fn f() {
var m = mat3x4<f32>();
- let m_1 = mat3x4(m);
+ out = mat3x4(m);
}
diff --git a/test/tint/expressions/type_ctor/mat3x4/zero/f16.wgsl b/test/tint/expressions/type_ctor/mat3x4/zero/f16.wgsl
index 425d5b0..d5ed9d0 100644
--- a/test/tint/expressions/type_ctor/mat3x4/zero/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x4/zero/f16.wgsl
@@ -1,2 +1,10 @@
enable f16;
var<private> m = mat3x4<f16>();
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat3x4<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x4/zero/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/zero/f16.wgsl.expected.dxc.hlsl
index 41130ec..a3af16a 100644
--- a/test/tint/expressions/type_ctor/mat3x4/zero/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x4/zero/f16.wgsl.expected.dxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 3, 4> m = matrix<float16_t, 3, 4>((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx);
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 3, 4> value) {
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 8u), value[1u]);
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 16u), value[2u]);
}
-static matrix<float16_t, 3, 4> m = matrix<float16_t, 3, 4>((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx);
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x4/zero/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x4/zero/f16.wgsl.expected.glsl
index 4d7e4c0..a645ab4 100644
--- a/test/tint/expressions/type_ctor/mat3x4/zero/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat3x4/zero/f16.wgsl.expected.glsl
@@ -1,8 +1,17 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
+f16mat3x4 m = f16mat3x4(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat3x4 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-f16mat3x4 m = f16mat3x4(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf));
diff --git a/test/tint/expressions/type_ctor/mat3x4/zero/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x4/zero/f16.wgsl.expected.msl
index 20a3a5f..7a630a1 100644
--- a/test/tint/expressions/type_ctor/mat3x4/zero/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat3x4/zero/f16.wgsl.expected.msl
@@ -5,3 +5,10 @@
half3x4 m;
};
+kernel void f(device half3x4* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half3x4(half4(0.0h), half4(0.0h), half4(0.0h));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat3x4/zero/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x4/zero/f16.wgsl.expected.spvasm
index 1b3157f..94e265e 100644
--- a/test/tint/expressions/type_ctor/mat3x4/zero/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat3x4/zero/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 11
+; Bound: 19
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,19 +9,37 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v4half = OpTypeVector %half 4
%mat3v4half = OpTypeMatrix %v4half 3
%4 = OpConstantNull %mat3v4half
%_ptr_Private_mat3v4half = OpTypePointer Private %mat3v4half
%m = OpVariable %_ptr_Private_mat3v4half Private %4
+ %out_block = OpTypeStruct %mat3v4half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %7 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %7
- %10 = OpLabel
+ %10 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat3v4half = OpTypePointer StorageBuffer %mat3v4half
+ %f = OpFunction %void None %10
+ %13 = OpLabel
+ %17 = OpAccessChain %_ptr_StorageBuffer_mat3v4half %out %uint_0
+ %18 = OpLoad %mat3v4half %m
+ OpStore %17 %18
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat3x4/zero/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x4/zero/f16.wgsl.expected.wgsl
index 0d9490d..8d2ec3c 100644
--- a/test/tint/expressions/type_ctor/mat3x4/zero/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x4/zero/f16.wgsl.expected.wgsl
@@ -1,3 +1,10 @@
enable f16;
var<private> m = mat3x4<f16>();
+
+@group(0) @binding(0) var<storage, read_write> out : mat3x4<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x4/zero/f32.wgsl b/test/tint/expressions/type_ctor/mat3x4/zero/f32.wgsl
index 6b2bb52..d89a485 100644
--- a/test/tint/expressions/type_ctor/mat3x4/zero/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x4/zero/f32.wgsl
@@ -1 +1,9 @@
var<private> m = mat3x4<f32>();
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat3x4<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x4/zero/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/zero/f32.wgsl.expected.dxc.hlsl
index 3f3c45b..ab2fd2e 100644
--- a/test/tint/expressions/type_ctor/mat3x4/zero/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x4/zero/f32.wgsl.expected.dxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float3x4 m = float3x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx);
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store4((offset + 32u), asuint(value[2u]));
}
-static float3x4 m = float3x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx);
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x4/zero/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/zero/f32.wgsl.expected.fxc.hlsl
index 3f3c45b..ab2fd2e 100644
--- a/test/tint/expressions/type_ctor/mat3x4/zero/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat3x4/zero/f32.wgsl.expected.fxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float3x4 m = float3x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx);
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float3x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store4((offset + 32u), asuint(value[2u]));
}
-static float3x4 m = float3x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx);
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat3x4/zero/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x4/zero/f32.wgsl.expected.glsl
index 845aed1..98748e2 100644
--- a/test/tint/expressions/type_ctor/mat3x4/zero/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat3x4/zero/f32.wgsl.expected.glsl
@@ -1,7 +1,16 @@
#version 310 es
+mat3x4 m = mat3x4(vec4(0.0f), vec4(0.0f), vec4(0.0f));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat3x4 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat3x4 m = mat3x4(vec4(0.0f), vec4(0.0f), vec4(0.0f));
diff --git a/test/tint/expressions/type_ctor/mat3x4/zero/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x4/zero/f32.wgsl.expected.msl
index 6d3618a..9791c69 100644
--- a/test/tint/expressions/type_ctor/mat3x4/zero/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat3x4/zero/f32.wgsl.expected.msl
@@ -5,3 +5,10 @@
float3x4 m;
};
+kernel void f(device float3x4* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float3x4(float4(0.0f), float4(0.0f), float4(0.0f));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat3x4/zero/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x4/zero/f32.wgsl.expected.spvasm
index 329a1ab..031d6ff 100644
--- a/test/tint/expressions/type_ctor/mat3x4/zero/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat3x4/zero/f32.wgsl.expected.spvasm
@@ -1,23 +1,41 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 11
+; Bound: 19
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%mat3v4float = OpTypeMatrix %v4float 3
%4 = OpConstantNull %mat3v4float
%_ptr_Private_mat3v4float = OpTypePointer Private %mat3v4float
%m = OpVariable %_ptr_Private_mat3v4float Private %4
+ %out_block = OpTypeStruct %mat3v4float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %7 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %7
- %10 = OpLabel
+ %10 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat3v4float = OpTypePointer StorageBuffer %mat3v4float
+ %f = OpFunction %void None %10
+ %13 = OpLabel
+ %17 = OpAccessChain %_ptr_StorageBuffer_mat3v4float %out %uint_0
+ %18 = OpLoad %mat3v4float %m
+ OpStore %17 %18
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat3x4/zero/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x4/zero/f32.wgsl.expected.wgsl
index 6b2bb52..a32fcce 100644
--- a/test/tint/expressions/type_ctor/mat3x4/zero/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat3x4/zero/f32.wgsl.expected.wgsl
@@ -1 +1,8 @@
var<private> m = mat3x4<f32>();
+
+@group(0) @binding(0) var<storage, read_write> out : mat3x4<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f16.wgsl b/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f16.wgsl
index dcc7e57..5855e61 100644
--- a/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f16.wgsl
@@ -1,10 +1,13 @@
enable f16;
-var<private> m = mat4x2(mat4x2<f16>(0.0h, 1.0h,
- 2.0h, 3.0h,
- 4.0h, 5.0h,
- 6.0h, 7.0h));
+var<private> m = mat4x2<f16>(mat4x2<f16>(0.0h, 1.0h,
+ 2.0h, 3.0h,
+ 4.0h, 5.0h,
+ 6.0h, 7.0h));
-fn f() -> mat4x2<f16> {
- let m_1 = mat4x2(m);
- return m_1;
+@group(0) @binding(0)
+var<storage, read_write> out : mat4x2<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat4x2<f16>(m);
}
diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f16.wgsl.expected.dxc.hlsl
index be358f3..29d3615 100644
--- a/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f16.wgsl.expected.dxc.hlsl
@@ -1,11 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 4, 2> m = matrix<float16_t, 4, 2>(vector<float16_t, 2>(float16_t(0.0h), float16_t(1.0h)), vector<float16_t, 2>(float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 2>(float16_t(4.0h), float16_t(5.0h)), vector<float16_t, 2>(float16_t(6.0h), float16_t(7.0h)));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 4, 2> value) {
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 4u), value[1u]);
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 8u), value[2u]);
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 12u), value[3u]);
}
-static matrix<float16_t, 4, 2> m = matrix<float16_t, 4, 2>(vector<float16_t, 2>(float16_t(0.0h), float16_t(1.0h)), vector<float16_t, 2>(float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 2>(float16_t(4.0h), float16_t(5.0h)), vector<float16_t, 2>(float16_t(6.0h), float16_t(7.0h)));
-
-matrix<float16_t, 4, 2> f() {
- const matrix<float16_t, 4, 2> m_1 = matrix<float16_t, 4, 2>(m);
- return m_1;
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, matrix<float16_t, 4, 2>(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f16.wgsl.expected.glsl
index 572fcd0..0e3bda1 100644
--- a/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f16.wgsl.expected.glsl
@@ -1,13 +1,17 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
- return;
-}
f16mat4x2 m = f16mat4x2(f16vec2(0.0hf, 1.0hf), f16vec2(2.0hf, 3.0hf), f16vec2(4.0hf, 5.0hf), f16vec2(6.0hf, 7.0hf));
-f16mat4x2 f() {
- f16mat4x2 m_1 = f16mat4x2(m);
- return m_1;
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat4x2 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = f16mat4x2(m);
}
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ f();
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f16.wgsl.expected.msl
index 20d0ed7..74499e8 100644
--- a/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f16.wgsl.expected.msl
@@ -5,8 +5,10 @@
half4x2 m;
};
-half4x2 f(thread tint_private_vars_struct* const tint_private_vars) {
- half4x2 const m_1 = half4x2((*(tint_private_vars)).m);
- return m_1;
+kernel void f(device half4x2* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half4x2(half2(0.0h, 1.0h), half2(2.0h, 3.0h), half2(4.0h, 5.0h), half2(6.0h, 7.0h));
+ *(tint_symbol) = half4x2(tint_private_vars.m);
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f16.wgsl.expected.spvasm
index 6bbc56e..b5e0963 100644
--- a/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 28
+; Bound: 32
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,11 +9,19 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 4
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v2half = OpTypeVector %half 2
%mat4v2half = OpTypeMatrix %v2half 4
@@ -32,15 +40,18 @@
%16 = OpConstantComposite %mat4v2half %6 %9 %12 %15
%_ptr_Private_mat4v2half = OpTypePointer Private %mat4v2half
%m = OpVariable %_ptr_Private_mat4v2half Private %16
+ %out_block = OpTypeStruct %mat4v2half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %19 = OpTypeFunction %void
- %23 = OpTypeFunction %mat4v2half
-%unused_entry_point = OpFunction %void None %19
- %22 = OpLabel
- OpReturn
- OpFunctionEnd
- %f = OpFunction %mat4v2half None %23
+ %22 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat4v2half = OpTypePointer StorageBuffer %mat4v2half
+ %f = OpFunction %void None %22
%25 = OpLabel
- %27 = OpLoad %mat4v2half %m
- OpReturnValue %27
+ %29 = OpAccessChain %_ptr_StorageBuffer_mat4v2half %out %uint_0
+ %31 = OpLoad %mat4v2half %m
+ OpStore %29 %31
+ OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f16.wgsl.expected.wgsl
index cdd9ef8..c21bc48 100644
--- a/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f16.wgsl.expected.wgsl
@@ -1,8 +1,10 @@
enable f16;
-var<private> m = mat4x2(mat4x2<f16>(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h));
+var<private> m = mat4x2<f16>(mat4x2<f16>(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h));
-fn f() -> mat4x2<f16> {
- let m_1 = mat4x2(m);
- return m_1;
+@group(0) @binding(0) var<storage, read_write> out : mat4x2<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat4x2<f16>(m);
}
diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f32.wgsl b/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f32.wgsl
index d82b3ff..b4612b4 100644
--- a/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f32.wgsl
@@ -1,9 +1,12 @@
-var<private> m = mat4x2(mat4x2<f32>(0.0f, 1.0f,
- 2.0f, 3.0f,
- 4.0f, 5.0f,
- 6.0f, 7.0f));
+var<private> m = mat4x2<f32>(mat4x2<f32>(0.0f, 1.0f,
+ 2.0f, 3.0f,
+ 4.0f, 5.0f,
+ 6.0f, 7.0f));
-fn f() -> mat4x2<f32> {
- let m_1 = mat4x2(m);
- return m_1;
+@group(0) @binding(0)
+var<storage, read_write> out : mat4x2<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat4x2<f32>(m);
}
diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f32.wgsl.expected.dxc.hlsl
index b957caa..3249fa9 100644
--- a/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f32.wgsl.expected.dxc.hlsl
@@ -1,11 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float4x2 m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
+ tint_symbol.Store2((offset + 16u), asuint(value[2u]));
+ tint_symbol.Store2((offset + 24u), asuint(value[3u]));
}
-static float4x2 m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f));
-
-float4x2 f() {
- const float4x2 m_1 = float4x2(m);
- return m_1;
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float4x2(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f32.wgsl.expected.fxc.hlsl
index b957caa..3249fa9 100644
--- a/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f32.wgsl.expected.fxc.hlsl
@@ -1,11 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float4x2 m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
+ tint_symbol.Store2((offset + 16u), asuint(value[2u]));
+ tint_symbol.Store2((offset + 24u), asuint(value[3u]));
}
-static float4x2 m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f));
-
-float4x2 f() {
- const float4x2 m_1 = float4x2(m);
- return m_1;
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float4x2(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f32.wgsl.expected.glsl
index e5a475d..473de8d 100644
--- a/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f32.wgsl.expected.glsl
@@ -1,12 +1,16 @@
#version 310 es
-layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
- return;
-}
mat4x2 m = mat4x2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f), vec2(4.0f, 5.0f), vec2(6.0f, 7.0f));
-mat4x2 f() {
- mat4x2 m_1 = mat4x2(m);
- return m_1;
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat4x2 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = mat4x2(m);
}
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ f();
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f32.wgsl.expected.msl
index c229c26..fbda45f 100644
--- a/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f32.wgsl.expected.msl
@@ -5,8 +5,10 @@
float4x2 m;
};
-float4x2 f(thread tint_private_vars_struct* const tint_private_vars) {
- float4x2 const m_1 = float4x2((*(tint_private_vars)).m);
- return m_1;
+kernel void f(device float4x2* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f));
+ *(tint_symbol) = float4x2(tint_private_vars.m);
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f32.wgsl.expected.spvasm
index f40139e..f680c00 100644
--- a/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f32.wgsl.expected.spvasm
@@ -1,15 +1,23 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 28
+; Bound: 32
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%mat4v2float = OpTypeMatrix %v2float 4
@@ -28,15 +36,18 @@
%16 = OpConstantComposite %mat4v2float %6 %9 %12 %15
%_ptr_Private_mat4v2float = OpTypePointer Private %mat4v2float
%m = OpVariable %_ptr_Private_mat4v2float Private %16
+ %out_block = OpTypeStruct %mat4v2float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %19 = OpTypeFunction %void
- %23 = OpTypeFunction %mat4v2float
-%unused_entry_point = OpFunction %void None %19
- %22 = OpLabel
- OpReturn
- OpFunctionEnd
- %f = OpFunction %mat4v2float None %23
+ %22 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat4v2float = OpTypePointer StorageBuffer %mat4v2float
+ %f = OpFunction %void None %22
%25 = OpLabel
- %27 = OpLoad %mat4v2float %m
- OpReturnValue %27
+ %29 = OpAccessChain %_ptr_StorageBuffer_mat4v2float %out %uint_0
+ %31 = OpLoad %mat4v2float %m
+ OpStore %29 %31
+ OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f32.wgsl.expected.wgsl
index 6eb8cc6..48a9686 100644
--- a/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f32.wgsl.expected.wgsl
@@ -1,6 +1,8 @@
-var<private> m = mat4x2(mat4x2<f32>(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f));
+var<private> m = mat4x2<f32>(mat4x2<f32>(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f));
-fn f() -> mat4x2<f32> {
- let m_1 = mat4x2(m);
- return m_1;
+@group(0) @binding(0) var<storage, read_write> out : mat4x2<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat4x2<f32>(m);
}
diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f16.wgsl b/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f16.wgsl
index f89ebb9..1f44217 100644
--- a/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f16.wgsl
@@ -3,3 +3,11 @@
2.0h, 3.0h,
4.0h, 5.0h,
6.0h, 7.0h);
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat4x2<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f16.wgsl.expected.dxc.hlsl
index d449a86..e45c042 100644
--- a/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f16.wgsl.expected.dxc.hlsl
@@ -1,6 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 4, 2> m = matrix<float16_t, 4, 2>(vector<float16_t, 2>(float16_t(0.0h), float16_t(1.0h)), vector<float16_t, 2>(float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 2>(float16_t(4.0h), float16_t(5.0h)), vector<float16_t, 2>(float16_t(6.0h), float16_t(7.0h)));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 4, 2> value) {
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 4u), value[1u]);
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 8u), value[2u]);
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 12u), value[3u]);
}
-static matrix<float16_t, 4, 2> m = matrix<float16_t, 4, 2>(vector<float16_t, 2>(float16_t(0.0h), float16_t(1.0h)), vector<float16_t, 2>(float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 2>(float16_t(4.0h), float16_t(5.0h)), vector<float16_t, 2>(float16_t(6.0h), float16_t(7.0h)));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f16.wgsl.expected.glsl
index f24340e..75d6df4 100644
--- a/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f16.wgsl.expected.glsl
@@ -1,8 +1,17 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
+f16mat4x2 m = f16mat4x2(f16vec2(0.0hf, 1.0hf), f16vec2(2.0hf, 3.0hf), f16vec2(4.0hf, 5.0hf), f16vec2(6.0hf, 7.0hf));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat4x2 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-f16mat4x2 m = f16mat4x2(f16vec2(0.0hf, 1.0hf), f16vec2(2.0hf, 3.0hf), f16vec2(4.0hf, 5.0hf), f16vec2(6.0hf, 7.0hf));
diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f16.wgsl.expected.msl
index d6410a1..1ca5ed5 100644
--- a/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f16.wgsl.expected.msl
@@ -5,3 +5,10 @@
half4x2 m;
};
+kernel void f(device half4x2* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half4x2(half2(0.0h, 1.0h), half2(2.0h, 3.0h), half2(4.0h, 5.0h), half2(6.0h, 7.0h));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f16.wgsl.expected.spvasm
index 282162b..8f1da5c 100644
--- a/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 23
+; Bound: 31
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,10 +9,19 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 4
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v2half = OpTypeVector %half 2
%mat4v2half = OpTypeMatrix %v2half 4
@@ -31,9 +40,18 @@
%16 = OpConstantComposite %mat4v2half %6 %9 %12 %15
%_ptr_Private_mat4v2half = OpTypePointer Private %mat4v2half
%m = OpVariable %_ptr_Private_mat4v2half Private %16
+ %out_block = OpTypeStruct %mat4v2half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %19 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %19
- %22 = OpLabel
+ %22 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat4v2half = OpTypePointer StorageBuffer %mat4v2half
+ %f = OpFunction %void None %22
+ %25 = OpLabel
+ %29 = OpAccessChain %_ptr_StorageBuffer_mat4v2half %out %uint_0
+ %30 = OpLoad %mat4v2half %m
+ OpStore %29 %30
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f16.wgsl.expected.wgsl
index 2da061a..dd2e891 100644
--- a/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f16.wgsl.expected.wgsl
@@ -1,3 +1,10 @@
enable f16;
var<private> m = mat4x2<f16>(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h);
+
+@group(0) @binding(0) var<storage, read_write> out : mat4x2<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl b/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl
index 1332e85..2e38539 100644
--- a/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl
@@ -2,3 +2,11 @@
2.0f, 3.0f,
4.0f, 5.0f,
6.0f, 7.0f);
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat4x2<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl.expected.dxc.hlsl
index e97d279..d7372ac 100644
--- a/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl.expected.dxc.hlsl
@@ -1,6 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float4x2 m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
+ tint_symbol.Store2((offset + 16u), asuint(value[2u]));
+ tint_symbol.Store2((offset + 24u), asuint(value[3u]));
}
-static float4x2 m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl.expected.fxc.hlsl
index e97d279..d7372ac 100644
--- a/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl.expected.fxc.hlsl
@@ -1,6 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float4x2 m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
+ tint_symbol.Store2((offset + 16u), asuint(value[2u]));
+ tint_symbol.Store2((offset + 24u), asuint(value[3u]));
}
-static float4x2 m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl.expected.glsl
index 2fbbb7e..989aad8 100644
--- a/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl.expected.glsl
@@ -1,7 +1,16 @@
#version 310 es
+mat4x2 m = mat4x2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f), vec2(4.0f, 5.0f), vec2(6.0f, 7.0f));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat4x2 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat4x2 m = mat4x2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f), vec2(4.0f, 5.0f), vec2(6.0f, 7.0f));
diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl.expected.msl
index 3553bff..0cb5c08 100644
--- a/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl.expected.msl
@@ -5,3 +5,10 @@
float4x2 m;
};
+kernel void f(device float4x2* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl.expected.spvasm
index fd79610..dd094ad 100644
--- a/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl.expected.spvasm
@@ -1,14 +1,23 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 23
+; Bound: 31
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%mat4v2float = OpTypeMatrix %v2float 4
@@ -27,9 +36,18 @@
%16 = OpConstantComposite %mat4v2float %6 %9 %12 %15
%_ptr_Private_mat4v2float = OpTypePointer Private %mat4v2float
%m = OpVariable %_ptr_Private_mat4v2float Private %16
+ %out_block = OpTypeStruct %mat4v2float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %19 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %19
- %22 = OpLabel
+ %22 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat4v2float = OpTypePointer StorageBuffer %mat4v2float
+ %f = OpFunction %void None %22
+ %25 = OpLabel
+ %29 = OpAccessChain %_ptr_StorageBuffer_mat4v2float %out %uint_0
+ %30 = OpLoad %mat4v2float %m
+ OpStore %29 %30
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl.expected.wgsl
index 5ca6239..bf5897d 100644
--- a/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl.expected.wgsl
@@ -1 +1,8 @@
var<private> m = mat4x2<f32>(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f);
+
+@group(0) @binding(0) var<storage, read_write> out : mat4x2<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f16.wgsl b/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f16.wgsl
index fa13d77..5125f0c 100644
--- a/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f16.wgsl
@@ -3,3 +3,11 @@
vec2<f16>(2.0h, 3.0h),
vec2<f16>(4.0h, 5.0h),
vec2<f16>(6.0h, 7.0h));
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat4x2<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f16.wgsl.expected.dxc.hlsl
index d449a86..e45c042 100644
--- a/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f16.wgsl.expected.dxc.hlsl
@@ -1,6 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 4, 2> m = matrix<float16_t, 4, 2>(vector<float16_t, 2>(float16_t(0.0h), float16_t(1.0h)), vector<float16_t, 2>(float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 2>(float16_t(4.0h), float16_t(5.0h)), vector<float16_t, 2>(float16_t(6.0h), float16_t(7.0h)));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 4, 2> value) {
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 4u), value[1u]);
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 8u), value[2u]);
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 12u), value[3u]);
}
-static matrix<float16_t, 4, 2> m = matrix<float16_t, 4, 2>(vector<float16_t, 2>(float16_t(0.0h), float16_t(1.0h)), vector<float16_t, 2>(float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 2>(float16_t(4.0h), float16_t(5.0h)), vector<float16_t, 2>(float16_t(6.0h), float16_t(7.0h)));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f16.wgsl.expected.glsl
index f24340e..75d6df4 100644
--- a/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f16.wgsl.expected.glsl
@@ -1,8 +1,17 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
+f16mat4x2 m = f16mat4x2(f16vec2(0.0hf, 1.0hf), f16vec2(2.0hf, 3.0hf), f16vec2(4.0hf, 5.0hf), f16vec2(6.0hf, 7.0hf));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat4x2 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-f16mat4x2 m = f16mat4x2(f16vec2(0.0hf, 1.0hf), f16vec2(2.0hf, 3.0hf), f16vec2(4.0hf, 5.0hf), f16vec2(6.0hf, 7.0hf));
diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f16.wgsl.expected.msl
index d6410a1..1ca5ed5 100644
--- a/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f16.wgsl.expected.msl
@@ -5,3 +5,10 @@
half4x2 m;
};
+kernel void f(device half4x2* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half4x2(half2(0.0h, 1.0h), half2(2.0h, 3.0h), half2(4.0h, 5.0h), half2(6.0h, 7.0h));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f16.wgsl.expected.spvasm
index 282162b..8f1da5c 100644
--- a/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 23
+; Bound: 31
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,10 +9,19 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 4
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v2half = OpTypeVector %half 2
%mat4v2half = OpTypeMatrix %v2half 4
@@ -31,9 +40,18 @@
%16 = OpConstantComposite %mat4v2half %6 %9 %12 %15
%_ptr_Private_mat4v2half = OpTypePointer Private %mat4v2half
%m = OpVariable %_ptr_Private_mat4v2half Private %16
+ %out_block = OpTypeStruct %mat4v2half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %19 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %19
- %22 = OpLabel
+ %22 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat4v2half = OpTypePointer StorageBuffer %mat4v2half
+ %f = OpFunction %void None %22
+ %25 = OpLabel
+ %29 = OpAccessChain %_ptr_StorageBuffer_mat4v2half %out %uint_0
+ %30 = OpLoad %mat4v2half %m
+ OpStore %29 %30
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f16.wgsl.expected.wgsl
index e97eb29..3844336 100644
--- a/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f16.wgsl.expected.wgsl
@@ -1,3 +1,10 @@
enable f16;
var<private> m = mat4x2<f16>(vec2<f16>(0.0h, 1.0h), vec2<f16>(2.0h, 3.0h), vec2<f16>(4.0h, 5.0h), vec2<f16>(6.0h, 7.0h));
+
+@group(0) @binding(0) var<storage, read_write> out : mat4x2<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl b/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl
index 74227f4..cbe8a8b 100644
--- a/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl
@@ -2,3 +2,11 @@
vec2<f32>(2.0f, 3.0f),
vec2<f32>(4.0f, 5.0f),
vec2<f32>(6.0f, 7.0f));
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat4x2<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.dxc.hlsl
index e97d279..d7372ac 100644
--- a/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.dxc.hlsl
@@ -1,6 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float4x2 m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
+ tint_symbol.Store2((offset + 16u), asuint(value[2u]));
+ tint_symbol.Store2((offset + 24u), asuint(value[3u]));
}
-static float4x2 m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.fxc.hlsl
index e97d279..d7372ac 100644
--- a/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.fxc.hlsl
@@ -1,6 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float4x2 m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
+ tint_symbol.Store2((offset + 16u), asuint(value[2u]));
+ tint_symbol.Store2((offset + 24u), asuint(value[3u]));
}
-static float4x2 m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.glsl
index 2fbbb7e..989aad8 100644
--- a/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.glsl
@@ -1,7 +1,16 @@
#version 310 es
+mat4x2 m = mat4x2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f), vec2(4.0f, 5.0f), vec2(6.0f, 7.0f));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat4x2 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat4x2 m = mat4x2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f), vec2(4.0f, 5.0f), vec2(6.0f, 7.0f));
diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.msl
index 3553bff..0cb5c08 100644
--- a/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.msl
@@ -5,3 +5,10 @@
float4x2 m;
};
+kernel void f(device float4x2* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.spvasm
index fd79610..dd094ad 100644
--- a/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.spvasm
@@ -1,14 +1,23 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 23
+; Bound: 31
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%mat4v2float = OpTypeMatrix %v2float 4
@@ -27,9 +36,18 @@
%16 = OpConstantComposite %mat4v2float %6 %9 %12 %15
%_ptr_Private_mat4v2float = OpTypePointer Private %mat4v2float
%m = OpVariable %_ptr_Private_mat4v2float Private %16
+ %out_block = OpTypeStruct %mat4v2float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %19 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %19
- %22 = OpLabel
+ %22 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat4v2float = OpTypePointer StorageBuffer %mat4v2float
+ %f = OpFunction %void None %22
+ %25 = OpLabel
+ %29 = OpAccessChain %_ptr_StorageBuffer_mat4v2float %out %uint_0
+ %30 = OpLoad %mat4v2float %m
+ OpStore %29 %30
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.wgsl
index a425e47..b0161c7 100644
--- a/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.wgsl
@@ -1 +1,8 @@
var<private> m = mat4x2<f32>(vec2<f32>(0.0f, 1.0f), vec2<f32>(2.0f, 3.0f), vec2<f32>(4.0f, 5.0f), vec2<f32>(6.0f, 7.0f));
+
+@group(0) @binding(0) var<storage, read_write> out : mat4x2<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f16.wgsl b/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f16.wgsl
index c3f66f1..d31161e 100644
--- a/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f16.wgsl
@@ -4,7 +4,10 @@
4.0h, 5.0h,
6.0h, 7.0h));
-fn f() -> mat4x2<f16> {
- let m_1 = mat4x2(m);
- return m_1;
+@group(0) @binding(0)
+var<storage, read_write> out : mat4x2<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat4x2(m);
}
diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f16.wgsl.expected.dxc.hlsl
index be358f3..29d3615 100644
--- a/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f16.wgsl.expected.dxc.hlsl
@@ -1,11 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 4, 2> m = matrix<float16_t, 4, 2>(vector<float16_t, 2>(float16_t(0.0h), float16_t(1.0h)), vector<float16_t, 2>(float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 2>(float16_t(4.0h), float16_t(5.0h)), vector<float16_t, 2>(float16_t(6.0h), float16_t(7.0h)));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 4, 2> value) {
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 4u), value[1u]);
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 8u), value[2u]);
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 12u), value[3u]);
}
-static matrix<float16_t, 4, 2> m = matrix<float16_t, 4, 2>(vector<float16_t, 2>(float16_t(0.0h), float16_t(1.0h)), vector<float16_t, 2>(float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 2>(float16_t(4.0h), float16_t(5.0h)), vector<float16_t, 2>(float16_t(6.0h), float16_t(7.0h)));
-
-matrix<float16_t, 4, 2> f() {
- const matrix<float16_t, 4, 2> m_1 = matrix<float16_t, 4, 2>(m);
- return m_1;
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, matrix<float16_t, 4, 2>(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f16.wgsl.expected.glsl
index 572fcd0..0e3bda1 100644
--- a/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f16.wgsl.expected.glsl
@@ -1,13 +1,17 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
- return;
-}
f16mat4x2 m = f16mat4x2(f16vec2(0.0hf, 1.0hf), f16vec2(2.0hf, 3.0hf), f16vec2(4.0hf, 5.0hf), f16vec2(6.0hf, 7.0hf));
-f16mat4x2 f() {
- f16mat4x2 m_1 = f16mat4x2(m);
- return m_1;
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat4x2 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = f16mat4x2(m);
}
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ f();
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f16.wgsl.expected.msl
index 20d0ed7..74499e8 100644
--- a/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f16.wgsl.expected.msl
@@ -5,8 +5,10 @@
half4x2 m;
};
-half4x2 f(thread tint_private_vars_struct* const tint_private_vars) {
- half4x2 const m_1 = half4x2((*(tint_private_vars)).m);
- return m_1;
+kernel void f(device half4x2* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half4x2(half2(0.0h, 1.0h), half2(2.0h, 3.0h), half2(4.0h, 5.0h), half2(6.0h, 7.0h));
+ *(tint_symbol) = half4x2(tint_private_vars.m);
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f16.wgsl.expected.spvasm
index 6bbc56e..b5e0963 100644
--- a/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 28
+; Bound: 32
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,11 +9,19 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 4
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v2half = OpTypeVector %half 2
%mat4v2half = OpTypeMatrix %v2half 4
@@ -32,15 +40,18 @@
%16 = OpConstantComposite %mat4v2half %6 %9 %12 %15
%_ptr_Private_mat4v2half = OpTypePointer Private %mat4v2half
%m = OpVariable %_ptr_Private_mat4v2half Private %16
+ %out_block = OpTypeStruct %mat4v2half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %19 = OpTypeFunction %void
- %23 = OpTypeFunction %mat4v2half
-%unused_entry_point = OpFunction %void None %19
- %22 = OpLabel
- OpReturn
- OpFunctionEnd
- %f = OpFunction %mat4v2half None %23
+ %22 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat4v2half = OpTypePointer StorageBuffer %mat4v2half
+ %f = OpFunction %void None %22
%25 = OpLabel
- %27 = OpLoad %mat4v2half %m
- OpReturnValue %27
+ %29 = OpAccessChain %_ptr_StorageBuffer_mat4v2half %out %uint_0
+ %31 = OpLoad %mat4v2half %m
+ OpStore %29 %31
+ OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f16.wgsl.expected.wgsl
index ef56f0c..a1c886d 100644
--- a/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f16.wgsl.expected.wgsl
@@ -2,7 +2,9 @@
var<private> m = mat4x2(mat4x2(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h));
-fn f() -> mat4x2<f16> {
- let m_1 = mat4x2(m);
- return m_1;
+@group(0) @binding(0) var<storage, read_write> out : mat4x2<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat4x2(m);
}
diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f32.wgsl b/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f32.wgsl
index 70ea4df..9da3aaa 100644
--- a/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f32.wgsl
@@ -3,7 +3,10 @@
4.0f, 5.0f,
6.0f, 7.0f));
-fn f() -> mat4x2<f32> {
- let m_1 = mat4x2(m);
- return m_1;
+@group(0) @binding(0)
+var<storage, read_write> out : mat4x2<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat4x2(m);
}
diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f32.wgsl.expected.dxc.hlsl
index b957caa..3249fa9 100644
--- a/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f32.wgsl.expected.dxc.hlsl
@@ -1,11 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float4x2 m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
+ tint_symbol.Store2((offset + 16u), asuint(value[2u]));
+ tint_symbol.Store2((offset + 24u), asuint(value[3u]));
}
-static float4x2 m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f));
-
-float4x2 f() {
- const float4x2 m_1 = float4x2(m);
- return m_1;
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float4x2(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f32.wgsl.expected.fxc.hlsl
index b957caa..3249fa9 100644
--- a/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f32.wgsl.expected.fxc.hlsl
@@ -1,11 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float4x2 m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
+ tint_symbol.Store2((offset + 16u), asuint(value[2u]));
+ tint_symbol.Store2((offset + 24u), asuint(value[3u]));
}
-static float4x2 m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f));
-
-float4x2 f() {
- const float4x2 m_1 = float4x2(m);
- return m_1;
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float4x2(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f32.wgsl.expected.glsl
index e5a475d..473de8d 100644
--- a/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f32.wgsl.expected.glsl
@@ -1,12 +1,16 @@
#version 310 es
-layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
- return;
-}
mat4x2 m = mat4x2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f), vec2(4.0f, 5.0f), vec2(6.0f, 7.0f));
-mat4x2 f() {
- mat4x2 m_1 = mat4x2(m);
- return m_1;
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat4x2 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = mat4x2(m);
}
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ f();
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f32.wgsl.expected.msl
index c229c26..fbda45f 100644
--- a/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f32.wgsl.expected.msl
@@ -5,8 +5,10 @@
float4x2 m;
};
-float4x2 f(thread tint_private_vars_struct* const tint_private_vars) {
- float4x2 const m_1 = float4x2((*(tint_private_vars)).m);
- return m_1;
+kernel void f(device float4x2* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f));
+ *(tint_symbol) = float4x2(tint_private_vars.m);
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f32.wgsl.expected.spvasm
index f40139e..f680c00 100644
--- a/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f32.wgsl.expected.spvasm
@@ -1,15 +1,23 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 28
+; Bound: 32
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%mat4v2float = OpTypeMatrix %v2float 4
@@ -28,15 +36,18 @@
%16 = OpConstantComposite %mat4v2float %6 %9 %12 %15
%_ptr_Private_mat4v2float = OpTypePointer Private %mat4v2float
%m = OpVariable %_ptr_Private_mat4v2float Private %16
+ %out_block = OpTypeStruct %mat4v2float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %19 = OpTypeFunction %void
- %23 = OpTypeFunction %mat4v2float
-%unused_entry_point = OpFunction %void None %19
- %22 = OpLabel
- OpReturn
- OpFunctionEnd
- %f = OpFunction %mat4v2float None %23
+ %22 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat4v2float = OpTypePointer StorageBuffer %mat4v2float
+ %f = OpFunction %void None %22
%25 = OpLabel
- %27 = OpLoad %mat4v2float %m
- OpReturnValue %27
+ %29 = OpAccessChain %_ptr_StorageBuffer_mat4v2float %out %uint_0
+ %31 = OpLoad %mat4v2float %m
+ OpStore %29 %31
+ OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f32.wgsl.expected.wgsl
index 11bedce..8865ba2 100644
--- a/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f32.wgsl.expected.wgsl
@@ -1,6 +1,8 @@
var<private> m = mat4x2(mat4x2(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f));
-fn f() -> mat4x2<f32> {
- let m_1 = mat4x2(m);
- return m_1;
+@group(0) @binding(0) var<storage, read_write> out : mat4x2<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat4x2(m);
}
diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/abstract-float.wgsl b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/abstract-float.wgsl
index 61644c1..df9250a 100644
--- a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/abstract-float.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/abstract-float.wgsl
@@ -1,4 +1,12 @@
-var<private> m = mat4x2(0.0, 1.0,
- 2.0, 3.0,
- 4.0, 5.0,
- 6.0, 7.0);
+const m = mat4x2(0.0, 1.0,
+ 2.0, 3.0,
+ 4.0, 5.0,
+ 6.0, 7.0);
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat4x2<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl
index e97d279..83146c1 100644
--- a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
+ tint_symbol.Store2((offset + 16u), asuint(value[2u]));
+ tint_symbol.Store2((offset + 24u), asuint(value[3u]));
}
-static float4x2 m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f)));
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl
index e97d279..83146c1 100644
--- a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
+ tint_symbol.Store2((offset + 16u), asuint(value[2u]));
+ tint_symbol.Store2((offset + 24u), asuint(value[3u]));
}
-static float4x2 m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f)));
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/abstract-float.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/abstract-float.wgsl.expected.glsl
index 2fbbb7e..7a70a62 100644
--- a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/abstract-float.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/abstract-float.wgsl.expected.glsl
@@ -1,7 +1,15 @@
#version 310 es
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat4x2 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = mat4x2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f), vec2(4.0f, 5.0f), vec2(6.0f, 7.0f));
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat4x2 m = mat4x2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f), vec2(4.0f, 5.0f), vec2(6.0f, 7.0f));
diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/abstract-float.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/abstract-float.wgsl.expected.msl
index 3553bff..e148a5f 100644
--- a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/abstract-float.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/abstract-float.wgsl.expected.msl
@@ -1,7 +1,8 @@
#include <metal_stdlib>
using namespace metal;
-struct tint_private_vars_struct {
- float4x2 m;
-};
+kernel void f(device float4x2* tint_symbol [[buffer(0)]]) {
+ *(tint_symbol) = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f));
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/abstract-float.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/abstract-float.wgsl.expected.spvasm
index fd79610..57265b4 100644
--- a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/abstract-float.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/abstract-float.wgsl.expected.spvasm
@@ -1,35 +1,49 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 23
+; Bound: 28
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
- OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%mat4v2float = OpTypeMatrix %v2float 4
- %4 = OpConstantNull %float
+ %out_block = OpTypeStruct %mat4v2float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat4v2float = OpTypePointer StorageBuffer %mat4v2float
+ %15 = OpConstantNull %float
%float_1 = OpConstant %float 1
- %6 = OpConstantComposite %v2float %4 %float_1
+ %17 = OpConstantComposite %v2float %15 %float_1
%float_2 = OpConstant %float 2
%float_3 = OpConstant %float 3
- %9 = OpConstantComposite %v2float %float_2 %float_3
+ %20 = OpConstantComposite %v2float %float_2 %float_3
%float_4 = OpConstant %float 4
%float_5 = OpConstant %float 5
- %12 = OpConstantComposite %v2float %float_4 %float_5
+ %23 = OpConstantComposite %v2float %float_4 %float_5
%float_6 = OpConstant %float 6
%float_7 = OpConstant %float 7
- %15 = OpConstantComposite %v2float %float_6 %float_7
- %16 = OpConstantComposite %mat4v2float %6 %9 %12 %15
-%_ptr_Private_mat4v2float = OpTypePointer Private %mat4v2float
- %m = OpVariable %_ptr_Private_mat4v2float Private %16
- %void = OpTypeVoid
- %19 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %19
- %22 = OpLabel
+ %26 = OpConstantComposite %v2float %float_6 %float_7
+ %27 = OpConstantComposite %mat4v2float %17 %20 %23 %26
+ %f = OpFunction %void None %7
+ %10 = OpLabel
+ %14 = OpAccessChain %_ptr_StorageBuffer_mat4v2float %out %uint_0
+ OpStore %14 %27
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/abstract-float.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/abstract-float.wgsl.expected.wgsl
index 3f21792..29c65fa 100644
--- a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/abstract-float.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/abstract-float.wgsl.expected.wgsl
@@ -1 +1,8 @@
-var<private> m = mat4x2(0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0);
+const m = mat4x2(0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0);
+
+@group(0) @binding(0) var<storage, read_write> out : mat4x2<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f16.wgsl b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f16.wgsl
index 18d3a88..6ef782a 100644
--- a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f16.wgsl
@@ -3,3 +3,11 @@
2.0h, 3.0h,
4.0h, 5.0h,
6.0h, 7.0h);
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat4x2<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f16.wgsl.expected.dxc.hlsl
index d449a86..e45c042 100644
--- a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f16.wgsl.expected.dxc.hlsl
@@ -1,6 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 4, 2> m = matrix<float16_t, 4, 2>(vector<float16_t, 2>(float16_t(0.0h), float16_t(1.0h)), vector<float16_t, 2>(float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 2>(float16_t(4.0h), float16_t(5.0h)), vector<float16_t, 2>(float16_t(6.0h), float16_t(7.0h)));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 4, 2> value) {
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 4u), value[1u]);
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 8u), value[2u]);
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 12u), value[3u]);
}
-static matrix<float16_t, 4, 2> m = matrix<float16_t, 4, 2>(vector<float16_t, 2>(float16_t(0.0h), float16_t(1.0h)), vector<float16_t, 2>(float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 2>(float16_t(4.0h), float16_t(5.0h)), vector<float16_t, 2>(float16_t(6.0h), float16_t(7.0h)));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f16.wgsl.expected.glsl
index f24340e..75d6df4 100644
--- a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f16.wgsl.expected.glsl
@@ -1,8 +1,17 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
+f16mat4x2 m = f16mat4x2(f16vec2(0.0hf, 1.0hf), f16vec2(2.0hf, 3.0hf), f16vec2(4.0hf, 5.0hf), f16vec2(6.0hf, 7.0hf));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat4x2 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-f16mat4x2 m = f16mat4x2(f16vec2(0.0hf, 1.0hf), f16vec2(2.0hf, 3.0hf), f16vec2(4.0hf, 5.0hf), f16vec2(6.0hf, 7.0hf));
diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f16.wgsl.expected.msl
index d6410a1..1ca5ed5 100644
--- a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f16.wgsl.expected.msl
@@ -5,3 +5,10 @@
half4x2 m;
};
+kernel void f(device half4x2* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half4x2(half2(0.0h, 1.0h), half2(2.0h, 3.0h), half2(4.0h, 5.0h), half2(6.0h, 7.0h));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f16.wgsl.expected.spvasm
index 282162b..8f1da5c 100644
--- a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 23
+; Bound: 31
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,10 +9,19 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 4
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v2half = OpTypeVector %half 2
%mat4v2half = OpTypeMatrix %v2half 4
@@ -31,9 +40,18 @@
%16 = OpConstantComposite %mat4v2half %6 %9 %12 %15
%_ptr_Private_mat4v2half = OpTypePointer Private %mat4v2half
%m = OpVariable %_ptr_Private_mat4v2half Private %16
+ %out_block = OpTypeStruct %mat4v2half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %19 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %19
- %22 = OpLabel
+ %22 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat4v2half = OpTypePointer StorageBuffer %mat4v2half
+ %f = OpFunction %void None %22
+ %25 = OpLabel
+ %29 = OpAccessChain %_ptr_StorageBuffer_mat4v2half %out %uint_0
+ %30 = OpLoad %mat4v2half %m
+ OpStore %29 %30
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f16.wgsl.expected.wgsl
index 3e79133..71de233 100644
--- a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f16.wgsl.expected.wgsl
@@ -1,3 +1,10 @@
enable f16;
var<private> m = mat4x2(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h);
+
+@group(0) @binding(0) var<storage, read_write> out : mat4x2<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl
index f4ad0c1..5fd5d1a 100644
--- a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl
@@ -2,3 +2,11 @@
2.0f, 3.0f,
4.0f, 5.0f,
6.0f, 7.0f);
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat4x2<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl.expected.dxc.hlsl
index e97d279..d7372ac 100644
--- a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl.expected.dxc.hlsl
@@ -1,6 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float4x2 m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
+ tint_symbol.Store2((offset + 16u), asuint(value[2u]));
+ tint_symbol.Store2((offset + 24u), asuint(value[3u]));
}
-static float4x2 m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl.expected.fxc.hlsl
index e97d279..d7372ac 100644
--- a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl.expected.fxc.hlsl
@@ -1,6 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float4x2 m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
+ tint_symbol.Store2((offset + 16u), asuint(value[2u]));
+ tint_symbol.Store2((offset + 24u), asuint(value[3u]));
}
-static float4x2 m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl.expected.glsl
index 2fbbb7e..989aad8 100644
--- a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl.expected.glsl
@@ -1,7 +1,16 @@
#version 310 es
+mat4x2 m = mat4x2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f), vec2(4.0f, 5.0f), vec2(6.0f, 7.0f));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat4x2 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat4x2 m = mat4x2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f), vec2(4.0f, 5.0f), vec2(6.0f, 7.0f));
diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl.expected.msl
index 3553bff..0cb5c08 100644
--- a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl.expected.msl
@@ -5,3 +5,10 @@
float4x2 m;
};
+kernel void f(device float4x2* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl.expected.spvasm
index fd79610..dd094ad 100644
--- a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl.expected.spvasm
@@ -1,14 +1,23 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 23
+; Bound: 31
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%mat4v2float = OpTypeMatrix %v2float 4
@@ -27,9 +36,18 @@
%16 = OpConstantComposite %mat4v2float %6 %9 %12 %15
%_ptr_Private_mat4v2float = OpTypePointer Private %mat4v2float
%m = OpVariable %_ptr_Private_mat4v2float Private %16
+ %out_block = OpTypeStruct %mat4v2float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %19 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %19
- %22 = OpLabel
+ %22 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat4v2float = OpTypePointer StorageBuffer %mat4v2float
+ %f = OpFunction %void None %22
+ %25 = OpLabel
+ %29 = OpAccessChain %_ptr_StorageBuffer_mat4v2float %out %uint_0
+ %30 = OpLoad %mat4v2float %m
+ OpStore %29 %30
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl.expected.wgsl
index 94293b0..5752ad0 100644
--- a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl.expected.wgsl
@@ -1 +1,8 @@
var<private> m = mat4x2(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f);
+
+@group(0) @binding(0) var<storage, read_write> out : mat4x2<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/abstract-float.wgsl b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/abstract-float.wgsl
index 8d088c5..8f0849b 100644
--- a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/abstract-float.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/abstract-float.wgsl
@@ -1,4 +1,12 @@
-var<private> m = mat4x2(vec2(0.0, 1.0),
- vec2(2.0, 3.0),
- vec2(4.0, 5.0),
- vec2(6.0, 7.0));
+const m = mat4x2(vec2(0.0, 1.0),
+ vec2(2.0, 3.0),
+ vec2(4.0, 5.0),
+ vec2(6.0, 7.0));
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat4x2<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl
index e97d279..83146c1 100644
--- a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
+ tint_symbol.Store2((offset + 16u), asuint(value[2u]));
+ tint_symbol.Store2((offset + 24u), asuint(value[3u]));
}
-static float4x2 m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f)));
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl
index e97d279..83146c1 100644
--- a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
+ tint_symbol.Store2((offset + 16u), asuint(value[2u]));
+ tint_symbol.Store2((offset + 24u), asuint(value[3u]));
}
-static float4x2 m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f)));
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/abstract-float.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/abstract-float.wgsl.expected.glsl
index 2fbbb7e..7a70a62 100644
--- a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/abstract-float.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/abstract-float.wgsl.expected.glsl
@@ -1,7 +1,15 @@
#version 310 es
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat4x2 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = mat4x2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f), vec2(4.0f, 5.0f), vec2(6.0f, 7.0f));
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat4x2 m = mat4x2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f), vec2(4.0f, 5.0f), vec2(6.0f, 7.0f));
diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/abstract-float.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/abstract-float.wgsl.expected.msl
index 3553bff..e148a5f 100644
--- a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/abstract-float.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/abstract-float.wgsl.expected.msl
@@ -1,7 +1,8 @@
#include <metal_stdlib>
using namespace metal;
-struct tint_private_vars_struct {
- float4x2 m;
-};
+kernel void f(device float4x2* tint_symbol [[buffer(0)]]) {
+ *(tint_symbol) = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f));
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/abstract-float.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/abstract-float.wgsl.expected.spvasm
index fd79610..57265b4 100644
--- a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/abstract-float.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/abstract-float.wgsl.expected.spvasm
@@ -1,35 +1,49 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 23
+; Bound: 28
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
- OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%mat4v2float = OpTypeMatrix %v2float 4
- %4 = OpConstantNull %float
+ %out_block = OpTypeStruct %mat4v2float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat4v2float = OpTypePointer StorageBuffer %mat4v2float
+ %15 = OpConstantNull %float
%float_1 = OpConstant %float 1
- %6 = OpConstantComposite %v2float %4 %float_1
+ %17 = OpConstantComposite %v2float %15 %float_1
%float_2 = OpConstant %float 2
%float_3 = OpConstant %float 3
- %9 = OpConstantComposite %v2float %float_2 %float_3
+ %20 = OpConstantComposite %v2float %float_2 %float_3
%float_4 = OpConstant %float 4
%float_5 = OpConstant %float 5
- %12 = OpConstantComposite %v2float %float_4 %float_5
+ %23 = OpConstantComposite %v2float %float_4 %float_5
%float_6 = OpConstant %float 6
%float_7 = OpConstant %float 7
- %15 = OpConstantComposite %v2float %float_6 %float_7
- %16 = OpConstantComposite %mat4v2float %6 %9 %12 %15
-%_ptr_Private_mat4v2float = OpTypePointer Private %mat4v2float
- %m = OpVariable %_ptr_Private_mat4v2float Private %16
- %void = OpTypeVoid
- %19 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %19
- %22 = OpLabel
+ %26 = OpConstantComposite %v2float %float_6 %float_7
+ %27 = OpConstantComposite %mat4v2float %17 %20 %23 %26
+ %f = OpFunction %void None %7
+ %10 = OpLabel
+ %14 = OpAccessChain %_ptr_StorageBuffer_mat4v2float %out %uint_0
+ OpStore %14 %27
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/abstract-float.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/abstract-float.wgsl.expected.wgsl
index 571207b..5131593 100644
--- a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/abstract-float.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/abstract-float.wgsl.expected.wgsl
@@ -1 +1,8 @@
-var<private> m = mat4x2(vec2(0.0, 1.0), vec2(2.0, 3.0), vec2(4.0, 5.0), vec2(6.0, 7.0));
+const m = mat4x2(vec2(0.0, 1.0), vec2(2.0, 3.0), vec2(4.0, 5.0), vec2(6.0, 7.0));
+
+@group(0) @binding(0) var<storage, read_write> out : mat4x2<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f16.wgsl b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f16.wgsl
index 3b0e788..00cced0 100644
--- a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f16.wgsl
@@ -3,3 +3,11 @@
vec2<f16>(2.0h, 3.0h),
vec2<f16>(4.0h, 5.0h),
vec2<f16>(6.0h, 7.0h));
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat4x2<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f16.wgsl.expected.dxc.hlsl
index d449a86..e45c042 100644
--- a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f16.wgsl.expected.dxc.hlsl
@@ -1,6 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 4, 2> m = matrix<float16_t, 4, 2>(vector<float16_t, 2>(float16_t(0.0h), float16_t(1.0h)), vector<float16_t, 2>(float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 2>(float16_t(4.0h), float16_t(5.0h)), vector<float16_t, 2>(float16_t(6.0h), float16_t(7.0h)));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 4, 2> value) {
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 4u), value[1u]);
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 8u), value[2u]);
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 12u), value[3u]);
}
-static matrix<float16_t, 4, 2> m = matrix<float16_t, 4, 2>(vector<float16_t, 2>(float16_t(0.0h), float16_t(1.0h)), vector<float16_t, 2>(float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 2>(float16_t(4.0h), float16_t(5.0h)), vector<float16_t, 2>(float16_t(6.0h), float16_t(7.0h)));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f16.wgsl.expected.glsl
index f24340e..75d6df4 100644
--- a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f16.wgsl.expected.glsl
@@ -1,8 +1,17 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
+f16mat4x2 m = f16mat4x2(f16vec2(0.0hf, 1.0hf), f16vec2(2.0hf, 3.0hf), f16vec2(4.0hf, 5.0hf), f16vec2(6.0hf, 7.0hf));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat4x2 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-f16mat4x2 m = f16mat4x2(f16vec2(0.0hf, 1.0hf), f16vec2(2.0hf, 3.0hf), f16vec2(4.0hf, 5.0hf), f16vec2(6.0hf, 7.0hf));
diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f16.wgsl.expected.msl
index d6410a1..1ca5ed5 100644
--- a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f16.wgsl.expected.msl
@@ -5,3 +5,10 @@
half4x2 m;
};
+kernel void f(device half4x2* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half4x2(half2(0.0h, 1.0h), half2(2.0h, 3.0h), half2(4.0h, 5.0h), half2(6.0h, 7.0h));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f16.wgsl.expected.spvasm
index 282162b..8f1da5c 100644
--- a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 23
+; Bound: 31
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,10 +9,19 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 4
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v2half = OpTypeVector %half 2
%mat4v2half = OpTypeMatrix %v2half 4
@@ -31,9 +40,18 @@
%16 = OpConstantComposite %mat4v2half %6 %9 %12 %15
%_ptr_Private_mat4v2half = OpTypePointer Private %mat4v2half
%m = OpVariable %_ptr_Private_mat4v2half Private %16
+ %out_block = OpTypeStruct %mat4v2half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %19 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %19
- %22 = OpLabel
+ %22 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat4v2half = OpTypePointer StorageBuffer %mat4v2half
+ %f = OpFunction %void None %22
+ %25 = OpLabel
+ %29 = OpAccessChain %_ptr_StorageBuffer_mat4v2half %out %uint_0
+ %30 = OpLoad %mat4v2half %m
+ OpStore %29 %30
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f16.wgsl.expected.wgsl
index c08c7239..236cb58 100644
--- a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f16.wgsl.expected.wgsl
@@ -1,3 +1,10 @@
enable f16;
var<private> m = mat4x2(vec2<f16>(0.0h, 1.0h), vec2<f16>(2.0h, 3.0h), vec2<f16>(4.0h, 5.0h), vec2<f16>(6.0h, 7.0h));
+
+@group(0) @binding(0) var<storage, read_write> out : mat4x2<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl
index 8da6415..3568403 100644
--- a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl
@@ -2,3 +2,11 @@
vec2<f32>(2.0f, 3.0f),
vec2<f32>(4.0f, 5.0f),
vec2<f32>(6.0f, 7.0f));
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat4x2<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl.expected.dxc.hlsl
index e97d279..d7372ac 100644
--- a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl.expected.dxc.hlsl
@@ -1,6 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float4x2 m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
+ tint_symbol.Store2((offset + 16u), asuint(value[2u]));
+ tint_symbol.Store2((offset + 24u), asuint(value[3u]));
}
-static float4x2 m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl.expected.fxc.hlsl
index e97d279..d7372ac 100644
--- a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl.expected.fxc.hlsl
@@ -1,6 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float4x2 m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
+ tint_symbol.Store2((offset + 16u), asuint(value[2u]));
+ tint_symbol.Store2((offset + 24u), asuint(value[3u]));
}
-static float4x2 m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl.expected.glsl
index 2fbbb7e..989aad8 100644
--- a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl.expected.glsl
@@ -1,7 +1,16 @@
#version 310 es
+mat4x2 m = mat4x2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f), vec2(4.0f, 5.0f), vec2(6.0f, 7.0f));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat4x2 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat4x2 m = mat4x2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f), vec2(4.0f, 5.0f), vec2(6.0f, 7.0f));
diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl.expected.msl
index 3553bff..0cb5c08 100644
--- a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl.expected.msl
@@ -5,3 +5,10 @@
float4x2 m;
};
+kernel void f(device float4x2* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl.expected.spvasm
index fd79610..dd094ad 100644
--- a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl.expected.spvasm
@@ -1,14 +1,23 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 23
+; Bound: 31
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%mat4v2float = OpTypeMatrix %v2float 4
@@ -27,9 +36,18 @@
%16 = OpConstantComposite %mat4v2float %6 %9 %12 %15
%_ptr_Private_mat4v2float = OpTypePointer Private %mat4v2float
%m = OpVariable %_ptr_Private_mat4v2float Private %16
+ %out_block = OpTypeStruct %mat4v2float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %19 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %19
- %22 = OpLabel
+ %22 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat4v2float = OpTypePointer StorageBuffer %mat4v2float
+ %f = OpFunction %void None %22
+ %25 = OpLabel
+ %29 = OpAccessChain %_ptr_StorageBuffer_mat4v2float %out %uint_0
+ %30 = OpLoad %mat4v2float %m
+ OpStore %29 %30
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl.expected.wgsl
index e024293..c5f43bf 100644
--- a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl.expected.wgsl
@@ -1 +1,8 @@
var<private> m = mat4x2(vec2<f32>(0.0f, 1.0f), vec2<f32>(2.0f, 3.0f), vec2<f32>(4.0f, 5.0f), vec2<f32>(6.0f, 7.0f));
+
+@group(0) @binding(0) var<storage, read_write> out : mat4x2<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x2/load/f16.wgsl b/test/tint/expressions/type_ctor/mat4x2/load/f16.wgsl
index d9c0b36..750f649 100644
--- a/test/tint/expressions/type_ctor/mat4x2/load/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x2/load/f16.wgsl
@@ -1,5 +1,10 @@
enable f16;
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat4x2<f16>;
+
+@compute @workgroup_size(1)
fn f() {
- var m = mat4x2<f16>();
- let m_1 = mat4x2(m);
+ var m = mat4x2<f16>();
+ out = mat4x2(m);
}
diff --git a/test/tint/expressions/type_ctor/mat4x2/load/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/load/f16.wgsl.expected.dxc.hlsl
index db3e6a7..79815a89 100644
--- a/test/tint/expressions/type_ctor/mat4x2/load/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x2/load/f16.wgsl.expected.dxc.hlsl
@@ -1,9 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 4, 2> value) {
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 4u), value[1u]);
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 8u), value[2u]);
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 12u), value[3u]);
}
+[numthreads(1, 1, 1)]
void f() {
matrix<float16_t, 4, 2> m = matrix<float16_t, 4, 2>((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx);
- const matrix<float16_t, 4, 2> m_1 = matrix<float16_t, 4, 2>(m);
+ tint_symbol_store(0u, matrix<float16_t, 4, 2>(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat4x2/load/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x2/load/f16.wgsl.expected.glsl
index e75435c..3aa3bfb 100644
--- a/test/tint/expressions/type_ctor/mat4x2/load/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat4x2/load/f16.wgsl.expected.glsl
@@ -1,12 +1,17 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
- return;
-}
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat4x2 inner;
+} tint_symbol;
+
void f() {
f16mat4x2 m = f16mat4x2(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf));
- f16mat4x2 m_1 = f16mat4x2(m);
+ tint_symbol.inner = f16mat4x2(m);
}
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ f();
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x2/load/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x2/load/f16.wgsl.expected.msl
index e3c6532..4d9dff0 100644
--- a/test/tint/expressions/type_ctor/mat4x2/load/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat4x2/load/f16.wgsl.expected.msl
@@ -1,8 +1,9 @@
#include <metal_stdlib>
using namespace metal;
-void f() {
+kernel void f(device half4x2* tint_symbol [[buffer(0)]]) {
half4x2 m = half4x2(half2(0.0h), half2(0.0h), half2(0.0h), half2(0.0h));
- half4x2 const m_1 = half4x2(m);
+ *(tint_symbol) = half4x2(m);
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat4x2/load/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x2/load/f16.wgsl.expected.spvasm
index 37c3f3b..fef1f5f 100644
--- a/test/tint/expressions/type_ctor/mat4x2/load/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat4x2/load/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 15
+; Bound: 20
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,26 +9,38 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
- OpName %unused_entry_point "unused_entry_point"
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
OpName %f "f"
OpName %m "m"
- %void = OpTypeVoid
- %1 = OpTypeFunction %void
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 4
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v2half = OpTypeVector %half 2
%mat4v2half = OpTypeMatrix %v2half 4
- %10 = OpConstantNull %mat4v2half
+ %out_block = OpTypeStruct %mat4v2half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void
+ %11 = OpConstantNull %mat4v2half
%_ptr_Function_mat4v2half = OpTypePointer Function %mat4v2half
-%unused_entry_point = OpFunction %void None %1
- %4 = OpLabel
- OpReturn
- OpFunctionEnd
- %f = OpFunction %void None %1
- %6 = OpLabel
- %m = OpVariable %_ptr_Function_mat4v2half Function %10
- OpStore %m %10
- %14 = OpLoad %mat4v2half %m
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat4v2half = OpTypePointer StorageBuffer %mat4v2half
+ %f = OpFunction %void None %7
+ %10 = OpLabel
+ %m = OpVariable %_ptr_Function_mat4v2half Function %11
+ OpStore %m %11
+ %17 = OpAccessChain %_ptr_StorageBuffer_mat4v2half %out %uint_0
+ %19 = OpLoad %mat4v2half %m
+ OpStore %17 %19
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat4x2/load/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x2/load/f16.wgsl.expected.wgsl
index 13a9671..bc18922 100644
--- a/test/tint/expressions/type_ctor/mat4x2/load/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x2/load/f16.wgsl.expected.wgsl
@@ -1,6 +1,9 @@
enable f16;
+@group(0) @binding(0) var<storage, read_write> out : mat4x2<f16>;
+
+@compute @workgroup_size(1)
fn f() {
var m = mat4x2<f16>();
- let m_1 = mat4x2(m);
+ out = mat4x2(m);
}
diff --git a/test/tint/expressions/type_ctor/mat4x2/load/f32.wgsl b/test/tint/expressions/type_ctor/mat4x2/load/f32.wgsl
index 9651287..6d18808 100644
--- a/test/tint/expressions/type_ctor/mat4x2/load/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x2/load/f32.wgsl
@@ -1,4 +1,8 @@
+@group(0) @binding(0)
+var<storage, read_write> out : mat4x2<f32>;
+
+@compute @workgroup_size(1)
fn f() {
- var m = mat4x2<f32>();
- let m_1 = mat4x2(m);
+ var m = mat4x2<f32>();
+ out = mat4x2(m);
}
diff --git a/test/tint/expressions/type_ctor/mat4x2/load/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/load/f32.wgsl.expected.dxc.hlsl
index 92ac9a0..092d7ad 100644
--- a/test/tint/expressions/type_ctor/mat4x2/load/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x2/load/f32.wgsl.expected.dxc.hlsl
@@ -1,9 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
+ tint_symbol.Store2((offset + 16u), asuint(value[2u]));
+ tint_symbol.Store2((offset + 24u), asuint(value[3u]));
}
+[numthreads(1, 1, 1)]
void f() {
float4x2 m = float4x2((0.0f).xx, (0.0f).xx, (0.0f).xx, (0.0f).xx);
- const float4x2 m_1 = float4x2(m);
+ tint_symbol_store(0u, float4x2(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat4x2/load/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/load/f32.wgsl.expected.fxc.hlsl
index 92ac9a0..092d7ad 100644
--- a/test/tint/expressions/type_ctor/mat4x2/load/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x2/load/f32.wgsl.expected.fxc.hlsl
@@ -1,9 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
+ tint_symbol.Store2((offset + 16u), asuint(value[2u]));
+ tint_symbol.Store2((offset + 24u), asuint(value[3u]));
}
+[numthreads(1, 1, 1)]
void f() {
float4x2 m = float4x2((0.0f).xx, (0.0f).xx, (0.0f).xx, (0.0f).xx);
- const float4x2 m_1 = float4x2(m);
+ tint_symbol_store(0u, float4x2(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat4x2/load/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x2/load/f32.wgsl.expected.glsl
index ae6ce5f..a943962 100644
--- a/test/tint/expressions/type_ctor/mat4x2/load/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat4x2/load/f32.wgsl.expected.glsl
@@ -1,11 +1,16 @@
#version 310 es
-layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
- return;
-}
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat4x2 inner;
+} tint_symbol;
+
void f() {
mat4x2 m = mat4x2(vec2(0.0f), vec2(0.0f), vec2(0.0f), vec2(0.0f));
- mat4x2 m_1 = mat4x2(m);
+ tint_symbol.inner = mat4x2(m);
}
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ f();
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x2/load/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x2/load/f32.wgsl.expected.msl
index 2f4e0c3..a721b6d 100644
--- a/test/tint/expressions/type_ctor/mat4x2/load/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat4x2/load/f32.wgsl.expected.msl
@@ -1,8 +1,9 @@
#include <metal_stdlib>
using namespace metal;
-void f() {
+kernel void f(device float4x2* tint_symbol [[buffer(0)]]) {
float4x2 m = float4x2(float2(0.0f), float2(0.0f), float2(0.0f), float2(0.0f));
- float4x2 const m_1 = float4x2(m);
+ *(tint_symbol) = float4x2(m);
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat4x2/load/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x2/load/f32.wgsl.expected.spvasm
index 66dbb32..e399817 100644
--- a/test/tint/expressions/type_ctor/mat4x2/load/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat4x2/load/f32.wgsl.expected.spvasm
@@ -1,30 +1,42 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 15
+; Bound: 20
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
- OpName %unused_entry_point "unused_entry_point"
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
OpName %f "f"
OpName %m "m"
- %void = OpTypeVoid
- %1 = OpTypeFunction %void
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%mat4v2float = OpTypeMatrix %v2float 4
- %10 = OpConstantNull %mat4v2float
+ %out_block = OpTypeStruct %mat4v2float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void
+ %11 = OpConstantNull %mat4v2float
%_ptr_Function_mat4v2float = OpTypePointer Function %mat4v2float
-%unused_entry_point = OpFunction %void None %1
- %4 = OpLabel
- OpReturn
- OpFunctionEnd
- %f = OpFunction %void None %1
- %6 = OpLabel
- %m = OpVariable %_ptr_Function_mat4v2float Function %10
- OpStore %m %10
- %14 = OpLoad %mat4v2float %m
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat4v2float = OpTypePointer StorageBuffer %mat4v2float
+ %f = OpFunction %void None %7
+ %10 = OpLabel
+ %m = OpVariable %_ptr_Function_mat4v2float Function %11
+ OpStore %m %11
+ %17 = OpAccessChain %_ptr_StorageBuffer_mat4v2float %out %uint_0
+ %19 = OpLoad %mat4v2float %m
+ OpStore %17 %19
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat4x2/load/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x2/load/f32.wgsl.expected.wgsl
index 8c94760..3dd1eb7 100644
--- a/test/tint/expressions/type_ctor/mat4x2/load/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x2/load/f32.wgsl.expected.wgsl
@@ -1,4 +1,7 @@
+@group(0) @binding(0) var<storage, read_write> out : mat4x2<f32>;
+
+@compute @workgroup_size(1)
fn f() {
var m = mat4x2<f32>();
- let m_1 = mat4x2(m);
+ out = mat4x2(m);
}
diff --git a/test/tint/expressions/type_ctor/mat4x2/zero/f16.wgsl b/test/tint/expressions/type_ctor/mat4x2/zero/f16.wgsl
index 924406a..583e162 100644
--- a/test/tint/expressions/type_ctor/mat4x2/zero/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x2/zero/f16.wgsl
@@ -1,2 +1,10 @@
enable f16;
var<private> m = mat4x2<f16>();
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat4x2<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x2/zero/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/zero/f16.wgsl.expected.dxc.hlsl
index 84cfdd5..7169167 100644
--- a/test/tint/expressions/type_ctor/mat4x2/zero/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x2/zero/f16.wgsl.expected.dxc.hlsl
@@ -1,6 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 4, 2> m = matrix<float16_t, 4, 2>((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx);
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 4, 2> value) {
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 4u), value[1u]);
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 8u), value[2u]);
+ tint_symbol.Store<vector<float16_t, 2> >((offset + 12u), value[3u]);
}
-static matrix<float16_t, 4, 2> m = matrix<float16_t, 4, 2>((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx);
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x2/zero/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x2/zero/f16.wgsl.expected.glsl
index 800e158..dceb8b4 100644
--- a/test/tint/expressions/type_ctor/mat4x2/zero/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat4x2/zero/f16.wgsl.expected.glsl
@@ -1,8 +1,17 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
+f16mat4x2 m = f16mat4x2(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat4x2 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-f16mat4x2 m = f16mat4x2(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf));
diff --git a/test/tint/expressions/type_ctor/mat4x2/zero/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x2/zero/f16.wgsl.expected.msl
index d6410a1..42057c1 100644
--- a/test/tint/expressions/type_ctor/mat4x2/zero/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat4x2/zero/f16.wgsl.expected.msl
@@ -5,3 +5,10 @@
half4x2 m;
};
+kernel void f(device half4x2* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half4x2(half2(0.0h), half2(0.0h), half2(0.0h), half2(0.0h));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat4x2/zero/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x2/zero/f16.wgsl.expected.spvasm
index 268ad7e..a7903da 100644
--- a/test/tint/expressions/type_ctor/mat4x2/zero/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat4x2/zero/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 11
+; Bound: 19
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,19 +9,37 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 4
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v2half = OpTypeVector %half 2
%mat4v2half = OpTypeMatrix %v2half 4
%4 = OpConstantNull %mat4v2half
%_ptr_Private_mat4v2half = OpTypePointer Private %mat4v2half
%m = OpVariable %_ptr_Private_mat4v2half Private %4
+ %out_block = OpTypeStruct %mat4v2half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %7 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %7
- %10 = OpLabel
+ %10 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat4v2half = OpTypePointer StorageBuffer %mat4v2half
+ %f = OpFunction %void None %10
+ %13 = OpLabel
+ %17 = OpAccessChain %_ptr_StorageBuffer_mat4v2half %out %uint_0
+ %18 = OpLoad %mat4v2half %m
+ OpStore %17 %18
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat4x2/zero/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x2/zero/f16.wgsl.expected.wgsl
index e0378a9..4be5d1c 100644
--- a/test/tint/expressions/type_ctor/mat4x2/zero/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x2/zero/f16.wgsl.expected.wgsl
@@ -1,3 +1,10 @@
enable f16;
var<private> m = mat4x2<f16>();
+
+@group(0) @binding(0) var<storage, read_write> out : mat4x2<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x2/zero/f32.wgsl b/test/tint/expressions/type_ctor/mat4x2/zero/f32.wgsl
index 4c85dff..1d538e3 100644
--- a/test/tint/expressions/type_ctor/mat4x2/zero/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x2/zero/f32.wgsl
@@ -1 +1,9 @@
var<private> m = mat4x2<f32>();
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat4x2<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x2/zero/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/zero/f32.wgsl.expected.dxc.hlsl
index f402a95..aad3082 100644
--- a/test/tint/expressions/type_ctor/mat4x2/zero/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x2/zero/f32.wgsl.expected.dxc.hlsl
@@ -1,6 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float4x2 m = float4x2((0.0f).xx, (0.0f).xx, (0.0f).xx, (0.0f).xx);
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
+ tint_symbol.Store2((offset + 16u), asuint(value[2u]));
+ tint_symbol.Store2((offset + 24u), asuint(value[3u]));
}
-static float4x2 m = float4x2((0.0f).xx, (0.0f).xx, (0.0f).xx, (0.0f).xx);
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x2/zero/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/zero/f32.wgsl.expected.fxc.hlsl
index f402a95..aad3082 100644
--- a/test/tint/expressions/type_ctor/mat4x2/zero/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x2/zero/f32.wgsl.expected.fxc.hlsl
@@ -1,6 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float4x2 m = float4x2((0.0f).xx, (0.0f).xx, (0.0f).xx, (0.0f).xx);
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x2 value) {
+ tint_symbol.Store2((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store2((offset + 8u), asuint(value[1u]));
+ tint_symbol.Store2((offset + 16u), asuint(value[2u]));
+ tint_symbol.Store2((offset + 24u), asuint(value[3u]));
}
-static float4x2 m = float4x2((0.0f).xx, (0.0f).xx, (0.0f).xx, (0.0f).xx);
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x2/zero/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x2/zero/f32.wgsl.expected.glsl
index 9e082c7..e649362 100644
--- a/test/tint/expressions/type_ctor/mat4x2/zero/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat4x2/zero/f32.wgsl.expected.glsl
@@ -1,7 +1,16 @@
#version 310 es
+mat4x2 m = mat4x2(vec2(0.0f), vec2(0.0f), vec2(0.0f), vec2(0.0f));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat4x2 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat4x2 m = mat4x2(vec2(0.0f), vec2(0.0f), vec2(0.0f), vec2(0.0f));
diff --git a/test/tint/expressions/type_ctor/mat4x2/zero/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x2/zero/f32.wgsl.expected.msl
index 3553bff..26fcb4c 100644
--- a/test/tint/expressions/type_ctor/mat4x2/zero/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat4x2/zero/f32.wgsl.expected.msl
@@ -5,3 +5,10 @@
float4x2 m;
};
+kernel void f(device float4x2* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float4x2(float2(0.0f), float2(0.0f), float2(0.0f), float2(0.0f));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat4x2/zero/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x2/zero/f32.wgsl.expected.spvasm
index 328b418..580892c 100644
--- a/test/tint/expressions/type_ctor/mat4x2/zero/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat4x2/zero/f32.wgsl.expected.spvasm
@@ -1,23 +1,41 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 11
+; Bound: 19
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%mat4v2float = OpTypeMatrix %v2float 4
%4 = OpConstantNull %mat4v2float
%_ptr_Private_mat4v2float = OpTypePointer Private %mat4v2float
%m = OpVariable %_ptr_Private_mat4v2float Private %4
+ %out_block = OpTypeStruct %mat4v2float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %7 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %7
- %10 = OpLabel
+ %10 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat4v2float = OpTypePointer StorageBuffer %mat4v2float
+ %f = OpFunction %void None %10
+ %13 = OpLabel
+ %17 = OpAccessChain %_ptr_StorageBuffer_mat4v2float %out %uint_0
+ %18 = OpLoad %mat4v2float %m
+ OpStore %17 %18
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat4x2/zero/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x2/zero/f32.wgsl.expected.wgsl
index 4c85dff..f51f11a 100644
--- a/test/tint/expressions/type_ctor/mat4x2/zero/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x2/zero/f32.wgsl.expected.wgsl
@@ -1 +1,8 @@
var<private> m = mat4x2<f32>();
+
+@group(0) @binding(0) var<storage, read_write> out : mat4x2<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f16.wgsl b/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f16.wgsl
index f8c21ad..5a53885 100644
--- a/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f16.wgsl
@@ -1,10 +1,13 @@
enable f16;
-var<private> m = mat4x3(mat4x3<f16>(0.0h, 1.0h, 2.0h,
- 3.0h, 4.0h, 5.0h,
- 6.0h, 7.0h, 8.0h,
- 9.0h, 10.0h, 11.0h));
+var<private> m = mat4x3<f16>(mat4x3<f16>(0.0h, 1.0h, 2.0h,
+ 3.0h, 4.0h, 5.0h,
+ 6.0h, 7.0h, 8.0h,
+ 9.0h, 10.0h, 11.0h));
-fn f() -> mat4x3<f16> {
- let m_1 = mat4x3(m);
- return m_1;
+@group(0) @binding(0)
+var<storage, read_write> out : mat4x3<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat4x3<f16>(m);
}
diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f16.wgsl.expected.dxc.hlsl
index 9b9f603..7d0c096 100644
--- a/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f16.wgsl.expected.dxc.hlsl
@@ -1,11 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 4, 3> m = matrix<float16_t, 4, 3>(vector<float16_t, 3>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector<float16_t, 3>(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)), vector<float16_t, 3>(float16_t(6.0h), float16_t(7.0h), float16_t(8.0h)), vector<float16_t, 3>(float16_t(9.0h), float16_t(10.0h), float16_t(11.0h)));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 4, 3> value) {
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 8u), value[1u]);
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 16u), value[2u]);
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 24u), value[3u]);
}
-static matrix<float16_t, 4, 3> m = matrix<float16_t, 4, 3>(vector<float16_t, 3>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector<float16_t, 3>(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)), vector<float16_t, 3>(float16_t(6.0h), float16_t(7.0h), float16_t(8.0h)), vector<float16_t, 3>(float16_t(9.0h), float16_t(10.0h), float16_t(11.0h)));
-
-matrix<float16_t, 4, 3> f() {
- const matrix<float16_t, 4, 3> m_1 = matrix<float16_t, 4, 3>(m);
- return m_1;
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, matrix<float16_t, 4, 3>(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f16.wgsl.expected.glsl
index b17a39b..2f3118b 100644
--- a/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f16.wgsl.expected.glsl
@@ -1,13 +1,24 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
- return;
-}
f16mat4x3 m = f16mat4x3(f16vec3(0.0hf, 1.0hf, 2.0hf), f16vec3(3.0hf, 4.0hf, 5.0hf), f16vec3(6.0hf, 7.0hf, 8.0hf), f16vec3(9.0hf, 10.0hf, 11.0hf));
-f16mat4x3 f() {
- f16mat4x3 m_1 = f16mat4x3(m);
- return m_1;
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat4x3 inner;
+} tint_symbol;
+
+void assign_and_preserve_padding_tint_symbol(f16mat4x3 value) {
+ tint_symbol.inner[0] = value[0u];
+ tint_symbol.inner[1] = value[1u];
+ tint_symbol.inner[2] = value[2u];
+ tint_symbol.inner[3] = value[3u];
}
+void f() {
+ assign_and_preserve_padding_tint_symbol(f16mat4x3(m));
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ f();
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f16.wgsl.expected.msl
index 5374a3b..3348147 100644
--- a/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f16.wgsl.expected.msl
@@ -1,12 +1,39 @@
#include <metal_stdlib>
using namespace metal;
+
+template<typename T, size_t N>
+struct tint_array {
+ const constant T& operator[](size_t i) const constant { return elements[i]; }
+ device T& operator[](size_t i) device { return elements[i]; }
+ const device T& operator[](size_t i) const device { return elements[i]; }
+ thread T& operator[](size_t i) thread { return elements[i]; }
+ const thread T& operator[](size_t i) const thread { return elements[i]; }
+ threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+ const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+ T elements[N];
+};
+
struct tint_private_vars_struct {
half4x3 m;
};
-half4x3 f(thread tint_private_vars_struct* const tint_private_vars) {
- half4x3 const m_1 = half4x3((*(tint_private_vars)).m);
- return m_1;
+struct tint_packed_vec3_f16_array_element {
+ /* 0x0000 */ packed_half3 elements;
+ /* 0x0006 */ tint_array<int8_t, 2> tint_pad;
+};
+
+void assign_and_preserve_padding(device tint_array<tint_packed_vec3_f16_array_element, 4>* const dest, half4x3 value) {
+ (*(dest))[0u].elements = packed_half3(value[0u]);
+ (*(dest))[1u].elements = packed_half3(value[1u]);
+ (*(dest))[2u].elements = packed_half3(value[2u]);
+ (*(dest))[3u].elements = packed_half3(value[3u]);
+}
+
+kernel void f(device tint_array<tint_packed_vec3_f16_array_element, 4>* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half4x3(half3(0.0h, 1.0h, 2.0h), half3(3.0h, 4.0h, 5.0h), half3(6.0h, 7.0h, 8.0h), half3(9.0h, 10.0h, 11.0h));
+ assign_and_preserve_padding(tint_symbol, half4x3(tint_private_vars.m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f16.wgsl.expected.spvasm
index dead4f4..73c05e6 100644
--- a/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 32
+; Bound: 57
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,11 +9,21 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %assign_and_preserve_padding_out "assign_and_preserve_padding_out"
+ OpName %value "value"
OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v3half = OpTypeVector %half 3
%mat4v3half = OpTypeMatrix %v3half 4
@@ -36,15 +46,44 @@
%20 = OpConstantComposite %mat4v3half %7 %11 %15 %19
%_ptr_Private_mat4v3half = OpTypePointer Private %mat4v3half
%m = OpVariable %_ptr_Private_mat4v3half Private %20
+ %out_block = OpTypeStruct %mat4v3half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %23 = OpTypeFunction %void
- %27 = OpTypeFunction %mat4v3half
-%unused_entry_point = OpFunction %void None %23
- %26 = OpLabel
+ %26 = OpTypeFunction %void %mat4v3half
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %34 = OpConstantNull %int
+%_ptr_StorageBuffer_v3half = OpTypePointer StorageBuffer %v3half
+ %37 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+ %int_2 = OpConstant %int 2
+ %uint_2 = OpConstant %uint 2
+ %int_3 = OpConstant %int 3
+ %uint_3 = OpConstant %uint 3
+ %51 = OpTypeFunction %void
+%assign_and_preserve_padding_out = OpFunction %void None %26
+ %value = OpFunctionParameter %mat4v3half
+ %30 = OpLabel
+ %36 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %34
+ %38 = OpCompositeExtract %v3half %value 0
+ OpStore %36 %38
+ %40 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %int_1
+ %42 = OpCompositeExtract %v3half %value 1
+ OpStore %40 %42
+ %44 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %int_2
+ %46 = OpCompositeExtract %v3half %value 2
+ OpStore %44 %46
+ %48 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %int_3
+ %50 = OpCompositeExtract %v3half %value 3
+ OpStore %48 %50
OpReturn
OpFunctionEnd
- %f = OpFunction %mat4v3half None %27
- %29 = OpLabel
- %31 = OpLoad %mat4v3half %m
- OpReturnValue %31
+ %f = OpFunction %void None %51
+ %53 = OpLabel
+ %56 = OpLoad %mat4v3half %m
+ %54 = OpFunctionCall %void %assign_and_preserve_padding_out %56
+ OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f16.wgsl.expected.wgsl
index 94f3ced..5cf419f 100644
--- a/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f16.wgsl.expected.wgsl
@@ -1,8 +1,10 @@
enable f16;
-var<private> m = mat4x3(mat4x3<f16>(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h, 8.0h, 9.0h, 10.0h, 11.0h));
+var<private> m = mat4x3<f16>(mat4x3<f16>(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h, 8.0h, 9.0h, 10.0h, 11.0h));
-fn f() -> mat4x3<f16> {
- let m_1 = mat4x3(m);
- return m_1;
+@group(0) @binding(0) var<storage, read_write> out : mat4x3<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat4x3<f16>(m);
}
diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f32.wgsl b/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f32.wgsl
index 9b7dee4..a3cb986 100644
--- a/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f32.wgsl
@@ -3,7 +3,10 @@
6.0f, 7.0f, 8.0f,
9.0f, 10.0f, 11.0f));
-fn f() -> mat4x3<f32> {
- let m_1 = mat4x3(m);
- return m_1;
+@group(0) @binding(0)
+var<storage, read_write> out : mat4x3<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat4x3<f32>(m);
}
diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f32.wgsl.expected.dxc.hlsl
index 284dccb..635fe69 100644
--- a/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f32.wgsl.expected.dxc.hlsl
@@ -1,11 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float4x3 m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store3((offset + 32u), asuint(value[2u]));
+ tint_symbol.Store3((offset + 48u), asuint(value[3u]));
}
-static float4x3 m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f));
-
-float4x3 f() {
- const float4x3 m_1 = float4x3(m);
- return m_1;
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float4x3(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f32.wgsl.expected.fxc.hlsl
index 284dccb..635fe69 100644
--- a/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f32.wgsl.expected.fxc.hlsl
@@ -1,11 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float4x3 m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store3((offset + 32u), asuint(value[2u]));
+ tint_symbol.Store3((offset + 48u), asuint(value[3u]));
}
-static float4x3 m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f));
-
-float4x3 f() {
- const float4x3 m_1 = float4x3(m);
- return m_1;
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float4x3(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f32.wgsl.expected.glsl
index 9b28954..64e7c1a 100644
--- a/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f32.wgsl.expected.glsl
@@ -1,12 +1,23 @@
#version 310 es
-layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
- return;
-}
mat4x3 m = mat4x3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f), vec3(6.0f, 7.0f, 8.0f), vec3(9.0f, 10.0f, 11.0f));
-mat4x3 f() {
- mat4x3 m_1 = mat4x3(m);
- return m_1;
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat4x3 inner;
+} tint_symbol;
+
+void assign_and_preserve_padding_tint_symbol(mat4x3 value) {
+ tint_symbol.inner[0] = value[0u];
+ tint_symbol.inner[1] = value[1u];
+ tint_symbol.inner[2] = value[2u];
+ tint_symbol.inner[3] = value[3u];
}
+void f() {
+ assign_and_preserve_padding_tint_symbol(mat4x3(m));
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ f();
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f32.wgsl.expected.msl
index 9c054fd..fa6f5cc 100644
--- a/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f32.wgsl.expected.msl
@@ -1,12 +1,39 @@
#include <metal_stdlib>
using namespace metal;
+
+template<typename T, size_t N>
+struct tint_array {
+ const constant T& operator[](size_t i) const constant { return elements[i]; }
+ device T& operator[](size_t i) device { return elements[i]; }
+ const device T& operator[](size_t i) const device { return elements[i]; }
+ thread T& operator[](size_t i) thread { return elements[i]; }
+ const thread T& operator[](size_t i) const thread { return elements[i]; }
+ threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+ const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+ T elements[N];
+};
+
struct tint_private_vars_struct {
float4x3 m;
};
-float4x3 f(thread tint_private_vars_struct* const tint_private_vars) {
- float4x3 const m_1 = float4x3((*(tint_private_vars)).m);
- return m_1;
+struct tint_packed_vec3_f32_array_element {
+ /* 0x0000 */ packed_float3 elements;
+ /* 0x000c */ tint_array<int8_t, 4> tint_pad;
+};
+
+void assign_and_preserve_padding(device tint_array<tint_packed_vec3_f32_array_element, 4>* const dest, float4x3 value) {
+ (*(dest))[0u].elements = packed_float3(value[0u]);
+ (*(dest))[1u].elements = packed_float3(value[1u]);
+ (*(dest))[2u].elements = packed_float3(value[2u]);
+ (*(dest))[3u].elements = packed_float3(value[3u]);
+}
+
+kernel void f(device tint_array<tint_packed_vec3_f32_array_element, 4>* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f));
+ assign_and_preserve_padding(tint_symbol, float4x3(tint_private_vars.m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f32.wgsl.expected.spvasm
index 8cfb499..8a219ca 100644
--- a/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f32.wgsl.expected.spvasm
@@ -1,15 +1,25 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 32
+; Bound: 57
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %assign_and_preserve_padding_out "assign_and_preserve_padding_out"
+ OpName %value "value"
OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%mat4v3float = OpTypeMatrix %v3float 4
@@ -32,15 +42,44 @@
%20 = OpConstantComposite %mat4v3float %7 %11 %15 %19
%_ptr_Private_mat4v3float = OpTypePointer Private %mat4v3float
%m = OpVariable %_ptr_Private_mat4v3float Private %20
+ %out_block = OpTypeStruct %mat4v3float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %23 = OpTypeFunction %void
- %27 = OpTypeFunction %mat4v3float
-%unused_entry_point = OpFunction %void None %23
- %26 = OpLabel
+ %26 = OpTypeFunction %void %mat4v3float
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %34 = OpConstantNull %int
+%_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float
+ %37 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+ %int_2 = OpConstant %int 2
+ %uint_2 = OpConstant %uint 2
+ %int_3 = OpConstant %int 3
+ %uint_3 = OpConstant %uint 3
+ %51 = OpTypeFunction %void
+%assign_and_preserve_padding_out = OpFunction %void None %26
+ %value = OpFunctionParameter %mat4v3float
+ %30 = OpLabel
+ %36 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %34
+ %38 = OpCompositeExtract %v3float %value 0
+ OpStore %36 %38
+ %40 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_1
+ %42 = OpCompositeExtract %v3float %value 1
+ OpStore %40 %42
+ %44 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_2
+ %46 = OpCompositeExtract %v3float %value 2
+ OpStore %44 %46
+ %48 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_3
+ %50 = OpCompositeExtract %v3float %value 3
+ OpStore %48 %50
OpReturn
OpFunctionEnd
- %f = OpFunction %mat4v3float None %27
- %29 = OpLabel
- %31 = OpLoad %mat4v3float %m
- OpReturnValue %31
+ %f = OpFunction %void None %51
+ %53 = OpLabel
+ %56 = OpLoad %mat4v3float %m
+ %54 = OpFunctionCall %void %assign_and_preserve_padding_out %56
+ OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f32.wgsl.expected.wgsl
index d406f38..71a4263 100644
--- a/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f32.wgsl.expected.wgsl
@@ -1,6 +1,8 @@
var<private> m = mat4x3(mat4x3<f32>(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f));
-fn f() -> mat4x3<f32> {
- let m_1 = mat4x3(m);
- return m_1;
+@group(0) @binding(0) var<storage, read_write> out : mat4x3<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat4x3<f32>(m);
}
diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f16.wgsl b/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f16.wgsl
index e17d69d..ff32bb3 100644
--- a/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f16.wgsl
@@ -3,3 +3,11 @@
3.0h, 4.0h, 5.0h,
6.0h, 7.0h, 8.0h,
9.0h, 10.0h, 11.0h);
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat4x3<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f16.wgsl.expected.dxc.hlsl
index 3fd1b03..8f187eb 100644
--- a/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f16.wgsl.expected.dxc.hlsl
@@ -1,6 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 4, 3> m = matrix<float16_t, 4, 3>(vector<float16_t, 3>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector<float16_t, 3>(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)), vector<float16_t, 3>(float16_t(6.0h), float16_t(7.0h), float16_t(8.0h)), vector<float16_t, 3>(float16_t(9.0h), float16_t(10.0h), float16_t(11.0h)));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 4, 3> value) {
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 8u), value[1u]);
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 16u), value[2u]);
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 24u), value[3u]);
}
-static matrix<float16_t, 4, 3> m = matrix<float16_t, 4, 3>(vector<float16_t, 3>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector<float16_t, 3>(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)), vector<float16_t, 3>(float16_t(6.0h), float16_t(7.0h), float16_t(8.0h)), vector<float16_t, 3>(float16_t(9.0h), float16_t(10.0h), float16_t(11.0h)));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f16.wgsl.expected.glsl
index 962c5ea..83549f1 100644
--- a/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f16.wgsl.expected.glsl
@@ -1,8 +1,24 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
+f16mat4x3 m = f16mat4x3(f16vec3(0.0hf, 1.0hf, 2.0hf), f16vec3(3.0hf, 4.0hf, 5.0hf), f16vec3(6.0hf, 7.0hf, 8.0hf), f16vec3(9.0hf, 10.0hf, 11.0hf));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat4x3 inner;
+} tint_symbol;
+
+void assign_and_preserve_padding_tint_symbol(f16mat4x3 value) {
+ tint_symbol.inner[0] = value[0u];
+ tint_symbol.inner[1] = value[1u];
+ tint_symbol.inner[2] = value[2u];
+ tint_symbol.inner[3] = value[3u];
+}
+
+void f() {
+ assign_and_preserve_padding_tint_symbol(m);
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-f16mat4x3 m = f16mat4x3(f16vec3(0.0hf, 1.0hf, 2.0hf), f16vec3(3.0hf, 4.0hf, 5.0hf), f16vec3(6.0hf, 7.0hf, 8.0hf), f16vec3(9.0hf, 10.0hf, 11.0hf));
diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f16.wgsl.expected.msl
index 7c59d76..d662b9c 100644
--- a/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f16.wgsl.expected.msl
@@ -1,7 +1,39 @@
#include <metal_stdlib>
using namespace metal;
+
+template<typename T, size_t N>
+struct tint_array {
+ const constant T& operator[](size_t i) const constant { return elements[i]; }
+ device T& operator[](size_t i) device { return elements[i]; }
+ const device T& operator[](size_t i) const device { return elements[i]; }
+ thread T& operator[](size_t i) thread { return elements[i]; }
+ const thread T& operator[](size_t i) const thread { return elements[i]; }
+ threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+ const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+ T elements[N];
+};
+
struct tint_private_vars_struct {
half4x3 m;
};
+struct tint_packed_vec3_f16_array_element {
+ /* 0x0000 */ packed_half3 elements;
+ /* 0x0006 */ tint_array<int8_t, 2> tint_pad;
+};
+
+void assign_and_preserve_padding(device tint_array<tint_packed_vec3_f16_array_element, 4>* const dest, half4x3 value) {
+ (*(dest))[0u].elements = packed_half3(value[0u]);
+ (*(dest))[1u].elements = packed_half3(value[1u]);
+ (*(dest))[2u].elements = packed_half3(value[2u]);
+ (*(dest))[3u].elements = packed_half3(value[3u]);
+}
+
+kernel void f(device tint_array<tint_packed_vec3_f16_array_element, 4>* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half4x3(half3(0.0h, 1.0h, 2.0h), half3(3.0h, 4.0h, 5.0h), half3(6.0h, 7.0h, 8.0h), half3(9.0h, 10.0h, 11.0h));
+ assign_and_preserve_padding(tint_symbol, tint_private_vars.m);
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f16.wgsl.expected.spvasm
index cec0264..1aa4b68 100644
--- a/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 27
+; Bound: 56
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,10 +9,21 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %assign_and_preserve_padding_out "assign_and_preserve_padding_out"
+ OpName %value "value"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v3half = OpTypeVector %half 3
%mat4v3half = OpTypeMatrix %v3half 4
@@ -35,9 +46,44 @@
%20 = OpConstantComposite %mat4v3half %7 %11 %15 %19
%_ptr_Private_mat4v3half = OpTypePointer Private %mat4v3half
%m = OpVariable %_ptr_Private_mat4v3half Private %20
+ %out_block = OpTypeStruct %mat4v3half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %23 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %23
- %26 = OpLabel
+ %26 = OpTypeFunction %void %mat4v3half
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %34 = OpConstantNull %int
+%_ptr_StorageBuffer_v3half = OpTypePointer StorageBuffer %v3half
+ %37 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+ %int_2 = OpConstant %int 2
+ %uint_2 = OpConstant %uint 2
+ %int_3 = OpConstant %int 3
+ %uint_3 = OpConstant %uint 3
+ %51 = OpTypeFunction %void
+%assign_and_preserve_padding_out = OpFunction %void None %26
+ %value = OpFunctionParameter %mat4v3half
+ %30 = OpLabel
+ %36 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %34
+ %38 = OpCompositeExtract %v3half %value 0
+ OpStore %36 %38
+ %40 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %int_1
+ %42 = OpCompositeExtract %v3half %value 1
+ OpStore %40 %42
+ %44 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %int_2
+ %46 = OpCompositeExtract %v3half %value 2
+ OpStore %44 %46
+ %48 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %int_3
+ %50 = OpCompositeExtract %v3half %value 3
+ OpStore %48 %50
+ OpReturn
+ OpFunctionEnd
+ %f = OpFunction %void None %51
+ %53 = OpLabel
+ %55 = OpLoad %mat4v3half %m
+ %54 = OpFunctionCall %void %assign_and_preserve_padding_out %55
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f16.wgsl.expected.wgsl
index c9c72ab..038abe7 100644
--- a/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f16.wgsl.expected.wgsl
@@ -1,3 +1,10 @@
enable f16;
var<private> m = mat4x3<f16>(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h, 8.0h, 9.0h, 10.0h, 11.0h);
+
+@group(0) @binding(0) var<storage, read_write> out : mat4x3<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl b/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl
index afb562f..c14cfda 100644
--- a/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl
@@ -2,3 +2,11 @@
3.0f, 4.0f, 5.0f,
6.0f, 7.0f, 8.0f,
9.0f, 10.0f, 11.0f);
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat4x3<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl.expected.dxc.hlsl
index 6b34e6e..0490538 100644
--- a/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl.expected.dxc.hlsl
@@ -1,6 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float4x3 m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store3((offset + 32u), asuint(value[2u]));
+ tint_symbol.Store3((offset + 48u), asuint(value[3u]));
}
-static float4x3 m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl.expected.fxc.hlsl
index 6b34e6e..0490538 100644
--- a/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl.expected.fxc.hlsl
@@ -1,6 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float4x3 m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store3((offset + 32u), asuint(value[2u]));
+ tint_symbol.Store3((offset + 48u), asuint(value[3u]));
}
-static float4x3 m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl.expected.glsl
index 06560c7..eff2b7f 100644
--- a/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl.expected.glsl
@@ -1,7 +1,23 @@
#version 310 es
+mat4x3 m = mat4x3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f), vec3(6.0f, 7.0f, 8.0f), vec3(9.0f, 10.0f, 11.0f));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat4x3 inner;
+} tint_symbol;
+
+void assign_and_preserve_padding_tint_symbol(mat4x3 value) {
+ tint_symbol.inner[0] = value[0u];
+ tint_symbol.inner[1] = value[1u];
+ tint_symbol.inner[2] = value[2u];
+ tint_symbol.inner[3] = value[3u];
+}
+
+void f() {
+ assign_and_preserve_padding_tint_symbol(m);
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat4x3 m = mat4x3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f), vec3(6.0f, 7.0f, 8.0f), vec3(9.0f, 10.0f, 11.0f));
diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl.expected.msl
index 7438c62..cebc171 100644
--- a/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl.expected.msl
@@ -1,7 +1,39 @@
#include <metal_stdlib>
using namespace metal;
+
+template<typename T, size_t N>
+struct tint_array {
+ const constant T& operator[](size_t i) const constant { return elements[i]; }
+ device T& operator[](size_t i) device { return elements[i]; }
+ const device T& operator[](size_t i) const device { return elements[i]; }
+ thread T& operator[](size_t i) thread { return elements[i]; }
+ const thread T& operator[](size_t i) const thread { return elements[i]; }
+ threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+ const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+ T elements[N];
+};
+
struct tint_private_vars_struct {
float4x3 m;
};
+struct tint_packed_vec3_f32_array_element {
+ /* 0x0000 */ packed_float3 elements;
+ /* 0x000c */ tint_array<int8_t, 4> tint_pad;
+};
+
+void assign_and_preserve_padding(device tint_array<tint_packed_vec3_f32_array_element, 4>* const dest, float4x3 value) {
+ (*(dest))[0u].elements = packed_float3(value[0u]);
+ (*(dest))[1u].elements = packed_float3(value[1u]);
+ (*(dest))[2u].elements = packed_float3(value[2u]);
+ (*(dest))[3u].elements = packed_float3(value[3u]);
+}
+
+kernel void f(device tint_array<tint_packed_vec3_f32_array_element, 4>* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f));
+ assign_and_preserve_padding(tint_symbol, tint_private_vars.m);
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl.expected.spvasm
index f5592ed..239d024 100644
--- a/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl.expected.spvasm
@@ -1,14 +1,25 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 27
+; Bound: 56
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %assign_and_preserve_padding_out "assign_and_preserve_padding_out"
+ OpName %value "value"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%mat4v3float = OpTypeMatrix %v3float 4
@@ -31,9 +42,44 @@
%20 = OpConstantComposite %mat4v3float %7 %11 %15 %19
%_ptr_Private_mat4v3float = OpTypePointer Private %mat4v3float
%m = OpVariable %_ptr_Private_mat4v3float Private %20
+ %out_block = OpTypeStruct %mat4v3float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %23 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %23
- %26 = OpLabel
+ %26 = OpTypeFunction %void %mat4v3float
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %34 = OpConstantNull %int
+%_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float
+ %37 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+ %int_2 = OpConstant %int 2
+ %uint_2 = OpConstant %uint 2
+ %int_3 = OpConstant %int 3
+ %uint_3 = OpConstant %uint 3
+ %51 = OpTypeFunction %void
+%assign_and_preserve_padding_out = OpFunction %void None %26
+ %value = OpFunctionParameter %mat4v3float
+ %30 = OpLabel
+ %36 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %34
+ %38 = OpCompositeExtract %v3float %value 0
+ OpStore %36 %38
+ %40 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_1
+ %42 = OpCompositeExtract %v3float %value 1
+ OpStore %40 %42
+ %44 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_2
+ %46 = OpCompositeExtract %v3float %value 2
+ OpStore %44 %46
+ %48 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_3
+ %50 = OpCompositeExtract %v3float %value 3
+ OpStore %48 %50
+ OpReturn
+ OpFunctionEnd
+ %f = OpFunction %void None %51
+ %53 = OpLabel
+ %55 = OpLoad %mat4v3float %m
+ %54 = OpFunctionCall %void %assign_and_preserve_padding_out %55
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl.expected.wgsl
index aaa7fd7..7d5587e 100644
--- a/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl.expected.wgsl
@@ -1 +1,8 @@
var<private> m = mat4x3<f32>(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f);
+
+@group(0) @binding(0) var<storage, read_write> out : mat4x3<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f16.wgsl b/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f16.wgsl
index fa9c762..a6d8b10 100644
--- a/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f16.wgsl
@@ -3,3 +3,11 @@
vec3<f16>(3.0h, 4.0h, 5.0h),
vec3<f16>(6.0h, 7.0h, 8.0h),
vec3<f16>(9.0h, 10.0h, 11.0h));
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat4x3<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f16.wgsl.expected.dxc.hlsl
index 3fd1b03..8f187eb 100644
--- a/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f16.wgsl.expected.dxc.hlsl
@@ -1,6 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 4, 3> m = matrix<float16_t, 4, 3>(vector<float16_t, 3>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector<float16_t, 3>(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)), vector<float16_t, 3>(float16_t(6.0h), float16_t(7.0h), float16_t(8.0h)), vector<float16_t, 3>(float16_t(9.0h), float16_t(10.0h), float16_t(11.0h)));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 4, 3> value) {
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 8u), value[1u]);
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 16u), value[2u]);
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 24u), value[3u]);
}
-static matrix<float16_t, 4, 3> m = matrix<float16_t, 4, 3>(vector<float16_t, 3>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector<float16_t, 3>(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)), vector<float16_t, 3>(float16_t(6.0h), float16_t(7.0h), float16_t(8.0h)), vector<float16_t, 3>(float16_t(9.0h), float16_t(10.0h), float16_t(11.0h)));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f16.wgsl.expected.glsl
index 962c5ea..83549f1 100644
--- a/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f16.wgsl.expected.glsl
@@ -1,8 +1,24 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
+f16mat4x3 m = f16mat4x3(f16vec3(0.0hf, 1.0hf, 2.0hf), f16vec3(3.0hf, 4.0hf, 5.0hf), f16vec3(6.0hf, 7.0hf, 8.0hf), f16vec3(9.0hf, 10.0hf, 11.0hf));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat4x3 inner;
+} tint_symbol;
+
+void assign_and_preserve_padding_tint_symbol(f16mat4x3 value) {
+ tint_symbol.inner[0] = value[0u];
+ tint_symbol.inner[1] = value[1u];
+ tint_symbol.inner[2] = value[2u];
+ tint_symbol.inner[3] = value[3u];
+}
+
+void f() {
+ assign_and_preserve_padding_tint_symbol(m);
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-f16mat4x3 m = f16mat4x3(f16vec3(0.0hf, 1.0hf, 2.0hf), f16vec3(3.0hf, 4.0hf, 5.0hf), f16vec3(6.0hf, 7.0hf, 8.0hf), f16vec3(9.0hf, 10.0hf, 11.0hf));
diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f16.wgsl.expected.msl
index 7c59d76..d662b9c 100644
--- a/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f16.wgsl.expected.msl
@@ -1,7 +1,39 @@
#include <metal_stdlib>
using namespace metal;
+
+template<typename T, size_t N>
+struct tint_array {
+ const constant T& operator[](size_t i) const constant { return elements[i]; }
+ device T& operator[](size_t i) device { return elements[i]; }
+ const device T& operator[](size_t i) const device { return elements[i]; }
+ thread T& operator[](size_t i) thread { return elements[i]; }
+ const thread T& operator[](size_t i) const thread { return elements[i]; }
+ threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+ const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+ T elements[N];
+};
+
struct tint_private_vars_struct {
half4x3 m;
};
+struct tint_packed_vec3_f16_array_element {
+ /* 0x0000 */ packed_half3 elements;
+ /* 0x0006 */ tint_array<int8_t, 2> tint_pad;
+};
+
+void assign_and_preserve_padding(device tint_array<tint_packed_vec3_f16_array_element, 4>* const dest, half4x3 value) {
+ (*(dest))[0u].elements = packed_half3(value[0u]);
+ (*(dest))[1u].elements = packed_half3(value[1u]);
+ (*(dest))[2u].elements = packed_half3(value[2u]);
+ (*(dest))[3u].elements = packed_half3(value[3u]);
+}
+
+kernel void f(device tint_array<tint_packed_vec3_f16_array_element, 4>* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half4x3(half3(0.0h, 1.0h, 2.0h), half3(3.0h, 4.0h, 5.0h), half3(6.0h, 7.0h, 8.0h), half3(9.0h, 10.0h, 11.0h));
+ assign_and_preserve_padding(tint_symbol, tint_private_vars.m);
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f16.wgsl.expected.spvasm
index cec0264..1aa4b68 100644
--- a/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 27
+; Bound: 56
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,10 +9,21 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %assign_and_preserve_padding_out "assign_and_preserve_padding_out"
+ OpName %value "value"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v3half = OpTypeVector %half 3
%mat4v3half = OpTypeMatrix %v3half 4
@@ -35,9 +46,44 @@
%20 = OpConstantComposite %mat4v3half %7 %11 %15 %19
%_ptr_Private_mat4v3half = OpTypePointer Private %mat4v3half
%m = OpVariable %_ptr_Private_mat4v3half Private %20
+ %out_block = OpTypeStruct %mat4v3half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %23 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %23
- %26 = OpLabel
+ %26 = OpTypeFunction %void %mat4v3half
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %34 = OpConstantNull %int
+%_ptr_StorageBuffer_v3half = OpTypePointer StorageBuffer %v3half
+ %37 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+ %int_2 = OpConstant %int 2
+ %uint_2 = OpConstant %uint 2
+ %int_3 = OpConstant %int 3
+ %uint_3 = OpConstant %uint 3
+ %51 = OpTypeFunction %void
+%assign_and_preserve_padding_out = OpFunction %void None %26
+ %value = OpFunctionParameter %mat4v3half
+ %30 = OpLabel
+ %36 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %34
+ %38 = OpCompositeExtract %v3half %value 0
+ OpStore %36 %38
+ %40 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %int_1
+ %42 = OpCompositeExtract %v3half %value 1
+ OpStore %40 %42
+ %44 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %int_2
+ %46 = OpCompositeExtract %v3half %value 2
+ OpStore %44 %46
+ %48 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %int_3
+ %50 = OpCompositeExtract %v3half %value 3
+ OpStore %48 %50
+ OpReturn
+ OpFunctionEnd
+ %f = OpFunction %void None %51
+ %53 = OpLabel
+ %55 = OpLoad %mat4v3half %m
+ %54 = OpFunctionCall %void %assign_and_preserve_padding_out %55
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f16.wgsl.expected.wgsl
index 2693abb..8f8cea5 100644
--- a/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f16.wgsl.expected.wgsl
@@ -1,3 +1,10 @@
enable f16;
var<private> m = mat4x3<f16>(vec3<f16>(0.0h, 1.0h, 2.0h), vec3<f16>(3.0h, 4.0h, 5.0h), vec3<f16>(6.0h, 7.0h, 8.0h), vec3<f16>(9.0h, 10.0h, 11.0h));
+
+@group(0) @binding(0) var<storage, read_write> out : mat4x3<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl b/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl
index 00f6cb1..8db51bb 100644
--- a/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl
@@ -2,3 +2,11 @@
vec3<f32>(3.0f, 4.0f, 5.0f),
vec3<f32>(6.0f, 7.0f, 8.0f),
vec3<f32>(9.0f, 10.0f, 11.0f));
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat4x3<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.dxc.hlsl
index 6b34e6e..0490538 100644
--- a/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.dxc.hlsl
@@ -1,6 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float4x3 m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store3((offset + 32u), asuint(value[2u]));
+ tint_symbol.Store3((offset + 48u), asuint(value[3u]));
}
-static float4x3 m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.fxc.hlsl
index 6b34e6e..0490538 100644
--- a/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.fxc.hlsl
@@ -1,6 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float4x3 m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store3((offset + 32u), asuint(value[2u]));
+ tint_symbol.Store3((offset + 48u), asuint(value[3u]));
}
-static float4x3 m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.glsl
index 06560c7..eff2b7f 100644
--- a/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.glsl
@@ -1,7 +1,23 @@
#version 310 es
+mat4x3 m = mat4x3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f), vec3(6.0f, 7.0f, 8.0f), vec3(9.0f, 10.0f, 11.0f));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat4x3 inner;
+} tint_symbol;
+
+void assign_and_preserve_padding_tint_symbol(mat4x3 value) {
+ tint_symbol.inner[0] = value[0u];
+ tint_symbol.inner[1] = value[1u];
+ tint_symbol.inner[2] = value[2u];
+ tint_symbol.inner[3] = value[3u];
+}
+
+void f() {
+ assign_and_preserve_padding_tint_symbol(m);
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat4x3 m = mat4x3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f), vec3(6.0f, 7.0f, 8.0f), vec3(9.0f, 10.0f, 11.0f));
diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.msl
index 7438c62..cebc171 100644
--- a/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.msl
@@ -1,7 +1,39 @@
#include <metal_stdlib>
using namespace metal;
+
+template<typename T, size_t N>
+struct tint_array {
+ const constant T& operator[](size_t i) const constant { return elements[i]; }
+ device T& operator[](size_t i) device { return elements[i]; }
+ const device T& operator[](size_t i) const device { return elements[i]; }
+ thread T& operator[](size_t i) thread { return elements[i]; }
+ const thread T& operator[](size_t i) const thread { return elements[i]; }
+ threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+ const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+ T elements[N];
+};
+
struct tint_private_vars_struct {
float4x3 m;
};
+struct tint_packed_vec3_f32_array_element {
+ /* 0x0000 */ packed_float3 elements;
+ /* 0x000c */ tint_array<int8_t, 4> tint_pad;
+};
+
+void assign_and_preserve_padding(device tint_array<tint_packed_vec3_f32_array_element, 4>* const dest, float4x3 value) {
+ (*(dest))[0u].elements = packed_float3(value[0u]);
+ (*(dest))[1u].elements = packed_float3(value[1u]);
+ (*(dest))[2u].elements = packed_float3(value[2u]);
+ (*(dest))[3u].elements = packed_float3(value[3u]);
+}
+
+kernel void f(device tint_array<tint_packed_vec3_f32_array_element, 4>* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f));
+ assign_and_preserve_padding(tint_symbol, tint_private_vars.m);
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.spvasm
index f5592ed..239d024 100644
--- a/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.spvasm
@@ -1,14 +1,25 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 27
+; Bound: 56
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %assign_and_preserve_padding_out "assign_and_preserve_padding_out"
+ OpName %value "value"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%mat4v3float = OpTypeMatrix %v3float 4
@@ -31,9 +42,44 @@
%20 = OpConstantComposite %mat4v3float %7 %11 %15 %19
%_ptr_Private_mat4v3float = OpTypePointer Private %mat4v3float
%m = OpVariable %_ptr_Private_mat4v3float Private %20
+ %out_block = OpTypeStruct %mat4v3float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %23 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %23
- %26 = OpLabel
+ %26 = OpTypeFunction %void %mat4v3float
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %34 = OpConstantNull %int
+%_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float
+ %37 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+ %int_2 = OpConstant %int 2
+ %uint_2 = OpConstant %uint 2
+ %int_3 = OpConstant %int 3
+ %uint_3 = OpConstant %uint 3
+ %51 = OpTypeFunction %void
+%assign_and_preserve_padding_out = OpFunction %void None %26
+ %value = OpFunctionParameter %mat4v3float
+ %30 = OpLabel
+ %36 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %34
+ %38 = OpCompositeExtract %v3float %value 0
+ OpStore %36 %38
+ %40 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_1
+ %42 = OpCompositeExtract %v3float %value 1
+ OpStore %40 %42
+ %44 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_2
+ %46 = OpCompositeExtract %v3float %value 2
+ OpStore %44 %46
+ %48 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_3
+ %50 = OpCompositeExtract %v3float %value 3
+ OpStore %48 %50
+ OpReturn
+ OpFunctionEnd
+ %f = OpFunction %void None %51
+ %53 = OpLabel
+ %55 = OpLoad %mat4v3float %m
+ %54 = OpFunctionCall %void %assign_and_preserve_padding_out %55
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.wgsl
index 8e07672..25cabb4 100644
--- a/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.wgsl
@@ -1 +1,8 @@
var<private> m = mat4x3<f32>(vec3<f32>(0.0f, 1.0f, 2.0f), vec3<f32>(3.0f, 4.0f, 5.0f), vec3<f32>(6.0f, 7.0f, 8.0f), vec3<f32>(9.0f, 10.0f, 11.0f));
+
+@group(0) @binding(0) var<storage, read_write> out : mat4x3<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f16.wgsl b/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f16.wgsl
index b85217b..8b5afef 100644
--- a/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f16.wgsl
@@ -4,7 +4,10 @@
6.0h, 7.0h, 8.0h,
9.0h, 10.0h, 11.0h));
-fn f() -> mat4x3<f16> {
- let m_1 = mat4x3(m);
- return m_1;
+@group(0) @binding(0)
+var<storage, read_write> out : mat4x3<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat4x3(m);
}
diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f16.wgsl.expected.dxc.hlsl
index 9b9f603..7d0c096 100644
--- a/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f16.wgsl.expected.dxc.hlsl
@@ -1,11 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 4, 3> m = matrix<float16_t, 4, 3>(vector<float16_t, 3>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector<float16_t, 3>(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)), vector<float16_t, 3>(float16_t(6.0h), float16_t(7.0h), float16_t(8.0h)), vector<float16_t, 3>(float16_t(9.0h), float16_t(10.0h), float16_t(11.0h)));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 4, 3> value) {
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 8u), value[1u]);
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 16u), value[2u]);
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 24u), value[3u]);
}
-static matrix<float16_t, 4, 3> m = matrix<float16_t, 4, 3>(vector<float16_t, 3>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector<float16_t, 3>(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)), vector<float16_t, 3>(float16_t(6.0h), float16_t(7.0h), float16_t(8.0h)), vector<float16_t, 3>(float16_t(9.0h), float16_t(10.0h), float16_t(11.0h)));
-
-matrix<float16_t, 4, 3> f() {
- const matrix<float16_t, 4, 3> m_1 = matrix<float16_t, 4, 3>(m);
- return m_1;
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, matrix<float16_t, 4, 3>(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f16.wgsl.expected.glsl
index b17a39b..2f3118b 100644
--- a/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f16.wgsl.expected.glsl
@@ -1,13 +1,24 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
- return;
-}
f16mat4x3 m = f16mat4x3(f16vec3(0.0hf, 1.0hf, 2.0hf), f16vec3(3.0hf, 4.0hf, 5.0hf), f16vec3(6.0hf, 7.0hf, 8.0hf), f16vec3(9.0hf, 10.0hf, 11.0hf));
-f16mat4x3 f() {
- f16mat4x3 m_1 = f16mat4x3(m);
- return m_1;
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat4x3 inner;
+} tint_symbol;
+
+void assign_and_preserve_padding_tint_symbol(f16mat4x3 value) {
+ tint_symbol.inner[0] = value[0u];
+ tint_symbol.inner[1] = value[1u];
+ tint_symbol.inner[2] = value[2u];
+ tint_symbol.inner[3] = value[3u];
}
+void f() {
+ assign_and_preserve_padding_tint_symbol(f16mat4x3(m));
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ f();
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f16.wgsl.expected.msl
index 5374a3b..3348147 100644
--- a/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f16.wgsl.expected.msl
@@ -1,12 +1,39 @@
#include <metal_stdlib>
using namespace metal;
+
+template<typename T, size_t N>
+struct tint_array {
+ const constant T& operator[](size_t i) const constant { return elements[i]; }
+ device T& operator[](size_t i) device { return elements[i]; }
+ const device T& operator[](size_t i) const device { return elements[i]; }
+ thread T& operator[](size_t i) thread { return elements[i]; }
+ const thread T& operator[](size_t i) const thread { return elements[i]; }
+ threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+ const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+ T elements[N];
+};
+
struct tint_private_vars_struct {
half4x3 m;
};
-half4x3 f(thread tint_private_vars_struct* const tint_private_vars) {
- half4x3 const m_1 = half4x3((*(tint_private_vars)).m);
- return m_1;
+struct tint_packed_vec3_f16_array_element {
+ /* 0x0000 */ packed_half3 elements;
+ /* 0x0006 */ tint_array<int8_t, 2> tint_pad;
+};
+
+void assign_and_preserve_padding(device tint_array<tint_packed_vec3_f16_array_element, 4>* const dest, half4x3 value) {
+ (*(dest))[0u].elements = packed_half3(value[0u]);
+ (*(dest))[1u].elements = packed_half3(value[1u]);
+ (*(dest))[2u].elements = packed_half3(value[2u]);
+ (*(dest))[3u].elements = packed_half3(value[3u]);
+}
+
+kernel void f(device tint_array<tint_packed_vec3_f16_array_element, 4>* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half4x3(half3(0.0h, 1.0h, 2.0h), half3(3.0h, 4.0h, 5.0h), half3(6.0h, 7.0h, 8.0h), half3(9.0h, 10.0h, 11.0h));
+ assign_and_preserve_padding(tint_symbol, half4x3(tint_private_vars.m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f16.wgsl.expected.spvasm
index dead4f4..73c05e6 100644
--- a/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 32
+; Bound: 57
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,11 +9,21 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %assign_and_preserve_padding_out "assign_and_preserve_padding_out"
+ OpName %value "value"
OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v3half = OpTypeVector %half 3
%mat4v3half = OpTypeMatrix %v3half 4
@@ -36,15 +46,44 @@
%20 = OpConstantComposite %mat4v3half %7 %11 %15 %19
%_ptr_Private_mat4v3half = OpTypePointer Private %mat4v3half
%m = OpVariable %_ptr_Private_mat4v3half Private %20
+ %out_block = OpTypeStruct %mat4v3half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %23 = OpTypeFunction %void
- %27 = OpTypeFunction %mat4v3half
-%unused_entry_point = OpFunction %void None %23
- %26 = OpLabel
+ %26 = OpTypeFunction %void %mat4v3half
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %34 = OpConstantNull %int
+%_ptr_StorageBuffer_v3half = OpTypePointer StorageBuffer %v3half
+ %37 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+ %int_2 = OpConstant %int 2
+ %uint_2 = OpConstant %uint 2
+ %int_3 = OpConstant %int 3
+ %uint_3 = OpConstant %uint 3
+ %51 = OpTypeFunction %void
+%assign_and_preserve_padding_out = OpFunction %void None %26
+ %value = OpFunctionParameter %mat4v3half
+ %30 = OpLabel
+ %36 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %34
+ %38 = OpCompositeExtract %v3half %value 0
+ OpStore %36 %38
+ %40 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %int_1
+ %42 = OpCompositeExtract %v3half %value 1
+ OpStore %40 %42
+ %44 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %int_2
+ %46 = OpCompositeExtract %v3half %value 2
+ OpStore %44 %46
+ %48 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %int_3
+ %50 = OpCompositeExtract %v3half %value 3
+ OpStore %48 %50
OpReturn
OpFunctionEnd
- %f = OpFunction %mat4v3half None %27
- %29 = OpLabel
- %31 = OpLoad %mat4v3half %m
- OpReturnValue %31
+ %f = OpFunction %void None %51
+ %53 = OpLabel
+ %56 = OpLoad %mat4v3half %m
+ %54 = OpFunctionCall %void %assign_and_preserve_padding_out %56
+ OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f16.wgsl.expected.wgsl
index 1fae55a..4da02e6 100644
--- a/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f16.wgsl.expected.wgsl
@@ -2,7 +2,9 @@
var<private> m = mat4x3(mat4x3(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h, 8.0h, 9.0h, 10.0h, 11.0h));
-fn f() -> mat4x3<f16> {
- let m_1 = mat4x3(m);
- return m_1;
+@group(0) @binding(0) var<storage, read_write> out : mat4x3<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat4x3(m);
}
diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f32.wgsl b/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f32.wgsl
index ad7c1b2..088e056 100644
--- a/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f32.wgsl
@@ -3,7 +3,10 @@
6.0f, 7.0f, 8.0f,
9.0f, 10.0f, 11.0f));
-fn f() -> mat4x3<f32> {
- let m_1 = mat4x3(m);
- return m_1;
+@group(0) @binding(0)
+var<storage, read_write> out : mat4x3<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat4x3(m);
}
diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f32.wgsl.expected.dxc.hlsl
index 284dccb..635fe69 100644
--- a/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f32.wgsl.expected.dxc.hlsl
@@ -1,11 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float4x3 m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store3((offset + 32u), asuint(value[2u]));
+ tint_symbol.Store3((offset + 48u), asuint(value[3u]));
}
-static float4x3 m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f));
-
-float4x3 f() {
- const float4x3 m_1 = float4x3(m);
- return m_1;
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float4x3(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f32.wgsl.expected.fxc.hlsl
index 284dccb..635fe69 100644
--- a/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f32.wgsl.expected.fxc.hlsl
@@ -1,11 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float4x3 m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store3((offset + 32u), asuint(value[2u]));
+ tint_symbol.Store3((offset + 48u), asuint(value[3u]));
}
-static float4x3 m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f));
-
-float4x3 f() {
- const float4x3 m_1 = float4x3(m);
- return m_1;
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float4x3(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f32.wgsl.expected.glsl
index 9b28954..64e7c1a 100644
--- a/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f32.wgsl.expected.glsl
@@ -1,12 +1,23 @@
#version 310 es
-layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
- return;
-}
mat4x3 m = mat4x3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f), vec3(6.0f, 7.0f, 8.0f), vec3(9.0f, 10.0f, 11.0f));
-mat4x3 f() {
- mat4x3 m_1 = mat4x3(m);
- return m_1;
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat4x3 inner;
+} tint_symbol;
+
+void assign_and_preserve_padding_tint_symbol(mat4x3 value) {
+ tint_symbol.inner[0] = value[0u];
+ tint_symbol.inner[1] = value[1u];
+ tint_symbol.inner[2] = value[2u];
+ tint_symbol.inner[3] = value[3u];
}
+void f() {
+ assign_and_preserve_padding_tint_symbol(mat4x3(m));
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ f();
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f32.wgsl.expected.msl
index 9c054fd..fa6f5cc 100644
--- a/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f32.wgsl.expected.msl
@@ -1,12 +1,39 @@
#include <metal_stdlib>
using namespace metal;
+
+template<typename T, size_t N>
+struct tint_array {
+ const constant T& operator[](size_t i) const constant { return elements[i]; }
+ device T& operator[](size_t i) device { return elements[i]; }
+ const device T& operator[](size_t i) const device { return elements[i]; }
+ thread T& operator[](size_t i) thread { return elements[i]; }
+ const thread T& operator[](size_t i) const thread { return elements[i]; }
+ threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+ const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+ T elements[N];
+};
+
struct tint_private_vars_struct {
float4x3 m;
};
-float4x3 f(thread tint_private_vars_struct* const tint_private_vars) {
- float4x3 const m_1 = float4x3((*(tint_private_vars)).m);
- return m_1;
+struct tint_packed_vec3_f32_array_element {
+ /* 0x0000 */ packed_float3 elements;
+ /* 0x000c */ tint_array<int8_t, 4> tint_pad;
+};
+
+void assign_and_preserve_padding(device tint_array<tint_packed_vec3_f32_array_element, 4>* const dest, float4x3 value) {
+ (*(dest))[0u].elements = packed_float3(value[0u]);
+ (*(dest))[1u].elements = packed_float3(value[1u]);
+ (*(dest))[2u].elements = packed_float3(value[2u]);
+ (*(dest))[3u].elements = packed_float3(value[3u]);
+}
+
+kernel void f(device tint_array<tint_packed_vec3_f32_array_element, 4>* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f));
+ assign_and_preserve_padding(tint_symbol, float4x3(tint_private_vars.m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f32.wgsl.expected.spvasm
index 8cfb499..8a219ca 100644
--- a/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f32.wgsl.expected.spvasm
@@ -1,15 +1,25 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 32
+; Bound: 57
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %assign_and_preserve_padding_out "assign_and_preserve_padding_out"
+ OpName %value "value"
OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%mat4v3float = OpTypeMatrix %v3float 4
@@ -32,15 +42,44 @@
%20 = OpConstantComposite %mat4v3float %7 %11 %15 %19
%_ptr_Private_mat4v3float = OpTypePointer Private %mat4v3float
%m = OpVariable %_ptr_Private_mat4v3float Private %20
+ %out_block = OpTypeStruct %mat4v3float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %23 = OpTypeFunction %void
- %27 = OpTypeFunction %mat4v3float
-%unused_entry_point = OpFunction %void None %23
- %26 = OpLabel
+ %26 = OpTypeFunction %void %mat4v3float
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %34 = OpConstantNull %int
+%_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float
+ %37 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+ %int_2 = OpConstant %int 2
+ %uint_2 = OpConstant %uint 2
+ %int_3 = OpConstant %int 3
+ %uint_3 = OpConstant %uint 3
+ %51 = OpTypeFunction %void
+%assign_and_preserve_padding_out = OpFunction %void None %26
+ %value = OpFunctionParameter %mat4v3float
+ %30 = OpLabel
+ %36 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %34
+ %38 = OpCompositeExtract %v3float %value 0
+ OpStore %36 %38
+ %40 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_1
+ %42 = OpCompositeExtract %v3float %value 1
+ OpStore %40 %42
+ %44 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_2
+ %46 = OpCompositeExtract %v3float %value 2
+ OpStore %44 %46
+ %48 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_3
+ %50 = OpCompositeExtract %v3float %value 3
+ OpStore %48 %50
OpReturn
OpFunctionEnd
- %f = OpFunction %mat4v3float None %27
- %29 = OpLabel
- %31 = OpLoad %mat4v3float %m
- OpReturnValue %31
+ %f = OpFunction %void None %51
+ %53 = OpLabel
+ %56 = OpLoad %mat4v3float %m
+ %54 = OpFunctionCall %void %assign_and_preserve_padding_out %56
+ OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f32.wgsl.expected.wgsl
index 58662e4..e35a379 100644
--- a/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f32.wgsl.expected.wgsl
@@ -1,6 +1,8 @@
var<private> m = mat4x3(mat4x3(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f));
-fn f() -> mat4x3<f32> {
- let m_1 = mat4x3(m);
- return m_1;
+@group(0) @binding(0) var<storage, read_write> out : mat4x3<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat4x3(m);
}
diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/abstract-float.wgsl b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/abstract-float.wgsl
index 449400b..1d64f9d 100644
--- a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/abstract-float.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/abstract-float.wgsl
@@ -1,4 +1,12 @@
-var<private> m = mat4x3(0.0, 1.0, 2.0,
- 3.0, 4.0, 5.0,
- 6.0, 7.0, 8.0,
- 9.0, 10.0, 11.0);
+const m = mat4x3(0.0, 1.0, 2.0,
+ 3.0, 4.0, 5.0,
+ 6.0, 7.0, 8.0,
+ 9.0, 10.0, 11.0);
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat4x3<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl
index 6b34e6e..767a0fb 100644
--- a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store3((offset + 32u), asuint(value[2u]));
+ tint_symbol.Store3((offset + 48u), asuint(value[3u]));
}
-static float4x3 m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f)));
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl
index 6b34e6e..767a0fb 100644
--- a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store3((offset + 32u), asuint(value[2u]));
+ tint_symbol.Store3((offset + 48u), asuint(value[3u]));
}
-static float4x3 m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f)));
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/abstract-float.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/abstract-float.wgsl.expected.glsl
index 06560c7..07e18dd 100644
--- a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/abstract-float.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/abstract-float.wgsl.expected.glsl
@@ -1,7 +1,22 @@
#version 310 es
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat4x3 inner;
+} tint_symbol;
+
+void assign_and_preserve_padding_tint_symbol(mat4x3 value) {
+ tint_symbol.inner[0] = value[0u];
+ tint_symbol.inner[1] = value[1u];
+ tint_symbol.inner[2] = value[2u];
+ tint_symbol.inner[3] = value[3u];
+}
+
+void f() {
+ assign_and_preserve_padding_tint_symbol(mat4x3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f), vec3(6.0f, 7.0f, 8.0f), vec3(9.0f, 10.0f, 11.0f)));
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat4x3 m = mat4x3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f), vec3(6.0f, 7.0f, 8.0f), vec3(9.0f, 10.0f, 11.0f));
diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/abstract-float.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/abstract-float.wgsl.expected.msl
index 7438c62..1ea325e 100644
--- a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/abstract-float.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/abstract-float.wgsl.expected.msl
@@ -1,7 +1,33 @@
#include <metal_stdlib>
using namespace metal;
-struct tint_private_vars_struct {
- float4x3 m;
+
+template<typename T, size_t N>
+struct tint_array {
+ const constant T& operator[](size_t i) const constant { return elements[i]; }
+ device T& operator[](size_t i) device { return elements[i]; }
+ const device T& operator[](size_t i) const device { return elements[i]; }
+ thread T& operator[](size_t i) thread { return elements[i]; }
+ const thread T& operator[](size_t i) const thread { return elements[i]; }
+ threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+ const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+ T elements[N];
};
+struct tint_packed_vec3_f32_array_element {
+ /* 0x0000 */ packed_float3 elements;
+ /* 0x000c */ tint_array<int8_t, 4> tint_pad;
+};
+
+void assign_and_preserve_padding(device tint_array<tint_packed_vec3_f32_array_element, 4>* const dest, float4x3 value) {
+ (*(dest))[0u].elements = packed_float3(value[0u]);
+ (*(dest))[1u].elements = packed_float3(value[1u]);
+ (*(dest))[2u].elements = packed_float3(value[2u]);
+ (*(dest))[3u].elements = packed_float3(value[3u]);
+}
+
+kernel void f(device tint_array<tint_packed_vec3_f32_array_element, 4>* tint_symbol [[buffer(0)]]) {
+ assign_and_preserve_padding(tint_symbol, float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f)));
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/abstract-float.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/abstract-float.wgsl.expected.spvasm
index f5592ed..35d3339 100644
--- a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/abstract-float.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/abstract-float.wgsl.expected.spvasm
@@ -1,39 +1,81 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 27
+; Bound: 53
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
- OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %assign_and_preserve_padding_out "assign_and_preserve_padding_out"
+ OpName %value "value"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%mat4v3float = OpTypeMatrix %v3float 4
- %4 = OpConstantNull %float
+ %out_block = OpTypeStruct %mat4v3float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void %mat4v3float
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %15 = OpConstantNull %int
+%_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float
+ %18 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+ %int_2 = OpConstant %int 2
+ %uint_2 = OpConstant %uint 2
+ %int_3 = OpConstant %int 3
+ %uint_3 = OpConstant %uint 3
+ %32 = OpTypeFunction %void
+ %36 = OpConstantNull %float
%float_1 = OpConstant %float 1
%float_2 = OpConstant %float 2
- %7 = OpConstantComposite %v3float %4 %float_1 %float_2
+ %39 = OpConstantComposite %v3float %36 %float_1 %float_2
%float_3 = OpConstant %float 3
%float_4 = OpConstant %float 4
%float_5 = OpConstant %float 5
- %11 = OpConstantComposite %v3float %float_3 %float_4 %float_5
+ %43 = OpConstantComposite %v3float %float_3 %float_4 %float_5
%float_6 = OpConstant %float 6
%float_7 = OpConstant %float 7
%float_8 = OpConstant %float 8
- %15 = OpConstantComposite %v3float %float_6 %float_7 %float_8
+ %47 = OpConstantComposite %v3float %float_6 %float_7 %float_8
%float_9 = OpConstant %float 9
%float_10 = OpConstant %float 10
%float_11 = OpConstant %float 11
- %19 = OpConstantComposite %v3float %float_9 %float_10 %float_11
- %20 = OpConstantComposite %mat4v3float %7 %11 %15 %19
-%_ptr_Private_mat4v3float = OpTypePointer Private %mat4v3float
- %m = OpVariable %_ptr_Private_mat4v3float Private %20
- %void = OpTypeVoid
- %23 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %23
- %26 = OpLabel
+ %51 = OpConstantComposite %v3float %float_9 %float_10 %float_11
+ %52 = OpConstantComposite %mat4v3float %39 %43 %47 %51
+%assign_and_preserve_padding_out = OpFunction %void None %7
+ %value = OpFunctionParameter %mat4v3float
+ %11 = OpLabel
+ %17 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %15
+ %19 = OpCompositeExtract %v3float %value 0
+ OpStore %17 %19
+ %21 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_1
+ %23 = OpCompositeExtract %v3float %value 1
+ OpStore %21 %23
+ %25 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_2
+ %27 = OpCompositeExtract %v3float %value 2
+ OpStore %25 %27
+ %29 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_3
+ %31 = OpCompositeExtract %v3float %value 3
+ OpStore %29 %31
+ OpReturn
+ OpFunctionEnd
+ %f = OpFunction %void None %32
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %assign_and_preserve_padding_out %52
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/abstract-float.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/abstract-float.wgsl.expected.wgsl
index b8f80a7..4e54e99 100644
--- a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/abstract-float.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/abstract-float.wgsl.expected.wgsl
@@ -1 +1,8 @@
-var<private> m = mat4x3(0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0);
+const m = mat4x3(0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0);
+
+@group(0) @binding(0) var<storage, read_write> out : mat4x3<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f16.wgsl b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f16.wgsl
index 29609a1..b87ebb0 100644
--- a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f16.wgsl
@@ -3,3 +3,11 @@
3.0h, 4.0h, 5.0h,
6.0h, 7.0h, 8.0h,
9.0h, 10.0h, 11.0h);
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat4x3<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f16.wgsl.expected.dxc.hlsl
index 3fd1b03..8f187eb 100644
--- a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f16.wgsl.expected.dxc.hlsl
@@ -1,6 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 4, 3> m = matrix<float16_t, 4, 3>(vector<float16_t, 3>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector<float16_t, 3>(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)), vector<float16_t, 3>(float16_t(6.0h), float16_t(7.0h), float16_t(8.0h)), vector<float16_t, 3>(float16_t(9.0h), float16_t(10.0h), float16_t(11.0h)));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 4, 3> value) {
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 8u), value[1u]);
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 16u), value[2u]);
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 24u), value[3u]);
}
-static matrix<float16_t, 4, 3> m = matrix<float16_t, 4, 3>(vector<float16_t, 3>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector<float16_t, 3>(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)), vector<float16_t, 3>(float16_t(6.0h), float16_t(7.0h), float16_t(8.0h)), vector<float16_t, 3>(float16_t(9.0h), float16_t(10.0h), float16_t(11.0h)));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f16.wgsl.expected.glsl
index 962c5ea..83549f1 100644
--- a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f16.wgsl.expected.glsl
@@ -1,8 +1,24 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
+f16mat4x3 m = f16mat4x3(f16vec3(0.0hf, 1.0hf, 2.0hf), f16vec3(3.0hf, 4.0hf, 5.0hf), f16vec3(6.0hf, 7.0hf, 8.0hf), f16vec3(9.0hf, 10.0hf, 11.0hf));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat4x3 inner;
+} tint_symbol;
+
+void assign_and_preserve_padding_tint_symbol(f16mat4x3 value) {
+ tint_symbol.inner[0] = value[0u];
+ tint_symbol.inner[1] = value[1u];
+ tint_symbol.inner[2] = value[2u];
+ tint_symbol.inner[3] = value[3u];
+}
+
+void f() {
+ assign_and_preserve_padding_tint_symbol(m);
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-f16mat4x3 m = f16mat4x3(f16vec3(0.0hf, 1.0hf, 2.0hf), f16vec3(3.0hf, 4.0hf, 5.0hf), f16vec3(6.0hf, 7.0hf, 8.0hf), f16vec3(9.0hf, 10.0hf, 11.0hf));
diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f16.wgsl.expected.msl
index 7c59d76..d662b9c 100644
--- a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f16.wgsl.expected.msl
@@ -1,7 +1,39 @@
#include <metal_stdlib>
using namespace metal;
+
+template<typename T, size_t N>
+struct tint_array {
+ const constant T& operator[](size_t i) const constant { return elements[i]; }
+ device T& operator[](size_t i) device { return elements[i]; }
+ const device T& operator[](size_t i) const device { return elements[i]; }
+ thread T& operator[](size_t i) thread { return elements[i]; }
+ const thread T& operator[](size_t i) const thread { return elements[i]; }
+ threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+ const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+ T elements[N];
+};
+
struct tint_private_vars_struct {
half4x3 m;
};
+struct tint_packed_vec3_f16_array_element {
+ /* 0x0000 */ packed_half3 elements;
+ /* 0x0006 */ tint_array<int8_t, 2> tint_pad;
+};
+
+void assign_and_preserve_padding(device tint_array<tint_packed_vec3_f16_array_element, 4>* const dest, half4x3 value) {
+ (*(dest))[0u].elements = packed_half3(value[0u]);
+ (*(dest))[1u].elements = packed_half3(value[1u]);
+ (*(dest))[2u].elements = packed_half3(value[2u]);
+ (*(dest))[3u].elements = packed_half3(value[3u]);
+}
+
+kernel void f(device tint_array<tint_packed_vec3_f16_array_element, 4>* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half4x3(half3(0.0h, 1.0h, 2.0h), half3(3.0h, 4.0h, 5.0h), half3(6.0h, 7.0h, 8.0h), half3(9.0h, 10.0h, 11.0h));
+ assign_and_preserve_padding(tint_symbol, tint_private_vars.m);
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f16.wgsl.expected.spvasm
index cec0264..1aa4b68 100644
--- a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 27
+; Bound: 56
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,10 +9,21 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %assign_and_preserve_padding_out "assign_and_preserve_padding_out"
+ OpName %value "value"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v3half = OpTypeVector %half 3
%mat4v3half = OpTypeMatrix %v3half 4
@@ -35,9 +46,44 @@
%20 = OpConstantComposite %mat4v3half %7 %11 %15 %19
%_ptr_Private_mat4v3half = OpTypePointer Private %mat4v3half
%m = OpVariable %_ptr_Private_mat4v3half Private %20
+ %out_block = OpTypeStruct %mat4v3half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %23 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %23
- %26 = OpLabel
+ %26 = OpTypeFunction %void %mat4v3half
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %34 = OpConstantNull %int
+%_ptr_StorageBuffer_v3half = OpTypePointer StorageBuffer %v3half
+ %37 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+ %int_2 = OpConstant %int 2
+ %uint_2 = OpConstant %uint 2
+ %int_3 = OpConstant %int 3
+ %uint_3 = OpConstant %uint 3
+ %51 = OpTypeFunction %void
+%assign_and_preserve_padding_out = OpFunction %void None %26
+ %value = OpFunctionParameter %mat4v3half
+ %30 = OpLabel
+ %36 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %34
+ %38 = OpCompositeExtract %v3half %value 0
+ OpStore %36 %38
+ %40 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %int_1
+ %42 = OpCompositeExtract %v3half %value 1
+ OpStore %40 %42
+ %44 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %int_2
+ %46 = OpCompositeExtract %v3half %value 2
+ OpStore %44 %46
+ %48 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %int_3
+ %50 = OpCompositeExtract %v3half %value 3
+ OpStore %48 %50
+ OpReturn
+ OpFunctionEnd
+ %f = OpFunction %void None %51
+ %53 = OpLabel
+ %55 = OpLoad %mat4v3half %m
+ %54 = OpFunctionCall %void %assign_and_preserve_padding_out %55
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f16.wgsl.expected.wgsl
index 71b04e6..2101398 100644
--- a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f16.wgsl.expected.wgsl
@@ -1,3 +1,10 @@
enable f16;
var<private> m = mat4x3(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h, 8.0h, 9.0h, 10.0h, 11.0h);
+
+@group(0) @binding(0) var<storage, read_write> out : mat4x3<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl
index dfa9afe..598d2da 100644
--- a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl
@@ -2,3 +2,11 @@
3.0f, 4.0f, 5.0f,
6.0f, 7.0f, 8.0f,
9.0f, 10.0f, 11.0f);
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat4x3<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl.expected.dxc.hlsl
index 6b34e6e..0490538 100644
--- a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl.expected.dxc.hlsl
@@ -1,6 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float4x3 m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store3((offset + 32u), asuint(value[2u]));
+ tint_symbol.Store3((offset + 48u), asuint(value[3u]));
}
-static float4x3 m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl.expected.fxc.hlsl
index 6b34e6e..0490538 100644
--- a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl.expected.fxc.hlsl
@@ -1,6 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float4x3 m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store3((offset + 32u), asuint(value[2u]));
+ tint_symbol.Store3((offset + 48u), asuint(value[3u]));
}
-static float4x3 m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl.expected.glsl
index 06560c7..eff2b7f 100644
--- a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl.expected.glsl
@@ -1,7 +1,23 @@
#version 310 es
+mat4x3 m = mat4x3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f), vec3(6.0f, 7.0f, 8.0f), vec3(9.0f, 10.0f, 11.0f));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat4x3 inner;
+} tint_symbol;
+
+void assign_and_preserve_padding_tint_symbol(mat4x3 value) {
+ tint_symbol.inner[0] = value[0u];
+ tint_symbol.inner[1] = value[1u];
+ tint_symbol.inner[2] = value[2u];
+ tint_symbol.inner[3] = value[3u];
+}
+
+void f() {
+ assign_and_preserve_padding_tint_symbol(m);
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat4x3 m = mat4x3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f), vec3(6.0f, 7.0f, 8.0f), vec3(9.0f, 10.0f, 11.0f));
diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl.expected.msl
index 7438c62..cebc171 100644
--- a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl.expected.msl
@@ -1,7 +1,39 @@
#include <metal_stdlib>
using namespace metal;
+
+template<typename T, size_t N>
+struct tint_array {
+ const constant T& operator[](size_t i) const constant { return elements[i]; }
+ device T& operator[](size_t i) device { return elements[i]; }
+ const device T& operator[](size_t i) const device { return elements[i]; }
+ thread T& operator[](size_t i) thread { return elements[i]; }
+ const thread T& operator[](size_t i) const thread { return elements[i]; }
+ threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+ const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+ T elements[N];
+};
+
struct tint_private_vars_struct {
float4x3 m;
};
+struct tint_packed_vec3_f32_array_element {
+ /* 0x0000 */ packed_float3 elements;
+ /* 0x000c */ tint_array<int8_t, 4> tint_pad;
+};
+
+void assign_and_preserve_padding(device tint_array<tint_packed_vec3_f32_array_element, 4>* const dest, float4x3 value) {
+ (*(dest))[0u].elements = packed_float3(value[0u]);
+ (*(dest))[1u].elements = packed_float3(value[1u]);
+ (*(dest))[2u].elements = packed_float3(value[2u]);
+ (*(dest))[3u].elements = packed_float3(value[3u]);
+}
+
+kernel void f(device tint_array<tint_packed_vec3_f32_array_element, 4>* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f));
+ assign_and_preserve_padding(tint_symbol, tint_private_vars.m);
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl.expected.spvasm
index f5592ed..239d024 100644
--- a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl.expected.spvasm
@@ -1,14 +1,25 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 27
+; Bound: 56
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %assign_and_preserve_padding_out "assign_and_preserve_padding_out"
+ OpName %value "value"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%mat4v3float = OpTypeMatrix %v3float 4
@@ -31,9 +42,44 @@
%20 = OpConstantComposite %mat4v3float %7 %11 %15 %19
%_ptr_Private_mat4v3float = OpTypePointer Private %mat4v3float
%m = OpVariable %_ptr_Private_mat4v3float Private %20
+ %out_block = OpTypeStruct %mat4v3float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %23 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %23
- %26 = OpLabel
+ %26 = OpTypeFunction %void %mat4v3float
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %34 = OpConstantNull %int
+%_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float
+ %37 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+ %int_2 = OpConstant %int 2
+ %uint_2 = OpConstant %uint 2
+ %int_3 = OpConstant %int 3
+ %uint_3 = OpConstant %uint 3
+ %51 = OpTypeFunction %void
+%assign_and_preserve_padding_out = OpFunction %void None %26
+ %value = OpFunctionParameter %mat4v3float
+ %30 = OpLabel
+ %36 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %34
+ %38 = OpCompositeExtract %v3float %value 0
+ OpStore %36 %38
+ %40 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_1
+ %42 = OpCompositeExtract %v3float %value 1
+ OpStore %40 %42
+ %44 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_2
+ %46 = OpCompositeExtract %v3float %value 2
+ OpStore %44 %46
+ %48 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_3
+ %50 = OpCompositeExtract %v3float %value 3
+ OpStore %48 %50
+ OpReturn
+ OpFunctionEnd
+ %f = OpFunction %void None %51
+ %53 = OpLabel
+ %55 = OpLoad %mat4v3float %m
+ %54 = OpFunctionCall %void %assign_and_preserve_padding_out %55
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl.expected.wgsl
index 11bbddb..1caad14 100644
--- a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl.expected.wgsl
@@ -1 +1,8 @@
var<private> m = mat4x3(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f);
+
+@group(0) @binding(0) var<storage, read_write> out : mat4x3<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/abstract-float.wgsl b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/abstract-float.wgsl
index cd71d8c..51b9413 100644
--- a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/abstract-float.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/abstract-float.wgsl
@@ -1,4 +1,12 @@
-var<private> m = mat4x3(vec3(0.0, 1.0, 2.0),
- vec3(3.0, 4.0, 5.0),
- vec3(6.0, 7.0, 8.0),
- vec3(9.0, 10.0, 11.0));
+const m = mat4x3(vec3(0.0, 1.0, 2.0),
+ vec3(3.0, 4.0, 5.0),
+ vec3(6.0, 7.0, 8.0),
+ vec3(9.0, 10.0, 11.0));
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat4x3<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl
index 6b34e6e..767a0fb 100644
--- a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store3((offset + 32u), asuint(value[2u]));
+ tint_symbol.Store3((offset + 48u), asuint(value[3u]));
}
-static float4x3 m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f)));
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl
index 6b34e6e..767a0fb 100644
--- a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store3((offset + 32u), asuint(value[2u]));
+ tint_symbol.Store3((offset + 48u), asuint(value[3u]));
}
-static float4x3 m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f)));
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/abstract-float.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/abstract-float.wgsl.expected.glsl
index 06560c7..07e18dd 100644
--- a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/abstract-float.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/abstract-float.wgsl.expected.glsl
@@ -1,7 +1,22 @@
#version 310 es
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat4x3 inner;
+} tint_symbol;
+
+void assign_and_preserve_padding_tint_symbol(mat4x3 value) {
+ tint_symbol.inner[0] = value[0u];
+ tint_symbol.inner[1] = value[1u];
+ tint_symbol.inner[2] = value[2u];
+ tint_symbol.inner[3] = value[3u];
+}
+
+void f() {
+ assign_and_preserve_padding_tint_symbol(mat4x3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f), vec3(6.0f, 7.0f, 8.0f), vec3(9.0f, 10.0f, 11.0f)));
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat4x3 m = mat4x3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f), vec3(6.0f, 7.0f, 8.0f), vec3(9.0f, 10.0f, 11.0f));
diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/abstract-float.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/abstract-float.wgsl.expected.msl
index 7438c62..1ea325e 100644
--- a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/abstract-float.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/abstract-float.wgsl.expected.msl
@@ -1,7 +1,33 @@
#include <metal_stdlib>
using namespace metal;
-struct tint_private_vars_struct {
- float4x3 m;
+
+template<typename T, size_t N>
+struct tint_array {
+ const constant T& operator[](size_t i) const constant { return elements[i]; }
+ device T& operator[](size_t i) device { return elements[i]; }
+ const device T& operator[](size_t i) const device { return elements[i]; }
+ thread T& operator[](size_t i) thread { return elements[i]; }
+ const thread T& operator[](size_t i) const thread { return elements[i]; }
+ threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+ const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+ T elements[N];
};
+struct tint_packed_vec3_f32_array_element {
+ /* 0x0000 */ packed_float3 elements;
+ /* 0x000c */ tint_array<int8_t, 4> tint_pad;
+};
+
+void assign_and_preserve_padding(device tint_array<tint_packed_vec3_f32_array_element, 4>* const dest, float4x3 value) {
+ (*(dest))[0u].elements = packed_float3(value[0u]);
+ (*(dest))[1u].elements = packed_float3(value[1u]);
+ (*(dest))[2u].elements = packed_float3(value[2u]);
+ (*(dest))[3u].elements = packed_float3(value[3u]);
+}
+
+kernel void f(device tint_array<tint_packed_vec3_f32_array_element, 4>* tint_symbol [[buffer(0)]]) {
+ assign_and_preserve_padding(tint_symbol, float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f)));
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/abstract-float.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/abstract-float.wgsl.expected.spvasm
index f5592ed..35d3339 100644
--- a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/abstract-float.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/abstract-float.wgsl.expected.spvasm
@@ -1,39 +1,81 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 27
+; Bound: 53
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
- OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %assign_and_preserve_padding_out "assign_and_preserve_padding_out"
+ OpName %value "value"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%mat4v3float = OpTypeMatrix %v3float 4
- %4 = OpConstantNull %float
+ %out_block = OpTypeStruct %mat4v3float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void %mat4v3float
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %15 = OpConstantNull %int
+%_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float
+ %18 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+ %int_2 = OpConstant %int 2
+ %uint_2 = OpConstant %uint 2
+ %int_3 = OpConstant %int 3
+ %uint_3 = OpConstant %uint 3
+ %32 = OpTypeFunction %void
+ %36 = OpConstantNull %float
%float_1 = OpConstant %float 1
%float_2 = OpConstant %float 2
- %7 = OpConstantComposite %v3float %4 %float_1 %float_2
+ %39 = OpConstantComposite %v3float %36 %float_1 %float_2
%float_3 = OpConstant %float 3
%float_4 = OpConstant %float 4
%float_5 = OpConstant %float 5
- %11 = OpConstantComposite %v3float %float_3 %float_4 %float_5
+ %43 = OpConstantComposite %v3float %float_3 %float_4 %float_5
%float_6 = OpConstant %float 6
%float_7 = OpConstant %float 7
%float_8 = OpConstant %float 8
- %15 = OpConstantComposite %v3float %float_6 %float_7 %float_8
+ %47 = OpConstantComposite %v3float %float_6 %float_7 %float_8
%float_9 = OpConstant %float 9
%float_10 = OpConstant %float 10
%float_11 = OpConstant %float 11
- %19 = OpConstantComposite %v3float %float_9 %float_10 %float_11
- %20 = OpConstantComposite %mat4v3float %7 %11 %15 %19
-%_ptr_Private_mat4v3float = OpTypePointer Private %mat4v3float
- %m = OpVariable %_ptr_Private_mat4v3float Private %20
- %void = OpTypeVoid
- %23 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %23
- %26 = OpLabel
+ %51 = OpConstantComposite %v3float %float_9 %float_10 %float_11
+ %52 = OpConstantComposite %mat4v3float %39 %43 %47 %51
+%assign_and_preserve_padding_out = OpFunction %void None %7
+ %value = OpFunctionParameter %mat4v3float
+ %11 = OpLabel
+ %17 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %15
+ %19 = OpCompositeExtract %v3float %value 0
+ OpStore %17 %19
+ %21 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_1
+ %23 = OpCompositeExtract %v3float %value 1
+ OpStore %21 %23
+ %25 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_2
+ %27 = OpCompositeExtract %v3float %value 2
+ OpStore %25 %27
+ %29 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_3
+ %31 = OpCompositeExtract %v3float %value 3
+ OpStore %29 %31
+ OpReturn
+ OpFunctionEnd
+ %f = OpFunction %void None %32
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %assign_and_preserve_padding_out %52
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/abstract-float.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/abstract-float.wgsl.expected.wgsl
index 2ec81b0..37e0766 100644
--- a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/abstract-float.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/abstract-float.wgsl.expected.wgsl
@@ -1 +1,8 @@
-var<private> m = mat4x3(vec3(0.0, 1.0, 2.0), vec3(3.0, 4.0, 5.0), vec3(6.0, 7.0, 8.0), vec3(9.0, 10.0, 11.0));
+const m = mat4x3(vec3(0.0, 1.0, 2.0), vec3(3.0, 4.0, 5.0), vec3(6.0, 7.0, 8.0), vec3(9.0, 10.0, 11.0));
+
+@group(0) @binding(0) var<storage, read_write> out : mat4x3<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f16.wgsl b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f16.wgsl
index 60dc832..7e28464 100644
--- a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f16.wgsl
@@ -3,3 +3,11 @@
vec3<f16>(3.0h, 4.0h, 5.0h),
vec3<f16>(6.0h, 7.0h, 8.0h),
vec3<f16>(9.0h, 10.0h, 11.0h));
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat4x3<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f16.wgsl.expected.dxc.hlsl
index 3fd1b03..8f187eb 100644
--- a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f16.wgsl.expected.dxc.hlsl
@@ -1,6 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 4, 3> m = matrix<float16_t, 4, 3>(vector<float16_t, 3>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector<float16_t, 3>(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)), vector<float16_t, 3>(float16_t(6.0h), float16_t(7.0h), float16_t(8.0h)), vector<float16_t, 3>(float16_t(9.0h), float16_t(10.0h), float16_t(11.0h)));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 4, 3> value) {
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 8u), value[1u]);
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 16u), value[2u]);
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 24u), value[3u]);
}
-static matrix<float16_t, 4, 3> m = matrix<float16_t, 4, 3>(vector<float16_t, 3>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector<float16_t, 3>(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)), vector<float16_t, 3>(float16_t(6.0h), float16_t(7.0h), float16_t(8.0h)), vector<float16_t, 3>(float16_t(9.0h), float16_t(10.0h), float16_t(11.0h)));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f16.wgsl.expected.glsl
index 962c5ea..83549f1 100644
--- a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f16.wgsl.expected.glsl
@@ -1,8 +1,24 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
+f16mat4x3 m = f16mat4x3(f16vec3(0.0hf, 1.0hf, 2.0hf), f16vec3(3.0hf, 4.0hf, 5.0hf), f16vec3(6.0hf, 7.0hf, 8.0hf), f16vec3(9.0hf, 10.0hf, 11.0hf));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat4x3 inner;
+} tint_symbol;
+
+void assign_and_preserve_padding_tint_symbol(f16mat4x3 value) {
+ tint_symbol.inner[0] = value[0u];
+ tint_symbol.inner[1] = value[1u];
+ tint_symbol.inner[2] = value[2u];
+ tint_symbol.inner[3] = value[3u];
+}
+
+void f() {
+ assign_and_preserve_padding_tint_symbol(m);
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-f16mat4x3 m = f16mat4x3(f16vec3(0.0hf, 1.0hf, 2.0hf), f16vec3(3.0hf, 4.0hf, 5.0hf), f16vec3(6.0hf, 7.0hf, 8.0hf), f16vec3(9.0hf, 10.0hf, 11.0hf));
diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f16.wgsl.expected.msl
index 7c59d76..d662b9c 100644
--- a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f16.wgsl.expected.msl
@@ -1,7 +1,39 @@
#include <metal_stdlib>
using namespace metal;
+
+template<typename T, size_t N>
+struct tint_array {
+ const constant T& operator[](size_t i) const constant { return elements[i]; }
+ device T& operator[](size_t i) device { return elements[i]; }
+ const device T& operator[](size_t i) const device { return elements[i]; }
+ thread T& operator[](size_t i) thread { return elements[i]; }
+ const thread T& operator[](size_t i) const thread { return elements[i]; }
+ threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+ const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+ T elements[N];
+};
+
struct tint_private_vars_struct {
half4x3 m;
};
+struct tint_packed_vec3_f16_array_element {
+ /* 0x0000 */ packed_half3 elements;
+ /* 0x0006 */ tint_array<int8_t, 2> tint_pad;
+};
+
+void assign_and_preserve_padding(device tint_array<tint_packed_vec3_f16_array_element, 4>* const dest, half4x3 value) {
+ (*(dest))[0u].elements = packed_half3(value[0u]);
+ (*(dest))[1u].elements = packed_half3(value[1u]);
+ (*(dest))[2u].elements = packed_half3(value[2u]);
+ (*(dest))[3u].elements = packed_half3(value[3u]);
+}
+
+kernel void f(device tint_array<tint_packed_vec3_f16_array_element, 4>* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half4x3(half3(0.0h, 1.0h, 2.0h), half3(3.0h, 4.0h, 5.0h), half3(6.0h, 7.0h, 8.0h), half3(9.0h, 10.0h, 11.0h));
+ assign_and_preserve_padding(tint_symbol, tint_private_vars.m);
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f16.wgsl.expected.spvasm
index cec0264..1aa4b68 100644
--- a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 27
+; Bound: 56
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,10 +9,21 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %assign_and_preserve_padding_out "assign_and_preserve_padding_out"
+ OpName %value "value"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v3half = OpTypeVector %half 3
%mat4v3half = OpTypeMatrix %v3half 4
@@ -35,9 +46,44 @@
%20 = OpConstantComposite %mat4v3half %7 %11 %15 %19
%_ptr_Private_mat4v3half = OpTypePointer Private %mat4v3half
%m = OpVariable %_ptr_Private_mat4v3half Private %20
+ %out_block = OpTypeStruct %mat4v3half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %23 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %23
- %26 = OpLabel
+ %26 = OpTypeFunction %void %mat4v3half
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %34 = OpConstantNull %int
+%_ptr_StorageBuffer_v3half = OpTypePointer StorageBuffer %v3half
+ %37 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+ %int_2 = OpConstant %int 2
+ %uint_2 = OpConstant %uint 2
+ %int_3 = OpConstant %int 3
+ %uint_3 = OpConstant %uint 3
+ %51 = OpTypeFunction %void
+%assign_and_preserve_padding_out = OpFunction %void None %26
+ %value = OpFunctionParameter %mat4v3half
+ %30 = OpLabel
+ %36 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %34
+ %38 = OpCompositeExtract %v3half %value 0
+ OpStore %36 %38
+ %40 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %int_1
+ %42 = OpCompositeExtract %v3half %value 1
+ OpStore %40 %42
+ %44 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %int_2
+ %46 = OpCompositeExtract %v3half %value 2
+ OpStore %44 %46
+ %48 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %int_3
+ %50 = OpCompositeExtract %v3half %value 3
+ OpStore %48 %50
+ OpReturn
+ OpFunctionEnd
+ %f = OpFunction %void None %51
+ %53 = OpLabel
+ %55 = OpLoad %mat4v3half %m
+ %54 = OpFunctionCall %void %assign_and_preserve_padding_out %55
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f16.wgsl.expected.wgsl
index 5752080..6d0d2c7 100644
--- a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f16.wgsl.expected.wgsl
@@ -1,3 +1,10 @@
enable f16;
var<private> m = mat4x3(vec3<f16>(0.0h, 1.0h, 2.0h), vec3<f16>(3.0h, 4.0h, 5.0h), vec3<f16>(6.0h, 7.0h, 8.0h), vec3<f16>(9.0h, 10.0h, 11.0h));
+
+@group(0) @binding(0) var<storage, read_write> out : mat4x3<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl
index f55af6c..2ad5341 100644
--- a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl
@@ -2,3 +2,11 @@
vec3<f32>(3.0f, 4.0f, 5.0f),
vec3<f32>(6.0f, 7.0f, 8.0f),
vec3<f32>(9.0f, 10.0f, 11.0f));
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat4x3<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl.expected.dxc.hlsl
index 6b34e6e..0490538 100644
--- a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl.expected.dxc.hlsl
@@ -1,6 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float4x3 m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store3((offset + 32u), asuint(value[2u]));
+ tint_symbol.Store3((offset + 48u), asuint(value[3u]));
}
-static float4x3 m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl.expected.fxc.hlsl
index 6b34e6e..0490538 100644
--- a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl.expected.fxc.hlsl
@@ -1,6 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float4x3 m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store3((offset + 32u), asuint(value[2u]));
+ tint_symbol.Store3((offset + 48u), asuint(value[3u]));
}
-static float4x3 m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl.expected.glsl
index 06560c7..eff2b7f 100644
--- a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl.expected.glsl
@@ -1,7 +1,23 @@
#version 310 es
+mat4x3 m = mat4x3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f), vec3(6.0f, 7.0f, 8.0f), vec3(9.0f, 10.0f, 11.0f));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat4x3 inner;
+} tint_symbol;
+
+void assign_and_preserve_padding_tint_symbol(mat4x3 value) {
+ tint_symbol.inner[0] = value[0u];
+ tint_symbol.inner[1] = value[1u];
+ tint_symbol.inner[2] = value[2u];
+ tint_symbol.inner[3] = value[3u];
+}
+
+void f() {
+ assign_and_preserve_padding_tint_symbol(m);
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat4x3 m = mat4x3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f), vec3(6.0f, 7.0f, 8.0f), vec3(9.0f, 10.0f, 11.0f));
diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl.expected.msl
index 7438c62..cebc171 100644
--- a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl.expected.msl
@@ -1,7 +1,39 @@
#include <metal_stdlib>
using namespace metal;
+
+template<typename T, size_t N>
+struct tint_array {
+ const constant T& operator[](size_t i) const constant { return elements[i]; }
+ device T& operator[](size_t i) device { return elements[i]; }
+ const device T& operator[](size_t i) const device { return elements[i]; }
+ thread T& operator[](size_t i) thread { return elements[i]; }
+ const thread T& operator[](size_t i) const thread { return elements[i]; }
+ threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+ const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+ T elements[N];
+};
+
struct tint_private_vars_struct {
float4x3 m;
};
+struct tint_packed_vec3_f32_array_element {
+ /* 0x0000 */ packed_float3 elements;
+ /* 0x000c */ tint_array<int8_t, 4> tint_pad;
+};
+
+void assign_and_preserve_padding(device tint_array<tint_packed_vec3_f32_array_element, 4>* const dest, float4x3 value) {
+ (*(dest))[0u].elements = packed_float3(value[0u]);
+ (*(dest))[1u].elements = packed_float3(value[1u]);
+ (*(dest))[2u].elements = packed_float3(value[2u]);
+ (*(dest))[3u].elements = packed_float3(value[3u]);
+}
+
+kernel void f(device tint_array<tint_packed_vec3_f32_array_element, 4>* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f));
+ assign_and_preserve_padding(tint_symbol, tint_private_vars.m);
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl.expected.spvasm
index f5592ed..239d024 100644
--- a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl.expected.spvasm
@@ -1,14 +1,25 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 27
+; Bound: 56
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %assign_and_preserve_padding_out "assign_and_preserve_padding_out"
+ OpName %value "value"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%mat4v3float = OpTypeMatrix %v3float 4
@@ -31,9 +42,44 @@
%20 = OpConstantComposite %mat4v3float %7 %11 %15 %19
%_ptr_Private_mat4v3float = OpTypePointer Private %mat4v3float
%m = OpVariable %_ptr_Private_mat4v3float Private %20
+ %out_block = OpTypeStruct %mat4v3float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %23 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %23
- %26 = OpLabel
+ %26 = OpTypeFunction %void %mat4v3float
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %34 = OpConstantNull %int
+%_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float
+ %37 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+ %int_2 = OpConstant %int 2
+ %uint_2 = OpConstant %uint 2
+ %int_3 = OpConstant %int 3
+ %uint_3 = OpConstant %uint 3
+ %51 = OpTypeFunction %void
+%assign_and_preserve_padding_out = OpFunction %void None %26
+ %value = OpFunctionParameter %mat4v3float
+ %30 = OpLabel
+ %36 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %34
+ %38 = OpCompositeExtract %v3float %value 0
+ OpStore %36 %38
+ %40 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_1
+ %42 = OpCompositeExtract %v3float %value 1
+ OpStore %40 %42
+ %44 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_2
+ %46 = OpCompositeExtract %v3float %value 2
+ OpStore %44 %46
+ %48 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_3
+ %50 = OpCompositeExtract %v3float %value 3
+ OpStore %48 %50
+ OpReturn
+ OpFunctionEnd
+ %f = OpFunction %void None %51
+ %53 = OpLabel
+ %55 = OpLoad %mat4v3float %m
+ %54 = OpFunctionCall %void %assign_and_preserve_padding_out %55
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl.expected.wgsl
index 7eb4b32..8a11732 100644
--- a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl.expected.wgsl
@@ -1 +1,8 @@
var<private> m = mat4x3(vec3<f32>(0.0f, 1.0f, 2.0f), vec3<f32>(3.0f, 4.0f, 5.0f), vec3<f32>(6.0f, 7.0f, 8.0f), vec3<f32>(9.0f, 10.0f, 11.0f));
+
+@group(0) @binding(0) var<storage, read_write> out : mat4x3<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x3/load/f16.wgsl b/test/tint/expressions/type_ctor/mat4x3/load/f16.wgsl
index 7afb798..cd1747d 100644
--- a/test/tint/expressions/type_ctor/mat4x3/load/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x3/load/f16.wgsl
@@ -1,5 +1,10 @@
enable f16;
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat4x3<f16>;
+
+@compute @workgroup_size(1)
fn f() {
- var m = mat4x3<f16>();
- let m_1 = mat4x3(m);
+ var m = mat4x3<f16>();
+ out = mat4x3(m);
}
diff --git a/test/tint/expressions/type_ctor/mat4x3/load/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/load/f16.wgsl.expected.dxc.hlsl
index 4e84ac5..b549f2a 100644
--- a/test/tint/expressions/type_ctor/mat4x3/load/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x3/load/f16.wgsl.expected.dxc.hlsl
@@ -1,9 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 4, 3> value) {
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 8u), value[1u]);
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 16u), value[2u]);
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 24u), value[3u]);
}
+[numthreads(1, 1, 1)]
void f() {
matrix<float16_t, 4, 3> m = matrix<float16_t, 4, 3>((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx);
- const matrix<float16_t, 4, 3> m_1 = matrix<float16_t, 4, 3>(m);
+ tint_symbol_store(0u, matrix<float16_t, 4, 3>(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat4x3/load/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x3/load/f16.wgsl.expected.glsl
index 38e2182..f44ed54 100644
--- a/test/tint/expressions/type_ctor/mat4x3/load/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat4x3/load/f16.wgsl.expected.glsl
@@ -1,12 +1,24 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
- return;
-}
-void f() {
- f16mat4x3 m = f16mat4x3(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf));
- f16mat4x3 m_1 = f16mat4x3(m);
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat4x3 inner;
+} tint_symbol;
+
+void assign_and_preserve_padding_tint_symbol(f16mat4x3 value) {
+ tint_symbol.inner[0] = value[0u];
+ tint_symbol.inner[1] = value[1u];
+ tint_symbol.inner[2] = value[2u];
+ tint_symbol.inner[3] = value[3u];
}
+void f() {
+ f16mat4x3 m = f16mat4x3(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf));
+ assign_and_preserve_padding_tint_symbol(f16mat4x3(m));
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ f();
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x3/load/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x3/load/f16.wgsl.expected.msl
index 0f11ff8..ff8c354 100644
--- a/test/tint/expressions/type_ctor/mat4x3/load/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat4x3/load/f16.wgsl.expected.msl
@@ -1,8 +1,34 @@
#include <metal_stdlib>
using namespace metal;
-void f() {
+
+template<typename T, size_t N>
+struct tint_array {
+ const constant T& operator[](size_t i) const constant { return elements[i]; }
+ device T& operator[](size_t i) device { return elements[i]; }
+ const device T& operator[](size_t i) const device { return elements[i]; }
+ thread T& operator[](size_t i) thread { return elements[i]; }
+ const thread T& operator[](size_t i) const thread { return elements[i]; }
+ threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+ const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+ T elements[N];
+};
+
+struct tint_packed_vec3_f16_array_element {
+ /* 0x0000 */ packed_half3 elements;
+ /* 0x0006 */ tint_array<int8_t, 2> tint_pad;
+};
+
+void assign_and_preserve_padding(device tint_array<tint_packed_vec3_f16_array_element, 4>* const dest, half4x3 value) {
+ (*(dest))[0u].elements = packed_half3(value[0u]);
+ (*(dest))[1u].elements = packed_half3(value[1u]);
+ (*(dest))[2u].elements = packed_half3(value[2u]);
+ (*(dest))[3u].elements = packed_half3(value[3u]);
+}
+
+kernel void f(device tint_array<tint_packed_vec3_f16_array_element, 4>* tint_symbol [[buffer(0)]]) {
half4x3 m = half4x3(half3(0.0h), half3(0.0h), half3(0.0h), half3(0.0h));
- half4x3 const m_1 = half4x3(m);
+ assign_and_preserve_padding(tint_symbol, half4x3(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat4x3/load/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x3/load/f16.wgsl.expected.spvasm
index 0326b42..21b04fe 100644
--- a/test/tint/expressions/type_ctor/mat4x3/load/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat4x3/load/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 15
+; Bound: 41
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,26 +9,66 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
- OpName %unused_entry_point "unused_entry_point"
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %assign_and_preserve_padding_out "assign_and_preserve_padding_out"
+ OpName %value "value"
OpName %f "f"
OpName %m "m"
- %void = OpTypeVoid
- %1 = OpTypeFunction %void
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v3half = OpTypeVector %half 3
%mat4v3half = OpTypeMatrix %v3half 4
- %10 = OpConstantNull %mat4v3half
+ %out_block = OpTypeStruct %mat4v3half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void %mat4v3half
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %15 = OpConstantNull %int
+%_ptr_StorageBuffer_v3half = OpTypePointer StorageBuffer %v3half
+ %18 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+ %int_2 = OpConstant %int 2
+ %uint_2 = OpConstant %uint 2
+ %int_3 = OpConstant %int 3
+ %uint_3 = OpConstant %uint 3
+ %32 = OpTypeFunction %void
+ %35 = OpConstantNull %mat4v3half
%_ptr_Function_mat4v3half = OpTypePointer Function %mat4v3half
-%unused_entry_point = OpFunction %void None %1
- %4 = OpLabel
+%assign_and_preserve_padding_out = OpFunction %void None %7
+ %value = OpFunctionParameter %mat4v3half
+ %11 = OpLabel
+ %17 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %15
+ %19 = OpCompositeExtract %v3half %value 0
+ OpStore %17 %19
+ %21 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %int_1
+ %23 = OpCompositeExtract %v3half %value 1
+ OpStore %21 %23
+ %25 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %int_2
+ %27 = OpCompositeExtract %v3half %value 2
+ OpStore %25 %27
+ %29 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %int_3
+ %31 = OpCompositeExtract %v3half %value 3
+ OpStore %29 %31
OpReturn
OpFunctionEnd
- %f = OpFunction %void None %1
- %6 = OpLabel
- %m = OpVariable %_ptr_Function_mat4v3half Function %10
- OpStore %m %10
- %14 = OpLoad %mat4v3half %m
+ %f = OpFunction %void None %32
+ %34 = OpLabel
+ %m = OpVariable %_ptr_Function_mat4v3half Function %35
+ OpStore %m %35
+ %40 = OpLoad %mat4v3half %m
+ %38 = OpFunctionCall %void %assign_and_preserve_padding_out %40
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat4x3/load/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x3/load/f16.wgsl.expected.wgsl
index 2b33625..79aa9ce 100644
--- a/test/tint/expressions/type_ctor/mat4x3/load/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x3/load/f16.wgsl.expected.wgsl
@@ -1,6 +1,9 @@
enable f16;
+@group(0) @binding(0) var<storage, read_write> out : mat4x3<f16>;
+
+@compute @workgroup_size(1)
fn f() {
var m = mat4x3<f16>();
- let m_1 = mat4x3(m);
+ out = mat4x3(m);
}
diff --git a/test/tint/expressions/type_ctor/mat4x3/load/f32.wgsl b/test/tint/expressions/type_ctor/mat4x3/load/f32.wgsl
index 8ac728c..0856f72 100644
--- a/test/tint/expressions/type_ctor/mat4x3/load/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x3/load/f32.wgsl
@@ -1,4 +1,8 @@
+@group(0) @binding(0)
+var<storage, read_write> out : mat4x3<f32>;
+
+@compute @workgroup_size(1)
fn f() {
- var m = mat4x3<f32>();
- let m_1 = mat4x3(m);
+ var m = mat4x3<f32>();
+ out = mat4x3(m);
}
diff --git a/test/tint/expressions/type_ctor/mat4x3/load/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/load/f32.wgsl.expected.dxc.hlsl
index 16edf13..c01c8a1 100644
--- a/test/tint/expressions/type_ctor/mat4x3/load/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x3/load/f32.wgsl.expected.dxc.hlsl
@@ -1,9 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store3((offset + 32u), asuint(value[2u]));
+ tint_symbol.Store3((offset + 48u), asuint(value[3u]));
}
+[numthreads(1, 1, 1)]
void f() {
float4x3 m = float4x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx, (0.0f).xxx);
- const float4x3 m_1 = float4x3(m);
+ tint_symbol_store(0u, float4x3(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat4x3/load/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/load/f32.wgsl.expected.fxc.hlsl
index 16edf13..c01c8a1 100644
--- a/test/tint/expressions/type_ctor/mat4x3/load/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x3/load/f32.wgsl.expected.fxc.hlsl
@@ -1,9 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store3((offset + 32u), asuint(value[2u]));
+ tint_symbol.Store3((offset + 48u), asuint(value[3u]));
}
+[numthreads(1, 1, 1)]
void f() {
float4x3 m = float4x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx, (0.0f).xxx);
- const float4x3 m_1 = float4x3(m);
+ tint_symbol_store(0u, float4x3(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat4x3/load/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x3/load/f32.wgsl.expected.glsl
index 13bad68..cb1ceac 100644
--- a/test/tint/expressions/type_ctor/mat4x3/load/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat4x3/load/f32.wgsl.expected.glsl
@@ -1,11 +1,23 @@
#version 310 es
-layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
- return;
-}
-void f() {
- mat4x3 m = mat4x3(vec3(0.0f), vec3(0.0f), vec3(0.0f), vec3(0.0f));
- mat4x3 m_1 = mat4x3(m);
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat4x3 inner;
+} tint_symbol;
+
+void assign_and_preserve_padding_tint_symbol(mat4x3 value) {
+ tint_symbol.inner[0] = value[0u];
+ tint_symbol.inner[1] = value[1u];
+ tint_symbol.inner[2] = value[2u];
+ tint_symbol.inner[3] = value[3u];
}
+void f() {
+ mat4x3 m = mat4x3(vec3(0.0f), vec3(0.0f), vec3(0.0f), vec3(0.0f));
+ assign_and_preserve_padding_tint_symbol(mat4x3(m));
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ f();
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x3/load/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x3/load/f32.wgsl.expected.msl
index e5a0c7d..2310b7a 100644
--- a/test/tint/expressions/type_ctor/mat4x3/load/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat4x3/load/f32.wgsl.expected.msl
@@ -1,8 +1,34 @@
#include <metal_stdlib>
using namespace metal;
-void f() {
+
+template<typename T, size_t N>
+struct tint_array {
+ const constant T& operator[](size_t i) const constant { return elements[i]; }
+ device T& operator[](size_t i) device { return elements[i]; }
+ const device T& operator[](size_t i) const device { return elements[i]; }
+ thread T& operator[](size_t i) thread { return elements[i]; }
+ const thread T& operator[](size_t i) const thread { return elements[i]; }
+ threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+ const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+ T elements[N];
+};
+
+struct tint_packed_vec3_f32_array_element {
+ /* 0x0000 */ packed_float3 elements;
+ /* 0x000c */ tint_array<int8_t, 4> tint_pad;
+};
+
+void assign_and_preserve_padding(device tint_array<tint_packed_vec3_f32_array_element, 4>* const dest, float4x3 value) {
+ (*(dest))[0u].elements = packed_float3(value[0u]);
+ (*(dest))[1u].elements = packed_float3(value[1u]);
+ (*(dest))[2u].elements = packed_float3(value[2u]);
+ (*(dest))[3u].elements = packed_float3(value[3u]);
+}
+
+kernel void f(device tint_array<tint_packed_vec3_f32_array_element, 4>* tint_symbol [[buffer(0)]]) {
float4x3 m = float4x3(float3(0.0f), float3(0.0f), float3(0.0f), float3(0.0f));
- float4x3 const m_1 = float4x3(m);
+ assign_and_preserve_padding(tint_symbol, float4x3(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat4x3/load/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x3/load/f32.wgsl.expected.spvasm
index 220eba0..c513d9ad 100644
--- a/test/tint/expressions/type_ctor/mat4x3/load/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat4x3/load/f32.wgsl.expected.spvasm
@@ -1,30 +1,70 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 15
+; Bound: 41
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
- OpName %unused_entry_point "unused_entry_point"
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %assign_and_preserve_padding_out "assign_and_preserve_padding_out"
+ OpName %value "value"
OpName %f "f"
OpName %m "m"
- %void = OpTypeVoid
- %1 = OpTypeFunction %void
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%mat4v3float = OpTypeMatrix %v3float 4
- %10 = OpConstantNull %mat4v3float
+ %out_block = OpTypeStruct %mat4v3float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void %mat4v3float
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %15 = OpConstantNull %int
+%_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float
+ %18 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+ %int_2 = OpConstant %int 2
+ %uint_2 = OpConstant %uint 2
+ %int_3 = OpConstant %int 3
+ %uint_3 = OpConstant %uint 3
+ %32 = OpTypeFunction %void
+ %35 = OpConstantNull %mat4v3float
%_ptr_Function_mat4v3float = OpTypePointer Function %mat4v3float
-%unused_entry_point = OpFunction %void None %1
- %4 = OpLabel
+%assign_and_preserve_padding_out = OpFunction %void None %7
+ %value = OpFunctionParameter %mat4v3float
+ %11 = OpLabel
+ %17 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %15
+ %19 = OpCompositeExtract %v3float %value 0
+ OpStore %17 %19
+ %21 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_1
+ %23 = OpCompositeExtract %v3float %value 1
+ OpStore %21 %23
+ %25 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_2
+ %27 = OpCompositeExtract %v3float %value 2
+ OpStore %25 %27
+ %29 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_3
+ %31 = OpCompositeExtract %v3float %value 3
+ OpStore %29 %31
OpReturn
OpFunctionEnd
- %f = OpFunction %void None %1
- %6 = OpLabel
- %m = OpVariable %_ptr_Function_mat4v3float Function %10
- OpStore %m %10
- %14 = OpLoad %mat4v3float %m
+ %f = OpFunction %void None %32
+ %34 = OpLabel
+ %m = OpVariable %_ptr_Function_mat4v3float Function %35
+ OpStore %m %35
+ %40 = OpLoad %mat4v3float %m
+ %38 = OpFunctionCall %void %assign_and_preserve_padding_out %40
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat4x3/load/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x3/load/f32.wgsl.expected.wgsl
index a3186e8..425309b 100644
--- a/test/tint/expressions/type_ctor/mat4x3/load/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x3/load/f32.wgsl.expected.wgsl
@@ -1,4 +1,7 @@
+@group(0) @binding(0) var<storage, read_write> out : mat4x3<f32>;
+
+@compute @workgroup_size(1)
fn f() {
var m = mat4x3<f32>();
- let m_1 = mat4x3(m);
+ out = mat4x3(m);
}
diff --git a/test/tint/expressions/type_ctor/mat4x3/zero/f16.wgsl b/test/tint/expressions/type_ctor/mat4x3/zero/f16.wgsl
index 6f6f3f5..39c4381 100644
--- a/test/tint/expressions/type_ctor/mat4x3/zero/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x3/zero/f16.wgsl
@@ -1,2 +1,10 @@
enable f16;
var<private> m = mat4x3<f16>();
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat4x3<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x3/zero/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/zero/f16.wgsl.expected.dxc.hlsl
index 38327b1..a6dab8a 100644
--- a/test/tint/expressions/type_ctor/mat4x3/zero/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x3/zero/f16.wgsl.expected.dxc.hlsl
@@ -1,6 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 4, 3> m = matrix<float16_t, 4, 3>((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx);
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 4, 3> value) {
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 8u), value[1u]);
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 16u), value[2u]);
+ tint_symbol.Store<vector<float16_t, 3> >((offset + 24u), value[3u]);
}
-static matrix<float16_t, 4, 3> m = matrix<float16_t, 4, 3>((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx);
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x3/zero/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x3/zero/f16.wgsl.expected.glsl
index 094c7e9..f6c3166 100644
--- a/test/tint/expressions/type_ctor/mat4x3/zero/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat4x3/zero/f16.wgsl.expected.glsl
@@ -1,8 +1,24 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
+f16mat4x3 m = f16mat4x3(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat4x3 inner;
+} tint_symbol;
+
+void assign_and_preserve_padding_tint_symbol(f16mat4x3 value) {
+ tint_symbol.inner[0] = value[0u];
+ tint_symbol.inner[1] = value[1u];
+ tint_symbol.inner[2] = value[2u];
+ tint_symbol.inner[3] = value[3u];
+}
+
+void f() {
+ assign_and_preserve_padding_tint_symbol(m);
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-f16mat4x3 m = f16mat4x3(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf));
diff --git a/test/tint/expressions/type_ctor/mat4x3/zero/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x3/zero/f16.wgsl.expected.msl
index 7c59d76..cde9916 100644
--- a/test/tint/expressions/type_ctor/mat4x3/zero/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat4x3/zero/f16.wgsl.expected.msl
@@ -1,7 +1,39 @@
#include <metal_stdlib>
using namespace metal;
+
+template<typename T, size_t N>
+struct tint_array {
+ const constant T& operator[](size_t i) const constant { return elements[i]; }
+ device T& operator[](size_t i) device { return elements[i]; }
+ const device T& operator[](size_t i) const device { return elements[i]; }
+ thread T& operator[](size_t i) thread { return elements[i]; }
+ const thread T& operator[](size_t i) const thread { return elements[i]; }
+ threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+ const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+ T elements[N];
+};
+
struct tint_private_vars_struct {
half4x3 m;
};
+struct tint_packed_vec3_f16_array_element {
+ /* 0x0000 */ packed_half3 elements;
+ /* 0x0006 */ tint_array<int8_t, 2> tint_pad;
+};
+
+void assign_and_preserve_padding(device tint_array<tint_packed_vec3_f16_array_element, 4>* const dest, half4x3 value) {
+ (*(dest))[0u].elements = packed_half3(value[0u]);
+ (*(dest))[1u].elements = packed_half3(value[1u]);
+ (*(dest))[2u].elements = packed_half3(value[2u]);
+ (*(dest))[3u].elements = packed_half3(value[3u]);
+}
+
+kernel void f(device tint_array<tint_packed_vec3_f16_array_element, 4>* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half4x3(half3(0.0h), half3(0.0h), half3(0.0h), half3(0.0h));
+ assign_and_preserve_padding(tint_symbol, tint_private_vars.m);
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat4x3/zero/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x3/zero/f16.wgsl.expected.spvasm
index 4573010..8560043 100644
--- a/test/tint/expressions/type_ctor/mat4x3/zero/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat4x3/zero/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 11
+; Bound: 40
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,19 +9,65 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %assign_and_preserve_padding_out "assign_and_preserve_padding_out"
+ OpName %value "value"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v3half = OpTypeVector %half 3
%mat4v3half = OpTypeMatrix %v3half 4
%4 = OpConstantNull %mat4v3half
%_ptr_Private_mat4v3half = OpTypePointer Private %mat4v3half
%m = OpVariable %_ptr_Private_mat4v3half Private %4
+ %out_block = OpTypeStruct %mat4v3half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %7 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %7
- %10 = OpLabel
+ %10 = OpTypeFunction %void %mat4v3half
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %18 = OpConstantNull %int
+%_ptr_StorageBuffer_v3half = OpTypePointer StorageBuffer %v3half
+ %21 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+ %int_2 = OpConstant %int 2
+ %uint_2 = OpConstant %uint 2
+ %int_3 = OpConstant %int 3
+ %uint_3 = OpConstant %uint 3
+ %35 = OpTypeFunction %void
+%assign_and_preserve_padding_out = OpFunction %void None %10
+ %value = OpFunctionParameter %mat4v3half
+ %14 = OpLabel
+ %20 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %18
+ %22 = OpCompositeExtract %v3half %value 0
+ OpStore %20 %22
+ %24 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %int_1
+ %26 = OpCompositeExtract %v3half %value 1
+ OpStore %24 %26
+ %28 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %int_2
+ %30 = OpCompositeExtract %v3half %value 2
+ OpStore %28 %30
+ %32 = OpAccessChain %_ptr_StorageBuffer_v3half %out %uint_0 %int_3
+ %34 = OpCompositeExtract %v3half %value 3
+ OpStore %32 %34
+ OpReturn
+ OpFunctionEnd
+ %f = OpFunction %void None %35
+ %37 = OpLabel
+ %39 = OpLoad %mat4v3half %m
+ %38 = OpFunctionCall %void %assign_and_preserve_padding_out %39
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat4x3/zero/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x3/zero/f16.wgsl.expected.wgsl
index 9725227..a160279 100644
--- a/test/tint/expressions/type_ctor/mat4x3/zero/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x3/zero/f16.wgsl.expected.wgsl
@@ -1,3 +1,10 @@
enable f16;
var<private> m = mat4x3<f16>();
+
+@group(0) @binding(0) var<storage, read_write> out : mat4x3<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x3/zero/f32.wgsl b/test/tint/expressions/type_ctor/mat4x3/zero/f32.wgsl
index e23b03f..ed1819b 100644
--- a/test/tint/expressions/type_ctor/mat4x3/zero/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x3/zero/f32.wgsl
@@ -1 +1,9 @@
var<private> m = mat4x3<f32>();
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat4x3<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x3/zero/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/zero/f32.wgsl.expected.dxc.hlsl
index 297a867..b74eba8 100644
--- a/test/tint/expressions/type_ctor/mat4x3/zero/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x3/zero/f32.wgsl.expected.dxc.hlsl
@@ -1,6 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float4x3 m = float4x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx, (0.0f).xxx);
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store3((offset + 32u), asuint(value[2u]));
+ tint_symbol.Store3((offset + 48u), asuint(value[3u]));
}
-static float4x3 m = float4x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx, (0.0f).xxx);
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x3/zero/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/zero/f32.wgsl.expected.fxc.hlsl
index 297a867..b74eba8 100644
--- a/test/tint/expressions/type_ctor/mat4x3/zero/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x3/zero/f32.wgsl.expected.fxc.hlsl
@@ -1,6 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float4x3 m = float4x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx, (0.0f).xxx);
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x3 value) {
+ tint_symbol.Store3((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store3((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store3((offset + 32u), asuint(value[2u]));
+ tint_symbol.Store3((offset + 48u), asuint(value[3u]));
}
-static float4x3 m = float4x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx, (0.0f).xxx);
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x3/zero/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x3/zero/f32.wgsl.expected.glsl
index b24fd7a..5803faf 100644
--- a/test/tint/expressions/type_ctor/mat4x3/zero/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat4x3/zero/f32.wgsl.expected.glsl
@@ -1,7 +1,23 @@
#version 310 es
+mat4x3 m = mat4x3(vec3(0.0f), vec3(0.0f), vec3(0.0f), vec3(0.0f));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat4x3 inner;
+} tint_symbol;
+
+void assign_and_preserve_padding_tint_symbol(mat4x3 value) {
+ tint_symbol.inner[0] = value[0u];
+ tint_symbol.inner[1] = value[1u];
+ tint_symbol.inner[2] = value[2u];
+ tint_symbol.inner[3] = value[3u];
+}
+
+void f() {
+ assign_and_preserve_padding_tint_symbol(m);
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat4x3 m = mat4x3(vec3(0.0f), vec3(0.0f), vec3(0.0f), vec3(0.0f));
diff --git a/test/tint/expressions/type_ctor/mat4x3/zero/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x3/zero/f32.wgsl.expected.msl
index 7438c62..5030b17 100644
--- a/test/tint/expressions/type_ctor/mat4x3/zero/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat4x3/zero/f32.wgsl.expected.msl
@@ -1,7 +1,39 @@
#include <metal_stdlib>
using namespace metal;
+
+template<typename T, size_t N>
+struct tint_array {
+ const constant T& operator[](size_t i) const constant { return elements[i]; }
+ device T& operator[](size_t i) device { return elements[i]; }
+ const device T& operator[](size_t i) const device { return elements[i]; }
+ thread T& operator[](size_t i) thread { return elements[i]; }
+ const thread T& operator[](size_t i) const thread { return elements[i]; }
+ threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
+ const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
+ T elements[N];
+};
+
struct tint_private_vars_struct {
float4x3 m;
};
+struct tint_packed_vec3_f32_array_element {
+ /* 0x0000 */ packed_float3 elements;
+ /* 0x000c */ tint_array<int8_t, 4> tint_pad;
+};
+
+void assign_and_preserve_padding(device tint_array<tint_packed_vec3_f32_array_element, 4>* const dest, float4x3 value) {
+ (*(dest))[0u].elements = packed_float3(value[0u]);
+ (*(dest))[1u].elements = packed_float3(value[1u]);
+ (*(dest))[2u].elements = packed_float3(value[2u]);
+ (*(dest))[3u].elements = packed_float3(value[3u]);
+}
+
+kernel void f(device tint_array<tint_packed_vec3_f32_array_element, 4>* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float4x3(float3(0.0f), float3(0.0f), float3(0.0f), float3(0.0f));
+ assign_and_preserve_padding(tint_symbol, tint_private_vars.m);
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat4x3/zero/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x3/zero/f32.wgsl.expected.spvasm
index 53ffa7d..33e8038 100644
--- a/test/tint/expressions/type_ctor/mat4x3/zero/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat4x3/zero/f32.wgsl.expected.spvasm
@@ -1,23 +1,69 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 11
+; Bound: 40
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %assign_and_preserve_padding_out "assign_and_preserve_padding_out"
+ OpName %value "value"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%mat4v3float = OpTypeMatrix %v3float 4
%4 = OpConstantNull %mat4v3float
%_ptr_Private_mat4v3float = OpTypePointer Private %mat4v3float
%m = OpVariable %_ptr_Private_mat4v3float Private %4
+ %out_block = OpTypeStruct %mat4v3float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %7 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %7
- %10 = OpLabel
+ %10 = OpTypeFunction %void %mat4v3float
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %18 = OpConstantNull %int
+%_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float
+ %21 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+ %int_2 = OpConstant %int 2
+ %uint_2 = OpConstant %uint 2
+ %int_3 = OpConstant %int 3
+ %uint_3 = OpConstant %uint 3
+ %35 = OpTypeFunction %void
+%assign_and_preserve_padding_out = OpFunction %void None %10
+ %value = OpFunctionParameter %mat4v3float
+ %14 = OpLabel
+ %20 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %18
+ %22 = OpCompositeExtract %v3float %value 0
+ OpStore %20 %22
+ %24 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_1
+ %26 = OpCompositeExtract %v3float %value 1
+ OpStore %24 %26
+ %28 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_2
+ %30 = OpCompositeExtract %v3float %value 2
+ OpStore %28 %30
+ %32 = OpAccessChain %_ptr_StorageBuffer_v3float %out %uint_0 %int_3
+ %34 = OpCompositeExtract %v3float %value 3
+ OpStore %32 %34
+ OpReturn
+ OpFunctionEnd
+ %f = OpFunction %void None %35
+ %37 = OpLabel
+ %39 = OpLoad %mat4v3float %m
+ %38 = OpFunctionCall %void %assign_and_preserve_padding_out %39
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat4x3/zero/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x3/zero/f32.wgsl.expected.wgsl
index e23b03f..ad407af2 100644
--- a/test/tint/expressions/type_ctor/mat4x3/zero/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x3/zero/f32.wgsl.expected.wgsl
@@ -1 +1,8 @@
var<private> m = mat4x3<f32>();
+
+@group(0) @binding(0) var<storage, read_write> out : mat4x3<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f16.wgsl b/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f16.wgsl
index 08075c9..78ce290 100644
--- a/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f16.wgsl
@@ -1,10 +1,13 @@
enable f16;
-var<private> m = mat4x4(mat4x4<f16>(0.0h, 1.0h, 2.0h, 3.0h,
- 4.0h, 5.0h, 6.0h, 7.0h,
- 8.0h, 9.0h, 10.0h, 11.0h,
- 12.0h, 13.0h, 14.0h, 15.0h));
+var<private> m = mat4x4<f16>(mat4x4<f16>(0.0h, 1.0h, 2.0h, 3.0h,
+ 4.0h, 5.0h, 6.0h, 7.0h,
+ 8.0h, 9.0h, 10.0h, 11.0h,
+ 12.0h, 13.0h, 14.0h, 15.0h));
-fn f() -> mat4x4<f16> {
- let m_1 = mat4x4(m);
- return m_1;
+@group(0) @binding(0)
+var<storage, read_write> out : mat4x4<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat4x4<f16>(m);
}
diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f16.wgsl.expected.dxc.hlsl
index 9656713..8b4e035 100644
--- a/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f16.wgsl.expected.dxc.hlsl
@@ -1,11 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 4, 4> m = matrix<float16_t, 4, 4>(vector<float16_t, 4>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 4>(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)), vector<float16_t, 4>(float16_t(8.0h), float16_t(9.0h), float16_t(10.0h), float16_t(11.0h)), vector<float16_t, 4>(float16_t(12.0h), float16_t(13.0h), float16_t(14.0h), float16_t(15.0h)));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 4, 4> value) {
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 8u), value[1u]);
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 16u), value[2u]);
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 24u), value[3u]);
}
-static matrix<float16_t, 4, 4> m = matrix<float16_t, 4, 4>(vector<float16_t, 4>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 4>(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)), vector<float16_t, 4>(float16_t(8.0h), float16_t(9.0h), float16_t(10.0h), float16_t(11.0h)), vector<float16_t, 4>(float16_t(12.0h), float16_t(13.0h), float16_t(14.0h), float16_t(15.0h)));
-
-matrix<float16_t, 4, 4> f() {
- const matrix<float16_t, 4, 4> m_1 = matrix<float16_t, 4, 4>(m);
- return m_1;
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, matrix<float16_t, 4, 4>(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f16.wgsl.expected.glsl
index 8d3ad80..9413212 100644
--- a/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f16.wgsl.expected.glsl
@@ -1,13 +1,17 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
- return;
-}
f16mat4 m = f16mat4(f16vec4(0.0hf, 1.0hf, 2.0hf, 3.0hf), f16vec4(4.0hf, 5.0hf, 6.0hf, 7.0hf), f16vec4(8.0hf, 9.0hf, 10.0hf, 11.0hf), f16vec4(12.0hf, 13.0hf, 14.0hf, 15.0hf));
-f16mat4 f() {
- f16mat4 m_1 = f16mat4(m);
- return m_1;
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat4 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = f16mat4(m);
}
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ f();
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f16.wgsl.expected.msl
index 3271b7c..f349cef 100644
--- a/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f16.wgsl.expected.msl
@@ -5,8 +5,10 @@
half4x4 m;
};
-half4x4 f(thread tint_private_vars_struct* const tint_private_vars) {
- half4x4 const m_1 = half4x4((*(tint_private_vars)).m);
- return m_1;
+kernel void f(device half4x4* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half4x4(half4(0.0h, 1.0h, 2.0h, 3.0h), half4(4.0h, 5.0h, 6.0h, 7.0h), half4(8.0h, 9.0h, 10.0h, 11.0h), half4(12.0h, 13.0h, 14.0h, 15.0h));
+ *(tint_symbol) = half4x4(tint_private_vars.m);
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f16.wgsl.expected.spvasm
index 20aa3b2..9cab3b2 100644
--- a/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 36
+; Bound: 40
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,11 +9,19 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v4half = OpTypeVector %half 4
%mat4v4half = OpTypeMatrix %v4half 4
@@ -40,15 +48,18 @@
%24 = OpConstantComposite %mat4v4half %8 %13 %18 %23
%_ptr_Private_mat4v4half = OpTypePointer Private %mat4v4half
%m = OpVariable %_ptr_Private_mat4v4half Private %24
+ %out_block = OpTypeStruct %mat4v4half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %27 = OpTypeFunction %void
- %31 = OpTypeFunction %mat4v4half
-%unused_entry_point = OpFunction %void None %27
- %30 = OpLabel
- OpReturn
- OpFunctionEnd
- %f = OpFunction %mat4v4half None %31
+ %30 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat4v4half = OpTypePointer StorageBuffer %mat4v4half
+ %f = OpFunction %void None %30
%33 = OpLabel
- %35 = OpLoad %mat4v4half %m
- OpReturnValue %35
+ %37 = OpAccessChain %_ptr_StorageBuffer_mat4v4half %out %uint_0
+ %39 = OpLoad %mat4v4half %m
+ OpStore %37 %39
+ OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f16.wgsl.expected.wgsl
index 8130c8f..408e3a0 100644
--- a/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f16.wgsl.expected.wgsl
@@ -1,8 +1,10 @@
enable f16;
-var<private> m = mat4x4(mat4x4<f16>(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h, 8.0h, 9.0h, 10.0h, 11.0h, 12.0h, 13.0h, 14.0h, 15.0h));
+var<private> m = mat4x4<f16>(mat4x4<f16>(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h, 8.0h, 9.0h, 10.0h, 11.0h, 12.0h, 13.0h, 14.0h, 15.0h));
-fn f() -> mat4x4<f16> {
- let m_1 = mat4x4(m);
- return m_1;
+@group(0) @binding(0) var<storage, read_write> out : mat4x4<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat4x4<f16>(m);
}
diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f32.wgsl b/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f32.wgsl
index ff2b04a..04b3612 100644
--- a/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f32.wgsl
@@ -1,9 +1,12 @@
-var<private> m = mat4x4(mat4x4<f32>(0.0f, 1.0f, 2.0f, 3.0f,
- 4.0f, 5.0f, 6.0f, 7.0f,
- 8.0f, 9.0f, 10.0f, 11.0f,
- 12.0f, 13.0f, 14.0f, 15.0f));
+var<private> m = mat4x4<f32>(mat4x4<f32>(0.0f, 1.0f, 2.0f, 3.0f,
+ 4.0f, 5.0f, 6.0f, 7.0f,
+ 8.0f, 9.0f, 10.0f, 11.0f,
+ 12.0f, 13.0f, 14.0f, 15.0f));
-fn f() -> mat4x4<f32> {
- let m_1 = mat4x4(m);
- return m_1;
+@group(0) @binding(0)
+var<storage, read_write> out : mat4x4<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat4x4<f32>(m);
}
diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f32.wgsl.expected.dxc.hlsl
index fe1a3a7..388b2eb 100644
--- a/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f32.wgsl.expected.dxc.hlsl
@@ -1,11 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float4x4 m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store4((offset + 32u), asuint(value[2u]));
+ tint_symbol.Store4((offset + 48u), asuint(value[3u]));
}
-static float4x4 m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f));
-
-float4x4 f() {
- const float4x4 m_1 = float4x4(m);
- return m_1;
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float4x4(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f32.wgsl.expected.fxc.hlsl
index fe1a3a7..388b2eb 100644
--- a/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f32.wgsl.expected.fxc.hlsl
@@ -1,11 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float4x4 m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store4((offset + 32u), asuint(value[2u]));
+ tint_symbol.Store4((offset + 48u), asuint(value[3u]));
}
-static float4x4 m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f));
-
-float4x4 f() {
- const float4x4 m_1 = float4x4(m);
- return m_1;
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float4x4(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f32.wgsl.expected.glsl
index 5b8ecf4..04e4c0f 100644
--- a/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f32.wgsl.expected.glsl
@@ -1,12 +1,16 @@
#version 310 es
-layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
- return;
-}
mat4 m = mat4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f), vec4(8.0f, 9.0f, 10.0f, 11.0f), vec4(12.0f, 13.0f, 14.0f, 15.0f));
-mat4 f() {
- mat4 m_1 = mat4(m);
- return m_1;
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat4 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = mat4(m);
}
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ f();
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f32.wgsl.expected.msl
index 538ae08..6c099a2 100644
--- a/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f32.wgsl.expected.msl
@@ -5,8 +5,10 @@
float4x4 m;
};
-float4x4 f(thread tint_private_vars_struct* const tint_private_vars) {
- float4x4 const m_1 = float4x4((*(tint_private_vars)).m);
- return m_1;
+kernel void f(device float4x4* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f));
+ *(tint_symbol) = float4x4(tint_private_vars.m);
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f32.wgsl.expected.spvasm
index e503126..60792fd 100644
--- a/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f32.wgsl.expected.spvasm
@@ -1,15 +1,23 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 36
+; Bound: 40
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%mat4v4float = OpTypeMatrix %v4float 4
@@ -36,15 +44,18 @@
%24 = OpConstantComposite %mat4v4float %8 %13 %18 %23
%_ptr_Private_mat4v4float = OpTypePointer Private %mat4v4float
%m = OpVariable %_ptr_Private_mat4v4float Private %24
+ %out_block = OpTypeStruct %mat4v4float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %27 = OpTypeFunction %void
- %31 = OpTypeFunction %mat4v4float
-%unused_entry_point = OpFunction %void None %27
- %30 = OpLabel
- OpReturn
- OpFunctionEnd
- %f = OpFunction %mat4v4float None %31
+ %30 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat4v4float = OpTypePointer StorageBuffer %mat4v4float
+ %f = OpFunction %void None %30
%33 = OpLabel
- %35 = OpLoad %mat4v4float %m
- OpReturnValue %35
+ %37 = OpAccessChain %_ptr_StorageBuffer_mat4v4float %out %uint_0
+ %39 = OpLoad %mat4v4float %m
+ OpStore %37 %39
+ OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f32.wgsl.expected.wgsl
index ddab90c..948b887 100644
--- a/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f32.wgsl.expected.wgsl
@@ -1,6 +1,8 @@
-var<private> m = mat4x4(mat4x4<f32>(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f));
+var<private> m = mat4x4<f32>(mat4x4<f32>(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f));
-fn f() -> mat4x4<f32> {
- let m_1 = mat4x4(m);
- return m_1;
+@group(0) @binding(0) var<storage, read_write> out : mat4x4<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat4x4<f32>(m);
}
diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f16.wgsl b/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f16.wgsl
index d42ee17..cca6af54 100644
--- a/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f16.wgsl
@@ -3,3 +3,11 @@
4.0h, 5.0h, 6.0h, 7.0h,
8.0h, 9.0h, 10.0h, 11.0h,
12.0h, 13.0h, 14.0h, 15.0h);
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat4x4<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f16.wgsl.expected.dxc.hlsl
index 6243cce..2188318 100644
--- a/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f16.wgsl.expected.dxc.hlsl
@@ -1,6 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 4, 4> m = matrix<float16_t, 4, 4>(vector<float16_t, 4>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 4>(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)), vector<float16_t, 4>(float16_t(8.0h), float16_t(9.0h), float16_t(10.0h), float16_t(11.0h)), vector<float16_t, 4>(float16_t(12.0h), float16_t(13.0h), float16_t(14.0h), float16_t(15.0h)));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 4, 4> value) {
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 8u), value[1u]);
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 16u), value[2u]);
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 24u), value[3u]);
}
-static matrix<float16_t, 4, 4> m = matrix<float16_t, 4, 4>(vector<float16_t, 4>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 4>(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)), vector<float16_t, 4>(float16_t(8.0h), float16_t(9.0h), float16_t(10.0h), float16_t(11.0h)), vector<float16_t, 4>(float16_t(12.0h), float16_t(13.0h), float16_t(14.0h), float16_t(15.0h)));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f16.wgsl.expected.glsl
index 46f9ec3..98c0288 100644
--- a/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f16.wgsl.expected.glsl
@@ -1,8 +1,17 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
+f16mat4 m = f16mat4(f16vec4(0.0hf, 1.0hf, 2.0hf, 3.0hf), f16vec4(4.0hf, 5.0hf, 6.0hf, 7.0hf), f16vec4(8.0hf, 9.0hf, 10.0hf, 11.0hf), f16vec4(12.0hf, 13.0hf, 14.0hf, 15.0hf));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat4 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-f16mat4 m = f16mat4(f16vec4(0.0hf, 1.0hf, 2.0hf, 3.0hf), f16vec4(4.0hf, 5.0hf, 6.0hf, 7.0hf), f16vec4(8.0hf, 9.0hf, 10.0hf, 11.0hf), f16vec4(12.0hf, 13.0hf, 14.0hf, 15.0hf));
diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f16.wgsl.expected.msl
index b9a8b98..c81083c 100644
--- a/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f16.wgsl.expected.msl
@@ -5,3 +5,10 @@
half4x4 m;
};
+kernel void f(device half4x4* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half4x4(half4(0.0h, 1.0h, 2.0h, 3.0h), half4(4.0h, 5.0h, 6.0h, 7.0h), half4(8.0h, 9.0h, 10.0h, 11.0h), half4(12.0h, 13.0h, 14.0h, 15.0h));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f16.wgsl.expected.spvasm
index 3d55c43..e47a4db 100644
--- a/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 31
+; Bound: 39
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,10 +9,19 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v4half = OpTypeVector %half 4
%mat4v4half = OpTypeMatrix %v4half 4
@@ -39,9 +48,18 @@
%24 = OpConstantComposite %mat4v4half %8 %13 %18 %23
%_ptr_Private_mat4v4half = OpTypePointer Private %mat4v4half
%m = OpVariable %_ptr_Private_mat4v4half Private %24
+ %out_block = OpTypeStruct %mat4v4half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %27 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %27
- %30 = OpLabel
+ %30 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat4v4half = OpTypePointer StorageBuffer %mat4v4half
+ %f = OpFunction %void None %30
+ %33 = OpLabel
+ %37 = OpAccessChain %_ptr_StorageBuffer_mat4v4half %out %uint_0
+ %38 = OpLoad %mat4v4half %m
+ OpStore %37 %38
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f16.wgsl.expected.wgsl
index 762aa0a..70f8107 100644
--- a/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f16.wgsl.expected.wgsl
@@ -1,3 +1,10 @@
enable f16;
var<private> m = mat4x4<f16>(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h, 8.0h, 9.0h, 10.0h, 11.0h, 12.0h, 13.0h, 14.0h, 15.0h);
+
+@group(0) @binding(0) var<storage, read_write> out : mat4x4<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl b/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl
index bdd6737..fbda81a 100644
--- a/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl
@@ -2,3 +2,11 @@
4.0f, 5.0f, 6.0f, 7.0f,
8.0f, 9.0f, 10.0f, 11.0f,
12.0f, 13.0f, 14.0f, 15.0f);
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat4x4<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl.expected.dxc.hlsl
index 6b506f6..8a4c22a 100644
--- a/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl.expected.dxc.hlsl
@@ -1,6 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float4x4 m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store4((offset + 32u), asuint(value[2u]));
+ tint_symbol.Store4((offset + 48u), asuint(value[3u]));
}
-static float4x4 m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl.expected.fxc.hlsl
index 6b506f6..8a4c22a 100644
--- a/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl.expected.fxc.hlsl
@@ -1,6 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float4x4 m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store4((offset + 32u), asuint(value[2u]));
+ tint_symbol.Store4((offset + 48u), asuint(value[3u]));
}
-static float4x4 m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl.expected.glsl
index 5f8a226..4e64378 100644
--- a/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl.expected.glsl
@@ -1,7 +1,16 @@
#version 310 es
+mat4 m = mat4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f), vec4(8.0f, 9.0f, 10.0f, 11.0f), vec4(12.0f, 13.0f, 14.0f, 15.0f));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat4 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat4 m = mat4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f), vec4(8.0f, 9.0f, 10.0f, 11.0f), vec4(12.0f, 13.0f, 14.0f, 15.0f));
diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl.expected.msl
index ee88253..2e05fc7 100644
--- a/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl.expected.msl
@@ -5,3 +5,10 @@
float4x4 m;
};
+kernel void f(device float4x4* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl.expected.spvasm
index ac2d6d7..1eb4295 100644
--- a/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl.expected.spvasm
@@ -1,14 +1,23 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 31
+; Bound: 39
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%mat4v4float = OpTypeMatrix %v4float 4
@@ -35,9 +44,18 @@
%24 = OpConstantComposite %mat4v4float %8 %13 %18 %23
%_ptr_Private_mat4v4float = OpTypePointer Private %mat4v4float
%m = OpVariable %_ptr_Private_mat4v4float Private %24
+ %out_block = OpTypeStruct %mat4v4float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %27 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %27
- %30 = OpLabel
+ %30 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat4v4float = OpTypePointer StorageBuffer %mat4v4float
+ %f = OpFunction %void None %30
+ %33 = OpLabel
+ %37 = OpAccessChain %_ptr_StorageBuffer_mat4v4float %out %uint_0
+ %38 = OpLoad %mat4v4float %m
+ OpStore %37 %38
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl.expected.wgsl
index adc3d0c..1358f9e 100644
--- a/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl.expected.wgsl
@@ -1 +1,8 @@
var<private> m = mat4x4<f32>(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f);
+
+@group(0) @binding(0) var<storage, read_write> out : mat4x4<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f16.wgsl b/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f16.wgsl
index 73cb508..a29b35c 100644
--- a/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f16.wgsl
@@ -3,3 +3,11 @@
vec4<f16>(4.0h, 5.0h, 6.0h, 7.0h),
vec4<f16>(8.0h, 9.0h, 10.0h, 11.0h),
vec4<f16>(12.0h, 13.0h, 14.0h, 15.0h));
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat4x4<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f16.wgsl.expected.dxc.hlsl
index 6243cce..2188318 100644
--- a/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f16.wgsl.expected.dxc.hlsl
@@ -1,6 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 4, 4> m = matrix<float16_t, 4, 4>(vector<float16_t, 4>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 4>(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)), vector<float16_t, 4>(float16_t(8.0h), float16_t(9.0h), float16_t(10.0h), float16_t(11.0h)), vector<float16_t, 4>(float16_t(12.0h), float16_t(13.0h), float16_t(14.0h), float16_t(15.0h)));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 4, 4> value) {
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 8u), value[1u]);
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 16u), value[2u]);
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 24u), value[3u]);
}
-static matrix<float16_t, 4, 4> m = matrix<float16_t, 4, 4>(vector<float16_t, 4>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 4>(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)), vector<float16_t, 4>(float16_t(8.0h), float16_t(9.0h), float16_t(10.0h), float16_t(11.0h)), vector<float16_t, 4>(float16_t(12.0h), float16_t(13.0h), float16_t(14.0h), float16_t(15.0h)));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f16.wgsl.expected.glsl
index 46f9ec3..98c0288 100644
--- a/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f16.wgsl.expected.glsl
@@ -1,8 +1,17 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
+f16mat4 m = f16mat4(f16vec4(0.0hf, 1.0hf, 2.0hf, 3.0hf), f16vec4(4.0hf, 5.0hf, 6.0hf, 7.0hf), f16vec4(8.0hf, 9.0hf, 10.0hf, 11.0hf), f16vec4(12.0hf, 13.0hf, 14.0hf, 15.0hf));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat4 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-f16mat4 m = f16mat4(f16vec4(0.0hf, 1.0hf, 2.0hf, 3.0hf), f16vec4(4.0hf, 5.0hf, 6.0hf, 7.0hf), f16vec4(8.0hf, 9.0hf, 10.0hf, 11.0hf), f16vec4(12.0hf, 13.0hf, 14.0hf, 15.0hf));
diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f16.wgsl.expected.msl
index b9a8b98..c81083c 100644
--- a/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f16.wgsl.expected.msl
@@ -5,3 +5,10 @@
half4x4 m;
};
+kernel void f(device half4x4* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half4x4(half4(0.0h, 1.0h, 2.0h, 3.0h), half4(4.0h, 5.0h, 6.0h, 7.0h), half4(8.0h, 9.0h, 10.0h, 11.0h), half4(12.0h, 13.0h, 14.0h, 15.0h));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f16.wgsl.expected.spvasm
index 3d55c43..e47a4db 100644
--- a/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 31
+; Bound: 39
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,10 +9,19 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v4half = OpTypeVector %half 4
%mat4v4half = OpTypeMatrix %v4half 4
@@ -39,9 +48,18 @@
%24 = OpConstantComposite %mat4v4half %8 %13 %18 %23
%_ptr_Private_mat4v4half = OpTypePointer Private %mat4v4half
%m = OpVariable %_ptr_Private_mat4v4half Private %24
+ %out_block = OpTypeStruct %mat4v4half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %27 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %27
- %30 = OpLabel
+ %30 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat4v4half = OpTypePointer StorageBuffer %mat4v4half
+ %f = OpFunction %void None %30
+ %33 = OpLabel
+ %37 = OpAccessChain %_ptr_StorageBuffer_mat4v4half %out %uint_0
+ %38 = OpLoad %mat4v4half %m
+ OpStore %37 %38
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f16.wgsl.expected.wgsl
index 4af01b34..d67c9a2 100644
--- a/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f16.wgsl.expected.wgsl
@@ -1,3 +1,10 @@
enable f16;
var<private> m = mat4x4<f16>(vec4<f16>(0.0h, 1.0h, 2.0h, 3.0h), vec4<f16>(4.0h, 5.0h, 6.0h, 7.0h), vec4<f16>(8.0h, 9.0h, 10.0h, 11.0h), vec4<f16>(12.0h, 13.0h, 14.0h, 15.0h));
+
+@group(0) @binding(0) var<storage, read_write> out : mat4x4<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl b/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl
index 62b2ea3..68e951a 100644
--- a/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl
@@ -2,3 +2,11 @@
vec4<f32>(4.0f, 5.0f, 6.0f, 7.0f),
vec4<f32>(8.0f, 9.0f, 10.0f, 11.0f),
vec4<f32>(12.0f, 13.0f, 14.0f, 15.0f));
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat4x4<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.dxc.hlsl
index 6b506f6..8a4c22a 100644
--- a/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.dxc.hlsl
@@ -1,6 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float4x4 m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store4((offset + 32u), asuint(value[2u]));
+ tint_symbol.Store4((offset + 48u), asuint(value[3u]));
}
-static float4x4 m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.fxc.hlsl
index 6b506f6..8a4c22a 100644
--- a/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.fxc.hlsl
@@ -1,6 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float4x4 m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store4((offset + 32u), asuint(value[2u]));
+ tint_symbol.Store4((offset + 48u), asuint(value[3u]));
}
-static float4x4 m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.glsl
index 5f8a226..4e64378 100644
--- a/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.glsl
@@ -1,7 +1,16 @@
#version 310 es
+mat4 m = mat4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f), vec4(8.0f, 9.0f, 10.0f, 11.0f), vec4(12.0f, 13.0f, 14.0f, 15.0f));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat4 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat4 m = mat4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f), vec4(8.0f, 9.0f, 10.0f, 11.0f), vec4(12.0f, 13.0f, 14.0f, 15.0f));
diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.msl
index ee88253..2e05fc7 100644
--- a/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.msl
@@ -5,3 +5,10 @@
float4x4 m;
};
+kernel void f(device float4x4* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.spvasm
index ac2d6d7..1eb4295 100644
--- a/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.spvasm
@@ -1,14 +1,23 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 31
+; Bound: 39
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%mat4v4float = OpTypeMatrix %v4float 4
@@ -35,9 +44,18 @@
%24 = OpConstantComposite %mat4v4float %8 %13 %18 %23
%_ptr_Private_mat4v4float = OpTypePointer Private %mat4v4float
%m = OpVariable %_ptr_Private_mat4v4float Private %24
+ %out_block = OpTypeStruct %mat4v4float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %27 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %27
- %30 = OpLabel
+ %30 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat4v4float = OpTypePointer StorageBuffer %mat4v4float
+ %f = OpFunction %void None %30
+ %33 = OpLabel
+ %37 = OpAccessChain %_ptr_StorageBuffer_mat4v4float %out %uint_0
+ %38 = OpLoad %mat4v4float %m
+ OpStore %37 %38
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.wgsl
index e3c85d6..cfc04a7 100644
--- a/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.wgsl
@@ -1 +1,8 @@
var<private> m = mat4x4<f32>(vec4<f32>(0.0f, 1.0f, 2.0f, 3.0f), vec4<f32>(4.0f, 5.0f, 6.0f, 7.0f), vec4<f32>(8.0f, 9.0f, 10.0f, 11.0f), vec4<f32>(12.0f, 13.0f, 14.0f, 15.0f));
+
+@group(0) @binding(0) var<storage, read_write> out : mat4x4<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f16.wgsl b/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f16.wgsl
index 651128b..35a1881 100644
--- a/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f16.wgsl
@@ -4,7 +4,10 @@
8.0h, 9.0h, 10.0h, 11.0h,
12.0h, 13.0h, 14.0h, 15.0h));
-fn f() -> mat4x4<f16> {
- let m_1 = mat4x4(m);
- return m_1;
+@group(0) @binding(0)
+var<storage, read_write> out : mat4x4<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat4x4(m);
}
diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f16.wgsl.expected.dxc.hlsl
index 9656713..8b4e035 100644
--- a/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f16.wgsl.expected.dxc.hlsl
@@ -1,11 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 4, 4> m = matrix<float16_t, 4, 4>(vector<float16_t, 4>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 4>(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)), vector<float16_t, 4>(float16_t(8.0h), float16_t(9.0h), float16_t(10.0h), float16_t(11.0h)), vector<float16_t, 4>(float16_t(12.0h), float16_t(13.0h), float16_t(14.0h), float16_t(15.0h)));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 4, 4> value) {
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 8u), value[1u]);
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 16u), value[2u]);
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 24u), value[3u]);
}
-static matrix<float16_t, 4, 4> m = matrix<float16_t, 4, 4>(vector<float16_t, 4>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 4>(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)), vector<float16_t, 4>(float16_t(8.0h), float16_t(9.0h), float16_t(10.0h), float16_t(11.0h)), vector<float16_t, 4>(float16_t(12.0h), float16_t(13.0h), float16_t(14.0h), float16_t(15.0h)));
-
-matrix<float16_t, 4, 4> f() {
- const matrix<float16_t, 4, 4> m_1 = matrix<float16_t, 4, 4>(m);
- return m_1;
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, matrix<float16_t, 4, 4>(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f16.wgsl.expected.glsl
index 8d3ad80..9413212 100644
--- a/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f16.wgsl.expected.glsl
@@ -1,13 +1,17 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
- return;
-}
f16mat4 m = f16mat4(f16vec4(0.0hf, 1.0hf, 2.0hf, 3.0hf), f16vec4(4.0hf, 5.0hf, 6.0hf, 7.0hf), f16vec4(8.0hf, 9.0hf, 10.0hf, 11.0hf), f16vec4(12.0hf, 13.0hf, 14.0hf, 15.0hf));
-f16mat4 f() {
- f16mat4 m_1 = f16mat4(m);
- return m_1;
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat4 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = f16mat4(m);
}
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ f();
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f16.wgsl.expected.msl
index 3271b7c..f349cef 100644
--- a/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f16.wgsl.expected.msl
@@ -5,8 +5,10 @@
half4x4 m;
};
-half4x4 f(thread tint_private_vars_struct* const tint_private_vars) {
- half4x4 const m_1 = half4x4((*(tint_private_vars)).m);
- return m_1;
+kernel void f(device half4x4* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half4x4(half4(0.0h, 1.0h, 2.0h, 3.0h), half4(4.0h, 5.0h, 6.0h, 7.0h), half4(8.0h, 9.0h, 10.0h, 11.0h), half4(12.0h, 13.0h, 14.0h, 15.0h));
+ *(tint_symbol) = half4x4(tint_private_vars.m);
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f16.wgsl.expected.spvasm
index 20aa3b2..9cab3b2 100644
--- a/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 36
+; Bound: 40
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,11 +9,19 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v4half = OpTypeVector %half 4
%mat4v4half = OpTypeMatrix %v4half 4
@@ -40,15 +48,18 @@
%24 = OpConstantComposite %mat4v4half %8 %13 %18 %23
%_ptr_Private_mat4v4half = OpTypePointer Private %mat4v4half
%m = OpVariable %_ptr_Private_mat4v4half Private %24
+ %out_block = OpTypeStruct %mat4v4half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %27 = OpTypeFunction %void
- %31 = OpTypeFunction %mat4v4half
-%unused_entry_point = OpFunction %void None %27
- %30 = OpLabel
- OpReturn
- OpFunctionEnd
- %f = OpFunction %mat4v4half None %31
+ %30 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat4v4half = OpTypePointer StorageBuffer %mat4v4half
+ %f = OpFunction %void None %30
%33 = OpLabel
- %35 = OpLoad %mat4v4half %m
- OpReturnValue %35
+ %37 = OpAccessChain %_ptr_StorageBuffer_mat4v4half %out %uint_0
+ %39 = OpLoad %mat4v4half %m
+ OpStore %37 %39
+ OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f16.wgsl.expected.wgsl
index c4281c7..4cfc1dc 100644
--- a/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f16.wgsl.expected.wgsl
@@ -2,7 +2,9 @@
var<private> m = mat4x4(mat4x4(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h, 8.0h, 9.0h, 10.0h, 11.0h, 12.0h, 13.0h, 14.0h, 15.0h));
-fn f() -> mat4x4<f16> {
- let m_1 = mat4x4(m);
- return m_1;
+@group(0) @binding(0) var<storage, read_write> out : mat4x4<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat4x4(m);
}
diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f32.wgsl b/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f32.wgsl
index 3024289..a70604c 100644
--- a/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f32.wgsl
@@ -3,7 +3,10 @@
8.0f, 9.0f, 10.0f, 11.0f,
12.0f, 13.0f, 14.0f, 15.0f));
-fn f() -> mat4x4<f32> {
- let m_1 = mat4x4(m);
- return m_1;
+@group(0) @binding(0)
+var<storage, read_write> out : mat4x4<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat4x4(m);
}
diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f32.wgsl.expected.dxc.hlsl
index fe1a3a7..388b2eb 100644
--- a/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f32.wgsl.expected.dxc.hlsl
@@ -1,11 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float4x4 m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store4((offset + 32u), asuint(value[2u]));
+ tint_symbol.Store4((offset + 48u), asuint(value[3u]));
}
-static float4x4 m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f));
-
-float4x4 f() {
- const float4x4 m_1 = float4x4(m);
- return m_1;
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float4x4(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f32.wgsl.expected.fxc.hlsl
index fe1a3a7..388b2eb 100644
--- a/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f32.wgsl.expected.fxc.hlsl
@@ -1,11 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float4x4 m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store4((offset + 32u), asuint(value[2u]));
+ tint_symbol.Store4((offset + 48u), asuint(value[3u]));
}
-static float4x4 m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f));
-
-float4x4 f() {
- const float4x4 m_1 = float4x4(m);
- return m_1;
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float4x4(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f32.wgsl.expected.glsl
index 5b8ecf4..04e4c0f 100644
--- a/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f32.wgsl.expected.glsl
@@ -1,12 +1,16 @@
#version 310 es
-layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
- return;
-}
mat4 m = mat4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f), vec4(8.0f, 9.0f, 10.0f, 11.0f), vec4(12.0f, 13.0f, 14.0f, 15.0f));
-mat4 f() {
- mat4 m_1 = mat4(m);
- return m_1;
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat4 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = mat4(m);
}
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ f();
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f32.wgsl.expected.msl
index 538ae08..6c099a2 100644
--- a/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f32.wgsl.expected.msl
@@ -5,8 +5,10 @@
float4x4 m;
};
-float4x4 f(thread tint_private_vars_struct* const tint_private_vars) {
- float4x4 const m_1 = float4x4((*(tint_private_vars)).m);
- return m_1;
+kernel void f(device float4x4* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f));
+ *(tint_symbol) = float4x4(tint_private_vars.m);
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f32.wgsl.expected.spvasm
index e503126..60792fd 100644
--- a/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f32.wgsl.expected.spvasm
@@ -1,15 +1,23 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 36
+; Bound: 40
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%mat4v4float = OpTypeMatrix %v4float 4
@@ -36,15 +44,18 @@
%24 = OpConstantComposite %mat4v4float %8 %13 %18 %23
%_ptr_Private_mat4v4float = OpTypePointer Private %mat4v4float
%m = OpVariable %_ptr_Private_mat4v4float Private %24
+ %out_block = OpTypeStruct %mat4v4float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %27 = OpTypeFunction %void
- %31 = OpTypeFunction %mat4v4float
-%unused_entry_point = OpFunction %void None %27
- %30 = OpLabel
- OpReturn
- OpFunctionEnd
- %f = OpFunction %mat4v4float None %31
+ %30 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat4v4float = OpTypePointer StorageBuffer %mat4v4float
+ %f = OpFunction %void None %30
%33 = OpLabel
- %35 = OpLoad %mat4v4float %m
- OpReturnValue %35
+ %37 = OpAccessChain %_ptr_StorageBuffer_mat4v4float %out %uint_0
+ %39 = OpLoad %mat4v4float %m
+ OpStore %37 %39
+ OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f32.wgsl.expected.wgsl
index aa96555..1bd709b 100644
--- a/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f32.wgsl.expected.wgsl
@@ -1,6 +1,8 @@
var<private> m = mat4x4(mat4x4(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f));
-fn f() -> mat4x4<f32> {
- let m_1 = mat4x4(m);
- return m_1;
+@group(0) @binding(0) var<storage, read_write> out : mat4x4<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = mat4x4(m);
}
diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/abstract-float.wgsl b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/abstract-float.wgsl
index 3339d4d..88c560a 100644
--- a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/abstract-float.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/abstract-float.wgsl
@@ -1,4 +1,12 @@
-var<private> m = mat4x4(0.0, 1.0, 2.0, 3.0,
- 4.0, 5.0, 6.0, 7.0,
- 8.0, 9.0, 10.0, 11.0,
- 12.0, 13.0, 14.0, 15.0);
+const m = mat4x4(0.0, 1.0, 2.0, 3.0,
+ 4.0, 5.0, 6.0, 7.0,
+ 8.0, 9.0, 10.0, 11.0,
+ 12.0, 13.0, 14.0, 15.0);
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat4x4<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl
index 6b506f6..0739bb1 100644
--- a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store4((offset + 32u), asuint(value[2u]));
+ tint_symbol.Store4((offset + 48u), asuint(value[3u]));
}
-static float4x4 m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f)));
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl
index 6b506f6..0739bb1 100644
--- a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store4((offset + 32u), asuint(value[2u]));
+ tint_symbol.Store4((offset + 48u), asuint(value[3u]));
}
-static float4x4 m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f)));
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/abstract-float.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/abstract-float.wgsl.expected.glsl
index 5f8a226..0c13be0 100644
--- a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/abstract-float.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/abstract-float.wgsl.expected.glsl
@@ -1,7 +1,15 @@
#version 310 es
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat4 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = mat4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f), vec4(8.0f, 9.0f, 10.0f, 11.0f), vec4(12.0f, 13.0f, 14.0f, 15.0f));
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat4 m = mat4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f), vec4(8.0f, 9.0f, 10.0f, 11.0f), vec4(12.0f, 13.0f, 14.0f, 15.0f));
diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/abstract-float.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/abstract-float.wgsl.expected.msl
index ee88253..1ceef71 100644
--- a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/abstract-float.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/abstract-float.wgsl.expected.msl
@@ -1,7 +1,8 @@
#include <metal_stdlib>
using namespace metal;
-struct tint_private_vars_struct {
- float4x4 m;
-};
+kernel void f(device float4x4* tint_symbol [[buffer(0)]]) {
+ *(tint_symbol) = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f));
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/abstract-float.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/abstract-float.wgsl.expected.spvasm
index ac2d6d7..21ffd44 100644
--- a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/abstract-float.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/abstract-float.wgsl.expected.spvasm
@@ -1,43 +1,57 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 31
+; Bound: 36
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
- OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%mat4v4float = OpTypeMatrix %v4float 4
- %4 = OpConstantNull %float
+ %out_block = OpTypeStruct %mat4v4float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat4v4float = OpTypePointer StorageBuffer %mat4v4float
+ %15 = OpConstantNull %float
%float_1 = OpConstant %float 1
%float_2 = OpConstant %float 2
%float_3 = OpConstant %float 3
- %8 = OpConstantComposite %v4float %4 %float_1 %float_2 %float_3
+ %19 = OpConstantComposite %v4float %15 %float_1 %float_2 %float_3
%float_4 = OpConstant %float 4
%float_5 = OpConstant %float 5
%float_6 = OpConstant %float 6
%float_7 = OpConstant %float 7
- %13 = OpConstantComposite %v4float %float_4 %float_5 %float_6 %float_7
+ %24 = OpConstantComposite %v4float %float_4 %float_5 %float_6 %float_7
%float_8 = OpConstant %float 8
%float_9 = OpConstant %float 9
%float_10 = OpConstant %float 10
%float_11 = OpConstant %float 11
- %18 = OpConstantComposite %v4float %float_8 %float_9 %float_10 %float_11
+ %29 = OpConstantComposite %v4float %float_8 %float_9 %float_10 %float_11
%float_12 = OpConstant %float 12
%float_13 = OpConstant %float 13
%float_14 = OpConstant %float 14
%float_15 = OpConstant %float 15
- %23 = OpConstantComposite %v4float %float_12 %float_13 %float_14 %float_15
- %24 = OpConstantComposite %mat4v4float %8 %13 %18 %23
-%_ptr_Private_mat4v4float = OpTypePointer Private %mat4v4float
- %m = OpVariable %_ptr_Private_mat4v4float Private %24
- %void = OpTypeVoid
- %27 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %27
- %30 = OpLabel
+ %34 = OpConstantComposite %v4float %float_12 %float_13 %float_14 %float_15
+ %35 = OpConstantComposite %mat4v4float %19 %24 %29 %34
+ %f = OpFunction %void None %7
+ %10 = OpLabel
+ %14 = OpAccessChain %_ptr_StorageBuffer_mat4v4float %out %uint_0
+ OpStore %14 %35
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/abstract-float.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/abstract-float.wgsl.expected.wgsl
index 83572f2..5861af7 100644
--- a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/abstract-float.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/abstract-float.wgsl.expected.wgsl
@@ -1 +1,8 @@
-var<private> m = mat4x4(0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0);
+const m = mat4x4(0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0);
+
+@group(0) @binding(0) var<storage, read_write> out : mat4x4<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f16.wgsl b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f16.wgsl
index 2dd0fe3..0b603db 100644
--- a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f16.wgsl
@@ -3,3 +3,11 @@
4.0h, 5.0h, 6.0h, 7.0h,
8.0h, 9.0h, 10.0h, 11.0h,
12.0h, 13.0h, 14.0h, 15.0h);
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat4x4<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f16.wgsl.expected.dxc.hlsl
index 6243cce..2188318 100644
--- a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f16.wgsl.expected.dxc.hlsl
@@ -1,6 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 4, 4> m = matrix<float16_t, 4, 4>(vector<float16_t, 4>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 4>(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)), vector<float16_t, 4>(float16_t(8.0h), float16_t(9.0h), float16_t(10.0h), float16_t(11.0h)), vector<float16_t, 4>(float16_t(12.0h), float16_t(13.0h), float16_t(14.0h), float16_t(15.0h)));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 4, 4> value) {
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 8u), value[1u]);
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 16u), value[2u]);
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 24u), value[3u]);
}
-static matrix<float16_t, 4, 4> m = matrix<float16_t, 4, 4>(vector<float16_t, 4>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 4>(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)), vector<float16_t, 4>(float16_t(8.0h), float16_t(9.0h), float16_t(10.0h), float16_t(11.0h)), vector<float16_t, 4>(float16_t(12.0h), float16_t(13.0h), float16_t(14.0h), float16_t(15.0h)));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f16.wgsl.expected.glsl
index 46f9ec3..98c0288 100644
--- a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f16.wgsl.expected.glsl
@@ -1,8 +1,17 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
+f16mat4 m = f16mat4(f16vec4(0.0hf, 1.0hf, 2.0hf, 3.0hf), f16vec4(4.0hf, 5.0hf, 6.0hf, 7.0hf), f16vec4(8.0hf, 9.0hf, 10.0hf, 11.0hf), f16vec4(12.0hf, 13.0hf, 14.0hf, 15.0hf));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat4 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-f16mat4 m = f16mat4(f16vec4(0.0hf, 1.0hf, 2.0hf, 3.0hf), f16vec4(4.0hf, 5.0hf, 6.0hf, 7.0hf), f16vec4(8.0hf, 9.0hf, 10.0hf, 11.0hf), f16vec4(12.0hf, 13.0hf, 14.0hf, 15.0hf));
diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f16.wgsl.expected.msl
index b9a8b98..c81083c 100644
--- a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f16.wgsl.expected.msl
@@ -5,3 +5,10 @@
half4x4 m;
};
+kernel void f(device half4x4* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half4x4(half4(0.0h, 1.0h, 2.0h, 3.0h), half4(4.0h, 5.0h, 6.0h, 7.0h), half4(8.0h, 9.0h, 10.0h, 11.0h), half4(12.0h, 13.0h, 14.0h, 15.0h));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f16.wgsl.expected.spvasm
index 3d55c43..e47a4db 100644
--- a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 31
+; Bound: 39
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,10 +9,19 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v4half = OpTypeVector %half 4
%mat4v4half = OpTypeMatrix %v4half 4
@@ -39,9 +48,18 @@
%24 = OpConstantComposite %mat4v4half %8 %13 %18 %23
%_ptr_Private_mat4v4half = OpTypePointer Private %mat4v4half
%m = OpVariable %_ptr_Private_mat4v4half Private %24
+ %out_block = OpTypeStruct %mat4v4half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %27 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %27
- %30 = OpLabel
+ %30 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat4v4half = OpTypePointer StorageBuffer %mat4v4half
+ %f = OpFunction %void None %30
+ %33 = OpLabel
+ %37 = OpAccessChain %_ptr_StorageBuffer_mat4v4half %out %uint_0
+ %38 = OpLoad %mat4v4half %m
+ OpStore %37 %38
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f16.wgsl.expected.wgsl
index 630381c..4128781 100644
--- a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f16.wgsl.expected.wgsl
@@ -1,3 +1,10 @@
enable f16;
var<private> m = mat4x4(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h, 8.0h, 9.0h, 10.0h, 11.0h, 12.0h, 13.0h, 14.0h, 15.0h);
+
+@group(0) @binding(0) var<storage, read_write> out : mat4x4<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl
index 178b95b..859bbaed 100644
--- a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl
@@ -2,3 +2,11 @@
4.0f, 5.0f, 6.0f, 7.0f,
8.0f, 9.0f, 10.0f, 11.0f,
12.0f, 13.0f, 14.0f, 15.0f);
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat4x4<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl.expected.dxc.hlsl
index 6b506f6..8a4c22a 100644
--- a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl.expected.dxc.hlsl
@@ -1,6 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float4x4 m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store4((offset + 32u), asuint(value[2u]));
+ tint_symbol.Store4((offset + 48u), asuint(value[3u]));
}
-static float4x4 m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl.expected.fxc.hlsl
index 6b506f6..8a4c22a 100644
--- a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl.expected.fxc.hlsl
@@ -1,6 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float4x4 m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store4((offset + 32u), asuint(value[2u]));
+ tint_symbol.Store4((offset + 48u), asuint(value[3u]));
}
-static float4x4 m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl.expected.glsl
index 5f8a226..4e64378 100644
--- a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl.expected.glsl
@@ -1,7 +1,16 @@
#version 310 es
+mat4 m = mat4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f), vec4(8.0f, 9.0f, 10.0f, 11.0f), vec4(12.0f, 13.0f, 14.0f, 15.0f));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat4 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat4 m = mat4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f), vec4(8.0f, 9.0f, 10.0f, 11.0f), vec4(12.0f, 13.0f, 14.0f, 15.0f));
diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl.expected.msl
index ee88253..2e05fc7 100644
--- a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl.expected.msl
@@ -5,3 +5,10 @@
float4x4 m;
};
+kernel void f(device float4x4* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl.expected.spvasm
index ac2d6d7..1eb4295 100644
--- a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl.expected.spvasm
@@ -1,14 +1,23 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 31
+; Bound: 39
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%mat4v4float = OpTypeMatrix %v4float 4
@@ -35,9 +44,18 @@
%24 = OpConstantComposite %mat4v4float %8 %13 %18 %23
%_ptr_Private_mat4v4float = OpTypePointer Private %mat4v4float
%m = OpVariable %_ptr_Private_mat4v4float Private %24
+ %out_block = OpTypeStruct %mat4v4float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %27 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %27
- %30 = OpLabel
+ %30 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat4v4float = OpTypePointer StorageBuffer %mat4v4float
+ %f = OpFunction %void None %30
+ %33 = OpLabel
+ %37 = OpAccessChain %_ptr_StorageBuffer_mat4v4float %out %uint_0
+ %38 = OpLoad %mat4v4float %m
+ OpStore %37 %38
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl.expected.wgsl
index ae47f65..71cee3d 100644
--- a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl.expected.wgsl
@@ -1 +1,8 @@
var<private> m = mat4x4(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f);
+
+@group(0) @binding(0) var<storage, read_write> out : mat4x4<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/abstract-float.wgsl b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/abstract-float.wgsl
index 52c70d1..533f496 100644
--- a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/abstract-float.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/abstract-float.wgsl
@@ -1,4 +1,12 @@
-var<private> m = mat4x4(vec4(0.0, 1.0, 2.0, 3.0),
- vec4(4.0, 5.0, 6.0, 7.0),
- vec4(8.0, 9.0, 10.0, 11.0),
- vec4(12.0, 13.0, 14.0, 15.0));
+const m = mat4x4(vec4(0.0, 1.0, 2.0, 3.0),
+ vec4(4.0, 5.0, 6.0, 7.0),
+ vec4(8.0, 9.0, 10.0, 11.0),
+ vec4(12.0, 13.0, 14.0, 15.0));
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat4x4<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl
index 6b506f6..0739bb1 100644
--- a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store4((offset + 32u), asuint(value[2u]));
+ tint_symbol.Store4((offset + 48u), asuint(value[3u]));
}
-static float4x4 m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f)));
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl
index 6b506f6..0739bb1 100644
--- a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl
@@ -1,6 +1,14 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store4((offset + 32u), asuint(value[2u]));
+ tint_symbol.Store4((offset + 48u), asuint(value[3u]));
}
-static float4x4 m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f)));
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/abstract-float.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/abstract-float.wgsl.expected.glsl
index 5f8a226..0c13be0 100644
--- a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/abstract-float.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/abstract-float.wgsl.expected.glsl
@@ -1,7 +1,15 @@
#version 310 es
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat4 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = mat4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f), vec4(8.0f, 9.0f, 10.0f, 11.0f), vec4(12.0f, 13.0f, 14.0f, 15.0f));
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat4 m = mat4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f), vec4(8.0f, 9.0f, 10.0f, 11.0f), vec4(12.0f, 13.0f, 14.0f, 15.0f));
diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/abstract-float.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/abstract-float.wgsl.expected.msl
index ee88253..1ceef71 100644
--- a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/abstract-float.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/abstract-float.wgsl.expected.msl
@@ -1,7 +1,8 @@
#include <metal_stdlib>
using namespace metal;
-struct tint_private_vars_struct {
- float4x4 m;
-};
+kernel void f(device float4x4* tint_symbol [[buffer(0)]]) {
+ *(tint_symbol) = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f));
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/abstract-float.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/abstract-float.wgsl.expected.spvasm
index ac2d6d7..21ffd44 100644
--- a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/abstract-float.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/abstract-float.wgsl.expected.spvasm
@@ -1,43 +1,57 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 31
+; Bound: 36
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
- OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%mat4v4float = OpTypeMatrix %v4float 4
- %4 = OpConstantNull %float
+ %out_block = OpTypeStruct %mat4v4float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat4v4float = OpTypePointer StorageBuffer %mat4v4float
+ %15 = OpConstantNull %float
%float_1 = OpConstant %float 1
%float_2 = OpConstant %float 2
%float_3 = OpConstant %float 3
- %8 = OpConstantComposite %v4float %4 %float_1 %float_2 %float_3
+ %19 = OpConstantComposite %v4float %15 %float_1 %float_2 %float_3
%float_4 = OpConstant %float 4
%float_5 = OpConstant %float 5
%float_6 = OpConstant %float 6
%float_7 = OpConstant %float 7
- %13 = OpConstantComposite %v4float %float_4 %float_5 %float_6 %float_7
+ %24 = OpConstantComposite %v4float %float_4 %float_5 %float_6 %float_7
%float_8 = OpConstant %float 8
%float_9 = OpConstant %float 9
%float_10 = OpConstant %float 10
%float_11 = OpConstant %float 11
- %18 = OpConstantComposite %v4float %float_8 %float_9 %float_10 %float_11
+ %29 = OpConstantComposite %v4float %float_8 %float_9 %float_10 %float_11
%float_12 = OpConstant %float 12
%float_13 = OpConstant %float 13
%float_14 = OpConstant %float 14
%float_15 = OpConstant %float 15
- %23 = OpConstantComposite %v4float %float_12 %float_13 %float_14 %float_15
- %24 = OpConstantComposite %mat4v4float %8 %13 %18 %23
-%_ptr_Private_mat4v4float = OpTypePointer Private %mat4v4float
- %m = OpVariable %_ptr_Private_mat4v4float Private %24
- %void = OpTypeVoid
- %27 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %27
- %30 = OpLabel
+ %34 = OpConstantComposite %v4float %float_12 %float_13 %float_14 %float_15
+ %35 = OpConstantComposite %mat4v4float %19 %24 %29 %34
+ %f = OpFunction %void None %7
+ %10 = OpLabel
+ %14 = OpAccessChain %_ptr_StorageBuffer_mat4v4float %out %uint_0
+ OpStore %14 %35
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/abstract-float.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/abstract-float.wgsl.expected.wgsl
index 13ec29a..08e328d 100644
--- a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/abstract-float.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/abstract-float.wgsl.expected.wgsl
@@ -1 +1,8 @@
-var<private> m = mat4x4(vec4(0.0, 1.0, 2.0, 3.0), vec4(4.0, 5.0, 6.0, 7.0), vec4(8.0, 9.0, 10.0, 11.0), vec4(12.0, 13.0, 14.0, 15.0));
+const m = mat4x4(vec4(0.0, 1.0, 2.0, 3.0), vec4(4.0, 5.0, 6.0, 7.0), vec4(8.0, 9.0, 10.0, 11.0), vec4(12.0, 13.0, 14.0, 15.0));
+
+@group(0) @binding(0) var<storage, read_write> out : mat4x4<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f16.wgsl b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f16.wgsl
index 7a6dadf4..8fd84b0 100644
--- a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f16.wgsl
@@ -3,3 +3,11 @@
vec4<f16>(4.0h, 5.0h, 6.0h, 7.0h),
vec4<f16>(8.0h, 9.0h, 10.0h, 11.0h),
vec4<f16>(12.0h, 13.0h, 14.0h, 15.0h));
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat4x4<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f16.wgsl.expected.dxc.hlsl
index 6243cce..2188318 100644
--- a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f16.wgsl.expected.dxc.hlsl
@@ -1,6 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 4, 4> m = matrix<float16_t, 4, 4>(vector<float16_t, 4>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 4>(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)), vector<float16_t, 4>(float16_t(8.0h), float16_t(9.0h), float16_t(10.0h), float16_t(11.0h)), vector<float16_t, 4>(float16_t(12.0h), float16_t(13.0h), float16_t(14.0h), float16_t(15.0h)));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 4, 4> value) {
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 8u), value[1u]);
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 16u), value[2u]);
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 24u), value[3u]);
}
-static matrix<float16_t, 4, 4> m = matrix<float16_t, 4, 4>(vector<float16_t, 4>(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 4>(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)), vector<float16_t, 4>(float16_t(8.0h), float16_t(9.0h), float16_t(10.0h), float16_t(11.0h)), vector<float16_t, 4>(float16_t(12.0h), float16_t(13.0h), float16_t(14.0h), float16_t(15.0h)));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f16.wgsl.expected.glsl
index 46f9ec3..98c0288 100644
--- a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f16.wgsl.expected.glsl
@@ -1,8 +1,17 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
+f16mat4 m = f16mat4(f16vec4(0.0hf, 1.0hf, 2.0hf, 3.0hf), f16vec4(4.0hf, 5.0hf, 6.0hf, 7.0hf), f16vec4(8.0hf, 9.0hf, 10.0hf, 11.0hf), f16vec4(12.0hf, 13.0hf, 14.0hf, 15.0hf));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat4 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-f16mat4 m = f16mat4(f16vec4(0.0hf, 1.0hf, 2.0hf, 3.0hf), f16vec4(4.0hf, 5.0hf, 6.0hf, 7.0hf), f16vec4(8.0hf, 9.0hf, 10.0hf, 11.0hf), f16vec4(12.0hf, 13.0hf, 14.0hf, 15.0hf));
diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f16.wgsl.expected.msl
index b9a8b98..c81083c 100644
--- a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f16.wgsl.expected.msl
@@ -5,3 +5,10 @@
half4x4 m;
};
+kernel void f(device half4x4* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half4x4(half4(0.0h, 1.0h, 2.0h, 3.0h), half4(4.0h, 5.0h, 6.0h, 7.0h), half4(8.0h, 9.0h, 10.0h, 11.0h), half4(12.0h, 13.0h, 14.0h, 15.0h));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f16.wgsl.expected.spvasm
index 3d55c43..e47a4db 100644
--- a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 31
+; Bound: 39
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,10 +9,19 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v4half = OpTypeVector %half 4
%mat4v4half = OpTypeMatrix %v4half 4
@@ -39,9 +48,18 @@
%24 = OpConstantComposite %mat4v4half %8 %13 %18 %23
%_ptr_Private_mat4v4half = OpTypePointer Private %mat4v4half
%m = OpVariable %_ptr_Private_mat4v4half Private %24
+ %out_block = OpTypeStruct %mat4v4half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %27 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %27
- %30 = OpLabel
+ %30 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat4v4half = OpTypePointer StorageBuffer %mat4v4half
+ %f = OpFunction %void None %30
+ %33 = OpLabel
+ %37 = OpAccessChain %_ptr_StorageBuffer_mat4v4half %out %uint_0
+ %38 = OpLoad %mat4v4half %m
+ OpStore %37 %38
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f16.wgsl.expected.wgsl
index 6d28d49..2e4234a 100644
--- a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f16.wgsl.expected.wgsl
@@ -1,3 +1,10 @@
enable f16;
var<private> m = mat4x4(vec4<f16>(0.0h, 1.0h, 2.0h, 3.0h), vec4<f16>(4.0h, 5.0h, 6.0h, 7.0h), vec4<f16>(8.0h, 9.0h, 10.0h, 11.0h), vec4<f16>(12.0h, 13.0h, 14.0h, 15.0h));
+
+@group(0) @binding(0) var<storage, read_write> out : mat4x4<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl
index 1e8e479..dcbc432 100644
--- a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl
@@ -2,3 +2,11 @@
vec4<f32>(4.0f, 5.0f, 6.0f, 7.0f),
vec4<f32>(8.0f, 9.0f, 10.0f, 11.0f),
vec4<f32>(12.0f, 13.0f, 14.0f, 15.0f));
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat4x4<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl.expected.dxc.hlsl
index 6b506f6..8a4c22a 100644
--- a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl.expected.dxc.hlsl
@@ -1,6 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float4x4 m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store4((offset + 32u), asuint(value[2u]));
+ tint_symbol.Store4((offset + 48u), asuint(value[3u]));
}
-static float4x4 m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl.expected.fxc.hlsl
index 6b506f6..8a4c22a 100644
--- a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl.expected.fxc.hlsl
@@ -1,6 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float4x4 m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f));
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store4((offset + 32u), asuint(value[2u]));
+ tint_symbol.Store4((offset + 48u), asuint(value[3u]));
}
-static float4x4 m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f));
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl.expected.glsl
index 5f8a226..4e64378 100644
--- a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl.expected.glsl
@@ -1,7 +1,16 @@
#version 310 es
+mat4 m = mat4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f), vec4(8.0f, 9.0f, 10.0f, 11.0f), vec4(12.0f, 13.0f, 14.0f, 15.0f));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat4 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat4 m = mat4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f), vec4(8.0f, 9.0f, 10.0f, 11.0f), vec4(12.0f, 13.0f, 14.0f, 15.0f));
diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl.expected.msl
index ee88253..2e05fc7 100644
--- a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl.expected.msl
@@ -5,3 +5,10 @@
float4x4 m;
};
+kernel void f(device float4x4* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl.expected.spvasm
index ac2d6d7..1eb4295 100644
--- a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl.expected.spvasm
@@ -1,14 +1,23 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 31
+; Bound: 39
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%mat4v4float = OpTypeMatrix %v4float 4
@@ -35,9 +44,18 @@
%24 = OpConstantComposite %mat4v4float %8 %13 %18 %23
%_ptr_Private_mat4v4float = OpTypePointer Private %mat4v4float
%m = OpVariable %_ptr_Private_mat4v4float Private %24
+ %out_block = OpTypeStruct %mat4v4float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %27 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %27
- %30 = OpLabel
+ %30 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat4v4float = OpTypePointer StorageBuffer %mat4v4float
+ %f = OpFunction %void None %30
+ %33 = OpLabel
+ %37 = OpAccessChain %_ptr_StorageBuffer_mat4v4float %out %uint_0
+ %38 = OpLoad %mat4v4float %m
+ OpStore %37 %38
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl.expected.wgsl
index 9934a44..50e4055 100644
--- a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl.expected.wgsl
@@ -1 +1,8 @@
var<private> m = mat4x4(vec4<f32>(0.0f, 1.0f, 2.0f, 3.0f), vec4<f32>(4.0f, 5.0f, 6.0f, 7.0f), vec4<f32>(8.0f, 9.0f, 10.0f, 11.0f), vec4<f32>(12.0f, 13.0f, 14.0f, 15.0f));
+
+@group(0) @binding(0) var<storage, read_write> out : mat4x4<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x4/load/f16.wgsl b/test/tint/expressions/type_ctor/mat4x4/load/f16.wgsl
index a997031..ff0f3bc 100644
--- a/test/tint/expressions/type_ctor/mat4x4/load/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x4/load/f16.wgsl
@@ -1,5 +1,10 @@
enable f16;
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat4x4<f16>;
+
+@compute @workgroup_size(1)
fn f() {
- var m = mat4x4<f16>();
- let m_1 = mat4x4(m);
+ var m = mat4x4<f16>();
+ out = mat4x4(m);
}
diff --git a/test/tint/expressions/type_ctor/mat4x4/load/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/load/f16.wgsl.expected.dxc.hlsl
index 9eb4352..ebc0e9f 100644
--- a/test/tint/expressions/type_ctor/mat4x4/load/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x4/load/f16.wgsl.expected.dxc.hlsl
@@ -1,9 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 4, 4> value) {
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 8u), value[1u]);
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 16u), value[2u]);
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 24u), value[3u]);
}
+[numthreads(1, 1, 1)]
void f() {
matrix<float16_t, 4, 4> m = matrix<float16_t, 4, 4>((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx);
- const matrix<float16_t, 4, 4> m_1 = matrix<float16_t, 4, 4>(m);
+ tint_symbol_store(0u, matrix<float16_t, 4, 4>(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat4x4/load/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x4/load/f16.wgsl.expected.glsl
index 0ea582d..2e33345 100644
--- a/test/tint/expressions/type_ctor/mat4x4/load/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat4x4/load/f16.wgsl.expected.glsl
@@ -1,12 +1,17 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
- return;
-}
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat4 inner;
+} tint_symbol;
+
void f() {
f16mat4 m = f16mat4(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf));
- f16mat4 m_1 = f16mat4(m);
+ tint_symbol.inner = f16mat4(m);
}
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ f();
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x4/load/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x4/load/f16.wgsl.expected.msl
index b63a8b4..1022a88 100644
--- a/test/tint/expressions/type_ctor/mat4x4/load/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat4x4/load/f16.wgsl.expected.msl
@@ -1,8 +1,9 @@
#include <metal_stdlib>
using namespace metal;
-void f() {
+kernel void f(device half4x4* tint_symbol [[buffer(0)]]) {
half4x4 m = half4x4(half4(0.0h), half4(0.0h), half4(0.0h), half4(0.0h));
- half4x4 const m_1 = half4x4(m);
+ *(tint_symbol) = half4x4(m);
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat4x4/load/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x4/load/f16.wgsl.expected.spvasm
index ba9b0c7..d033854 100644
--- a/test/tint/expressions/type_ctor/mat4x4/load/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat4x4/load/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 15
+; Bound: 20
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,26 +9,38 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
- OpName %unused_entry_point "unused_entry_point"
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
OpName %f "f"
OpName %m "m"
- %void = OpTypeVoid
- %1 = OpTypeFunction %void
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v4half = OpTypeVector %half 4
%mat4v4half = OpTypeMatrix %v4half 4
- %10 = OpConstantNull %mat4v4half
+ %out_block = OpTypeStruct %mat4v4half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void
+ %11 = OpConstantNull %mat4v4half
%_ptr_Function_mat4v4half = OpTypePointer Function %mat4v4half
-%unused_entry_point = OpFunction %void None %1
- %4 = OpLabel
- OpReturn
- OpFunctionEnd
- %f = OpFunction %void None %1
- %6 = OpLabel
- %m = OpVariable %_ptr_Function_mat4v4half Function %10
- OpStore %m %10
- %14 = OpLoad %mat4v4half %m
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat4v4half = OpTypePointer StorageBuffer %mat4v4half
+ %f = OpFunction %void None %7
+ %10 = OpLabel
+ %m = OpVariable %_ptr_Function_mat4v4half Function %11
+ OpStore %m %11
+ %17 = OpAccessChain %_ptr_StorageBuffer_mat4v4half %out %uint_0
+ %19 = OpLoad %mat4v4half %m
+ OpStore %17 %19
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat4x4/load/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x4/load/f16.wgsl.expected.wgsl
index 2907c89b..83ce03c 100644
--- a/test/tint/expressions/type_ctor/mat4x4/load/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x4/load/f16.wgsl.expected.wgsl
@@ -1,6 +1,9 @@
enable f16;
+@group(0) @binding(0) var<storage, read_write> out : mat4x4<f16>;
+
+@compute @workgroup_size(1)
fn f() {
var m = mat4x4<f16>();
- let m_1 = mat4x4(m);
+ out = mat4x4(m);
}
diff --git a/test/tint/expressions/type_ctor/mat4x4/load/f32.wgsl b/test/tint/expressions/type_ctor/mat4x4/load/f32.wgsl
index b361a63..12888f4 100644
--- a/test/tint/expressions/type_ctor/mat4x4/load/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x4/load/f32.wgsl
@@ -1,4 +1,8 @@
+@group(0) @binding(0)
+var<storage, read_write> out : mat4x4<f32>;
+
+@compute @workgroup_size(1)
fn f() {
- var m = mat4x4<f32>();
- let m_1 = mat4x4(m);
+ var m = mat4x4<f32>();
+ out = mat4x4(m);
}
diff --git a/test/tint/expressions/type_ctor/mat4x4/load/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/load/f32.wgsl.expected.dxc.hlsl
index 03e51e9..2d77841 100644
--- a/test/tint/expressions/type_ctor/mat4x4/load/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x4/load/f32.wgsl.expected.dxc.hlsl
@@ -1,9 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store4((offset + 32u), asuint(value[2u]));
+ tint_symbol.Store4((offset + 48u), asuint(value[3u]));
}
+[numthreads(1, 1, 1)]
void f() {
float4x4 m = float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx);
- const float4x4 m_1 = float4x4(m);
+ tint_symbol_store(0u, float4x4(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat4x4/load/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/load/f32.wgsl.expected.fxc.hlsl
index 03e51e9..2d77841 100644
--- a/test/tint/expressions/type_ctor/mat4x4/load/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x4/load/f32.wgsl.expected.fxc.hlsl
@@ -1,9 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store4((offset + 32u), asuint(value[2u]));
+ tint_symbol.Store4((offset + 48u), asuint(value[3u]));
}
+[numthreads(1, 1, 1)]
void f() {
float4x4 m = float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx);
- const float4x4 m_1 = float4x4(m);
+ tint_symbol_store(0u, float4x4(m));
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat4x4/load/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x4/load/f32.wgsl.expected.glsl
index aa36f7c..88a86e5 100644
--- a/test/tint/expressions/type_ctor/mat4x4/load/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat4x4/load/f32.wgsl.expected.glsl
@@ -1,11 +1,16 @@
#version 310 es
-layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
- return;
-}
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat4 inner;
+} tint_symbol;
+
void f() {
mat4 m = mat4(vec4(0.0f), vec4(0.0f), vec4(0.0f), vec4(0.0f));
- mat4 m_1 = mat4(m);
+ tint_symbol.inner = mat4(m);
}
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ f();
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x4/load/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x4/load/f32.wgsl.expected.msl
index 019e73b..b95976d 100644
--- a/test/tint/expressions/type_ctor/mat4x4/load/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat4x4/load/f32.wgsl.expected.msl
@@ -1,8 +1,9 @@
#include <metal_stdlib>
using namespace metal;
-void f() {
+kernel void f(device float4x4* tint_symbol [[buffer(0)]]) {
float4x4 m = float4x4(float4(0.0f), float4(0.0f), float4(0.0f), float4(0.0f));
- float4x4 const m_1 = float4x4(m);
+ *(tint_symbol) = float4x4(m);
+ return;
}
diff --git a/test/tint/expressions/type_ctor/mat4x4/load/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x4/load/f32.wgsl.expected.spvasm
index 373458c..463dfff 100644
--- a/test/tint/expressions/type_ctor/mat4x4/load/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat4x4/load/f32.wgsl.expected.spvasm
@@ -1,30 +1,42 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 15
+; Bound: 20
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
- OpName %unused_entry_point "unused_entry_point"
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
OpName %f "f"
OpName %m "m"
- %void = OpTypeVoid
- %1 = OpTypeFunction %void
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%mat4v4float = OpTypeMatrix %v4float 4
- %10 = OpConstantNull %mat4v4float
+ %out_block = OpTypeStruct %mat4v4float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void
+ %11 = OpConstantNull %mat4v4float
%_ptr_Function_mat4v4float = OpTypePointer Function %mat4v4float
-%unused_entry_point = OpFunction %void None %1
- %4 = OpLabel
- OpReturn
- OpFunctionEnd
- %f = OpFunction %void None %1
- %6 = OpLabel
- %m = OpVariable %_ptr_Function_mat4v4float Function %10
- OpStore %m %10
- %14 = OpLoad %mat4v4float %m
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat4v4float = OpTypePointer StorageBuffer %mat4v4float
+ %f = OpFunction %void None %7
+ %10 = OpLabel
+ %m = OpVariable %_ptr_Function_mat4v4float Function %11
+ OpStore %m %11
+ %17 = OpAccessChain %_ptr_StorageBuffer_mat4v4float %out %uint_0
+ %19 = OpLoad %mat4v4float %m
+ OpStore %17 %19
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat4x4/load/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x4/load/f32.wgsl.expected.wgsl
index 6fabb6a..c4a300d 100644
--- a/test/tint/expressions/type_ctor/mat4x4/load/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x4/load/f32.wgsl.expected.wgsl
@@ -1,4 +1,7 @@
+@group(0) @binding(0) var<storage, read_write> out : mat4x4<f32>;
+
+@compute @workgroup_size(1)
fn f() {
var m = mat4x4<f32>();
- let m_1 = mat4x4(m);
+ out = mat4x4(m);
}
diff --git a/test/tint/expressions/type_ctor/mat4x4/zero/f16.wgsl b/test/tint/expressions/type_ctor/mat4x4/zero/f16.wgsl
index 3968945..2d197af 100644
--- a/test/tint/expressions/type_ctor/mat4x4/zero/f16.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x4/zero/f16.wgsl
@@ -1,2 +1,10 @@
enable f16;
var<private> m = mat4x4<f16>();
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat4x4<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x4/zero/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/zero/f16.wgsl.expected.dxc.hlsl
index 434fa7d..5b22e0a 100644
--- a/test/tint/expressions/type_ctor/mat4x4/zero/f16.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x4/zero/f16.wgsl.expected.dxc.hlsl
@@ -1,6 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static matrix<float16_t, 4, 4> m = matrix<float16_t, 4, 4>((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx);
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, matrix<float16_t, 4, 4> value) {
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 0u), value[0u]);
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 8u), value[1u]);
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 16u), value[2u]);
+ tint_symbol.Store<vector<float16_t, 4> >((offset + 24u), value[3u]);
}
-static matrix<float16_t, 4, 4> m = matrix<float16_t, 4, 4>((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx);
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x4/zero/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x4/zero/f16.wgsl.expected.glsl
index cecf0ff..f3c27c6 100644
--- a/test/tint/expressions/type_ctor/mat4x4/zero/f16.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat4x4/zero/f16.wgsl.expected.glsl
@@ -1,8 +1,17 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
+f16mat4 m = f16mat4(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ f16mat4 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-f16mat4 m = f16mat4(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf));
diff --git a/test/tint/expressions/type_ctor/mat4x4/zero/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x4/zero/f16.wgsl.expected.msl
index b9a8b98..25a1a5f 100644
--- a/test/tint/expressions/type_ctor/mat4x4/zero/f16.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat4x4/zero/f16.wgsl.expected.msl
@@ -5,3 +5,10 @@
half4x4 m;
};
+kernel void f(device half4x4* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = half4x4(half4(0.0h), half4(0.0h), half4(0.0h), half4(0.0h));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat4x4/zero/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x4/zero/f16.wgsl.expected.spvasm
index 34c0617..02d954d 100644
--- a/test/tint/expressions/type_ctor/mat4x4/zero/f16.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat4x4/zero/f16.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 11
+; Bound: 19
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -9,19 +9,37 @@
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 8
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%half = OpTypeFloat 16
%v4half = OpTypeVector %half 4
%mat4v4half = OpTypeMatrix %v4half 4
%4 = OpConstantNull %mat4v4half
%_ptr_Private_mat4v4half = OpTypePointer Private %mat4v4half
%m = OpVariable %_ptr_Private_mat4v4half Private %4
+ %out_block = OpTypeStruct %mat4v4half
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %7 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %7
- %10 = OpLabel
+ %10 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat4v4half = OpTypePointer StorageBuffer %mat4v4half
+ %f = OpFunction %void None %10
+ %13 = OpLabel
+ %17 = OpAccessChain %_ptr_StorageBuffer_mat4v4half %out %uint_0
+ %18 = OpLoad %mat4v4half %m
+ OpStore %17 %18
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat4x4/zero/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x4/zero/f16.wgsl.expected.wgsl
index c944f80..12ac36f 100644
--- a/test/tint/expressions/type_ctor/mat4x4/zero/f16.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x4/zero/f16.wgsl.expected.wgsl
@@ -1,3 +1,10 @@
enable f16;
var<private> m = mat4x4<f16>();
+
+@group(0) @binding(0) var<storage, read_write> out : mat4x4<f16>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x4/zero/f32.wgsl b/test/tint/expressions/type_ctor/mat4x4/zero/f32.wgsl
index 9a80a22..addadb4 100644
--- a/test/tint/expressions/type_ctor/mat4x4/zero/f32.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x4/zero/f32.wgsl
@@ -1 +1,9 @@
var<private> m = mat4x4<f32>();
+
+@group(0) @binding(0)
+var<storage, read_write> out : mat4x4<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x4/zero/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/zero/f32.wgsl.expected.dxc.hlsl
index a1f75e2..04cee9d 100644
--- a/test/tint/expressions/type_ctor/mat4x4/zero/f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x4/zero/f32.wgsl.expected.dxc.hlsl
@@ -1,6 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float4x4 m = float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx);
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store4((offset + 32u), asuint(value[2u]));
+ tint_symbol.Store4((offset + 48u), asuint(value[3u]));
}
-static float4x4 m = float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx);
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x4/zero/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/zero/f32.wgsl.expected.fxc.hlsl
index a1f75e2..04cee9d 100644
--- a/test/tint/expressions/type_ctor/mat4x4/zero/f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/expressions/type_ctor/mat4x4/zero/f32.wgsl.expected.fxc.hlsl
@@ -1,6 +1,15 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
+static float4x4 m = float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx);
+RWByteAddressBuffer tint_symbol : register(u0);
+
+void tint_symbol_store(uint offset, float4x4 value) {
+ tint_symbol.Store4((offset + 0u), asuint(value[0u]));
+ tint_symbol.Store4((offset + 16u), asuint(value[1u]));
+ tint_symbol.Store4((offset + 32u), asuint(value[2u]));
+ tint_symbol.Store4((offset + 48u), asuint(value[3u]));
}
-static float4x4 m = float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx);
+[numthreads(1, 1, 1)]
+void f() {
+ tint_symbol_store(0u, m);
+ return;
+}
diff --git a/test/tint/expressions/type_ctor/mat4x4/zero/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x4/zero/f32.wgsl.expected.glsl
index b5f43a3..5f85da5 100644
--- a/test/tint/expressions/type_ctor/mat4x4/zero/f32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_ctor/mat4x4/zero/f32.wgsl.expected.glsl
@@ -1,7 +1,16 @@
#version 310 es
+mat4 m = mat4(vec4(0.0f), vec4(0.0f), vec4(0.0f), vec4(0.0f));
+layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
+ mat4 inner;
+} tint_symbol;
+
+void f() {
+ tint_symbol.inner = m;
+}
+
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void unused_entry_point() {
+void main() {
+ f();
return;
}
-mat4 m = mat4(vec4(0.0f), vec4(0.0f), vec4(0.0f), vec4(0.0f));
diff --git a/test/tint/expressions/type_ctor/mat4x4/zero/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x4/zero/f32.wgsl.expected.msl
index ee88253..7ddd29e 100644
--- a/test/tint/expressions/type_ctor/mat4x4/zero/f32.wgsl.expected.msl
+++ b/test/tint/expressions/type_ctor/mat4x4/zero/f32.wgsl.expected.msl
@@ -5,3 +5,10 @@
float4x4 m;
};
+kernel void f(device float4x4* tint_symbol [[buffer(0)]]) {
+ thread tint_private_vars_struct tint_private_vars = {};
+ tint_private_vars.m = float4x4(float4(0.0f), float4(0.0f), float4(0.0f), float4(0.0f));
+ *(tint_symbol) = tint_private_vars.m;
+ return;
+}
+
diff --git a/test/tint/expressions/type_ctor/mat4x4/zero/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x4/zero/f32.wgsl.expected.spvasm
index fc3f2dd..38ee7c6 100644
--- a/test/tint/expressions/type_ctor/mat4x4/zero/f32.wgsl.expected.spvasm
+++ b/test/tint/expressions/type_ctor/mat4x4/zero/f32.wgsl.expected.spvasm
@@ -1,23 +1,41 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 11
+; Bound: 19
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
+ OpEntryPoint GLCompute %f "f"
+ OpExecutionMode %f LocalSize 1 1 1
OpName %m "m"
- OpName %unused_entry_point "unused_entry_point"
+ OpName %out_block "out_block"
+ OpMemberName %out_block 0 "inner"
+ OpName %out "out"
+ OpName %f "f"
+ OpDecorate %out_block Block
+ OpMemberDecorate %out_block 0 Offset 0
+ OpMemberDecorate %out_block 0 ColMajor
+ OpMemberDecorate %out_block 0 MatrixStride 16
+ OpDecorate %out DescriptorSet 0
+ OpDecorate %out Binding 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%mat4v4float = OpTypeMatrix %v4float 4
%4 = OpConstantNull %mat4v4float
%_ptr_Private_mat4v4float = OpTypePointer Private %mat4v4float
%m = OpVariable %_ptr_Private_mat4v4float Private %4
+ %out_block = OpTypeStruct %mat4v4float
+%_ptr_StorageBuffer_out_block = OpTypePointer StorageBuffer %out_block
+ %out = OpVariable %_ptr_StorageBuffer_out_block StorageBuffer
%void = OpTypeVoid
- %7 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %7
- %10 = OpLabel
+ %10 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_mat4v4float = OpTypePointer StorageBuffer %mat4v4float
+ %f = OpFunction %void None %10
+ %13 = OpLabel
+ %17 = OpAccessChain %_ptr_StorageBuffer_mat4v4float %out %uint_0
+ %18 = OpLoad %mat4v4float %m
+ OpStore %17 %18
OpReturn
OpFunctionEnd
diff --git a/test/tint/expressions/type_ctor/mat4x4/zero/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x4/zero/f32.wgsl.expected.wgsl
index 9a80a22..94f4995 100644
--- a/test/tint/expressions/type_ctor/mat4x4/zero/f32.wgsl.expected.wgsl
+++ b/test/tint/expressions/type_ctor/mat4x4/zero/f32.wgsl.expected.wgsl
@@ -1 +1,8 @@
var<private> m = mat4x4<f32>();
+
+@group(0) @binding(0) var<storage, read_write> out : mat4x4<f32>;
+
+@compute @workgroup_size(1)
+fn f() {
+ out = m;
+}