MojoShader

September 24th, 2008: Source code released to the world!

MojoShader is a library to work with Direct3D shaders on alternate 3D APIs and non-Windows platforms. The primary motivation is moving shaders to OpenGL languages on the fly. The developer deals with "profiles" that represent various target languages, such as GLSL or ARB_*_program.

This allows a developer to manage one set of shaders, presumably written in Direct3D HLSL, and use them across multiple rendering backends. This also means that the developer only has to worry about one (offline) compiler to manage program complexity, while MojoShader itself deals with the reduced complexity of the bytecode at runtime.

MojoShader provides both a simple API to convert bytecode to various profiles, and (optionally) basic glue to rendering APIs to abstract the management of the shaders at runtime.

Work is in progress to allow MojoShader to work as a replacement stack for the D3DX shader tools. The library already provides a preprocessor and an assembler to generate bytecode from low-level source, and construction of a full HLSL compiler is in progress.

The library is meant to be statically linked to an application (just add a few .c files and headers to your build), allows the app to optionally specify an allocator, and is thread safe (although OpenGL itself is not). It is meant to be embedded in games with a minimum of fuss.

Places MojoShader can be found in use:

What works:


What doesn't work:


License:

MojoShader is licensed under the zlib license.


Documentation:


Downloads:

Prepackaged source code:

Downloading with Mercurial:

MojoShader's source code may be downloaded using Mercurial (aka: "hg"). Hg allows you to get up-to-the-minute fixes and enhancements; as a developer works on a source tree, you can use hg to mirror that source tree instead of waiting for an official release. Please look at the Mercurial website for more information on using hg, where you can also download software for Mac OS X, Windows, and Unix systems.

Here is the web interface to MojoShader's Mercurial repository.

To download MojoShader via Mercurial:

hg clone http://hg.icculus.org/icculus/mojoshader/


Mailing list:

No mailing list at the moment; but you can email Ryan with comments and questions.


Page maintained by Ryan C. Gordon.