Merge commit 'origin/gallium-winsys-handle-rebased'
[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 - A x86 or amd64 processor. 64bit mode is preferred.
53
54 Support for sse2 is strongly encouraged. Support for ssse3, and sse4.1 will
55 yield the most efficient code. The less features the CPU has the more
56 likely is that you ran into underperforming, buggy, or incomplete code.
57
58 See /proc/cpuinfo to know what your CPU supports.
59
60 - LLVM 2.6.
61
62 For Linux, on a recent Debian based distribution do:
63
64 aptitude install llvm-dev
65
66 For Windows download pre-built MSVC 9.0 or MinGW binaries from
67 http://people.freedesktop.org/~jrfonseca/llvm/ and set the LLVM environment
68 variable to the extracted path.
69
70 - scons (optional)
71
72 - udis86, http://udis86.sourceforge.net/ (optional):
73
74 git clone git://udis86.git.sourceforge.net/gitroot/udis86/udis86
75 cd udis86
76 ./autogen.sh
77 ./configure --with-pic
78 make
79 sudo make install
80
81
82 Building
83 ========
84
85 To build everything on Linux invoke scons as:
86
87 scons debug=yes statetrackers=mesa drivers=llvmpipe winsys=xlib dri=false
88
89 Alternatively, you can build it with GNU make, if you prefer, by invoking it as
90
91 make linux-llvm
92
93 but the rest of these instructions assume that scons is used.
94
95 For windows is everything the except except the winsys:
96
97 scons debug=yes statetrackers=mesa drivers=llvmpipe winsys=gdi dri=false
98
99 Using
100 =====
101
102 On Linux, building will create a drop-in alternative for libGL.so. To use it
103 set the environment variables:
104
105 export LD_LIBRARY_PATH=$PWD/build/linux-x86_64-debug/lib:$LD_LIBRARY_PATH
106
107 or
108
109 export LD_LIBRARY_PATH=$PWD/build/linux-x86-debug/lib:$LD_LIBRARY_PATH
110
111 For performance evaluation pass debug=no to scons, and use the corresponding
112 lib directory without the "-debug" suffix.
113
114 On Windows, building will create a drop-in alternative for opengl32.dll. To use
115 it put it in the same directory as the application. It can also be used by
116 replacing the native ICD driver, but it's quite an advanced usage, so if you
117 need to ask, don't even try it.
118
119
120 Unit testing
121 ============
122
123 Building will also create several unit tests in
124 build/linux-???-debug/gallium/drivers/llvmpipe:
125
126 - lp_test_blend: blending
127 - lp_test_conv: SIMD vector conversion
128 - lp_test_format: pixel unpacking/packing
129
130 Some of this tests can output results and benchmarks to a tab-separated-file
131 for posterior analysis, e.g.:
132
133 build/linux-x86_64-debug/gallium/drivers/llvmpipe/lp_test_blend -o blend.tsv
134
135
136 Development Notes
137 =================
138
139 - When looking to this code by the first time start in lp_state_fs.c, and
140 then skim through the lp_bld_* functions called in there, and the comments
141 at the top of the lp_bld_*.c functions.
142
143 - All lp_bld_*.[ch] are isolated from the rest of the driver, and could/may be
144 put in a stand-alone Gallium state -> LLVM IR translation module.
145
146 - We use LLVM-C bindings for now. They are not documented, but follow the C++
147 interfaces very closely, and appear to be complete enough for code
148 generation. See
149 http://npcontemplation.blogspot.com/2008/06/secret-of-llvm-c-bindings.html
150 for a stand-alone example.