mesa/src/gallium/drivers/llvmpipe
José Fonseca 4fbffb7d90 llvmpipe: Use lp_build_select_bitwise() where appropriate.
Fixes fdo 29269.
2010-07-27 13:09:47 +01:00
..
.gitignore llvmpipe: Ignores! 2010-07-13 07:49:00 -07:00
Makefile llvmpipe: delete lp_test_*.o files with make clean 2010-07-14 15:13:54 -06:00
README llvmpipe: Refer to my personal udis86 repository. 2010-05-27 19:40:10 +01:00
SConscript llvmpipe: Only use -mssse3 on gcc 4.3+ 2010-07-16 17:24:21 +01:00
lp_bld_alpha.c gallivm/llvmpipe: move lp_bld_alpha.c to llvmpipe/ directory 2010-04-16 10:22:33 -06:00
lp_bld_alpha.h gallivm/llvmpipe: move lp_bld_alpha.c to llvmpipe/ directory 2010-04-16 10:22:33 -06:00
lp_bld_blend.h llvmpipe: fix up indexing of blend/colormask state for render targets 2010-05-10 17:04:19 -06:00
lp_bld_blend_aos.c llvmpipe: Remove lp_build_swizzle2_aos(). 2010-07-01 15:02:04 +01:00
lp_bld_blend_logicop.c gallivm/llvmpipe: move lp_bld_blend* files to llvmpipe/ directory 2010-04-16 10:28:21 -06:00
lp_bld_blend_soa.c llvmpipe: fix up indexing of blend/colormask state for render targets 2010-05-10 17:04:19 -06:00
lp_bld_depth.c llvmpipe: Use lp_build_select_bitwise() where appropriate. 2010-07-27 13:09:47 +01:00
lp_bld_depth.h llvmpipe: implement occlusion query 2010-05-06 11:45:45 -06:00
lp_bld_interp.c llvmpipe: Remove dead initialization. 2010-07-18 01:14:36 -07:00
lp_bld_interp.h llvmpipe: Per quad interpolation. 2010-06-02 18:43:35 +01:00
lp_clear.c llvmpipe: remove dead code 2010-01-06 17:00:26 +00:00
lp_clear.h
lp_context.c llvmpipe: make geometry shaders and stream output work 2010-06-22 12:58:04 -04:00
lp_context.h llvmpipe: disconnect vertex texture sampling from the setup 2010-07-06 13:29:04 -04:00
lp_debug.h llvmpipe: Use GALLIVM_DEBUG opt where applicable. 2010-05-15 11:48:39 +01:00
lp_draw_arrays.c llvmpipe: implement instanced drawing functions 2010-07-15 15:56:09 -06:00
lp_fence.c llvmpipe: move fences from per-bin to per-thread 2010-07-13 17:23:48 +01:00
lp_fence.h llvmpipe: move fences from per-bin to per-thread 2010-07-13 17:23:48 +01:00
lp_flush.c llvmpipe: fix comment typo 2010-07-13 19:59:38 +02:00
lp_flush.h llvmpipe: No need to flush the caches for buffers. 2010-04-25 23:41:48 +01:00
lp_jit.c llvmpipe: pass mask into fragment shader 2010-07-13 17:23:49 +01:00
lp_jit.h llvmpipe: pass mask into fragment shader 2010-07-13 17:23:49 +01:00
lp_limits.h llvmpipe: limit the number of fragment shader variants kept around 2010-06-18 13:52:17 +01:00
lp_memory.c llvmpipe: use single swizzled tile 2010-07-16 17:24:21 +01:00
lp_memory.h llvmpipe: use single swizzled tile 2010-07-16 17:24:21 +01:00
lp_perf.c llvmpipe: pass mask into fragment shader 2010-07-13 17:23:49 +01:00
lp_perf.h llvmpipe: pass mask into fragment shader 2010-07-13 17:23:49 +01:00
lp_public.h ws/xlib: remove self-knowledge about users of xlib winsys 2010-03-09 15:33:21 +00:00
lp_query.c llvmpipe: wait for queries being finished when asked for it or before deletion 2010-07-05 17:17:50 +02:00
lp_query.h llvmpipe: implement occlusion query 2010-05-06 11:45:45 -06:00
lp_rast.c llvmpipe: use single swizzled tile 2010-07-16 17:24:21 +01:00
lp_rast.h llvmpipe: Remove redundant alignments. 2010-07-14 14:53:35 +01:00
lp_rast_priv.h llvmpipe: use single swizzled tile 2010-07-16 17:24:21 +01:00
lp_rast_tri.c llvmpipe: pass mask into fragment shader 2010-07-13 17:23:49 +01:00
lp_rast_tri_tmp.h llvmpipe: pass mask into fragment shader 2010-07-13 17:23:49 +01:00
lp_scene.c llvmpipe: eliminate the set_state rasterizer command 2010-07-13 17:28:54 +01:00
lp_scene.h llvmpipe: move fences from per-bin to per-thread 2010-07-13 17:23:48 +01:00
lp_scene_queue.c llvmpipe: Silence uninitialized variable warning. 2010-02-13 23:48:40 -08:00
lp_scene_queue.h llvmpipe: use new u_ringbuffer for scene queue 2010-01-17 00:30:23 +00:00
lp_screen.c llvmpipe: say no to depth clamp 2010-07-21 22:54:34 +02:00
lp_screen.h llvmpipe: move rasterizer to screen instead of setup context 2010-07-13 19:58:58 +02:00
lp_setup.c llvmpipe: use single swizzled tile 2010-07-16 17:24:21 +01:00
lp_setup.h llvmpipe: move fences from per-bin to per-thread 2010-07-13 17:23:48 +01:00
lp_setup_context.h llvmpipe: move rasterizer to screen instead of setup context 2010-07-13 19:58:58 +02:00
lp_setup_line.c llvmpipe: setup_context -> lp_setup_context 2010-03-13 11:23:52 +00:00
lp_setup_point.c llvmpipe: setup_context -> lp_setup_context 2010-03-13 11:23:52 +00:00
lp_setup_tri.c llvmpipe: Remove redundant alignments. 2010-07-14 14:53:35 +01:00
lp_setup_vbuf.c llvmpipe: restore call to lp_setup_update_state() 2010-06-29 15:19:01 -06:00
lp_state.h llvmpipe: disconnect vertex texture sampling from the setup 2010-07-06 13:29:04 -04:00
lp_state_blend.c gallium: implement set_sample_mask() in all drivers 2010-05-18 16:20:44 +02:00
lp_state_clip.c llvmpipe: make clip-related functions static, clean-up initializations 2010-04-28 15:25:50 -06:00
lp_state_derived.c llvmpipe: disconnect vertex texture sampling from the setup 2010-07-06 13:29:04 -04:00
lp_state_fs.c llvmpipe: pass mask into fragment shader 2010-07-13 17:23:49 +01:00
lp_state_fs.h llvmpipe: pass mask into fragment shader 2010-07-13 17:23:49 +01:00
lp_state_gs.c llvmpipe: Remove unnecessary header. 2010-06-07 16:44:22 -07:00
lp_state_rasterizer.c gallium: convert rasterizer state to use gl-style front/back concepts 2010-05-14 13:04:42 +01:00
lp_state_sampler.c llvmpipe: disconnect vertex texture sampling from the setup 2010-07-06 13:29:04 -04:00
lp_state_so.c llvmpipe: Remove unnecessary header. 2010-06-23 15:17:00 -07:00
lp_state_surface.c gallium: move framebuffer utility functions into a new file 2010-05-03 17:08:17 -06:00
lp_state_vertex.c llvmpipe: make vertex-related functions static, clean-up initializations 2010-04-28 15:25:50 -06:00
lp_state_vs.c llvmpipe: make shader-related functions static, clean-up initializations 2010-04-28 15:25:50 -06:00
lp_surface.c llvmpipe: don't crash/assert on out of memory 2010-06-29 15:40:19 -06:00
lp_surface.h llvmpipe: move/rename llvmpipe_init_surface_functions() 2010-04-28 15:25:50 -06:00
lp_test.h llvmpipe: new -s option to run single test 2010-06-04 17:01:24 -06:00
lp_test_blend.c llvmpipe: new -s option to run single test 2010-06-04 17:01:24 -06:00
lp_test_conv.c gallivm: Fix 4 x unorm8 -> 4 x float conversion. 2010-07-02 11:50:00 +01:00
lp_test_format.c gallivm: Support multiple pixels in lp_build_fetch_rgba_aos(). 2010-07-02 18:45:49 +01:00
lp_test_main.c llvmpipe: new -s option to run single test 2010-06-04 17:01:24 -06:00
lp_test_printf.c llvmpipe: new -s option to run single test 2010-06-04 17:01:24 -06:00
lp_test_round.c llvmpipe: add test program for round(), trunc(), floor(), ceil() 2010-07-06 11:36:37 -06:00
lp_test_sincos.c llvmpipe: Remove unused variable in lp_test_sincos. 2010-07-17 00:35:10 -07:00
lp_tex_sample.c gallivm/llvmpipe: add const qualifiers 2010-05-12 10:38:00 -06:00
lp_tex_sample.h gallivm/llvmpipe: rename os_llvm.h to lp_bld.h 2010-03-15 18:16:56 -06:00
lp_texture.c llvmpipe: Partially fix resource texture from_handle 2010-07-22 20:26:35 -07:00
lp_texture.h llvmpipe: use single swizzled tile 2010-07-16 17:24:21 +01:00
lp_tile_image.c llvmpipe: Always swizzle/unswizzle whole tiles. 2010-07-13 17:23:48 +01:00
lp_tile_image.h llvmpipe: Fix rendering to non 32bpp formats. 2010-04-22 19:25:00 +01:00
lp_tile_shuffle_mask.py llvmpipe: Addi ssse3 swizzling for B8G8R8A8_UNORM. 2010-07-14 14:38:02 +01:00
lp_tile_soa.h llvmpipe: Always swizzle/unswizzle whole tiles. 2010-07-13 17:23:48 +01:00
lp_tile_soa.py llvmpipe: Describe _mm_shuffle_epi8() with gcc extended inline assembly when -mssse3 is not supported/enabled. 2010-07-16 17:24:21 +01:00
sse_mathfun.h llvmpipe: Unit test for sin/cos that compares against reference implementation. 2010-05-24 13:45:26 +01:00

README

LLVMPIPE -- a fork of softpipe that employs LLVM for code generation.


Status
======

Done so far is:

 - the whole fragment pipeline is code generated in a single function
 
   - input interpolation
   
   - depth testing
 
   - texture sampling
     - 1D/2D/3D/cube maps supported
     - all texture wrap modes supported
     - all texture filtering modes supported
     - perhaps not all texture formats yet supported
   
   - fragment shader TGSI translation
     - same level of support as the TGSI SSE2 exec machine, with the exception
       we don't fallback to TGSI interpretation when an unsupported opcode is
       found, but just ignore it
     - done in SoA layout
     - input interpolation also code generated
 
   - alpha testing
 
   - blend (including logic ops)
     - both in SoA and AoS layouts, but only the former used for now
 
 - code is generic
   - intermediates can be vectors of floats, ubytes, fixed point, etc, and of
     any width and length
   - not all operations are implemented for these types yet though

Most mesa/progs/demos/* work. 

To do (probably by this order):

 - code generate stipple and stencil testing

 - translate TGSI control flow instructions, and all other remaining opcodes
 
 - integrate with the draw module for VS code generation

 - code generate the triangle setup and rasterization


Requirements
============

 - A x86 or amd64 processor.  64bit mode is preferred.
 
   Support for sse2 is strongly encouraged.  Support for ssse3, and sse4.1 will
   yield the most efficient code.  The less features the CPU has the more
   likely is that you ran into underperforming, buggy, or incomplete code.  
   
   See /proc/cpuinfo to know what your CPU supports.
 
 - LLVM 2.6 (or later)
 
   For Linux, on a recent Debian based distribution do:
 
     aptitude install llvm-dev

   For Windows download pre-built MSVC 9.0 or MinGW binaries from
   http://people.freedesktop.org/~jrfonseca/llvm/ and set the LLVM environment
   variable to the extracted path.

   For MSVC there are two set of binaries: llvm-x.x-msvc32mt.7z and
   llvm-x.x-msvc32mtd.7z .

   You have to set the LLVM=/path/to/llvm-x.x-msvc32mtd env var when passing
   debug=yes to scons, and LLVM=/path/to/llvm-x.x-msvc32mt when building with
   debug=no. This is necessary as LLVM builds as static library so the chosen
   MS CRT must match.

   The version of LLVM from SVN ("2.7svn") from mid-March 2010 is pretty
   stable and has some features not in version 2.6.

 - scons (optional)

 - udis86, http://udis86.sourceforge.net/ (optional). My personal repository
   supports more opcodes which haven't been merged upstream yet:
 
     git clone git://anongit.freedesktop.org/~jrfonseca/udis86
     cd udis86
     ./autogen.sh
     ./configure --with-pic
     make
     sudo make install
 

Building
========

To build everything on Linux invoke scons as:

  scons debug=yes statetrackers=mesa drivers=llvmpipe winsys=xlib dri=false

Alternatively, you can build it with GNU make, if you prefer, by invoking it as

  make linux-llvm

but the rest of these instructions assume that scons is used.

For windows is everything the except except the winsys:

  scons debug=yes statetrackers=mesa drivers=llvmpipe winsys=gdi dri=false

Using
=====

On Linux, building will create a drop-in alternative for libGL.so. To use it
set the environment variables:

  export LD_LIBRARY_PATH=$PWD/build/linux-x86_64-debug/lib:$LD_LIBRARY_PATH

or

  export LD_LIBRARY_PATH=$PWD/build/linux-x86-debug/lib:$LD_LIBRARY_PATH

For performance evaluation pass debug=no to scons, and use the corresponding
lib directory without the "-debug" suffix.

On Windows, building will create a drop-in alternative for opengl32.dll. To use
it put it in the same directory as the application. It can also be used by
replacing the native ICD driver, but it's quite an advanced usage, so if you
need to ask, don't even try it.


Unit testing
============

Building will also create several unit tests in
build/linux-???-debug/gallium/drivers/llvmpipe:

 - lp_test_blend: blending
 - lp_test_conv: SIMD vector conversion
 - lp_test_format: pixel unpacking/packing

Some of this tests can output results and benchmarks to a tab-separated-file
for posterior analysis, e.g.:

  build/linux-x86_64-debug/gallium/drivers/llvmpipe/lp_test_blend -o blend.tsv


Development Notes
=================

- When looking to this code by the first time start in lp_state_fs.c, and 
  then skim through the lp_bld_* functions called in there, and the comments
  at the top of the lp_bld_*.c functions.  

- The driver-independent parts of the LLVM / Gallium code are found in
  src/gallium/auxiliary/gallivm/.  The filenames and function prefixes
  need to be renamed from "lp_bld_" to something else though.

- We use LLVM-C bindings for now. They are not documented, but follow the C++
  interfaces very closely, and appear to be complete enough for code
  generation. See 
  http://npcontemplation.blogspot.com/2008/06/secret-of-llvm-c-bindings.html
  for a stand-alone example.
  See the llvm-c/Core.h file for reference.