Zor's Blog
Seeing Sharp

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!

2 Responses to “Announcing SL#: C#-to-GLSL Translator”

  1. [...] 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#). [...]

  2. [...] The runtime C#-to-GLSL translator that we released as closed source software roughly two months ago has been bumped to version 1.3. [...]


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.