nvfx: expose GLSL
[mesa/mesa-lb.git] / src / gallium / drivers / llvmpipe / README
blob3c3fd386b5283ad157079aad36a8226a2d42795d
1 LLVMPIPE -- a fork of softpipe that employs LLVM for code generation.
4 Status
5 ======
7 Done so far is:
9  - the whole fragment pipeline is code generated in a single function
11    - input interpolation
12    
13    - depth testing
15    - texture sampling
16      - 1D/2D/3D/cube maps supported
17      - all texture wrap modes supported
18      - all texture filtering modes supported
19      - perhaps not all texture formats yet supported
20    
21    - fragment shader TGSI translation
22      - same level of support as the TGSI SSE2 exec machine, with the exception
23        we don't fallback to TGSI interpretation when an unsupported opcode is
24        found, but just ignore it
25      - done in SoA layout
26      - input interpolation also code generated
28    - alpha testing
30    - blend (including logic ops)
31      - both in SoA and AoS layouts, but only the former used for now
33  - code is generic
34    - intermediates can be vectors of floats, ubytes, fixed point, etc, and of
35      any width and length
36    - not all operations are implemented for these types yet though
38 Most mesa/progs/demos/* work. 
40 To do (probably by this order):
42  - code generate stipple and stencil testing
44  - translate TGSI control flow instructions, and all other remaining opcodes
46  - integrate with the draw module for VS code generation
48  - code generate the triangle setup and rasterization
51 Requirements
52 ============
54  - A x86 or amd64 processor.  64bit mode is preferred.
56    Support for sse2 is strongly encouraged.  Support for ssse3, and sse4.1 will
57    yield the most efficient code.  The less features the CPU has the more
58    likely is that you ran into underperforming, buggy, or incomplete code.  
59    
60    See /proc/cpuinfo to know what your CPU supports.
62  - LLVM 2.6 (or later)
64    For Linux, on a recent Debian based distribution do:
66      aptitude install llvm-dev
68    For Windows download pre-built MSVC 9.0 or MinGW binaries from
69    http://people.freedesktop.org/~jrfonseca/llvm/ and set the LLVM environment
70    variable to the extracted path.
72    The version of LLVM from SVN ("2.7svn") from mid-March 2010 seems pretty
73    stable and has some features not in version 2.6.
75  - scons (optional)
77  - udis86, http://udis86.sourceforge.net/ (optional):
79      git clone git://udis86.git.sourceforge.net/gitroot/udis86/udis86
80      cd udis86
81      ./autogen.sh
82      ./configure --with-pic
83      make
84      sudo make install
87 Building
88 ========
90 To build everything on Linux invoke scons as:
92   scons debug=yes statetrackers=mesa drivers=llvmpipe winsys=xlib dri=false
94 Alternatively, you can build it with GNU make, if you prefer, by invoking it as
96   make linux-llvm
98 but the rest of these instructions assume that scons is used.
100 For windows is everything the except except the winsys:
102   scons debug=yes statetrackers=mesa drivers=llvmpipe winsys=gdi dri=false
104 Using
105 =====
107 On Linux, building will create a drop-in alternative for libGL.so. To use it
108 set the environment variables:
110   export LD_LIBRARY_PATH=$PWD/build/linux-x86_64-debug/lib:$LD_LIBRARY_PATH
114   export LD_LIBRARY_PATH=$PWD/build/linux-x86-debug/lib:$LD_LIBRARY_PATH
116 For performance evaluation pass debug=no to scons, and use the corresponding
117 lib directory without the "-debug" suffix.
119 On Windows, building will create a drop-in alternative for opengl32.dll. To use
120 it put it in the same directory as the application. It can also be used by
121 replacing the native ICD driver, but it's quite an advanced usage, so if you
122 need to ask, don't even try it.
125 Unit testing
126 ============
128 Building will also create several unit tests in
129 build/linux-???-debug/gallium/drivers/llvmpipe:
131  - lp_test_blend: blending
132  - lp_test_conv: SIMD vector conversion
133  - lp_test_format: pixel unpacking/packing
135 Some of this tests can output results and benchmarks to a tab-separated-file
136 for posterior analysis, e.g.:
138   build/linux-x86_64-debug/gallium/drivers/llvmpipe/lp_test_blend -o blend.tsv
141 Development Notes
142 =================
144 - When looking to this code by the first time start in lp_state_fs.c, and 
145   then skim through the lp_bld_* functions called in there, and the comments
146   at the top of the lp_bld_*.c functions.  
148 - The driver-independent parts of the LLVM / Gallium code are found in
149   src/gallium/auxiliary/gallivm/.  The filenames and function prefixes
150   need to be renamed from "lp_bld_" to something else though.
152 - We use LLVM-C bindings for now. They are not documented, but follow the C++
153   interfaces very closely, and appear to be complete enough for code
154   generation. See 
155   http://npcontemplation.blogspot.com/2008/06/secret-of-llvm-c-bindings.html
156   for a stand-alone example.
157   See the llvm-c/Core.h file for reference.