Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save oscarbg/3f787a30ac63fd73336c164d2729cae1 to your computer and use it in GitHub Desktop.
Save oscarbg/3f787a30ac63fd73336c164d2729cae1 to your computer and use it in GitHub Desktop.
Compile and run OpenSWR on AWS Instance (Ubuntu 14.04)
# Approximate recipe on compiling and running OpenSWR on AWS Instance (Ubuntu 14.04)
# Questions regarding this recipe: @__rej__
# http://openswr.org
# prerequisites
sudo apt-get update
sudo apt-get install git
sudo apt-get install build-essential
sudo apt-get build-dep mesa
sudo apt-get install mesa-utils
sudo apt-get install python-pip
sudo pip install mako
# just in case you had them installed before
sudo apt-get purge llvm-3.4 clang-3.4
sudo apt-get auto remove
# install LLVM 3.9 (default one is 3.4, not good enough for OpenRWS)
sudo echo 'deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-3.9 main’ | sudo tee -a /etc/apt/sources.list
sudo echo 'deb-src http://apt.llvm.org/trusty/ llvm-toolchain-trusty-3.9 main’ | sudo tee -a /etc/apt/sources.list
wget -O - http://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo apt-get update
sudo apt-get install clang-3.9 lldb-3.9
ln -s /usr/bin/llvm-config-3.9 /usr/bin/llvm-config
# now clone and compile mesa
git clone git://anongit.freedesktop.org/git/mesa/mesa mesa.git
cd mesa.git
./autogen.sh \
--disable-va --disable-gbm --disable-xvmc --disable-vdpau \
--disable-dri --with-dri-drivers= \
--disable-egl --with-egl-platforms= --disable-gles1 --disable-gles2 \
--enable-texture-float \
--enable-glx --enable-xlib-glx \
--enable-gallium-llvm=yes --enable-gallium-osmesa \
--with-gallium-drivers=swrast,swr \
--prefix=/home/mesa
make
sudo make install
# most likely not necessary to reboot
sudo reboot now
# install and setup X server
sudo apt-get install -y linux-generic
sudo apt-get install -y xserver-xorg
# launch X server
/usr/bin/X :0 &
export LIBGL_DRIVERS_PATH=/home/mesa/lib
export LD_LIBRARY_PATH=/home/mesa/lib
# switch to OpenSWR rasterizer backend
export GALLIUM_DRIVER=swr
# however default llvmpipe seems to be actually faster in the most cases for me. Try what works better for you!
# export GALLIUM_DRIVER=llvmpipe
# run sample
DISPLAY=:0 glxinfo
DISPLAY=:0 glxgears
# try something Unity, renders and stores some images on the disk
sudo apt-get install unzip
wget https://www.dropbox.com/s/abycjktjzmkrmb4/auto.zip .
unzip auto.zip -d auto
chmod +x auto/auto.x86_64
DISPLAY=:0 auto/auto.x86_64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment