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,257 @@
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 %yieldsZero_ "yieldsZero("
OpName %globalNumbers "globalNumbers"
OpName %i "i"
OpName %buf0 "buf0"
OpMemberName %buf0 0 "one"
OpName %_ ""
OpName %acc "acc"
OpName %i_0 "i"
OpName %localNumbers "localNumbers"
OpName %param "param"
OpName %_GLF_color "_GLF_color"
OpDecorate %yieldsZero_ RelaxedPrecision
OpDecorate %globalNumbers RelaxedPrecision
OpDecorate %i RelaxedPrecision
OpMemberDecorate %buf0 0 Offset 0
OpDecorate %buf0 Block
OpDecorate %_ DescriptorSet 0
OpDecorate %_ Binding 0
OpDecorate %acc RelaxedPrecision
OpDecorate %i_0 RelaxedPrecision
OpDecorate %localNumbers RelaxedPrecision
OpDecorate %13 RelaxedPrecision
OpDecorate %14 RelaxedPrecision
OpDecorate %15 RelaxedPrecision
OpDecorate %16 RelaxedPrecision
OpDecorate %_GLF_color Location 0
OpDecorate %17 RelaxedPrecision
OpDecorate %18 RelaxedPrecision
OpDecorate %19 RelaxedPrecision
OpDecorate %20 RelaxedPrecision
OpDecorate %21 RelaxedPrecision
OpDecorate %22 RelaxedPrecision
OpDecorate %23 RelaxedPrecision
OpDecorate %24 RelaxedPrecision
OpDecorate %25 RelaxedPrecision
OpDecorate %26 RelaxedPrecision
OpDecorate %27 RelaxedPrecision
OpDecorate %28 RelaxedPrecision
OpDecorate %29 RelaxedPrecision
OpDecorate %30 RelaxedPrecision
OpDecorate %31 RelaxedPrecision
OpDecorate %32 RelaxedPrecision
OpDecorate %33 RelaxedPrecision
OpDecorate %34 RelaxedPrecision
%void = OpTypeVoid
%36 = OpTypeFunction %void
%int = OpTypeInt 32 1
%_ptr_Function_int = OpTypePointer Function %int
%39 = OpTypeFunction %int
%int_0 = OpConstant %int 0
%bool = OpTypeBool
%uint = OpTypeInt 32 0
%uint_10 = OpConstant %uint 10
%_arr_int_uint_10 = OpTypeArray %int %uint_10
%_ptr_Private__arr_int_uint_10 = OpTypePointer Private %_arr_int_uint_10
%_ptr_Private_int = OpTypePointer Private %int
%int_1 = OpConstant %int 1
%float = OpTypeFloat 32
%buf0 = OpTypeStruct %float
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
%_ = OpVariable %_ptr_Uniform_buf0 Uniform
%_ptr_Uniform_float = OpTypePointer Uniform %float
%int_4 = OpConstant %int 4
%uint_2 = OpConstant %uint 2
%_arr_int_uint_2 = OpTypeArray %int %uint_2
%_ptr_Function__arr_int_uint_2 = OpTypePointer Function %_arr_int_uint_2
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%_GLF_color = OpVariable %_ptr_Output_v4float Output
%float_1 = OpConstant %float 1
%float_0 = OpConstant %float 0
%59 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
%60 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1
%false = OpConstantFalse %bool
%_ptr_Function_bool = OpTypePointer Function %bool
%true = OpConstantTrue %bool
%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10
%65 = OpUndef %int
%66 = OpUndef %bool
%main = OpFunction %void None %36
%67 = OpLabel
%68 = OpVariable %_ptr_Function_bool Function %false
%29 = OpVariable %_ptr_Function_int Function
%30 = OpVariable %_ptr_Function_int Function
%31 = OpVariable %_ptr_Function_int Function
%globalNumbers = OpVariable %_ptr_Function__arr_int_uint_10 Function
%17 = OpVariable %_ptr_Function_int Function
%acc = OpVariable %_ptr_Function_int Function
%i_0 = OpVariable %_ptr_Function_int Function
%localNumbers = OpVariable %_ptr_Function__arr_int_uint_2 Function
%param = OpVariable %_ptr_Function_int Function
OpStore %acc %int_0
OpStore %i_0 %int_0
OpBranch %69
%69 = OpLabel
%24 = OpPhi %int %int_0 %67 %15 %70
%23 = OpPhi %int %int_0 %67 %16 %70
OpLoopMerge %71 %70 None
OpBranch %72
%72 = OpLabel
%73 = OpSLessThan %bool %23 %int_4
OpBranchConditional %73 %74 %71
%74 = OpLabel
OpStore %68 %false
OpBranch %75
%75 = OpLabel
%76 = OpPhi %bool %false %74 %66 %77
OpLoopMerge %78 %77 None
OpBranch %79
%79 = OpLabel
OpStore %30 %int_0
OpBranch %80
%80 = OpLabel
%81 = OpPhi %bool %76 %79 %66 %82
%32 = OpPhi %int %int_0 %79 %65 %82
OpLoopMerge %83 %82 None
OpBranch %84
%84 = OpLabel
%85 = OpAccessChain %_ptr_Uniform_float %_ %int_0
%86 = OpLoad %float %85
%87 = OpConvertFToS %int %86
%88 = OpSLessThan %bool %32 %87
OpBranchConditional %88 %89 %83
%89 = OpLabel
OpStore %68 %true
OpStore %29 %32
OpBranch %83
%82 = OpLabel
OpBranch %80
%83 = OpLabel
%33 = OpPhi %int %65 %84 %32 %89
%90 = OpPhi %bool %81 %84 %true %89
OpSelectionMerge %91 None
OpBranchConditional %90 %78 %91
%91 = OpLabel
%92 = OpUndef %int
OpStore %68 %true
OpStore %29 %92
OpBranch %78
%77 = OpLabel
OpBranch %75
%78 = OpLabel
%34 = OpPhi %int %33 %83 %92 %91
OpStore %31 %34
%93 = OpLoad %int %31
%21 = OpLoad %_arr_int_uint_2 %localNumbers
%22 = OpCompositeInsert %_arr_int_uint_2 %93 %21 1
OpStore %localNumbers %22
%94 = OpAccessChain %_ptr_Function_int %globalNumbers %int_0
OpStore %94 %int_0
%95 = OpAccessChain %_ptr_Function_int %localNumbers %int_1
%13 = OpCompositeExtract %int %22 1
OpStore %param %13
OpStore %17 %int_0
OpBranch %96
%96 = OpLabel
%25 = OpPhi %int %int_0 %78 %19 %97
OpLoopMerge %98 %97 None
OpBranch %99
%99 = OpLabel
%100 = OpSLessThanEqual %bool %25 %13
OpBranchConditional %100 %101 %98
%101 = OpLabel
%102 = OpAccessChain %_ptr_Function_int %globalNumbers %13
%18 = OpLoad %int %102
%103 = OpSLessThanEqual %bool %18 %int_1
OpSelectionMerge %104 None
OpBranchConditional %103 %105 %104
%105 = OpLabel
OpStore %102 %int_1
OpBranch %104
%104 = OpLabel
OpBranch %97
%97 = OpLabel
%19 = OpIAdd %int %25 %int_1
OpStore %17 %19
OpBranch %96
%98 = OpLabel
%106 = OpAccessChain %_ptr_Uniform_float %_ %int_0
%107 = OpLoad %float %106
%108 = OpConvertFToS %int %107
%109 = OpISub %int %108 %int_1
%110 = OpAccessChain %_ptr_Function_int %globalNumbers %109
%14 = OpLoad %int %110
%15 = OpIAdd %int %24 %14
OpStore %acc %15
OpBranch %70
%70 = OpLabel
%16 = OpIAdd %int %23 %int_1
OpStore %i_0 %16
OpBranch %69
%71 = OpLabel
%111 = OpIEqual %bool %24 %int_4
OpSelectionMerge %112 None
OpBranchConditional %111 %113 %114
%113 = OpLabel
OpStore %_GLF_color %59
OpBranch %112
%114 = OpLabel
OpStore %_GLF_color %60
OpBranch %112
%112 = OpLabel
OpReturn
OpFunctionEnd
%yieldsZero_ = OpFunction %int None %39
%115 = OpLabel
%116 = OpVariable %_ptr_Function_bool Function %false
%20 = OpVariable %_ptr_Function_int Function
%i = OpVariable %_ptr_Function_int Function
OpBranch %117
%117 = OpLabel
%118 = OpPhi %bool %false %115 %66 %119
OpLoopMerge %120 %119 None
OpBranch %121
%121 = OpLabel
OpStore %i %int_0
OpBranch %122
%122 = OpLabel
%123 = OpPhi %bool %118 %121 %66 %124
%28 = OpPhi %int %int_0 %121 %65 %124
OpLoopMerge %125 %124 None
OpBranch %126
%126 = OpLabel
%127 = OpAccessChain %_ptr_Uniform_float %_ %int_0
%128 = OpLoad %float %127
%129 = OpConvertFToS %int %128
%130 = OpSLessThan %bool %28 %129
OpBranchConditional %130 %131 %125
%131 = OpLabel
OpStore %116 %true
OpStore %20 %28
OpBranch %125
%124 = OpLabel
OpBranch %122
%125 = OpLabel
%26 = OpPhi %int %65 %126 %28 %131
%132 = OpPhi %bool %123 %126 %true %131
OpSelectionMerge %133 None
OpBranchConditional %132 %120 %133
%133 = OpLabel
%134 = OpUndef %int
OpStore %116 %true
OpStore %20 %134
OpBranch %120
%119 = OpLabel
OpBranch %117
%120 = OpLabel
%27 = OpPhi %int %26 %125 %134 %133
OpReturnValue %27
OpFunctionEnd

View File

@@ -0,0 +1,201 @@
cbuffer cbuffer_x_8 : register(b0, space0) {
uint4 x_8[1];
};
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
void main_1() {
bool x_68 = false;
int x_29 = 0;
int x_30 = 0;
int x_31 = 0;
int globalNumbers[10] = (int[10])0;
int x_17 = 0;
int acc = 0;
int i_1 = 0;
int localNumbers[2] = (int[2])0;
int param = 0;
int x_24 = 0;
int x_24_phi = 0;
int x_23_phi = 0;
acc = 0;
i_1 = 0;
x_24_phi = 0;
x_23_phi = 0;
while (true) {
int x_33 = 0;
int x_92 = 0;
bool x_76_phi = false;
int x_34_phi = 0;
int x_25_phi = 0;
x_24 = x_24_phi;
const int x_23 = x_23_phi;
if ((x_23 < 4)) {
} else {
break;
}
x_68 = false;
x_76_phi = false;
while (true) {
bool x_81 = false;
int x_32 = 0;
bool x_81_phi = false;
int x_32_phi = 0;
int x_33_phi = 0;
bool x_90_phi = false;
const bool x_76 = x_76_phi;
x_30 = 0;
x_81_phi = x_76;
x_32_phi = 0;
while (true) {
x_81 = x_81_phi;
x_32 = x_32_phi;
const float x_86 = asfloat(x_8[0].x);
x_33_phi = 0;
x_90_phi = x_81;
if ((x_32 < int(x_86))) {
} else {
break;
}
x_68 = true;
x_29 = x_32;
x_33_phi = x_32;
x_90_phi = true;
break;
{
x_81_phi = false;
x_32_phi = 0;
}
}
x_33 = x_33_phi;
const bool x_90 = x_90_phi;
x_34_phi = x_33;
if (x_90) {
break;
}
x_92 = 0;
x_68 = true;
x_29 = x_92;
x_34_phi = x_92;
break;
{
x_76_phi = false;
}
}
x_31 = x_34_phi;
const int x_93 = x_31;
int x_22_1[2] = localNumbers;
x_22_1[1u] = x_93;
const int x_22[2] = x_22_1;
localNumbers = x_22;
globalNumbers[0] = 0;
const int x_13 = x_22[1u];
param = x_13;
x_17 = 0;
x_25_phi = 0;
while (true) {
const int x_25 = x_25_phi;
if ((x_25 <= x_13)) {
} else {
break;
}
const int x_102_save = x_13;
const int x_18 = globalNumbers[x_102_save];
if ((x_18 <= 1)) {
globalNumbers[x_102_save] = 1;
}
{
const int x_19 = (x_25 + 1);
x_17 = x_19;
x_25_phi = x_19;
}
}
const float x_107 = asfloat(x_8[0].x);
const int x_14 = globalNumbers[(int(x_107) - 1)];
const int x_15 = asint((x_24 + asint(x_14)));
acc = x_15;
{
const int x_16 = (x_23 + 1);
i_1 = x_16;
x_24_phi = x_15;
x_23_phi = x_16;
}
}
if ((x_24 == asint(4))) {
x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
} else {
x_GLF_color = float4(0.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;
}
int yieldsZero_() {
bool x_116 = false;
int x_20 = 0;
int i = 0;
int x_26 = 0;
int x_134 = 0;
bool x_118_phi = false;
int x_27_phi = 0;
x_118_phi = false;
while (true) {
bool x_123 = false;
int x_28 = 0;
bool x_123_phi = false;
int x_28_phi = 0;
int x_26_phi = 0;
bool x_132_phi = false;
const bool x_118 = x_118_phi;
i = 0;
x_123_phi = x_118;
x_28_phi = 0;
while (true) {
x_123 = x_123_phi;
x_28 = x_28_phi;
const float x_128 = asfloat(x_8[0].x);
x_26_phi = 0;
x_132_phi = x_123;
if ((x_28 < int(x_128))) {
} else {
break;
}
x_116 = true;
x_20 = x_28;
x_26_phi = x_28;
x_132_phi = true;
break;
{
x_123_phi = false;
x_28_phi = 0;
}
}
x_26 = x_26_phi;
const bool x_132 = x_132_phi;
x_27_phi = x_26;
if (x_132) {
break;
}
x_134 = 0;
x_116 = true;
x_20 = x_134;
x_27_phi = x_134;
break;
{
x_118_phi = false;
}
}
return x_27_phi;
}

View File

@@ -0,0 +1,213 @@
#include <metal_stdlib>
using namespace metal;
struct buf0 {
/* 0x0000 */ float one;
};
struct tint_array_wrapper {
int arr[10];
};
struct tint_array_wrapper_1 {
int arr[2];
};
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_8, thread float4* const tint_symbol_4) {
bool x_68 = false;
int x_29 = 0;
int x_30 = 0;
int x_31 = 0;
tint_array_wrapper globalNumbers = {};
int x_17 = 0;
int acc = 0;
int i_1 = 0;
tint_array_wrapper_1 localNumbers = {};
int param = 0;
int x_24 = 0;
int x_24_phi = 0;
int x_23_phi = 0;
acc = 0;
i_1 = 0;
x_24_phi = 0;
x_23_phi = 0;
while (true) {
int x_33 = 0;
int x_92 = 0;
bool x_76_phi = false;
int x_34_phi = 0;
int x_25_phi = 0;
x_24 = x_24_phi;
int const x_23 = x_23_phi;
if ((x_23 < 4)) {
} else {
break;
}
x_68 = false;
x_76_phi = false;
while (true) {
bool x_81 = false;
int x_32 = 0;
bool x_81_phi = false;
int x_32_phi = 0;
int x_33_phi = 0;
bool x_90_phi = false;
bool const x_76 = x_76_phi;
x_30 = 0;
x_81_phi = x_76;
x_32_phi = 0;
while (true) {
x_81 = x_81_phi;
x_32 = x_32_phi;
float const x_86 = x_8.one;
x_33_phi = 0;
x_90_phi = x_81;
if ((x_32 < int(x_86))) {
} else {
break;
}
x_68 = true;
x_29 = x_32;
x_33_phi = x_32;
x_90_phi = true;
break;
{
x_81_phi = false;
x_32_phi = 0;
}
}
x_33 = x_33_phi;
bool const x_90 = x_90_phi;
x_34_phi = x_33;
if (x_90) {
break;
}
x_92 = 0;
x_68 = true;
x_29 = x_92;
x_34_phi = x_92;
break;
{
x_76_phi = false;
}
}
int const x_34 = x_34_phi;
x_31 = x_34;
int const x_93 = x_31;
tint_array_wrapper_1 const x_21 = localNumbers;
tint_array_wrapper_1 x_22_1 = x_21;
x_22_1.arr[1u] = x_93;
tint_array_wrapper_1 const x_22 = x_22_1;
localNumbers = x_22;
globalNumbers.arr[0] = 0;
int const x_13 = x_22.arr[1u];
param = x_13;
x_17 = 0;
x_25_phi = 0;
while (true) {
int const x_25 = x_25_phi;
if ((x_25 <= x_13)) {
} else {
break;
}
int const x_102_save = x_13;
int const x_18 = globalNumbers.arr[x_102_save];
if ((x_18 <= 1)) {
globalNumbers.arr[x_102_save] = 1;
}
{
int const x_19 = (x_25 + 1);
x_17 = x_19;
x_25_phi = x_19;
}
}
float const x_107 = x_8.one;
int const x_14 = globalNumbers.arr[(int(x_107) - 1)];
int const x_15 = as_type<int>((x_24 + as_type<int>(x_14)));
acc = x_15;
{
int const x_16 = (x_23 + 1);
i_1 = x_16;
x_24_phi = x_15;
x_23_phi = x_16;
}
}
if ((x_24 == as_type<int>(4))) {
*(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f);
} else {
*(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 1.0f);
}
return;
}
fragment tint_symbol_1 tint_symbol(constant buf0& x_8 [[buffer(0)]]) {
thread float4 tint_symbol_5 = 0.0f;
main_1(x_8, &(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;
}
int yieldsZero_(constant buf0& x_8) {
bool x_116 = false;
int x_20 = 0;
int i = 0;
int x_26 = 0;
int x_134 = 0;
bool x_118_phi = false;
int x_27_phi = 0;
x_118_phi = false;
while (true) {
bool x_123 = false;
int x_28 = 0;
bool x_123_phi = false;
int x_28_phi = 0;
int x_26_phi = 0;
bool x_132_phi = false;
bool const x_118 = x_118_phi;
i = 0;
x_123_phi = x_118;
x_28_phi = 0;
while (true) {
x_123 = x_123_phi;
x_28 = x_28_phi;
float const x_128 = x_8.one;
x_26_phi = 0;
x_132_phi = x_123;
if ((x_28 < int(x_128))) {
} else {
break;
}
x_116 = true;
x_20 = x_28;
x_26_phi = x_28;
x_132_phi = true;
break;
{
x_123_phi = false;
x_28_phi = 0;
}
}
x_26 = x_26_phi;
bool const x_132 = x_132_phi;
x_27_phi = x_26;
if (x_132) {
break;
}
x_134 = 0;
x_116 = true;
x_20 = x_134;
x_27_phi = x_134;
break;
{
x_118_phi = false;
}
}
int const x_27 = x_27_phi;
return x_27;
}

View File

@@ -0,0 +1,406 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 204
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %tint_symbol_1
OpExecutionMode %main OriginUpperLeft
OpName %buf0 "buf0"
OpMemberName %buf0 0 "one"
OpName %x_8 "x_8"
OpName %x_GLF_color "x_GLF_color"
OpName %tint_symbol_1 "tint_symbol_1"
OpName %main_1 "main_1"
OpName %x_68 "x_68"
OpName %x_29 "x_29"
OpName %x_30 "x_30"
OpName %x_31 "x_31"
OpName %globalNumbers "globalNumbers"
OpName %x_17 "x_17"
OpName %acc "acc"
OpName %i_1 "i_1"
OpName %localNumbers "localNumbers"
OpName %param "param"
OpName %x_24 "x_24"
OpName %x_24_phi "x_24_phi"
OpName %x_23_phi "x_23_phi"
OpName %x_33 "x_33"
OpName %x_92 "x_92"
OpName %x_76_phi "x_76_phi"
OpName %x_34_phi "x_34_phi"
OpName %x_25_phi "x_25_phi"
OpName %x_81 "x_81"
OpName %x_32 "x_32"
OpName %x_81_phi "x_81_phi"
OpName %x_32_phi "x_32_phi"
OpName %x_33_phi "x_33_phi"
OpName %x_90_phi "x_90_phi"
OpName %x_22_1 "x_22_1"
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"
OpName %yieldsZero_ "yieldsZero_"
OpName %x_116 "x_116"
OpName %x_20 "x_20"
OpName %i "i"
OpName %x_26 "x_26"
OpName %x_134 "x_134"
OpName %x_118_phi "x_118_phi"
OpName %x_27_phi "x_27_phi"
OpName %x_123 "x_123"
OpName %x_28 "x_28"
OpName %x_123_phi "x_123_phi"
OpName %x_28_phi "x_28_phi"
OpName %x_26_phi "x_26_phi"
OpName %x_132_phi "x_132_phi"
OpDecorate %buf0 Block
OpMemberDecorate %buf0 0 Offset 0
OpDecorate %x_8 NonWritable
OpDecorate %x_8 DescriptorSet 0
OpDecorate %x_8 Binding 0
OpDecorate %tint_symbol_1 Location 0
OpDecorate %_arr_int_uint_10 ArrayStride 4
OpDecorate %_arr_int_uint_2 ArrayStride 4
OpMemberDecorate %main_out 0 Offset 0
%float = OpTypeFloat 32
%buf0 = OpTypeStruct %float
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
%x_8 = OpVariable %_ptr_Uniform_buf0 Uniform
%v4float = OpTypeVector %float 4
%_ptr_Private_v4float = OpTypePointer Private %v4float
%8 = OpConstantNull %v4float
%x_GLF_color = OpVariable %_ptr_Private_v4float Private %8
%_ptr_Output_v4float = OpTypePointer Output %v4float
%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8
%void = OpTypeVoid
%11 = OpTypeFunction %void
%bool = OpTypeBool
%false = OpConstantFalse %bool
%_ptr_Function_bool = OpTypePointer Function %bool
%19 = OpConstantNull %bool
%int = OpTypeInt 32 1
%_ptr_Function_int = OpTypePointer Function %int
%23 = 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
%31 = OpConstantNull %_arr_int_uint_10
%uint_2 = OpConstant %uint 2
%_arr_int_uint_2 = OpTypeArray %int %uint_2
%_ptr_Function__arr_int_uint_2 = OpTypePointer Function %_arr_int_uint_2
%39 = OpConstantNull %_arr_int_uint_2
%int_0 = OpConstant %int 0
%int_4 = OpConstant %int 4
%uint_0 = OpConstant %uint 0
%_ptr_Uniform_float = OpTypePointer Uniform %float
%true = OpConstantTrue %bool
%uint_1 = OpConstant %uint 1
%int_1 = OpConstant %int 1
%float_1 = OpConstant %float 1
%float_0 = OpConstant %float 0
%144 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
%145 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1
%main_out = OpTypeStruct %v4float
%146 = OpTypeFunction %void %main_out
%158 = OpTypeFunction %int
%main_1 = OpFunction %void None %11
%14 = OpLabel
%x_68 = OpVariable %_ptr_Function_bool Function %19
%x_29 = OpVariable %_ptr_Function_int Function %23
%x_30 = OpVariable %_ptr_Function_int Function %23
%x_31 = OpVariable %_ptr_Function_int Function %23
%globalNumbers = OpVariable %_ptr_Function__arr_int_uint_10 Function %31
%x_17 = OpVariable %_ptr_Function_int Function %23
%acc = OpVariable %_ptr_Function_int Function %23
%i_1 = OpVariable %_ptr_Function_int Function %23
%localNumbers = OpVariable %_ptr_Function__arr_int_uint_2 Function %39
%param = OpVariable %_ptr_Function_int Function %23
%x_24 = OpVariable %_ptr_Function_int Function %23
%x_24_phi = OpVariable %_ptr_Function_int Function %23
%x_23_phi = OpVariable %_ptr_Function_int Function %23
%x_33 = OpVariable %_ptr_Function_int Function %23
%x_92 = OpVariable %_ptr_Function_int Function %23
%x_76_phi = OpVariable %_ptr_Function_bool Function %19
%x_34_phi = OpVariable %_ptr_Function_int Function %23
%x_25_phi = OpVariable %_ptr_Function_int Function %23
%x_81 = OpVariable %_ptr_Function_bool Function %19
%x_32 = OpVariable %_ptr_Function_int Function %23
%x_81_phi = OpVariable %_ptr_Function_bool Function %19
%x_32_phi = OpVariable %_ptr_Function_int Function %23
%x_33_phi = OpVariable %_ptr_Function_int Function %23
%x_90_phi = OpVariable %_ptr_Function_bool Function %19
%x_22_1 = OpVariable %_ptr_Function__arr_int_uint_2 Function %39
OpStore %x_68 %false
OpStore %acc %int_0
OpStore %i_1 %int_0
OpStore %x_24_phi %int_0
OpStore %x_23_phi %int_0
OpBranch %45
%45 = OpLabel
OpLoopMerge %46 %47 None
OpBranch %48
%48 = OpLabel
%54 = OpLoad %int %x_24_phi
OpStore %x_24 %54
%55 = OpLoad %int %x_23_phi
%57 = OpSLessThan %bool %55 %int_4
OpSelectionMerge %58 None
OpBranchConditional %57 %59 %60
%59 = OpLabel
OpBranch %58
%60 = OpLabel
OpBranch %46
%58 = OpLabel
OpStore %x_68 %false
OpStore %x_76_phi %false
OpBranch %61
%61 = OpLabel
OpLoopMerge %62 %63 None
OpBranch %64
%64 = OpLabel
%71 = OpLoad %bool %x_76_phi
OpStore %x_30 %int_0
OpStore %x_81_phi %71
OpStore %x_32_phi %int_0
OpBranch %72
%72 = OpLabel
OpLoopMerge %73 %74 None
OpBranch %75
%75 = OpLabel
%76 = OpLoad %bool %x_81_phi
OpStore %x_81 %76
%77 = OpLoad %int %x_32_phi
OpStore %x_32 %77
%80 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0
%81 = OpLoad %float %80
OpStore %x_33_phi %int_0
%82 = OpLoad %bool %x_81
OpStore %x_90_phi %82
%83 = OpLoad %int %x_32
%84 = OpConvertFToS %int %81
%85 = OpSLessThan %bool %83 %84
OpSelectionMerge %86 None
OpBranchConditional %85 %87 %88
%87 = OpLabel
OpBranch %86
%88 = OpLabel
OpBranch %73
%86 = OpLabel
OpStore %x_68 %true
%90 = OpLoad %int %x_32
OpStore %x_29 %90
%91 = OpLoad %int %x_32
OpStore %x_33_phi %91
OpStore %x_90_phi %true
OpBranch %73
%74 = OpLabel
OpStore %x_81_phi %false
OpStore %x_32_phi %int_0
OpBranch %72
%73 = OpLabel
%92 = OpLoad %int %x_33_phi
OpStore %x_33 %92
%93 = OpLoad %bool %x_90_phi
%94 = OpLoad %int %x_33
OpStore %x_34_phi %94
OpSelectionMerge %95 None
OpBranchConditional %93 %96 %95
%96 = OpLabel
OpBranch %62
%95 = OpLabel
OpStore %x_92 %int_0
OpStore %x_68 %true
%97 = OpLoad %int %x_92
OpStore %x_29 %97
%98 = OpLoad %int %x_92
OpStore %x_34_phi %98
OpBranch %62
%63 = OpLabel
OpStore %x_76_phi %false
OpBranch %61
%62 = OpLabel
%99 = OpLoad %int %x_34_phi
OpStore %x_31 %99
%100 = OpLoad %int %x_31
%101 = OpLoad %_arr_int_uint_2 %localNumbers
OpStore %x_22_1 %101
%104 = OpAccessChain %_ptr_Function_int %x_22_1 %uint_1
OpStore %104 %100
%105 = OpLoad %_arr_int_uint_2 %x_22_1
OpStore %localNumbers %105
%106 = OpAccessChain %_ptr_Function_int %globalNumbers %int_0
OpStore %106 %int_0
%107 = OpCompositeExtract %int %105 1
OpStore %param %107
OpStore %x_17 %int_0
OpStore %x_25_phi %int_0
OpBranch %108
%108 = OpLabel
OpLoopMerge %109 %110 None
OpBranch %111
%111 = OpLabel
%112 = OpLoad %int %x_25_phi
%113 = OpSLessThanEqual %bool %112 %107
OpSelectionMerge %114 None
OpBranchConditional %113 %115 %116
%115 = OpLabel
OpBranch %114
%116 = OpLabel
OpBranch %109
%114 = OpLabel
%117 = OpAccessChain %_ptr_Function_int %globalNumbers %107
%118 = OpLoad %int %117
%120 = OpSLessThanEqual %bool %118 %int_1
OpSelectionMerge %121 None
OpBranchConditional %120 %122 %121
%122 = OpLabel
%123 = OpAccessChain %_ptr_Function_int %globalNumbers %107
OpStore %123 %int_1
OpBranch %121
%121 = OpLabel
OpBranch %110
%110 = OpLabel
%124 = OpIAdd %int %112 %int_1
OpStore %x_17 %124
OpStore %x_25_phi %124
OpBranch %108
%109 = OpLabel
%125 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0
%126 = OpLoad %float %125
%127 = OpConvertFToS %int %126
%128 = OpISub %int %127 %int_1
%129 = OpAccessChain %_ptr_Function_int %globalNumbers %128
%130 = OpLoad %int %129
%132 = OpLoad %int %x_24
%133 = OpCopyObject %int %130
%134 = OpIAdd %int %132 %133
%131 = OpCopyObject %int %134
OpStore %acc %131
OpBranch %47
%47 = OpLabel
%135 = OpIAdd %int %55 %int_1
OpStore %i_1 %135
OpStore %x_24_phi %131
OpStore %x_23_phi %135
OpBranch %45
%46 = OpLabel
%136 = OpLoad %int %x_24
%137 = OpCopyObject %int %int_4
%138 = OpIEqual %bool %136 %137
OpSelectionMerge %139 None
OpBranchConditional %138 %140 %141
%140 = OpLabel
OpStore %x_GLF_color %144
OpBranch %139
%141 = OpLabel
OpStore %x_GLF_color %145
OpBranch %139
%139 = OpLabel
OpReturn
OpFunctionEnd
%tint_symbol_2 = OpFunction %void None %146
%tint_symbol = OpFunctionParameter %main_out
%150 = OpLabel
%151 = OpCompositeExtract %v4float %tint_symbol 0
OpStore %tint_symbol_1 %151
OpReturn
OpFunctionEnd
%main = OpFunction %void None %11
%153 = OpLabel
%154 = OpFunctionCall %void %main_1
%156 = OpLoad %v4float %x_GLF_color
%157 = OpCompositeConstruct %main_out %156
%155 = OpFunctionCall %void %tint_symbol_2 %157
OpReturn
OpFunctionEnd
%yieldsZero_ = OpFunction %int None %158
%160 = OpLabel
%x_116 = OpVariable %_ptr_Function_bool Function %19
%x_20 = OpVariable %_ptr_Function_int Function %23
%i = OpVariable %_ptr_Function_int Function %23
%x_26 = OpVariable %_ptr_Function_int Function %23
%x_134 = OpVariable %_ptr_Function_int Function %23
%x_118_phi = OpVariable %_ptr_Function_bool Function %19
%x_27_phi = OpVariable %_ptr_Function_int Function %23
%x_123 = OpVariable %_ptr_Function_bool Function %19
%x_28 = OpVariable %_ptr_Function_int Function %23
%x_123_phi = OpVariable %_ptr_Function_bool Function %19
%x_28_phi = OpVariable %_ptr_Function_int Function %23
%x_26_phi = OpVariable %_ptr_Function_int Function %23
%x_132_phi = OpVariable %_ptr_Function_bool Function %19
OpStore %x_116 %false
OpStore %x_118_phi %false
OpBranch %168
%168 = OpLabel
OpLoopMerge %169 %170 None
OpBranch %171
%171 = OpLabel
%178 = OpLoad %bool %x_118_phi
OpStore %i %int_0
OpStore %x_123_phi %178
OpStore %x_28_phi %int_0
OpBranch %179
%179 = OpLabel
OpLoopMerge %180 %181 None
OpBranch %182
%182 = OpLabel
%183 = OpLoad %bool %x_123_phi
OpStore %x_123 %183
%184 = OpLoad %int %x_28_phi
OpStore %x_28 %184
%185 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0
%186 = OpLoad %float %185
OpStore %x_26_phi %int_0
%187 = OpLoad %bool %x_123
OpStore %x_132_phi %187
%188 = OpLoad %int %x_28
%189 = OpConvertFToS %int %186
%190 = OpSLessThan %bool %188 %189
OpSelectionMerge %191 None
OpBranchConditional %190 %192 %193
%192 = OpLabel
OpBranch %191
%193 = OpLabel
OpBranch %180
%191 = OpLabel
OpStore %x_116 %true
%194 = OpLoad %int %x_28
OpStore %x_20 %194
%195 = OpLoad %int %x_28
OpStore %x_26_phi %195
OpStore %x_132_phi %true
OpBranch %180
%181 = OpLabel
OpStore %x_123_phi %false
OpStore %x_28_phi %int_0
OpBranch %179
%180 = OpLabel
%196 = OpLoad %int %x_26_phi
OpStore %x_26 %196
%197 = OpLoad %bool %x_132_phi
%198 = OpLoad %int %x_26
OpStore %x_27_phi %198
OpSelectionMerge %199 None
OpBranchConditional %197 %200 %199
%200 = OpLabel
OpBranch %169
%199 = OpLabel
OpStore %x_134 %int_0
OpStore %x_116 %true
%201 = OpLoad %int %x_134
OpStore %x_20 %201
%202 = OpLoad %int %x_134
OpStore %x_27_phi %202
OpBranch %169
%170 = OpLabel
OpStore %x_118_phi %false
OpBranch %168
%169 = OpLabel
%203 = OpLoad %int %x_27_phi
OpReturnValue %203
OpFunctionEnd

View File

@@ -0,0 +1,212 @@
[[block]]
struct buf0 {
one : f32;
};
[[group(0), binding(0)]] var<uniform> x_8 : buf0;
var<private> x_GLF_color : vec4<f32>;
fn main_1() {
var x_68 : bool = false;
var x_29 : i32;
var x_30 : i32;
var x_31 : i32;
var globalNumbers : array<i32, 10>;
var x_17 : i32;
var acc : i32;
var i_1 : i32;
var localNumbers : array<i32, 2>;
var param : i32;
var x_24 : i32;
var x_24_phi : i32;
var x_23_phi : i32;
acc = 0;
i_1 = 0;
x_24_phi = 0;
x_23_phi = 0;
loop {
var x_33 : i32;
var x_92 : i32;
var x_76_phi : bool;
var x_34_phi : i32;
var x_25_phi : i32;
x_24 = x_24_phi;
let x_23 : i32 = x_23_phi;
if ((x_23 < 4)) {
} else {
break;
}
x_68 = false;
x_76_phi = false;
loop {
var x_81 : bool;
var x_32 : i32;
var x_81_phi : bool;
var x_32_phi : i32;
var x_33_phi : i32;
var x_90_phi : bool;
let x_76 : bool = x_76_phi;
x_30 = 0;
x_81_phi = x_76;
x_32_phi = 0;
loop {
x_81 = x_81_phi;
x_32 = x_32_phi;
let x_86 : f32 = x_8.one;
x_33_phi = 0;
x_90_phi = x_81;
if ((x_32 < i32(x_86))) {
} else {
break;
}
x_68 = true;
x_29 = x_32;
x_33_phi = x_32;
x_90_phi = true;
break;
continuing {
x_81_phi = false;
x_32_phi = 0;
}
}
x_33 = x_33_phi;
let x_90 : bool = x_90_phi;
x_34_phi = x_33;
if (x_90) {
break;
}
x_92 = 0;
x_68 = true;
x_29 = x_92;
x_34_phi = x_92;
break;
continuing {
x_76_phi = false;
}
}
let x_34 : i32 = x_34_phi;
x_31 = x_34;
let x_93 : i32 = x_31;
let x_21 : array<i32, 2> = localNumbers;
var x_22_1 : array<i32, 2> = x_21;
x_22_1[1u] = x_93;
let x_22 : array<i32, 2> = x_22_1;
localNumbers = x_22;
globalNumbers[0] = 0;
let x_95 : ptr<function, i32> = &(localNumbers[1]);
let x_13 : i32 = x_22[1u];
param = x_13;
x_17 = 0;
x_25_phi = 0;
loop {
let x_25 : i32 = x_25_phi;
if ((x_25 <= x_13)) {
} else {
break;
}
let x_102 : ptr<function, i32> = &(globalNumbers[x_13]);
let x_18 : i32 = *(x_102);
if ((x_18 <= 1)) {
*(x_102) = 1;
}
continuing {
let x_19 : i32 = (x_25 + 1);
x_17 = x_19;
x_25_phi = x_19;
}
}
let x_107 : f32 = x_8.one;
let x_14 : i32 = globalNumbers[(i32(x_107) - 1)];
let x_15 : i32 = bitcast<i32>((x_24 + bitcast<i32>(x_14)));
acc = x_15;
continuing {
let x_16 : i32 = (x_23 + 1);
i_1 = x_16;
x_24_phi = x_15;
x_23_phi = x_16;
}
}
if ((x_24 == bitcast<i32>(4))) {
x_GLF_color = vec4<f32>(1.0, 0.0, 0.0, 1.0);
} else {
x_GLF_color = vec4<f32>(0.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);
}
fn yieldsZero_() -> i32 {
var x_116 : bool = false;
var x_20 : i32;
var i : i32;
var x_26 : i32;
var x_134 : i32;
var x_118_phi : bool;
var x_27_phi : i32;
x_118_phi = false;
loop {
var x_123 : bool;
var x_28 : i32;
var x_123_phi : bool;
var x_28_phi : i32;
var x_26_phi : i32;
var x_132_phi : bool;
let x_118 : bool = x_118_phi;
i = 0;
x_123_phi = x_118;
x_28_phi = 0;
loop {
x_123 = x_123_phi;
x_28 = x_28_phi;
let x_128 : f32 = x_8.one;
x_26_phi = 0;
x_132_phi = x_123;
if ((x_28 < i32(x_128))) {
} else {
break;
}
x_116 = true;
x_20 = x_28;
x_26_phi = x_28;
x_132_phi = true;
break;
continuing {
x_123_phi = false;
x_28_phi = 0;
}
}
x_26 = x_26_phi;
let x_132 : bool = x_132_phi;
x_27_phi = x_26;
if (x_132) {
break;
}
x_134 = 0;
x_116 = true;
x_20 = x_134;
x_27_phi = x_134;
break;
continuing {
x_118_phi = false;
}
}
let x_27 : i32 = x_27_phi;
return x_27;
}

View File

@@ -0,0 +1,212 @@
[[block]]
struct buf0 {
one : f32;
};
[[group(0), binding(0)]] var<uniform> x_8 : buf0;
var<private> x_GLF_color : vec4<f32>;
fn main_1() {
var x_68 : bool = false;
var x_29 : i32;
var x_30 : i32;
var x_31 : i32;
var globalNumbers : array<i32, 10>;
var x_17 : i32;
var acc : i32;
var i_1 : i32;
var localNumbers : array<i32, 2>;
var param : i32;
var x_24 : i32;
var x_24_phi : i32;
var x_23_phi : i32;
acc = 0;
i_1 = 0;
x_24_phi = 0;
x_23_phi = 0;
loop {
var x_33 : i32;
var x_92 : i32;
var x_76_phi : bool;
var x_34_phi : i32;
var x_25_phi : i32;
x_24 = x_24_phi;
let x_23 : i32 = x_23_phi;
if ((x_23 < 4)) {
} else {
break;
}
x_68 = false;
x_76_phi = false;
loop {
var x_81 : bool;
var x_32 : i32;
var x_81_phi : bool;
var x_32_phi : i32;
var x_33_phi : i32;
var x_90_phi : bool;
let x_76 : bool = x_76_phi;
x_30 = 0;
x_81_phi = x_76;
x_32_phi = 0;
loop {
x_81 = x_81_phi;
x_32 = x_32_phi;
let x_86 : f32 = x_8.one;
x_33_phi = 0;
x_90_phi = x_81;
if ((x_32 < i32(x_86))) {
} else {
break;
}
x_68 = true;
x_29 = x_32;
x_33_phi = x_32;
x_90_phi = true;
break;
continuing {
x_81_phi = false;
x_32_phi = 0;
}
}
x_33 = x_33_phi;
let x_90 : bool = x_90_phi;
x_34_phi = x_33;
if (x_90) {
break;
}
x_92 = 0;
x_68 = true;
x_29 = x_92;
x_34_phi = x_92;
break;
continuing {
x_76_phi = false;
}
}
let x_34 : i32 = x_34_phi;
x_31 = x_34;
let x_93 : i32 = x_31;
let x_21 : array<i32, 2> = localNumbers;
var x_22_1 : array<i32, 2> = x_21;
x_22_1[1u] = x_93;
let x_22 : array<i32, 2> = x_22_1;
localNumbers = x_22;
globalNumbers[0] = 0;
let x_95 : ptr<function, i32> = &(localNumbers[1]);
let x_13 : i32 = x_22[1u];
param = x_13;
x_17 = 0;
x_25_phi = 0;
loop {
let x_25 : i32 = x_25_phi;
if ((x_25 <= x_13)) {
} else {
break;
}
let x_102 : ptr<function, i32> = &(globalNumbers[x_13]);
let x_18 : i32 = *(x_102);
if ((x_18 <= 1)) {
*(x_102) = 1;
}
continuing {
let x_19 : i32 = (x_25 + 1);
x_17 = x_19;
x_25_phi = x_19;
}
}
let x_107 : f32 = x_8.one;
let x_14 : i32 = globalNumbers[(i32(x_107) - 1)];
let x_15 : i32 = bitcast<i32>((x_24 + bitcast<i32>(x_14)));
acc = x_15;
continuing {
let x_16 : i32 = (x_23 + 1);
i_1 = x_16;
x_24_phi = x_15;
x_23_phi = x_16;
}
}
if ((x_24 == bitcast<i32>(4))) {
x_GLF_color = vec4<f32>(1.0, 0.0, 0.0, 1.0);
} else {
x_GLF_color = vec4<f32>(0.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);
}
fn yieldsZero_() -> i32 {
var x_116 : bool = false;
var x_20 : i32;
var i : i32;
var x_26 : i32;
var x_134 : i32;
var x_118_phi : bool;
var x_27_phi : i32;
x_118_phi = false;
loop {
var x_123 : bool;
var x_28 : i32;
var x_123_phi : bool;
var x_28_phi : i32;
var x_26_phi : i32;
var x_132_phi : bool;
let x_118 : bool = x_118_phi;
i = 0;
x_123_phi = x_118;
x_28_phi = 0;
loop {
x_123 = x_123_phi;
x_28 = x_28_phi;
let x_128 : f32 = x_8.one;
x_26_phi = 0;
x_132_phi = x_123;
if ((x_28 < i32(x_128))) {
} else {
break;
}
x_116 = true;
x_20 = x_28;
x_26_phi = x_28;
x_132_phi = true;
break;
continuing {
x_123_phi = false;
x_28_phi = 0;
}
}
x_26 = x_26_phi;
let x_132 : bool = x_132_phi;
x_27_phi = x_26;
if (x_132) {
break;
}
x_134 = 0;
x_116 = true;
x_20 = x_134;
x_27_phi = x_134;
break;
continuing {
x_118_phi = false;
}
}
let x_27 : i32 = x_27_phi;
return x_27;
}

View File

@@ -0,0 +1,201 @@
cbuffer cbuffer_x_8 : register(b0, space0) {
uint4 x_8[1];
};
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
void main_1() {
bool x_68 = false;
int x_29 = 0;
int x_30 = 0;
int x_31 = 0;
int globalNumbers[10] = (int[10])0;
int x_17 = 0;
int acc = 0;
int i_1 = 0;
int localNumbers[2] = (int[2])0;
int param = 0;
int x_24 = 0;
int x_24_phi = 0;
int x_23_phi = 0;
acc = 0;
i_1 = 0;
x_24_phi = 0;
x_23_phi = 0;
while (true) {
int x_33 = 0;
int x_92 = 0;
bool x_76_phi = false;
int x_34_phi = 0;
int x_25_phi = 0;
x_24 = x_24_phi;
const int x_23 = x_23_phi;
if ((x_23 < 4)) {
} else {
break;
}
x_68 = false;
x_76_phi = false;
while (true) {
bool x_81 = false;
int x_32 = 0;
bool x_81_phi = false;
int x_32_phi = 0;
int x_33_phi = 0;
bool x_90_phi = false;
const bool x_76 = x_76_phi;
x_30 = 0;
x_81_phi = x_76;
x_32_phi = 0;
while (true) {
x_81 = x_81_phi;
x_32 = x_32_phi;
const float x_86 = asfloat(x_8[0].x);
x_33_phi = 0;
x_90_phi = x_81;
if ((x_32 < int(x_86))) {
} else {
break;
}
x_68 = true;
x_29 = x_32;
x_33_phi = x_32;
x_90_phi = true;
break;
{
x_81_phi = false;
x_32_phi = 0;
}
}
x_33 = x_33_phi;
const bool x_90 = x_90_phi;
x_34_phi = x_33;
if (x_90) {
break;
}
x_92 = 0;
x_68 = true;
x_29 = x_92;
x_34_phi = x_92;
break;
{
x_76_phi = false;
}
}
x_31 = x_34_phi;
const int x_93 = x_31;
int x_22_1[2] = localNumbers;
x_22_1[1u] = x_93;
const int x_22[2] = x_22_1;
localNumbers = x_22;
globalNumbers[0] = 0;
const int x_13 = x_22[1u];
param = x_13;
x_17 = 0;
x_25_phi = 0;
while (true) {
const int x_25 = x_25_phi;
if ((x_25 <= x_13)) {
} else {
break;
}
const int x_102_save = x_13;
const int x_18 = globalNumbers[x_102_save];
if ((x_18 <= 1)) {
globalNumbers[x_102_save] = 1;
}
{
const int x_19 = (x_25 + 1);
x_17 = x_19;
x_25_phi = x_19;
}
}
const float x_107 = asfloat(x_8[0].x);
const int x_14 = globalNumbers[(int(x_107) - 1)];
const int x_15 = asint((x_24 + asint(x_14)));
acc = x_15;
{
const int x_16 = (x_23 + 1);
i_1 = x_16;
x_24_phi = x_15;
x_23_phi = x_16;
}
}
if ((x_24 == asint(4))) {
x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
} else {
x_GLF_color = float4(0.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;
}
int yieldsZero_() {
bool x_116 = false;
int x_20 = 0;
int i = 0;
int x_26 = 0;
int x_134 = 0;
bool x_118_phi = false;
int x_27_phi = 0;
x_118_phi = false;
while (true) {
bool x_123 = false;
int x_28 = 0;
bool x_123_phi = false;
int x_28_phi = 0;
int x_26_phi = 0;
bool x_132_phi = false;
const bool x_118 = x_118_phi;
i = 0;
x_123_phi = x_118;
x_28_phi = 0;
while (true) {
x_123 = x_123_phi;
x_28 = x_28_phi;
const float x_128 = asfloat(x_8[0].x);
x_26_phi = 0;
x_132_phi = x_123;
if ((x_28 < int(x_128))) {
} else {
break;
}
x_116 = true;
x_20 = x_28;
x_26_phi = x_28;
x_132_phi = true;
break;
{
x_123_phi = false;
x_28_phi = 0;
}
}
x_26 = x_26_phi;
const bool x_132 = x_132_phi;
x_27_phi = x_26;
if (x_132) {
break;
}
x_134 = 0;
x_116 = true;
x_20 = x_134;
x_27_phi = x_134;
break;
{
x_118_phi = false;
}
}
return x_27_phi;
}

View File

@@ -0,0 +1,213 @@
#include <metal_stdlib>
using namespace metal;
struct buf0 {
/* 0x0000 */ float one;
};
struct tint_array_wrapper {
int arr[10];
};
struct tint_array_wrapper_1 {
int arr[2];
};
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_8, thread float4* const tint_symbol_4) {
bool x_68 = false;
int x_29 = 0;
int x_30 = 0;
int x_31 = 0;
tint_array_wrapper globalNumbers = {};
int x_17 = 0;
int acc = 0;
int i_1 = 0;
tint_array_wrapper_1 localNumbers = {};
int param = 0;
int x_24 = 0;
int x_24_phi = 0;
int x_23_phi = 0;
acc = 0;
i_1 = 0;
x_24_phi = 0;
x_23_phi = 0;
while (true) {
int x_33 = 0;
int x_92 = 0;
bool x_76_phi = false;
int x_34_phi = 0;
int x_25_phi = 0;
x_24 = x_24_phi;
int const x_23 = x_23_phi;
if ((x_23 < 4)) {
} else {
break;
}
x_68 = false;
x_76_phi = false;
while (true) {
bool x_81 = false;
int x_32 = 0;
bool x_81_phi = false;
int x_32_phi = 0;
int x_33_phi = 0;
bool x_90_phi = false;
bool const x_76 = x_76_phi;
x_30 = 0;
x_81_phi = x_76;
x_32_phi = 0;
while (true) {
x_81 = x_81_phi;
x_32 = x_32_phi;
float const x_86 = x_8.one;
x_33_phi = 0;
x_90_phi = x_81;
if ((x_32 < int(x_86))) {
} else {
break;
}
x_68 = true;
x_29 = x_32;
x_33_phi = x_32;
x_90_phi = true;
break;
{
x_81_phi = false;
x_32_phi = 0;
}
}
x_33 = x_33_phi;
bool const x_90 = x_90_phi;
x_34_phi = x_33;
if (x_90) {
break;
}
x_92 = 0;
x_68 = true;
x_29 = x_92;
x_34_phi = x_92;
break;
{
x_76_phi = false;
}
}
int const x_34 = x_34_phi;
x_31 = x_34;
int const x_93 = x_31;
tint_array_wrapper_1 const x_21 = localNumbers;
tint_array_wrapper_1 x_22_1 = x_21;
x_22_1.arr[1u] = x_93;
tint_array_wrapper_1 const x_22 = x_22_1;
localNumbers = x_22;
globalNumbers.arr[0] = 0;
int const x_13 = x_22.arr[1u];
param = x_13;
x_17 = 0;
x_25_phi = 0;
while (true) {
int const x_25 = x_25_phi;
if ((x_25 <= x_13)) {
} else {
break;
}
int const x_102_save = x_13;
int const x_18 = globalNumbers.arr[x_102_save];
if ((x_18 <= 1)) {
globalNumbers.arr[x_102_save] = 1;
}
{
int const x_19 = (x_25 + 1);
x_17 = x_19;
x_25_phi = x_19;
}
}
float const x_107 = x_8.one;
int const x_14 = globalNumbers.arr[(int(x_107) - 1)];
int const x_15 = as_type<int>((x_24 + as_type<int>(x_14)));
acc = x_15;
{
int const x_16 = (x_23 + 1);
i_1 = x_16;
x_24_phi = x_15;
x_23_phi = x_16;
}
}
if ((x_24 == as_type<int>(4))) {
*(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f);
} else {
*(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 1.0f);
}
return;
}
fragment tint_symbol_1 tint_symbol(constant buf0& x_8 [[buffer(0)]]) {
thread float4 tint_symbol_5 = 0.0f;
main_1(x_8, &(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;
}
int yieldsZero_(constant buf0& x_8) {
bool x_116 = false;
int x_20 = 0;
int i = 0;
int x_26 = 0;
int x_134 = 0;
bool x_118_phi = false;
int x_27_phi = 0;
x_118_phi = false;
while (true) {
bool x_123 = false;
int x_28 = 0;
bool x_123_phi = false;
int x_28_phi = 0;
int x_26_phi = 0;
bool x_132_phi = false;
bool const x_118 = x_118_phi;
i = 0;
x_123_phi = x_118;
x_28_phi = 0;
while (true) {
x_123 = x_123_phi;
x_28 = x_28_phi;
float const x_128 = x_8.one;
x_26_phi = 0;
x_132_phi = x_123;
if ((x_28 < int(x_128))) {
} else {
break;
}
x_116 = true;
x_20 = x_28;
x_26_phi = x_28;
x_132_phi = true;
break;
{
x_123_phi = false;
x_28_phi = 0;
}
}
x_26 = x_26_phi;
bool const x_132 = x_132_phi;
x_27_phi = x_26;
if (x_132) {
break;
}
x_134 = 0;
x_116 = true;
x_20 = x_134;
x_27_phi = x_134;
break;
{
x_118_phi = false;
}
}
int const x_27 = x_27_phi;
return x_27;
}

View File

@@ -0,0 +1,406 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 204
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %tint_symbol_1
OpExecutionMode %main OriginUpperLeft
OpName %buf0 "buf0"
OpMemberName %buf0 0 "one"
OpName %x_8 "x_8"
OpName %x_GLF_color "x_GLF_color"
OpName %tint_symbol_1 "tint_symbol_1"
OpName %main_1 "main_1"
OpName %x_68 "x_68"
OpName %x_29 "x_29"
OpName %x_30 "x_30"
OpName %x_31 "x_31"
OpName %globalNumbers "globalNumbers"
OpName %x_17 "x_17"
OpName %acc "acc"
OpName %i_1 "i_1"
OpName %localNumbers "localNumbers"
OpName %param "param"
OpName %x_24 "x_24"
OpName %x_24_phi "x_24_phi"
OpName %x_23_phi "x_23_phi"
OpName %x_33 "x_33"
OpName %x_92 "x_92"
OpName %x_76_phi "x_76_phi"
OpName %x_34_phi "x_34_phi"
OpName %x_25_phi "x_25_phi"
OpName %x_81 "x_81"
OpName %x_32 "x_32"
OpName %x_81_phi "x_81_phi"
OpName %x_32_phi "x_32_phi"
OpName %x_33_phi "x_33_phi"
OpName %x_90_phi "x_90_phi"
OpName %x_22_1 "x_22_1"
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"
OpName %yieldsZero_ "yieldsZero_"
OpName %x_116 "x_116"
OpName %x_20 "x_20"
OpName %i "i"
OpName %x_26 "x_26"
OpName %x_134 "x_134"
OpName %x_118_phi "x_118_phi"
OpName %x_27_phi "x_27_phi"
OpName %x_123 "x_123"
OpName %x_28 "x_28"
OpName %x_123_phi "x_123_phi"
OpName %x_28_phi "x_28_phi"
OpName %x_26_phi "x_26_phi"
OpName %x_132_phi "x_132_phi"
OpDecorate %buf0 Block
OpMemberDecorate %buf0 0 Offset 0
OpDecorate %x_8 NonWritable
OpDecorate %x_8 DescriptorSet 0
OpDecorate %x_8 Binding 0
OpDecorate %tint_symbol_1 Location 0
OpDecorate %_arr_int_uint_10 ArrayStride 4
OpDecorate %_arr_int_uint_2 ArrayStride 4
OpMemberDecorate %main_out 0 Offset 0
%float = OpTypeFloat 32
%buf0 = OpTypeStruct %float
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
%x_8 = OpVariable %_ptr_Uniform_buf0 Uniform
%v4float = OpTypeVector %float 4
%_ptr_Private_v4float = OpTypePointer Private %v4float
%8 = OpConstantNull %v4float
%x_GLF_color = OpVariable %_ptr_Private_v4float Private %8
%_ptr_Output_v4float = OpTypePointer Output %v4float
%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8
%void = OpTypeVoid
%11 = OpTypeFunction %void
%bool = OpTypeBool
%false = OpConstantFalse %bool
%_ptr_Function_bool = OpTypePointer Function %bool
%19 = OpConstantNull %bool
%int = OpTypeInt 32 1
%_ptr_Function_int = OpTypePointer Function %int
%23 = 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
%31 = OpConstantNull %_arr_int_uint_10
%uint_2 = OpConstant %uint 2
%_arr_int_uint_2 = OpTypeArray %int %uint_2
%_ptr_Function__arr_int_uint_2 = OpTypePointer Function %_arr_int_uint_2
%39 = OpConstantNull %_arr_int_uint_2
%int_0 = OpConstant %int 0
%int_4 = OpConstant %int 4
%uint_0 = OpConstant %uint 0
%_ptr_Uniform_float = OpTypePointer Uniform %float
%true = OpConstantTrue %bool
%uint_1 = OpConstant %uint 1
%int_1 = OpConstant %int 1
%float_1 = OpConstant %float 1
%float_0 = OpConstant %float 0
%144 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
%145 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1
%main_out = OpTypeStruct %v4float
%146 = OpTypeFunction %void %main_out
%158 = OpTypeFunction %int
%main_1 = OpFunction %void None %11
%14 = OpLabel
%x_68 = OpVariable %_ptr_Function_bool Function %19
%x_29 = OpVariable %_ptr_Function_int Function %23
%x_30 = OpVariable %_ptr_Function_int Function %23
%x_31 = OpVariable %_ptr_Function_int Function %23
%globalNumbers = OpVariable %_ptr_Function__arr_int_uint_10 Function %31
%x_17 = OpVariable %_ptr_Function_int Function %23
%acc = OpVariable %_ptr_Function_int Function %23
%i_1 = OpVariable %_ptr_Function_int Function %23
%localNumbers = OpVariable %_ptr_Function__arr_int_uint_2 Function %39
%param = OpVariable %_ptr_Function_int Function %23
%x_24 = OpVariable %_ptr_Function_int Function %23
%x_24_phi = OpVariable %_ptr_Function_int Function %23
%x_23_phi = OpVariable %_ptr_Function_int Function %23
%x_33 = OpVariable %_ptr_Function_int Function %23
%x_92 = OpVariable %_ptr_Function_int Function %23
%x_76_phi = OpVariable %_ptr_Function_bool Function %19
%x_34_phi = OpVariable %_ptr_Function_int Function %23
%x_25_phi = OpVariable %_ptr_Function_int Function %23
%x_81 = OpVariable %_ptr_Function_bool Function %19
%x_32 = OpVariable %_ptr_Function_int Function %23
%x_81_phi = OpVariable %_ptr_Function_bool Function %19
%x_32_phi = OpVariable %_ptr_Function_int Function %23
%x_33_phi = OpVariable %_ptr_Function_int Function %23
%x_90_phi = OpVariable %_ptr_Function_bool Function %19
%x_22_1 = OpVariable %_ptr_Function__arr_int_uint_2 Function %39
OpStore %x_68 %false
OpStore %acc %int_0
OpStore %i_1 %int_0
OpStore %x_24_phi %int_0
OpStore %x_23_phi %int_0
OpBranch %45
%45 = OpLabel
OpLoopMerge %46 %47 None
OpBranch %48
%48 = OpLabel
%54 = OpLoad %int %x_24_phi
OpStore %x_24 %54
%55 = OpLoad %int %x_23_phi
%57 = OpSLessThan %bool %55 %int_4
OpSelectionMerge %58 None
OpBranchConditional %57 %59 %60
%59 = OpLabel
OpBranch %58
%60 = OpLabel
OpBranch %46
%58 = OpLabel
OpStore %x_68 %false
OpStore %x_76_phi %false
OpBranch %61
%61 = OpLabel
OpLoopMerge %62 %63 None
OpBranch %64
%64 = OpLabel
%71 = OpLoad %bool %x_76_phi
OpStore %x_30 %int_0
OpStore %x_81_phi %71
OpStore %x_32_phi %int_0
OpBranch %72
%72 = OpLabel
OpLoopMerge %73 %74 None
OpBranch %75
%75 = OpLabel
%76 = OpLoad %bool %x_81_phi
OpStore %x_81 %76
%77 = OpLoad %int %x_32_phi
OpStore %x_32 %77
%80 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0
%81 = OpLoad %float %80
OpStore %x_33_phi %int_0
%82 = OpLoad %bool %x_81
OpStore %x_90_phi %82
%83 = OpLoad %int %x_32
%84 = OpConvertFToS %int %81
%85 = OpSLessThan %bool %83 %84
OpSelectionMerge %86 None
OpBranchConditional %85 %87 %88
%87 = OpLabel
OpBranch %86
%88 = OpLabel
OpBranch %73
%86 = OpLabel
OpStore %x_68 %true
%90 = OpLoad %int %x_32
OpStore %x_29 %90
%91 = OpLoad %int %x_32
OpStore %x_33_phi %91
OpStore %x_90_phi %true
OpBranch %73
%74 = OpLabel
OpStore %x_81_phi %false
OpStore %x_32_phi %int_0
OpBranch %72
%73 = OpLabel
%92 = OpLoad %int %x_33_phi
OpStore %x_33 %92
%93 = OpLoad %bool %x_90_phi
%94 = OpLoad %int %x_33
OpStore %x_34_phi %94
OpSelectionMerge %95 None
OpBranchConditional %93 %96 %95
%96 = OpLabel
OpBranch %62
%95 = OpLabel
OpStore %x_92 %int_0
OpStore %x_68 %true
%97 = OpLoad %int %x_92
OpStore %x_29 %97
%98 = OpLoad %int %x_92
OpStore %x_34_phi %98
OpBranch %62
%63 = OpLabel
OpStore %x_76_phi %false
OpBranch %61
%62 = OpLabel
%99 = OpLoad %int %x_34_phi
OpStore %x_31 %99
%100 = OpLoad %int %x_31
%101 = OpLoad %_arr_int_uint_2 %localNumbers
OpStore %x_22_1 %101
%104 = OpAccessChain %_ptr_Function_int %x_22_1 %uint_1
OpStore %104 %100
%105 = OpLoad %_arr_int_uint_2 %x_22_1
OpStore %localNumbers %105
%106 = OpAccessChain %_ptr_Function_int %globalNumbers %int_0
OpStore %106 %int_0
%107 = OpCompositeExtract %int %105 1
OpStore %param %107
OpStore %x_17 %int_0
OpStore %x_25_phi %int_0
OpBranch %108
%108 = OpLabel
OpLoopMerge %109 %110 None
OpBranch %111
%111 = OpLabel
%112 = OpLoad %int %x_25_phi
%113 = OpSLessThanEqual %bool %112 %107
OpSelectionMerge %114 None
OpBranchConditional %113 %115 %116
%115 = OpLabel
OpBranch %114
%116 = OpLabel
OpBranch %109
%114 = OpLabel
%117 = OpAccessChain %_ptr_Function_int %globalNumbers %107
%118 = OpLoad %int %117
%120 = OpSLessThanEqual %bool %118 %int_1
OpSelectionMerge %121 None
OpBranchConditional %120 %122 %121
%122 = OpLabel
%123 = OpAccessChain %_ptr_Function_int %globalNumbers %107
OpStore %123 %int_1
OpBranch %121
%121 = OpLabel
OpBranch %110
%110 = OpLabel
%124 = OpIAdd %int %112 %int_1
OpStore %x_17 %124
OpStore %x_25_phi %124
OpBranch %108
%109 = OpLabel
%125 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0
%126 = OpLoad %float %125
%127 = OpConvertFToS %int %126
%128 = OpISub %int %127 %int_1
%129 = OpAccessChain %_ptr_Function_int %globalNumbers %128
%130 = OpLoad %int %129
%132 = OpLoad %int %x_24
%133 = OpCopyObject %int %130
%134 = OpIAdd %int %132 %133
%131 = OpCopyObject %int %134
OpStore %acc %131
OpBranch %47
%47 = OpLabel
%135 = OpIAdd %int %55 %int_1
OpStore %i_1 %135
OpStore %x_24_phi %131
OpStore %x_23_phi %135
OpBranch %45
%46 = OpLabel
%136 = OpLoad %int %x_24
%137 = OpCopyObject %int %int_4
%138 = OpIEqual %bool %136 %137
OpSelectionMerge %139 None
OpBranchConditional %138 %140 %141
%140 = OpLabel
OpStore %x_GLF_color %144
OpBranch %139
%141 = OpLabel
OpStore %x_GLF_color %145
OpBranch %139
%139 = OpLabel
OpReturn
OpFunctionEnd
%tint_symbol_2 = OpFunction %void None %146
%tint_symbol = OpFunctionParameter %main_out
%150 = OpLabel
%151 = OpCompositeExtract %v4float %tint_symbol 0
OpStore %tint_symbol_1 %151
OpReturn
OpFunctionEnd
%main = OpFunction %void None %11
%153 = OpLabel
%154 = OpFunctionCall %void %main_1
%156 = OpLoad %v4float %x_GLF_color
%157 = OpCompositeConstruct %main_out %156
%155 = OpFunctionCall %void %tint_symbol_2 %157
OpReturn
OpFunctionEnd
%yieldsZero_ = OpFunction %int None %158
%160 = OpLabel
%x_116 = OpVariable %_ptr_Function_bool Function %19
%x_20 = OpVariable %_ptr_Function_int Function %23
%i = OpVariable %_ptr_Function_int Function %23
%x_26 = OpVariable %_ptr_Function_int Function %23
%x_134 = OpVariable %_ptr_Function_int Function %23
%x_118_phi = OpVariable %_ptr_Function_bool Function %19
%x_27_phi = OpVariable %_ptr_Function_int Function %23
%x_123 = OpVariable %_ptr_Function_bool Function %19
%x_28 = OpVariable %_ptr_Function_int Function %23
%x_123_phi = OpVariable %_ptr_Function_bool Function %19
%x_28_phi = OpVariable %_ptr_Function_int Function %23
%x_26_phi = OpVariable %_ptr_Function_int Function %23
%x_132_phi = OpVariable %_ptr_Function_bool Function %19
OpStore %x_116 %false
OpStore %x_118_phi %false
OpBranch %168
%168 = OpLabel
OpLoopMerge %169 %170 None
OpBranch %171
%171 = OpLabel
%178 = OpLoad %bool %x_118_phi
OpStore %i %int_0
OpStore %x_123_phi %178
OpStore %x_28_phi %int_0
OpBranch %179
%179 = OpLabel
OpLoopMerge %180 %181 None
OpBranch %182
%182 = OpLabel
%183 = OpLoad %bool %x_123_phi
OpStore %x_123 %183
%184 = OpLoad %int %x_28_phi
OpStore %x_28 %184
%185 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0
%186 = OpLoad %float %185
OpStore %x_26_phi %int_0
%187 = OpLoad %bool %x_123
OpStore %x_132_phi %187
%188 = OpLoad %int %x_28
%189 = OpConvertFToS %int %186
%190 = OpSLessThan %bool %188 %189
OpSelectionMerge %191 None
OpBranchConditional %190 %192 %193
%192 = OpLabel
OpBranch %191
%193 = OpLabel
OpBranch %180
%191 = OpLabel
OpStore %x_116 %true
%194 = OpLoad %int %x_28
OpStore %x_20 %194
%195 = OpLoad %int %x_28
OpStore %x_26_phi %195
OpStore %x_132_phi %true
OpBranch %180
%181 = OpLabel
OpStore %x_123_phi %false
OpStore %x_28_phi %int_0
OpBranch %179
%180 = OpLabel
%196 = OpLoad %int %x_26_phi
OpStore %x_26 %196
%197 = OpLoad %bool %x_132_phi
%198 = OpLoad %int %x_26
OpStore %x_27_phi %198
OpSelectionMerge %199 None
OpBranchConditional %197 %200 %199
%200 = OpLabel
OpBranch %169
%199 = OpLabel
OpStore %x_134 %int_0
OpStore %x_116 %true
%201 = OpLoad %int %x_134
OpStore %x_20 %201
%202 = OpLoad %int %x_134
OpStore %x_27_phi %202
OpBranch %169
%170 = OpLabel
OpStore %x_118_phi %false
OpBranch %168
%169 = OpLabel
%203 = OpLoad %int %x_27_phi
OpReturnValue %203
OpFunctionEnd

View File

@@ -0,0 +1,212 @@
[[block]]
struct buf0 {
one : f32;
};
[[group(0), binding(0)]] var<uniform> x_8 : buf0;
var<private> x_GLF_color : vec4<f32>;
fn main_1() {
var x_68 : bool = false;
var x_29 : i32;
var x_30 : i32;
var x_31 : i32;
var globalNumbers : array<i32, 10>;
var x_17 : i32;
var acc : i32;
var i_1 : i32;
var localNumbers : array<i32, 2>;
var param : i32;
var x_24 : i32;
var x_24_phi : i32;
var x_23_phi : i32;
acc = 0;
i_1 = 0;
x_24_phi = 0;
x_23_phi = 0;
loop {
var x_33 : i32;
var x_92 : i32;
var x_76_phi : bool;
var x_34_phi : i32;
var x_25_phi : i32;
x_24 = x_24_phi;
let x_23 : i32 = x_23_phi;
if ((x_23 < 4)) {
} else {
break;
}
x_68 = false;
x_76_phi = false;
loop {
var x_81 : bool;
var x_32 : i32;
var x_81_phi : bool;
var x_32_phi : i32;
var x_33_phi : i32;
var x_90_phi : bool;
let x_76 : bool = x_76_phi;
x_30 = 0;
x_81_phi = x_76;
x_32_phi = 0;
loop {
x_81 = x_81_phi;
x_32 = x_32_phi;
let x_86 : f32 = x_8.one;
x_33_phi = 0;
x_90_phi = x_81;
if ((x_32 < i32(x_86))) {
} else {
break;
}
x_68 = true;
x_29 = x_32;
x_33_phi = x_32;
x_90_phi = true;
break;
continuing {
x_81_phi = false;
x_32_phi = 0;
}
}
x_33 = x_33_phi;
let x_90 : bool = x_90_phi;
x_34_phi = x_33;
if (x_90) {
break;
}
x_92 = 0;
x_68 = true;
x_29 = x_92;
x_34_phi = x_92;
break;
continuing {
x_76_phi = false;
}
}
let x_34 : i32 = x_34_phi;
x_31 = x_34;
let x_93 : i32 = x_31;
let x_21 : array<i32, 2> = localNumbers;
var x_22_1 : array<i32, 2> = x_21;
x_22_1[1u] = x_93;
let x_22 : array<i32, 2> = x_22_1;
localNumbers = x_22;
globalNumbers[0] = 0;
let x_95 : ptr<function, i32> = &(localNumbers[1]);
let x_13 : i32 = x_22[1u];
param = x_13;
x_17 = 0;
x_25_phi = 0;
loop {
let x_25 : i32 = x_25_phi;
if ((x_25 <= x_13)) {
} else {
break;
}
let x_102 : ptr<function, i32> = &(globalNumbers[x_13]);
let x_18 : i32 = *(x_102);
if ((x_18 <= 1)) {
*(x_102) = 1;
}
continuing {
let x_19 : i32 = (x_25 + 1);
x_17 = x_19;
x_25_phi = x_19;
}
}
let x_107 : f32 = x_8.one;
let x_14 : i32 = globalNumbers[(i32(x_107) - 1)];
let x_15 : i32 = bitcast<i32>((x_24 + bitcast<i32>(x_14)));
acc = x_15;
continuing {
let x_16 : i32 = (x_23 + 1);
i_1 = x_16;
x_24_phi = x_15;
x_23_phi = x_16;
}
}
if ((x_24 == bitcast<i32>(4))) {
x_GLF_color = vec4<f32>(1.0, 0.0, 0.0, 1.0);
} else {
x_GLF_color = vec4<f32>(0.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);
}
fn yieldsZero_() -> i32 {
var x_116 : bool = false;
var x_20 : i32;
var i : i32;
var x_26 : i32;
var x_134 : i32;
var x_118_phi : bool;
var x_27_phi : i32;
x_118_phi = false;
loop {
var x_123 : bool;
var x_28 : i32;
var x_123_phi : bool;
var x_28_phi : i32;
var x_26_phi : i32;
var x_132_phi : bool;
let x_118 : bool = x_118_phi;
i = 0;
x_123_phi = x_118;
x_28_phi = 0;
loop {
x_123 = x_123_phi;
x_28 = x_28_phi;
let x_128 : f32 = x_8.one;
x_26_phi = 0;
x_132_phi = x_123;
if ((x_28 < i32(x_128))) {
} else {
break;
}
x_116 = true;
x_20 = x_28;
x_26_phi = x_28;
x_132_phi = true;
break;
continuing {
x_123_phi = false;
x_28_phi = 0;
}
}
x_26 = x_26_phi;
let x_132 : bool = x_132_phi;
x_27_phi = x_26;
if (x_132) {
break;
}
x_134 = 0;
x_116 = true;
x_20 = x_134;
x_27_phi = x_134;
break;
continuing {
x_118_phi = false;
}
}
let x_27 : i32 = x_27_phi;
return x_27;
}