test: Add some basic vector / matrix access tests

Change-Id: I774d7e4b6fdf9d1507bd9cbf3be00bd4113e8162
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/51222
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
Ben Clayton 2021-05-17 22:26:57 +00:00 committed by Commit Bot service account
parent 634c829d2c
commit bb3d963405
40 changed files with 617 additions and 0 deletions

View File

@ -0,0 +1,36 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 25
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %main "main"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%mat3v3float = OpTypeMatrix %v3float 3
%float_1 = OpConstant %float 1
%float_2 = OpConstant %float 2
%float_3 = OpConstant %float 3
%11 = OpConstantComposite %v3float %float_1 %float_2 %float_3
%float_4 = OpConstant %float 4
%float_5 = OpConstant %float 5
%float_6 = OpConstant %float 6
%15 = OpConstantComposite %v3float %float_4 %float_5 %float_6
%float_7 = OpConstant %float 7
%float_8 = OpConstant %float 8
%float_9 = OpConstant %float 9
%19 = OpConstantComposite %v3float %float_7 %float_8 %float_9
%20 = OpConstantComposite %mat3v3float %11 %15 %19
%int = OpTypeInt 32 1
%int_1 = OpConstant %int 1
%main = OpFunction %void None %1
%4 = OpLabel
%23 = OpCompositeExtract %v3float %20 1
%24 = OpCompositeExtract %float %23 1
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,6 @@
[numthreads(1, 1, 1)]
void main() {
const float x_24 = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f))[1u].y;
return;
}

View File

@ -0,0 +1,8 @@
#include <metal_stdlib>
using namespace metal;
kernel void tint_symbol() {
const float x_24 = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f))[1u].y;
return;
}

View File

@ -0,0 +1,36 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 25
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %main "main"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%mat3v3float = OpTypeMatrix %v3float 3
%float_1 = OpConstant %float 1
%float_2 = OpConstant %float 2
%float_3 = OpConstant %float 3
%11 = OpConstantComposite %v3float %float_1 %float_2 %float_3
%float_4 = OpConstant %float 4
%float_5 = OpConstant %float 5
%float_6 = OpConstant %float 6
%15 = OpConstantComposite %v3float %float_4 %float_5 %float_6
%float_7 = OpConstant %float 7
%float_8 = OpConstant %float 8
%float_9 = OpConstant %float 9
%19 = OpConstantComposite %v3float %float_7 %float_8 %float_9
%20 = OpConstantComposite %mat3v3float %11 %15 %19
%uint = OpTypeInt 32 0
%uint_1 = OpConstant %uint 1
%main = OpFunction %void None %1
%4 = OpLabel
%23 = OpCompositeExtract %v3float %20 1
%24 = OpCompositeExtract %float %23 1
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,5 @@
[[stage(compute)]]
fn main() {
let x_24 : f32 = mat3x3<f32>(vec3<f32>(1.0, 2.0, 3.0), vec3<f32>(4.0, 5.0, 6.0), vec3<f32>(7.0, 8.0, 9.0))[1u].y;
return;
}

View File

@ -0,0 +1,6 @@
[[stage(compute)]]
fn main() {
let m : mat3x3<f32> = mat3x3<f32>(vec3<f32>(1., 2., 3.), vec3<f32>(4., 5., 6.), vec3<f32>(7., 8., 9.));
let v : vec3<f32> = m[1];
let f : f32 = v[1];
}

View File

@ -0,0 +1,8 @@
[numthreads(1, 1, 1)]
void main() {
const float3x3 m = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f));
const float3 v = m[1];
const float f = v[1];
return;
}

View File

@ -0,0 +1,10 @@
#include <metal_stdlib>
using namespace metal;
kernel void tint_symbol() {
const float3x3 m = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f));
const float3 v = m[1];
const float f = v[1];
return;
}

View File

@ -0,0 +1,36 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 25
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %main "main"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%mat3v3float = OpTypeMatrix %v3float 3
%float_1 = OpConstant %float 1
%float_2 = OpConstant %float 2
%float_3 = OpConstant %float 3
%11 = OpConstantComposite %v3float %float_1 %float_2 %float_3
%float_4 = OpConstant %float 4
%float_5 = OpConstant %float 5
%float_6 = OpConstant %float 6
%15 = OpConstantComposite %v3float %float_4 %float_5 %float_6
%float_7 = OpConstant %float 7
%float_8 = OpConstant %float 8
%float_9 = OpConstant %float 9
%19 = OpConstantComposite %v3float %float_7 %float_8 %float_9
%20 = OpConstantComposite %mat3v3float %11 %15 %19
%int = OpTypeInt 32 1
%int_1 = OpConstant %int 1
%main = OpFunction %void None %1
%4 = OpLabel
%23 = OpCompositeExtract %v3float %20 1
%24 = OpCompositeExtract %float %23 1
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,6 @@
[[stage(compute)]]
fn main() {
let m : mat3x3<f32> = mat3x3<f32>(vec3<f32>(1.0, 2.0, 3.0), vec3<f32>(4.0, 5.0, 6.0), vec3<f32>(7.0, 8.0, 9.0));
let v : vec3<f32> = m[1];
let f : f32 = v[1];
}

View File

@ -0,0 +1,26 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 15
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %main "main"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%float_1 = OpConstant %float 1
%float_2 = OpConstant %float 2
%float_3 = OpConstant %float 3
%10 = OpConstantComposite %v3float %float_1 %float_2 %float_3
%v2float = OpTypeVector %float 2
%main = OpFunction %void None %1
%4 = OpLabel
%11 = OpCompositeExtract %float %10 1
%13 = OpVectorShuffle %v2float %10 %10 0 2
%14 = OpVectorShuffle %v3float %10 %10 0 2 1
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,8 @@
[numthreads(1, 1, 1)]
void main() {
const float x_11 = float3(1.0f, 2.0f, 3.0f).y;
const float2 x_13 = float2(float3(1.0f, 2.0f, 3.0f).x, float3(1.0f, 2.0f, 3.0f).z);
const float3 x_14 = float3(float3(1.0f, 2.0f, 3.0f).x, float3(1.0f, 2.0f, 3.0f).z, float3(1.0f, 2.0f, 3.0f).y);
return;
}

View File

@ -0,0 +1,10 @@
#include <metal_stdlib>
using namespace metal;
kernel void tint_symbol() {
const float x_11 = float3(1.0f, 2.0f, 3.0f).y;
const float2 x_13 = float2(float3(1.0f, 2.0f, 3.0f).x, float3(1.0f, 2.0f, 3.0f).z);
const float3 x_14 = float3(float3(1.0f, 2.0f, 3.0f).x, float3(1.0f, 2.0f, 3.0f).z, float3(1.0f, 2.0f, 3.0f).y);
return;
}

View File

@ -0,0 +1,31 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 20
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %main "main"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%float_1 = OpConstant %float 1
%float_2 = OpConstant %float 2
%float_3 = OpConstant %float 3
%10 = OpConstantComposite %v3float %float_1 %float_2 %float_3
%v2float = OpTypeVector %float 2
%main = OpFunction %void None %1
%4 = OpLabel
%11 = OpCompositeExtract %float %10 1
%13 = OpCompositeExtract %float %10 0
%14 = OpCompositeExtract %float %10 2
%15 = OpCompositeConstruct %v2float %13 %14
%16 = OpCompositeExtract %float %10 0
%17 = OpCompositeExtract %float %10 2
%18 = OpCompositeExtract %float %10 1
%19 = OpCompositeConstruct %v3float %16 %17 %18
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,7 @@
[[stage(compute)]]
fn main() {
let x_11 : f32 = vec3<f32>(1.0, 2.0, 3.0).y;
let x_13 : vec2<f32> = vec2<f32>(vec3<f32>(1.0, 2.0, 3.0).x, vec3<f32>(1.0, 2.0, 3.0).z);
let x_14 : vec3<f32> = vec3<f32>(vec3<f32>(1.0, 2.0, 3.0).x, vec3<f32>(1.0, 2.0, 3.0).z, vec3<f32>(1.0, 2.0, 3.0).y);
return;
}

View File

@ -0,0 +1,7 @@
[[stage(compute)]]
fn main() {
let v : vec3<f32> = vec3<f32>(1., 2., 3.);
let scalar : f32 = v.y;
let swizzle2 : vec2<f32> = v.xz;
let swizzle3 : vec3<f32> = v.xzy;
}

View File

@ -0,0 +1,9 @@
[numthreads(1, 1, 1)]
void main() {
const float3 v = float3(1.0f, 2.0f, 3.0f);
const float scalar = v.y;
const float2 swizzle2 = v.xz;
const float3 swizzle3 = v.xzy;
return;
}

View File

@ -0,0 +1,11 @@
#include <metal_stdlib>
using namespace metal;
kernel void tint_symbol() {
const float3 v = float3(1.0f, 2.0f, 3.0f);
const float scalar = v.y;
const float2 swizzle2 = v.xz;
const float3 swizzle3 = v.xzy;
return;
}

View File

@ -0,0 +1,26 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 15
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %main "main"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%float_1 = OpConstant %float 1
%float_2 = OpConstant %float 2
%float_3 = OpConstant %float 3
%10 = OpConstantComposite %v3float %float_1 %float_2 %float_3
%v2float = OpTypeVector %float 2
%main = OpFunction %void None %1
%4 = OpLabel
%11 = OpCompositeExtract %float %10 1
%13 = OpVectorShuffle %v2float %10 %10 0 2
%14 = OpVectorShuffle %v3float %10 %10 0 2 1
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,7 @@
[[stage(compute)]]
fn main() {
let v : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
let scalar : f32 = v.y;
let swizzle2 : vec2<f32> = v.xz;
let swizzle3 : vec3<f32> = v.xzy;
}

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 %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %main "main"
OpName %m "m"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%mat3v3float = OpTypeMatrix %v3float 3
%_ptr_Function_mat3v3float = OpTypePointer Function %mat3v3float
%10 = OpConstantNull %mat3v3float
%int = OpTypeInt 32 1
%int_1 = OpConstant %int 1
%_ptr_Function_v3float = OpTypePointer Function %v3float
%main = OpFunction %void None %1
%4 = OpLabel
%m = OpVariable %_ptr_Function_mat3v3float Function %10
%14 = OpAccessChain %_ptr_Function_v3float %m %int_1
%15 = OpLoad %v3float %14
%16 = OpCompositeExtract %float %15 1
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,8 @@
[numthreads(1, 1, 1)]
void main() {
float3x3 m = float3x3(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f));
const float3 x_15 = m[1];
const float x_16 = x_15.y;
return;
}

View File

@ -0,0 +1,10 @@
#include <metal_stdlib>
using namespace metal;
kernel void tint_symbol() {
float3x3 m = float3x3(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f));
const float3 x_15 = m[1];
const float x_16 = x_15.y;
return;
}

View File

@ -0,0 +1,33 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 20
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %main "main"
OpName %m "m"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%mat3v3float = OpTypeMatrix %v3float 3
%float_0 = OpConstant %float 0
%9 = OpConstantComposite %v3float %float_0 %float_0 %float_0
%10 = OpConstantComposite %mat3v3float %9 %9 %9
%_ptr_Function_mat3v3float = OpTypePointer Function %mat3v3float
%13 = OpConstantNull %mat3v3float
%int = OpTypeInt 32 1
%int_1 = OpConstant %int 1
%_ptr_Function_v3float = OpTypePointer Function %v3float
%main = OpFunction %void None %1
%4 = OpLabel
%m = OpVariable %_ptr_Function_mat3v3float Function %13
OpStore %m %10
%17 = OpAccessChain %_ptr_Function_v3float %m %int_1
%18 = OpLoad %v3float %17
%19 = OpCompositeExtract %float %18 1
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,7 @@
[[stage(compute)]]
fn main() {
var m : mat3x3<f32> = mat3x3<f32>(vec3<f32>(0.0, 0.0, 0.0), vec3<f32>(0.0, 0.0, 0.0), vec3<f32>(0.0, 0.0, 0.0));
let x_15 : vec3<f32> = m[1];
let x_16 : f32 = x_15.y;
return;
}

View File

@ -0,0 +1,6 @@
[[stage(compute)]]
fn main() {
var m : mat3x3<f32>;
let v : vec3<f32> = m[1];
let f : f32 = v[1];
}

View File

@ -0,0 +1,8 @@
[numthreads(1, 1, 1)]
void main() {
float3x3 m;
const float3 v = m[1];
const float f = v[1];
return;
}

View File

@ -0,0 +1,10 @@
#include <metal_stdlib>
using namespace metal;
kernel void tint_symbol() {
float3x3 m = 0.0f;
const float3 v = m[1];
const float f = v[1];
return;
}

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 %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %main "main"
OpName %m "m"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%mat3v3float = OpTypeMatrix %v3float 3
%_ptr_Function_mat3v3float = OpTypePointer Function %mat3v3float
%10 = OpConstantNull %mat3v3float
%int = OpTypeInt 32 1
%int_1 = OpConstant %int 1
%_ptr_Function_v3float = OpTypePointer Function %v3float
%main = OpFunction %void None %1
%4 = OpLabel
%m = OpVariable %_ptr_Function_mat3v3float Function %10
%14 = OpAccessChain %_ptr_Function_v3float %m %int_1
%15 = OpLoad %v3float %14
%16 = OpCompositeExtract %float %15 1
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,6 @@
[[stage(compute)]]
fn main() {
var m : mat3x3<f32>;
let v : vec3<f32> = m[1];
let f : f32 = v[1];
}

View File

@ -0,0 +1,32 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 20
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %main "main"
OpName %v "v"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%_ptr_Function_v3float = OpTypePointer Function %v3float
%9 = OpConstantNull %v3float
%uint = OpTypeInt 32 0
%uint_1 = OpConstant %uint 1
%_ptr_Function_float = OpTypePointer Function %float
%v2float = OpTypeVector %float 2
%main = OpFunction %void None %1
%4 = OpLabel
%v = OpVariable %_ptr_Function_v3float Function %9
%13 = OpAccessChain %_ptr_Function_float %v %uint_1
%14 = OpLoad %float %13
%16 = OpLoad %v3float %v
%17 = OpVectorShuffle %v2float %16 %16 0 2
%18 = OpLoad %v3float %v
%19 = OpVectorShuffle %v3float %18 %18 0 2 1
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,11 @@
[numthreads(1, 1, 1)]
void main() {
float3 v = float3(0.0f, 0.0f, 0.0f);
const float x_14 = v.y;
const float3 x_16 = v;
const float2 x_17 = float2(x_16.x, x_16.z);
const float3 x_18 = v;
const float3 x_19 = float3(x_18.x, x_18.z, x_18.y);
return;
}

View File

@ -0,0 +1,13 @@
#include <metal_stdlib>
using namespace metal;
kernel void tint_symbol() {
float3 v = float3(0.0f, 0.0f, 0.0f);
const float x_14 = v.y;
const float3 x_16 = v;
const float2 x_17 = float2(x_16.x, x_16.z);
const float3 x_18 = v;
const float3 x_19 = float3(x_18.x, x_18.z, x_18.y);
return;
}

View File

@ -0,0 +1,40 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 27
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %main "main"
OpName %v "v"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%float_0 = OpConstant %float 0
%8 = OpConstantComposite %v3float %float_0 %float_0 %float_0
%_ptr_Function_v3float = OpTypePointer Function %v3float
%11 = OpConstantNull %v3float
%uint = OpTypeInt 32 0
%uint_1 = OpConstant %uint 1
%_ptr_Function_float = OpTypePointer Function %float
%v2float = OpTypeVector %float 2
%main = OpFunction %void None %1
%4 = OpLabel
%v = OpVariable %_ptr_Function_v3float Function %11
OpStore %v %8
%15 = OpAccessChain %_ptr_Function_float %v %uint_1
%16 = OpLoad %float %15
%17 = OpLoad %v3float %v
%19 = OpCompositeExtract %float %17 0
%20 = OpCompositeExtract %float %17 2
%21 = OpCompositeConstruct %v2float %19 %20
%22 = OpLoad %v3float %v
%23 = OpCompositeExtract %float %22 0
%24 = OpCompositeExtract %float %22 2
%25 = OpCompositeExtract %float %22 1
%26 = OpCompositeConstruct %v3float %23 %24 %25
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,10 @@
[[stage(compute)]]
fn main() {
var v : vec3<f32> = vec3<f32>(0.0, 0.0, 0.0);
let x_14 : f32 = v.y;
let x_16 : vec3<f32> = v;
let x_17 : vec2<f32> = vec2<f32>(x_16.x, x_16.z);
let x_18 : vec3<f32> = v;
let x_19 : vec3<f32> = vec3<f32>(x_18.x, x_18.z, x_18.y);
return;
}

View File

@ -0,0 +1,7 @@
[[stage(compute)]]
fn main() {
var v : vec3<f32>;
let scalar : f32 = v.y;
let swizzle2 : vec2<f32> = v.xz;
let swizzle3 : vec3<f32> = v.xzy;
}

View File

@ -0,0 +1,9 @@
[numthreads(1, 1, 1)]
void main() {
float3 v;
const float scalar = v.y;
const float2 swizzle2 = v.xz;
const float3 swizzle3 = v.xzy;
return;
}

View File

@ -0,0 +1,11 @@
#include <metal_stdlib>
using namespace metal;
kernel void tint_symbol() {
float3 v = 0.0f;
const float scalar = v.y;
const float2 swizzle2 = v.xz;
const float3 swizzle3 = v.xzy;
return;
}

View File

@ -0,0 +1,32 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 20
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %main "main"
OpName %v "v"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%_ptr_Function_v3float = OpTypePointer Function %v3float
%9 = OpConstantNull %v3float
%uint = OpTypeInt 32 0
%uint_1 = OpConstant %uint 1
%_ptr_Function_float = OpTypePointer Function %float
%v2float = OpTypeVector %float 2
%main = OpFunction %void None %1
%4 = OpLabel
%v = OpVariable %_ptr_Function_v3float Function %9
%13 = OpAccessChain %_ptr_Function_float %v %uint_1
%14 = OpLoad %float %13
%16 = OpLoad %v3float %v
%17 = OpVectorShuffle %v2float %16 %16 0 2
%18 = OpLoad %v3float %v
%19 = OpVectorShuffle %v3float %18 %18 0 2 1
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,7 @@
[[stage(compute)]]
fn main() {
var v : vec3<f32>;
let scalar : f32 = v.y;
let swizzle2 : vec2<f32> = v.xz;
let swizzle3 : vec3<f32> = v.xzy;
}