blob: 9c874acdedc028e70bd2b1c51a4adb352344ad71 [file] [log] [blame]
José Fonseca9285f152009-08-10 12:35:16 +01001LLVMPIPE -- a fork of softpipe that employs LLVM for code generation.
2
3
José Fonseca8df64bb2009-08-18 17:36:13 +01004Status
5======
6
7Done so far is:
8
José Fonseca5811ed82009-08-22 22:26:55 +01009 - the whole fragment pipeline is code generated in a single function
10
José Fonseca1fc41002009-09-11 11:24:00 +010011 - input interpolation
12
José Fonseca5811ed82009-08-22 22:26:55 +010013 - depth testing
14
Brian Pauld0b35352010-03-15 11:46:41 -060015 - 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
José Fonseca1fc41002009-09-11 11:24:00 +010020
José Fonseca5811ed82009-08-22 22:26:55 +010021 - 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
José Fonseca5811ed82009-08-22 22:26:55 +010025 - 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
José Fonseca8df64bb2009-08-18 17:36:13 +010037
José Fonseca1fc41002009-09-11 11:24:00 +010038Most mesa/progs/demos/* work.
José Fonseca8df64bb2009-08-18 17:36:13 +010039
40To do (probably by this order):
José Fonseca5811ed82009-08-22 22:26:55 +010041
42 - code generate stipple and stencil testing
43
José Fonseca5811ed82009-08-22 22:26:55 +010044 - translate TGSI control flow instructions, and all other remaining opcodes
José Fonseca1fc41002009-09-11 11:24:00 +010045
46 - integrate with the draw module for VS code generation
José Fonseca5811ed82009-08-22 22:26:55 +010047
48 - code generate the triangle setup and rasterization
José Fonseca8df64bb2009-08-18 17:36:13 +010049
50
José Fonseca9285f152009-08-10 12:35:16 +010051Requirements
52============
53
José Fonsecada1c4022009-11-26 11:15:08 +000054 - 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.
José Fonseca818d4442009-08-16 11:50:17 +010061
Brian Pauld0b35352010-03-15 11:46:41 -060062 - LLVM 2.6 (or later)
José Fonseca818d4442009-08-16 11:50:17 +010063
José Fonseca12576552010-01-10 18:37:07 +000064 For Linux, on a recent Debian based distribution do:
José Fonseca9285f152009-08-10 12:35:16 +010065
66 aptitude install llvm-dev
José Fonseca19b31d02009-08-10 15:43:04 +010067
José Fonseca12576552010-01-10 18:37:07 +000068 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.
José Fonseca19b31d02009-08-10 15:43:04 +010071
José Fonsecaf379e7d2010-05-13 16:18:05 +010072 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
Brian Pauld0b35352010-03-15 11:46:41 -060081 stable and has some features not in version 2.6.
82
José Fonseca8bf4e5d2009-11-24 16:01:01 +000083 - scons (optional)
José Fonseca9285f152009-08-10 12:35:16 +010084
José Fonseca8bf4e5d2009-11-24 16:01:01 +000085 - udis86, http://udis86.sourceforge.net/ (optional):
86
87 git clone git://udis86.git.sourceforge.net/gitroot/udis86/udis86
88 cd udis86
89 ./autogen.sh
90 ./configure --with-pic
91 make
92 sudo make install
93
José Fonseca9285f152009-08-10 12:35:16 +010094
95Building
96========
97
José Fonseca12576552010-01-10 18:37:07 +000098To build everything on Linux invoke scons as:
José Fonseca9285f152009-08-10 12:35:16 +010099
José Fonsecae243e872010-02-27 23:49:58 +0000100 scons debug=yes statetrackers=mesa drivers=llvmpipe winsys=xlib dri=false
José Fonseca9285f152009-08-10 12:35:16 +0100101
José Fonseca5811ed82009-08-22 22:26:55 +0100102Alternatively, you can build it with GNU make, if you prefer, by invoking it as
103
104 make linux-llvm
105
José Fonseca1fc41002009-09-11 11:24:00 +0100106but the rest of these instructions assume that scons is used.
José Fonseca5811ed82009-08-22 22:26:55 +0100107
José Fonseca12576552010-01-10 18:37:07 +0000108For windows is everything the except except the winsys:
109
José Fonsecae243e872010-02-27 23:49:58 +0000110 scons debug=yes statetrackers=mesa drivers=llvmpipe winsys=gdi dri=false
José Fonseca9285f152009-08-10 12:35:16 +0100111
112Using
113=====
114
José Fonseca12576552010-01-10 18:37:07 +0000115On Linux, building will create a drop-in alternative for libGL.so. To use it
116set the environment variables:
José Fonseca9285f152009-08-10 12:35:16 +0100117
José Fonseca50d77142009-08-10 16:12:51 +0100118 export LD_LIBRARY_PATH=$PWD/build/linux-x86_64-debug/lib:$LD_LIBRARY_PATH
José Fonseca9285f152009-08-10 12:35:16 +0100119
José Fonseca5811ed82009-08-22 22:26:55 +0100120or
121
122 export LD_LIBRARY_PATH=$PWD/build/linux-x86-debug/lib:$LD_LIBRARY_PATH
123
José Fonseca1fc41002009-09-11 11:24:00 +0100124For performance evaluation pass debug=no to scons, and use the corresponding
125lib directory without the "-debug" suffix.
126
José Fonseca12576552010-01-10 18:37:07 +0000127On Windows, building will create a drop-in alternative for opengl32.dll. To use
128it put it in the same directory as the application. It can also be used by
129replacing the native ICD driver, but it's quite an advanced usage, so if you
130need to ask, don't even try it.
131
José Fonseca9285f152009-08-10 12:35:16 +0100132
133Unit testing
134============
135
136Building will also create several unit tests in
137build/linux-???-debug/gallium/drivers/llvmpipe:
138
139 - lp_test_blend: blending
140 - lp_test_conv: SIMD vector conversion
141 - lp_test_format: pixel unpacking/packing
142
José Fonseca1fc41002009-09-11 11:24:00 +0100143Some of this tests can output results and benchmarks to a tab-separated-file
José Fonseca89146cd2009-08-20 10:21:49 +0100144for posterior analysis, e.g.:
145
José Fonseca5811ed82009-08-22 22:26:55 +0100146 build/linux-x86_64-debug/gallium/drivers/llvmpipe/lp_test_blend -o blend.tsv
José Fonseca9285f152009-08-10 12:35:16 +0100147
José Fonsecac5531f52009-08-21 10:57:48 +0100148
149Development Notes
150=================
151
José Fonseca5811ed82009-08-22 22:26:55 +0100152- When looking to this code by the first time start in lp_state_fs.c, and
153 then skim through the lp_bld_* functions called in there, and the comments
154 at the top of the lp_bld_*.c functions.
155
Brian Pauld0b35352010-03-15 11:46:41 -0600156- The driver-independent parts of the LLVM / Gallium code are found in
157 src/gallium/auxiliary/gallivm/. The filenames and function prefixes
158 need to be renamed from "lp_bld_" to something else though.
José Fonseca5811ed82009-08-22 22:26:55 +0100159
José Fonsecac5531f52009-08-21 10:57:48 +0100160- We use LLVM-C bindings for now. They are not documented, but follow the C++
161 interfaces very closely, and appear to be complete enough for code
162 generation. See
163 http://npcontemplation.blogspot.com/2008/06/secret-of-llvm-c-bindings.html
José Fonseca1fc41002009-09-11 11:24:00 +0100164 for a stand-alone example.
Brian Pauld0b35352010-03-15 11:46:41 -0600165 See the llvm-c/Core.h file for reference.