Add entry point to operators wgsl test

This commit is contained in:
Gordon-F
2021-06-28 21:25:30 +03:00
committed by Dzmitry Malyshau
parent 6723c8f6ae
commit 925c92d12f
5 changed files with 58 additions and 2 deletions

View File

@@ -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();
}

View File

@@ -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;
}

View File

@@ -17,3 +17,10 @@ int unary(
return !1;
}
}
kernel void main1(
) {
metal::float4 _e0 = splat();
int _e1 = unary();
return;
}

View File

@@ -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

View File

@@ -12,3 +12,9 @@ fn unary() -> i32 {
}
}
[[stage(compute), workgroup_size(1, 1, 1)]]
fn main() {
let _e0: vec4<f32> = splat();
let _e1: i32 = unary();
return;
}