pygfx / pyshader

Write modern GPU shaders in Python!
BSD 2-Clause "Simplified" License
73 stars 1 forks source link

Several improvements, prevent stack corruption #44

Closed almarklein closed 4 years ago

almarklein commented 4 years ago

The compiler that translates Python bytecode to our IR handles globals, resolving them to the appropriate function calls eventually. To do this the globals are pushed on the parser-stack, but no code is emitted. This means that if we "leak" such a global, the stack of the IR is corrupt. This could happen when e.g. using a variable name that does not exist, resulting in really unfriendly error messages. This PR fixes that by tracking such globals much better.