test: Add matrix constructor tests that take a vector

Bug: tint:1334
Change-Id: I7e625da4bd270b6d0bfdb43fbd8dbe41682180f9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72141
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
Ben Clayton 2021-12-09 14:37:37 +00:00
parent cf09c23a12
commit e306927ff5
45 changed files with 423 additions and 0 deletions

View File

@ -0,0 +1,2 @@
let m = mat2x2<f32>(vec2<f32>(0.0, 1.0),
vec2<f32>(2.0, 3.0));

View File

@ -0,0 +1,6 @@
[numthreads(1, 1, 1)]
void unused_entry_point() {
return;
}
static const float2x2 m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f));

View File

@ -0,0 +1,4 @@
#include <metal_stdlib>
using namespace metal;
constant float2x2 m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f));

View File

@ -0,0 +1,27 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 15
; 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"
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%mat2v2float = OpTypeMatrix %v2float 2
%float_0 = OpConstant %float 0
%float_1 = OpConstant %float 1
%6 = OpConstantComposite %v2float %float_0 %float_1
%float_2 = OpConstant %float 2
%float_3 = OpConstant %float 3
%9 = OpConstantComposite %v2float %float_2 %float_3
%m = OpConstantComposite %mat2v2float %6 %9
%void = OpTypeVoid
%11 = OpTypeFunction %void
%unused_entry_point = OpFunction %void None %11
%14 = OpLabel
OpReturn
OpFunctionEnd

View File

@ -0,0 +1 @@
let m = mat2x2<f32>(vec2<f32>(0.0, 1.0), vec2<f32>(2.0, 3.0));

View File

@ -0,0 +1,2 @@
let m = mat2x3<f32>(vec3<f32>(0.0, 1.0, 2.0),
vec3<f32>(3.0, 4.0, 5.0));

View File

@ -0,0 +1,6 @@
[numthreads(1, 1, 1)]
void unused_entry_point() {
return;
}
static const float2x3 m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f));

View File

@ -0,0 +1,4 @@
#include <metal_stdlib>
using namespace metal;
constant float2x3 m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f));

View File

@ -0,0 +1,29 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 17
; 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"
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%mat2v3float = OpTypeMatrix %v3float 2
%float_0 = OpConstant %float 0
%float_1 = OpConstant %float 1
%float_2 = OpConstant %float 2
%7 = OpConstantComposite %v3float %float_0 %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
%m = OpConstantComposite %mat2v3float %7 %11
%void = OpTypeVoid
%13 = OpTypeFunction %void
%unused_entry_point = OpFunction %void None %13
%16 = OpLabel
OpReturn
OpFunctionEnd

View File

@ -0,0 +1 @@
let m = mat2x3<f32>(vec3<f32>(0.0, 1.0, 2.0), vec3<f32>(3.0, 4.0, 5.0));

View File

@ -0,0 +1,2 @@
let m = mat2x4<f32>(vec4<f32>(0.0, 1.0, 2.0, 3.0),
vec4<f32>(4.0, 5.0, 6.0, 7.0));

View File

@ -0,0 +1,6 @@
[numthreads(1, 1, 1)]
void unused_entry_point() {
return;
}
static const float2x4 m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f));

View File

@ -0,0 +1,4 @@
#include <metal_stdlib>
using namespace metal;
constant float2x4 m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f));

View File

@ -0,0 +1,31 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; 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
OpName %m "m"
OpName %unused_entry_point "unused_entry_point"
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%mat2v4float = OpTypeMatrix %v4float 2
%float_0 = OpConstant %float 0
%float_1 = OpConstant %float 1
%float_2 = OpConstant %float 2
%float_3 = OpConstant %float 3
%8 = OpConstantComposite %v4float %float_0 %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
%m = OpConstantComposite %mat2v4float %8 %13
%void = OpTypeVoid
%15 = OpTypeFunction %void
%unused_entry_point = OpFunction %void None %15
%18 = OpLabel
OpReturn
OpFunctionEnd

View File

@ -0,0 +1 @@
let m = mat2x4<f32>(vec4<f32>(0.0, 1.0, 2.0, 3.0), vec4<f32>(4.0, 5.0, 6.0, 7.0));

View File

@ -0,0 +1,3 @@
let m = mat3x2<f32>(vec2<f32>(0.0, 1.0),
vec2<f32>(2.0, 3.0),
vec2<f32>(4.0, 5.0));

View File

@ -0,0 +1,6 @@
[numthreads(1, 1, 1)]
void unused_entry_point() {
return;
}
static const float3x2 m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f));

View File

@ -0,0 +1,4 @@
#include <metal_stdlib>
using namespace metal;
constant float3x2 m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f));

View File

@ -0,0 +1,30 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 18
; 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"
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%mat3v2float = OpTypeMatrix %v2float 3
%float_0 = OpConstant %float 0
%float_1 = OpConstant %float 1
%6 = OpConstantComposite %v2float %float_0 %float_1
%float_2 = OpConstant %float 2
%float_3 = OpConstant %float 3
%9 = OpConstantComposite %v2float %float_2 %float_3
%float_4 = OpConstant %float 4
%float_5 = OpConstant %float 5
%12 = OpConstantComposite %v2float %float_4 %float_5
%m = OpConstantComposite %mat3v2float %6 %9 %12
%void = OpTypeVoid
%14 = OpTypeFunction %void
%unused_entry_point = OpFunction %void None %14
%17 = OpLabel
OpReturn
OpFunctionEnd

View File

@ -0,0 +1 @@
let m = mat3x2<f32>(vec2<f32>(0.0, 1.0), vec2<f32>(2.0, 3.0), vec2<f32>(4.0, 5.0));

View File

@ -0,0 +1,3 @@
let m = mat3x3<f32>(vec3<f32>(0.0, 1.0, 2.0),
vec3<f32>(3.0, 4.0, 5.0),
vec3<f32>(6.0, 7.0, 8.0));

View File

@ -0,0 +1,6 @@
[numthreads(1, 1, 1)]
void unused_entry_point() {
return;
}
static const float3x3 m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f));

View File

@ -0,0 +1,4 @@
#include <metal_stdlib>
using namespace metal;
constant float3x3 m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f));

View File

@ -0,0 +1,33 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 21
; 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"
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%mat3v3float = OpTypeMatrix %v3float 3
%float_0 = OpConstant %float 0
%float_1 = OpConstant %float 1
%float_2 = OpConstant %float 2
%7 = OpConstantComposite %v3float %float_0 %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
%float_6 = OpConstant %float 6
%float_7 = OpConstant %float 7
%float_8 = OpConstant %float 8
%15 = OpConstantComposite %v3float %float_6 %float_7 %float_8
%m = OpConstantComposite %mat3v3float %7 %11 %15
%void = OpTypeVoid
%17 = OpTypeFunction %void
%unused_entry_point = OpFunction %void None %17
%20 = OpLabel
OpReturn
OpFunctionEnd

View File

@ -0,0 +1 @@
let m = mat3x3<f32>(vec3<f32>(0.0, 1.0, 2.0), vec3<f32>(3.0, 4.0, 5.0), vec3<f32>(6.0, 7.0, 8.0));

View File

@ -0,0 +1,3 @@
let m = mat3x4<f32>(vec4<f32>(0.0, 1.0, 2.0, 3.0),
vec4<f32>(4.0, 5.0, 6.0, 7.0),
vec4<f32>(8.0, 9.0, 10.0, 11.0));

View File

@ -0,0 +1,6 @@
[numthreads(1, 1, 1)]
void unused_entry_point() {
return;
}
static const 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));

View File

@ -0,0 +1,4 @@
#include <metal_stdlib>
using namespace metal;
constant 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));

View File

@ -0,0 +1,36 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 24
; 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"
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%mat3v4float = OpTypeMatrix %v4float 3
%float_0 = OpConstant %float 0
%float_1 = OpConstant %float 1
%float_2 = OpConstant %float 2
%float_3 = OpConstant %float 3
%8 = OpConstantComposite %v4float %float_0 %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
%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
%m = OpConstantComposite %mat3v4float %8 %13 %18
%void = OpTypeVoid
%20 = OpTypeFunction %void
%unused_entry_point = OpFunction %void None %20
%23 = OpLabel
OpReturn
OpFunctionEnd

View File

@ -0,0 +1 @@
let m = mat3x4<f32>(vec4<f32>(0.0, 1.0, 2.0, 3.0), vec4<f32>(4.0, 5.0, 6.0, 7.0), vec4<f32>(8.0, 9.0, 10.0, 11.0));

View File

@ -0,0 +1,4 @@
let m = mat4x2<f32>(vec2<f32>(0.0, 1.0),
vec2<f32>(2.0, 3.0),
vec2<f32>(4.0, 5.0),
vec2<f32>(6.0, 7.0));

View File

@ -0,0 +1,6 @@
[numthreads(1, 1, 1)]
void unused_entry_point() {
return;
}
static const float4x2 m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f));

View File

@ -0,0 +1,4 @@
#include <metal_stdlib>
using namespace metal;
constant float4x2 m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f));

View File

@ -0,0 +1,33 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 21
; 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"
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%mat4v2float = OpTypeMatrix %v2float 4
%float_0 = OpConstant %float 0
%float_1 = OpConstant %float 1
%6 = OpConstantComposite %v2float %float_0 %float_1
%float_2 = OpConstant %float 2
%float_3 = OpConstant %float 3
%9 = OpConstantComposite %v2float %float_2 %float_3
%float_4 = OpConstant %float 4
%float_5 = OpConstant %float 5
%12 = OpConstantComposite %v2float %float_4 %float_5
%float_6 = OpConstant %float 6
%float_7 = OpConstant %float 7
%15 = OpConstantComposite %v2float %float_6 %float_7
%m = OpConstantComposite %mat4v2float %6 %9 %12 %15
%void = OpTypeVoid
%17 = OpTypeFunction %void
%unused_entry_point = OpFunction %void None %17
%20 = OpLabel
OpReturn
OpFunctionEnd

View File

@ -0,0 +1 @@
let m = mat4x2<f32>(vec2<f32>(0.0, 1.0), vec2<f32>(2.0, 3.0), vec2<f32>(4.0, 5.0), vec2<f32>(6.0, 7.0));

View File

@ -0,0 +1,4 @@
let m = mat4x3<f32>(vec3<f32>(0.0, 1.0, 2.0),
vec3<f32>(3.0, 4.0, 5.0),
vec3<f32>(6.0, 7.0, 8.0),
vec3<f32>(9.0, 10.0, 11.0));

View File

@ -0,0 +1,6 @@
[numthreads(1, 1, 1)]
void unused_entry_point() {
return;
}
static const 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));

View File

@ -0,0 +1,4 @@
#include <metal_stdlib>
using namespace metal;
constant 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));

View File

@ -0,0 +1,37 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; 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"
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%mat4v3float = OpTypeMatrix %v3float 4
%float_0 = OpConstant %float 0
%float_1 = OpConstant %float 1
%float_2 = OpConstant %float 2
%7 = OpConstantComposite %v3float %float_0 %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
%float_6 = OpConstant %float 6
%float_7 = OpConstant %float 7
%float_8 = OpConstant %float 8
%15 = 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
%m = OpConstantComposite %mat4v3float %7 %11 %15 %19
%void = OpTypeVoid
%21 = OpTypeFunction %void
%unused_entry_point = OpFunction %void None %21
%24 = OpLabel
OpReturn
OpFunctionEnd

View File

@ -0,0 +1 @@
let m = mat4x3<f32>(vec3<f32>(0.0, 1.0, 2.0), vec3<f32>(3.0, 4.0, 5.0), vec3<f32>(6.0, 7.0, 8.0), vec3<f32>(9.0, 10.0, 11.0));

View File

@ -0,0 +1,4 @@
let m = mat4x4<f32>(vec4<f32>(0.0, 1.0, 2.0, 3.0),
vec4<f32>(4.0, 5.0, 6.0, 7.0),
vec4<f32>(8.0, 9.0, 10.0, 11.0),
vec4<f32>(12.0, 13.0, 14.0, 15.0));

View File

@ -0,0 +1,6 @@
[numthreads(1, 1, 1)]
void unused_entry_point() {
return;
}
static const 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));

View File

@ -0,0 +1,4 @@
#include <metal_stdlib>
using namespace metal;
constant 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));

View File

@ -0,0 +1,41 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; 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
OpName %m "m"
OpName %unused_entry_point "unused_entry_point"
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%mat4v4float = OpTypeMatrix %v4float 4
%float_0 = OpConstant %float 0
%float_1 = OpConstant %float 1
%float_2 = OpConstant %float 2
%float_3 = OpConstant %float 3
%8 = OpConstantComposite %v4float %float_0 %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
%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
%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
%m = OpConstantComposite %mat4v4float %8 %13 %18 %23
%void = OpTypeVoid
%25 = OpTypeFunction %void
%unused_entry_point = OpFunction %void None %25
%28 = OpLabel
OpReturn
OpFunctionEnd

View File

@ -0,0 +1 @@
let m = mat4x4<f32>(vec4<f32>(0.0, 1.0, 2.0, 3.0), vec4<f32>(4.0, 5.0, 6.0, 7.0), vec4<f32>(8.0, 9.0, 10.0, 11.0), vec4<f32>(12.0, 13.0, 14.0, 15.0));