HLSL Compiler
来源:互联网 发布:mysql my.cnf 路径 编辑:程序博客网 时间:2024/06/10 13:59
(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
http://repo.or.cz/w/wine/hlsl-compiler.git - Matijn Woudt and Matteo Bruni's sandbox for their wine HLSL compiler work
Compilers that read HLSL (and their target languages)
http://sourceforge.net/projects/hlsl2glsl (GLSL) (2006)
http://code.google.com/p/hlsl2glslfork (GLSL) (2008)
http://icculus.org/mojoshader (GLSL, ARB_*_program) (HLSL parser just started in 2010)
http://marc.info/?l=wine-devel&m=127125529916136&w=2 (Stefan Doesinger's HLSL compiler, 2006... need better link)
Parsers
http://developer.nvidia.com/object/cg_compiler_code.html (nvidia's 2002 opensourced CG parser)
Compiler Backends that output shader assembly
http://sourceforge.net/projects/llvmptxbackend/ (LLVM IR -> PTX) (GPL, so not mergable into LLVM tree)
Glue to interface Mesa's ad-hoc GLSL compiler to LLVM IR
http://cgit.freedesktop.org/mesa/mesa/tree/src/gallium/auxiliary/gallivm (GLSL -> X86 SSE specific LLVM IR?)
Related Pages
http://www.prog.uni-saarland.de/projects/anysl (home of llvmptxbackend)
http://llvm.org/docs/BitCodeFormat.html (LLVM IR file format)
http://aras-p.info/blog/2010/05/21/compiling-hlsl-into-glsl-in-2010/
http://graphics.stanford.edu/~danielrh/babelshader.html (converts MS shader assembly to ARB shader assembly) (2003)
Not very related pages
http://en.wikipedia.org/wiki/OpenCL (OpenCL is an HLSL-like language, but targets computation rather than graphics, and there aren't any open source implementations?)
http://en.wikipedia.org/wiki/CUDA (ditto)
http://www.tungstengraphics.com/wiki/files/tgsi.pdf (404, but archive.org still has it, sha1sum df05ca5e4252026782179cdeaf65af63d1d82040 )
Discussion
http://www.radeonhd.org/?page=archive_display&c=radeon&m=4&y=2010&d=2010-4-01 "... in Wine we want HLSL -> llvm -> d3d_asm and then d3d_asm -> GLSL (->llvm -> tgsi) ..."
CategoryCompilers CategoryGraphics
- HLSL Compiler
- UE4 HLSL Cross Compiler
- HLSL Effect-Compiler Tool
- HLSL
- HLSL
- compiler
- Compiler
- compiler
- HLSL Semantics (HLSL语义)
- HLSL Keywords (HLSL 关键字)
- HLSL Appendix(HLSL附录)
- HLSL基础
- HLSL初步
- HLSL函数
- 再观HLSL
- HLSL初级教程
- HLSL错误
- HLSL Introduction
- HLSL bytecode to GLSL编译器的第一步
- android中if判断引起的crash
- java面向对象4
- mysql order by注入技巧
- java面向对象5
- HLSL Compiler
- java面向对象6
- HLSL Attributes (Xbox 360)
- Android HandlerThread
- POJ---2418-Hardwood Species(字典树)
- java面向对象7
- 内存分配以及指针处理的相关测试代码
- Linux程序之线程轮询
- [C++11] 顺序存储的完全二叉树构造树形结构