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>
This commit is contained in:
Alastair Donaldson
2021-07-23 13:10:12 +00:00
committed by Tint LUCI CQ
parent bd3edb564f
commit f7e73d4ee3
5160 changed files with 621458 additions and 0 deletions

View File

@@ -0,0 +1,168 @@
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %_GLF_color
OpExecutionMode %main OriginUpperLeft
OpSource ESSL 310
OpName %main "main"
OpName %k "k"
OpName %buf0 "buf0"
OpMemberName %buf0 0 "injectionSwitch"
OpName %_ ""
OpName %GLF_dead0j "GLF_dead0j"
OpName %donor_replacementGLF_dead0stack "donor_replacementGLF_dead0stack"
OpName %donor_replacementGLF_dead0top "donor_replacementGLF_dead0top"
OpName %matrix_b "matrix_b"
OpName %b "b"
OpName %_GLF_color "_GLF_color"
OpDecorate %k RelaxedPrecision
OpDecorate %12 RelaxedPrecision
OpMemberDecorate %buf0 0 Offset 0
OpDecorate %buf0 Block
OpDecorate %_ DescriptorSet 0
OpDecorate %_ Binding 0
OpDecorate %GLF_dead0j RelaxedPrecision
OpDecorate %donor_replacementGLF_dead0stack RelaxedPrecision
OpDecorate %13 RelaxedPrecision
OpDecorate %donor_replacementGLF_dead0top RelaxedPrecision
OpDecorate %14 RelaxedPrecision
OpDecorate %15 RelaxedPrecision
OpDecorate %16 RelaxedPrecision
OpDecorate %17 RelaxedPrecision
OpDecorate %18 RelaxedPrecision
OpDecorate %b RelaxedPrecision
OpDecorate %19 RelaxedPrecision
OpDecorate %20 RelaxedPrecision
OpDecorate %21 RelaxedPrecision
OpDecorate %22 RelaxedPrecision
OpDecorate %23 RelaxedPrecision
OpDecorate %24 RelaxedPrecision
OpDecorate %25 RelaxedPrecision
OpDecorate %_GLF_color Location 0
%void = OpTypeVoid
%27 = OpTypeFunction %void
%int = OpTypeInt 32 1
%_ptr_Function_int = OpTypePointer Function %int
%int_0 = OpConstant %int 0
%int_4 = OpConstant %int 4
%bool = OpTypeBool
%float = OpTypeFloat 32
%float_0 = OpConstant %float 0
%v2float = OpTypeVector %float 2
%buf0 = OpTypeStruct %v2float
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
%_ = OpVariable %_ptr_Uniform_buf0 Uniform
%uint = OpTypeInt 32 0
%uint_1 = OpConstant %uint 1
%_ptr_Uniform_float = OpTypePointer Uniform %float
%int_1 = OpConstant %int 1
%uint_10 = OpConstant %uint 10
%_arr_int_uint_10 = OpTypeArray %int %uint_10
%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10
%int_9 = OpConstant %int 9
%v4float = OpTypeVector %float 4
%_ptr_Function_v4float = OpTypePointer Function %v4float
%47 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0
%int_3 = OpConstant %int 3
%_ptr_Function_float = OpTypePointer Function %float
%float_1 = OpConstant %float 1
%_ptr_Output_v4float = OpTypePointer Output %v4float
%_GLF_color = OpVariable %_ptr_Output_v4float Output
%52 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
%main = OpFunction %void None %27
%53 = OpLabel
%k = OpVariable %_ptr_Function_int Function
%GLF_dead0j = OpVariable %_ptr_Function_int Function
%donor_replacementGLF_dead0stack = OpVariable %_ptr_Function__arr_int_uint_10 Function
%donor_replacementGLF_dead0top = OpVariable %_ptr_Function_int Function
%54 = OpVariable %_ptr_Function_int Function
%matrix_b = OpVariable %_ptr_Function_v4float Function
%b = OpVariable %_ptr_Function_int Function
OpStore %k %int_0
OpBranch %55
%55 = OpLabel
OpLoopMerge %56 %57 None
OpBranch %58
%58 = OpLabel
%12 = OpLoad %int %k
%59 = OpSLessThan %bool %12 %int_4
OpBranchConditional %59 %60 %56
%60 = OpLabel
%61 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1
%62 = OpLoad %float %61
%63 = OpFOrdGreaterThan %bool %float_0 %62
OpSelectionMerge %64 None
OpBranchConditional %63 %65 %64
%65 = OpLabel
OpStore %GLF_dead0j %int_1
OpBranch %66
%66 = OpLabel
OpLoopMerge %67 %68 None
OpBranch %69
%69 = OpLabel
%70 = OpAccessChain %_ptr_Function_int %donor_replacementGLF_dead0stack %int_0
%13 = OpLoad %int %70
%71 = OpSLessThanEqual %bool %int_1 %13
OpBranchConditional %71 %72 %67
%72 = OpLabel
OpBranch %68
%68 = OpLabel
OpBranch %66
%67 = OpLabel
%14 = OpLoad %int %donor_replacementGLF_dead0top
%73 = OpSGreaterThanEqual %bool %14 %int_0
%15 = OpLoad %int %donor_replacementGLF_dead0top
%74 = OpSLessThan %bool %15 %int_9
%75 = OpLogicalAnd %bool %73 %74
OpSelectionMerge %76 None
OpBranchConditional %75 %77 %78
%77 = OpLabel
%16 = OpLoad %int %donor_replacementGLF_dead0top
%17 = OpIAdd %int %16 %int_1
OpStore %donor_replacementGLF_dead0top %17
OpStore %54 %17
OpBranch %76
%78 = OpLabel
OpStore %54 %int_0
OpBranch %76
%76 = OpLabel
%18 = OpLoad %int %54
%79 = OpAccessChain %_ptr_Function_int %donor_replacementGLF_dead0stack %18
OpStore %79 %int_1
OpBranch %64
%64 = OpLabel
OpStore %matrix_b %47
OpStore %b %int_3
OpBranch %80
%80 = OpLabel
OpLoopMerge %81 %82 None
OpBranch %83
%83 = OpLabel
%19 = OpLoad %int %b
%84 = OpSGreaterThanEqual %bool %19 %int_0
OpBranchConditional %84 %85 %81
%85 = OpLabel
%20 = OpLoad %int %b
%21 = OpLoad %int %b
%86 = OpAccessChain %_ptr_Function_float %matrix_b %21
%87 = OpLoad %float %86
%88 = OpFSub %float %87 %float_1
%89 = OpAccessChain %_ptr_Function_float %matrix_b %20
OpStore %89 %88
OpBranch %82
%82 = OpLabel
%22 = OpLoad %int %b
%23 = OpISub %int %22 %int_1
OpStore %b %23
OpBranch %80
%81 = OpLabel
OpBranch %57
%57 = OpLabel
%24 = OpLoad %int %k
%25 = OpIAdd %int %24 %int_1
OpStore %k %25
OpBranch %55
%56 = OpLabel
OpStore %_GLF_color %52
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,71 @@
void set_float4(inout float4 vec, int idx, float val) {
vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec;
}
cbuffer cbuffer_x_6 : register(b0, space0) {
uint4 x_6[1];
};
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
void main_1() {
int k = 0;
int GLF_dead0j = 0;
int donor_replacementGLF_dead0stack[10] = (int[10])0;
int donor_replacementGLF_dead0top = 0;
int x_54 = 0;
float4 matrix_b = float4(0.0f, 0.0f, 0.0f, 0.0f);
int b = 0;
k = 0;
{
for(; (k < 4); k = (k + 1)) {
const float x_62 = asfloat(x_6[0].y);
if ((0.0f > x_62)) {
GLF_dead0j = 1;
while (true) {
const int x_13 = donor_replacementGLF_dead0stack[0];
if ((1 <= x_13)) {
} else {
break;
}
}
bool tint_tmp = (donor_replacementGLF_dead0top >= 0);
if (tint_tmp) {
tint_tmp = (donor_replacementGLF_dead0top < 9);
}
if ((tint_tmp)) {
const int x_17 = (donor_replacementGLF_dead0top + 1);
donor_replacementGLF_dead0top = x_17;
x_54 = x_17;
} else {
x_54 = 0;
}
donor_replacementGLF_dead0stack[x_54] = 1;
}
matrix_b = float4(0.0f, 0.0f, 0.0f, 0.0f);
b = 3;
{
for(; (b >= 0); b = (b - 1)) {
const int x_20 = b;
const float x_87 = matrix_b[b];
set_float4(matrix_b, x_20, (x_87 - 1.0f));
}
}
}
}
x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
return;
}
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol {
float4 x_GLF_color_1 : SV_Target0;
};
tint_symbol main() {
main_1();
const main_out tint_symbol_1 = {x_GLF_color};
const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1};
return tint_symbol_3;
}

View File

@@ -0,0 +1,88 @@
#include <metal_stdlib>
using namespace metal;
struct buf0 {
/* 0x0000 */ packed_float2 injectionSwitch;
};
struct tint_array_wrapper {
int arr[10];
};
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol_1 {
float4 x_GLF_color_1 [[color(0)]];
};
void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) {
int k = 0;
int GLF_dead0j = 0;
tint_array_wrapper donor_replacementGLF_dead0stack = {};
int donor_replacementGLF_dead0top = 0;
int x_54 = 0;
float4 matrix_b = 0.0f;
int b = 0;
k = 0;
while (true) {
int const x_12 = k;
if ((x_12 < 4)) {
} else {
break;
}
float const x_62 = x_6.injectionSwitch.y;
if ((0.0f > x_62)) {
GLF_dead0j = 1;
while (true) {
int const x_13 = donor_replacementGLF_dead0stack.arr[0];
if ((1 <= x_13)) {
} else {
break;
}
}
int const x_14 = donor_replacementGLF_dead0top;
int const x_15 = donor_replacementGLF_dead0top;
if (((x_14 >= 0) && (x_15 < 9))) {
int const x_16 = donor_replacementGLF_dead0top;
int const x_17 = (x_16 + 1);
donor_replacementGLF_dead0top = x_17;
x_54 = x_17;
} else {
x_54 = 0;
}
int const x_18 = x_54;
donor_replacementGLF_dead0stack.arr[x_18] = 1;
}
matrix_b = float4(0.0f, 0.0f, 0.0f, 0.0f);
b = 3;
while (true) {
int const x_19 = b;
if ((x_19 >= 0)) {
} else {
break;
}
int const x_20 = b;
int const x_21 = b;
float const x_87 = matrix_b[x_21];
matrix_b[x_20] = (x_87 - 1.0f);
{
int const x_22 = b;
b = (x_22 - 1);
}
}
{
int const x_24 = k;
k = (x_24 + 1);
}
}
*(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f);
return;
}
fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) {
thread float4 tint_symbol_5 = 0.0f;
main_1(x_6, &(tint_symbol_5));
main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5};
tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1};
return tint_symbol_3;
}

View File

@@ -0,0 +1,205 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 115
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %tint_symbol_1
OpExecutionMode %main OriginUpperLeft
OpName %buf0 "buf0"
OpMemberName %buf0 0 "injectionSwitch"
OpName %x_6 "x_6"
OpName %x_GLF_color "x_GLF_color"
OpName %tint_symbol_1 "tint_symbol_1"
OpName %main_1 "main_1"
OpName %k "k"
OpName %GLF_dead0j "GLF_dead0j"
OpName %donor_replacementGLF_dead0stack "donor_replacementGLF_dead0stack"
OpName %donor_replacementGLF_dead0top "donor_replacementGLF_dead0top"
OpName %x_54 "x_54"
OpName %matrix_b "matrix_b"
OpName %b "b"
OpName %main_out "main_out"
OpMemberName %main_out 0 "x_GLF_color_1"
OpName %tint_symbol_2 "tint_symbol_2"
OpName %tint_symbol "tint_symbol"
OpName %main "main"
OpDecorate %buf0 Block
OpMemberDecorate %buf0 0 Offset 0
OpDecorate %x_6 NonWritable
OpDecorate %x_6 DescriptorSet 0
OpDecorate %x_6 Binding 0
OpDecorate %tint_symbol_1 Location 0
OpDecorate %_arr_int_uint_10 ArrayStride 4
OpMemberDecorate %main_out 0 Offset 0
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%buf0 = OpTypeStruct %v2float
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
%x_6 = OpVariable %_ptr_Uniform_buf0 Uniform
%v4float = OpTypeVector %float 4
%_ptr_Private_v4float = OpTypePointer Private %v4float
%9 = OpConstantNull %v4float
%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9
%_ptr_Output_v4float = OpTypePointer Output %v4float
%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9
%void = OpTypeVoid
%12 = OpTypeFunction %void
%int = OpTypeInt 32 1
%_ptr_Function_int = OpTypePointer Function %int
%19 = OpConstantNull %int
%uint = OpTypeInt 32 0
%uint_10 = OpConstant %uint 10
%_arr_int_uint_10 = OpTypeArray %int %uint_10
%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10
%26 = OpConstantNull %_arr_int_uint_10
%_ptr_Function_v4float = OpTypePointer Function %v4float
%int_0 = OpConstant %int 0
%int_4 = OpConstant %int 4
%bool = OpTypeBool
%uint_0 = OpConstant %uint 0
%uint_1 = OpConstant %uint 1
%_ptr_Uniform_float = OpTypePointer Uniform %float
%float_0 = OpConstant %float 0
%int_1 = OpConstant %int 1
%int_9 = OpConstant %int 9
%79 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0
%int_3 = OpConstant %int 3
%_ptr_Function_float = OpTypePointer Function %float
%float_1 = OpConstant %float 1
%102 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
%main_out = OpTypeStruct %v4float
%103 = OpTypeFunction %void %main_out
%main_1 = OpFunction %void None %12
%15 = OpLabel
%k = OpVariable %_ptr_Function_int Function %19
%GLF_dead0j = OpVariable %_ptr_Function_int Function %19
%donor_replacementGLF_dead0stack = OpVariable %_ptr_Function__arr_int_uint_10 Function %26
%donor_replacementGLF_dead0top = OpVariable %_ptr_Function_int Function %19
%x_54 = OpVariable %_ptr_Function_int Function %19
%matrix_b = OpVariable %_ptr_Function_v4float Function %9
%b = OpVariable %_ptr_Function_int Function %19
OpStore %k %int_0
OpBranch %33
%33 = OpLabel
OpLoopMerge %34 %35 None
OpBranch %36
%36 = OpLabel
%37 = OpLoad %int %k
%39 = OpSLessThan %bool %37 %int_4
OpSelectionMerge %41 None
OpBranchConditional %39 %42 %43
%42 = OpLabel
OpBranch %41
%43 = OpLabel
OpBranch %34
%41 = OpLabel
%47 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1
%48 = OpLoad %float %47
%50 = OpFOrdGreaterThan %bool %float_0 %48
OpSelectionMerge %51 None
OpBranchConditional %50 %52 %51
%52 = OpLabel
OpStore %GLF_dead0j %int_1
OpBranch %54
%54 = OpLabel
OpLoopMerge %55 %56 None
OpBranch %57
%57 = OpLabel
%58 = OpAccessChain %_ptr_Function_int %donor_replacementGLF_dead0stack %int_0
%59 = OpLoad %int %58
%60 = OpSLessThanEqual %bool %int_1 %59
OpSelectionMerge %61 None
OpBranchConditional %60 %62 %63
%62 = OpLabel
OpBranch %61
%63 = OpLabel
OpBranch %55
%61 = OpLabel
OpBranch %56
%56 = OpLabel
OpBranch %54
%55 = OpLabel
%64 = OpLoad %int %donor_replacementGLF_dead0top
%65 = OpLoad %int %donor_replacementGLF_dead0top
%66 = OpSGreaterThanEqual %bool %64 %int_0
OpSelectionMerge %67 None
OpBranchConditional %66 %68 %67
%68 = OpLabel
%70 = OpSLessThan %bool %65 %int_9
OpBranch %67
%67 = OpLabel
%71 = OpPhi %bool %66 %55 %70 %68
OpSelectionMerge %72 None
OpBranchConditional %71 %73 %74
%73 = OpLabel
%75 = OpLoad %int %donor_replacementGLF_dead0top
%76 = OpIAdd %int %75 %int_1
OpStore %donor_replacementGLF_dead0top %76
OpStore %x_54 %76
OpBranch %72
%74 = OpLabel
OpStore %x_54 %int_0
OpBranch %72
%72 = OpLabel
%77 = OpLoad %int %x_54
%78 = OpAccessChain %_ptr_Function_int %donor_replacementGLF_dead0stack %77
OpStore %78 %int_1
OpBranch %51
%51 = OpLabel
OpStore %matrix_b %79
OpStore %b %int_3
OpBranch %81
%81 = OpLabel
OpLoopMerge %82 %83 None
OpBranch %84
%84 = OpLabel
%85 = OpLoad %int %b
%86 = OpSGreaterThanEqual %bool %85 %int_0
OpSelectionMerge %87 None
OpBranchConditional %86 %88 %89
%88 = OpLabel
OpBranch %87
%89 = OpLabel
OpBranch %82
%87 = OpLabel
%90 = OpLoad %int %b
%91 = OpLoad %int %b
%93 = OpAccessChain %_ptr_Function_float %matrix_b %91
%94 = OpLoad %float %93
%95 = OpAccessChain %_ptr_Function_float %matrix_b %90
%97 = OpFSub %float %94 %float_1
OpStore %95 %97
OpBranch %83
%83 = OpLabel
%98 = OpLoad %int %b
%99 = OpISub %int %98 %int_1
OpStore %b %99
OpBranch %81
%82 = OpLabel
OpBranch %35
%35 = OpLabel
%100 = OpLoad %int %k
%101 = OpIAdd %int %100 %int_1
OpStore %k %101
OpBranch %33
%34 = OpLabel
OpStore %x_GLF_color %102
OpReturn
OpFunctionEnd
%tint_symbol_2 = OpFunction %void None %103
%tint_symbol = OpFunctionParameter %main_out
%107 = OpLabel
%108 = OpCompositeExtract %v4float %tint_symbol 0
OpStore %tint_symbol_1 %108
OpReturn
OpFunctionEnd
%main = OpFunction %void None %12
%110 = OpLabel
%111 = OpFunctionCall %void %main_1
%113 = OpLoad %v4float %x_GLF_color
%114 = OpCompositeConstruct %main_out %113
%112 = OpFunctionCall %void %tint_symbol_2 %114
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,85 @@
[[block]]
struct buf0 {
injectionSwitch : vec2<f32>;
};
[[group(0), binding(0)]] var<uniform> x_6 : buf0;
var<private> x_GLF_color : vec4<f32>;
fn main_1() {
var k : i32;
var GLF_dead0j : i32;
var donor_replacementGLF_dead0stack : array<i32, 10>;
var donor_replacementGLF_dead0top : i32;
var x_54 : i32;
var matrix_b : vec4<f32>;
var b : i32;
k = 0;
loop {
let x_12 : i32 = k;
if ((x_12 < 4)) {
} else {
break;
}
let x_62 : f32 = x_6.injectionSwitch.y;
if ((0.0 > x_62)) {
GLF_dead0j = 1;
loop {
let x_13 : i32 = donor_replacementGLF_dead0stack[0];
if ((1 <= x_13)) {
} else {
break;
}
}
let x_14 : i32 = donor_replacementGLF_dead0top;
let x_15 : i32 = donor_replacementGLF_dead0top;
if (((x_14 >= 0) && (x_15 < 9))) {
let x_16 : i32 = donor_replacementGLF_dead0top;
let x_17 : i32 = (x_16 + 1);
donor_replacementGLF_dead0top = x_17;
x_54 = x_17;
} else {
x_54 = 0;
}
let x_18 : i32 = x_54;
donor_replacementGLF_dead0stack[x_18] = 1;
}
matrix_b = vec4<f32>(0.0, 0.0, 0.0, 0.0);
b = 3;
loop {
let x_19 : i32 = b;
if ((x_19 >= 0)) {
} else {
break;
}
let x_20 : i32 = b;
let x_21 : i32 = b;
let x_87 : f32 = matrix_b[x_21];
matrix_b[x_20] = (x_87 - 1.0);
continuing {
let x_22 : i32 = b;
b = (x_22 - 1);
}
}
continuing {
let x_24 : i32 = k;
k = (x_24 + 1);
}
}
x_GLF_color = vec4<f32>(1.0, 0.0, 0.0, 1.0);
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);
}

View File

@@ -0,0 +1,85 @@
[[block]]
struct buf0 {
injectionSwitch : vec2<f32>;
};
[[group(0), binding(0)]] var<uniform> x_6 : buf0;
var<private> x_GLF_color : vec4<f32>;
fn main_1() {
var k : i32;
var GLF_dead0j : i32;
var donor_replacementGLF_dead0stack : array<i32, 10>;
var donor_replacementGLF_dead0top : i32;
var x_54 : i32;
var matrix_b : vec4<f32>;
var b : i32;
k = 0;
loop {
let x_12 : i32 = k;
if ((x_12 < 4)) {
} else {
break;
}
let x_62 : f32 = x_6.injectionSwitch.y;
if ((0.0 > x_62)) {
GLF_dead0j = 1;
loop {
let x_13 : i32 = donor_replacementGLF_dead0stack[0];
if ((1 <= x_13)) {
} else {
break;
}
}
let x_14 : i32 = donor_replacementGLF_dead0top;
let x_15 : i32 = donor_replacementGLF_dead0top;
if (((x_14 >= 0) && (x_15 < 9))) {
let x_16 : i32 = donor_replacementGLF_dead0top;
let x_17 : i32 = (x_16 + 1);
donor_replacementGLF_dead0top = x_17;
x_54 = x_17;
} else {
x_54 = 0;
}
let x_18 : i32 = x_54;
donor_replacementGLF_dead0stack[x_18] = 1;
}
matrix_b = vec4<f32>(0.0, 0.0, 0.0, 0.0);
b = 3;
loop {
let x_19 : i32 = b;
if ((x_19 >= 0)) {
} else {
break;
}
let x_20 : i32 = b;
let x_21 : i32 = b;
let x_87 : f32 = matrix_b[x_21];
matrix_b[x_20] = (x_87 - 1.0);
continuing {
let x_22 : i32 = b;
b = (x_22 - 1);
}
}
continuing {
let x_24 : i32 = k;
k = (x_24 + 1);
}
}
x_GLF_color = vec4<f32>(1.0, 0.0, 0.0, 1.0);
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);
}

View File

@@ -0,0 +1,71 @@
void set_float4(inout float4 vec, int idx, float val) {
vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec;
}
cbuffer cbuffer_x_6 : register(b0, space0) {
uint4 x_6[1];
};
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
void main_1() {
int k = 0;
int GLF_dead0j = 0;
int donor_replacementGLF_dead0stack[10] = (int[10])0;
int donor_replacementGLF_dead0top = 0;
int x_54 = 0;
float4 matrix_b = float4(0.0f, 0.0f, 0.0f, 0.0f);
int b = 0;
k = 0;
{
for(; (k < 4); k = (k + 1)) {
const float x_62 = asfloat(x_6[0].y);
if ((0.0f > x_62)) {
GLF_dead0j = 1;
while (true) {
const int x_13 = donor_replacementGLF_dead0stack[0];
if ((1 <= x_13)) {
} else {
break;
}
}
bool tint_tmp = (donor_replacementGLF_dead0top >= 0);
if (tint_tmp) {
tint_tmp = (donor_replacementGLF_dead0top < 9);
}
if ((tint_tmp)) {
const int x_17 = (donor_replacementGLF_dead0top + 1);
donor_replacementGLF_dead0top = x_17;
x_54 = x_17;
} else {
x_54 = 0;
}
donor_replacementGLF_dead0stack[x_54] = 1;
}
matrix_b = float4(0.0f, 0.0f, 0.0f, 0.0f);
b = 3;
{
for(; (b >= 0); b = (b - 1)) {
const int x_20 = b;
const float x_87 = matrix_b[b];
set_float4(matrix_b, x_20, (x_87 - 1.0f));
}
}
}
}
x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
return;
}
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol {
float4 x_GLF_color_1 : SV_Target0;
};
tint_symbol main() {
main_1();
const main_out tint_symbol_1 = {x_GLF_color};
const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1};
return tint_symbol_3;
}

View File

@@ -0,0 +1,88 @@
#include <metal_stdlib>
using namespace metal;
struct buf0 {
/* 0x0000 */ packed_float2 injectionSwitch;
};
struct tint_array_wrapper {
int arr[10];
};
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol_1 {
float4 x_GLF_color_1 [[color(0)]];
};
void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) {
int k = 0;
int GLF_dead0j = 0;
tint_array_wrapper donor_replacementGLF_dead0stack = {};
int donor_replacementGLF_dead0top = 0;
int x_54 = 0;
float4 matrix_b = 0.0f;
int b = 0;
k = 0;
while (true) {
int const x_12 = k;
if ((x_12 < 4)) {
} else {
break;
}
float const x_62 = x_6.injectionSwitch.y;
if ((0.0f > x_62)) {
GLF_dead0j = 1;
while (true) {
int const x_13 = donor_replacementGLF_dead0stack.arr[0];
if ((1 <= x_13)) {
} else {
break;
}
}
int const x_14 = donor_replacementGLF_dead0top;
int const x_15 = donor_replacementGLF_dead0top;
if (((x_14 >= 0) && (x_15 < 9))) {
int const x_16 = donor_replacementGLF_dead0top;
int const x_17 = (x_16 + 1);
donor_replacementGLF_dead0top = x_17;
x_54 = x_17;
} else {
x_54 = 0;
}
int const x_18 = x_54;
donor_replacementGLF_dead0stack.arr[x_18] = 1;
}
matrix_b = float4(0.0f, 0.0f, 0.0f, 0.0f);
b = 3;
while (true) {
int const x_19 = b;
if ((x_19 >= 0)) {
} else {
break;
}
int const x_20 = b;
int const x_21 = b;
float const x_87 = matrix_b[x_21];
matrix_b[x_20] = (x_87 - 1.0f);
{
int const x_22 = b;
b = (x_22 - 1);
}
}
{
int const x_24 = k;
k = (x_24 + 1);
}
}
*(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f);
return;
}
fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) {
thread float4 tint_symbol_5 = 0.0f;
main_1(x_6, &(tint_symbol_5));
main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5};
tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1};
return tint_symbol_3;
}

View File

@@ -0,0 +1,205 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 115
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %tint_symbol_1
OpExecutionMode %main OriginUpperLeft
OpName %buf0 "buf0"
OpMemberName %buf0 0 "injectionSwitch"
OpName %x_6 "x_6"
OpName %x_GLF_color "x_GLF_color"
OpName %tint_symbol_1 "tint_symbol_1"
OpName %main_1 "main_1"
OpName %k "k"
OpName %GLF_dead0j "GLF_dead0j"
OpName %donor_replacementGLF_dead0stack "donor_replacementGLF_dead0stack"
OpName %donor_replacementGLF_dead0top "donor_replacementGLF_dead0top"
OpName %x_54 "x_54"
OpName %matrix_b "matrix_b"
OpName %b "b"
OpName %main_out "main_out"
OpMemberName %main_out 0 "x_GLF_color_1"
OpName %tint_symbol_2 "tint_symbol_2"
OpName %tint_symbol "tint_symbol"
OpName %main "main"
OpDecorate %buf0 Block
OpMemberDecorate %buf0 0 Offset 0
OpDecorate %x_6 NonWritable
OpDecorate %x_6 DescriptorSet 0
OpDecorate %x_6 Binding 0
OpDecorate %tint_symbol_1 Location 0
OpDecorate %_arr_int_uint_10 ArrayStride 4
OpMemberDecorate %main_out 0 Offset 0
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%buf0 = OpTypeStruct %v2float
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
%x_6 = OpVariable %_ptr_Uniform_buf0 Uniform
%v4float = OpTypeVector %float 4
%_ptr_Private_v4float = OpTypePointer Private %v4float
%9 = OpConstantNull %v4float
%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9
%_ptr_Output_v4float = OpTypePointer Output %v4float
%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9
%void = OpTypeVoid
%12 = OpTypeFunction %void
%int = OpTypeInt 32 1
%_ptr_Function_int = OpTypePointer Function %int
%19 = OpConstantNull %int
%uint = OpTypeInt 32 0
%uint_10 = OpConstant %uint 10
%_arr_int_uint_10 = OpTypeArray %int %uint_10
%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10
%26 = OpConstantNull %_arr_int_uint_10
%_ptr_Function_v4float = OpTypePointer Function %v4float
%int_0 = OpConstant %int 0
%int_4 = OpConstant %int 4
%bool = OpTypeBool
%uint_0 = OpConstant %uint 0
%uint_1 = OpConstant %uint 1
%_ptr_Uniform_float = OpTypePointer Uniform %float
%float_0 = OpConstant %float 0
%int_1 = OpConstant %int 1
%int_9 = OpConstant %int 9
%79 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0
%int_3 = OpConstant %int 3
%_ptr_Function_float = OpTypePointer Function %float
%float_1 = OpConstant %float 1
%102 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
%main_out = OpTypeStruct %v4float
%103 = OpTypeFunction %void %main_out
%main_1 = OpFunction %void None %12
%15 = OpLabel
%k = OpVariable %_ptr_Function_int Function %19
%GLF_dead0j = OpVariable %_ptr_Function_int Function %19
%donor_replacementGLF_dead0stack = OpVariable %_ptr_Function__arr_int_uint_10 Function %26
%donor_replacementGLF_dead0top = OpVariable %_ptr_Function_int Function %19
%x_54 = OpVariable %_ptr_Function_int Function %19
%matrix_b = OpVariable %_ptr_Function_v4float Function %9
%b = OpVariable %_ptr_Function_int Function %19
OpStore %k %int_0
OpBranch %33
%33 = OpLabel
OpLoopMerge %34 %35 None
OpBranch %36
%36 = OpLabel
%37 = OpLoad %int %k
%39 = OpSLessThan %bool %37 %int_4
OpSelectionMerge %41 None
OpBranchConditional %39 %42 %43
%42 = OpLabel
OpBranch %41
%43 = OpLabel
OpBranch %34
%41 = OpLabel
%47 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1
%48 = OpLoad %float %47
%50 = OpFOrdGreaterThan %bool %float_0 %48
OpSelectionMerge %51 None
OpBranchConditional %50 %52 %51
%52 = OpLabel
OpStore %GLF_dead0j %int_1
OpBranch %54
%54 = OpLabel
OpLoopMerge %55 %56 None
OpBranch %57
%57 = OpLabel
%58 = OpAccessChain %_ptr_Function_int %donor_replacementGLF_dead0stack %int_0
%59 = OpLoad %int %58
%60 = OpSLessThanEqual %bool %int_1 %59
OpSelectionMerge %61 None
OpBranchConditional %60 %62 %63
%62 = OpLabel
OpBranch %61
%63 = OpLabel
OpBranch %55
%61 = OpLabel
OpBranch %56
%56 = OpLabel
OpBranch %54
%55 = OpLabel
%64 = OpLoad %int %donor_replacementGLF_dead0top
%65 = OpLoad %int %donor_replacementGLF_dead0top
%66 = OpSGreaterThanEqual %bool %64 %int_0
OpSelectionMerge %67 None
OpBranchConditional %66 %68 %67
%68 = OpLabel
%70 = OpSLessThan %bool %65 %int_9
OpBranch %67
%67 = OpLabel
%71 = OpPhi %bool %66 %55 %70 %68
OpSelectionMerge %72 None
OpBranchConditional %71 %73 %74
%73 = OpLabel
%75 = OpLoad %int %donor_replacementGLF_dead0top
%76 = OpIAdd %int %75 %int_1
OpStore %donor_replacementGLF_dead0top %76
OpStore %x_54 %76
OpBranch %72
%74 = OpLabel
OpStore %x_54 %int_0
OpBranch %72
%72 = OpLabel
%77 = OpLoad %int %x_54
%78 = OpAccessChain %_ptr_Function_int %donor_replacementGLF_dead0stack %77
OpStore %78 %int_1
OpBranch %51
%51 = OpLabel
OpStore %matrix_b %79
OpStore %b %int_3
OpBranch %81
%81 = OpLabel
OpLoopMerge %82 %83 None
OpBranch %84
%84 = OpLabel
%85 = OpLoad %int %b
%86 = OpSGreaterThanEqual %bool %85 %int_0
OpSelectionMerge %87 None
OpBranchConditional %86 %88 %89
%88 = OpLabel
OpBranch %87
%89 = OpLabel
OpBranch %82
%87 = OpLabel
%90 = OpLoad %int %b
%91 = OpLoad %int %b
%93 = OpAccessChain %_ptr_Function_float %matrix_b %91
%94 = OpLoad %float %93
%95 = OpAccessChain %_ptr_Function_float %matrix_b %90
%97 = OpFSub %float %94 %float_1
OpStore %95 %97
OpBranch %83
%83 = OpLabel
%98 = OpLoad %int %b
%99 = OpISub %int %98 %int_1
OpStore %b %99
OpBranch %81
%82 = OpLabel
OpBranch %35
%35 = OpLabel
%100 = OpLoad %int %k
%101 = OpIAdd %int %100 %int_1
OpStore %k %101
OpBranch %33
%34 = OpLabel
OpStore %x_GLF_color %102
OpReturn
OpFunctionEnd
%tint_symbol_2 = OpFunction %void None %103
%tint_symbol = OpFunctionParameter %main_out
%107 = OpLabel
%108 = OpCompositeExtract %v4float %tint_symbol 0
OpStore %tint_symbol_1 %108
OpReturn
OpFunctionEnd
%main = OpFunction %void None %12
%110 = OpLabel
%111 = OpFunctionCall %void %main_1
%113 = OpLoad %v4float %x_GLF_color
%114 = OpCompositeConstruct %main_out %113
%112 = OpFunctionCall %void %tint_symbol_2 %114
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,85 @@
[[block]]
struct buf0 {
injectionSwitch : vec2<f32>;
};
[[group(0), binding(0)]] var<uniform> x_6 : buf0;
var<private> x_GLF_color : vec4<f32>;
fn main_1() {
var k : i32;
var GLF_dead0j : i32;
var donor_replacementGLF_dead0stack : array<i32, 10>;
var donor_replacementGLF_dead0top : i32;
var x_54 : i32;
var matrix_b : vec4<f32>;
var b : i32;
k = 0;
loop {
let x_12 : i32 = k;
if ((x_12 < 4)) {
} else {
break;
}
let x_62 : f32 = x_6.injectionSwitch.y;
if ((0.0 > x_62)) {
GLF_dead0j = 1;
loop {
let x_13 : i32 = donor_replacementGLF_dead0stack[0];
if ((1 <= x_13)) {
} else {
break;
}
}
let x_14 : i32 = donor_replacementGLF_dead0top;
let x_15 : i32 = donor_replacementGLF_dead0top;
if (((x_14 >= 0) && (x_15 < 9))) {
let x_16 : i32 = donor_replacementGLF_dead0top;
let x_17 : i32 = (x_16 + 1);
donor_replacementGLF_dead0top = x_17;
x_54 = x_17;
} else {
x_54 = 0;
}
let x_18 : i32 = x_54;
donor_replacementGLF_dead0stack[x_18] = 1;
}
matrix_b = vec4<f32>(0.0, 0.0, 0.0, 0.0);
b = 3;
loop {
let x_19 : i32 = b;
if ((x_19 >= 0)) {
} else {
break;
}
let x_20 : i32 = b;
let x_21 : i32 = b;
let x_87 : f32 = matrix_b[x_21];
matrix_b[x_20] = (x_87 - 1.0);
continuing {
let x_22 : i32 = b;
b = (x_22 - 1);
}
}
continuing {
let x_24 : i32 = k;
k = (x_24 + 1);
}
}
x_GLF_color = vec4<f32>(1.0, 0.0, 0.0, 1.0);
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);
}