HLSL Compiler

(See also DirectX-Shaders and DirectX-ToDo )

Many projects - Wine included - could use an open source HLSL compiler.

Wine in particular needs one that accepts the DirectX HLSL and outputs the DirectX shader bytecode. At the moment it's enough to target Direct3D 9 HLSL/bytecode, later Wine will also need to extend it to Direct3D 10 and 11.

There are several ways to approach building a compiler:

  • write an ad hoc compiler using lex and yacc, without much of an optimizer (like Mesa has for GLSL)
  • ditto, but use a well-known IR representation so a good optimizer could be borrowed later
  • write the compiler using an existing compiler toolkit (like LLVM or maybe Open64)

It's not clear yet what the best path is, they probably all merit some exploration.

Here are a few HLSL-compiler-like things that have been spotted in the wild:

Wine patches

Compilers that read HLSL (and their target languages)


Compiler Backends that output shader assembly

Glue to interface Mesa's ad-hoc GLSL compiler to LLVM IR

Related Pages

Not very related pages


CategoryCompilers CategoryGraphics

HLSLCompiler (last edited 2013-06-02 09:37:39 by KyleAuble)