Merge branch 'master' into opengl-es-v2
[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 (not all state/formats are supported)
16
17 - fragment shader TGSI translation
18 - same level of support as the TGSI SSE2 exec machine, with the exception
19 we don't fallback to TGSI interpretation when an unsupported opcode is
20 found, but just ignore it
21 - done in SoA layout
22 - input interpolation also code generated
23
24 - alpha testing
25
26 - blend (including logic ops)
27 - both in SoA and AoS layouts, but only the former used for now
28
29 - code is generic
30 - intermediates can be vectors of floats, ubytes, fixed point, etc, and of
31 any width and length
32 - not all operations are implemented for these types yet though
33
34 Most mesa/progs/demos/* work.
35
36 To do (probably by this order):
37
38 - code generate stipple and stencil testing
39
40 - translate the remaining bits of texture sampling state
41
42 - translate TGSI control flow instructions, and all other remaining opcodes
43
44 - integrate with the draw module for VS code generation
45
46 - code generate the triangle setup and rasterization
47
48
49 Requirements
50 ============
51
52 - Linux
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.
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 - scons (optional)
73
74 - udis86, http://udis86.sourceforge.net/ (optional):
75
76 git clone git://udis86.git.sourceforge.net/gitroot/udis86/udis86
77 cd udis86
78 ./autogen.sh
79 ./configure --with-pic
80 make
81 sudo make install
82
83
84 Building
85 ========
86
87 To build everything on Linux invoke scons as:
88
89 scons debug=yes statetrackers=mesa drivers=trace,llvmpipe winsys=xlib dri=false
90
91 Alternatively, you can build it with GNU make, if you prefer, by invoking it as
92
93 make linux-llvm
94
95 but the rest of these instructions assume that scons is used.
96
97 For windows is everything the except except the winsys:
98
99 scons debug=yes statetrackers=mesa drivers=trace,llvmpipe winsys=gdi dri=false
100
101 Using
102 =====
103
104 On Linux, building will create a drop-in alternative for libGL.so. To use it
105 set the environment variables:
106
107 export LD_LIBRARY_PATH=$PWD/build/linux-x86_64-debug/lib:$LD_LIBRARY_PATH
108
109 or
110
111 export LD_LIBRARY_PATH=$PWD/build/linux-x86-debug/lib:$LD_LIBRARY_PATH
112
113 For performance evaluation pass debug=no to scons, and use the corresponding
114 lib directory without the "-debug" suffix.
115
116 On Windows, building will create a drop-in alternative for opengl32.dll. To use
117 it put it in the same directory as the application. It can also be used by
118 replacing the native ICD driver, but it's quite an advanced usage, so if you
119 need to ask, don't even try it.
120
121
122 Unit testing
123 ============
124
125 Building will also create several unit tests in
126 build/linux-???-debug/gallium/drivers/llvmpipe:
127
128 - lp_test_blend: blending
129 - lp_test_conv: SIMD vector conversion
130 - lp_test_format: pixel unpacking/packing
131
132 Some of this tests can output results and benchmarks to a tab-separated-file
133 for posterior analysis, e.g.:
134
135 build/linux-x86_64-debug/gallium/drivers/llvmpipe/lp_test_blend -o blend.tsv
136
137
138 Development Notes
139 =================
140
141 - When looking to this code by the first time start in lp_state_fs.c, and
142 then skim through the lp_bld_* functions called in there, and the comments
143 at the top of the lp_bld_*.c functions.
144
145 - All lp_bld_*.[ch] are isolated from the rest of the driver, and could/may be
146 put in a stand-alone Gallium state -> LLVM IR translation module.
147
148 - We use LLVM-C bindings for now. They are not documented, but follow the C++
149 interfaces very closely, and appear to be complete enough for code
150 generation. See
151 http://npcontemplation.blogspot.com/2008/06/secret-of-llvm-c-bindings.html
152 for a stand-alone example.