Alastair Donaldson f7e73d4ee3 Add tests derived from VK-GL-CTS
This adds SPIR-V assembly and WGSL tests derived from VK-GL-CTS commit
571256871c2e2f03995373e1e4a02958d8cd8cf5. The following procedure was
followed:

- Those .amber files in VK-GL-CTS wholly owned by Google were
  identified

- All GLSL and SPIR-V shaders were extracted from the Amber files and
  converted into SPIR-V binaries

- The compact-ids pass of spirv-opt was applied to each binary

- Duplicate binaries were removed

- spirv-opt -O was used to obtain an optimized version of each remaining
  binary, with duplicates discarded

- Binaries that failed validation using spirv-val with target
  environment SPIR-V 1.3 were discarded

- Those binaries that tint could not successfully convert into WGSL were
  put aside for further investigation

- SPIR-V assembly versions of the remaining binaries are included in
  this CL

- test-runner with -generate-expected and -generate-skip was used to
  generate expected .spvasm, .msl, .hlsl and .wgsl outputs for these
  SPIR-V assembly tests

- Each successfully-generated .expected.wgsl is included in this CL
  again, as a WGLSL test

- test-runner with -generate-expected and -generate-skip was used again,
  to generate expected outputs for these WGSL tests

Change-Id: Ibe9baf2729cf97e0b633db9a426f53362a5de540
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58842
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-07-23 13:10:12 +00:00

110 lines
2.1 KiB
WebGPU Shading Language

[[block]]
struct theSSBO {
out_data : i32;
};
[[block]]
struct buf1 {
injectionSwitch : vec2<f32>;
};
[[group(0), binding(0)]] var<storage, read_write> x_4 : theSSBO;
[[group(0), binding(1)]] var<uniform> x_6 : buf1;
fn main_1() {
var i : i32;
var GLF_live3s : f32;
var i_1 : i32;
var z : i32;
x_4.out_data = 42;
let x_37 : f32 = x_6.injectionSwitch.x;
let x_39 : f32 = x_6.injectionSwitch.y;
if ((x_37 > x_39)) {
workgroupBarrier();
}
let x_44 : f32 = x_6.injectionSwitch.x;
let x_46 : f32 = x_6.injectionSwitch.y;
if ((x_44 > x_46)) {
workgroupBarrier();
}
let x_51 : f32 = x_6.injectionSwitch.y;
i = i32(x_51);
loop {
let x_57 : i32 = i;
if ((x_57 > 0)) {
} else {
break;
}
workgroupBarrier();
continuing {
let x_60 : i32 = i;
i = (x_60 - 1);
}
}
GLF_live3s = 0.0;
loop {
i_1 = 1;
loop {
let x_70 : i32 = i_1;
if ((x_70 < 2)) {
} else {
break;
}
let x_74 : f32 = x_6.injectionSwitch.x;
if ((x_74 > 1.0)) {
workgroupBarrier();
}
let x_79 : f32 = x_6.injectionSwitch.x;
let x_81 : f32 = x_6.injectionSwitch.y;
if ((x_79 > x_81)) {
workgroupBarrier();
}
let x_86 : f32 = x_6.injectionSwitch.y;
z = i32(x_86);
loop {
let x_92 : i32 = z;
if ((x_92 > 0)) {
} else {
break;
}
let x_95 : f32 = GLF_live3s;
GLF_live3s = (x_95 + 1.0);
continuing {
let x_97 : i32 = z;
z = (x_97 - 1);
}
}
let x_99 : i32 = i_1;
if ((x_99 >= 1)) {
let x_104 : f32 = x_6.injectionSwitch.x;
if ((x_104 > 1.0)) {
workgroupBarrier();
}
}
continuing {
let x_108 : i32 = i_1;
i_1 = (x_108 + 1);
}
}
continuing {
let x_111 : f32 = x_6.injectionSwitch.x;
let x_113 : f32 = x_6.injectionSwitch.y;
if ((x_111 > x_113)) {
} else {
break;
}
}
}
return;
}
[[stage(compute), workgroup_size(1, 1, 1)]]
fn main() {
main_1();
}