View source in Mesa

OpenSWR

A High Performance, Highly Scalable Software Rasterizer for OpenGL

For more information please send us an email.

Windows Build Instructions

On Windows, OpenSWR is built using the scons package. Mesa windows build instructions are included here. OpenSWR also requires LLVM versions greater than 3.9.0 to build.

The instructions below describe how to build Mesa with OpenSWR support

Download and Build LLVM

Please refer to the LLVM Windows build instructions with Visual Studio for a general overview, located here

Use cmake to generate MSVC .sln files, as follows:


cmake -DCMAKE_GENERATOR_PLATFORM=x64 -DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_ENABLE_RTTI=1 -DLLVM_USE_CRT_DEBUG=MTd -DLLVM_USE_CRT_RELEASE=MT -DLLVM_ENABLE_TERMINFO=OFF -DCMAKE_INSTALL_PREFIX=c:\my\llvm\root c:\my\llvm\src

Note that, in theory, you only need to use one of LLVM_USE_CRT_DEBUG or LLVM_USE_CRT_RELEASE, depending on whether you are building Debug or Release, but it doesn't hurt to always include both in the cmake line.

The mesa windows scons build has the peculiarity that you cannot mix debug and release versions of libs (see link error LNK2038). If you are planning of building both version of mesa, you should also build both versions of LLVM. Below, I am assuming that we are building both.

Build both flavors of LLVM using:


cd c:\my\llvm\build-debug
cmake -DCMAKE_GENERATOR_PLATFORM=x64 -DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_ENABLE_RTTI=1 -DLLVM_USE_CRT_DEBUG=MTd -DLLVM_USE_CRT_RELEASE=MT -DLLVM_ENABLE_TERMINFO=OFF -DCMAKE_INSTALL_PREFIX=c:\my\llvm\root-debug c:\my\llvm\src
cmake --build . --config Debug
cmake --build . --config Debug --target install

cd c:\my\llvm\build-release
cmake -DCMAKE_GENERATOR_PLATFORM=x64 -DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_ENABLE_RTTI=1 -DLLVM_USE_CRT_DEBUG=MTd -DLLVM_USE_CRT_RELEASE=MT -DLLVM_ENABLE_TERMINFO=OFF -DCMAKE_INSTALL_PREFIX=c:\my\llvm\root-release c:\my\llvm\src
cmake --build . --config Release
cmake --build . --config Release --target install

The results are located in the appopriate root directory.

Build Mesa with OpenSWR

First, clone the mesa repo.

For debug builds:


  set LLVM=c:\my\llvm\root-debug
  scons swr=1 libgl-gdi

For release builds:


  set LLVM=c:\my\llvm\root-release
  scons swr=1 libgl-gdi build=release

Note that you have to modify the LLVM environment variable between debug and release builds.

The build results in 3 .dll files: opengl32.dll, swrAVX.dll and swrAVX2.dll. opengl32.dll is located in build\windows-x86_64\gallium\targets\libgl-gdi, and the SWR libraries are located in build\windows-x86_64\gallium\drivers\swr. Place them either in c:\windows\system32 (making sure that you keep a backup of the original opengl32.dll), or in your current directory (if you are running simple command-line tests).

Please modify your paths accordingly if you are running debug builds.