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

100 lines
1.8 KiB
WebGPU Shading Language

[[block]]
struct buf0 {
injectionSwitch : vec2<f32>;
};
type RTArr = [[stride(4)]] array<u32>;
[[block]]
struct doesNotMatter {
x_compute_data : RTArr;
};
var<private> GLF_live2gl_FragCoord : vec4<f32>;
[[group(0), binding(1)]] var<uniform> x_9 : buf0;
[[group(0), binding(0)]] var<storage, read_write> x_12 : doesNotMatter;
fn main_1() {
var GLF_live2_looplimiter1 : i32;
var i : i32;
var j : i32;
var GLF_dead3x : f32;
var x_51 : f32;
var GLF_dead3k : i32;
GLF_live2_looplimiter1 = 0;
i = 0;
loop {
let x_56 : i32 = i;
if ((x_56 < 1)) {
} else {
break;
}
let x_59 : i32 = GLF_live2_looplimiter1;
if ((x_59 >= 3)) {
j = 0;
loop {
let x_67 : i32 = j;
if ((x_67 < 1)) {
} else {
break;
}
let x_13 : f32 = GLF_live2gl_FragCoord.x;
if ((i32(x_13) < 120)) {
} else {
workgroupBarrier();
}
continuing {
let x_76 : i32 = j;
j = (x_76 + 1);
}
}
break;
}
continuing {
let x_78 : i32 = i;
i = (x_78 + 1);
}
}
let x_81 : f32 = x_9.injectionSwitch.x;
let x_83 : f32 = x_9.injectionSwitch.y;
if ((x_81 > x_83)) {
let x_14 : f32 = GLF_live2gl_FragCoord.x;
x_51 = x_14;
} else {
x_51 = 0.0;
}
let x_15 : f32 = x_51;
GLF_dead3x = x_15;
GLF_dead3k = 0;
loop {
let x_93 : i32 = GLF_dead3k;
if ((x_93 < 2)) {
} else {
break;
}
let x_96 : f32 = GLF_dead3x;
if ((x_96 > 4.0)) {
break;
}
let x_16 : f32 = GLF_live2gl_FragCoord.x;
GLF_dead3x = x_16;
workgroupBarrier();
continuing {
let x_101 : i32 = GLF_dead3k;
GLF_dead3k = (x_101 + 1);
}
}
x_12.x_compute_data[0] = 42u;
return;
}
[[stage(compute), workgroup_size(1, 18, 6)]]
fn main() {
main_1();
}