diff --git a/examples/boxes/LICENSE b/examples/boxes/LICENSE new file mode 100644 index 0000000..ce8bad5 --- /dev/null +++ b/examples/boxes/LICENSE @@ -0,0 +1,54 @@ +Portions of this program utilize 3rd-party code and are copyright of their +respective owners, and are distributed under the following license conditions: + +############################################################################### + +spin.js + +The MIT License + +Copyright (c) 2011 Felix Gnass [fgnass at neteye dot de] + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +############################################################################### + +stat.js + +The MIT License + +Copyright (c) 2009-2012 Mr.doob + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/examples/boxes/boxes.ftl b/examples/boxes/boxes.ftl new file mode 100644 index 0000000..708015c --- /dev/null +++ b/examples/boxes/boxes.ftl @@ -0,0 +1,54 @@ +interface IRoot { + var w : float; + var h : float; +} + +interface Node { + var w : float; + var h : float; + var x : float; + var rx : float; + var y : float; + + var depth : int; +} + +class Root : IRoot { + children { + child : Node; + } + + actions { + w := child.w + 10; + h := child.h + 10; + child.x := 5; + child.rx := child.x + child.w; + child.y := 5; + + child.depth := 0; + } +} + +class HBox : Node { + children { + childs : [ Node ]; + } + actions { + loop childs { + childs.depth := depth + 1; + w := fold 5 .. $-.w + childs$i.w + 5; + childs.rx := fold x .. childs$-.rx + 5 + childs$i.w; + childs.x := childs$i.rx - childs$i.w; + h := fold 5 .. $-.h > (childs$i.h + 10) ? $-.h : (childs$i.h + 10); + childs.y := y + 5; + } + @render @RectangleOutline(x, y, w, h, rgb(100,0,0)); + } +} +class Leaf : Node { + actions { + w := 10; + h := 10; + @render @Rectangle(x, y, w, h, rgb(255,0,0)); + } +} diff --git a/examples/boxes/data_sc_big.json b/examples/boxes/data_sc_big.json new file mode 100644 index 0000000..91ca82f --- /dev/null +++ b/examples/boxes/data_sc_big.json @@ -0,0 +1,18 @@ +data = { + class: "Root", + children: { + "child": { + class: "HBox", + children: { + "childs": [ + {class: "Leaf"}, + {class: "Leaf"}, + {class: "HBox", + children: { + childs: [{class: "Leaf"}, {class: "Leaf"}]}}, + {class: "Leaf"}, + {class: "Leaf"}] + } + } + } +}; \ No newline at end of file diff --git a/examples/boxes/data_sc_small.json b/examples/boxes/data_sc_small.json new file mode 100644 index 0000000..5050430 --- /dev/null +++ b/examples/boxes/data_sc_small.json @@ -0,0 +1,18 @@ +data = { + class: "Root", + children: { + "child": { + class: "HBox", + children: { + "childs": [ + {class: "Leaf"}, + {class: "Leaf"}, + {class: "HBox", + children: { + childs: [{class: "Leaf"}, {class: "Leaf"}]}}, + {class: "Leaf"}, + {class: "Leaf"}] + } + } + } +}; \ No newline at end of file diff --git a/examples/boxes/index.html b/examples/boxes/index.html new file mode 100644 index 0000000..b120b8a --- /dev/null +++ b/examples/boxes/index.html @@ -0,0 +1,77 @@ + + + + Superconductor Template + + + + + + + +
+

Superconductor

+ ERROR: HTML canvas support not found. + +
+ + \ No newline at end of file diff --git a/examples/boxes/kbindings.js b/examples/boxes/kbindings.js new file mode 100644 index 0000000..dcdca42 --- /dev/null +++ b/examples/boxes/kbindings.js @@ -0,0 +1,295 @@ +this._gen_getKernels = function() { + this._gen_kernel_visit_0 = this.program.createKernel("visit_0"); + this._gen_kernel_visit_1 = this.program.createKernel("visit_1"); + this._gen_kernel_visit_2 = this.program.createKernel("visit_2"); + this._gen_kernel_visit_3 = this.program.createKernel("visit_3"); + this._gen_kernel_visit_4 = this.program.createKernel("visit_4"); +}; + + +this._gen_allocateClBuffers = function() { + this.cl_float_buffer_1 = this.context.createBuffer(this.cl.MEM_READ_WRITE, this.float_buffer_1.byteLength); + this.cl_int_buffer_1 = this.context.createBuffer(this.cl.MEM_READ_WRITE, this.int_buffer_1.byteLength); + this.cl_grammartokens_buffer_1 = this.context.createBuffer(this.cl.MEM_READ_WRITE, this.grammartokens_buffer_1.byteLength); + this.cl_nodeindex_buffer_1 = this.context.createBuffer(this.cl.MEM_READ_WRITE, this.nodeindex_buffer_1.byteLength); +}; + + +this._gen_transferTree = function() { + this.queue.enqueueWriteBuffer(this.cl_float_buffer_1, true, 0, this.float_buffer_1.byteLength, this.float_buffer_1); + this.queue.enqueueWriteBuffer(this.cl_int_buffer_1, true, 0, this.int_buffer_1.byteLength, this.int_buffer_1); + this.queue.enqueueWriteBuffer(this.cl_grammartokens_buffer_1, true, 0, this.grammartokens_buffer_1.byteLength, this.grammartokens_buffer_1); + this.queue.enqueueWriteBuffer(this.cl_nodeindex_buffer_1, true, 0, this.nodeindex_buffer_1.byteLength, this.nodeindex_buffer_1); +}; + + +this._gen_retrieveTree = function() { + this.queue.enqueueReadBuffer(this.cl_float_buffer_1, true, 0, this.float_buffer_1.byteLength, this.float_buffer_1); + this.queue.enqueueReadBuffer(this.cl_int_buffer_1, true, 0, this.int_buffer_1.byteLength, this.int_buffer_1); + this.queue.enqueueReadBuffer(this.cl_grammartokens_buffer_1, true, 0, this.grammartokens_buffer_1.byteLength, this.grammartokens_buffer_1); + this.queue.enqueueReadBuffer(this.cl_nodeindex_buffer_1, true, 0, this.nodeindex_buffer_1.byteLength, this.nodeindex_buffer_1); +}; + + +this._gen_setKernelArguments = function(kernel) { + var types = WebCLKernelArgumentTypes; + kernel.setArg(0, 0, types.UINT); // start_idx (default to 0) + kernel.setArg(1, this.tree_size, types.UINT); + kernel.setArg(2, this.cl_float_buffer_1); + kernel.setArg(3, this.cl_int_buffer_1); + kernel.setArg(4, this.cl_grammartokens_buffer_1); + kernel.setArg(5, this.cl_nodeindex_buffer_1); +}; + + +this._gen_runTraversals = function() { + this._gen_run_visit_0(); + this._gen_run_visit_1(); + this._gen_run_visit_2(); + this._gen_run_visit_3(); +}; + + +this._gen_run_visit_0 = function() { + this._gen_setKernelArguments(this._gen_kernel_visit_0); + this.topDownTraversal(this._gen_kernel_visit_0); +}; + + +this._gen_run_visit_1 = function() { + this._gen_setKernelArguments(this._gen_kernel_visit_1); + this.bottomUpTraversal(this._gen_kernel_visit_1); +}; + + +this._gen_run_visit_2 = function() { + this._gen_setKernelArguments(this._gen_kernel_visit_2); + this.topDownTraversal(this._gen_kernel_visit_2); +}; + + +this._gen_run_visit_3 = function() { + this._gen_setKernelArguments(this._gen_kernel_visit_3); + this.bottomUpTraversal(this._gen_kernel_visit_3); +}; + + +this._gen_run_visit_4 = function(clVBO) { + this._gen_setKernelArguments(this._gen_kernel_visit_4); + this._gen_kernel_visit_4.setArg(6, clVBO); + this.topDownTraversal(this._gen_kernel_visit_4); +}; + + +// Defines all the typed array buffers which will store data locally before +// sending it to the CL device, then populates them with data +this._gen_allocateHostBuffers = function(treeSize) { + this.FLOAT_BUFFER_1_SIZE = 17; + this.float_buffer_1 = new Float32Array(this.FLOAT_BUFFER_1_SIZE * treeSize); + this.INT_BUFFER_1_SIZE = 31; + this.int_buffer_1 = new Int32Array(this.INT_BUFFER_1_SIZE * treeSize); + this.GRAMMARTOKENS_BUFFER_1_SIZE = 2; + this.grammartokens_buffer_1 = new Int32Array(this.GRAMMARTOKENS_BUFFER_1_SIZE * treeSize); + this.NODEINDEX_BUFFER_1_SIZE = 6; + this.nodeindex_buffer_1 = new Int32Array(this.NODEINDEX_BUFFER_1_SIZE * treeSize); +}; + +this._gen_allocateHostProxies = function (treeSize) { + this.displayname = this.grammartokens_buffer_1.subarray(treeSize * 0, (treeSize * 0) + treeSize); + this.fld_hbox_child_childs_count = this.int_buffer_1.subarray(treeSize * 18, (treeSize * 18) + treeSize); + this.fld_hbox_child_childs_leftmost_child = this.nodeindex_buffer_1.subarray(treeSize * 1, (treeSize * 1) + treeSize); + this.fld_hbox_childs_depth_init = this.int_buffer_1.subarray(treeSize * 23, (treeSize * 23) + treeSize); + this.fld_hbox_childs_depth_last = this.int_buffer_1.subarray(treeSize * 24, (treeSize * 24) + treeSize); + this.fld_hbox_childs_rx_init = this.float_buffer_1.subarray(treeSize * 11, (treeSize * 11) + treeSize); + this.fld_hbox_childs_rx_last = this.float_buffer_1.subarray(treeSize * 12, (treeSize * 12) + treeSize); + this.fld_hbox_childs___dorenderinglast___init = this.int_buffer_1.subarray(treeSize * 19, (treeSize * 19) + treeSize); + this.fld_hbox_childs___dorenderinglast___last = this.int_buffer_1.subarray(treeSize * 20, (treeSize * 20) + treeSize); + this.fld_hbox_childs___renderrightoffset___init = this.int_buffer_1.subarray(treeSize * 25, (treeSize * 25) + treeSize); + this.fld_hbox_childs___renderrightoffset___last = this.int_buffer_1.subarray(treeSize * 26, (treeSize * 26) + treeSize); + this.fld_hbox_childs_x_init = this.float_buffer_1.subarray(treeSize * 9, (treeSize * 9) + treeSize); + this.fld_hbox_childs_x_last = this.float_buffer_1.subarray(treeSize * 10, (treeSize * 10) + treeSize); + this.fld_hbox_childs_y_init = this.float_buffer_1.subarray(treeSize * 13, (treeSize * 13) + treeSize); + this.fld_hbox_childs_y_last = this.float_buffer_1.subarray(treeSize * 14, (treeSize * 14) + treeSize); + this.fld_hbox_h_init = this.float_buffer_1.subarray(treeSize * 15, (treeSize * 15) + treeSize); + this.fld_hbox_h_last = this.float_buffer_1.subarray(treeSize * 16, (treeSize * 16) + treeSize); + this.fld_hbox___childsrendersize__ = this.int_buffer_1.subarray(treeSize * 13, (treeSize * 13) + treeSize); + this.fld_hbox___childsrendersize___init = this.int_buffer_1.subarray(treeSize * 21, (treeSize * 21) + treeSize); + this.fld_hbox___childsrendersize___last = this.int_buffer_1.subarray(treeSize * 22, (treeSize * 22) + treeSize); + this.fld_hbox___draw__ = this.int_buffer_1.subarray(treeSize * 16, (treeSize * 16) + treeSize); + this.fld_hbox___draw__0 = this.int_buffer_1.subarray(treeSize * 15, (treeSize * 15) + treeSize); + this.fld_hbox___selfrendersize__ = this.int_buffer_1.subarray(treeSize * 17, (treeSize * 17) + treeSize); + this.fld_hbox___selfrendersize__0 = this.int_buffer_1.subarray(treeSize * 14, (treeSize * 14) + treeSize); + this.fld_hbox_w_init = this.float_buffer_1.subarray(treeSize * 7, (treeSize * 7) + treeSize); + this.fld_hbox_w_last = this.float_buffer_1.subarray(treeSize * 8, (treeSize * 8) + treeSize); + this.fld_iroot_h = this.float_buffer_1.subarray(treeSize * 1, (treeSize * 1) + treeSize); + this.fld_iroot___dorenderinglast__ = this.int_buffer_1.subarray(treeSize * 3, (treeSize * 3) + treeSize); + this.fld_iroot___renderoffset__ = this.int_buffer_1.subarray(treeSize * 1, (treeSize * 1) + treeSize); + this.fld_iroot___renderrightoffset__ = this.int_buffer_1.subarray(treeSize * 0, (treeSize * 0) + treeSize); + this.fld_iroot___rendersize__ = this.int_buffer_1.subarray(treeSize * 2, (treeSize * 2) + treeSize); + this.fld_iroot_w = this.float_buffer_1.subarray(treeSize * 0, (treeSize * 0) + treeSize); + this.fld_leaf___draw__ = this.int_buffer_1.subarray(treeSize * 29, (treeSize * 29) + treeSize); + this.fld_leaf___draw__0 = this.int_buffer_1.subarray(treeSize * 28, (treeSize * 28) + treeSize); + this.fld_leaf___selfrendersize__ = this.int_buffer_1.subarray(treeSize * 30, (treeSize * 30) + treeSize); + this.fld_leaf___selfrendersize__0 = this.int_buffer_1.subarray(treeSize * 27, (treeSize * 27) + treeSize); + this.fld_node_depth = this.int_buffer_1.subarray(treeSize * 8, (treeSize * 8) + treeSize); + this.fld_node_h = this.float_buffer_1.subarray(treeSize * 5, (treeSize * 5) + treeSize); + this.fld_node_rx = this.float_buffer_1.subarray(treeSize * 4, (treeSize * 4) + treeSize); + this.fld_node___dorenderinglast__ = this.int_buffer_1.subarray(treeSize * 7, (treeSize * 7) + treeSize); + this.fld_node___renderoffset__ = this.int_buffer_1.subarray(treeSize * 5, (treeSize * 5) + treeSize); + this.fld_node___renderrightoffset__ = this.int_buffer_1.subarray(treeSize * 4, (treeSize * 4) + treeSize); + this.fld_node___rendersize__ = this.int_buffer_1.subarray(treeSize * 6, (treeSize * 6) + treeSize); + this.fld_node_w = this.float_buffer_1.subarray(treeSize * 2, (treeSize * 2) + treeSize); + this.fld_node_x = this.float_buffer_1.subarray(treeSize * 6, (treeSize * 6) + treeSize); + this.fld_node_y = this.float_buffer_1.subarray(treeSize * 3, (treeSize * 3) + treeSize); + this.fld_root_child_child_count = this.int_buffer_1.subarray(treeSize * 12, (treeSize * 12) + treeSize); + this.fld_root_child_child_leftmost_child = this.nodeindex_buffer_1.subarray(treeSize * 0, (treeSize * 0) + treeSize); + this.fld_root___childrendersize__ = this.int_buffer_1.subarray(treeSize * 11, (treeSize * 11) + treeSize); + this.fld_root___draw__ = this.int_buffer_1.subarray(treeSize * 9, (treeSize * 9) + treeSize); + this.fld_root___selfrendersize__ = this.int_buffer_1.subarray(treeSize * 10, (treeSize * 10) + treeSize); + this.id = this.nodeindex_buffer_1.subarray(treeSize * 5, (treeSize * 5) + treeSize); + this.left_siblings = this.nodeindex_buffer_1.subarray(treeSize * 3, (treeSize * 3) + treeSize); + this.parent = this.nodeindex_buffer_1.subarray(treeSize * 4, (treeSize * 4) + treeSize); + this.refname = this.grammartokens_buffer_1.subarray(treeSize * 1, (treeSize * 1) + treeSize); + this.right_siblings = this.nodeindex_buffer_1.subarray(treeSize * 2, (treeSize * 2) + treeSize); +}; + + +this._gen_copyHostBuffers = function (data, treeSize){ + for(var i = 0; i < data.float_buffer_1.length; i++) { + this.float_buffer_1[i] = data.float_buffer_1[i]; + } + + for(var i = 0; i < data.int_buffer_1.length; i++) { + this.int_buffer_1[i] = data.int_buffer_1[i]; + } + + for(var i = 0; i < data.grammartokens_buffer_1.length; i++) { + this.grammartokens_buffer_1[i] = data.grammartokens_buffer_1[i]; + } + + for(var i = 0; i < data.nodeindex_buffer_1.length; i++) { + this.nodeindex_buffer_1[i] = data.nodeindex_buffer_1[i]; + } + +}; + + +// Creates proxy object to wrap every field in the tree. Both host and cl buffers must be allocated +// before calling this function. +this._gen_allocateProxyObjects = function() { + this.proxyData.displayname = new CLDataWrapper(this, this.displayname, this.cl_grammartokens_buffer_1); + this.proxyData.fld_hbox_child_childs_count = new CLDataWrapper(this, this.fld_hbox_child_childs_count, this.cl_int_buffer_1); + this.proxyData.fld_hbox_child_childs_leftmost_child = new CLDataWrapper(this, this.fld_hbox_child_childs_leftmost_child, this.cl_nodeindex_buffer_1); + this.proxyData.fld_hbox_childs_depth_init = new CLDataWrapper(this, this.fld_hbox_childs_depth_init, this.cl_int_buffer_1); + this.proxyData.fld_hbox_childs_depth_last = new CLDataWrapper(this, this.fld_hbox_childs_depth_last, this.cl_int_buffer_1); + this.proxyData.fld_hbox_childs_rx_init = new CLDataWrapper(this, this.fld_hbox_childs_rx_init, this.cl_float_buffer_1); + this.proxyData.fld_hbox_childs_rx_last = new CLDataWrapper(this, this.fld_hbox_childs_rx_last, this.cl_float_buffer_1); + this.proxyData.fld_hbox_childs___dorenderinglast___init = new CLDataWrapper(this, this.fld_hbox_childs___dorenderinglast___init, this.cl_int_buffer_1); + this.proxyData.fld_hbox_childs___dorenderinglast___last = new CLDataWrapper(this, this.fld_hbox_childs___dorenderinglast___last, this.cl_int_buffer_1); + this.proxyData.fld_hbox_childs___renderrightoffset___init = new CLDataWrapper(this, this.fld_hbox_childs___renderrightoffset___init, this.cl_int_buffer_1); + this.proxyData.fld_hbox_childs___renderrightoffset___last = new CLDataWrapper(this, this.fld_hbox_childs___renderrightoffset___last, this.cl_int_buffer_1); + this.proxyData.fld_hbox_childs_x_init = new CLDataWrapper(this, this.fld_hbox_childs_x_init, this.cl_float_buffer_1); + this.proxyData.fld_hbox_childs_x_last = new CLDataWrapper(this, this.fld_hbox_childs_x_last, this.cl_float_buffer_1); + this.proxyData.fld_hbox_childs_y_init = new CLDataWrapper(this, this.fld_hbox_childs_y_init, this.cl_float_buffer_1); + this.proxyData.fld_hbox_childs_y_last = new CLDataWrapper(this, this.fld_hbox_childs_y_last, this.cl_float_buffer_1); + this.proxyData.fld_hbox_h_init = new CLDataWrapper(this, this.fld_hbox_h_init, this.cl_float_buffer_1); + this.proxyData.fld_hbox_h_last = new CLDataWrapper(this, this.fld_hbox_h_last, this.cl_float_buffer_1); + this.proxyData.fld_hbox___childsrendersize__ = new CLDataWrapper(this, this.fld_hbox___childsrendersize__, this.cl_int_buffer_1); + this.proxyData.fld_hbox___childsrendersize___init = new CLDataWrapper(this, this.fld_hbox___childsrendersize___init, this.cl_int_buffer_1); + this.proxyData.fld_hbox___childsrendersize___last = new CLDataWrapper(this, this.fld_hbox___childsrendersize___last, this.cl_int_buffer_1); + this.proxyData.fld_hbox___draw__ = new CLDataWrapper(this, this.fld_hbox___draw__, this.cl_int_buffer_1); + this.proxyData.fld_hbox___draw__0 = new CLDataWrapper(this, this.fld_hbox___draw__0, this.cl_int_buffer_1); + this.proxyData.fld_hbox___selfrendersize__ = new CLDataWrapper(this, this.fld_hbox___selfrendersize__, this.cl_int_buffer_1); + this.proxyData.fld_hbox___selfrendersize__0 = new CLDataWrapper(this, this.fld_hbox___selfrendersize__0, this.cl_int_buffer_1); + this.proxyData.fld_hbox_w_init = new CLDataWrapper(this, this.fld_hbox_w_init, this.cl_float_buffer_1); + this.proxyData.fld_hbox_w_last = new CLDataWrapper(this, this.fld_hbox_w_last, this.cl_float_buffer_1); + this.proxyData.fld_iroot_h = new CLDataWrapper(this, this.fld_iroot_h, this.cl_float_buffer_1); + this.proxyData.fld_iroot___dorenderinglast__ = new CLDataWrapper(this, this.fld_iroot___dorenderinglast__, this.cl_int_buffer_1); + this.proxyData.fld_iroot___renderoffset__ = new CLDataWrapper(this, this.fld_iroot___renderoffset__, this.cl_int_buffer_1); + this.proxyData.fld_iroot___renderrightoffset__ = new CLDataWrapper(this, this.fld_iroot___renderrightoffset__, this.cl_int_buffer_1); + this.proxyData.fld_iroot___rendersize__ = new CLDataWrapper(this, this.fld_iroot___rendersize__, this.cl_int_buffer_1); + this.proxyData.fld_iroot_w = new CLDataWrapper(this, this.fld_iroot_w, this.cl_float_buffer_1); + this.proxyData.fld_leaf___draw__ = new CLDataWrapper(this, this.fld_leaf___draw__, this.cl_int_buffer_1); + this.proxyData.fld_leaf___draw__0 = new CLDataWrapper(this, this.fld_leaf___draw__0, this.cl_int_buffer_1); + this.proxyData.fld_leaf___selfrendersize__ = new CLDataWrapper(this, this.fld_leaf___selfrendersize__, this.cl_int_buffer_1); + this.proxyData.fld_leaf___selfrendersize__0 = new CLDataWrapper(this, this.fld_leaf___selfrendersize__0, this.cl_int_buffer_1); + this.proxyData.fld_node_depth = new CLDataWrapper(this, this.fld_node_depth, this.cl_int_buffer_1); + this.proxyData.fld_node_h = new CLDataWrapper(this, this.fld_node_h, this.cl_float_buffer_1); + this.proxyData.fld_node_rx = new CLDataWrapper(this, this.fld_node_rx, this.cl_float_buffer_1); + this.proxyData.fld_node___dorenderinglast__ = new CLDataWrapper(this, this.fld_node___dorenderinglast__, this.cl_int_buffer_1); + this.proxyData.fld_node___renderoffset__ = new CLDataWrapper(this, this.fld_node___renderoffset__, this.cl_int_buffer_1); + this.proxyData.fld_node___renderrightoffset__ = new CLDataWrapper(this, this.fld_node___renderrightoffset__, this.cl_int_buffer_1); + this.proxyData.fld_node___rendersize__ = new CLDataWrapper(this, this.fld_node___rendersize__, this.cl_int_buffer_1); + this.proxyData.fld_node_w = new CLDataWrapper(this, this.fld_node_w, this.cl_float_buffer_1); + this.proxyData.fld_node_x = new CLDataWrapper(this, this.fld_node_x, this.cl_float_buffer_1); + this.proxyData.fld_node_y = new CLDataWrapper(this, this.fld_node_y, this.cl_float_buffer_1); + this.proxyData.fld_root_child_child_count = new CLDataWrapper(this, this.fld_root_child_child_count, this.cl_int_buffer_1); + this.proxyData.fld_root_child_child_leftmost_child = new CLDataWrapper(this, this.fld_root_child_child_leftmost_child, this.cl_nodeindex_buffer_1); + this.proxyData.fld_root___childrendersize__ = new CLDataWrapper(this, this.fld_root___childrendersize__, this.cl_int_buffer_1); + this.proxyData.fld_root___draw__ = new CLDataWrapper(this, this.fld_root___draw__, this.cl_int_buffer_1); + this.proxyData.fld_root___selfrendersize__ = new CLDataWrapper(this, this.fld_root___selfrendersize__, this.cl_int_buffer_1); + this.proxyData.id = new CLDataWrapper(this, this.id, this.cl_nodeindex_buffer_1); + this.proxyData.left_siblings = new CLDataWrapper(this, this.left_siblings, this.cl_nodeindex_buffer_1); + this.proxyData.parent = new CLDataWrapper(this, this.parent, this.cl_nodeindex_buffer_1); + this.proxyData.refname = new CLDataWrapper(this, this.refname, this.cl_grammartokens_buffer_1); + this.proxyData.right_siblings = new CLDataWrapper(this, this.right_siblings, this.cl_nodeindex_buffer_1); +}; + +this.getRenderBufferSize = function() { + return this.proxyData.fld_iroot___rendersize__.get(0); +}; + +this.classToToken = function (classStr) { + switch(classStr.toUpperCase()) { + case "CHILD": + return 5; + break; + case "CHILDS": + return 6; + break; + case "UNDEFINED": + return 12; + break; + case "ROOT": + return 10; + break; + case "HBOX": + return 7; + break; + case "LEAF": + return 9; + break; + case "IGNORE": + return 8; + break; + case "TEXTBOX": + return 11; + break; + default: + console.error("unknown class tag " +classStr); + throw 'Superconductor data flattening exn'; + } +}; + + +this.classToIFace = function (classStr) { + switch(classStr.toUpperCase()) { + case "ROOT": + return "iroot"; + break; + case "HBOX": + return "node"; + break; + case "LEAF": + return "node"; + break; + } +}; + + + this.inputs = [ + "glBufferMacro" , "refname" , "display" ]; + + + +this.offsets = "enum unionvariants {TOK_CHILD = 5, TOK_ROOT = 10, TOK_IGNORE = 8, TOK_CHILDS = 6, TOK_LEAF = 9, TOK_UNDEFINED = 12, TOK_HBOX = 7, TOK_TEXTBOX = 11};\n\n// Generated code. Modifcation to this file will be lost on next code generation.\n\n/**\n * @file cl_runner_generated_buffer_info.h\n * @author Superconductor v0.1\n * @date 03/06/2013 16:50:30\n * @brief Contains macros needed to access fields within monolithic OpenCL\n * buffers.\n * \n * @warning Generated code. Modifcation to this file will be lost on next\n * code generation.\n *\n * This file defines several sets of macros intended for use with the \n * 'monolithic' OpenCL buffer scheme of superconductor. In short, monolithic\n * buffers are a way of packing multiple different fields (represented by\n * structure-split arrays) into a single OpenCL buffer so as to minimize the\n * number of arguments needed to be passed to OpenCL.\n *\n * The macros contained here are of three classes:\n * @li @c buffer_name_size The number of fields packed into buffer buffer_name.\n * @li @c NUM_BUFFERS The total number of buffers define herein.\n * @li @c fld_class_property(node_idx) Macro to access the specified property of\n * for the node at node_idx.\n */\n\n#define FLOAT_BUFFER_1_SIZE 17\n#define INT_BUFFER_1_SIZE 31\n#define GRAMMARTOKENS_BUFFER_1_SIZE 2\n#define NODEINDEX_BUFFER_1_SIZE 6\n\n#define fld_hbox___childsrendersize___init(node_idx) int_buffer_1[tree_size * 21 + node_idx]\n#define FLD_HBOX_USCOREUSCORECHILDSRENDERSIZEUSCOREUSCORE_INIT_POSITION 21\n#define FLD_HBOX_USCOREUSCORECHILDSRENDERSIZEUSCOREUSCORE_INIT_BUFFER int_buffer_1\n#define fld_leaf___draw__(node_idx) int_buffer_1[tree_size * 29 + node_idx]\n#define FLD_LEAF_USCOREUSCOREDRAWUSCOREUSCORE_POSITION 29\n#define FLD_LEAF_USCOREUSCOREDRAWUSCOREUSCORE_BUFFER int_buffer_1\n#define fld_node_depth(node_idx) int_buffer_1[tree_size * 8 + node_idx]\n#define FLD_NODE_DEPTH_POSITION 8\n#define FLD_NODE_DEPTH_BUFFER int_buffer_1\n#define fld_hbox_child_childs_count(node_idx) int_buffer_1[tree_size * 18 + node_idx]\n#define FLD_HBOX_CHILD_CHILDS_COUNT_POSITION 18\n#define FLD_HBOX_CHILD_CHILDS_COUNT_BUFFER int_buffer_1\n#define fld_hbox_h_init(node_idx) float_buffer_1[tree_size * 15 + node_idx]\n#define FLD_HBOX_H_INIT_POSITION 15\n#define FLD_HBOX_H_INIT_BUFFER float_buffer_1\n#define fld_hbox___draw__0(node_idx) int_buffer_1[tree_size * 15 + node_idx]\n#define FLD_HBOX_USCOREUSCOREDRAWUSCOREUSCORE0_POSITION 15\n#define FLD_HBOX_USCOREUSCOREDRAWUSCOREUSCORE0_BUFFER int_buffer_1\n#define fld_root___selfrendersize__(node_idx) int_buffer_1[tree_size * 10 + node_idx]\n#define FLD_ROOT_USCOREUSCORESELFRENDERSIZEUSCOREUSCORE_POSITION 10\n#define FLD_ROOT_USCOREUSCORESELFRENDERSIZEUSCOREUSCORE_BUFFER int_buffer_1\n#define fld_hbox_childs___renderrightoffset___last(node_idx) int_buffer_1[tree_size * 26 + node_idx]\n#define FLD_HBOX_CHILDS_USCOREUSCORERENDERRIGHTOFFSETUSCOREUSCORE_LAST_POSITION 26\n#define FLD_HBOX_CHILDS_USCOREUSCORERENDERRIGHTOFFSETUSCOREUSCORE_LAST_BUFFER int_buffer_1\n#define fld_root___draw__(node_idx) int_buffer_1[tree_size * 9 + node_idx]\n#define FLD_ROOT_USCOREUSCOREDRAWUSCOREUSCORE_POSITION 9\n#define FLD_ROOT_USCOREUSCOREDRAWUSCOREUSCORE_BUFFER int_buffer_1\n#define fld_hbox_childs_x_last(node_idx) float_buffer_1[tree_size * 10 + node_idx]\n#define FLD_HBOX_CHILDS_X_LAST_POSITION 10\n#define FLD_HBOX_CHILDS_X_LAST_BUFFER float_buffer_1\n#define fld_hbox_childs_y_last(node_idx) float_buffer_1[tree_size * 14 + node_idx]\n#define FLD_HBOX_CHILDS_Y_LAST_POSITION 14\n#define FLD_HBOX_CHILDS_Y_LAST_BUFFER float_buffer_1\n#define fld_hbox_childs_x_init(node_idx) float_buffer_1[tree_size * 9 + node_idx]\n#define FLD_HBOX_CHILDS_X_INIT_POSITION 9\n#define FLD_HBOX_CHILDS_X_INIT_BUFFER float_buffer_1\n#define fld_hbox_childs___dorenderinglast___init(node_idx) int_buffer_1[tree_size * 19 + node_idx]\n#define FLD_HBOX_CHILDS_USCOREUSCOREDORENDERINGLASTUSCOREUSCORE_INIT_POSITION 19\n#define FLD_HBOX_CHILDS_USCOREUSCOREDORENDERINGLASTUSCOREUSCORE_INIT_BUFFER int_buffer_1\n#define fld_root___childrendersize__(node_idx) int_buffer_1[tree_size * 11 + node_idx]\n#define FLD_ROOT_USCOREUSCORECHILDRENDERSIZEUSCOREUSCORE_POSITION 11\n#define FLD_ROOT_USCOREUSCORECHILDRENDERSIZEUSCOREUSCORE_BUFFER int_buffer_1\n#define fld_iroot_w(node_idx) float_buffer_1[tree_size * 0 + node_idx]\n#define FLD_IROOT_W_POSITION 0\n#define FLD_IROOT_W_BUFFER float_buffer_1\n#define fld_iroot___dorenderinglast__(node_idx) int_buffer_1[tree_size * 3 + node_idx]\n#define FLD_IROOT_USCOREUSCOREDORENDERINGLASTUSCOREUSCORE_POSITION 3\n#define FLD_IROOT_USCOREUSCOREDORENDERINGLASTUSCOREUSCORE_BUFFER int_buffer_1\n#define fld_hbox___childsrendersize___last(node_idx) int_buffer_1[tree_size * 22 + node_idx]\n#define FLD_HBOX_USCOREUSCORECHILDSRENDERSIZEUSCOREUSCORE_LAST_POSITION 22\n#define FLD_HBOX_USCOREUSCORECHILDSRENDERSIZEUSCOREUSCORE_LAST_BUFFER int_buffer_1\n#define fld_hbox_childs___renderrightoffset___init(node_idx) int_buffer_1[tree_size * 25 + node_idx]\n#define FLD_HBOX_CHILDS_USCOREUSCORERENDERRIGHTOFFSETUSCOREUSCORE_INIT_POSITION 25\n#define FLD_HBOX_CHILDS_USCOREUSCORERENDERRIGHTOFFSETUSCOREUSCORE_INIT_BUFFER int_buffer_1\n#define fld_iroot___renderrightoffset__(node_idx) int_buffer_1[tree_size * 0 + node_idx]\n#define FLD_IROOT_USCOREUSCORERENDERRIGHTOFFSETUSCOREUSCORE_POSITION 0\n#define FLD_IROOT_USCOREUSCORERENDERRIGHTOFFSETUSCOREUSCORE_BUFFER int_buffer_1\n#define fld_node___rendersize__(node_idx) int_buffer_1[tree_size * 6 + node_idx]\n#define FLD_NODE_USCOREUSCORERENDERSIZEUSCOREUSCORE_POSITION 6\n#define FLD_NODE_USCOREUSCORERENDERSIZEUSCOREUSCORE_BUFFER int_buffer_1\n#define fld_hbox_w_last(node_idx) float_buffer_1[tree_size * 8 + node_idx]\n#define FLD_HBOX_W_LAST_POSITION 8\n#define FLD_HBOX_W_LAST_BUFFER float_buffer_1\n#define fld_hbox___childsrendersize__(node_idx) int_buffer_1[tree_size * 13 + node_idx]\n#define FLD_HBOX_USCOREUSCORECHILDSRENDERSIZEUSCOREUSCORE_POSITION 13\n#define FLD_HBOX_USCOREUSCORECHILDSRENDERSIZEUSCOREUSCORE_BUFFER int_buffer_1\n#define id(node_idx) nodeindex_buffer_1[tree_size * 5 + node_idx]\n#define ID_POSITION 5\n#define ID_BUFFER nodeindex_buffer_1\n#define fld_hbox_childs___dorenderinglast___last(node_idx) int_buffer_1[tree_size * 20 + node_idx]\n#define FLD_HBOX_CHILDS_USCOREUSCOREDORENDERINGLASTUSCOREUSCORE_LAST_POSITION 20\n#define FLD_HBOX_CHILDS_USCOREUSCOREDORENDERINGLASTUSCOREUSCORE_LAST_BUFFER int_buffer_1\n#define fld_leaf___draw__0(node_idx) int_buffer_1[tree_size * 28 + node_idx]\n#define FLD_LEAF_USCOREUSCOREDRAWUSCOREUSCORE0_POSITION 28\n#define FLD_LEAF_USCOREUSCOREDRAWUSCOREUSCORE0_BUFFER int_buffer_1\n#define fld_hbox_childs_depth_last(node_idx) int_buffer_1[tree_size * 24 + node_idx]\n#define FLD_HBOX_CHILDS_DEPTH_LAST_POSITION 24\n#define FLD_HBOX_CHILDS_DEPTH_LAST_BUFFER int_buffer_1\n#define fld_hbox___selfrendersize__(node_idx) int_buffer_1[tree_size * 17 + node_idx]\n#define FLD_HBOX_USCOREUSCORESELFRENDERSIZEUSCOREUSCORE_POSITION 17\n#define FLD_HBOX_USCOREUSCORESELFRENDERSIZEUSCOREUSCORE_BUFFER int_buffer_1\n#define left_siblings(node_idx) nodeindex_buffer_1[tree_size * 3 + node_idx]\n#define LEFT_SIBLINGS_POSITION 3\n#define LEFT_SIBLINGS_BUFFER nodeindex_buffer_1\n#define fld_leaf___selfrendersize__(node_idx) int_buffer_1[tree_size * 30 + node_idx]\n#define FLD_LEAF_USCOREUSCORESELFRENDERSIZEUSCOREUSCORE_POSITION 30\n#define FLD_LEAF_USCOREUSCORESELFRENDERSIZEUSCOREUSCORE_BUFFER int_buffer_1\n#define fld_root_child_child_count(node_idx) int_buffer_1[tree_size * 12 + node_idx]\n#define FLD_ROOT_CHILD_CHILD_COUNT_POSITION 12\n#define FLD_ROOT_CHILD_CHILD_COUNT_BUFFER int_buffer_1\n#define fld_iroot___renderoffset__(node_idx) int_buffer_1[tree_size * 1 + node_idx]\n#define FLD_IROOT_USCOREUSCORERENDEROFFSETUSCOREUSCORE_POSITION 1\n#define FLD_IROOT_USCOREUSCORERENDEROFFSETUSCOREUSCORE_BUFFER int_buffer_1\n#define fld_iroot_h(node_idx) float_buffer_1[tree_size * 1 + node_idx]\n#define FLD_IROOT_H_POSITION 1\n#define FLD_IROOT_H_BUFFER float_buffer_1\n#define parent(node_idx) nodeindex_buffer_1[tree_size * 4 + node_idx]\n#define PARENT_POSITION 4\n#define PARENT_BUFFER nodeindex_buffer_1\n#define fld_node___dorenderinglast__(node_idx) int_buffer_1[tree_size * 7 + node_idx]\n#define FLD_NODE_USCOREUSCOREDORENDERINGLASTUSCOREUSCORE_POSITION 7\n#define FLD_NODE_USCOREUSCOREDORENDERINGLASTUSCOREUSCORE_BUFFER int_buffer_1\n#define fld_node_w(node_idx) float_buffer_1[tree_size * 2 + node_idx]\n#define FLD_NODE_W_POSITION 2\n#define FLD_NODE_W_BUFFER float_buffer_1\n#define fld_iroot___rendersize__(node_idx) int_buffer_1[tree_size * 2 + node_idx]\n#define FLD_IROOT_USCOREUSCORERENDERSIZEUSCOREUSCORE_POSITION 2\n#define FLD_IROOT_USCOREUSCORERENDERSIZEUSCOREUSCORE_BUFFER int_buffer_1\n#define right_siblings(node_idx) nodeindex_buffer_1[tree_size * 2 + node_idx]\n#define RIGHT_SIBLINGS_POSITION 2\n#define RIGHT_SIBLINGS_BUFFER nodeindex_buffer_1\n#define fld_hbox_w_init(node_idx) float_buffer_1[tree_size * 7 + node_idx]\n#define FLD_HBOX_W_INIT_POSITION 7\n#define FLD_HBOX_W_INIT_BUFFER float_buffer_1\n#define displayname(node_idx) grammartokens_buffer_1[tree_size * 0 + node_idx]\n#define DISPLAYNAME_POSITION 0\n#define DISPLAYNAME_BUFFER grammartokens_buffer_1\n#define fld_leaf___selfrendersize__0(node_idx) int_buffer_1[tree_size * 27 + node_idx]\n#define FLD_LEAF_USCOREUSCORESELFRENDERSIZEUSCOREUSCORE0_POSITION 27\n#define FLD_LEAF_USCOREUSCORESELFRENDERSIZEUSCOREUSCORE0_BUFFER int_buffer_1\n#define fld_hbox_childs_depth_init(node_idx) int_buffer_1[tree_size * 23 + node_idx]\n#define FLD_HBOX_CHILDS_DEPTH_INIT_POSITION 23\n#define FLD_HBOX_CHILDS_DEPTH_INIT_BUFFER int_buffer_1\n#define fld_node_rx(node_idx) float_buffer_1[tree_size * 4 + node_idx]\n#define FLD_NODE_RX_POSITION 4\n#define FLD_NODE_RX_BUFFER float_buffer_1\n#define fld_hbox_childs_rx_init(node_idx) float_buffer_1[tree_size * 11 + node_idx]\n#define FLD_HBOX_CHILDS_RX_INIT_POSITION 11\n#define FLD_HBOX_CHILDS_RX_INIT_BUFFER float_buffer_1\n#define fld_root_child_child_leftmost_child(node_idx) nodeindex_buffer_1[tree_size * 0 + node_idx]\n#define FLD_ROOT_CHILD_CHILD_LEFTMOST_CHILD_POSITION 0\n#define FLD_ROOT_CHILD_CHILD_LEFTMOST_CHILD_BUFFER nodeindex_buffer_1\n#define fld_hbox_childs_rx_last(node_idx) float_buffer_1[tree_size * 12 + node_idx]\n#define FLD_HBOX_CHILDS_RX_LAST_POSITION 12\n#define FLD_HBOX_CHILDS_RX_LAST_BUFFER float_buffer_1\n#define fld_hbox___selfrendersize__0(node_idx) int_buffer_1[tree_size * 14 + node_idx]\n#define FLD_HBOX_USCOREUSCORESELFRENDERSIZEUSCOREUSCORE0_POSITION 14\n#define FLD_HBOX_USCOREUSCORESELFRENDERSIZEUSCOREUSCORE0_BUFFER int_buffer_1\n#define fld_node___renderrightoffset__(node_idx) int_buffer_1[tree_size * 4 + node_idx]\n#define FLD_NODE_USCOREUSCORERENDERRIGHTOFFSETUSCOREUSCORE_POSITION 4\n#define FLD_NODE_USCOREUSCORERENDERRIGHTOFFSETUSCOREUSCORE_BUFFER int_buffer_1\n#define fld_hbox_childs_y_init(node_idx) float_buffer_1[tree_size * 13 + node_idx]\n#define FLD_HBOX_CHILDS_Y_INIT_POSITION 13\n#define FLD_HBOX_CHILDS_Y_INIT_BUFFER float_buffer_1\n#define refname(node_idx) grammartokens_buffer_1[tree_size * 1 + node_idx]\n#define REFNAME_POSITION 1\n#define REFNAME_BUFFER grammartokens_buffer_1\n#define fld_node___renderoffset__(node_idx) int_buffer_1[tree_size * 5 + node_idx]\n#define FLD_NODE_USCOREUSCORERENDEROFFSETUSCOREUSCORE_POSITION 5\n#define FLD_NODE_USCOREUSCORERENDEROFFSETUSCOREUSCORE_BUFFER int_buffer_1\n#define fld_hbox___draw__(node_idx) int_buffer_1[tree_size * 16 + node_idx]\n#define FLD_HBOX_USCOREUSCOREDRAWUSCOREUSCORE_POSITION 16\n#define FLD_HBOX_USCOREUSCOREDRAWUSCOREUSCORE_BUFFER int_buffer_1\n#define fld_hbox_child_childs_leftmost_child(node_idx) nodeindex_buffer_1[tree_size * 1 + node_idx]\n#define FLD_HBOX_CHILD_CHILDS_LEFTMOST_CHILD_POSITION 1\n#define FLD_HBOX_CHILD_CHILDS_LEFTMOST_CHILD_BUFFER nodeindex_buffer_1\n#define fld_node_h(node_idx) float_buffer_1[tree_size * 5 + node_idx]\n#define FLD_NODE_H_POSITION 5\n#define FLD_NODE_H_BUFFER float_buffer_1\n#define fld_hbox_h_last(node_idx) float_buffer_1[tree_size * 16 + node_idx]\n#define FLD_HBOX_H_LAST_POSITION 16\n#define FLD_HBOX_H_LAST_BUFFER float_buffer_1\n#define fld_node_y(node_idx) float_buffer_1[tree_size * 3 + node_idx]\n#define FLD_NODE_Y_POSITION 3\n#define FLD_NODE_Y_BUFFER float_buffer_1\n#define fld_node_x(node_idx) float_buffer_1[tree_size * 6 + node_idx]\n#define FLD_NODE_X_POSITION 6\n#define FLD_NODE_X_BUFFER float_buffer_1\n"; diff --git a/examples/boxes/kernels.visualization b/examples/boxes/kernels.visualization new file mode 100644 index 0000000..719e9f8 --- /dev/null +++ b/examples/boxes/kernels.visualization @@ -0,0 +1,296 @@ +this._gen_getKernels = function() { + this._gen_kernel_visit_0 = this.program.createKernel("visit_0"); + this._gen_kernel_visit_1 = this.program.createKernel("visit_1"); + this._gen_kernel_visit_2 = this.program.createKernel("visit_2"); + this._gen_kernel_visit_3 = this.program.createKernel("visit_3"); + this._gen_kernel_visit_4 = this.program.createKernel("visit_4"); +}; + + +this._gen_allocateClBuffers = function() { + this.cl_float_buffer_1 = this.context.createBuffer(this.cl.MEM_READ_WRITE, this.float_buffer_1.byteLength); + this.cl_int_buffer_1 = this.context.createBuffer(this.cl.MEM_READ_WRITE, this.int_buffer_1.byteLength); + this.cl_grammartokens_buffer_1 = this.context.createBuffer(this.cl.MEM_READ_WRITE, this.grammartokens_buffer_1.byteLength); + this.cl_nodeindex_buffer_1 = this.context.createBuffer(this.cl.MEM_READ_WRITE, this.nodeindex_buffer_1.byteLength); +}; + + +this._gen_transferTree = function() { + this.queue.enqueueWriteBuffer(this.cl_float_buffer_1, true, 0, this.float_buffer_1.byteLength, this.float_buffer_1); + this.queue.enqueueWriteBuffer(this.cl_int_buffer_1, true, 0, this.int_buffer_1.byteLength, this.int_buffer_1); + this.queue.enqueueWriteBuffer(this.cl_grammartokens_buffer_1, true, 0, this.grammartokens_buffer_1.byteLength, this.grammartokens_buffer_1); + this.queue.enqueueWriteBuffer(this.cl_nodeindex_buffer_1, true, 0, this.nodeindex_buffer_1.byteLength, this.nodeindex_buffer_1); +}; + + +this._gen_retrieveTree = function() { + this.queue.enqueueReadBuffer(this.cl_float_buffer_1, true, 0, this.float_buffer_1.byteLength, this.float_buffer_1); + this.queue.enqueueReadBuffer(this.cl_int_buffer_1, true, 0, this.int_buffer_1.byteLength, this.int_buffer_1); + this.queue.enqueueReadBuffer(this.cl_grammartokens_buffer_1, true, 0, this.grammartokens_buffer_1.byteLength, this.grammartokens_buffer_1); + this.queue.enqueueReadBuffer(this.cl_nodeindex_buffer_1, true, 0, this.nodeindex_buffer_1.byteLength, this.nodeindex_buffer_1); +}; + + +this._gen_setKernelArguments = function(kernel) { + var types = WebCLKernelArgumentTypes; + kernel.setArg(0, 0, types.UINT); // start_idx (default to 0) + kernel.setArg(1, this.tree_size, types.UINT); + kernel.setArg(2, this.cl_float_buffer_1); + kernel.setArg(3, this.cl_int_buffer_1); + kernel.setArg(4, this.cl_grammartokens_buffer_1); + kernel.setArg(5, this.cl_nodeindex_buffer_1); +}; + + +this._gen_runTraversals = function() { + this._gen_run_visit_0(); + this._gen_run_visit_1(); + this._gen_run_visit_2(); + this._gen_run_visit_3(); +}; + + +this._gen_run_visit_0 = function() { + this._gen_setKernelArguments(this._gen_kernel_visit_0); + this.topDownTraversal(this._gen_kernel_visit_0); +}; + + +this._gen_run_visit_1 = function() { + this._gen_setKernelArguments(this._gen_kernel_visit_1); + this.bottomUpTraversal(this._gen_kernel_visit_1); +}; + + +this._gen_run_visit_2 = function() { + this._gen_setKernelArguments(this._gen_kernel_visit_2); + this.topDownTraversal(this._gen_kernel_visit_2); +}; + + +this._gen_run_visit_3 = function() { + this._gen_setKernelArguments(this._gen_kernel_visit_3); + this.bottomUpTraversal(this._gen_kernel_visit_3); +}; + + +this._gen_run_visit_4 = function(clVBO) { + this._gen_setKernelArguments(this._gen_kernel_visit_4); + this._gen_kernel_visit_4.setArg(6, clVBO); + this.topDownTraversal(this._gen_kernel_visit_4); +}; + + +// Defines all the typed array buffers which will store data locally before +// sending it to the CL device, then populates them with data +this._gen_allocateHostBuffers = function(treeSize) { + this.FLOAT_BUFFER_1_SIZE = 17; + this.float_buffer_1 = new Float32Array(this.FLOAT_BUFFER_1_SIZE * treeSize); + this.INT_BUFFER_1_SIZE = 31; + this.int_buffer_1 = new Int32Array(this.INT_BUFFER_1_SIZE * treeSize); + this.GRAMMARTOKENS_BUFFER_1_SIZE = 2; + this.grammartokens_buffer_1 = new Int32Array(this.GRAMMARTOKENS_BUFFER_1_SIZE * treeSize); + this.NODEINDEX_BUFFER_1_SIZE = 6; + this.nodeindex_buffer_1 = new Int32Array(this.NODEINDEX_BUFFER_1_SIZE * treeSize); +}; + +this._gen_allocateHostProxies = function (treeSize) { + this.displayname = this.grammartokens_buffer_1.subarray(treeSize * 0, (treeSize * 0) + treeSize); + this.fld_hbox_child_childs_count = this.int_buffer_1.subarray(treeSize * 18, (treeSize * 18) + treeSize); + this.fld_hbox_child_childs_leftmost_child = this.nodeindex_buffer_1.subarray(treeSize * 1, (treeSize * 1) + treeSize); + this.fld_hbox_childs_depth_init = this.int_buffer_1.subarray(treeSize * 23, (treeSize * 23) + treeSize); + this.fld_hbox_childs_depth_last = this.int_buffer_1.subarray(treeSize * 24, (treeSize * 24) + treeSize); + this.fld_hbox_childs_rx_init = this.float_buffer_1.subarray(treeSize * 11, (treeSize * 11) + treeSize); + this.fld_hbox_childs_rx_last = this.float_buffer_1.subarray(treeSize * 12, (treeSize * 12) + treeSize); + this.fld_hbox_childs___dorenderinglast___init = this.int_buffer_1.subarray(treeSize * 19, (treeSize * 19) + treeSize); + this.fld_hbox_childs___dorenderinglast___last = this.int_buffer_1.subarray(treeSize * 20, (treeSize * 20) + treeSize); + this.fld_hbox_childs___renderrightoffset___init = this.int_buffer_1.subarray(treeSize * 25, (treeSize * 25) + treeSize); + this.fld_hbox_childs___renderrightoffset___last = this.int_buffer_1.subarray(treeSize * 26, (treeSize * 26) + treeSize); + this.fld_hbox_childs_x_init = this.float_buffer_1.subarray(treeSize * 9, (treeSize * 9) + treeSize); + this.fld_hbox_childs_x_last = this.float_buffer_1.subarray(treeSize * 10, (treeSize * 10) + treeSize); + this.fld_hbox_childs_y_init = this.float_buffer_1.subarray(treeSize * 13, (treeSize * 13) + treeSize); + this.fld_hbox_childs_y_last = this.float_buffer_1.subarray(treeSize * 14, (treeSize * 14) + treeSize); + this.fld_hbox_h_init = this.float_buffer_1.subarray(treeSize * 15, (treeSize * 15) + treeSize); + this.fld_hbox_h_last = this.float_buffer_1.subarray(treeSize * 16, (treeSize * 16) + treeSize); + this.fld_hbox___childsrendersize__ = this.int_buffer_1.subarray(treeSize * 13, (treeSize * 13) + treeSize); + this.fld_hbox___childsrendersize___init = this.int_buffer_1.subarray(treeSize * 21, (treeSize * 21) + treeSize); + this.fld_hbox___childsrendersize___last = this.int_buffer_1.subarray(treeSize * 22, (treeSize * 22) + treeSize); + this.fld_hbox___draw__ = this.int_buffer_1.subarray(treeSize * 16, (treeSize * 16) + treeSize); + this.fld_hbox___draw__0 = this.int_buffer_1.subarray(treeSize * 15, (treeSize * 15) + treeSize); + this.fld_hbox___selfrendersize__ = this.int_buffer_1.subarray(treeSize * 17, (treeSize * 17) + treeSize); + this.fld_hbox___selfrendersize__0 = this.int_buffer_1.subarray(treeSize * 14, (treeSize * 14) + treeSize); + this.fld_hbox_w_init = this.float_buffer_1.subarray(treeSize * 7, (treeSize * 7) + treeSize); + this.fld_hbox_w_last = this.float_buffer_1.subarray(treeSize * 8, (treeSize * 8) + treeSize); + this.fld_iroot_h = this.float_buffer_1.subarray(treeSize * 1, (treeSize * 1) + treeSize); + this.fld_iroot___dorenderinglast__ = this.int_buffer_1.subarray(treeSize * 3, (treeSize * 3) + treeSize); + this.fld_iroot___renderoffset__ = this.int_buffer_1.subarray(treeSize * 1, (treeSize * 1) + treeSize); + this.fld_iroot___renderrightoffset__ = this.int_buffer_1.subarray(treeSize * 0, (treeSize * 0) + treeSize); + this.fld_iroot___rendersize__ = this.int_buffer_1.subarray(treeSize * 2, (treeSize * 2) + treeSize); + this.fld_iroot_w = this.float_buffer_1.subarray(treeSize * 0, (treeSize * 0) + treeSize); + this.fld_leaf___draw__ = this.int_buffer_1.subarray(treeSize * 29, (treeSize * 29) + treeSize); + this.fld_leaf___draw__0 = this.int_buffer_1.subarray(treeSize * 28, (treeSize * 28) + treeSize); + this.fld_leaf___selfrendersize__ = this.int_buffer_1.subarray(treeSize * 30, (treeSize * 30) + treeSize); + this.fld_leaf___selfrendersize__0 = this.int_buffer_1.subarray(treeSize * 27, (treeSize * 27) + treeSize); + this.fld_node_depth = this.int_buffer_1.subarray(treeSize * 8, (treeSize * 8) + treeSize); + this.fld_node_h = this.float_buffer_1.subarray(treeSize * 5, (treeSize * 5) + treeSize); + this.fld_node_rx = this.float_buffer_1.subarray(treeSize * 4, (treeSize * 4) + treeSize); + this.fld_node___dorenderinglast__ = this.int_buffer_1.subarray(treeSize * 7, (treeSize * 7) + treeSize); + this.fld_node___renderoffset__ = this.int_buffer_1.subarray(treeSize * 5, (treeSize * 5) + treeSize); + this.fld_node___renderrightoffset__ = this.int_buffer_1.subarray(treeSize * 4, (treeSize * 4) + treeSize); + this.fld_node___rendersize__ = this.int_buffer_1.subarray(treeSize * 6, (treeSize * 6) + treeSize); + this.fld_node_w = this.float_buffer_1.subarray(treeSize * 2, (treeSize * 2) + treeSize); + this.fld_node_x = this.float_buffer_1.subarray(treeSize * 6, (treeSize * 6) + treeSize); + this.fld_node_y = this.float_buffer_1.subarray(treeSize * 3, (treeSize * 3) + treeSize); + this.fld_root_child_child_count = this.int_buffer_1.subarray(treeSize * 12, (treeSize * 12) + treeSize); + this.fld_root_child_child_leftmost_child = this.nodeindex_buffer_1.subarray(treeSize * 0, (treeSize * 0) + treeSize); + this.fld_root___childrendersize__ = this.int_buffer_1.subarray(treeSize * 11, (treeSize * 11) + treeSize); + this.fld_root___draw__ = this.int_buffer_1.subarray(treeSize * 9, (treeSize * 9) + treeSize); + this.fld_root___selfrendersize__ = this.int_buffer_1.subarray(treeSize * 10, (treeSize * 10) + treeSize); + this.id = this.nodeindex_buffer_1.subarray(treeSize * 5, (treeSize * 5) + treeSize); + this.left_siblings = this.nodeindex_buffer_1.subarray(treeSize * 3, (treeSize * 3) + treeSize); + this.parent = this.nodeindex_buffer_1.subarray(treeSize * 4, (treeSize * 4) + treeSize); + this.refname = this.grammartokens_buffer_1.subarray(treeSize * 1, (treeSize * 1) + treeSize); + this.right_siblings = this.nodeindex_buffer_1.subarray(treeSize * 2, (treeSize * 2) + treeSize); +}; + + +this._gen_copyHostBuffers = function (data, treeSize){ + for(var i = 0; i < data.float_buffer_1.length; i++) { + this.float_buffer_1[i] = data.float_buffer_1[i]; + } + + for(var i = 0; i < data.int_buffer_1.length; i++) { + this.int_buffer_1[i] = data.int_buffer_1[i]; + } + + for(var i = 0; i < data.grammartokens_buffer_1.length; i++) { + this.grammartokens_buffer_1[i] = data.grammartokens_buffer_1[i]; + } + + for(var i = 0; i < data.nodeindex_buffer_1.length; i++) { + this.nodeindex_buffer_1[i] = data.nodeindex_buffer_1[i]; + } + +}; + + +// Creates proxy object to wrap every field in the tree. Both host and cl buffers must be allocated +// before calling this function. +this._gen_allocateProxyObjects = function() { + this.proxyData.displayname = new CLDataWrapper(this, this.displayname, this.cl_grammartokens_buffer_1); + this.proxyData.fld_hbox_child_childs_count = new CLDataWrapper(this, this.fld_hbox_child_childs_count, this.cl_int_buffer_1); + this.proxyData.fld_hbox_child_childs_leftmost_child = new CLDataWrapper(this, this.fld_hbox_child_childs_leftmost_child, this.cl_nodeindex_buffer_1); + this.proxyData.fld_hbox_childs_depth_init = new CLDataWrapper(this, this.fld_hbox_childs_depth_init, this.cl_int_buffer_1); + this.proxyData.fld_hbox_childs_depth_last = new CLDataWrapper(this, this.fld_hbox_childs_depth_last, this.cl_int_buffer_1); + this.proxyData.fld_hbox_childs_rx_init = new CLDataWrapper(this, this.fld_hbox_childs_rx_init, this.cl_float_buffer_1); + this.proxyData.fld_hbox_childs_rx_last = new CLDataWrapper(this, this.fld_hbox_childs_rx_last, this.cl_float_buffer_1); + this.proxyData.fld_hbox_childs___dorenderinglast___init = new CLDataWrapper(this, this.fld_hbox_childs___dorenderinglast___init, this.cl_int_buffer_1); + this.proxyData.fld_hbox_childs___dorenderinglast___last = new CLDataWrapper(this, this.fld_hbox_childs___dorenderinglast___last, this.cl_int_buffer_1); + this.proxyData.fld_hbox_childs___renderrightoffset___init = new CLDataWrapper(this, this.fld_hbox_childs___renderrightoffset___init, this.cl_int_buffer_1); + this.proxyData.fld_hbox_childs___renderrightoffset___last = new CLDataWrapper(this, this.fld_hbox_childs___renderrightoffset___last, this.cl_int_buffer_1); + this.proxyData.fld_hbox_childs_x_init = new CLDataWrapper(this, this.fld_hbox_childs_x_init, this.cl_float_buffer_1); + this.proxyData.fld_hbox_childs_x_last = new CLDataWrapper(this, this.fld_hbox_childs_x_last, this.cl_float_buffer_1); + this.proxyData.fld_hbox_childs_y_init = new CLDataWrapper(this, this.fld_hbox_childs_y_init, this.cl_float_buffer_1); + this.proxyData.fld_hbox_childs_y_last = new CLDataWrapper(this, this.fld_hbox_childs_y_last, this.cl_float_buffer_1); + this.proxyData.fld_hbox_h_init = new CLDataWrapper(this, this.fld_hbox_h_init, this.cl_float_buffer_1); + this.proxyData.fld_hbox_h_last = new CLDataWrapper(this, this.fld_hbox_h_last, this.cl_float_buffer_1); + this.proxyData.fld_hbox___childsrendersize__ = new CLDataWrapper(this, this.fld_hbox___childsrendersize__, this.cl_int_buffer_1); + this.proxyData.fld_hbox___childsrendersize___init = new CLDataWrapper(this, this.fld_hbox___childsrendersize___init, this.cl_int_buffer_1); + this.proxyData.fld_hbox___childsrendersize___last = new CLDataWrapper(this, this.fld_hbox___childsrendersize___last, this.cl_int_buffer_1); + this.proxyData.fld_hbox___draw__ = new CLDataWrapper(this, this.fld_hbox___draw__, this.cl_int_buffer_1); + this.proxyData.fld_hbox___draw__0 = new CLDataWrapper(this, this.fld_hbox___draw__0, this.cl_int_buffer_1); + this.proxyData.fld_hbox___selfrendersize__ = new CLDataWrapper(this, this.fld_hbox___selfrendersize__, this.cl_int_buffer_1); + this.proxyData.fld_hbox___selfrendersize__0 = new CLDataWrapper(this, this.fld_hbox___selfrendersize__0, this.cl_int_buffer_1); + this.proxyData.fld_hbox_w_init = new CLDataWrapper(this, this.fld_hbox_w_init, this.cl_float_buffer_1); + this.proxyData.fld_hbox_w_last = new CLDataWrapper(this, this.fld_hbox_w_last, this.cl_float_buffer_1); + this.proxyData.fld_iroot_h = new CLDataWrapper(this, this.fld_iroot_h, this.cl_float_buffer_1); + this.proxyData.fld_iroot___dorenderinglast__ = new CLDataWrapper(this, this.fld_iroot___dorenderinglast__, this.cl_int_buffer_1); + this.proxyData.fld_iroot___renderoffset__ = new CLDataWrapper(this, this.fld_iroot___renderoffset__, this.cl_int_buffer_1); + this.proxyData.fld_iroot___renderrightoffset__ = new CLDataWrapper(this, this.fld_iroot___renderrightoffset__, this.cl_int_buffer_1); + this.proxyData.fld_iroot___rendersize__ = new CLDataWrapper(this, this.fld_iroot___rendersize__, this.cl_int_buffer_1); + this.proxyData.fld_iroot_w = new CLDataWrapper(this, this.fld_iroot_w, this.cl_float_buffer_1); + this.proxyData.fld_leaf___draw__ = new CLDataWrapper(this, this.fld_leaf___draw__, this.cl_int_buffer_1); + this.proxyData.fld_leaf___draw__0 = new CLDataWrapper(this, this.fld_leaf___draw__0, this.cl_int_buffer_1); + this.proxyData.fld_leaf___selfrendersize__ = new CLDataWrapper(this, this.fld_leaf___selfrendersize__, this.cl_int_buffer_1); + this.proxyData.fld_leaf___selfrendersize__0 = new CLDataWrapper(this, this.fld_leaf___selfrendersize__0, this.cl_int_buffer_1); + this.proxyData.fld_node_depth = new CLDataWrapper(this, this.fld_node_depth, this.cl_int_buffer_1); + this.proxyData.fld_node_h = new CLDataWrapper(this, this.fld_node_h, this.cl_float_buffer_1); + this.proxyData.fld_node_rx = new CLDataWrapper(this, this.fld_node_rx, this.cl_float_buffer_1); + this.proxyData.fld_node___dorenderinglast__ = new CLDataWrapper(this, this.fld_node___dorenderinglast__, this.cl_int_buffer_1); + this.proxyData.fld_node___renderoffset__ = new CLDataWrapper(this, this.fld_node___renderoffset__, this.cl_int_buffer_1); + this.proxyData.fld_node___renderrightoffset__ = new CLDataWrapper(this, this.fld_node___renderrightoffset__, this.cl_int_buffer_1); + this.proxyData.fld_node___rendersize__ = new CLDataWrapper(this, this.fld_node___rendersize__, this.cl_int_buffer_1); + this.proxyData.fld_node_w = new CLDataWrapper(this, this.fld_node_w, this.cl_float_buffer_1); + this.proxyData.fld_node_x = new CLDataWrapper(this, this.fld_node_x, this.cl_float_buffer_1); + this.proxyData.fld_node_y = new CLDataWrapper(this, this.fld_node_y, this.cl_float_buffer_1); + this.proxyData.fld_root_child_child_count = new CLDataWrapper(this, this.fld_root_child_child_count, this.cl_int_buffer_1); + this.proxyData.fld_root_child_child_leftmost_child = new CLDataWrapper(this, this.fld_root_child_child_leftmost_child, this.cl_nodeindex_buffer_1); + this.proxyData.fld_root___childrendersize__ = new CLDataWrapper(this, this.fld_root___childrendersize__, this.cl_int_buffer_1); + this.proxyData.fld_root___draw__ = new CLDataWrapper(this, this.fld_root___draw__, this.cl_int_buffer_1); + this.proxyData.fld_root___selfrendersize__ = new CLDataWrapper(this, this.fld_root___selfrendersize__, this.cl_int_buffer_1); + this.proxyData.id = new CLDataWrapper(this, this.id, this.cl_nodeindex_buffer_1); + this.proxyData.left_siblings = new CLDataWrapper(this, this.left_siblings, this.cl_nodeindex_buffer_1); + this.proxyData.parent = new CLDataWrapper(this, this.parent, this.cl_nodeindex_buffer_1); + this.proxyData.refname = new CLDataWrapper(this, this.refname, this.cl_grammartokens_buffer_1); + this.proxyData.right_siblings = new CLDataWrapper(this, this.right_siblings, this.cl_nodeindex_buffer_1); +}; + +this.getRenderBufferSize = function() { + return this.proxyData.fld_iroot___rendersize__.get(0); +}; + +this.classToToken = function (classStr) { + switch(classStr.toUpperCase()) { + case "CHILD": + return 5; + break; + case "CHILDS": + return 6; + break; + case "UNDEFINED": + return 12; + break; + case "ROOT": + return 10; + break; + case "HBOX": + return 7; + break; + case "LEAF": + return 9; + break; + case "IGNORE": + return 8; + break; + case "TEXTBOX": + return 11; + break; + default: + console.error("unknown class tag " +classStr); + throw 'Superconductor data flattening exn'; + } +}; + + +this.classToIFace = function (classStr) { + switch(classStr.toUpperCase()) { + case "ROOT": + return "iroot"; + break; + case "HBOX": + return "node"; + break; + case "LEAF": + return "node"; + break; + } +}; + + + this.inputs = [ + "glBufferMacro" , "refname" , "display" ]; + + + +this.offsets = "enum unionvariants {TOK_CHILD = 5, TOK_ROOT = 10, TOK_IGNORE = 8, TOK_CHILDS = 6, TOK_LEAF = 9, TOK_UNDEFINED = 12, TOK_HBOX = 7, TOK_TEXTBOX = 11};\n\n// Generated code. Modifcation to this file will be lost on next code generation.\n\n/**\n * @file cl_runner_generated_buffer_info.h\n * @author Superconductor v0.1\n * @date 03/06/2013 16:50:30\n * @brief Contains macros needed to access fields within monolithic OpenCL\n * buffers.\n * \n * @warning Generated code. Modifcation to this file will be lost on next\n * code generation.\n *\n * This file defines several sets of macros intended for use with the \n * 'monolithic' OpenCL buffer scheme of superconductor. In short, monolithic\n * buffers are a way of packing multiple different fields (represented by\n * structure-split arrays) into a single OpenCL buffer so as to minimize the\n * number of arguments needed to be passed to OpenCL.\n *\n * The macros contained here are of three classes:\n * @li @c buffer_name_size The number of fields packed into buffer buffer_name.\n * @li @c NUM_BUFFERS The total number of buffers define herein.\n * @li @c fld_class_property(node_idx) Macro to access the specified property of\n * for the node at node_idx.\n */\n\n#define FLOAT_BUFFER_1_SIZE 17\n#define INT_BUFFER_1_SIZE 31\n#define GRAMMARTOKENS_BUFFER_1_SIZE 2\n#define NODEINDEX_BUFFER_1_SIZE 6\n\n#define fld_hbox___childsrendersize___init(node_idx) int_buffer_1[tree_size * 21 + node_idx]\n#define FLD_HBOX_USCOREUSCORECHILDSRENDERSIZEUSCOREUSCORE_INIT_POSITION 21\n#define FLD_HBOX_USCOREUSCORECHILDSRENDERSIZEUSCOREUSCORE_INIT_BUFFER int_buffer_1\n#define fld_leaf___draw__(node_idx) int_buffer_1[tree_size * 29 + node_idx]\n#define FLD_LEAF_USCOREUSCOREDRAWUSCOREUSCORE_POSITION 29\n#define FLD_LEAF_USCOREUSCOREDRAWUSCOREUSCORE_BUFFER int_buffer_1\n#define fld_node_depth(node_idx) int_buffer_1[tree_size * 8 + node_idx]\n#define FLD_NODE_DEPTH_POSITION 8\n#define FLD_NODE_DEPTH_BUFFER int_buffer_1\n#define fld_hbox_child_childs_count(node_idx) int_buffer_1[tree_size * 18 + node_idx]\n#define FLD_HBOX_CHILD_CHILDS_COUNT_POSITION 18\n#define FLD_HBOX_CHILD_CHILDS_COUNT_BUFFER int_buffer_1\n#define fld_hbox_h_init(node_idx) float_buffer_1[tree_size * 15 + node_idx]\n#define FLD_HBOX_H_INIT_POSITION 15\n#define FLD_HBOX_H_INIT_BUFFER float_buffer_1\n#define fld_hbox___draw__0(node_idx) int_buffer_1[tree_size * 15 + node_idx]\n#define FLD_HBOX_USCOREUSCOREDRAWUSCOREUSCORE0_POSITION 15\n#define FLD_HBOX_USCOREUSCOREDRAWUSCOREUSCORE0_BUFFER int_buffer_1\n#define fld_root___selfrendersize__(node_idx) int_buffer_1[tree_size * 10 + node_idx]\n#define FLD_ROOT_USCOREUSCORESELFRENDERSIZEUSCOREUSCORE_POSITION 10\n#define FLD_ROOT_USCOREUSCORESELFRENDERSIZEUSCOREUSCORE_BUFFER int_buffer_1\n#define fld_hbox_childs___renderrightoffset___last(node_idx) int_buffer_1[tree_size * 26 + node_idx]\n#define FLD_HBOX_CHILDS_USCOREUSCORERENDERRIGHTOFFSETUSCOREUSCORE_LAST_POSITION 26\n#define FLD_HBOX_CHILDS_USCOREUSCORERENDERRIGHTOFFSETUSCOREUSCORE_LAST_BUFFER int_buffer_1\n#define fld_root___draw__(node_idx) int_buffer_1[tree_size * 9 + node_idx]\n#define FLD_ROOT_USCOREUSCOREDRAWUSCOREUSCORE_POSITION 9\n#define FLD_ROOT_USCOREUSCOREDRAWUSCOREUSCORE_BUFFER int_buffer_1\n#define fld_hbox_childs_x_last(node_idx) float_buffer_1[tree_size * 10 + node_idx]\n#define FLD_HBOX_CHILDS_X_LAST_POSITION 10\n#define FLD_HBOX_CHILDS_X_LAST_BUFFER float_buffer_1\n#define fld_hbox_childs_y_last(node_idx) float_buffer_1[tree_size * 14 + node_idx]\n#define FLD_HBOX_CHILDS_Y_LAST_POSITION 14\n#define FLD_HBOX_CHILDS_Y_LAST_BUFFER float_buffer_1\n#define fld_hbox_childs_x_init(node_idx) float_buffer_1[tree_size * 9 + node_idx]\n#define FLD_HBOX_CHILDS_X_INIT_POSITION 9\n#define FLD_HBOX_CHILDS_X_INIT_BUFFER float_buffer_1\n#define fld_hbox_childs___dorenderinglast___init(node_idx) int_buffer_1[tree_size * 19 + node_idx]\n#define FLD_HBOX_CHILDS_USCOREUSCOREDORENDERINGLASTUSCOREUSCORE_INIT_POSITION 19\n#define FLD_HBOX_CHILDS_USCOREUSCOREDORENDERINGLASTUSCOREUSCORE_INIT_BUFFER int_buffer_1\n#define fld_root___childrendersize__(node_idx) int_buffer_1[tree_size * 11 + node_idx]\n#define FLD_ROOT_USCOREUSCORECHILDRENDERSIZEUSCOREUSCORE_POSITION 11\n#define FLD_ROOT_USCOREUSCORECHILDRENDERSIZEUSCOREUSCORE_BUFFER int_buffer_1\n#define fld_iroot_w(node_idx) float_buffer_1[tree_size * 0 + node_idx]\n#define FLD_IROOT_W_POSITION 0\n#define FLD_IROOT_W_BUFFER float_buffer_1\n#define fld_iroot___dorenderinglast__(node_idx) int_buffer_1[tree_size * 3 + node_idx]\n#define FLD_IROOT_USCOREUSCOREDORENDERINGLASTUSCOREUSCORE_POSITION 3\n#define FLD_IROOT_USCOREUSCOREDORENDERINGLASTUSCOREUSCORE_BUFFER int_buffer_1\n#define fld_hbox___childsrendersize___last(node_idx) int_buffer_1[tree_size * 22 + node_idx]\n#define FLD_HBOX_USCOREUSCORECHILDSRENDERSIZEUSCOREUSCORE_LAST_POSITION 22\n#define FLD_HBOX_USCOREUSCORECHILDSRENDERSIZEUSCOREUSCORE_LAST_BUFFER int_buffer_1\n#define fld_hbox_childs___renderrightoffset___init(node_idx) int_buffer_1[tree_size * 25 + node_idx]\n#define FLD_HBOX_CHILDS_USCOREUSCORERENDERRIGHTOFFSETUSCOREUSCORE_INIT_POSITION 25\n#define FLD_HBOX_CHILDS_USCOREUSCORERENDERRIGHTOFFSETUSCOREUSCORE_INIT_BUFFER int_buffer_1\n#define fld_iroot___renderrightoffset__(node_idx) int_buffer_1[tree_size * 0 + node_idx]\n#define FLD_IROOT_USCOREUSCORERENDERRIGHTOFFSETUSCOREUSCORE_POSITION 0\n#define FLD_IROOT_USCOREUSCORERENDERRIGHTOFFSETUSCOREUSCORE_BUFFER int_buffer_1\n#define fld_node___rendersize__(node_idx) int_buffer_1[tree_size * 6 + node_idx]\n#define FLD_NODE_USCOREUSCORERENDERSIZEUSCOREUSCORE_POSITION 6\n#define FLD_NODE_USCOREUSCORERENDERSIZEUSCOREUSCORE_BUFFER int_buffer_1\n#define fld_hbox_w_last(node_idx) float_buffer_1[tree_size * 8 + node_idx]\n#define FLD_HBOX_W_LAST_POSITION 8\n#define FLD_HBOX_W_LAST_BUFFER float_buffer_1\n#define fld_hbox___childsrendersize__(node_idx) int_buffer_1[tree_size * 13 + node_idx]\n#define FLD_HBOX_USCOREUSCORECHILDSRENDERSIZEUSCOREUSCORE_POSITION 13\n#define FLD_HBOX_USCOREUSCORECHILDSRENDERSIZEUSCOREUSCORE_BUFFER int_buffer_1\n#define id(node_idx) nodeindex_buffer_1[tree_size * 5 + node_idx]\n#define ID_POSITION 5\n#define ID_BUFFER nodeindex_buffer_1\n#define fld_hbox_childs___dorenderinglast___last(node_idx) int_buffer_1[tree_size * 20 + node_idx]\n#define FLD_HBOX_CHILDS_USCOREUSCOREDORENDERINGLASTUSCOREUSCORE_LAST_POSITION 20\n#define FLD_HBOX_CHILDS_USCOREUSCOREDORENDERINGLASTUSCOREUSCORE_LAST_BUFFER int_buffer_1\n#define fld_leaf___draw__0(node_idx) int_buffer_1[tree_size * 28 + node_idx]\n#define FLD_LEAF_USCOREUSCOREDRAWUSCOREUSCORE0_POSITION 28\n#define FLD_LEAF_USCOREUSCOREDRAWUSCOREUSCORE0_BUFFER int_buffer_1\n#define fld_hbox_childs_depth_last(node_idx) int_buffer_1[tree_size * 24 + node_idx]\n#define FLD_HBOX_CHILDS_DEPTH_LAST_POSITION 24\n#define FLD_HBOX_CHILDS_DEPTH_LAST_BUFFER int_buffer_1\n#define fld_hbox___selfrendersize__(node_idx) int_buffer_1[tree_size * 17 + node_idx]\n#define FLD_HBOX_USCOREUSCORESELFRENDERSIZEUSCOREUSCORE_POSITION 17\n#define FLD_HBOX_USCOREUSCORESELFRENDERSIZEUSCOREUSCORE_BUFFER int_buffer_1\n#define left_siblings(node_idx) nodeindex_buffer_1[tree_size * 3 + node_idx]\n#define LEFT_SIBLINGS_POSITION 3\n#define LEFT_SIBLINGS_BUFFER nodeindex_buffer_1\n#define fld_leaf___selfrendersize__(node_idx) int_buffer_1[tree_size * 30 + node_idx]\n#define FLD_LEAF_USCOREUSCORESELFRENDERSIZEUSCOREUSCORE_POSITION 30\n#define FLD_LEAF_USCOREUSCORESELFRENDERSIZEUSCOREUSCORE_BUFFER int_buffer_1\n#define fld_root_child_child_count(node_idx) int_buffer_1[tree_size * 12 + node_idx]\n#define FLD_ROOT_CHILD_CHILD_COUNT_POSITION 12\n#define FLD_ROOT_CHILD_CHILD_COUNT_BUFFER int_buffer_1\n#define fld_iroot___renderoffset__(node_idx) int_buffer_1[tree_size * 1 + node_idx]\n#define FLD_IROOT_USCOREUSCORERENDEROFFSETUSCOREUSCORE_POSITION 1\n#define FLD_IROOT_USCOREUSCORERENDEROFFSETUSCOREUSCORE_BUFFER int_buffer_1\n#define fld_iroot_h(node_idx) float_buffer_1[tree_size * 1 + node_idx]\n#define FLD_IROOT_H_POSITION 1\n#define FLD_IROOT_H_BUFFER float_buffer_1\n#define parent(node_idx) nodeindex_buffer_1[tree_size * 4 + node_idx]\n#define PARENT_POSITION 4\n#define PARENT_BUFFER nodeindex_buffer_1\n#define fld_node___dorenderinglast__(node_idx) int_buffer_1[tree_size * 7 + node_idx]\n#define FLD_NODE_USCOREUSCOREDORENDERINGLASTUSCOREUSCORE_POSITION 7\n#define FLD_NODE_USCOREUSCOREDORENDERINGLASTUSCOREUSCORE_BUFFER int_buffer_1\n#define fld_node_w(node_idx) float_buffer_1[tree_size * 2 + node_idx]\n#define FLD_NODE_W_POSITION 2\n#define FLD_NODE_W_BUFFER float_buffer_1\n#define fld_iroot___rendersize__(node_idx) int_buffer_1[tree_size * 2 + node_idx]\n#define FLD_IROOT_USCOREUSCORERENDERSIZEUSCOREUSCORE_POSITION 2\n#define FLD_IROOT_USCOREUSCORERENDERSIZEUSCOREUSCORE_BUFFER int_buffer_1\n#define right_siblings(node_idx) nodeindex_buffer_1[tree_size * 2 + node_idx]\n#define RIGHT_SIBLINGS_POSITION 2\n#define RIGHT_SIBLINGS_BUFFER nodeindex_buffer_1\n#define fld_hbox_w_init(node_idx) float_buffer_1[tree_size * 7 + node_idx]\n#define FLD_HBOX_W_INIT_POSITION 7\n#define FLD_HBOX_W_INIT_BUFFER float_buffer_1\n#define displayname(node_idx) grammartokens_buffer_1[tree_size * 0 + node_idx]\n#define DISPLAYNAME_POSITION 0\n#define DISPLAYNAME_BUFFER grammartokens_buffer_1\n#define fld_leaf___selfrendersize__0(node_idx) int_buffer_1[tree_size * 27 + node_idx]\n#define FLD_LEAF_USCOREUSCORESELFRENDERSIZEUSCOREUSCORE0_POSITION 27\n#define FLD_LEAF_USCOREUSCORESELFRENDERSIZEUSCOREUSCORE0_BUFFER int_buffer_1\n#define fld_hbox_childs_depth_init(node_idx) int_buffer_1[tree_size * 23 + node_idx]\n#define FLD_HBOX_CHILDS_DEPTH_INIT_POSITION 23\n#define FLD_HBOX_CHILDS_DEPTH_INIT_BUFFER int_buffer_1\n#define fld_node_rx(node_idx) float_buffer_1[tree_size * 4 + node_idx]\n#define FLD_NODE_RX_POSITION 4\n#define FLD_NODE_RX_BUFFER float_buffer_1\n#define fld_hbox_childs_rx_init(node_idx) float_buffer_1[tree_size * 11 + node_idx]\n#define FLD_HBOX_CHILDS_RX_INIT_POSITION 11\n#define FLD_HBOX_CHILDS_RX_INIT_BUFFER float_buffer_1\n#define fld_root_child_child_leftmost_child(node_idx) nodeindex_buffer_1[tree_size * 0 + node_idx]\n#define FLD_ROOT_CHILD_CHILD_LEFTMOST_CHILD_POSITION 0\n#define FLD_ROOT_CHILD_CHILD_LEFTMOST_CHILD_BUFFER nodeindex_buffer_1\n#define fld_hbox_childs_rx_last(node_idx) float_buffer_1[tree_size * 12 + node_idx]\n#define FLD_HBOX_CHILDS_RX_LAST_POSITION 12\n#define FLD_HBOX_CHILDS_RX_LAST_BUFFER float_buffer_1\n#define fld_hbox___selfrendersize__0(node_idx) int_buffer_1[tree_size * 14 + node_idx]\n#define FLD_HBOX_USCOREUSCORESELFRENDERSIZEUSCOREUSCORE0_POSITION 14\n#define FLD_HBOX_USCOREUSCORESELFRENDERSIZEUSCOREUSCORE0_BUFFER int_buffer_1\n#define fld_node___renderrightoffset__(node_idx) int_buffer_1[tree_size * 4 + node_idx]\n#define FLD_NODE_USCOREUSCORERENDERRIGHTOFFSETUSCOREUSCORE_POSITION 4\n#define FLD_NODE_USCOREUSCORERENDERRIGHTOFFSETUSCOREUSCORE_BUFFER int_buffer_1\n#define fld_hbox_childs_y_init(node_idx) float_buffer_1[tree_size * 13 + node_idx]\n#define FLD_HBOX_CHILDS_Y_INIT_POSITION 13\n#define FLD_HBOX_CHILDS_Y_INIT_BUFFER float_buffer_1\n#define refname(node_idx) grammartokens_buffer_1[tree_size * 1 + node_idx]\n#define REFNAME_POSITION 1\n#define REFNAME_BUFFER grammartokens_buffer_1\n#define fld_node___renderoffset__(node_idx) int_buffer_1[tree_size * 5 + node_idx]\n#define FLD_NODE_USCOREUSCORERENDEROFFSETUSCOREUSCORE_POSITION 5\n#define FLD_NODE_USCOREUSCORERENDEROFFSETUSCOREUSCORE_BUFFER int_buffer_1\n#define fld_hbox___draw__(node_idx) int_buffer_1[tree_size * 16 + node_idx]\n#define FLD_HBOX_USCOREUSCOREDRAWUSCOREUSCORE_POSITION 16\n#define FLD_HBOX_USCOREUSCOREDRAWUSCOREUSCORE_BUFFER int_buffer_1\n#define fld_hbox_child_childs_leftmost_child(node_idx) nodeindex_buffer_1[tree_size * 1 + node_idx]\n#define FLD_HBOX_CHILD_CHILDS_LEFTMOST_CHILD_POSITION 1\n#define FLD_HBOX_CHILD_CHILDS_LEFTMOST_CHILD_BUFFER nodeindex_buffer_1\n#define fld_node_h(node_idx) float_buffer_1[tree_size * 5 + node_idx]\n#define FLD_NODE_H_POSITION 5\n#define FLD_NODE_H_BUFFER float_buffer_1\n#define fld_hbox_h_last(node_idx) float_buffer_1[tree_size * 16 + node_idx]\n#define FLD_HBOX_H_LAST_POSITION 16\n#define FLD_HBOX_H_LAST_BUFFER float_buffer_1\n#define fld_node_y(node_idx) float_buffer_1[tree_size * 3 + node_idx]\n#define FLD_NODE_Y_POSITION 3\n#define FLD_NODE_Y_BUFFER float_buffer_1\n#define fld_node_x(node_idx) float_buffer_1[tree_size * 6 + node_idx]\n#define FLD_NODE_X_POSITION 6\n#define FLD_NODE_X_BUFFER float_buffer_1\n"; +this.kernelSource = ["enum unionvariants {TOK_CHILD = 5, TOK_ROOT = 10, TOK_IGNORE = 8, TOK_CHILDS = 6, TOK_LEAF = 9, TOK_UNDEFINED = 12, TOK_HBOX = 7, TOK_TEXTBOX = 11};\n\n// Generated code. Modifcation to this file will be lost on next code generation.\n\n/**\n * @file cl_runner_generated_buffer_info.h\n * @author Superconductor v0.1\n * @date 03/06/2013 16:50:30\n * @brief Contains macros needed to access fields within monolithic OpenCL\n * buffers.\n * \n * @warning Generated code. Modifcation to this file will be lost on next\n * code generation.\n *\n * This file defines several sets of macros intended for use with the \n * 'monolithic' OpenCL buffer scheme of superconductor. In short, monolithic\n * buffers are a way of packing multiple different fields (represented by\n * structure-split arrays) into a single OpenCL buffer so as to minimize the\n * number of arguments needed to be passed to OpenCL.\n *\n * The macros contained here are of three classes:\n * @li @c buffer_name_size The number of fields packed into buffer buffer_name.\n * @li @c NUM_BUFFERS The total number of buffers define herein.\n * @li @c fld_class_property(node_idx) Macro to access the specified property of\n * for the node at node_idx.\n */\n\n#define FLOAT_BUFFER_1_SIZE 17\n#define INT_BUFFER_1_SIZE 31\n#define GRAMMARTOKENS_BUFFER_1_SIZE 2\n#define NODEINDEX_BUFFER_1_SIZE 6\n\n#define fld_hbox___childsrendersize___init(node_idx) int_buffer_1[tree_size * 21 + node_idx]\n#define FLD_HBOX_USCOREUSCORECHILDSRENDERSIZEUSCOREUSCORE_INIT_POSITION 21\n#define FLD_HBOX_USCOREUSCORECHILDSRENDERSIZEUSCOREUSCORE_INIT_BUFFER int_buffer_1\n#define fld_leaf___draw__(node_idx) int_buffer_1[tree_size * 29 + node_idx]\n#define FLD_LEAF_USCOREUSCOREDRAWUSCOREUSCORE_POSITION 29\n#define FLD_LEAF_USCOREUSCOREDRAWUSCOREUSCORE_BUFFER int_buffer_1\n#define fld_node_depth(node_idx) int_buffer_1[tree_size * 8 + node_idx]\n#define FLD_NODE_DEPTH_POSITION 8\n#define FLD_NODE_DEPTH_BUFFER int_buffer_1\n#define fld_hbox_child_childs_count(node_idx) int_buffer_1[tree_size * 18 + node_idx]\n#define FLD_HBOX_CHILD_CHILDS_COUNT_POSITION 18\n#define FLD_HBOX_CHILD_CHILDS_COUNT_BUFFER int_buffer_1\n#define fld_hbox_h_init(node_idx) float_buffer_1[tree_size * 15 + node_idx]\n#define FLD_HBOX_H_INIT_POSITION 15\n#define FLD_HBOX_H_INIT_BUFFER float_buffer_1\n#define fld_hbox___draw__0(node_idx) int_buffer_1[tree_size * 15 + node_idx]\n#define FLD_HBOX_USCOREUSCOREDRAWUSCOREUSCORE0_POSITION 15\n#define FLD_HBOX_USCOREUSCOREDRAWUSCOREUSCORE0_BUFFER int_buffer_1\n#define fld_root___selfrendersize__(node_idx) int_buffer_1[tree_size * 10 + node_idx]\n#define FLD_ROOT_USCOREUSCORESELFRENDERSIZEUSCOREUSCORE_POSITION 10\n#define FLD_ROOT_USCOREUSCORESELFRENDERSIZEUSCOREUSCORE_BUFFER int_buffer_1\n#define fld_hbox_childs___renderrightoffset___last(node_idx) int_buffer_1[tree_size * 26 + node_idx]\n#define FLD_HBOX_CHILDS_USCOREUSCORERENDERRIGHTOFFSETUSCOREUSCORE_LAST_POSITION 26\n#define FLD_HBOX_CHILDS_USCOREUSCORERENDERRIGHTOFFSETUSCOREUSCORE_LAST_BUFFER int_buffer_1\n#define fld_root___draw__(node_idx) int_buffer_1[tree_size * 9 + node_idx]\n#define FLD_ROOT_USCOREUSCOREDRAWUSCOREUSCORE_POSITION 9\n#define FLD_ROOT_USCOREUSCOREDRAWUSCOREUSCORE_BUFFER int_buffer_1\n#define fld_hbox_childs_x_last(node_idx) float_buffer_1[tree_size * 10 + node_idx]\n#define FLD_HBOX_CHILDS_X_LAST_POSITION 10\n#define FLD_HBOX_CHILDS_X_LAST_BUFFER float_buffer_1\n#define fld_hbox_childs_y_last(node_idx) float_buffer_1[tree_size * 14 + node_idx]\n#define FLD_HBOX_CHILDS_Y_LAST_POSITION 14\n#define FLD_HBOX_CHILDS_Y_LAST_BUFFER float_buffer_1\n#define fld_hbox_childs_x_init(node_idx) float_buffer_1[tree_size * 9 + node_idx]\n#define FLD_HBOX_CHILDS_X_INIT_POSITION 9\n#define FLD_HBOX_CHILDS_X_INIT_BUFFER float_buffer_1\n#define fld_hbox_childs___dorenderinglast___init(node_idx) int_buffer_1[tree_size * 19 + node_idx]\n#define FLD_HBOX_CHILDS_USCOREUSCOREDORENDERINGLASTUSCOREUSCORE_INIT_POSITION 19\n#define FLD_HBOX_CHILDS_USCOREUSCOREDORENDERINGLASTUSCOREUSCORE_INIT_BUFFER int_buffer_1\n#define fld_root___childrendersize__(node_idx) int_buffer_1[tree_size * 11 + node_idx]\n#define FLD_ROOT_USCOREUSCORECHILDRENDERSIZEUSCOREUSCORE_POSITION 11\n#define FLD_ROOT_USCOREUSCORECHILDRENDERSIZEUSCOREUSCORE_BUFFER int_buffer_1\n#define fld_iroot_w(node_idx) float_buffer_1[tree_size * 0 + node_idx]\n#define FLD_IROOT_W_POSITION 0\n#define FLD_IROOT_W_BUFFER float_buffer_1\n#define fld_iroot___dorenderinglast__(node_idx) int_buffer_1[tree_size * 3 + node_idx]\n#define FLD_IROOT_USCOREUSCOREDORENDERINGLASTUSCOREUSCORE_POSITION 3\n#define FLD_IROOT_USCOREUSCOREDORENDERINGLASTUSCOREUSCORE_BUFFER int_buffer_1\n#define fld_hbox___childsrendersize___last(node_idx) int_buffer_1[tree_size * 22 + node_idx]\n#define FLD_HBOX_USCOREUSCORECHILDSRENDERSIZEUSCOREUSCORE_LAST_POSITION 22\n#define FLD_HBOX_USCOREUSCORECHILDSRENDERSIZEUSCOREUSCORE_LAST_BUFFER int_buffer_1\n#define fld_hbox_childs___renderrightoffset___init(node_idx) int_buffer_1[tree_size * 25 + node_idx]\n#define FLD_HBOX_CHILDS_USCOREUSCORERENDERRIGHTOFFSETUSCOREUSCORE_INIT_POSITION 25\n#define FLD_HBOX_CHILDS_USCOREUSCORERENDERRIGHTOFFSETUSCOREUSCORE_INIT_BUFFER int_buffer_1\n#define fld_iroot___renderrightoffset__(node_idx) int_buffer_1[tree_size * 0 + node_idx]\n#define FLD_IROOT_USCOREUSCORERENDERRIGHTOFFSETUSCOREUSCORE_POSITION 0\n#define FLD_IROOT_USCOREUSCORERENDERRIGHTOFFSETUSCOREUSCORE_BUFFER int_buffer_1\n#define fld_node___rendersize__(node_idx) int_buffer_1[tree_size * 6 + node_idx]\n#define FLD_NODE_USCOREUSCORERENDERSIZEUSCOREUSCORE_POSITION 6\n#define FLD_NODE_USCOREUSCORERENDERSIZEUSCOREUSCORE_BUFFER int_buffer_1\n#define fld_hbox_w_last(node_idx) float_buffer_1[tree_size * 8 + node_idx]\n#define FLD_HBOX_W_LAST_POSITION 8\n#define FLD_HBOX_W_LAST_BUFFER float_buffer_1\n#define fld_hbox___childsrendersize__(node_idx) int_buffer_1[tree_size * 13 + node_idx]\n#define FLD_HBOX_USCOREUSCORECHILDSRENDERSIZEUSCOREUSCORE_POSITION 13\n#define FLD_HBOX_USCOREUSCORECHILDSRENDERSIZEUSCOREUSCORE_BUFFER int_buffer_1\n#define id(node_idx) nodeindex_buffer_1[tree_size * 5 + node_idx]\n#define ID_POSITION 5\n#define ID_BUFFER nodeindex_buffer_1\n#define fld_hbox_childs___dorenderinglast___last(node_idx) int_buffer_1[tree_size * 20 + node_idx]\n#define FLD_HBOX_CHILDS_USCOREUSCOREDORENDERINGLASTUSCOREUSCORE_LAST_POSITION 20\n#define FLD_HBOX_CHILDS_USCOREUSCOREDORENDERINGLASTUSCOREUSCORE_LAST_BUFFER int_buffer_1\n#define fld_leaf___draw__0(node_idx) int_buffer_1[tree_size * 28 + node_idx]\n#define FLD_LEAF_USCOREUSCOREDRAWUSCOREUSCORE0_POSITION 28\n#define FLD_LEAF_USCOREUSCOREDRAWUSCOREUSCORE0_BUFFER int_buffer_1\n#define fld_hbox_childs_depth_last(node_idx) int_buffer_1[tree_size * 24 + node_idx]\n#define FLD_HBOX_CHILDS_DEPTH_LAST_POSITION 24\n#define FLD_HBOX_CHILDS_DEPTH_LAST_BUFFER int_buffer_1\n#define fld_hbox___selfrendersize__(node_idx) int_buffer_1[tree_size * 17 + node_idx]\n#define FLD_HBOX_USCOREUSCORESELFRENDERSIZEUSCOREUSCORE_POSITION 17\n#define FLD_HBOX_USCOREUSCORESELFRENDERSIZEUSCOREUSCORE_BUFFER int_buffer_1\n#define left_siblings(node_idx) nodeindex_buffer_1[tree_size * 3 + node_idx]\n#define LEFT_SIBLINGS_POSITION 3\n#define LEFT_SIBLINGS_BUFFER nodeindex_buffer_1\n#define fld_leaf___selfrendersize__(node_idx) int_buffer_1[tree_size * 30 + node_idx]\n#define FLD_LEAF_USCOREUSCORESELFRENDERSIZEUSCOREUSCORE_POSITION 30\n#define FLD_LEAF_USCOREUSCORESELFRENDERSIZEUSCOREUSCORE_BUFFER int_buffer_1\n#define fld_root_child_child_count(node_idx) int_buffer_1[tree_size * 12 + node_idx]\n#define FLD_ROOT_CHILD_CHILD_COUNT_POSITION 12\n#define FLD_ROOT_CHILD_CHILD_COUNT_BUFFER int_buffer_1\n#define fld_iroot___renderoffset__(node_idx) int_buffer_1[tree_size * 1 + node_idx]\n#define FLD_IROOT_USCOREUSCORERENDEROFFSETUSCOREUSCORE_POSITION 1\n#define FLD_IROOT_USCOREUSCORERENDEROFFSETUSCOREUSCORE_BUFFER int_buffer_1\n#define fld_iroot_h(node_idx) float_buffer_1[tree_size * 1 + node_idx]\n#define FLD_IROOT_H_POSITION 1\n#define FLD_IROOT_H_BUFFER float_buffer_1\n#define parent(node_idx) nodeindex_buffer_1[tree_size * 4 + node_idx]\n#define PARENT_POSITION 4\n#define PARENT_BUFFER nodeindex_buffer_1\n#define fld_node___dorenderinglast__(node_idx) int_buffer_1[tree_size * 7 + node_idx]\n#define FLD_NODE_USCOREUSCOREDORENDERINGLASTUSCOREUSCORE_POSITION 7\n#define FLD_NODE_USCOREUSCOREDORENDERINGLASTUSCOREUSCORE_BUFFER int_buffer_1\n#define fld_node_w(node_idx) float_buffer_1[tree_size * 2 + node_idx]\n#define FLD_NODE_W_POSITION 2\n#define FLD_NODE_W_BUFFER float_buffer_1\n#define fld_iroot___rendersize__(node_idx) int_buffer_1[tree_size * 2 + node_idx]\n#define FLD_IROOT_USCOREUSCORERENDERSIZEUSCOREUSCORE_POSITION 2\n#define FLD_IROOT_USCOREUSCORERENDERSIZEUSCOREUSCORE_BUFFER int_buffer_1\n#define right_siblings(node_idx) nodeindex_buffer_1[tree_size * 2 + node_idx]\n#define RIGHT_SIBLINGS_POSITION 2\n#define RIGHT_SIBLINGS_BUFFER nodeindex_buffer_1\n#define fld_hbox_w_init(node_idx) float_buffer_1[tree_size * 7 + node_idx]\n#define FLD_HBOX_W_INIT_POSITION 7\n#define FLD_HBOX_W_INIT_BUFFER float_buffer_1\n#define displayname(node_idx) grammartokens_buffer_1[tree_size * 0 + node_idx]\n#define DISPLAYNAME_POSITION 0\n#define DISPLAYNAME_BUFFER grammartokens_buffer_1\n#define fld_leaf___selfrendersize__0(node_idx) int_buffer_1[tree_size * 27 + node_idx]\n#define FLD_LEAF_USCOREUSCORESELFRENDERSIZEUSCOREUSCORE0_POSITION 27\n#define FLD_LEAF_USCOREUSCORESELFRENDERSIZEUSCOREUSCORE0_BUFFER int_buffer_1\n#define fld_hbox_childs_depth_init(node_idx) int_buffer_1[tree_size * 23 + node_idx]\n#define FLD_HBOX_CHILDS_DEPTH_INIT_POSITION 23\n#define FLD_HBOX_CHILDS_DEPTH_INIT_BUFFER int_buffer_1\n#define fld_node_rx(node_idx) float_buffer_1[tree_size * 4 + node_idx]\n#define FLD_NODE_RX_POSITION 4\n#define FLD_NODE_RX_BUFFER float_buffer_1\n#define fld_hbox_childs_rx_init(node_idx) float_buffer_1[tree_size * 11 + node_idx]\n#define FLD_HBOX_CHILDS_RX_INIT_POSITION 11\n#define FLD_HBOX_CHILDS_RX_INIT_BUFFER float_buffer_1\n#define fld_root_child_child_leftmost_child(node_idx) nodeindex_buffer_1[tree_size * 0 + node_idx]\n#define FLD_ROOT_CHILD_CHILD_LEFTMOST_CHILD_POSITION 0\n#define FLD_ROOT_CHILD_CHILD_LEFTMOST_CHILD_BUFFER nodeindex_buffer_1\n#define fld_hbox_childs_rx_last(node_idx) float_buffer_1[tree_size * 12 + node_idx]\n#define FLD_HBOX_CHILDS_RX_LAST_POSITION 12\n#define FLD_HBOX_CHILDS_RX_LAST_BUFFER float_buffer_1\n#define fld_hbox___selfrendersize__0(node_idx) int_buffer_1[tree_size * 14 + node_idx]\n#define FLD_HBOX_USCOREUSCORESELFRENDERSIZEUSCOREUSCORE0_POSITION 14\n#define FLD_HBOX_USCOREUSCORESELFRENDERSIZEUSCOREUSCORE0_BUFFER int_buffer_1\n#define fld_node___renderrightoffset__(node_idx) int_buffer_1[tree_size * 4 + node_idx]\n#define FLD_NODE_USCOREUSCORERENDERRIGHTOFFSETUSCOREUSCORE_POSITION 4\n#define FLD_NODE_USCOREUSCORERENDERRIGHTOFFSETUSCOREUSCORE_BUFFER int_buffer_1\n#define fld_hbox_childs_y_init(node_idx) float_buffer_1[tree_size * 13 + node_idx]\n#define FLD_HBOX_CHILDS_Y_INIT_POSITION 13\n#define FLD_HBOX_CHILDS_Y_INIT_BUFFER float_buffer_1\n#define refname(node_idx) grammartokens_buffer_1[tree_size * 1 + node_idx]\n#define REFNAME_POSITION 1\n#define REFNAME_BUFFER grammartokens_buffer_1\n#define fld_node___renderoffset__(node_idx) int_buffer_1[tree_size * 5 + node_idx]\n#define FLD_NODE_USCOREUSCORERENDEROFFSETUSCOREUSCORE_POSITION 5\n#define FLD_NODE_USCOREUSCORERENDEROFFSETUSCOREUSCORE_BUFFER int_buffer_1\n#define fld_hbox___draw__(node_idx) int_buffer_1[tree_size * 16 + node_idx]\n#define FLD_HBOX_USCOREUSCOREDRAWUSCOREUSCORE_POSITION 16\n#define FLD_HBOX_USCOREUSCOREDRAWUSCOREUSCORE_BUFFER int_buffer_1\n#define fld_hbox_child_childs_leftmost_child(node_idx) nodeindex_buffer_1[tree_size * 1 + node_idx]\n#define FLD_HBOX_CHILD_CHILDS_LEFTMOST_CHILD_POSITION 1\n#define FLD_HBOX_CHILD_CHILDS_LEFTMOST_CHILD_BUFFER nodeindex_buffer_1\n#define fld_node_h(node_idx) float_buffer_1[tree_size * 5 + node_idx]\n#define FLD_NODE_H_POSITION 5\n#define FLD_NODE_H_BUFFER float_buffer_1\n#define fld_hbox_h_last(node_idx) float_buffer_1[tree_size * 16 + node_idx]\n#define FLD_HBOX_H_LAST_POSITION 16\n#define FLD_HBOX_H_LAST_BUFFER float_buffer_1\n#define fld_node_y(node_idx) float_buffer_1[tree_size * 3 + node_idx]\n#define FLD_NODE_Y_POSITION 3\n#define FLD_NODE_Y_BUFFER float_buffer_1\n#define fld_node_x(node_idx) float_buffer_1[tree_size * 6 + node_idx]\n#define FLD_NODE_X_POSITION 6\n#define FLD_NODE_X_BUFFER float_buffer_1\nstatic int hbox___renderSize__ (int _ale_arg0, int _ale_arg1) { return (_ale_arg0 + _ale_arg1); }\nstatic float hbox_childs_x (float _ale_arg0, float _ale_arg1) { return (_ale_arg0 - _ale_arg1); }\nstatic int hbox___selfRenderSize__ (int _ale_arg0) { return _ale_arg0; }\nstatic int hbox_childs_depth (int _ale_arg0) { return (_ale_arg0 + 1); }\nstatic int hbox___selfRenderSize__0 (float _ale_arg2, float _ale_arg3, float _ale_arg1, float _ale_arg0) { return RectangleOutline_size(_ale_arg0, _ale_arg1, _ale_arg2, _ale_arg3, rgb(100, 0, 0)); }\nstatic int hbox___draw__ (int _ale_arg0) { return _ale_arg0; }\nstatic int hbox___renderOffset__ (int _ale_arg0, int _ale_arg1) { return (_ale_arg0 - _ale_arg1); }\nstatic int hbox_childs___doRenderingLast__ (int _ale_arg0) { return _ale_arg0; }\nstatic int hbox___draw__0 (float _ale_arg5, int _ale_arg2, int _ale_arg1, __global VertexAndColor* _ale_arg0, int _ale_arg7, float _ale_arg6, float _ale_arg4, float _ale_arg3) { return (RectangleOutline_draw(_ale_arg0, _ale_arg1, _ale_arg2, _ale_arg3, _ale_arg4, _ale_arg5, _ale_arg6, rgb(100, 0, 0)) + _ale_arg7); }\nstatic float hbox_childs_y (float _ale_arg0) { return (_ale_arg0 + 5); }\nstatic int root_child___doRenderingLast__ (int _ale_arg0) { return _ale_arg0; }\nstatic int root___renderOffset__ (int _ale_arg0, int _ale_arg1) { return (_ale_arg0 - _ale_arg1); }\nstatic int root___doRenderingLast__ (int _ale_arg0) { return _ale_arg0; }\nstatic float root_child_y () { return 5; }\nstatic float root_child_rx (float _ale_arg1, float _ale_arg0) { return (_ale_arg0 + _ale_arg1); }\nstatic int root_child___renderRightOffset__ (int _ale_arg2, int _ale_arg1, int _ale_arg0) { return ((_ale_arg0 + _ale_arg1) + _ale_arg2); }\nstatic float root_w (float _ale_arg0) { return (_ale_arg0 + 10); }\nstatic int root___renderRightOffset__ (int _ale_arg0) { return _ale_arg0; }\nstatic int root___draw__ () { return 0; }\nstatic int root___selfRenderSize__ () { return 0; }\nstatic int root___renderSize__ (int _ale_arg1, int _ale_arg0) { return (_ale_arg0 + _ale_arg1); }\nstatic int root___childRenderSize__ (int _ale_arg0) { return _ale_arg0; }\nstatic int root_child_depth () { return 0; }\nstatic float root_child_x () { return 5; }\nstatic float root_h (float _ale_arg0) { return (_ale_arg0 + 10); }\nstatic int leaf___selfRenderSize__ (int _ale_arg0) { return _ale_arg0; }\nstatic int leaf___draw__ (int _ale_arg0) { return _ale_arg0; }\nstatic int leaf___renderSize__ (int _ale_arg0) { return _ale_arg0; }\nstatic int leaf___draw__0 (float _ale_arg5, int _ale_arg2, int _ale_arg1, __global VertexAndColor* _ale_arg0, int _ale_arg7, float _ale_arg6, float _ale_arg4, float _ale_arg3) { return (Rectangle_draw(_ale_arg0, _ale_arg1, _ale_arg2, _ale_arg3, _ale_arg4, _ale_arg5, _ale_arg6, rgb(255, 0, 0)) + _ale_arg7); }\nstatic int leaf___renderOffset__ (int _ale_arg0, int _ale_arg1) { return (_ale_arg0 - _ale_arg1); }\nstatic int leaf___selfRenderSize__0 (float _ale_arg2, float _ale_arg3, float _ale_arg1, float _ale_arg0) { return Rectangle_size(_ale_arg0, _ale_arg1, _ale_arg2, _ale_arg3, rgb(255, 0, 0)); }\nstatic float leaf_w () { return 10; }\nstatic float leaf_h () { return 10; }\n// Generated code. Modifcation to this file will be lost on next code generation.\n\n/**\n * @file traversals.cl\n * @brief OpenCL code to run layout solver traversals.\n */\n\n__kernel void visit_0(unsigned int start_idx, unsigned int tree_size, __global float* float_buffer_1, __global int* int_buffer_1, __global GrammarTokens* grammartokens_buffer_1, __global NodeIndex* nodeindex_buffer_1); \n__kernel void visit_1(unsigned int start_idx, unsigned int tree_size, __global float* float_buffer_1, __global int* int_buffer_1, __global GrammarTokens* grammartokens_buffer_1, __global NodeIndex* nodeindex_buffer_1); \n__kernel void visit_2(unsigned int start_idx, unsigned int tree_size, __global float* float_buffer_1, __global int* int_buffer_1, __global GrammarTokens* grammartokens_buffer_1, __global NodeIndex* nodeindex_buffer_1); \n__kernel void visit_3(unsigned int start_idx, unsigned int tree_size, __global float* float_buffer_1, __global int* int_buffer_1, __global GrammarTokens* grammartokens_buffer_1, __global NodeIndex* nodeindex_buffer_1); \n__kernel void visit_4(unsigned int start_idx, unsigned int tree_size, __global float* float_buffer_1, __global int* int_buffer_1, __global GrammarTokens* grammartokens_buffer_1, __global NodeIndex* nodeindex_buffer_1, __global VertexAndColor* glBuffer); \n\n\n///// pass /////\nvoid visit_leaf_0(unsigned int start_idx, unsigned int tree_size, __global float* float_buffer_1, __global int* int_buffer_1, __global GrammarTokens* grammartokens_buffer_1, __global NodeIndex* nodeindex_buffer_1) {\n\tunsigned int index = get_global_id(0) + start_idx;\n\n\t// Variables needed for loop macro. Declare up top to avoid declaring a\n\t// multitide below, one for every loop\n\tint step = 0;\n\tunsigned int prev_child_idx = 0;\n\n fld_node_h(index) = leaf_h();\n fld_node_w(index) = leaf_w();\n}\n\nvoid visit_root_0(unsigned int start_idx, unsigned int tree_size, __global float* float_buffer_1, __global int* int_buffer_1, __global GrammarTokens* grammartokens_buffer_1, __global NodeIndex* nodeindex_buffer_1) {\n\tunsigned int index = get_global_id(0) + start_idx;\n\n\t// Variables needed for loop macro. Declare up top to avoid declaring a\n\t// multitide below, one for every loop\n\tint step = 0;\n\tunsigned int prev_child_idx = 0;\n\n fld_node_depth(GetAbsoluteIndex(fld_root_child_child_leftmost_child(index), index)) = root_child_depth();\n fld_node_x(GetAbsoluteIndex(fld_root_child_child_leftmost_child(index), index)) = root_child_x();\n fld_node_y(GetAbsoluteIndex(fld_root_child_child_leftmost_child(index), index)) = root_child_y();\n fld_root___draw__(index) = root___draw__();\n fld_root___selfrendersize__(index) = root___selfRenderSize__();\n fld_node___dorenderinglast__(GetAbsoluteIndex(fld_root_child_child_leftmost_child(index), index)) = root_child___doRenderingLast__(fld_root___draw__(index));\n}\n\nvoid visit_hbox_0(unsigned int start_idx, unsigned int tree_size, __global float* float_buffer_1, __global int* int_buffer_1, __global GrammarTokens* grammartokens_buffer_1, __global NodeIndex* nodeindex_buffer_1) {\n\tunsigned int index = get_global_id(0) + start_idx;\n\n\t// Variables needed for loop macro. Declare up top to avoid declaring a\n\t// multitide below, one for every loop\n\tint step = 0;\n\tunsigned int prev_child_idx = 0;\n\n\n SFORLOOPALIAS_OCL(index, fld_hbox_child_childs_leftmost_child, step) {\n fld_node_depth(current_node) = ((fld_node_depth(index) + 1));\n fld_node_y(current_node) = ((fld_node_y(index) + 5));\n } SFORLOOPALIAS_OCL_END();\n}\n\n///// pass /////\nvoid visit_leaf_1(unsigned int start_idx, unsigned int tree_size, __global float* float_buffer_1, __global int* int_buffer_1, __global GrammarTokens* grammartokens_buffer_1, __global NodeIndex* nodeindex_buffer_1) {\n\tunsigned int index = get_global_id(0) + start_idx;\n\n\t// Variables needed for loop macro. Declare up top to avoid declaring a\n\t// multitide below, one for every loop\n\tint step = 0;\n\tunsigned int prev_child_idx = 0;\n\n}\n\nvoid visit_root_1(unsigned int start_idx, unsigned int tree_size, __global float* float_buffer_1, __global int* int_buffer_1, __global GrammarTokens* grammartokens_buffer_1, __global NodeIndex* nodeindex_buffer_1) {\n\tunsigned int index = get_global_id(0) + start_idx;\n\n\t// Variables needed for loop macro. Declare up top to avoid declaring a\n\t// multitide below, one for every loop\n\tint step = 0;\n\tunsigned int prev_child_idx = 0;\n\n fld_node_rx(GetAbsoluteIndex(fld_root_child_child_leftmost_child(index), index)) = root_child_rx(fld_node_w(GetAbsoluteIndex(fld_root_child_child_leftmost_child(index), index)), fld_node_x(GetAbsoluteIndex(fld_root_child_child_leftmost_child(index), index)));\n fld_iroot_h(index) = root_h(fld_node_h(GetAbsoluteIndex(fld_root_child_child_leftmost_child(index), index)));\n fld_iroot_w(index) = root_w(fld_node_w(GetAbsoluteIndex(fld_root_child_child_leftmost_child(index), index)));\n}\n\nvoid visit_hbox_1(unsigned int start_idx, unsigned int tree_size, __global float* float_buffer_1, __global int* int_buffer_1, __global GrammarTokens* grammartokens_buffer_1, __global NodeIndex* nodeindex_buffer_1) {\n\tunsigned int index = get_global_id(0) + start_idx;\n\n\t// Variables needed for loop macro. Declare up top to avoid declaring a\n\t// multitide below, one for every loop\n\tint step = 0;\n\tunsigned int prev_child_idx = 0;\n\n\n SFORLOOPALIAS_OCL(index, fld_hbox_child_childs_leftmost_child, step) {\n } SFORLOOPALIAS_OCL_END();\n\n fld_hbox_h_init(index) = (5);\n fld_node_h(index) = fld_hbox_h_init(index);\n fld_hbox_w_init(index) = (5);\n fld_node_w(index) = fld_hbox_w_init(index);\n SFORLOOPALIAS_OCL(index, fld_hbox_child_childs_leftmost_child, step) {\n fld_node_h(index) = (((fld_node_h(index) > (fld_node_h(current_node) + 10)) ? fld_node_h(index) : (fld_node_h(current_node) + 10)));\n fld_node_w(index) = (((fld_node_w(index) + fld_node_w(current_node)) + 5));\n } SFORLOOPALIAS_OCL_END();\n}\n\n///// pass /////\nvoid visit_leaf_2(unsigned int start_idx, unsigned int tree_size, __global float* float_buffer_1, __global int* int_buffer_1, __global GrammarTokens* grammartokens_buffer_1, __global NodeIndex* nodeindex_buffer_1) {\n\tunsigned int index = get_global_id(0) + start_idx;\n\n\t// Variables needed for loop macro. Declare up top to avoid declaring a\n\t// multitide below, one for every loop\n\tint step = 0;\n\tunsigned int prev_child_idx = 0;\n\n fld_leaf___selfrendersize__0(index) = leaf___selfRenderSize__0(fld_node_w(index), fld_node_h(index), fld_node_y(index), fld_node_x(index));\n fld_leaf___selfrendersize__(index) = leaf___selfRenderSize__(fld_leaf___selfrendersize__0(index));\n fld_node___rendersize__(index) = leaf___renderSize__(fld_leaf___selfrendersize__(index));\n}\n\nvoid visit_root_2(unsigned int start_idx, unsigned int tree_size, __global float* float_buffer_1, __global int* int_buffer_1, __global GrammarTokens* grammartokens_buffer_1, __global NodeIndex* nodeindex_buffer_1) {\n\tunsigned int index = get_global_id(0) + start_idx;\n\n\t// Variables needed for loop macro. Declare up top to avoid declaring a\n\t// multitide below, one for every loop\n\tint step = 0;\n\tunsigned int prev_child_idx = 0;\n\n}\n\nvoid visit_hbox_2(unsigned int start_idx, unsigned int tree_size, __global float* float_buffer_1, __global int* int_buffer_1, __global GrammarTokens* grammartokens_buffer_1, __global NodeIndex* nodeindex_buffer_1) {\n\tunsigned int index = get_global_id(0) + start_idx;\n\n\t// Variables needed for loop macro. Declare up top to avoid declaring a\n\t// multitide below, one for every loop\n\tint step = 0;\n\tunsigned int prev_child_idx = 0;\n\n fld_hbox___selfrendersize__0(index) = hbox___selfRenderSize__0(fld_node_w(index), fld_node_h(index), fld_node_y(index), fld_node_x(index));\n fld_hbox___selfrendersize__(index) = hbox___selfRenderSize__(fld_hbox___selfrendersize__0(index));\n\n fld_hbox_childs_rx_init(index) = (fld_node_x(index) );\n fld_hbox_childs_rx_last(index) = fld_hbox_childs_rx_init(index);\n SFORLOOPALIAS_OCL(index, fld_hbox_child_childs_leftmost_child, step) {\n fld_node_rx(current_node) = ((((STEP() == 1 ? (fld_hbox_childs_rx_last(index)) : (fld_node_rx(PREV_OCL()))) + 5) + fld_node_w(current_node)));\n } SFORLOOPALIAS_OCL_END();\n\n SFORLOOPALIAS_OCL(index, fld_hbox_child_childs_leftmost_child, step) {\n fld_node_x(current_node) = ((fld_node_rx(current_node) - fld_node_w(current_node)));\n } SFORLOOPALIAS_OCL_END();\n}\n\n///// pass /////\nvoid visit_leaf_3(unsigned int start_idx, unsigned int tree_size, __global float* float_buffer_1, __global int* int_buffer_1, __global GrammarTokens* grammartokens_buffer_1, __global NodeIndex* nodeindex_buffer_1) {\n\tunsigned int index = get_global_id(0) + start_idx;\n\n\t// Variables needed for loop macro. Declare up top to avoid declaring a\n\t// multitide below, one for every loop\n\tint step = 0;\n\tunsigned int prev_child_idx = 0;\n\n}\n\nvoid visit_root_3(unsigned int start_idx, unsigned int tree_size, __global float* float_buffer_1, __global int* int_buffer_1, __global GrammarTokens* grammartokens_buffer_1, __global NodeIndex* nodeindex_buffer_1) {\n\tunsigned int index = get_global_id(0) + start_idx;\n\n\t// Variables needed for loop macro. Declare up top to avoid declaring a\n\t// multitide below, one for every loop\n\tint step = 0;\n\tunsigned int prev_child_idx = 0;\n\n fld_root___childrendersize__(index) = root___childRenderSize__(fld_node___rendersize__(GetAbsoluteIndex(fld_root_child_child_leftmost_child(index), index)));\n fld_iroot___rendersize__(index) = root___renderSize__(fld_root___selfrendersize__(index), fld_root___childrendersize__(index));\n fld_iroot___dorenderinglast__(index) = root___doRenderingLast__(fld_iroot___rendersize__(index));\n fld_iroot___renderrightoffset__(index) = root___renderRightOffset__(fld_iroot___rendersize__(index));\n fld_iroot___renderoffset__(index) = root___renderOffset__(fld_iroot___renderrightoffset__(index), fld_iroot___rendersize__(index));\n fld_node___renderrightoffset__(GetAbsoluteIndex(fld_root_child_child_leftmost_child(index), index)) = root_child___renderRightOffset__(fld_node___rendersize__(GetAbsoluteIndex(fld_root_child_child_leftmost_child(index), index)), fld_root___selfrendersize__(index), fld_iroot___renderoffset__(index));\n}\n\nvoid visit_hbox_3(unsigned int start_idx, unsigned int tree_size, __global float* float_buffer_1, __global int* int_buffer_1, __global GrammarTokens* grammartokens_buffer_1, __global NodeIndex* nodeindex_buffer_1) {\n\tunsigned int index = get_global_id(0) + start_idx;\n\n\t// Variables needed for loop macro. Declare up top to avoid declaring a\n\t// multitide below, one for every loop\n\tint step = 0;\n\tunsigned int prev_child_idx = 0;\n\n\n SFORLOOPALIAS_OCL(index, fld_hbox_child_childs_leftmost_child, step) {\n } SFORLOOPALIAS_OCL_END();\n\n fld_hbox___childsrendersize___init(index) = (0);\n fld_hbox___childsrendersize__(index) = fld_hbox___childsrendersize___init(index);\n SFORLOOPALIAS_OCL(index, fld_hbox_child_childs_leftmost_child, step) {\n fld_hbox___childsrendersize__(index) = ((fld_hbox___childsrendersize__(index) + fld_node___rendersize__(current_node)));\n } SFORLOOPALIAS_OCL_END();\n fld_node___rendersize__(index) = hbox___renderSize__(fld_hbox___childsrendersize__(index), fld_hbox___selfrendersize__(index));\n}\n\n///// pass /////\nvoid visit_leaf_4(unsigned int start_idx, unsigned int tree_size, __global float* float_buffer_1, __global int* int_buffer_1, __global GrammarTokens* grammartokens_buffer_1, __global NodeIndex* nodeindex_buffer_1, __global VertexAndColor* glBuffer) {\n\tunsigned int index = get_global_id(0) + start_idx;\n\n\t// Variables needed for loop macro. Declare up top to avoid declaring a\n\t// multitide below, one for every loop\n\tint step = 0;\n\tunsigned int prev_child_idx = 0;\n\n fld_node___renderoffset__(index) = leaf___renderOffset__(fld_node___renderrightoffset__(index), fld_node___rendersize__(index));\n fld_leaf___draw__0(index) = leaf___draw__0(fld_node_w(index), fld_leaf___selfrendersize__0(index), fld_node___renderoffset__(index), glBufferMacro(index), fld_node___dorenderinglast__(index), fld_node_h(index), fld_node_y(index), fld_node_x(index));\n fld_leaf___draw__(index) = leaf___draw__(fld_leaf___draw__0(index));\n}\n\nvoid visit_root_4(unsigned int start_idx, unsigned int tree_size, __global float* float_buffer_1, __global int* int_buffer_1, __global GrammarTokens* grammartokens_buffer_1, __global NodeIndex* nodeindex_buffer_1, __global VertexAndColor* glBuffer) {\n\tunsigned int index = get_global_id(0) + start_idx;\n\n\t// Variables needed for loop macro. Declare up top to avoid declaring a\n\t// multitide below, one for every loop\n\tint step = 0;\n\tunsigned int prev_child_idx = 0;\n\n}\n\nvoid visit_hbox_4(unsigned int start_idx, unsigned int tree_size, __global float* float_buffer_1, __global int* int_buffer_1, __global GrammarTokens* grammartokens_buffer_1, __global NodeIndex* nodeindex_buffer_1, __global VertexAndColor* glBuffer) {\n\tunsigned int index = get_global_id(0) + start_idx;\n\n\t// Variables needed for loop macro. Declare up top to avoid declaring a\n\t// multitide below, one for every loop\n\tint step = 0;\n\tunsigned int prev_child_idx = 0;\n\n fld_node___renderoffset__(index) = hbox___renderOffset__(fld_node___renderrightoffset__(index), fld_node___rendersize__(index));\n fld_hbox___draw__0(index) = hbox___draw__0(fld_node_w(index), fld_hbox___selfrendersize__0(index), fld_node___renderoffset__(index), glBufferMacro(index), fld_node___dorenderinglast__(index), fld_node_h(index), fld_node_y(index), fld_node_x(index));\n fld_hbox___draw__(index) = hbox___draw__(fld_hbox___draw__0(index));\n\n fld_hbox_childs___renderrightoffset___init(index) = ((fld_node___renderoffset__(index) + fld_hbox___selfrendersize__(index)));\n fld_hbox_childs___renderrightoffset___last(index) = fld_hbox_childs___renderrightoffset___init(index);\n SFORLOOPALIAS_OCL(index, fld_hbox_child_childs_leftmost_child, step) {\n fld_node___renderrightoffset__(current_node) = (((STEP() == 1 ? (fld_hbox_childs___renderrightoffset___last(index)) : (fld_node___renderrightoffset__(PREV_OCL()))) + fld_node___rendersize__(current_node)));\n } SFORLOOPALIAS_OCL_END();\n\n SFORLOOPALIAS_OCL(index, fld_hbox_child_childs_leftmost_child, step) {\n fld_node___dorenderinglast__(current_node) = (fld_hbox___draw__(index) );\n } SFORLOOPALIAS_OCL_END();\n}\n\n\n // Main visit dispatcher kernels\n\n __kernel void visit_0(unsigned int start_idx, unsigned int tree_size, __global float* float_buffer_1, __global int* int_buffer_1, __global GrammarTokens* grammartokens_buffer_1, __global NodeIndex* nodeindex_buffer_1) {\n\tunsigned int index = get_global_id(0) + start_idx;\n\n\tswitch((enum unionvariants) displayname(index)) {\n\t\tcase TOK_ROOT:\n\t\t\tvisit_root_0(start_idx, tree_size, float_buffer_1, int_buffer_1, grammartokens_buffer_1, nodeindex_buffer_1);\n\t\t\tbreak;\n\t\tcase TOK_HBOX:\n\t\t\tvisit_hbox_0(start_idx, tree_size, float_buffer_1, int_buffer_1, grammartokens_buffer_1, nodeindex_buffer_1);\n\t\t\tbreak;\n\t\tcase TOK_LEAF:\n\t\t\tvisit_leaf_0(start_idx, tree_size, float_buffer_1, int_buffer_1, grammartokens_buffer_1, nodeindex_buffer_1);\n\t\t\tbreak;\n\t}\n}\n\n__kernel void visit_1(unsigned int start_idx, unsigned int tree_size, __global float* float_buffer_1, __global int* int_buffer_1, __global GrammarTokens* grammartokens_buffer_1, __global NodeIndex* nodeindex_buffer_1) {\n\tunsigned int index = get_global_id(0) + start_idx;\n\n\tswitch((enum unionvariants) displayname(index)) {\n\t\tcase TOK_ROOT:\n\t\t\tvisit_root_1(start_idx, tree_size, float_buffer_1, int_buffer_1, grammartokens_buffer_1, nodeindex_buffer_1);\n\t\t\tbreak;\n\t\tcase TOK_HBOX:\n\t\t\tvisit_hbox_1(start_idx, tree_size, float_buffer_1, int_buffer_1, grammartokens_buffer_1, nodeindex_buffer_1);\n\t\t\tbreak;\n\t\tcase TOK_LEAF:\n\t\t\tvisit_leaf_1(start_idx, tree_size, float_buffer_1, int_buffer_1, grammartokens_buffer_1, nodeindex_buffer_1);\n\t\t\tbreak;\n\t}\n}\n\n__kernel void visit_2(unsigned int start_idx, unsigned int tree_size, __global float* float_buffer_1, __global int* int_buffer_1, __global GrammarTokens* grammartokens_buffer_1, __global NodeIndex* nodeindex_buffer_1) {\n\tunsigned int index = get_global_id(0) + start_idx;\n\n\tswitch((enum unionvariants) displayname(index)) {\n\t\tcase TOK_ROOT:\n\t\t\tvisit_root_2(start_idx, tree_size, float_buffer_1, int_buffer_1, grammartokens_buffer_1, nodeindex_buffer_1);\n\t\t\tbreak;\n\t\tcase TOK_HBOX:\n\t\t\tvisit_hbox_2(start_idx, tree_size, float_buffer_1, int_buffer_1, grammartokens_buffer_1, nodeindex_buffer_1);\n\t\t\tbreak;\n\t\tcase TOK_LEAF:\n\t\t\tvisit_leaf_2(start_idx, tree_size, float_buffer_1, int_buffer_1, grammartokens_buffer_1, nodeindex_buffer_1);\n\t\t\tbreak;\n\t}\n}\n\n__kernel void visit_3(unsigned int start_idx, unsigned int tree_size, __global float* float_buffer_1, __global int* int_buffer_1, __global GrammarTokens* grammartokens_buffer_1, __global NodeIndex* nodeindex_buffer_1) {\n\tunsigned int index = get_global_id(0) + start_idx;\n\n\tswitch((enum unionvariants) displayname(index)) {\n\t\tcase TOK_ROOT:\n\t\t\tvisit_root_3(start_idx, tree_size, float_buffer_1, int_buffer_1, grammartokens_buffer_1, nodeindex_buffer_1);\n\t\t\tbreak;\n\t\tcase TOK_HBOX:\n\t\t\tvisit_hbox_3(start_idx, tree_size, float_buffer_1, int_buffer_1, grammartokens_buffer_1, nodeindex_buffer_1);\n\t\t\tbreak;\n\t\tcase TOK_LEAF:\n\t\t\tvisit_leaf_3(start_idx, tree_size, float_buffer_1, int_buffer_1, grammartokens_buffer_1,"," nodeindex_buffer_1);\n\t\t\tbreak;\n\t}\n}\n\n__kernel void visit_4(unsigned int start_idx, unsigned int tree_size, __global float* float_buffer_1, __global int* int_buffer_1, __global GrammarTokens* grammartokens_buffer_1, __global NodeIndex* nodeindex_buffer_1, __global VertexAndColor* glBuffer) {\n\tunsigned int index = get_global_id(0) + start_idx;\n\n\tswitch((enum unionvariants) displayname(index)) {\n\t\tcase TOK_ROOT:\n\t\t\tvisit_root_4(start_idx, tree_size, float_buffer_1, int_buffer_1, grammartokens_buffer_1, nodeindex_buffer_1, glBuffer);\n\t\t\tbreak;\n\t\tcase TOK_HBOX:\n\t\t\tvisit_hbox_4(start_idx, tree_size, float_buffer_1, int_buffer_1, grammartokens_buffer_1, nodeindex_buffer_1, glBuffer);\n\t\t\tbreak;\n\t\tcase TOK_LEAF:\n\t\t\tvisit_leaf_4(start_idx, tree_size, float_buffer_1, int_buffer_1, grammartokens_buffer_1, nodeindex_buffer_1, glBuffer);\n\t\t\tbreak;\n\t}\n}\n\n\n"];