Skip to content

Commit

Permalink
fixup! add constructors test file
Browse files Browse the repository at this point in the history
  • Loading branch information
teoxoy committed Jul 17, 2023
1 parent 252e452 commit cbffe7e
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 79 deletions.
6 changes: 3 additions & 3 deletions tests/in/constructors.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ struct Foo {
}

// const const1 = vec3<f32>(0.0); // TODO: this is now a splat and we need to const eval it
const const2 = vec3(0.0, 0.0, 0.0);
const const3 = mat2x2<f32>(0.0, 0.0, 0.0, 0.0);
const const4 = array<mat2x2<f32>, 1>(mat2x2<f32>(0.0, 0.0, 0.0, 0.0));
const const2 = vec3(0.0, 1.0, 2.0);
const const3 = mat2x2<f32>(0.0, 1.0, 2.0, 3.0);
const const4 = array<mat2x2<f32>, 1>(mat2x2<f32>(0.0, 1.0, 2.0, 3.0));

// zero value constructors
const cz0 = bool();
Expand Down
6 changes: 3 additions & 3 deletions tests/out/glsl/constructors.main.Compute.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ struct Foo {
vec4 a;
int b;
};
const vec3 const2_ = vec3(0.0, 0.0, 0.0);
const mat2x2 const3_ = mat2x2(vec2(0.0, 0.0), vec2(0.0, 0.0));
const mat2x2 const4_[1] = mat2x2[1](mat2x2(vec2(0.0, 0.0), vec2(0.0, 0.0)));
const vec3 const2_ = vec3(0.0, 1.0, 2.0);
const mat2x2 const3_ = mat2x2(vec2(0.0, 1.0), vec2(2.0, 3.0));
const mat2x2 const4_[1] = mat2x2[1](mat2x2(vec2(0.0, 1.0), vec2(2.0, 3.0)));
const bool cz0_ = false;
const int cz1_ = 0;
const uint cz2_ = 0u;
Expand Down
6 changes: 3 additions & 3 deletions tests/out/hlsl/constructors.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ ret_Constructarray4_int_ Constructarray4_int_(int arg0, int arg1, int arg2, int
return ret;
}

static const float3 const2_ = float3(0.0, 0.0, 0.0);
static const float2x2 const3_ = float2x2(float2(0.0, 0.0), float2(0.0, 0.0));
static const float2x2 const4_[1] = Constructarray1_float2x2_(float2x2(float2(0.0, 0.0), float2(0.0, 0.0)));
static const float3 const2_ = float3(0.0, 1.0, 2.0);
static const float2x2 const3_ = float2x2(float2(0.0, 1.0), float2(2.0, 3.0));
static const float2x2 const4_[1] = Constructarray1_float2x2_(float2x2(float2(0.0, 1.0), float2(2.0, 3.0)));
static const bool cz0_ = (bool)0;
static const int cz1_ = (int)0;
static const uint cz2_ = (uint)0;
Expand Down
6 changes: 3 additions & 3 deletions tests/out/msl/constructors.msl
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ struct type_10 {
struct type_11 {
int inner[4];
};
constant metal::float3 const2_ = metal::float3(0.0, 0.0, 0.0);
constant metal::float2x2 const3_ = metal::float2x2(metal::float2(0.0, 0.0), metal::float2(0.0, 0.0));
constant type_5 const4_ = type_5 {metal::float2x2(metal::float2(0.0, 0.0), metal::float2(0.0, 0.0))};
constant metal::float3 const2_ = metal::float3(0.0, 1.0, 2.0);
constant metal::float2x2 const3_ = metal::float2x2(metal::float2(0.0, 1.0), metal::float2(2.0, 3.0));
constant type_5 const4_ = type_5 {metal::float2x2(metal::float2(0.0, 1.0), metal::float2(2.0, 3.0))};
constant bool cz0_ = bool {};
constant int cz1_ = int {};
constant uint cz2_ = uint {};
Expand Down
131 changes: 67 additions & 64 deletions tests/out/spv/constructors.spvasm
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
; SPIR-V
; Version: 1.1
; Generator: rspirv
; Bound: 87
; Bound: 90
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %43 "main"
OpExecutionMode %43 LocalSize 1 1 1
OpEntryPoint GLCompute %47 "main"
OpExecutionMode %47 LocalSize 1 1 1
OpMemberDecorate %6 0 Offset 0
OpMemberDecorate %6 1 Offset 16
OpDecorate %10 ArrayStride 16
Expand All @@ -32,66 +32,69 @@ OpDecorate %17 ArrayStride 4
%19 = OpTypeMatrix %3 4
%20 = OpTypeMatrix %7 2
%21 = OpConstant %4 0.0
%22 = OpConstantComposite %7 %21 %21 %21
%23 = OpConstantComposite %9 %21 %21
%24 = OpConstantComposite %8 %23 %23
%25 = OpConstant %5 1
%26 = OpConstantComposite %10 %24
%27 = OpConstantNull %13
%28 = OpConstantNull %5
%29 = OpConstantNull %12
%30 = OpConstantNull %4
%31 = OpConstantNull %14
%32 = OpConstantNull %8
%33 = OpConstant %5 3
%34 = OpConstantNull %15
%35 = OpConstantNull %6
%36 = OpConstant %5 0
%37 = OpConstant %5 2
%38 = OpConstantComposite %17 %36 %25 %37 %33
%40 = OpTypePointer Function %6
%41 = OpConstantNull %6
%44 = OpTypeFunction %2
%45 = OpConstant %4 1.0
%46 = OpConstantNull %13
%47 = OpConstantNull %5
%48 = OpConstantNull %12
%49 = OpConstantNull %4
%50 = OpConstantNull %14
%51 = OpConstantNull %8
%52 = OpConstantNull %15
%53 = OpConstantNull %6
%54 = OpConstant %12 0
%55 = OpConstantNull %13
%56 = OpConstantNull %5
%57 = OpConstantNull %12
%58 = OpConstantNull %4
%59 = OpConstantNull %14
%60 = OpConstantNull %20
%61 = OpConstantNull %14
%62 = OpConstantNull %20
%43 = OpFunction %2 None %44
%42 = OpLabel
%39 = OpVariable %40 Function %41
OpBranch %63
%63 = OpLabel
%64 = OpCompositeConstruct %3 %45 %45 %45 %45
%65 = OpCompositeConstruct %6 %64 %25
OpStore %39 %65
%66 = OpCompositeConstruct %9 %45 %21
%67 = OpCompositeConstruct %9 %21 %45
%68 = OpCompositeConstruct %8 %66 %67
%69 = OpCompositeConstruct %3 %45 %21 %21 %21
%70 = OpCompositeConstruct %3 %21 %45 %21 %21
%71 = OpCompositeConstruct %3 %21 %21 %45 %21
%72 = OpCompositeConstruct %3 %21 %21 %21 %45
%73 = OpCompositeConstruct %19 %69 %70 %71 %72
%74 = OpCompositeConstruct %14 %54 %54
%75 = OpCompositeConstruct %9 %21 %21
%76 = OpCompositeConstruct %9 %21 %21
%77 = OpCompositeConstruct %8 %75 %76
%78 = OpCompositeConstruct %17 %36 %25 %37 %33
%84 = OpCopyObject %20 %60
%86 = OpCopyObject %20 %62
%22 = OpConstant %4 1.0
%23 = OpConstant %4 2.0
%24 = OpConstantComposite %7 %21 %22 %23
%25 = OpConstant %4 3.0
%26 = OpConstantComposite %9 %21 %22
%27 = OpConstantComposite %9 %23 %25
%28 = OpConstantComposite %8 %26 %27
%29 = OpConstant %5 1
%30 = OpConstantComposite %10 %28
%31 = OpConstantNull %13
%32 = OpConstantNull %5
%33 = OpConstantNull %12
%34 = OpConstantNull %4
%35 = OpConstantNull %14
%36 = OpConstantNull %8
%37 = OpConstant %5 3
%38 = OpConstantNull %15
%39 = OpConstantNull %6
%40 = OpConstant %5 0
%41 = OpConstant %5 2
%42 = OpConstantComposite %17 %40 %29 %41 %37
%44 = OpTypePointer Function %6
%45 = OpConstantNull %6
%48 = OpTypeFunction %2
%49 = OpConstantNull %13
%50 = OpConstantNull %5
%51 = OpConstantNull %12
%52 = OpConstantNull %4
%53 = OpConstantNull %14
%54 = OpConstantNull %8
%55 = OpConstantNull %15
%56 = OpConstantNull %6
%57 = OpConstant %12 0
%58 = OpConstantNull %13
%59 = OpConstantNull %5
%60 = OpConstantNull %12
%61 = OpConstantNull %4
%62 = OpConstantNull %14
%63 = OpConstantNull %20
%64 = OpConstantNull %14
%65 = OpConstantNull %20
%47 = OpFunction %2 None %48
%46 = OpLabel
%43 = OpVariable %44 Function %45
OpBranch %66
%66 = OpLabel
%67 = OpCompositeConstruct %3 %22 %22 %22 %22
%68 = OpCompositeConstruct %6 %67 %29
OpStore %43 %68
%69 = OpCompositeConstruct %9 %22 %21
%70 = OpCompositeConstruct %9 %21 %22
%71 = OpCompositeConstruct %8 %69 %70
%72 = OpCompositeConstruct %3 %22 %21 %21 %21
%73 = OpCompositeConstruct %3 %21 %22 %21 %21
%74 = OpCompositeConstruct %3 %21 %21 %22 %21
%75 = OpCompositeConstruct %3 %21 %21 %21 %22
%76 = OpCompositeConstruct %19 %72 %73 %74 %75
%77 = OpCompositeConstruct %14 %57 %57
%78 = OpCompositeConstruct %9 %21 %21
%79 = OpCompositeConstruct %9 %21 %21
%80 = OpCompositeConstruct %8 %78 %79
%81 = OpCompositeConstruct %17 %40 %29 %41 %37
%87 = OpCopyObject %20 %63
%89 = OpCopyObject %20 %65
OpReturn
OpFunctionEnd
6 changes: 3 additions & 3 deletions tests/out/wgsl/constructors.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ struct Foo {
b: i32,
}

const const2_: vec3<f32> = vec3<f32>(0.0, 0.0, 0.0);
const const3_: mat2x2<f32> = mat2x2<f32>(vec2<f32>(0.0, 0.0), vec2<f32>(0.0, 0.0));
const const4_: array<mat2x2<f32>, 1> = array<mat2x2<f32>, 1>(mat2x2<f32>(vec2<f32>(0.0, 0.0), vec2<f32>(0.0, 0.0)));
const const2_: vec3<f32> = vec3<f32>(0.0, 1.0, 2.0);
const const3_: mat2x2<f32> = mat2x2<f32>(vec2<f32>(0.0, 1.0), vec2<f32>(2.0, 3.0));
const const4_: array<mat2x2<f32>, 1> = array<mat2x2<f32>, 1>(mat2x2<f32>(vec2<f32>(0.0, 1.0), vec2<f32>(2.0, 3.0)));
const cz0_: bool = bool();
const cz1_: i32 = i32();
const cz2_: u32 = u32();
Expand Down

0 comments on commit cbffe7e

Please sign in to comment.