diff --git a/tests/in/operators.wgsl b/tests/in/operators.wgsl index 3b7d1f33f9..cb6da5df09 100644 --- a/tests/in/operators.wgsl +++ b/tests/in/operators.wgsl @@ -8,3 +8,9 @@ fn unary() -> i32 { let a = 1; if (!true) { return a; } else { return ~a; }; } + +[[stage(compute), workgroup_size(1)]] +fn main() { + let a = splat(); + let b = unary(); +} diff --git a/tests/out/glsl/operators.main.Compute.glsl b/tests/out/glsl/operators.main.Compute.glsl new file mode 100644 index 0000000000..caad84e6aa --- /dev/null +++ b/tests/out/glsl/operators.main.Compute.glsl @@ -0,0 +1,27 @@ +#version 310 es + +precision highp float; + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + + +vec4 splat() { + vec2 a = (((vec2(1.0) + vec2(2.0)) - vec2(3.0)) / vec2(4.0)); + ivec4 b = (ivec4(5) % ivec4(2)); + return (a.xyxy + vec4(b)); +} + +int unary() { + if ((! true)) { + return 1; + } else { + return (~ 1); + } +} + +void main() { + vec4 _expr0 = splat(); + int _expr1 = unary(); + return; +} + diff --git a/tests/out/msl/operators.msl b/tests/out/msl/operators.msl index 4cddb70b50..3749cb47c4 100644 --- a/tests/out/msl/operators.msl +++ b/tests/out/msl/operators.msl @@ -17,3 +17,10 @@ int unary( return !1; } } + +kernel void main1( +) { + metal::float4 _e0 = splat(); + int _e1 = unary(); + return; +} diff --git a/tests/out/spv/operators.spvasm b/tests/out/spv/operators.spvasm index a6380e59c1..aefe1c99fd 100644 --- a/tests/out/spv/operators.spvasm +++ b/tests/out/spv/operators.spvasm @@ -1,11 +1,12 @@ ; SPIR-V ; Version: 1.0 ; Generator: rspirv -; Bound: 44 +; Bound: 50 OpCapability Shader -OpCapability Linkage %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %45 "main" +OpExecutionMode %45 LocalSize 1 1 1 %2 = OpTypeVoid %4 = OpTypeFloat 32 %3 = OpConstant %4 1.0 @@ -24,6 +25,7 @@ OpMemoryModel Logical GLSL450 %27 = OpTypeVector %9 4 %36 = OpTypeFunction %9 %43 = OpConstantNull %9 +%46 = OpTypeFunction %2 %16 = OpFunction %14 None %17 %15 = OpLabel OpBranch %18 @@ -57,4 +59,12 @@ OpReturnValue %11 OpReturnValue %42 %39 = OpLabel OpReturnValue %43 +OpFunctionEnd +%45 = OpFunction %2 None %46 +%44 = OpLabel +OpBranch %47 +%47 = OpLabel +%48 = OpFunctionCall %14 %16 +%49 = OpFunctionCall %9 %35 +OpReturn OpFunctionEnd \ No newline at end of file diff --git a/tests/out/wgsl/operators.wgsl b/tests/out/wgsl/operators.wgsl index cacefc7242..06e3ca1dc2 100644 --- a/tests/out/wgsl/operators.wgsl +++ b/tests/out/wgsl/operators.wgsl @@ -12,3 +12,9 @@ fn unary() -> i32 { } } +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main() { + let _e0: vec4 = splat(); + let _e1: i32 = unary(); + return; +}