Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JCapucho authored and jimblandy committed Jun 14, 2022
1 parent 46bc882 commit c7e6769
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 13 deletions.
1 change: 1 addition & 0 deletions tests/in/math-functions.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ fn main() {
let b = radians(f);
let c = degrees(v);
let d = radians(v);
let const_dot = dot(vec2<i32>(), vec2<i32>());
}
1 change: 1 addition & 0 deletions tests/out/glsl/math-functions.main.Vertex.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ void main() {
float b = radians(1.0);
vec4 c = degrees(v);
vec4 d = radians(v);
int const_dot = ( + ivec2(0, 0).x * ivec2(0, 0).x + ivec2(0, 0).y * ivec2(0, 0).y);
}

1 change: 1 addition & 0 deletions tests/out/hlsl/math-functions.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ void main()
float b = radians(1.0);
float4 c = degrees(v);
float4 d = radians(v);
int const_dot = dot(int2(0, 0), int2(0, 0));
}
2 changes: 2 additions & 0 deletions tests/out/msl/math-functions.msl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

using metal::uint;

constant metal::int2 const_type = {0, 0};

vertex void main_(
) {
Expand All @@ -12,4 +13,5 @@ vertex void main_(
float b = ((1.0) * 0.017453292519943295474);
metal::float4 c = ((v) * 57.295779513082322865);
metal::float4 d = ((v) * 0.017453292519943295474);
int const_dot = ( + const_type.x * const_type.x + const_type.y * const_type.y);
}
39 changes: 26 additions & 13 deletions tests/out/spv/math-functions.spvasm
Original file line number Diff line number Diff line change
@@ -1,25 +1,38 @@
; SPIR-V
; Version: 1.1
; Generator: rspirv
; Bound: 16
; Bound: 29
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %7 "main"
OpEntryPoint Vertex %11 "main"
%2 = OpTypeVoid
%4 = OpTypeFloat 32
%3 = OpConstant %4 1.0
%5 = OpConstant %4 0.0
%8 = OpTypeFunction %2
%10 = OpTypeVector %4 4
%7 = OpFunction %2 None %8
%6 = OpLabel
OpBranch %9
%9 = OpLabel
%11 = OpCompositeConstruct %10 %5 %5 %5 %5
%12 = OpExtInst %4 %1 Degrees %3
%13 = OpExtInst %4 %1 Radians %3
%14 = OpExtInst %10 %1 Degrees %11
%15 = OpExtInst %10 %1 Radians %11
%7 = OpTypeInt 32 1
%6 = OpConstant %7 0
%8 = OpTypeVector %7 2
%9 = OpConstantComposite %8 %6 %6
%12 = OpTypeFunction %2
%14 = OpTypeVector %4 4
%21 = OpConstantNull %7
%11 = OpFunction %2 None %12
%10 = OpLabel
OpBranch %13
%13 = OpLabel
%15 = OpCompositeConstruct %14 %5 %5 %5 %5
%16 = OpExtInst %4 %1 Degrees %3
%17 = OpExtInst %4 %1 Radians %3
%18 = OpExtInst %14 %1 Degrees %15
%19 = OpExtInst %14 %1 Radians %15
%22 = OpCompositeExtract %7 %9 0
%23 = OpCompositeExtract %7 %9 0
%24 = OpIMul %7 %22 %23
%25 = OpIAdd %7 %21 %24
%26 = OpCompositeExtract %7 %9 1
%27 = OpCompositeExtract %7 %9 1
%28 = OpIMul %7 %26 %27
%20 = OpIAdd %7 %25 %28
OpReturn
OpFunctionEnd
1 change: 1 addition & 0 deletions tests/out/wgsl/math-functions.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ fn main() {
let b = radians(1.0);
let c = degrees(v);
let d = radians(v);
let const_dot = dot(vec2<i32>(0, 0), vec2<i32>(0, 0));
}

0 comments on commit c7e6769

Please sign in to comment.