Skip to content

Commit 721584d

Browse files
author
hartsantler
committed
glsl/webclgl backend: fixed for loop.
1 parent 9e1689b commit 721584d

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

pythonjs/pythonjs.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,13 @@ def visit_Module(self, node):
108108
header.append( 'var __shader__ = []' )
109109

110110
lines = header + lines
111-
## fixed by Foxboron
112-
return '\n'.join(l if isinstance(l,str) else l.encode("utf-8") for l in lines)
111+
if False:
112+
for line in lines:
113+
assert isinstance(line, str)
114+
return '\n'.join(lines)
115+
else:
116+
## fixed by Foxboron
117+
return '\n'.join(l if isinstance(l,str) else l.encode("utf-8") for l in lines)
113118

114119
def visit_Expr(self, node):
115120
# XXX: this is UGLY
@@ -198,7 +203,7 @@ def _visit_function(self, node):
198203
return_type = None
199204
glsl = False
200205
glsl_wrapper_name = False
201-
glsl_vectorize = False
206+
gpu_vectorize = False
202207
args_typedefs = {}
203208
for decor in node.decorator_list:
204209
if isinstance(decor, ast.Name) and decor.id == '__glsl__':
@@ -725,7 +730,7 @@ def visit_For(self, node):
725730
if self._glsl:
726731
target = self.visit(node.target)
727732
iter = self.visit(node.iter.args[0])
728-
lines = ['for (int %s; %s < %s; %s++) {' %(target, target, iter, target)]
733+
lines = ['for (int %s=0; %s < %s; %s++) {' %(target, target, iter, target)]
729734
for b in node.body:
730735
lines.append( self.visit(b) )
731736
lines.append( '}' )

0 commit comments

Comments
 (0)