Merge branch 'mesa_7_6_branch'
[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 - udis86, http://udis86.sourceforge.net/ . Use my repository, which decodes
55 opcodes not yet supported by upstream.
56
57 git clone git://people.freedesktop.org/~jrfonseca/udis86
58 cd udis86
59 ./configure --with-pic
60 make
61 sudo make install
62
63 - LLVM 2.5. On Debian based distributions do:
64
65 aptitude install llvm-dev
66
67 There is a typo in one of the llvm-dev 2.5 headers, that causes compilation
68 errors in the debug build:
69
70 --- /usr/include/llvm-c/Core.h.orig 2009-08-10 15:38:54.000000000 +0100
71 +++ /usr/include/llvm-c/Core.h 2009-08-10 15:38:25.000000000 +0100
72 @@ -831,7 +831,7 @@
73 template<typename T>
74 inline T **unwrap(LLVMValueRef *Vals, unsigned Length) {
75 #if DEBUG
76 - for (LLVMValueRef *I = Vals, E = Vals + Length; I != E; ++I)
77 + for (LLVMValueRef *I = Vals, *E = Vals + Length; I != E; ++I)
78 cast<T>(*I);
79 #endif
80 return reinterpret_cast<T**>(Vals);
81
82 - A x86 or amd64 processor with support for sse2, sse3, and sse4.1 SIMD
83 instructions. This is necessary because we emit several SSE intrinsics for
84 convenience. See /proc/cpuinfo to know what your CPU supports.
85
86 - scons
87
88
89 Building
90 ========
91
92 To build everything invoke scons as:
93
94 scons debug=yes statetrackers=mesa drivers=llvmpipe winsys=xlib dri=false -k
95
96 Alternatively, you can build it with GNU make, if you prefer, by invoking it as
97
98 make linux-llvm
99
100 but the rest of these instructions assume that scons is used.
101
102
103 Using
104 =====
105
106 Building will create a drop-in alternative for libGL.so. To use it set the
107 environment variables:
108
109 export LD_LIBRARY_PATH=$PWD/build/linux-x86_64-debug/lib:$LD_LIBRARY_PATH
110
111 or
112
113 export LD_LIBRARY_PATH=$PWD/build/linux-x86-debug/lib:$LD_LIBRARY_PATH
114
115 For performance evaluation pass debug=no to scons, and use the corresponding
116 lib directory without the "-debug" suffix.
117
118
119 Unit testing
120 ============
121
122 Building will also create several unit tests in
123 build/linux-???-debug/gallium/drivers/llvmpipe:
124
125 - lp_test_blend: blending
126 - lp_test_conv: SIMD vector conversion
127 - lp_test_format: pixel unpacking/packing
128
129 Some of this tests can output results and benchmarks to a tab-separated-file
130 for posterior analysis, e.g.:
131
132 build/linux-x86_64-debug/gallium/drivers/llvmpipe/lp_test_blend -o blend.tsv
133
134
135 Development Notes
136 =================
137
138 - When looking to this code by the first time start in lp_state_fs.c, and
139 then skim through the lp_bld_* functions called in there, and the comments
140 at the top of the lp_bld_*.c functions.
141
142 - All lp_bld_*.[ch] are isolated from the rest of the driver, and could/may be
143 put in a stand-alone Gallium state -> LLVM IR translation module.
144
145 - We use LLVM-C bindings for now. They are not documented, but follow the C++
146 interfaces very closely, and appear to be complete enough for code
147 generation. See
148 http://npcontemplation.blogspot.com/2008/06/secret-of-llvm-c-bindings.html
149 for a stand-alone example.