llvmpipe: rearrange queries
[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 For MSVC there are two set of binaries: llvm-x.x-msvc32mt.7z and
73 llvm-x.x-msvc32mtd.7z .
74
75 You have to set the LLVM=/path/to/llvm-x.x-msvc32mtd env var when passing
76 debug=yes to scons, and LLVM=/path/to/llvm-x.x-msvc32mt when building with
77 debug=no. This is necessary as LLVM builds as static library so the chosen
78 MS CRT must match.
79
80 The version of LLVM from SVN ("2.7svn") from mid-March 2010 is pretty
81 stable and has some features not in version 2.6.
82
83 - scons (optional)
84
85 - udis86, http://udis86.sourceforge.net/ (optional). My personal repository
86 supports more opcodes which haven't been merged upstream yet:
87
88 git clone git://anongit.freedesktop.org/~jrfonseca/udis86
89 cd udis86
90 ./autogen.sh
91 ./configure --with-pic
92 make
93 sudo make install
94
95
96 Building
97 ========
98
99 To build everything on Linux invoke scons as:
100
101 scons debug=yes statetrackers=mesa drivers=llvmpipe winsys=xlib dri=false
102
103 Alternatively, you can build it with GNU make, if you prefer, by invoking it as
104
105 make linux-llvm
106
107 but the rest of these instructions assume that scons is used.
108
109 For windows is everything the except except the winsys:
110
111 scons debug=yes statetrackers=mesa drivers=llvmpipe winsys=gdi dri=false
112
113 Using
114 =====
115
116 On Linux, building will create a drop-in alternative for libGL.so. To use it
117 set the environment variables:
118
119 export LD_LIBRARY_PATH=$PWD/build/linux-x86_64-debug/lib:$LD_LIBRARY_PATH
120
121 or
122
123 export LD_LIBRARY_PATH=$PWD/build/linux-x86-debug/lib:$LD_LIBRARY_PATH
124
125 For performance evaluation pass debug=no to scons, and use the corresponding
126 lib directory without the "-debug" suffix.
127
128 On Windows, building will create a drop-in alternative for opengl32.dll. To use
129 it put it in the same directory as the application. It can also be used by
130 replacing the native ICD driver, but it's quite an advanced usage, so if you
131 need to ask, don't even try it.
132
133
134 Unit testing
135 ============
136
137 Building will also create several unit tests in
138 build/linux-???-debug/gallium/drivers/llvmpipe:
139
140 - lp_test_blend: blending
141 - lp_test_conv: SIMD vector conversion
142 - lp_test_format: pixel unpacking/packing
143
144 Some of this tests can output results and benchmarks to a tab-separated-file
145 for posterior analysis, e.g.:
146
147 build/linux-x86_64-debug/gallium/drivers/llvmpipe/lp_test_blend -o blend.tsv
148
149
150 Development Notes
151 =================
152
153 - When looking to this code by the first time start in lp_state_fs.c, and
154 then skim through the lp_bld_* functions called in there, and the comments
155 at the top of the lp_bld_*.c functions.
156
157 - The driver-independent parts of the LLVM / Gallium code are found in
158 src/gallium/auxiliary/gallivm/. The filenames and function prefixes
159 need to be renamed from "lp_bld_" to something else though.
160
161 - We use LLVM-C bindings for now. They are not documented, but follow the C++
162 interfaces very closely, and appear to be complete enough for code
163 generation. See
164 http://npcontemplation.blogspot.com/2008/06/secret-of-llvm-c-bindings.html
165 for a stand-alone example.
166 See the llvm-c/Core.h file for reference.