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

107 lines
2.3 KiB
WebGPU Shading Language

[[block]]
struct buf0 {
injected : i32;
};
[[group(0), binding(0)]] var<uniform> x_9 : buf0;
var<private> x_GLF_color : vec4<f32>;
fn main_1() {
var idx : i32;
var m43 : mat4x3<f32>;
var ll_1 : i32;
var GLF_live6rows : i32;
var z : i32;
var ll_2 : i32;
var ctr : i32;
var tempm43 : mat4x3<f32>;
var ll_3 : i32;
var c : i32;
var d : i32;
var GLF_live6sums : array<f32, 9>;
idx = 0;
m43 = mat4x3<f32>(vec3<f32>(1.0, 0.0, 0.0), vec3<f32>(0.0, 1.0, 0.0), vec3<f32>(0.0, 0.0, 1.0), vec3<f32>(0.0, 0.0, 0.0));
ll_1 = 0;
GLF_live6rows = 2;
loop {
let x_18 : i32 = ll_1;
let x_19 : i32 = x_9.injected;
if ((x_18 >= x_19)) {
x_GLF_color = vec4<f32>(1.0, 0.0, 0.0, 1.0);
break;
}
let x_20 : i32 = ll_1;
ll_1 = (x_20 + 1);
let x_22 : i32 = x_9.injected;
z = x_22;
ll_2 = 0;
ctr = 0;
loop {
let x_23 : i32 = ctr;
if ((x_23 < 1)) {
} else {
break;
}
let x_24 : i32 = ll_2;
let x_25 : i32 = x_9.injected;
if ((x_24 >= x_25)) {
break;
}
let x_26 : i32 = ll_2;
ll_2 = (x_26 + 1);
let x_98 : mat4x3<f32> = m43;
tempm43 = x_98;
ll_3 = 0;
c = 0;
loop {
let x_28 : i32 = z;
if ((1 < x_28)) {
} else {
break;
}
d = 0;
let x_29 : i32 = c;
let x_30 : i32 = c;
let x_31 : i32 = c;
let x_32 : i32 = d;
let x_33 : i32 = d;
let x_34 : i32 = d;
tempm43[select(0, x_31, ((x_29 >= 0) && (x_30 < 4)))][select(0, x_34, ((x_32 >= 0) && (x_33 < 3)))] = 1.0;
continuing {
let x_35 : i32 = c;
c = (x_35 + 1);
}
}
let x_37 : i32 = idx;
let x_38 : i32 = idx;
let x_39 : i32 = idx;
let x_117 : i32 = select(0, x_39, ((x_37 >= 0) && (x_38 < 9)));
let x_40 : i32 = ctr;
let x_119 : f32 = m43[x_40].y;
let x_121 : f32 = GLF_live6sums[x_117];
GLF_live6sums[x_117] = (x_121 + x_119);
continuing {
let x_41 : i32 = ctr;
ctr = (x_41 + 1);
}
}
let x_43 : i32 = idx;
idx = (x_43 + 1);
}
return;
}
struct main_out {
[[location(0)]]
x_GLF_color_1 : vec4<f32>;
};
[[stage(fragment)]]
fn main() -> main_out {
main_1();
return main_out(x_GLF_color);
}