Merge branch '7.8'
[mesa.git] / src / gallium / drivers / llvmpipe / README
1 LLVMPIPE -- a fork of softpipe that employs LLVM for code generation.
2
3
4 Status
5 ======
6
7 Done so far is:
8
9 - the whole fragment pipeline is code generated in a single function
10
11 - input interpolation
12
13 - depth testing
14
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
27
28 - alpha testing
29
30 - blend (including logic ops)
31 - both in SoA and AoS layouts, but only the former used for now
32
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
37
38 Most mesa/progs/demos/* work.
39
40 To do (probably by this order):
41
42 - code generate stipple and stencil testing
43
44 - translate TGSI control flow instructions, and all other remaining opcodes
45
46 - integrate with the draw module for VS code generation
47
48 - code generate the triangle setup and rasterization
49
50
51 Requirements
52 ============
53
54 - A x86 or amd64 processor. 64bit mode is preferred.
55
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.
61
62 - LLVM 2.6 (or later)
63
64 For Linux, on a recent Debian based distribution do:
65
66 aptitude install llvm-dev
67
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.
71
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.
74
75 - scons (optional)
76
77 - udis86, http://udis86.sourceforge.net/ (optional):
78
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
85
86
87 Building
88 ========
89
90 To build everything on Linux invoke scons as:
91
92 scons debug=yes statetrackers=mesa drivers=llvmpipe winsys=xlib dri=false
93
94 Alternatively, you can build it with GNU make, if you prefer, by invoking it as
95
96 make linux-llvm
97
98 but the rest of these instructions assume that scons is used.
99
100 For windows is everything the except except the winsys:
101
102 scons debug=yes statetrackers=mesa drivers=llvmpipe winsys=gdi dri=false
103
104 Using
105 =====
106
107 On Linux, building will create a drop-in alternative for libGL.so. To use it
108 set the environment variables:
109
110 export LD_LIBRARY_PATH=$PWD/build/linux-x86_64-debug/lib:$LD_LIBRARY_PATH
111
112 or
113
114 export LD_LIBRARY_PATH=$PWD/build/linux-x86-debug/lib:$LD_LIBRARY_PATH
115
116 For performance evaluation pass debug=no to scons, and use the corresponding
117 lib directory without the "-debug" suffix.
118
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.
123
124
125 Unit testing
126 ============
127
128 Building will also create several unit tests in
129 build/linux-???-debug/gallium/drivers/llvmpipe:
130
131 - lp_test_blend: blending
132 - lp_test_conv: SIMD vector conversion
133 - lp_test_format: pixel unpacking/packing
134
135 Some of this tests can output results and benchmarks to a tab-separated-file
136 for posterior analysis, e.g.:
137
138 build/linux-x86_64-debug/gallium/drivers/llvmpipe/lp_test_blend -o blend.tsv
139
140
141 Development Notes
142 =================
143
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.
147
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.
151
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.