View source in Mesa


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

Follow these instructions if you don't have llvm built and installed in your system.

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:


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 --build . --config Debug
cmake --build . --config Debug --target install

cd c:\my\llvm\build-release
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).

If you need to compile OSMesa on windows, just add osmesa to the scons build line, as follows (example for release build):

  scons swr=1 libgl-gdi osmesa build=release

The osmesa libraries will be found under the build\windows-x86_64\gallium\targets\osmesa directory.

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