Announcing SL#: C#-to-GLSL Translator
This is the first formal product release from Ignite Interactive Studio: SL# (or SLSharp).
SL# is a runtime translation engine that translates C# (IL) code to GLSL (OpenGL shader language) code. What it does is relatively simple: It takes a stream of compiled IL code and translates it to a valid GLSL code string. This is achieved through reconstructing an AST (abstract syntax tree) from the IL (effectively decompiling it at runtime).
The engine is freeware. That is, it is not open source, but you are free to use it for whatever project you want. Be it commercial or non-commercial. See the license here.
There is a bunch of benefits in doing this:
- IntelliSense and refactoring support for free
- Compile-time type safety
- No need to learn GLSL; just code in the language you know
- Obfuscation of the generated GLSL string
Currently, we’re primarily targeting C#. However, theoretically, SL# will translate any IL to valid GLSL. We have not tested VB.NET and F# yet, but intend to do so in the near future, as well as add any necessary support for these languages.
It should be noted that there are still some unsupported IL patterns and GLSL constructs. Namely, the :? operator and if-then-else statements don’t quite work yet (although if-then works fine). We do, of course, plan to support these in the future, as well as many other constructs.
So with that said, this is in all practicality an experimental release. Any feedback is greatly appreciated (especially tests on ATI cards). You can post feature requests and bug reports here.
The website for the project can be found here. It has some information regarding the library’s internals, a couple of samples, and a download link.
Enjoy! And remember to give feedback!
[...] As a consequence of the loss of control flow, the JIT has a much harder time optimizing. It has to attempt to reconstruct the control flow of a method from the bytecode that compilers have given it. This might fail if a compiler emits rather obscure code. And as mentioned, tools that operate on IL have an incredibly hard time trying to remap it to high-level code (i.e. SL#). [...]
Bytecode is Evil « Zor's Blog - February 3, 2011 at 16:09 |
[...] The runtime C#-to-GLSL translator that we released as closed source software roughly two months ago has been bumped to version 1.3. [...]
SL# 1.3 Released as Open Source « Zor's Blog - March 30, 2011 at 13:44 |