From 4080ef2ce7daef8d9e50a88858ed4a3a7ff4ed20 Mon Sep 17 00:00:00 2001 From: GregF Date: Mon, 21 Dec 2015 14:54:46 -0700 Subject: [PATCH] LunarGOO: Correctly handle phis for empty loop exit block If empty loop exit block precedes loop merge block for simple conditional or induction loop, create phi copies before loop begin and right before loop end. Constant phi copies can be avoided at loop end. --- Core/BottomTranslator.cpp | 98 ++- test/baseResults/loops.frag.out | 217 ++--- test/baseResults/noUnroll.out | 1350 +++++++++++++++--------------- test/baseResults/switch.frag.out | 168 ++-- 4 files changed, 957 insertions(+), 876 deletions(-) diff --git a/Core/BottomTranslator.cpp b/Core/BottomTranslator.cpp index af66b9f7..cf0c2167 100644 --- a/Core/BottomTranslator.cpp +++ b/Core/BottomTranslator.cpp @@ -159,13 +159,13 @@ namespace { // Add phi copies if the backend wants us to: // For all the successors of bb - void addPhiCopies(const BasicBlock* bb); + void addPhiCopies(const BasicBlock* bb, const bool noConst=false); // For nextBB that are relevant for curBB - void addPhiCopies(const BasicBlock* curBB, const BasicBlock* nextBB); + void addPhiCopies(const BasicBlock* curBB, const BasicBlock* nextBB, const bool noConst=false); // For the specified phi node for currBB - void addPhiCopy(const PHINode* phi, const BasicBlock* curBB); + void addPhiCopy(const PHINode* phi, const BasicBlock* curBB, const bool noConst=false); // Module Pass implementation static char ID; @@ -314,6 +314,10 @@ namespace { // If dominator properly dominates dominatee, then handle it, else do nothing bool attemptHandleDominatee(const BasicBlock* dominator, const BasicBlock* dominatee); + // True if exitBlock is just unconditional branch, it has one or more phi functions pointing to it, + // and the values of those phis associated with the exitBlock are all constant. + bool isSimpleMultiExitSearchLoopExit(const BasicBlock* exitBlock, LoopWrapper* loop); + // Sets up a the beginning of a loop for the loop at the top of our LoopStack. // Assumes there is something on top of our LoopStack. void setUpLoopBegin(const Value* condition); @@ -437,13 +441,13 @@ void BottomTranslator::declarePhiCopies(const Function* function) } } -void BottomTranslator::addPhiCopies(const BasicBlock* bb) +void BottomTranslator::addPhiCopies(const BasicBlock* bb, const bool noConst) { for (succ_const_iterator s = succ_begin(bb), e = succ_end(bb); s != e; ++s) - addPhiCopies(bb, *s); + addPhiCopies(bb, *s, noConst); } -void BottomTranslator::addPhiCopies(const BasicBlock* curBB, const BasicBlock* nextBB) +void BottomTranslator::addPhiCopies(const BasicBlock* curBB, const BasicBlock* nextBB, const bool noConst) { if (! backEnd->getRemovePhiFunctions()) return; @@ -453,13 +457,13 @@ void BottomTranslator::addPhiCopies(const BasicBlock* curBB, const BasicBlock* n const PHINode *phiNode = dyn_cast(i); if (phiNode) - addPhiCopy(phiNode, curBB); + addPhiCopy(phiNode, curBB, noConst); else break; } } -void BottomTranslator::addPhiCopy(const PHINode* phi, const BasicBlock* curBB) +void BottomTranslator::addPhiCopy(const PHINode* phi, const BasicBlock* curBB, const bool noConst) { // Exclude phi copies for our inductive variables if (! loops.empty() && loops.top()->isSimpleInductive() && phi == loops.top()->getInductionVariable()) @@ -473,7 +477,7 @@ void BottomTranslator::addPhiCopy(const PHINode* phi, const BasicBlock* curBB) // then we found ourselves Value* src = phi->getIncomingValue(predIndex); - if (! gla::IsUndef(src)) { + if (! gla::IsUndef(src) && ! ( noConst && isa(src))) { if (alias) backEndTranslator->addPhiAlias(phi, src); else @@ -578,9 +582,28 @@ void BottomTranslator::handleLoopBlock(const BasicBlock* bb, bool instructionsHa assert(! isLatch || simpleLatch); // isLatch => simpleLatch + const BasicBlock* exitBlock = NULL; + + if (isExiting) { + int exitPos = loop->exitSuccNumber(bb); + assert(exitPos != -1); + if (exitPos == 2) + gla::UnsupportedFunctionality("complex loop exits (two exit branches from same block)"); + + exitBlock = GetSuccessor(exitPos, bb); + } + // If it's a loop header, have the back-end add it - if (isHeader) + bool needExitPhiCopies = false; + if (isHeader) { + if (exitBlock && isSimpleMultiExitSearchLoopExit(exitBlock, loop)) + { + needExitPhiCopies = true; + addPhiCopies(exitBlock); + handledBlocks.insert(exitBlock); + } setUpLoopBegin(condition); + } // If the branch is conditional and not a latch nor exiting, we're dealing // with conditional (e.g. if-then-else) flow control from a header. @@ -625,17 +648,6 @@ void BottomTranslator::handleLoopBlock(const BasicBlock* bb, bool instructionsHa const BasicBlock* exitMerge = loop->getExitMerge(); - const BasicBlock* exitBlock = NULL; - - if (isExiting) { - int exitPos = loop->exitSuccNumber(bb); - assert(exitPos != -1); - if (exitPos == 2) - gla::UnsupportedFunctionality("complex loop exits (two exit branches from same block)"); - - exitBlock = GetSuccessor(exitPos, bb); - } - // Simple conditional loops should have exitBlock defined for them assert(! loop->isSimpleConditional() || exitBlock); // simple-conditional => exitBlock @@ -645,13 +657,19 @@ void BottomTranslator::handleLoopBlock(const BasicBlock* bb, bool instructionsHa // must be the loop-merge, and must be equivalent to exitBlock assert((! loop->isSimpleConditional() || ! exitMerge || AreEquivalent(exitBlock, exitMerge)) && "unstructured conditional loop"); + // Add exit phis before back edge; only need non-constant copies here + if (needExitPhiCopies) + addPhiCopies(exitBlock, true); + backEndTranslator->endLoop(); closeLoop(); const BasicBlock* loopMerge = loop->isSimpleConditional() && ! exitMerge ? exitBlock : exitMerge; // Handle the exitBlock, if it's not the loopMerge - if (exitBlock && loopMerge != exitBlock) { + if (exitBlock && loopMerge != exitBlock && !handledBlocks.count(exitBlock)) { + if (loopMerge && pred_begin(loopMerge) != pred_end(loopMerge) && isSimpleMultiExitSearchLoopExit(exitBlock, loop)) + gla::UnsupportedFunctionality("control flow: exitBlock handled before multi-pred loopMerge", gla::EATContinue); handleBlock(exitBlock); } @@ -939,6 +957,42 @@ void BottomTranslator::setUpSimpleLatch() addPhiCopies(loops.top()->getLatch(), loops.top()->getHeader()); } +bool BottomTranslator::isSimpleMultiExitSearchLoopExit(const BasicBlock* exitBlock, LoopWrapper* loop) +{ + // If not simple, return false + if (!loop->isSimpleInductive() && !loop->isSimpleConditional()) + return false; + + // If not multi-exit, return false + const BasicBlock* exitMerge = loop->getExitMerge(); + if (!exitMerge || exitMerge == exitBlock) + return false; + + // if exitBlock is not single unconditional branch, return false + if (exitBlock->size() != 1 ) + return false; + + if (!IsUnconditional(exitBlock)) + return false; + + // If any phi values for exitBlock are not constant, return false + bool saw_phi_val = false; + const BasicBlock* nextBB = *succ_begin(exitBlock); + for (BasicBlock::const_iterator i = nextBB->begin(), e = nextBB->end(); i != e; ++i) { + const PHINode *phi = dyn_cast(i); + if (!phi) + return saw_phi_val; + + // Find the operand whose predecessor is exitBlock. + int predIndex = phi->getBasicBlockIndex(exitBlock); + if (predIndex >= 0) { + saw_phi_val = true; + } + } + + return saw_phi_val; +} + void BottomTranslator::setUpLoopBegin(const Value* condition) { assert(loops.size() != 0); diff --git a/test/baseResults/loops.frag.out b/test/baseResults/loops.frag.out index d2bd6c19..d2d6fb1b 100644 --- a/test/baseResults/loops.frag.out +++ b/test/baseResults/loops.frag.out @@ -2414,6 +2414,7 @@ void main() } color4 = color3; + color5 = color4; while (color4.z < d3) { color61 = bigColor1_3 + color4; bool H_cp7uj51 = color61.y < d4; @@ -2424,9 +2425,9 @@ void main() vec4 color71 = bigColor1_3 + color61; color4 = color71; + color5 = color4; } - color5 = color4; color6 = color5; i = C_0; for (i = 0; i < Count; ++i) { @@ -2615,6 +2616,7 @@ void main() colorb = colora; Lg_4 = C_0; + colorc = colorb; while (Lg_4 <= C_41) { float H_0f3y181 = colorb.z + d3; Lg_5 = colorb; @@ -2631,9 +2633,9 @@ void main() int H_zk97sd1 = Lg_4 + C_1; colorb = H_0vqk2y; Lg_4 = H_zk97sd1; + colorc = colorb; } - colorc = colorb; colord = colorc; while (true) { vec4 colora1 = bigColor4 + colord; @@ -2696,6 +2698,7 @@ void main() if (H_s3gwv91) { bool H_lmykhx1 = d7 < C_1d0; colori = colorh; + colorj = colori; while (colori.y < d6) { colord1 = bigColor6 + colori; if (H_lmykhx1) { @@ -2704,9 +2707,9 @@ void main() } colori = colord1; + colorj = colori; } - colorj = colori; colorl = colorj; } else { colork = colorh; @@ -2802,6 +2805,7 @@ void main() } colort = colorq; + coloru = colort; while (colort.z < d10) { float H_906no3 = C_1d0 + colort.y; Lg_7 = colort; @@ -2823,9 +2827,9 @@ void main() H_y8yjmyr.xz = vec2(H_abkne3, H_cxcou2); vec4 selectb = H_c8m0ti ? H_y8yjmy : H_y8yjmyr; colort = selectb; + coloru = colort; } - coloru = colort; colorv = coloru; while (colorv.x < C_10d0) { vec4 colorj1 = bigColor8 + colorv; @@ -2960,21 +2964,25 @@ const vec4 C_vec4p0d66p = vec4(0.66); const vec4 C_vec4p0d33p = vec4(0.33); const float C_42d0 = 42.0; const vec4 C_vec4p1d0p = vec4(1.0); +vec4 colorg; const int C_0 = 0; -vec4 colori; +vec4 colorj; const float C_20d0 = 20.0; const float C_1d0 = 1.0; const int C_41 = 41; +vec4 Lg_1; const int C_1 = 1; vec4 colora2; vec4 select7; -float Lg_1; +float Lg_2; +vec4 colord1; const float C_0d0 = 0.0; vec4 colore1; vec4 colorg1; const float C_2d0 = 2.0; vec4 colorh1; const float C_5d0 = 5.0; +vec4 Lg_3; const float C_10d0 = 10.0; vec4 colorn1; @@ -2985,23 +2993,26 @@ void main() vec4 color2; vec4 color3; vec4 color4; - int i; vec4 color5; + int i; vec4 color6; - int Lg_; vec4 color7; - int Lg_1; + int Lg_; vec4 color8; + int Lg_1; + vec4 color9; int Lg_2; vec4 colora; + vec4 colorc; int Lg_3; - vec4 colorb; + vec4 colorc1; vec4 colord; vec4 colore; vec4 colorf; vec4 colorg; vec4 colorh; - vec4 colori; + vec4 colorj; + vec4 colorj1; vec4 colork; vec4 colorl; vec4 colorm; @@ -3012,12 +3023,13 @@ void main() vec4 colorr; vec4 colors; vec4 colort; + vec4 coloru; vec4 colorv; vec4 colorw; vec4 colorx; vec4 colory; vec4 colorz; - vec4 color9; + vec4 colora; bool H_bghf2q = BaseColor.x < C_0d33; bool H_9j9phn = BaseColor.x < C_0d66; vec4 select = H_9j9phn ? C_vec4p0d66p : C_vec4p0d33p; @@ -3025,23 +3037,23 @@ void main() vec4 select1 = BaseColor + _L; color = select1; while (color.x < d) { - vec4 colora = bigColor + color; - color = colora; + vec4 colorb = bigColor + color; + color = colorb; } color1 = color; while (color1.z < d) { - vec4 colorb = bigColor1_1 + color1; - bool H_28748h = colorb.w < d; - vec4 colorc = bigColor1_1 + colorb; - vec4 select2 = H_28748h ? colorb : colorc; + vec4 colorc = bigColor1_1 + color1; + bool H_28748h = colorc.w < d; + vec4 colord = bigColor1_1 + colorc; + vec4 select2 = H_28748h ? colorc : colord; color1 = select2; } color2 = color1; while (color2.x < C_42d0) { - vec4 colord = color2 + C_vec4p1d0p; - color2 = colord; + vec4 colore = color2 + C_vec4p1d0p; + color2 = colore; } color3 = color2; @@ -3053,41 +3065,44 @@ void main() break; } - vec4 colore = bigColor1_2 + color3; - color3 = colore; + vec4 colorf = bigColor1_2 + color3; + color3 = colorf; } color4 = color3; + color5 = color4; while (color4.z < d3) { - vec4 colorf = bigColor1_3 + color4; - bool H_cp7uj = colorf.y < d4; + colorg = bigColor1_3 + color4; + bool H_cp7uj = colorg.y < d4; if (H_cp7uj) { + color5 = colorg; break; } - vec4 colorg = bigColor1_3 + colorf; - color4 = colorg; + vec4 colorh = bigColor1_3 + colorg; + color4 = colorh; + color5 = color4; } i = C_0; - color5 = color4; + color6 = color5; for (i = 0; i < Count; ++i) { - vec4 colorh = bigColor2 + color5; - color5 = colorh; + vec4 colori = bigColor2 + color6; + color6 = colori; } - color6 = color5; + color7 = color6; while (true) { - colori = bigColor3 + color6; - bool H_s8h3qa = colori.x >= d2; - if (H_s8h3qa) { + colorj = bigColor3 + color7; + bool H_946xso1 = colorj.x >= d2; + if (H_946xso1) { break; } - color6 = colori; + color7 = colorj; } - float H_whexx = colori.z + d3; + float H_whexx = colorj.z + d3; float H_r8jpbt = H_whexx + d3; float H_jm = H_r8jpbt + d3; float H_teod = H_jm + d3; @@ -3129,38 +3144,38 @@ void main() float H_vb1m6c = H_5zwnye + d3; float H_kljeh = H_vb1m6c + d3; float H_ack95d = H_kljeh + d3; - vec4 H_bueoqy1 = colori; - H_bueoqy1.z = H_ack95d; + vec4 H_aj0o0z1 = colorj; + H_aj0o0z1.z = H_ack95d; Lg_ = C_0; - color7 = H_bueoqy1; + color8 = H_aj0o0z1; for ( ; Lg_ != 100; ++Lg_) { - bool H_ouigu = color7.z < C_20d0; - float H_i27ik = color7.x + C_1d0; - vec4 H_hvpvwg = color7; - H_hvpvwg.x = H_i27ik; - float H_tyie6w = C_1d0 + color7.y; - vec4 H_hvpvwgr = color7; - H_hvpvwgr.y = H_tyie6w; - vec4 select3 = H_ouigu ? H_hvpvwg : H_hvpvwgr; - color7 = select3; + bool H_ouigu = color8.z < C_20d0; + float H_i27ik = color8.x + C_1d0; + vec4 H_wgo1rc = color8; + H_wgo1rc.x = H_i27ik; + float H_tyie6w = C_1d0 + color8.y; + vec4 H_wgo1rcr = color8; + H_wgo1rcr.y = H_tyie6w; + vec4 select3 = H_ouigu ? H_wgo1rc : H_wgo1rcr; + color8 = select3; } Lg_1 = C_0; - color8 = color7; + color9 = color8; for ( ; Lg_1 != 120; ++Lg_1) { - bool H_dkcc0l = color8.z < C_20d0; - float H_5t8tep = C_1d0 + color8.x; - vec4 H_wgo1rc = color8; - H_wgo1rc.x = H_5t8tep; - float H_64nt4p = C_1d0 + color8.y; - vec4 H_wgo1rcr = color8; - H_wgo1rcr.y = H_64nt4p; - vec4 select4 = H_dkcc0l ? H_wgo1rc : H_wgo1rcr; - color8 = select4; + bool H_dkcc0l = color9.z < C_20d0; + float H_5t8tep = C_1d0 + color9.x; + vec4 H_v5a11d = color9; + H_v5a11d.x = H_5t8tep; + float H_64nt4p = C_1d0 + color9.y; + vec4 H_v5a11dr = color9; + H_v5a11dr.y = H_64nt4p; + vec4 select4 = H_dkcc0l ? H_v5a11d : H_v5a11dr; + color9 = select4; } Lg_2 = C_0; - colora = color8; + colora = color9; for ( ; Lg_2 != 42; ++Lg_2) { float H_bthy3g = colora.z + d3; bool H_nda4t = colora.x < d4; @@ -3173,24 +3188,29 @@ void main() colora = select5; } + colorc = colora; Lg_3 = C_0; - colorb = colora; + colorc1 = colorc; while (Lg_3 <= C_41) { - bool H_0rnct = colorb.x < d4; + float H_0f3y = colorc.z + d3; + Lg_1 = colorc; + Lg_1.z = H_0f3y; + bool H_0rnct = colorc.x < d4; if (H_0rnct) { + colorc1 = Lg_1; break; } - float H_0f3y = colorb.z + d3; - float H_heycbr = C_1d0 + colorb.w; - vec4 H_y3sg72 = colorb; - H_y3sg72.zw = vec2(H_0f3y, H_heycbr); + float H_heycbr = C_1d0 + colorc.w; + vec4 H_43cmyw = Lg_1; + H_43cmyw.w = H_heycbr; int H_zk97sd = Lg_3 + C_1; + colorc = H_43cmyw; Lg_3 = H_zk97sd; - colorb = H_y3sg72; + colorc1 = colorc; } - colord = colorb; + colord = colorc1; while (true) { vec4 colora1 = bigColor4 + colord; bool H_wfbsrv = colora1.x < d4; @@ -3231,8 +3251,8 @@ void main() if (H_8l0mbn) { colorf = select7; while (colorf.y < d6) { - vec4 colorc1 = bigColor6 + colorf; - colorf = colorc1; + vec4 colorc2 = bigColor6 + colorf; + colorf = colorc2; } colorh = colorf; @@ -3251,17 +3271,20 @@ void main() bool H_s3gwv = colorh.x < d6; if (H_s3gwv) { bool H_lmykhx = d7 < C_1d0; - colori = colorh; - while (colori.y < d6) { + colorj = colorh; + colorj1 = colorj; + while (colorj.y < d6) { + colord1 = bigColor6 + colorj; if (H_lmykhx) { + colorj1 = colord1; break; } - vec4 colord1 = bigColor6 + colori; - colori = colord1; + colorj = colord1; + colorj1 = colorj; } - colorl = colori; + colorl = colorj1; } else { colork = colorh; while (colork.z < d6) { @@ -3356,37 +3379,41 @@ void main() } colort = colorq; + coloru = colort; while (colort.z < d10) { float H_906no = C_1d0 + colort.y; - vec4 H_gdeqcx1 = colort; - H_gdeqcx1.y = H_906no; + Lg_3 = colort; + Lg_3.y = H_906no; bool H_91q1tp1 = H_906no >= d11; if (H_91q1tp1) { + vec4 colori1 = C_vec4p1d0p + Lg_3; + coloru = colori1; break; } float H_cxcou = C_1d0 + colort.z; bool H_c8m0ti = colort.w < d12; float H_zx6jg = C_1d0 + colort.w; - vec4 H_hoos0v1 = H_gdeqcx1; - H_hoos0v1.zw = vec2(H_cxcou, H_zx6jg); + vec4 H_2hjlix = Lg_3; + H_2hjlix.zw = vec2(H_cxcou, H_zx6jg); float H_abkne = C_1d0 + colort.x; - vec4 H_hoos0v1r = H_gdeqcx1; - H_hoos0v1r.xz = vec2(H_abkne, H_cxcou); - vec4 select9 = H_c8m0ti ? H_hoos0v1 : H_hoos0v1r; + vec4 H_2hjlixr = Lg_3; + H_2hjlixr.xz = vec2(H_abkne, H_cxcou); + vec4 select9 = H_c8m0ti ? H_2hjlix : H_2hjlixr; colort = select9; + coloru = colort; } - colorv = colort; + colorv = coloru; while (colorv.x < C_10d0) { - vec4 colorj = bigColor8 + colorv; - bool H_f99dxf = colorj.z < d8; - bool H_sm96gh = colorj.w < d6; - float H_8im07j = bigColor8.x + colorj.y; - vec4 H_aj0o0z1 = colorj; - H_aj0o0z1.y = H_8im07j; - vec4 colorj1 = H_sm96gh ? colorj : H_aj0o0z1; - vec4 selectd = H_f99dxf ? colorj1 : H_aj0o0z1; + vec4 colorj2 = bigColor8 + colorv; + bool H_f99dxf = colorj2.z < d8; + bool H_sm96gh = colorj2.w < d6; + float H_8im07j = bigColor8.x + colorj2.y; + vec4 H_4quxmv = colorj2; + H_4quxmv.y = H_8im07j; + vec4 colorj3 = H_sm96gh ? colorj2 : H_4quxmv; + vec4 selectd = H_f99dxf ? colorj3 : H_4quxmv; colorv = selectd; } @@ -3426,18 +3453,18 @@ void main() colorn1 = C_vec4p1d0p + colorz; bool H_0dzijc1 = colorn1.x >= d17; if (H_0dzijc1) { - color9 = colorn1; - while (color9.y < d16) { - bool H_z37o2g = color9.w < d16; + colora = colorn1; + while (colora.y < d16) { + bool H_z37o2g = colora.w < d16; if (H_z37o2g) { discard; } - vec4 coloro1 = C_vec4p1d0p + color9; - color9 = coloro1; + vec4 coloro1 = C_vec4p1d0p + colora; + colora = coloro1; } - vec4 colorp1 = C_vec4p1d0p + color9; + vec4 colorp1 = C_vec4p1d0p + colora; gl_FragColor = colorp1; return; } diff --git a/test/baseResults/noUnroll.out b/test/baseResults/noUnroll.out index 437f0f19..6f1a006e 100644 --- a/test/baseResults/noUnroll.out +++ b/test/baseResults/noUnroll.out @@ -1,673 +1,677 @@ -doWhileLoop.frag -#version 110 -// LunarGOO output -uniform vec4 bigColor; -uniform float d; -varying vec4 BaseColor; -vec4 color1; - -void main() -{ - vec4 color; - color = BaseColor; - while (true) { - color1 = bigColor + color; - bool H_1v5ao91 = color1.x < d; - if (! H_1v5ao91) { - break; - } - - color = color1; - } - - gl_FragColor = color1; - -} - -forLoop.frag -#version 130 -// LunarGOO output -uniform int Count; -uniform vec4 bigColor; -uniform uvec4 v4; -in vec4 BaseColor; -in float f; -vec4 gla_globalAgg; -const int C_0 = 0; -const float C_0d0 = 0.0; -vec4 Lg_7; -const int C_2 = 2; -vec3 Lg_8; -const int C_1 = 1; - -void main() -{ - vec4 Lg_1; - int i; - float sum; - int Lg_2; - int Lg_3; - vec4 tv; - vec4 r; - int Lg_4; - vec4 Lg_5; - int Lg_6; - Lg_1 = BaseColor; - i = C_0; - for (i = 0; i < Count; ++i) { - vec4 color = Lg_1 + bigColor; - Lg_1 = color; - } - - gl_FragColor = Lg_1; - sum = C_0d0; - Lg_2 = C_0; - for ( ; Lg_2 != 4; ++Lg_2) { - Lg_7 = vec4(sum); - float H_gmopng = float(ivec4(v4)[Lg_2]); - float sum1 = H_gmopng + sum; - sum = sum1; - } - - Lg_3 = C_0; - tv = gla_globalAgg; - for ( ; Lg_3 != 4; ++Lg_3) { - int H_exkixg1 = ivec4(v4)[Lg_3] << C_2; - float H_clpxp61 = float(H_exkixg1); - vec4 tv1 = tv; - tv1[Lg_3] = H_clpxp61; - tv = tv1; - } - - vec4 H_rxko521 = Lg_7 + tv; - vec4 Ll_FragColor1 = H_rxko521 + Lg_1; - gl_FragColor = Ll_FragColor1; - vec4 H_wlwz58 = vec4(f); - r = BaseColor; - Lg_4 = C_0; - while (true) { - bool H_wox96k = Lg_4 < Count; - if (! H_wox96k) { - break; - } - - vec4 H_xdyojw1 = r; - H_xdyojw1.w = f; - int H_zk97sd1 = Lg_4 + C_1; - r = H_xdyojw1; - Lg_4 = H_zk97sd1; - } - - vec3 H_bbezxw = Ll_FragColor1.xyz + r.xyz; - vec4 H_oazljt = Ll_FragColor1; - H_oazljt.xyz = H_bbezxw.xyz; - gl_FragColor = H_oazljt; - Lg_5 = H_oazljt; - Lg_6 = C_0; - for ( ; Lg_6 <= 15; Lg_6 += 4) { - vec4 Ll_FragColor2 = H_wlwz58 * Lg_5; - gl_FragColor = Ll_FragColor2; - Lg_5 = Ll_FragColor2; - } - - -} - -loops.frag -#version 130 -// LunarGOO output -uniform float d; -uniform vec4 bigColor; -uniform vec4 bigColor1_1; -uniform float d2; -uniform float d3; -uniform vec4 bigColor1_2; -uniform vec4 bigColor1_3; -uniform float d4; -uniform int Count; -uniform vec4 bigColor2; -uniform vec4 bigColor3; -uniform vec4 bigColor4; -uniform vec4 bigColor5; -uniform float d5; -uniform float d6; -uniform vec4 bigColor6; -uniform float d7; -uniform vec4 bigColor7; -uniform float d8; -uniform float d9; -uniform float d10; -uniform float d11; -uniform float d12; -uniform vec4 bigColor8; -uniform float d14; -uniform float d15; -uniform float d16; -uniform float d18; -uniform float d17; -uniform float d13; -uniform float d19; -uniform float d20; -uniform float d21; -uniform float d22; -uniform float d23; -uniform float d24; -uniform float d25; -uniform float d26; -uniform float d27; -uniform float d28; -uniform float d29; -uniform float d30; -uniform float d31; -uniform float d32; -uniform float d33; -uniform float d34; -in vec4 BaseColor; -const float C_0d33 = 0.33; -const float C_0d66 = 0.66; -const vec4 C_vec4p0d66p = vec4(0.66); -const vec4 C_vec4p0d33p = vec4(0.33); -const float C_42d0 = 42.0; -const vec4 C_vec4p1d0p = vec4(1.0); -vec4 color71; -const int C_0 = 0; -vec4 colora1; -const float C_20d0 = 20.0; -const float C_1d0 = 1.0; -const int C_41 = 41; -vec4 Lg_6; -const int C_1 = 1; -vec4 select8; -vec4 select9; -float Lg_7; -vec4 colore1; -const float C_0d0 = 0.0; -vec4 colorf1; -vec4 colorh1; -const float C_2d0 = 2.0; -vec4 colori1; -const float C_5d0 = 5.0; -vec4 Lg_8; -const float C_10d0 = 10.0; -vec4 coloro1; - -void main() -{ - vec4 color; - vec4 color1; - vec4 color2; - vec4 color3; - vec4 color4; - vec4 color5; - vec4 color6; - int i; - vec4 color7; - vec4 color8; - int Lg_1; - vec4 color9; - int Lg_2; - vec4 colora; - int Lg_3; - vec4 colorb; - int Lg_4; - vec4 colorc; - int Lg_5; - vec4 colord; - vec4 colore; - vec4 colorf; - vec4 colorg; - vec4 colorh; - vec4 colori; - vec4 colorj; - vec4 colork; - vec4 colorl; - vec4 colorm; - vec4 colorn; - vec4 coloro; - vec4 colorp; - vec4 colorq; - vec4 colorr; - vec4 colors; - vec4 colort; - vec4 coloru; - vec4 colorv; - vec4 colorw; - vec4 colorx; - vec4 colory; - vec4 colorz; - vec4 color01; - vec4 color11; - bool H_bghf2q1 = BaseColor.x < C_0d33; - bool H_9j9phn = BaseColor.x < C_0d66; - vec4 select = H_9j9phn ? C_vec4p0d66p : C_vec4p0d33p; - vec4 select1 = H_bghf2q1 ? C_vec4p0d33p : select; - vec4 select2 = BaseColor + select1; - color = select2; - while (color.x < d) { - vec4 color21 = bigColor + color; - color = color21; - } - - color1 = color; - while (color1.z < d) { - vec4 color31 = bigColor1_1 + color1; - bool H_b19a7k = color31.w < d; - vec4 color41 = bigColor1_1 + color31; - vec4 select3 = H_b19a7k ? color31 : color41; - color1 = select3; - } - - color2 = color1; - while (color2.x < C_42d0) { - vec4 color51 = color2 + C_vec4p1d0p; - color2 = color51; - } - - color3 = color2; - while (true) { - bool notlhs = color3.w >= d2; - bool notrhs = color3.y >= d3; - bool H_nbn92x = notrhs || notlhs; - if (H_nbn92x) { - break; - } - - vec4 color61 = bigColor1_2 + color3; - color3 = color61; - } - - color4 = color3; - while (color4.z < d3) { - color71 = bigColor1_3 + color4; - bool H_r8iyb71 = color71.y < d4; - if (H_r8iyb71) { - color5 = color71; - break; - } - - vec4 color81 = bigColor1_3 + color71; - color4 = color81; - } - - color5 = color4; - color6 = color5; - i = C_0; - for (i = 0; i < Count; ++i) { - vec4 color91 = bigColor2 + color6; - color6 = color91; - } - - color7 = color6; - while (true) { - colora1 = bigColor3 + color7; - bool H_y14t7v1 = colora1.x < d2; - if (! H_y14t7v1) { - break; - } - - color7 = colora1; - } - - color8 = colora1; - Lg_1 = C_0; - for ( ; Lg_1 != 42; ++Lg_1) { - float H_mjhfad = color8.z + d3; - vec4 H_wgo1rc = color8; - H_wgo1rc.z = H_mjhfad; - color8 = H_wgo1rc; - } - - color9 = color8; - Lg_2 = C_0; - for ( ; Lg_2 != 100; ++Lg_2) { - bool H_dkcc0l1 = color9.z < C_20d0; - float H_xi9dur1 = color9.x + C_1d0; - vec4 H_v5a11d = color9; - H_v5a11d.x = H_xi9dur1; - float H_64nt4p = C_1d0 + color9.y; - vec4 H_v5a11dr = color9; - H_v5a11dr.y = H_64nt4p; - vec4 select4 = H_dkcc0l1 ? H_v5a11d : H_v5a11dr; - color9 = select4; - } - - colora = color9; - Lg_3 = C_0; - for ( ; Lg_3 != 120; ++Lg_3) { - bool H_5cg22m1 = colora.z < C_20d0; - float H_t50h6y1 = C_1d0 + colora.x; - vec4 H_ze6hx1 = colora; - H_ze6hx1.x = H_t50h6y1; - float H_ugehwx1 = C_1d0 + colora.y; - vec4 H_ze6hx1r = colora; - H_ze6hx1r.y = H_ugehwx1; - vec4 select5 = H_5cg22m1 ? H_ze6hx1 : H_ze6hx1r; - colora = select5; - } - - colorb = colora; - Lg_4 = C_0; - for ( ; Lg_4 != 42; ++Lg_4) { - float H_0f3y181 = colorb.z + d3; - vec4 H_y3sg72 = colorb; - H_y3sg72.z = H_0f3y181; - bool H_0rnct = colorb.x < d4; - float H_heycbr = C_1d0 + colorb.w; - vec4 H_y3sg72r = colorb; - H_y3sg72r.zw = vec2(H_0f3y181, H_heycbr); - vec4 select6 = H_0rnct ? H_y3sg72 : H_y3sg72r; - colorb = select6; - } - - colorc = colorb; - Lg_5 = C_0; - while (Lg_5 <= C_41) { - float H_hmpflb = colorc.z + d3; - Lg_6 = colorc; - Lg_6.z = H_hmpflb; - bool H_1yyglv = colorc.x < d4; - if (H_1yyglv) { - colord = Lg_6; - break; - } - - float H_ygqqil1 = C_1d0 + colorc.w; - vec4 H_xxjjwy = Lg_6; - H_xxjjwy.w = H_ygqqil1; - int H_cn5n1i1 = Lg_5 + C_1; - colorc = H_xxjjwy; - Lg_5 = H_cn5n1i1; - } - - colord = colorc; - colore = colord; - while (true) { - vec4 colorb1 = bigColor4 + colore; - bool H_d8n1rz = colorb1.x < d4; - bool H_0hvytn = colorb1.y < d4; - float H_ft4i1t1 = colorb1.y + d4; - vec4 H_hbtye1 = colorb1; - H_hbtye1.y = H_ft4i1t1; - float H_qi2sqn1 = colorb1.x + d4; - vec4 H_hbtye1r = colorb1; - H_hbtye1r.x = H_qi2sqn1; - vec4 select7 = H_0hvytn ? H_hbtye1 : H_hbtye1r; - select8 = H_d8n1rz ? colorb1 : select7; - bool H_hxwloo = select8.z < d4; - if (! H_hxwloo) { - break; - } - - colore = select8; - } - - colorf = select8; - while (true) { - vec4 colorc1 = bigColor5 + colorf; - bool H_ky29nq1 = colorc1.y < d5; - float H_vnjtse1 = colorc1.y + d5; - vec4 H_cd5hos1 = colorc1; - H_cd5hos1.y = H_vnjtse1; - select9 = H_ky29nq1 ? H_cd5hos1 : colorc1; - bool H_5otk5o = select9.x < d5; - if (! H_5otk5o) { - break; - } - - colorf = select9; - } - - bool H_8l0mbn = select9.x < d6; - if (H_8l0mbn) { - colorg = select9; - while (colorg.y < d6) { - vec4 colord1 = bigColor6 + colorg; - colorg = colord1; - } - - colori = colorg; - } else { - colorh = select9; - while (colorh.z < d6) { - float H_k81hde1 = bigColor6.z + colorh.z; - vec4 H_c5togy1 = colorh; - H_c5togy1.z = H_k81hde1; - colorh = H_c5togy1; - } - - colori = colorh; - } - - bool H_p4jfbx1 = colori.x < d6; - if (H_p4jfbx1) { - bool H_lmykhx1 = d7 < C_1d0; - colorj = colori; - while (colorj.y < d6) { - colore1 = bigColor6 + colorj; - if (H_lmykhx1) { - colork = colore1; - break; - } - - colorj = colore1; - } - - colork = colorj; - colorm = colork; - } else { - colorl = colori; - while (colorl.z < d6) { - float H_wcfyex1 = bigColor6.z + colorl.z; - vec4 H_4y5jj = colorl; - H_4y5jj.z = H_wcfyex1; - colorl = H_4y5jj; - } - - colorm = colorl; - } - - bool H_2ecxn2 = d7 < C_0d0; - bool H_lmykhx1r = d7 < C_1d0; - colorn = colorm; - while (true) { - if (H_2ecxn2) { - coloro = colorn; - break; - } - - colorf1 = bigColor7 + colorn; - if (H_lmykhx1r) { - float H_5nb6mx1 = C_1d0 + colorf1.z; - vec4 H_1kqzpy = colorf1; - H_1kqzpy.z = H_5nb6mx1; - coloro = H_1kqzpy; - break; - } - - vec4 colorg1 = BaseColor + colorf1; - colorn = colorg1; - } - - bool H_zt4vz81 = d8 < C_0d0; - bool H_cokhy9 = d8 < C_1d0; - colorp = coloro; - while (true) { - if (H_zt4vz81) { - colorq = colorp; - break; - } - - colorh1 = bigColor7 + colorp; - if (H_cokhy9) { - float H_fjsmvh = C_1d0 + colorh1.z; - bool H_hrxnuy1 = d8 < C_2d0; - float H_e8em5i = C_1d0 + colorh1.y; - vec4 H_fh4v4t = colorh1; - H_fh4v4t.yz = vec2(H_e8em5i, H_fjsmvh); - float H_dxzlfi = C_1d0 + colorh1.x; - vec4 H_fh4v4tr = colorh1; - H_fh4v4tr.xz = vec2(H_dxzlfi, H_fjsmvh); - vec4 selecta = H_hrxnuy1 ? H_fh4v4t : H_fh4v4tr; - colorq = selecta; - break; - } - - colori1 = BaseColor + colorh1; - bool H_q6q6lh = colori1.z < d8; - if (! H_q6q6lh) { - colorq = colori1; - break; - } - - colorp = colori1; - } - - bool H_45lodh = d9 > d8; - colorr = colorq; - while (colorr.w < d9) { - colort = colorr; - if (H_45lodh) { - bool H_bare6w1 = colorr.x > d7; - colors = colorr; - if (! H_bare6w1) { - bool H_thbawy = colorr.z == C_5d0; - if (! H_thbawy) { - break; - } - - float H_dbcm251 = C_1d0 + colorr.w; - vec4 H_iz6rsw1 = colorr; - H_iz6rsw1.w = H_dbcm251; - colors = H_iz6rsw1; - } - - colort = colors; - } - - colorr = colort; - } - - coloru = colorr; - while (coloru.z < d10) { - float H_imrx301 = C_1d0 + coloru.y; - Lg_8 = coloru; - Lg_8.y = H_imrx301; - bool H_o5kiav1 = H_imrx301 < d11; - if (! H_o5kiav1) { - vec4 colorj1 = C_vec4p1d0p + Lg_8; - colorv = colorj1; - break; - } - - float H_jx5ytz = C_1d0 + coloru.z; - bool H_j3w65o1 = coloru.w < d12; - float H_wwb38w = C_1d0 + coloru.w; - vec4 H_vbrigz = Lg_8; - H_vbrigz.zw = vec2(H_jx5ytz, H_wwb38w); - float H_hbdxd01 = C_1d0 + coloru.x; - vec4 H_vbrigzr = Lg_8; - H_vbrigzr.xz = vec2(H_hbdxd01, H_jx5ytz); - vec4 selectb = H_j3w65o1 ? H_vbrigz : H_vbrigzr; - coloru = selectb; - } - - colorv = coloru; - colorw = colorv; - while (colorw.x < C_10d0) { - vec4 colork1 = bigColor8 + colorw; - bool H_4hxxxc1 = colork1.z < d8; - bool H_nvrkke = colork1.w < d6; - float H_ldwisu1 = bigColor8.x + colork1.y; - vec4 H_cvcj3x1 = colork1; - H_cvcj3x1.y = H_ldwisu1; - vec4 selectc = H_nvrkke ? colork1 : H_cvcj3x1; - vec4 selectd = H_4hxxxc1 ? selectc : H_cvcj3x1; - colorw = selectd; - } - - vec4 colorl1 = C_vec4p1d0p + colorw; - gl_FragColor = colorl1; - colorx = colorl1; - while (colorx.x < d14) { - bool H_b9sdbr = colorx.y < d15; - if (H_b9sdbr) { - return; - } - - vec4 colorm1 = C_vec4p1d0p + colorx; - colorx = colorm1; - } - - vec4 colorn1 = C_vec4p1d0p + colorx; - colory = colorn1; - while (colory.w < d16) { - float H_gd6sw71 = C_1d0 + colory.w; - vec4 H_rqruau1 = colory; - H_rqruau1.w = H_gd6sw71; - colory = H_rqruau1; - } - - colorz = colory; - while (true) { - bool notlhs1 = colorz.w >= d2; - bool notrhs1 = colorz.y >= d3; - bool H_9acxdp1 = notrhs1 || notlhs1; - if (H_9acxdp1) { - color01 = colorz; - while (color01.y >= d18) { - coloro1 = C_vec4p1d0p + color01; - bool H_yayciw1 = coloro1.x < d17; - if (! H_yayciw1) { - color11 = coloro1; - while (color11.y < d16) { - bool H_an18n91 = color11.w < d16; - if (H_an18n91) { - discard; - } - - vec4 colorp1 = C_vec4p1d0p + color11; - color11 = colorp1; - } - - vec4 colorq1 = C_vec4p1d0p + color11; - gl_FragColor = colorq1; - return; - } - - color01 = coloro1; - } - - return; - } - - vec4 colorr1 = bigColor1_2 + colorz; - bool H_eafgoe1 = colorr1.z < d3; - if (H_eafgoe1) { - return; - } - - colorz = colorr1; - } - -} - -whileLoop.frag -#version 110 -// LunarGOO output -uniform float d; -uniform vec4 bigColor; -varying vec4 BaseColor; - -void main() -{ - vec4 color; - color = BaseColor; - while (color.x < d) { - vec4 color1 = bigColor + color; - color = color1; - } - - gl_FragColor = color; - -} - +doWhileLoop.frag +#version 110 +// LunarGOO output +uniform vec4 bigColor; +uniform float d; +varying vec4 BaseColor; +vec4 color1; + +void main() +{ + vec4 color; + color = BaseColor; + while (true) { + color1 = bigColor + color; + bool H_1v5ao91 = color1.x < d; + if (! H_1v5ao91) { + break; + } + + color = color1; + } + + gl_FragColor = color1; + +} + +forLoop.frag +#version 130 +// LunarGOO output +uniform int Count; +uniform vec4 bigColor; +uniform uvec4 v4; +in vec4 BaseColor; +in float f; +vec4 gla_globalAgg; +const int C_0 = 0; +const float C_0d0 = 0.0; +vec4 Lg_7; +const int C_2 = 2; +vec3 Lg_8; +const int C_1 = 1; + +void main() +{ + vec4 Lg_1; + int i; + float sum; + int Lg_2; + int Lg_3; + vec4 tv; + vec4 r; + int Lg_4; + vec4 Lg_5; + int Lg_6; + Lg_1 = BaseColor; + i = C_0; + for (i = 0; i < Count; ++i) { + vec4 color = Lg_1 + bigColor; + Lg_1 = color; + } + + gl_FragColor = Lg_1; + sum = C_0d0; + Lg_2 = C_0; + for ( ; Lg_2 != 4; ++Lg_2) { + Lg_7 = vec4(sum); + float H_gmopng = float(ivec4(v4)[Lg_2]); + float sum1 = H_gmopng + sum; + sum = sum1; + } + + Lg_3 = C_0; + tv = gla_globalAgg; + for ( ; Lg_3 != 4; ++Lg_3) { + int H_exkixg1 = ivec4(v4)[Lg_3] << C_2; + float H_clpxp61 = float(H_exkixg1); + vec4 tv1 = tv; + tv1[Lg_3] = H_clpxp61; + tv = tv1; + } + + vec4 H_rxko521 = Lg_7 + tv; + vec4 Ll_FragColor1 = H_rxko521 + Lg_1; + gl_FragColor = Ll_FragColor1; + vec4 H_wlwz58 = vec4(f); + r = BaseColor; + Lg_4 = C_0; + while (true) { + bool H_wox96k = Lg_4 < Count; + if (! H_wox96k) { + break; + } + + vec4 H_xdyojw1 = r; + H_xdyojw1.w = f; + int H_zk97sd1 = Lg_4 + C_1; + r = H_xdyojw1; + Lg_4 = H_zk97sd1; + } + + vec3 H_bbezxw = Ll_FragColor1.xyz + r.xyz; + vec4 H_oazljt = Ll_FragColor1; + H_oazljt.xyz = H_bbezxw.xyz; + gl_FragColor = H_oazljt; + Lg_5 = H_oazljt; + Lg_6 = C_0; + for ( ; Lg_6 <= 15; Lg_6 += 4) { + vec4 Ll_FragColor2 = H_wlwz58 * Lg_5; + gl_FragColor = Ll_FragColor2; + Lg_5 = Ll_FragColor2; + } + + +} + +loops.frag +#version 130 +// LunarGOO output +uniform float d; +uniform vec4 bigColor; +uniform vec4 bigColor1_1; +uniform float d2; +uniform float d3; +uniform vec4 bigColor1_2; +uniform vec4 bigColor1_3; +uniform float d4; +uniform int Count; +uniform vec4 bigColor2; +uniform vec4 bigColor3; +uniform vec4 bigColor4; +uniform vec4 bigColor5; +uniform float d5; +uniform float d6; +uniform vec4 bigColor6; +uniform float d7; +uniform vec4 bigColor7; +uniform float d8; +uniform float d9; +uniform float d10; +uniform float d11; +uniform float d12; +uniform vec4 bigColor8; +uniform float d14; +uniform float d15; +uniform float d16; +uniform float d18; +uniform float d17; +uniform float d13; +uniform float d19; +uniform float d20; +uniform float d21; +uniform float d22; +uniform float d23; +uniform float d24; +uniform float d25; +uniform float d26; +uniform float d27; +uniform float d28; +uniform float d29; +uniform float d30; +uniform float d31; +uniform float d32; +uniform float d33; +uniform float d34; +in vec4 BaseColor; +const float C_0d33 = 0.33; +const float C_0d66 = 0.66; +const vec4 C_vec4p0d66p = vec4(0.66); +const vec4 C_vec4p0d33p = vec4(0.33); +const float C_42d0 = 42.0; +const vec4 C_vec4p1d0p = vec4(1.0); +vec4 color71; +const int C_0 = 0; +vec4 colora1; +const float C_20d0 = 20.0; +const float C_1d0 = 1.0; +const int C_41 = 41; +vec4 Lg_6; +const int C_1 = 1; +vec4 select8; +vec4 select9; +float Lg_7; +vec4 colore1; +const float C_0d0 = 0.0; +vec4 colorf1; +vec4 colorh1; +const float C_2d0 = 2.0; +vec4 colori1; +const float C_5d0 = 5.0; +vec4 Lg_8; +const float C_10d0 = 10.0; +vec4 coloro1; + +void main() +{ + vec4 color; + vec4 color1; + vec4 color2; + vec4 color3; + vec4 color4; + vec4 color5; + vec4 color6; + int i; + vec4 color7; + vec4 color8; + int Lg_1; + vec4 color9; + int Lg_2; + vec4 colora; + int Lg_3; + vec4 colorb; + int Lg_4; + vec4 colorc; + int Lg_5; + vec4 colord; + vec4 colore; + vec4 colorf; + vec4 colorg; + vec4 colorh; + vec4 colori; + vec4 colorj; + vec4 colork; + vec4 colorl; + vec4 colorm; + vec4 colorn; + vec4 coloro; + vec4 colorp; + vec4 colorq; + vec4 colorr; + vec4 colors; + vec4 colort; + vec4 coloru; + vec4 colorv; + vec4 colorw; + vec4 colorx; + vec4 colory; + vec4 colorz; + vec4 color01; + vec4 color11; + bool H_bghf2q1 = BaseColor.x < C_0d33; + bool H_9j9phn = BaseColor.x < C_0d66; + vec4 select = H_9j9phn ? C_vec4p0d66p : C_vec4p0d33p; + vec4 select1 = H_bghf2q1 ? C_vec4p0d33p : select; + vec4 select2 = BaseColor + select1; + color = select2; + while (color.x < d) { + vec4 color21 = bigColor + color; + color = color21; + } + + color1 = color; + while (color1.z < d) { + vec4 color31 = bigColor1_1 + color1; + bool H_b19a7k = color31.w < d; + vec4 color41 = bigColor1_1 + color31; + vec4 select3 = H_b19a7k ? color31 : color41; + color1 = select3; + } + + color2 = color1; + while (color2.x < C_42d0) { + vec4 color51 = color2 + C_vec4p1d0p; + color2 = color51; + } + + color3 = color2; + while (true) { + bool notlhs = color3.w >= d2; + bool notrhs = color3.y >= d3; + bool H_nbn92x = notrhs || notlhs; + if (H_nbn92x) { + break; + } + + vec4 color61 = bigColor1_2 + color3; + color3 = color61; + } + + color4 = color3; + color5 = color4; + while (color4.z < d3) { + color71 = bigColor1_3 + color4; + bool H_r8iyb71 = color71.y < d4; + if (H_r8iyb71) { + color5 = color71; + break; + } + + vec4 color81 = bigColor1_3 + color71; + color4 = color81; + color5 = color4; + } + + color6 = color5; + i = C_0; + for (i = 0; i < Count; ++i) { + vec4 color91 = bigColor2 + color6; + color6 = color91; + } + + color7 = color6; + while (true) { + colora1 = bigColor3 + color7; + bool H_y14t7v1 = colora1.x < d2; + if (! H_y14t7v1) { + break; + } + + color7 = colora1; + } + + color8 = colora1; + Lg_1 = C_0; + for ( ; Lg_1 != 42; ++Lg_1) { + float H_mjhfad = color8.z + d3; + vec4 H_wgo1rc = color8; + H_wgo1rc.z = H_mjhfad; + color8 = H_wgo1rc; + } + + color9 = color8; + Lg_2 = C_0; + for ( ; Lg_2 != 100; ++Lg_2) { + bool H_dkcc0l1 = color9.z < C_20d0; + float H_xi9dur1 = color9.x + C_1d0; + vec4 H_v5a11d = color9; + H_v5a11d.x = H_xi9dur1; + float H_64nt4p = C_1d0 + color9.y; + vec4 H_v5a11dr = color9; + H_v5a11dr.y = H_64nt4p; + vec4 select4 = H_dkcc0l1 ? H_v5a11d : H_v5a11dr; + color9 = select4; + } + + colora = color9; + Lg_3 = C_0; + for ( ; Lg_3 != 120; ++Lg_3) { + bool H_5cg22m1 = colora.z < C_20d0; + float H_t50h6y1 = C_1d0 + colora.x; + vec4 H_ze6hx1 = colora; + H_ze6hx1.x = H_t50h6y1; + float H_ugehwx1 = C_1d0 + colora.y; + vec4 H_ze6hx1r = colora; + H_ze6hx1r.y = H_ugehwx1; + vec4 select5 = H_5cg22m1 ? H_ze6hx1 : H_ze6hx1r; + colora = select5; + } + + colorb = colora; + Lg_4 = C_0; + for ( ; Lg_4 != 42; ++Lg_4) { + float H_0f3y181 = colorb.z + d3; + vec4 H_y3sg72 = colorb; + H_y3sg72.z = H_0f3y181; + bool H_0rnct = colorb.x < d4; + float H_heycbr = C_1d0 + colorb.w; + vec4 H_y3sg72r = colorb; + H_y3sg72r.zw = vec2(H_0f3y181, H_heycbr); + vec4 select6 = H_0rnct ? H_y3sg72 : H_y3sg72r; + colorb = select6; + } + + colorc = colorb; + Lg_5 = C_0; + colord = colorc; + while (Lg_5 <= C_41) { + float H_hmpflb = colorc.z + d3; + Lg_6 = colorc; + Lg_6.z = H_hmpflb; + bool H_1yyglv = colorc.x < d4; + if (H_1yyglv) { + colord = Lg_6; + break; + } + + float H_ygqqil1 = C_1d0 + colorc.w; + vec4 H_xxjjwy = Lg_6; + H_xxjjwy.w = H_ygqqil1; + int H_cn5n1i1 = Lg_5 + C_1; + colorc = H_xxjjwy; + Lg_5 = H_cn5n1i1; + colord = colorc; + } + + colore = colord; + while (true) { + vec4 colorb1 = bigColor4 + colore; + bool H_d8n1rz = colorb1.x < d4; + bool H_0hvytn = colorb1.y < d4; + float H_ft4i1t1 = colorb1.y + d4; + vec4 H_hbtye1 = colorb1; + H_hbtye1.y = H_ft4i1t1; + float H_qi2sqn1 = colorb1.x + d4; + vec4 H_hbtye1r = colorb1; + H_hbtye1r.x = H_qi2sqn1; + vec4 select7 = H_0hvytn ? H_hbtye1 : H_hbtye1r; + select8 = H_d8n1rz ? colorb1 : select7; + bool H_hxwloo = select8.z < d4; + if (! H_hxwloo) { + break; + } + + colore = select8; + } + + colorf = select8; + while (true) { + vec4 colorc1 = bigColor5 + colorf; + bool H_ky29nq1 = colorc1.y < d5; + float H_vnjtse1 = colorc1.y + d5; + vec4 H_cd5hos1 = colorc1; + H_cd5hos1.y = H_vnjtse1; + select9 = H_ky29nq1 ? H_cd5hos1 : colorc1; + bool H_5otk5o = select9.x < d5; + if (! H_5otk5o) { + break; + } + + colorf = select9; + } + + bool H_8l0mbn = select9.x < d6; + if (H_8l0mbn) { + colorg = select9; + while (colorg.y < d6) { + vec4 colord1 = bigColor6 + colorg; + colorg = colord1; + } + + colori = colorg; + } else { + colorh = select9; + while (colorh.z < d6) { + float H_k81hde1 = bigColor6.z + colorh.z; + vec4 H_c5togy1 = colorh; + H_c5togy1.z = H_k81hde1; + colorh = H_c5togy1; + } + + colori = colorh; + } + + bool H_p4jfbx1 = colori.x < d6; + if (H_p4jfbx1) { + bool H_lmykhx1 = d7 < C_1d0; + colorj = colori; + colork = colorj; + while (colorj.y < d6) { + colore1 = bigColor6 + colorj; + if (H_lmykhx1) { + colork = colore1; + break; + } + + colorj = colore1; + colork = colorj; + } + + colorm = colork; + } else { + colorl = colori; + while (colorl.z < d6) { + float H_wcfyex1 = bigColor6.z + colorl.z; + vec4 H_4y5jj = colorl; + H_4y5jj.z = H_wcfyex1; + colorl = H_4y5jj; + } + + colorm = colorl; + } + + bool H_2ecxn2 = d7 < C_0d0; + bool H_lmykhx1r = d7 < C_1d0; + colorn = colorm; + while (true) { + if (H_2ecxn2) { + coloro = colorn; + break; + } + + colorf1 = bigColor7 + colorn; + if (H_lmykhx1r) { + float H_5nb6mx1 = C_1d0 + colorf1.z; + vec4 H_1kqzpy = colorf1; + H_1kqzpy.z = H_5nb6mx1; + coloro = H_1kqzpy; + break; + } + + vec4 colorg1 = BaseColor + colorf1; + colorn = colorg1; + } + + bool H_zt4vz81 = d8 < C_0d0; + bool H_cokhy9 = d8 < C_1d0; + colorp = coloro; + while (true) { + if (H_zt4vz81) { + colorq = colorp; + break; + } + + colorh1 = bigColor7 + colorp; + if (H_cokhy9) { + float H_fjsmvh = C_1d0 + colorh1.z; + bool H_hrxnuy1 = d8 < C_2d0; + float H_e8em5i = C_1d0 + colorh1.y; + vec4 H_fh4v4t = colorh1; + H_fh4v4t.yz = vec2(H_e8em5i, H_fjsmvh); + float H_dxzlfi = C_1d0 + colorh1.x; + vec4 H_fh4v4tr = colorh1; + H_fh4v4tr.xz = vec2(H_dxzlfi, H_fjsmvh); + vec4 selecta = H_hrxnuy1 ? H_fh4v4t : H_fh4v4tr; + colorq = selecta; + break; + } + + colori1 = BaseColor + colorh1; + bool H_q6q6lh = colori1.z < d8; + if (! H_q6q6lh) { + colorq = colori1; + break; + } + + colorp = colori1; + } + + bool H_45lodh = d9 > d8; + colorr = colorq; + while (colorr.w < d9) { + colort = colorr; + if (H_45lodh) { + bool H_bare6w1 = colorr.x > d7; + colors = colorr; + if (! H_bare6w1) { + bool H_thbawy = colorr.z == C_5d0; + if (! H_thbawy) { + break; + } + + float H_dbcm251 = C_1d0 + colorr.w; + vec4 H_iz6rsw1 = colorr; + H_iz6rsw1.w = H_dbcm251; + colors = H_iz6rsw1; + } + + colort = colors; + } + + colorr = colort; + } + + coloru = colorr; + colorv = coloru; + while (coloru.z < d10) { + float H_imrx301 = C_1d0 + coloru.y; + Lg_8 = coloru; + Lg_8.y = H_imrx301; + bool H_o5kiav1 = H_imrx301 < d11; + if (! H_o5kiav1) { + vec4 colorj1 = C_vec4p1d0p + Lg_8; + colorv = colorj1; + break; + } + + float H_jx5ytz = C_1d0 + coloru.z; + bool H_j3w65o1 = coloru.w < d12; + float H_wwb38w = C_1d0 + coloru.w; + vec4 H_vbrigz = Lg_8; + H_vbrigz.zw = vec2(H_jx5ytz, H_wwb38w); + float H_hbdxd01 = C_1d0 + coloru.x; + vec4 H_vbrigzr = Lg_8; + H_vbrigzr.xz = vec2(H_hbdxd01, H_jx5ytz); + vec4 selectb = H_j3w65o1 ? H_vbrigz : H_vbrigzr; + coloru = selectb; + colorv = coloru; + } + + colorw = colorv; + while (colorw.x < C_10d0) { + vec4 colork1 = bigColor8 + colorw; + bool H_4hxxxc1 = colork1.z < d8; + bool H_nvrkke = colork1.w < d6; + float H_ldwisu1 = bigColor8.x + colork1.y; + vec4 H_cvcj3x1 = colork1; + H_cvcj3x1.y = H_ldwisu1; + vec4 selectc = H_nvrkke ? colork1 : H_cvcj3x1; + vec4 selectd = H_4hxxxc1 ? selectc : H_cvcj3x1; + colorw = selectd; + } + + vec4 colorl1 = C_vec4p1d0p + colorw; + gl_FragColor = colorl1; + colorx = colorl1; + while (colorx.x < d14) { + bool H_b9sdbr = colorx.y < d15; + if (H_b9sdbr) { + return; + } + + vec4 colorm1 = C_vec4p1d0p + colorx; + colorx = colorm1; + } + + vec4 colorn1 = C_vec4p1d0p + colorx; + colory = colorn1; + while (colory.w < d16) { + float H_gd6sw71 = C_1d0 + colory.w; + vec4 H_rqruau1 = colory; + H_rqruau1.w = H_gd6sw71; + colory = H_rqruau1; + } + + colorz = colory; + while (true) { + bool notlhs1 = colorz.w >= d2; + bool notrhs1 = colorz.y >= d3; + bool H_9acxdp1 = notrhs1 || notlhs1; + if (H_9acxdp1) { + color01 = colorz; + while (color01.y >= d18) { + coloro1 = C_vec4p1d0p + color01; + bool H_yayciw1 = coloro1.x < d17; + if (! H_yayciw1) { + color11 = coloro1; + while (color11.y < d16) { + bool H_an18n91 = color11.w < d16; + if (H_an18n91) { + discard; + } + + vec4 colorp1 = C_vec4p1d0p + color11; + color11 = colorp1; + } + + vec4 colorq1 = C_vec4p1d0p + color11; + gl_FragColor = colorq1; + return; + } + + color01 = coloro1; + } + + return; + } + + vec4 colorr1 = bigColor1_2 + colorz; + bool H_eafgoe1 = colorr1.z < d3; + if (H_eafgoe1) { + return; + } + + colorz = colorr1; + } + +} + +whileLoop.frag +#version 110 +// LunarGOO output +uniform float d; +uniform vec4 bigColor; +varying vec4 BaseColor; + +void main() +{ + vec4 color; + color = BaseColor; + while (color.x < d) { + vec4 color1 = bigColor + color; + color = color1; + } + + gl_FragColor = color; + +} + diff --git a/test/baseResults/switch.frag.out b/test/baseResults/switch.frag.out index e4471748..7c0b3f96 100644 --- a/test/baseResults/switch.frag.out +++ b/test/baseResults/switch.frag.out @@ -760,8 +760,6 @@ attributes #0 = { nounwind readnone } ***Unsupported functionality: switch topology -***Unsupported functionality: switch topology - ***Unsupported functionality: switch topology #version 310 es // LunarGOO output @@ -920,6 +918,7 @@ void main() mediump float H_v86jke1rrr = cos(x); i = C_0; f6 = f4; + fa = f6; while (i <= C_9) { switch (c) { case 1: @@ -927,6 +926,7 @@ void main() mediump float H_q4zp4f1 = H_0lhnahrrrr + f6; j = C_20; f8 = H_q4zp4f1; + f9 = f8; while (j <= C_29) { Lg_3 = f8 + C_1d0; bool H_93uqn1 = Lg_3 < C_100d2; @@ -941,119 +941,115 @@ void main() j = H_l69nk4; f8 = Lg_3; + f9 = f8; } - f9 = f8; - break; - - } - f7 = f9; - case 2: - { - mediump float H_sf4otx1 = H_v86jke1rrr + f6; - f7 = H_sf4otx1; - default: - { - mediump float H_ksdj391 = H_3c9cke1rrr + f6; - f7 = H_ksdj391; - } - - bool H_amefxf1 = f7 < C_3d43; - mediump int H_o3goq3 = C_1 + i; - if (H_amefxf1) { - fa = f7; - break; - } - - i = H_o3goq3; - f6 = f7; - } - - fa = f6; - mediump float H_13mhsn1 = float(local); - mediump float color1 = H_13mhsn1 + fa; - color = color1; - switch (c) { - case 0: - { - Lg_1 = v; - break; - - } + f7 = f9; case 2: { - Lg_1 = v; - break; - - } - case 1: - { - case 3: - { - mediump vec4 H_hno2sy = v * v; - Lg_1 = H_hno2sy; - break; - - } + mediump float H_sf4otx1 = H_v86jke1rrr + f6; + f7 = H_sf4otx1; default: { - Lg_1 = C_vec4p0d0p; + mediump float H_ksdj391 = H_3c9cke1rrr + f6; + f7 = H_ksdj391; + } + + bool H_amefxf1 = f7 < C_3d43; + mediump int H_o3goq3 = C_1 + i; + if (H_amefxf1) { + fa = f7; break; - } + + i = H_o3goq3; + f6 = f7; + fa = f6; } - mediump float color2 = Lg_1.y + color1; - color = color2; + mediump float H_13mhsn1 = float(local); + mediump float color1 = H_13mhsn1 + fa; + color = color1; switch (c) { case 0: { - Lg_2 = v; + Lg_1 = v; break; } case 2: { - Lg_2 = C_vec4p1d0p; + Lg_1 = v; break; } case 1: { - Lg_2 = v; - break; - - } - case 3: - { - mediump vec4 H_hno2syr = v * v; - Lg_2 = H_hno2syr; - break; - + case 3: + { + mediump vec4 H_hno2sy = v * v; + Lg_1 = H_hno2sy; + break; + + } + default: + { + Lg_1 = C_vec4p0d0p; + break; + + } } - default: - { - Lg_2 = C_vec4p0d0p; - break; - + + mediump float color2 = Lg_1.y + color1; + color = color2; + switch (c) { + case 0: + { + Lg_2 = v; + break; + + } + case 2: + { + Lg_2 = C_vec4p1d0p; + break; + + } + case 1: + { + Lg_2 = v; + break; + + } + case 3: + { + mediump vec4 H_hno2syr = v * v; + Lg_2 = H_hno2syr; + break; + + } + default: + { + Lg_2 = C_vec4p0d0p; + break; + + } } + + mediump float color3 = Lg_2.z + color2; + color = color3; + } - mediump float color3 = Lg_2.z + color2; - color = color3; - - } - tempglsl.frag Warning, version 310 is not yet complete; most version-specific features are present, but some are missing. ERROR: 0:143: 'default' : cannot be nested inside control flow -ERROR: 0:177: 'H_l69nk4' : undeclared identifier -ERROR: 0:177: 'assign' : cannot convert from 'temp float' to 'temp mediump int' -ERROR: 0:186: 'case' : cannot be nested inside control flow -ERROR: 0:190: 'default' : cannot be nested inside control flow -ERROR: 0:226: 'case' : cannot be nested inside control flow -ERROR: 0:233: 'default' : cannot be nested inside control flow -ERROR: 0:282: '' : syntax error -ERROR: 8 compilation errors. No code generated. +ERROR: 0:179: 'H_l69nk4' : undeclared identifier +ERROR: 0:179: 'assign' : cannot convert from 'temp float' to 'temp mediump int' +ERROR: 0:189: 'default' : cannot be nested inside control flow +ERROR: 0:225: 'case' : cannot be nested inside control flow +ERROR: 0:232: 'default' : cannot be nested inside control flow +ERROR: 0:281: '' : syntax error +ERROR: 7 compilation errors. No code generated.