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

111 lines
2.2 KiB
WebGPU Shading Language

[[block]]
struct buf0 {
injectionSwitch : vec2<f32>;
};
var<private> x_GLF_color : vec4<f32>;
var<private> gl_FragCoord : vec4<f32>;
[[group(0), binding(0)]] var<uniform> x_8 : buf0;
fn main_1() {
var odd_index : i32;
var even_index : i32;
var j : i32;
var ll : i32;
var x_59 : bool;
var x_60_phi : bool;
x_GLF_color = vec4<f32>(1.0, 0.0, 0.0, 1.0);
let x_53 : f32 = gl_FragCoord.x;
let x_54 : bool = (x_53 < 128.0);
x_60_phi = x_54;
if (x_54) {
let x_58 : f32 = gl_FragCoord.y;
x_59 = (x_58 < 128.0);
x_60_phi = x_59;
}
let x_60 : bool = x_60_phi;
if (x_60) {
return;
}
odd_index = 0;
loop {
let x_11 : i32 = odd_index;
if ((x_11 <= 1)) {
} else {
break;
}
let x_70 : f32 = x_GLF_color.x;
x_GLF_color.x = (x_70 + 0.25);
let x_12 : i32 = odd_index;
odd_index = (x_12 + 1);
}
even_index = 1;
loop {
let x_14 : i32 = even_index;
if ((x_14 >= 0)) {
} else {
break;
}
let x_80 : f32 = x_GLF_color.x;
x_GLF_color.x = (x_80 + 0.25);
let x_84 : f32 = x_8.injectionSwitch.x;
let x_86 : f32 = x_8.injectionSwitch.y;
if ((x_84 > x_86)) {
continue;
}
let x_15 : i32 = even_index;
if ((x_15 >= 1)) {
discard;
}
j = 1;
loop {
if (true) {
} else {
break;
}
let x_16 : i32 = ll;
if ((x_16 >= 3)) {
break;
}
let x_17 : i32 = ll;
ll = (x_17 + 1);
let x_19 : i32 = j;
if ((bitcast<u32>(x_19) < 1u)) {
continue;
}
let x_106 : f32 = x_8.injectionSwitch.x;
let x_108 : f32 = x_8.injectionSwitch.y;
if ((x_106 > x_108)) {
break;
}
continuing {
let x_20 : i32 = j;
j = (x_20 + 1);
}
}
let x_113 : f32 = x_8.injectionSwitch.x;
let x_115 : f32 = x_8.injectionSwitch.y;
if ((x_113 > x_115)) {
x_GLF_color = vec4<f32>(1.0, 1.0, 1.0, 1.0);
}
let x_22 : i32 = even_index;
even_index = (x_22 - 1);
}
return;
}
struct main_out {
[[location(0)]]
x_GLF_color_1 : vec4<f32>;
};
[[stage(fragment)]]
fn main([[builtin(position)]] gl_FragCoord_param : vec4<f32>) -> main_out {
gl_FragCoord = gl_FragCoord_param;
main_1();
return main_out(x_GLF_color);
}