transform/shader_io: Generate a wrapper function

This is a major reworking of this transform. The old transform code
was getting unwieldy, with part of the complication coming from the
handling of multiple return statements. By generating a wrapper
function instead, we can avoid a lot of this complexity.

The original entry point function is stripped of all shader IO
attributes (as well as `stage` and `workgroup_size`), but the body is
left unmodified. A new entry point wrapper function is introduced
which calls the original function, packing/unpacking the shader inputs
as necessary, and propagates the result to the corresponding shader
outputs.

The new code has been refactored to use a state object with the
different parts of the transform split into separate functions, which
makes it much more manageable.

Fixed: tint:1076
Bug: tint:920
Change-Id: I3490a0ea7a3509a4e198ce730e476516649d8d96
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/60521
Auto-Submit: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
James Price
2021-08-04 22:15:28 +00:00
committed by Tint LUCI CQ
parent 3e92e9f8ba
commit a5d73ce965
3866 changed files with 49323 additions and 26508 deletions

View File

@@ -24,7 +24,7 @@ void makeTreeNode_struct_BST_i1_i1_i11_i1_(thread BST* const tree, thread int* c
return;
}
void insert_i1_i1_(thread int* const treeIndex, thread int* const data_1, thread tint_array_wrapper* const tint_symbol_4) {
void insert_i1_i1_(thread int* const treeIndex, thread int* const data_1, thread tint_array_wrapper* const tint_symbol_3) {
int baseIndex = 0;
BST param = {};
int param_1 = 0;
@@ -40,49 +40,49 @@ void insert_i1_i1_(thread int* const treeIndex, thread int* const data_1, thread
}
int const x_171 = *(data_1);
int const x_172 = baseIndex;
int const x_174 = (*(tint_symbol_4)).arr[x_172].data;
int const x_174 = (*(tint_symbol_3)).arr[x_172].data;
if ((x_171 <= x_174)) {
int const x_179 = baseIndex;
int const x_181 = (*(tint_symbol_4)).arr[x_179].leftIndex;
int const x_181 = (*(tint_symbol_3)).arr[x_179].leftIndex;
if ((x_181 == -1)) {
int const x_186 = baseIndex;
int const x_187 = *(treeIndex);
(*(tint_symbol_4)).arr[x_186].leftIndex = x_187;
(*(tint_symbol_3)).arr[x_186].leftIndex = x_187;
int const x_189 = *(treeIndex);
BST const x_191 = (*(tint_symbol_4)).arr[x_189];
BST const x_191 = (*(tint_symbol_3)).arr[x_189];
param = x_191;
int const x_192 = *(data_1);
param_1 = x_192;
makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param), &(param_1));
BST const x_194 = param;
(*(tint_symbol_4)).arr[x_189] = x_194;
(*(tint_symbol_3)).arr[x_189] = x_194;
return;
} else {
int const x_196 = baseIndex;
int const x_198 = (*(tint_symbol_4)).arr[x_196].leftIndex;
int const x_198 = (*(tint_symbol_3)).arr[x_196].leftIndex;
baseIndex = x_198;
continue;
}
return;
} else {
int const x_199 = baseIndex;
int const x_201 = (*(tint_symbol_4)).arr[x_199].rightIndex;
int const x_201 = (*(tint_symbol_3)).arr[x_199].rightIndex;
if ((x_201 == -1)) {
int const x_206 = baseIndex;
int const x_207 = *(treeIndex);
(*(tint_symbol_4)).arr[x_206].rightIndex = x_207;
(*(tint_symbol_3)).arr[x_206].rightIndex = x_207;
int const x_209 = *(treeIndex);
BST const x_211 = (*(tint_symbol_4)).arr[x_209];
BST const x_211 = (*(tint_symbol_3)).arr[x_209];
param_2 = x_211;
int const x_212 = *(data_1);
param_3 = x_212;
makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_2), &(param_3));
BST const x_214 = param_2;
(*(tint_symbol_4)).arr[x_209] = x_214;
(*(tint_symbol_3)).arr[x_209] = x_214;
return;
} else {
int const x_216 = baseIndex;
int const x_218 = (*(tint_symbol_4)).arr[x_216].rightIndex;
int const x_218 = (*(tint_symbol_3)).arr[x_216].rightIndex;
baseIndex = x_218;
continue;
}
@@ -93,7 +93,7 @@ void insert_i1_i1_(thread int* const treeIndex, thread int* const data_1, thread
return;
}
int search_i1_(thread int* const target, thread tint_array_wrapper* const tint_symbol_5) {
int search_i1_(thread int* const target, thread tint_array_wrapper* const tint_symbol_4) {
int index = 0;
BST currentNode = {};
int x_220 = 0;
@@ -105,7 +105,7 @@ int search_i1_(thread int* const target, thread tint_array_wrapper* const tint_s
break;
}
int const x_228 = index;
BST const x_230 = (*(tint_symbol_5)).arr[x_228];
BST const x_230 = (*(tint_symbol_4)).arr[x_228];
currentNode = x_230;
int const x_232 = currentNode.data;
int const x_233 = *(target);
@@ -128,7 +128,7 @@ int search_i1_(thread int* const target, thread tint_array_wrapper* const tint_s
return -1;
}
void main_1(thread tint_array_wrapper* const tint_symbol_6, thread float4* const tint_symbol_7) {
void main_1(thread tint_array_wrapper* const tint_symbol_5, thread float4* const tint_symbol_6) {
int treeIndex_1 = 0;
BST param_4 = {};
int param_5 = 0;
@@ -155,66 +155,66 @@ void main_1(thread tint_array_wrapper* const tint_symbol_6, thread float4* const
int result = 0;
int param_24 = 0;
treeIndex_1 = 0;
BST const x_84 = (*(tint_symbol_6)).arr[0];
BST const x_84 = (*(tint_symbol_5)).arr[0];
param_4 = x_84;
param_5 = 9;
makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_4), &(param_5));
BST const x_86 = param_4;
(*(tint_symbol_6)).arr[0] = x_86;
(*(tint_symbol_5)).arr[0] = x_86;
int const x_88 = treeIndex_1;
treeIndex_1 = as_type<int>((as_type<uint>(x_88) + as_type<uint>(1)));
int const x_90 = treeIndex_1;
param_6 = x_90;
param_7 = 5;
insert_i1_i1_(&(param_6), &(param_7), tint_symbol_6);
insert_i1_i1_(&(param_6), &(param_7), tint_symbol_5);
int const x_92 = treeIndex_1;
treeIndex_1 = as_type<int>((as_type<uint>(x_92) + as_type<uint>(1)));
int const x_94 = treeIndex_1;
param_8 = x_94;
param_9 = 12;
insert_i1_i1_(&(param_8), &(param_9), tint_symbol_6);
insert_i1_i1_(&(param_8), &(param_9), tint_symbol_5);
int const x_96 = treeIndex_1;
treeIndex_1 = as_type<int>((as_type<uint>(x_96) + as_type<uint>(1)));
int const x_98 = treeIndex_1;
param_10 = x_98;
param_11 = 15;
insert_i1_i1_(&(param_10), &(param_11), tint_symbol_6);
insert_i1_i1_(&(param_10), &(param_11), tint_symbol_5);
int const x_100 = treeIndex_1;
treeIndex_1 = as_type<int>((as_type<uint>(x_100) + as_type<uint>(1)));
int const x_102 = treeIndex_1;
param_12 = x_102;
param_13 = 7;
insert_i1_i1_(&(param_12), &(param_13), tint_symbol_6);
insert_i1_i1_(&(param_12), &(param_13), tint_symbol_5);
int const x_104 = treeIndex_1;
treeIndex_1 = as_type<int>((as_type<uint>(x_104) + as_type<uint>(1)));
int const x_106 = treeIndex_1;
param_14 = x_106;
param_15 = 8;
insert_i1_i1_(&(param_14), &(param_15), tint_symbol_6);
insert_i1_i1_(&(param_14), &(param_15), tint_symbol_5);
int const x_108 = treeIndex_1;
treeIndex_1 = as_type<int>((as_type<uint>(x_108) + as_type<uint>(1)));
int const x_110 = treeIndex_1;
param_16 = x_110;
param_17 = 2;
insert_i1_i1_(&(param_16), &(param_17), tint_symbol_6);
insert_i1_i1_(&(param_16), &(param_17), tint_symbol_5);
int const x_112 = treeIndex_1;
treeIndex_1 = as_type<int>((as_type<uint>(x_112) + as_type<uint>(1)));
int const x_114 = treeIndex_1;
param_18 = x_114;
param_19 = 6;
insert_i1_i1_(&(param_18), &(param_19), tint_symbol_6);
insert_i1_i1_(&(param_18), &(param_19), tint_symbol_5);
int const x_116 = treeIndex_1;
treeIndex_1 = as_type<int>((as_type<uint>(x_116) + as_type<uint>(1)));
int const x_118 = treeIndex_1;
param_20 = x_118;
param_21 = 17;
insert_i1_i1_(&(param_20), &(param_21), tint_symbol_6);
insert_i1_i1_(&(param_20), &(param_21), tint_symbol_5);
int const x_120 = treeIndex_1;
treeIndex_1 = as_type<int>((as_type<uint>(x_120) + as_type<uint>(1)));
int const x_122 = treeIndex_1;
param_22 = x_122;
param_23 = 13;
insert_i1_i1_(&(param_22), &(param_23), tint_symbol_6);
insert_i1_i1_(&(param_22), &(param_23), tint_symbol_5);
count = 0;
i = 0;
while (true) {
@@ -225,7 +225,7 @@ void main_1(thread tint_array_wrapper* const tint_symbol_6, thread float4* const
}
int const x_131 = i;
param_24 = x_131;
int const x_132 = search_i1_(&(param_24), tint_symbol_6);
int const x_132 = search_i1_(&(param_24), tint_symbol_5);
result = x_132;
int const x_133 = i;
switch(x_133) {
@@ -263,19 +263,25 @@ void main_1(thread tint_array_wrapper* const tint_symbol_6, thread float4* const
}
int const x_152 = count;
if ((x_152 == 20)) {
*(tint_symbol_7) = float4(1.0f, 0.0f, 0.0f, 1.0f);
*(tint_symbol_6) = float4(1.0f, 0.0f, 0.0f, 1.0f);
} else {
*(tint_symbol_7) = float4(0.0f, 0.0f, 1.0f, 1.0f);
*(tint_symbol_6) = float4(0.0f, 0.0f, 1.0f, 1.0f);
}
return;
}
fragment tint_symbol_1 tint_symbol() {
thread tint_array_wrapper tint_symbol_8 = {};
thread float4 tint_symbol_9 = 0.0f;
main_1(&(tint_symbol_8), &(tint_symbol_9));
main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_9};
tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1};
return tint_symbol_3;
main_out tint_symbol_inner(thread tint_array_wrapper* const tint_symbol_7, thread float4* const tint_symbol_8) {
main_1(tint_symbol_7, tint_symbol_8);
main_out const tint_symbol_2 = {.x_GLF_color_1=*(tint_symbol_8)};
return tint_symbol_2;
}
fragment tint_symbol_1 tint_symbol() {
thread tint_array_wrapper tint_symbol_9 = {};
thread float4 tint_symbol_10 = 0.0f;
main_out const inner_result = tint_symbol_inner(&(tint_symbol_9), &(tint_symbol_10));
tint_symbol_1 wrapper_result = {};
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result;
}

View File

@@ -24,7 +24,7 @@ void makeTreeNode_struct_BST_i1_i1_i11_i1_(thread BST* const tree, thread int* c
return;
}
void insert_i1_i1_(thread int* const treeIndex, thread int* const data_1, thread tint_array_wrapper* const tint_symbol_4) {
void insert_i1_i1_(thread int* const treeIndex, thread int* const data_1, thread tint_array_wrapper* const tint_symbol_3) {
int baseIndex = 0;
BST param = {};
int param_1 = 0;
@@ -40,49 +40,49 @@ void insert_i1_i1_(thread int* const treeIndex, thread int* const data_1, thread
}
int const x_171 = *(data_1);
int const x_172 = baseIndex;
int const x_174 = (*(tint_symbol_4)).arr[x_172].data;
int const x_174 = (*(tint_symbol_3)).arr[x_172].data;
if ((x_171 <= x_174)) {
int const x_179 = baseIndex;
int const x_181 = (*(tint_symbol_4)).arr[x_179].leftIndex;
int const x_181 = (*(tint_symbol_3)).arr[x_179].leftIndex;
if ((x_181 == -1)) {
int const x_186 = baseIndex;
int const x_187 = *(treeIndex);
(*(tint_symbol_4)).arr[x_186].leftIndex = x_187;
(*(tint_symbol_3)).arr[x_186].leftIndex = x_187;
int const x_189 = *(treeIndex);
BST const x_191 = (*(tint_symbol_4)).arr[x_189];
BST const x_191 = (*(tint_symbol_3)).arr[x_189];
param = x_191;
int const x_192 = *(data_1);
param_1 = x_192;
makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param), &(param_1));
BST const x_194 = param;
(*(tint_symbol_4)).arr[x_189] = x_194;
(*(tint_symbol_3)).arr[x_189] = x_194;
return;
} else {
int const x_196 = baseIndex;
int const x_198 = (*(tint_symbol_4)).arr[x_196].leftIndex;
int const x_198 = (*(tint_symbol_3)).arr[x_196].leftIndex;
baseIndex = x_198;
continue;
}
return;
} else {
int const x_199 = baseIndex;
int const x_201 = (*(tint_symbol_4)).arr[x_199].rightIndex;
int const x_201 = (*(tint_symbol_3)).arr[x_199].rightIndex;
if ((x_201 == -1)) {
int const x_206 = baseIndex;
int const x_207 = *(treeIndex);
(*(tint_symbol_4)).arr[x_206].rightIndex = x_207;
(*(tint_symbol_3)).arr[x_206].rightIndex = x_207;
int const x_209 = *(treeIndex);
BST const x_211 = (*(tint_symbol_4)).arr[x_209];
BST const x_211 = (*(tint_symbol_3)).arr[x_209];
param_2 = x_211;
int const x_212 = *(data_1);
param_3 = x_212;
makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_2), &(param_3));
BST const x_214 = param_2;
(*(tint_symbol_4)).arr[x_209] = x_214;
(*(tint_symbol_3)).arr[x_209] = x_214;
return;
} else {
int const x_216 = baseIndex;
int const x_218 = (*(tint_symbol_4)).arr[x_216].rightIndex;
int const x_218 = (*(tint_symbol_3)).arr[x_216].rightIndex;
baseIndex = x_218;
continue;
}
@@ -93,7 +93,7 @@ void insert_i1_i1_(thread int* const treeIndex, thread int* const data_1, thread
return;
}
int search_i1_(thread int* const target, thread tint_array_wrapper* const tint_symbol_5) {
int search_i1_(thread int* const target, thread tint_array_wrapper* const tint_symbol_4) {
int index = 0;
BST currentNode = {};
int x_220 = 0;
@@ -105,7 +105,7 @@ int search_i1_(thread int* const target, thread tint_array_wrapper* const tint_s
break;
}
int const x_228 = index;
BST const x_230 = (*(tint_symbol_5)).arr[x_228];
BST const x_230 = (*(tint_symbol_4)).arr[x_228];
currentNode = x_230;
int const x_232 = currentNode.data;
int const x_233 = *(target);
@@ -128,7 +128,7 @@ int search_i1_(thread int* const target, thread tint_array_wrapper* const tint_s
return -1;
}
void main_1(thread tint_array_wrapper* const tint_symbol_6, thread float4* const tint_symbol_7) {
void main_1(thread tint_array_wrapper* const tint_symbol_5, thread float4* const tint_symbol_6) {
int treeIndex_1 = 0;
BST param_4 = {};
int param_5 = 0;
@@ -155,66 +155,66 @@ void main_1(thread tint_array_wrapper* const tint_symbol_6, thread float4* const
int result = 0;
int param_24 = 0;
treeIndex_1 = 0;
BST const x_84 = (*(tint_symbol_6)).arr[0];
BST const x_84 = (*(tint_symbol_5)).arr[0];
param_4 = x_84;
param_5 = 9;
makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_4), &(param_5));
BST const x_86 = param_4;
(*(tint_symbol_6)).arr[0] = x_86;
(*(tint_symbol_5)).arr[0] = x_86;
int const x_88 = treeIndex_1;
treeIndex_1 = as_type<int>((as_type<uint>(x_88) + as_type<uint>(1)));
int const x_90 = treeIndex_1;
param_6 = x_90;
param_7 = 5;
insert_i1_i1_(&(param_6), &(param_7), tint_symbol_6);
insert_i1_i1_(&(param_6), &(param_7), tint_symbol_5);
int const x_92 = treeIndex_1;
treeIndex_1 = as_type<int>((as_type<uint>(x_92) + as_type<uint>(1)));
int const x_94 = treeIndex_1;
param_8 = x_94;
param_9 = 12;
insert_i1_i1_(&(param_8), &(param_9), tint_symbol_6);
insert_i1_i1_(&(param_8), &(param_9), tint_symbol_5);
int const x_96 = treeIndex_1;
treeIndex_1 = as_type<int>((as_type<uint>(x_96) + as_type<uint>(1)));
int const x_98 = treeIndex_1;
param_10 = x_98;
param_11 = 15;
insert_i1_i1_(&(param_10), &(param_11), tint_symbol_6);
insert_i1_i1_(&(param_10), &(param_11), tint_symbol_5);
int const x_100 = treeIndex_1;
treeIndex_1 = as_type<int>((as_type<uint>(x_100) + as_type<uint>(1)));
int const x_102 = treeIndex_1;
param_12 = x_102;
param_13 = 7;
insert_i1_i1_(&(param_12), &(param_13), tint_symbol_6);
insert_i1_i1_(&(param_12), &(param_13), tint_symbol_5);
int const x_104 = treeIndex_1;
treeIndex_1 = as_type<int>((as_type<uint>(x_104) + as_type<uint>(1)));
int const x_106 = treeIndex_1;
param_14 = x_106;
param_15 = 8;
insert_i1_i1_(&(param_14), &(param_15), tint_symbol_6);
insert_i1_i1_(&(param_14), &(param_15), tint_symbol_5);
int const x_108 = treeIndex_1;
treeIndex_1 = as_type<int>((as_type<uint>(x_108) + as_type<uint>(1)));
int const x_110 = treeIndex_1;
param_16 = x_110;
param_17 = 2;
insert_i1_i1_(&(param_16), &(param_17), tint_symbol_6);
insert_i1_i1_(&(param_16), &(param_17), tint_symbol_5);
int const x_112 = treeIndex_1;
treeIndex_1 = as_type<int>((as_type<uint>(x_112) + as_type<uint>(1)));
int const x_114 = treeIndex_1;
param_18 = x_114;
param_19 = 6;
insert_i1_i1_(&(param_18), &(param_19), tint_symbol_6);
insert_i1_i1_(&(param_18), &(param_19), tint_symbol_5);
int const x_116 = treeIndex_1;
treeIndex_1 = as_type<int>((as_type<uint>(x_116) + as_type<uint>(1)));
int const x_118 = treeIndex_1;
param_20 = x_118;
param_21 = 17;
insert_i1_i1_(&(param_20), &(param_21), tint_symbol_6);
insert_i1_i1_(&(param_20), &(param_21), tint_symbol_5);
int const x_120 = treeIndex_1;
treeIndex_1 = as_type<int>((as_type<uint>(x_120) + as_type<uint>(1)));
int const x_122 = treeIndex_1;
param_22 = x_122;
param_23 = 13;
insert_i1_i1_(&(param_22), &(param_23), tint_symbol_6);
insert_i1_i1_(&(param_22), &(param_23), tint_symbol_5);
count = 0;
i = 0;
while (true) {
@@ -225,7 +225,7 @@ void main_1(thread tint_array_wrapper* const tint_symbol_6, thread float4* const
}
int const x_131 = i;
param_24 = x_131;
int const x_132 = search_i1_(&(param_24), tint_symbol_6);
int const x_132 = search_i1_(&(param_24), tint_symbol_5);
result = x_132;
int const x_133 = i;
switch(x_133) {
@@ -263,19 +263,25 @@ void main_1(thread tint_array_wrapper* const tint_symbol_6, thread float4* const
}
int const x_152 = count;
if ((x_152 == 20)) {
*(tint_symbol_7) = float4(1.0f, 0.0f, 0.0f, 1.0f);
*(tint_symbol_6) = float4(1.0f, 0.0f, 0.0f, 1.0f);
} else {
*(tint_symbol_7) = float4(0.0f, 0.0f, 1.0f, 1.0f);
*(tint_symbol_6) = float4(0.0f, 0.0f, 1.0f, 1.0f);
}
return;
}
fragment tint_symbol_1 tint_symbol() {
thread tint_array_wrapper tint_symbol_8 = {};
thread float4 tint_symbol_9 = 0.0f;
main_1(&(tint_symbol_8), &(tint_symbol_9));
main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_9};
tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1};
return tint_symbol_3;
main_out tint_symbol_inner(thread tint_array_wrapper* const tint_symbol_7, thread float4* const tint_symbol_8) {
main_1(tint_symbol_7, tint_symbol_8);
main_out const tint_symbol_2 = {.x_GLF_color_1=*(tint_symbol_8)};
return tint_symbol_2;
}
fragment tint_symbol_1 tint_symbol() {
thread tint_array_wrapper tint_symbol_9 = {};
thread float4 tint_symbol_10 = 0.0f;
main_out const inner_result = tint_symbol_inner(&(tint_symbol_9), &(tint_symbol_10));
tint_symbol_1 wrapper_result = {};
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result;
}

View File

@@ -12,7 +12,7 @@ struct tint_array_wrapper {
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol_2 {
struct tint_symbol_1 {
float4 x_GLF_color_1 [[color(0)]];
};
@@ -24,7 +24,7 @@ void makeTreeNode_struct_BST_i1_i1_i11_i1_(thread BST* const tree, thread int* c
return;
}
void insert_i1_i1_(thread int* const treeIndex, thread int* const data_1, thread tint_array_wrapper* const tint_symbol_5) {
void insert_i1_i1_(thread int* const treeIndex, thread int* const data_1, thread tint_array_wrapper* const tint_symbol_3) {
int baseIndex = 0;
BST param = {};
int param_1 = 0;
@@ -40,49 +40,49 @@ void insert_i1_i1_(thread int* const treeIndex, thread int* const data_1, thread
}
int const x_182 = *(data_1);
int const x_183 = baseIndex;
int const x_185 = (*(tint_symbol_5)).arr[x_183].data;
int const x_185 = (*(tint_symbol_3)).arr[x_183].data;
if ((x_182 <= x_185)) {
int const x_190 = baseIndex;
int const x_192 = (*(tint_symbol_5)).arr[x_190].leftIndex;
int const x_192 = (*(tint_symbol_3)).arr[x_190].leftIndex;
if ((x_192 == -1)) {
int const x_197 = baseIndex;
int const x_198 = *(treeIndex);
(*(tint_symbol_5)).arr[x_197].leftIndex = x_198;
(*(tint_symbol_3)).arr[x_197].leftIndex = x_198;
int const x_200 = *(treeIndex);
BST const x_202 = (*(tint_symbol_5)).arr[x_200];
BST const x_202 = (*(tint_symbol_3)).arr[x_200];
param = x_202;
int const x_203 = *(data_1);
param_1 = x_203;
makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param), &(param_1));
BST const x_205 = param;
(*(tint_symbol_5)).arr[x_200] = x_205;
(*(tint_symbol_3)).arr[x_200] = x_205;
return;
} else {
int const x_207 = baseIndex;
int const x_209 = (*(tint_symbol_5)).arr[x_207].leftIndex;
int const x_209 = (*(tint_symbol_3)).arr[x_207].leftIndex;
baseIndex = x_209;
continue;
}
return;
} else {
int const x_210 = baseIndex;
int const x_212 = (*(tint_symbol_5)).arr[x_210].rightIndex;
int const x_212 = (*(tint_symbol_3)).arr[x_210].rightIndex;
if ((x_212 == -1)) {
int const x_217 = baseIndex;
int const x_218 = *(treeIndex);
(*(tint_symbol_5)).arr[x_217].rightIndex = x_218;
(*(tint_symbol_3)).arr[x_217].rightIndex = x_218;
int const x_220 = *(treeIndex);
BST const x_222 = (*(tint_symbol_5)).arr[x_220];
BST const x_222 = (*(tint_symbol_3)).arr[x_220];
param_2 = x_222;
int const x_223 = *(data_1);
param_3 = x_223;
makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_2), &(param_3));
BST const x_225 = param_2;
(*(tint_symbol_5)).arr[x_220] = x_225;
(*(tint_symbol_3)).arr[x_220] = x_225;
return;
} else {
int const x_227 = baseIndex;
int const x_229 = (*(tint_symbol_5)).arr[x_227].rightIndex;
int const x_229 = (*(tint_symbol_3)).arr[x_227].rightIndex;
baseIndex = x_229;
continue;
}
@@ -93,7 +93,7 @@ void insert_i1_i1_(thread int* const treeIndex, thread int* const data_1, thread
return;
}
int search_i1_(thread int* const target, thread tint_array_wrapper* const tint_symbol_6) {
int search_i1_(thread int* const target, thread tint_array_wrapper* const tint_symbol_4) {
int index = 0;
BST currentNode = {};
int x_231 = 0;
@@ -105,7 +105,7 @@ int search_i1_(thread int* const target, thread tint_array_wrapper* const tint_s
break;
}
int const x_239 = index;
BST const x_241 = (*(tint_symbol_6)).arr[x_239];
BST const x_241 = (*(tint_symbol_4)).arr[x_239];
currentNode = x_241;
int const x_243 = currentNode.data;
int const x_244 = *(target);
@@ -128,7 +128,7 @@ int search_i1_(thread int* const target, thread tint_array_wrapper* const tint_s
return -1;
}
void main_1(thread tint_array_wrapper* const tint_symbol_7, thread float4* const tint_symbol_8, thread float4* const tint_symbol_9) {
void main_1(thread tint_array_wrapper* const tint_symbol_5, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) {
int treeIndex_1 = 0;
BST param_4 = {};
int param_5 = 0;
@@ -155,66 +155,66 @@ void main_1(thread tint_array_wrapper* const tint_symbol_7, thread float4* const
int result = 0;
int param_24 = 0;
treeIndex_1 = 0;
BST const x_88 = (*(tint_symbol_7)).arr[0];
BST const x_88 = (*(tint_symbol_5)).arr[0];
param_4 = x_88;
param_5 = 9;
makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_4), &(param_5));
BST const x_90 = param_4;
(*(tint_symbol_7)).arr[0] = x_90;
(*(tint_symbol_5)).arr[0] = x_90;
int const x_92 = treeIndex_1;
treeIndex_1 = as_type<int>((as_type<uint>(x_92) + as_type<uint>(1)));
int const x_94 = treeIndex_1;
param_6 = x_94;
param_7 = 5;
insert_i1_i1_(&(param_6), &(param_7), tint_symbol_7);
insert_i1_i1_(&(param_6), &(param_7), tint_symbol_5);
int const x_96 = treeIndex_1;
treeIndex_1 = as_type<int>((as_type<uint>(x_96) + as_type<uint>(1)));
int const x_98 = treeIndex_1;
param_8 = x_98;
param_9 = 12;
insert_i1_i1_(&(param_8), &(param_9), tint_symbol_7);
insert_i1_i1_(&(param_8), &(param_9), tint_symbol_5);
int const x_100 = treeIndex_1;
treeIndex_1 = as_type<int>((as_type<uint>(x_100) + as_type<uint>(1)));
int const x_102 = treeIndex_1;
param_10 = x_102;
param_11 = 15;
insert_i1_i1_(&(param_10), &(param_11), tint_symbol_7);
insert_i1_i1_(&(param_10), &(param_11), tint_symbol_5);
int const x_104 = treeIndex_1;
treeIndex_1 = as_type<int>((as_type<uint>(x_104) + as_type<uint>(1)));
int const x_106 = treeIndex_1;
param_12 = x_106;
param_13 = 7;
insert_i1_i1_(&(param_12), &(param_13), tint_symbol_7);
insert_i1_i1_(&(param_12), &(param_13), tint_symbol_5);
int const x_108 = treeIndex_1;
treeIndex_1 = as_type<int>((as_type<uint>(x_108) + as_type<uint>(1)));
int const x_110 = treeIndex_1;
param_14 = x_110;
param_15 = 8;
insert_i1_i1_(&(param_14), &(param_15), tint_symbol_7);
insert_i1_i1_(&(param_14), &(param_15), tint_symbol_5);
int const x_112 = treeIndex_1;
treeIndex_1 = as_type<int>((as_type<uint>(x_112) + as_type<uint>(1)));
int const x_114 = treeIndex_1;
param_16 = x_114;
param_17 = 2;
insert_i1_i1_(&(param_16), &(param_17), tint_symbol_7);
insert_i1_i1_(&(param_16), &(param_17), tint_symbol_5);
int const x_116 = treeIndex_1;
treeIndex_1 = as_type<int>((as_type<uint>(x_116) + as_type<uint>(1)));
int const x_118 = treeIndex_1;
param_18 = x_118;
param_19 = 6;
insert_i1_i1_(&(param_18), &(param_19), tint_symbol_7);
insert_i1_i1_(&(param_18), &(param_19), tint_symbol_5);
int const x_120 = treeIndex_1;
treeIndex_1 = as_type<int>((as_type<uint>(x_120) + as_type<uint>(1)));
int const x_122 = treeIndex_1;
param_20 = x_122;
param_21 = 17;
insert_i1_i1_(&(param_20), &(param_21), tint_symbol_7);
insert_i1_i1_(&(param_20), &(param_21), tint_symbol_5);
int const x_124 = treeIndex_1;
treeIndex_1 = as_type<int>((as_type<uint>(x_124) + as_type<uint>(1)));
int const x_126 = treeIndex_1;
param_22 = x_126;
param_23 = 13;
insert_i1_i1_(&(param_22), &(param_23), tint_symbol_7);
insert_i1_i1_(&(param_22), &(param_23), tint_symbol_5);
count = 0;
i = 0;
while (true) {
@@ -227,7 +227,7 @@ void main_1(thread tint_array_wrapper* const tint_symbol_7, thread float4* const
bool x_156_phi = false;
int const x_135 = i;
param_24 = x_135;
int const x_136 = search_i1_(&(param_24), tint_symbol_7);
int const x_136 = search_i1_(&(param_24), tint_symbol_5);
result = x_136;
int const x_137 = i;
switch(x_137) {
@@ -246,7 +246,7 @@ void main_1(thread tint_array_wrapper* const tint_symbol_7, thread float4* const
bool const x_149 = (x_147 == x_148);
x_156_phi = x_149;
if (!(x_149)) {
float const x_154 = (*(tint_symbol_8)).x;
float const x_154 = (*(tint_symbol_6)).x;
x_155 = (x_154 < 0.0f);
x_156_phi = x_155;
}
@@ -273,21 +273,27 @@ void main_1(thread tint_array_wrapper* const tint_symbol_7, thread float4* const
}
int const x_163 = count;
if ((x_163 == 20)) {
*(tint_symbol_9) = float4(1.0f, 0.0f, 0.0f, 1.0f);
*(tint_symbol_7) = float4(1.0f, 0.0f, 0.0f, 1.0f);
} else {
*(tint_symbol_9) = float4(0.0f, 0.0f, 1.0f, 1.0f);
*(tint_symbol_7) = float4(0.0f, 0.0f, 1.0f, 1.0f);
}
return;
}
fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]]) {
thread float4 tint_symbol_10 = 0.0f;
thread tint_array_wrapper tint_symbol_11 = {};
thread float4 tint_symbol_12 = 0.0f;
tint_symbol_10 = gl_FragCoord_param;
main_1(&(tint_symbol_11), &(tint_symbol_10), &(tint_symbol_12));
main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_12};
tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1};
return tint_symbol_4;
main_out tint_symbol_inner(float4 gl_FragCoord_param, thread float4* const tint_symbol_8, thread tint_array_wrapper* const tint_symbol_9, thread float4* const tint_symbol_10) {
*(tint_symbol_8) = gl_FragCoord_param;
main_1(tint_symbol_9, tint_symbol_8, tint_symbol_10);
main_out const tint_symbol_2 = {.x_GLF_color_1=*(tint_symbol_10)};
return tint_symbol_2;
}
fragment tint_symbol_1 tint_symbol(float4 gl_FragCoord_param [[position]]) {
thread float4 tint_symbol_11 = 0.0f;
thread tint_array_wrapper tint_symbol_12 = {};
thread float4 tint_symbol_13 = 0.0f;
main_out const inner_result = tint_symbol_inner(gl_FragCoord_param, &(tint_symbol_11), &(tint_symbol_12), &(tint_symbol_13));
tint_symbol_1 wrapper_result = {};
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result;
}

View File

@@ -12,7 +12,7 @@ struct tint_array_wrapper {
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol_2 {
struct tint_symbol_1 {
float4 x_GLF_color_1 [[color(0)]];
};
@@ -24,7 +24,7 @@ void makeTreeNode_struct_BST_i1_i1_i11_i1_(thread BST* const tree, thread int* c
return;
}
void insert_i1_i1_(thread int* const treeIndex, thread int* const data_1, thread tint_array_wrapper* const tint_symbol_5) {
void insert_i1_i1_(thread int* const treeIndex, thread int* const data_1, thread tint_array_wrapper* const tint_symbol_3) {
int baseIndex = 0;
BST param = {};
int param_1 = 0;
@@ -40,49 +40,49 @@ void insert_i1_i1_(thread int* const treeIndex, thread int* const data_1, thread
}
int const x_182 = *(data_1);
int const x_183 = baseIndex;
int const x_185 = (*(tint_symbol_5)).arr[x_183].data;
int const x_185 = (*(tint_symbol_3)).arr[x_183].data;
if ((x_182 <= x_185)) {
int const x_190 = baseIndex;
int const x_192 = (*(tint_symbol_5)).arr[x_190].leftIndex;
int const x_192 = (*(tint_symbol_3)).arr[x_190].leftIndex;
if ((x_192 == -1)) {
int const x_197 = baseIndex;
int const x_198 = *(treeIndex);
(*(tint_symbol_5)).arr[x_197].leftIndex = x_198;
(*(tint_symbol_3)).arr[x_197].leftIndex = x_198;
int const x_200 = *(treeIndex);
BST const x_202 = (*(tint_symbol_5)).arr[x_200];
BST const x_202 = (*(tint_symbol_3)).arr[x_200];
param = x_202;
int const x_203 = *(data_1);
param_1 = x_203;
makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param), &(param_1));
BST const x_205 = param;
(*(tint_symbol_5)).arr[x_200] = x_205;
(*(tint_symbol_3)).arr[x_200] = x_205;
return;
} else {
int const x_207 = baseIndex;
int const x_209 = (*(tint_symbol_5)).arr[x_207].leftIndex;
int const x_209 = (*(tint_symbol_3)).arr[x_207].leftIndex;
baseIndex = x_209;
continue;
}
return;
} else {
int const x_210 = baseIndex;
int const x_212 = (*(tint_symbol_5)).arr[x_210].rightIndex;
int const x_212 = (*(tint_symbol_3)).arr[x_210].rightIndex;
if ((x_212 == -1)) {
int const x_217 = baseIndex;
int const x_218 = *(treeIndex);
(*(tint_symbol_5)).arr[x_217].rightIndex = x_218;
(*(tint_symbol_3)).arr[x_217].rightIndex = x_218;
int const x_220 = *(treeIndex);
BST const x_222 = (*(tint_symbol_5)).arr[x_220];
BST const x_222 = (*(tint_symbol_3)).arr[x_220];
param_2 = x_222;
int const x_223 = *(data_1);
param_3 = x_223;
makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_2), &(param_3));
BST const x_225 = param_2;
(*(tint_symbol_5)).arr[x_220] = x_225;
(*(tint_symbol_3)).arr[x_220] = x_225;
return;
} else {
int const x_227 = baseIndex;
int const x_229 = (*(tint_symbol_5)).arr[x_227].rightIndex;
int const x_229 = (*(tint_symbol_3)).arr[x_227].rightIndex;
baseIndex = x_229;
continue;
}
@@ -93,7 +93,7 @@ void insert_i1_i1_(thread int* const treeIndex, thread int* const data_1, thread
return;
}
int search_i1_(thread int* const target, thread tint_array_wrapper* const tint_symbol_6) {
int search_i1_(thread int* const target, thread tint_array_wrapper* const tint_symbol_4) {
int index = 0;
BST currentNode = {};
int x_231 = 0;
@@ -105,7 +105,7 @@ int search_i1_(thread int* const target, thread tint_array_wrapper* const tint_s
break;
}
int const x_239 = index;
BST const x_241 = (*(tint_symbol_6)).arr[x_239];
BST const x_241 = (*(tint_symbol_4)).arr[x_239];
currentNode = x_241;
int const x_243 = currentNode.data;
int const x_244 = *(target);
@@ -128,7 +128,7 @@ int search_i1_(thread int* const target, thread tint_array_wrapper* const tint_s
return -1;
}
void main_1(thread tint_array_wrapper* const tint_symbol_7, thread float4* const tint_symbol_8, thread float4* const tint_symbol_9) {
void main_1(thread tint_array_wrapper* const tint_symbol_5, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) {
int treeIndex_1 = 0;
BST param_4 = {};
int param_5 = 0;
@@ -155,66 +155,66 @@ void main_1(thread tint_array_wrapper* const tint_symbol_7, thread float4* const
int result = 0;
int param_24 = 0;
treeIndex_1 = 0;
BST const x_88 = (*(tint_symbol_7)).arr[0];
BST const x_88 = (*(tint_symbol_5)).arr[0];
param_4 = x_88;
param_5 = 9;
makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_4), &(param_5));
BST const x_90 = param_4;
(*(tint_symbol_7)).arr[0] = x_90;
(*(tint_symbol_5)).arr[0] = x_90;
int const x_92 = treeIndex_1;
treeIndex_1 = as_type<int>((as_type<uint>(x_92) + as_type<uint>(1)));
int const x_94 = treeIndex_1;
param_6 = x_94;
param_7 = 5;
insert_i1_i1_(&(param_6), &(param_7), tint_symbol_7);
insert_i1_i1_(&(param_6), &(param_7), tint_symbol_5);
int const x_96 = treeIndex_1;
treeIndex_1 = as_type<int>((as_type<uint>(x_96) + as_type<uint>(1)));
int const x_98 = treeIndex_1;
param_8 = x_98;
param_9 = 12;
insert_i1_i1_(&(param_8), &(param_9), tint_symbol_7);
insert_i1_i1_(&(param_8), &(param_9), tint_symbol_5);
int const x_100 = treeIndex_1;
treeIndex_1 = as_type<int>((as_type<uint>(x_100) + as_type<uint>(1)));
int const x_102 = treeIndex_1;
param_10 = x_102;
param_11 = 15;
insert_i1_i1_(&(param_10), &(param_11), tint_symbol_7);
insert_i1_i1_(&(param_10), &(param_11), tint_symbol_5);
int const x_104 = treeIndex_1;
treeIndex_1 = as_type<int>((as_type<uint>(x_104) + as_type<uint>(1)));
int const x_106 = treeIndex_1;
param_12 = x_106;
param_13 = 7;
insert_i1_i1_(&(param_12), &(param_13), tint_symbol_7);
insert_i1_i1_(&(param_12), &(param_13), tint_symbol_5);
int const x_108 = treeIndex_1;
treeIndex_1 = as_type<int>((as_type<uint>(x_108) + as_type<uint>(1)));
int const x_110 = treeIndex_1;
param_14 = x_110;
param_15 = 8;
insert_i1_i1_(&(param_14), &(param_15), tint_symbol_7);
insert_i1_i1_(&(param_14), &(param_15), tint_symbol_5);
int const x_112 = treeIndex_1;
treeIndex_1 = as_type<int>((as_type<uint>(x_112) + as_type<uint>(1)));
int const x_114 = treeIndex_1;
param_16 = x_114;
param_17 = 2;
insert_i1_i1_(&(param_16), &(param_17), tint_symbol_7);
insert_i1_i1_(&(param_16), &(param_17), tint_symbol_5);
int const x_116 = treeIndex_1;
treeIndex_1 = as_type<int>((as_type<uint>(x_116) + as_type<uint>(1)));
int const x_118 = treeIndex_1;
param_18 = x_118;
param_19 = 6;
insert_i1_i1_(&(param_18), &(param_19), tint_symbol_7);
insert_i1_i1_(&(param_18), &(param_19), tint_symbol_5);
int const x_120 = treeIndex_1;
treeIndex_1 = as_type<int>((as_type<uint>(x_120) + as_type<uint>(1)));
int const x_122 = treeIndex_1;
param_20 = x_122;
param_21 = 17;
insert_i1_i1_(&(param_20), &(param_21), tint_symbol_7);
insert_i1_i1_(&(param_20), &(param_21), tint_symbol_5);
int const x_124 = treeIndex_1;
treeIndex_1 = as_type<int>((as_type<uint>(x_124) + as_type<uint>(1)));
int const x_126 = treeIndex_1;
param_22 = x_126;
param_23 = 13;
insert_i1_i1_(&(param_22), &(param_23), tint_symbol_7);
insert_i1_i1_(&(param_22), &(param_23), tint_symbol_5);
count = 0;
i = 0;
while (true) {
@@ -227,7 +227,7 @@ void main_1(thread tint_array_wrapper* const tint_symbol_7, thread float4* const
bool x_156_phi = false;
int const x_135 = i;
param_24 = x_135;
int const x_136 = search_i1_(&(param_24), tint_symbol_7);
int const x_136 = search_i1_(&(param_24), tint_symbol_5);
result = x_136;
int const x_137 = i;
switch(x_137) {
@@ -246,7 +246,7 @@ void main_1(thread tint_array_wrapper* const tint_symbol_7, thread float4* const
bool const x_149 = (x_147 == x_148);
x_156_phi = x_149;
if (!(x_149)) {
float const x_154 = (*(tint_symbol_8)).x;
float const x_154 = (*(tint_symbol_6)).x;
x_155 = (x_154 < 0.0f);
x_156_phi = x_155;
}
@@ -273,21 +273,27 @@ void main_1(thread tint_array_wrapper* const tint_symbol_7, thread float4* const
}
int const x_163 = count;
if ((x_163 == 20)) {
*(tint_symbol_9) = float4(1.0f, 0.0f, 0.0f, 1.0f);
*(tint_symbol_7) = float4(1.0f, 0.0f, 0.0f, 1.0f);
} else {
*(tint_symbol_9) = float4(0.0f, 0.0f, 1.0f, 1.0f);
*(tint_symbol_7) = float4(0.0f, 0.0f, 1.0f, 1.0f);
}
return;
}
fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]]) {
thread float4 tint_symbol_10 = 0.0f;
thread tint_array_wrapper tint_symbol_11 = {};
thread float4 tint_symbol_12 = 0.0f;
tint_symbol_10 = gl_FragCoord_param;
main_1(&(tint_symbol_11), &(tint_symbol_10), &(tint_symbol_12));
main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_12};
tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1};
return tint_symbol_4;
main_out tint_symbol_inner(float4 gl_FragCoord_param, thread float4* const tint_symbol_8, thread tint_array_wrapper* const tint_symbol_9, thread float4* const tint_symbol_10) {
*(tint_symbol_8) = gl_FragCoord_param;
main_1(tint_symbol_9, tint_symbol_8, tint_symbol_10);
main_out const tint_symbol_2 = {.x_GLF_color_1=*(tint_symbol_10)};
return tint_symbol_2;
}
fragment tint_symbol_1 tint_symbol(float4 gl_FragCoord_param [[position]]) {
thread float4 tint_symbol_11 = 0.0f;
thread tint_array_wrapper tint_symbol_12 = {};
thread float4 tint_symbol_13 = 0.0f;
main_out const inner_result = tint_symbol_inner(gl_FragCoord_param, &(tint_symbol_11), &(tint_symbol_12), &(tint_symbol_13));
tint_symbol_1 wrapper_result = {};
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result;
}