1. Prerequisites for building¶
1.1 General¶
Build system¶
-
Meson is required when building on *nix
platforms and on Windows. -
Android Build system when building as native Android component. Meson
is used when building ARC.
Compiler¶
The following compilers are known to work, if you know of others or
you’re willing to maintain support for other compiler get in touch.
-
GCC 8.0.0 or later (some parts of Mesa may require later versions)
-
Clang 5.0 or later (some parts of Mesa may require later versions)
-
Microsoft Visual Studio 2019 Version 16.11 or later and
Windows SDK of at least 20348 is required, for building on Windows.
1.2 Requirements¶
The requirements depends on the features selected at configure stage.
Check/install the respective development package as prompted by the
configure error message.
Here are some common ways to retrieve most/all of the dependencies based
on the packaging tool used by your distro.
zypper source-install --build-deps-only Mesa # openSUSE/SLED/SLES yum-builddep mesa # yum Fedora, OpenSuse(?) dnf builddep mesa # dnf Fedora apt-get build-dep mesa # Debian and derivatives ... # others
2. Building with meson¶
Meson >= 0.46.0 is required
Meson is the latest build system in mesa, it is currently able to build
for *nix systems like Linux and BSD, macOS, Haiku, and Windows.
The general approach is:
meson builddir/ ninja -C builddir/ sudo ninja -C builddir/ install
On Windows you can also use the Visual Studio backend
meson builddir --backend=vs cd builddir msbuild mesa.sln /m
Please read the detailed meson instructions for more
information
3. Running against a local build¶
It’s often necessary or useful when debugging driver issues or testing new
branches to run against a local build of Mesa without doing a system-wide
install. To do this, choose a temporary location for the install. A directory
called installdir
inside your mesa tree is as good as anything. All of the
commands below will assume $MESA_INSTALLDIR
is an absolute path to this
location.
First, configure Mesa and install in the temporary location:
meson builddir/ -Dprefix="$MESA_INSTALLDIR" OTHER_OPTIONS ninja -C builddir/ install
where OTHER_OPTIONS
is replaced by any meson configuration options you may
want. For instance, if you want to build the LLVMpipe drivers, it would look
like this:
meson builddir/ -Dprefix="$MESA_INSTALLDIR" -Dgallium-drivers=swrast -Dvulkan-drivers=swrast ninja -C builddir/ install
Once Mesa has built and installed to $MESA_INSTALLDIR
, you can run any app
against your temporary install by setting the right environment variables.
Which variable you have to set depends on the API.
OpenGL¶
LD_LIBRARY_PATH="$MESA_INSTALLDIR/lib64" glxinfo
You may need to use lib
instead of lib64
on some systems or a full
library specifier on debian. Look inside installdir
for the directory that
contains libGL.so
and use that one.
Vulkan¶
VK_ICD_FILENAMES="$MESA_INSTALLDIR/share/vulkan/icd/my_icd.json" vulkaninfo
where my_icd.json
is replaced with the actual ICD json file name. This
will depend on your driver. For instance, the 64-bit Lavapipe driver ICD file
is named lvp_icd.x86_64.json
.
OpenCL¶
OCL_ICD_VENDORS="$MESA_INSTALLDIR/etc/OpenCL/vendors" clinfo
Unlike Vulkan, OpenCL takes a path to the whole vendors
folder and will
enumerate any drivers found there.
Troubleshooting local builds¶
If you are trying to run an app against a local build and it’s not working,
here are a few things to check:
Double-check your paths and try with the simplest app you can. Before
banging your head on a Steam game, make sure your path works with
glxgears
first.Watch out for wrapper scripts. Some more complex apps such as games have
big start-up scripts. Sometimes those scripts scrub the environment or set
LD_LIBRARY_PATH
to something in the game’s install directory.Is your Mesa build the same arch as your app? Lots of games are still
32-bit and your Mesa build is probably 64-bit by default.32 and 64-bit builds in the same local install directory doesn’t typically
work. Distributions go to great lengths to make this work in your system
install and it’s hard to get it right for a local install. If you’ve
recently built 64-bit and are now building 32-bit, throw away the install
directory first to prevent conflicts.
4. Building with AOSP (Android)¶
<TODO>
5. Library Information¶
When compilation has finished, look in the top-level lib/
(or
lib64/
) directory. You’ll see a set of library files similar to
this:
lrwxrwxrwx 1 brian users 10 Mar 26 07:53 libGL.so -> libGL.so.1* lrwxrwxrwx 1 brian users 19 Mar 26 07:53 libGL.so.1 -> libGL.so.1.5.060100* -rwxr-xr-x 1 brian users 3375861 Mar 26 07:53 libGL.so.1.5.060100* lrwxrwxrwx 1 brian users 14 Mar 26 07:53 libOSMesa.so -> libOSMesa.so.6* lrwxrwxrwx 1 brian users 23 Mar 26 07:53 libOSMesa.so.6 -> libOSMesa.so.6.1.060100* -rwxr-xr-x 1 brian users 23871 Mar 26 07:53 libOSMesa.so.6.1.060100*
libGL is the main OpenGL library (i.e. Mesa), while libOSMesa is
the OSMesa (Off-Screen) interface library.
If you built the DRI hardware drivers, you’ll also see the DRI drivers:
-rwxr-xr-x 1 brian users 16895413 Jul 21 12:11 i915_dri.so -rwxr-xr-x 1 brian users 16895413 Jul 21 12:11 i965_dri.so -rwxr-xr-x 1 brian users 11849858 Jul 21 12:12 r200_dri.so -rwxr-xr-x 1 brian users 11757388 Jul 21 12:12 radeon_dri.so
If you built with Gallium support, look in lib/gallium/ for
Gallium-based versions of libGL and device drivers.
6. Building OpenGL programs with pkg-config¶
Running ninja install
will install package configuration files for
the pkg-config utility.
When compiling your OpenGL application you can use pkg-config to
determine the proper compiler and linker flags.
For example, compiling and linking a GLUT application can be done with:
gcc `pkg-config --cflags --libs glut` mydemo.c -o mydemo
Описание
Файлы2
Скриншоты1
Комментарии3
MESA3D
Многим известно что новые версии Бодислайда требуют нового OpenGL , если у вас железо «по новее» ,то эту проблему можно решить обновлением драйверов видеокарты , только вот железо может быть старым и аппаратно не поддерживать требуемую версию OpenGL .
Тогда на помощь приходит «эмуляция».
Mesa3D можно использовать для предоставления программного рендерера приложениям OpenGL.
Приложение работает автоматически , без активации . И только для той программы в папке которой расположено .
Бодислайд при эмуляции будет слегка подтормаживать , в зависимости от мощности вашего процессора , но зато будет работать .
Разумеется Mesa3D можно использовать и для других програм и игр .
Тестировал на Вин 10 — работает , на других версиях Виндовс , не знаю не проверял . Но на оф. странице есть по этому поводу инфа , смотрите там если что .
Установка : скачать нужную версию , распаковать и разместить файл opengl32.dll в папке рядом с исполняемыми файлами Бодисайда , по адресу CalienteToolsBodySlide
и все . Приложение заработает автоматически , при включении Бодислайда .
Оригинальная страница : MESA3D FOR WINDOWS
MesaForWindows 32bit -20.1.5 (7 Мб)Сервер №1
MesaForWindows 64bit -20.1.5 (7Мб)Сервер №2
Table of Contents
- Downloads
- Sponsorship
- Known issues
- Differences between MSVC and MinGW packages
- Mingw and MSVC Package contents
- OpenGL and OpenGL ES common shared libraries
- Microsoft CLonD3D12, GLonD3D12 and D3D12 VA-API common dependency
- Desktop OpenGL drivers
- OpenGL off-screen rendering driver
- OpenGL ES drivers and EGL library
- Vulkan drivers
- OpenCL drivers, compilers and backends
- Direct3D drivers, libraries and tools
- VA-API drivers
- Testing library and tools
- Development packages
- Debug packages
- Build Mesa3D yourself
- Installation and usage
- Usage notes
- Uninstall Mesa3D
- Legacy software compatibility
- OpenGL context configuration override
- How to set environment variables
Downloads
Mesa 22.3.4 builds with Visual Studio and MSYS2 Mingw-w64 are now available in releases section.
Sponsorship
mesa-dist-win project was given an extensible sponsorship with initial due date of November 1st 2023. Sponsorship consists in a free VPS to use as build machine with 12 GB RAM, 6 threads AMD EPYC 7413 and 150 GB NVMe SSD from Petrosky, a virtual private server hosting company thanks to @Directox01.
Known issues
This is a list of all comonly encountered issues with known solutions or workarounds. A specific release is only affected by a subset of them.
libgallium_wgl.dll
missing error with Mesa3D OpenGL ES and desktop OpenGL drivers
This is encountered with existing per application deployments made with 21.2.x or older when updating to 21.3.0 or newer. Just redo per app deployment to fix it. Gallium megadriver separation from opengl32.dll
was a very invasive change that existing per app deployments didn’t stand a chance against. If you don’t remember if an affected program is 32-bit or 64-bit, right click on opengl32.dll
shortcut in the folder where the program executable is located and select open file location. If location ends in x64 then it’s 64-bit, otherwise it’s 32-bit.
libEGL.dll
missing error with Mesa3D OpenGL ES
This is encountered with existing per application deployments made with 21.2.x or older when updating to 21.3.0 or newer. Just redo per app deployment to fix it. The EGL support was a very invasive change that existing per app deployments didn’t stand a chance against. If you don’t remember if an affected program is 32-bit or 64-bit, right click on opengl32.dll
shortcut in the folder where the program executable is located and select open file location. If location ends in x64 then it’s 64-bit, otherwise it’s 32-bit.
libvulkan-1.dll
missing error with Mesa3Dopengl32.dll
from MinGW release package
Only releases prior to 22.2.0 for which zink driver was built with MSYS2 MinGW-W64 vulkan-devel package group are affected. Run fix-libvulkan-1.dll-missing-error.cmd
from MinGW release package to correct it. This tool supports unattended execution via auto
command line option. This tool is only bundled in MinGW release package when needed otherwise it’s intentionally missing. The decision to use this Vulkan SDK over LunarG’s is done based on which comes with newer loader and headers.
- 64-bit binaries in both MSVC and MinGW packages require a CPU with AVX even though they shouldn’t
This is no longer an issue as of Mesa 22.0 or newer. This issue is caused by 64-bit binaries containing swr driver which leaks AVX usage into common code. This is an upstream bug reported here, here and here.
- Mesa
opengl32.dll
from MinGW package depends on Vulkan runtime since 21.0.0
This was fixed in 22.2.0 by containing this requirement to zink driver explicit usage. This is an upstream regression introduced when zink driver was patched to support Windows.
- Programs can behave like there is no OpenGL support when using Mesa
opengl32.dll
since 21.0.0
This is not a defect but rather a behavior change of Mesa when environment variables are misconfigured. It usually happens when selecting a Mesa driver that doesn’t exist in release package used or it fails to initialize due to host system not meeting hardware requirements or lacking dependencies. Reading differences between MSVC and MinGW packages and Mingw and MSVC Package contents should aid in troubleshooting.
- Important notes about errors related to missing
libglapi.dll
You may experience them with programs that use any Mesa3D desktop OpenGL driver via per app deployment tool, system wide deployment is unaffected. You may experience them if per app deployment was done before shared glapi support was introduced. shared glapi has been consistently available in both MSVC and MinGW packages since 20.0.2.
To correct these errors regardless of cause you have to re-deploy. If you don’t remember if an affected program is 32-bit or 64-bit, right click on opengl32.dll
shortcut in the folder where the program executable is located and select open file location. If location ends in x64 then it’s 64-bit, otherwise it’s 32-bit.
Same problem with same solution applies to osmesa if you are upgrading from 17.3.5.501-1 or older.
Differences between MSVC and MinGW packages
- MinGW package requires a CPU with SSSE3 with benefit of providing 3-5% performance boost with software rendering drivers;
- d3d10sw introduced in 21.2.0 is only available in MSVC package;
- MinGW package uses ZSTD for certain compression tasks since 20.1.8.
If you need to migrate from Mingw to MSVC binaries you just need to replace Mesa binaries folder from Mingw package with MSVC counterpart.
Mingw and MSVC Package contents
The following Mesa3D drivers and build artifacts are shipped in each release:
OpenGL and OpenGL ES common shared libraries
- GLAPI shared library. File name:
libglapi.dll
. Its presence is required when providing both OpenGL and OpenGL ES support. Mesa3D off-screen renderer and all Mesa3D OpenGL and OpenGL ES drivers depend on it when present. Since 20.0.2 it’s available in both MSVC and MSYS2 Mingw-w64 packages. - Gallium OpenGL megadriver. File name:
libgallium_wgl.dll
. When present it contains all Mesa3D desktop OpenGL drivers instead ofopengl32.dll
. It debuted in 21.3.0. Mesa3D EGL library and OpenGL ES drivers depend on it when present. - Mesa3D WGL runtime. File name:
opengl32.dll
. This used to contain all Mesa3D desktop OpenGL drivers and OpenGL ES depended on it, but since 21.3.0 it was reduced to only being a loader for gallium OpenGL megadriver, so only programs using Mesa3D desktop OpenGL drivers via per-application deployment depend on it now.
Microsoft CLonD3D12, GLonD3D12 and D3D12 VA-API common dependency
- DirectX IL for redistribution. File name:
dxil.dll
. This Windows SDK binary is installable via deployment tools as necessary.
Desktop OpenGL drivers
- llvmpipe. llvmpipe is a Desktop OpenGL software renderer intended as fallback when hardware acceleration is not possible. It can only handle very light gaming with good performance. This is the default Mesa3D desktop OpenGL driver when GLonD3D12 is either unavailable or fails to load. It’s available for both x86 and x64 as part of Mesa3D Desktop OpenGL bundle
opengl32.dll
orlibgallium_wgl.dll
if the latter is available. When it’s not the default driver select it by setting environment variableGALLIUM_DRIVER=llvmpipe
. - softpipe is a reference implementation of a Desktop OpenGL software renderer with no focus towards gaming performance. It’s available for both x86 and x64 as part of Mesa3D Desktop OpenGL bundle
opengl32.dll
orlibgallium_wgl.dll
if the latter is available. Select it by setting environment variableGALLIUM_DRIVER=softpipe
. - GLonD3D12. It’s available for both x86 and x64 in MSVC package and since 22.2.0 in MinGW package as well as part of Mesa3D Desktop OpenGL bundle
opengl32.dll
orlibgallium_wgl.dll
if the latter is available and prior to 22.3.0 as standaloneopenglon12.dll
as well. In addition to officially requiring Windows 10 v10.0.19041.488 or newer, it also depends on DirectX IL for redistribution —dxil.dll
to load, which can be installed via deployment tools. When available and if it can load, this is the default Mesa3D desktop OpenGL driver on D3D12 GPU accelerated systems. This driver introduced in 21.0.0 is operating as wrapper returning D3D12 API calls. Due to this nature it can use GPU accelleration. If it’s not selected by default you can test it with Direct3D WARP software renderer built into Windows by settingGALLIUM_DRIVER=d3d12
andLIBGL_ALWAYS_SOFTWARE=1
environment variables. The standalone copy doesn’t needGALLIUM_DRIVER=d3d12
being set and it can only be installed via system-wide deployment tool. The standalone GLonD3D12 and Mesa3D Desktop OpenGL bundle replace each other when using system-wide deployment tool but you can reverse it any time. - zink. This driver introduced in MinGW package in 21.0.0 and MSVC package in 21.2.0 it’s available for both x86 and x64 as part of Mesa3D Desktop OpenGL bundle
opengl32.dll
orlibgallium_wgl.dll
if the latter is available. Similarly to GLonD3D12, it operates as wrapper returning Vulkan API calls. Due to this nature it uses GPU accelleration by default but it supports software rendering too. Select it viaGALLIUM_DRIVER=zink
environment variable, but note that it requires at least 1 Vulkan device and Vulkan loader/runtime to initialize. zink ignored Vulkan CPU type devices by default until 22.1.0. Nowdays it uses a priority system that automatically selects a Vulkan CPU type device if no higher priority Vulkan type device exists. You can test zink with Vulkan CPU type devices only by settingLIBGL_ALWAYS_SOFTWARE=1
(Mesa 22.1.0 and newer) orZINK_USE_LAVAPIPE=true
(deprecated in Mesa 22.1.0). - swr. This driver is no longer available in Mesa 22.0 and newer. File names:
swrAVX.dll
,swrAVX2.dll
,swrSKX.dll
,swrKNL.dll
. Even though it resides outside of Mesa3D Desktop OpenGL bundleopengl32.dll
orlibgallium_wgl.dll
if the latter is available, it still depends on it. This alternative desktop OpenGL software rendering driver developed by Intel is optimized for visualization software. It’s available in MSVC package and since 20.1.7 in MinGW package as well. It only supports x64, x86 is officially unsupported. There are currently 4 DLLs, only one being loaded based on what the user CPU can do. You can switch to swr by setting GALLIUM_DRIVER environment variable value to swr.
OpenGL off-screen rendering driver
- osmesa. File name:
osmesa.dll
. Available for both x86 and x64. This driver is used in special cases by software that is designed to use Mesa code to render without any kind of window system or operating system dependency. Since 21.0.0 only osmesa gallium remained. It supports OpenGL 3.x and newer. Since 20.0.2 osmesa integration with standalone GLLES drivers is available in both MSVC and MSYS2 Mingw-w64 packages requiringlibglapi.dll
in the process.
OpenGL ES drivers and EGL library
- EGL library. File name:
libEGL.dll
. Mesa3D EGL library used by OpenGL ES drivers. This debuted in 21.3.0 and it’s available for 32-bit and 64-bit applications in both MSVC and MSYS2 packages. It depends on desktop OpenGL bundleopengl32.dll
orlibgallium_wgl.dll
if the latter is available. - OpenGL ES standalone drivers. File names:
libGLESv1_CM.dll
andlibGLESv2.dll
. OpenGL ES 1.x, 2.x and 3.x standalone drivers available for 32-bit and 64-bit applications. Since 20.0.2 they are available in both MSVC and MSYS2 Mingw-w64 packages. They depend on Mesa3D EGL library if available and desktop OpenGL bundleopengl32.dll
orlibgallium_wgl.dll
if the latter is available.
Vulkan drivers
- lavapipe Vulkan CPU driver is available in both MSVC and MinGW packages since 21.1.0. File names:
lvp_icd.x86_64.json
,lvp_icd.x86.json
,vulkan_lvp.dll
. Note that some programs may ignore Vulkan CPU type devices on purpose. For information on how to deploy see usage notes. - Microsoft dozen Vulkan driver is available since 22.1.0 in MSVC package and since 22.2.0 in MinGW package as well. This driver relies on D3D12 API to function and it can use GPU acceleration on supported systems. File names:
dzn_icd.x86_64.json
,dzn_icd.x86.json
,vulkan_dzn.dll
. For information on how to deploy see usage notes. - Vulkan driver for AMD graphics (radv) is no longer available since 22.1.0 per @zmike suggestion as it won’t work anytime soon. RADV was available in both MSVC and MinGW packages since 21.2.0. 32-bit binary of it was available since Mesa 22.0. File names:
radeon_icd.x86_64.json
,radeon_icd.x86.json
,libvulkan_radeon.dll
andvulkan_radeon.dll
. For information on how to deploy see usage notes.
OpenCL drivers, compilers and backends
- Microsoft OpenCL stack. File names:
clon12compiler.dll
(compiler),openclon12.dll
(ICD) andWinPixEventRuntime.dll
(x64 only dependency). These components introduced in 21.0.0 are finally provided by mesa-dist-win since 21.3.0 (compiler only) and 21.3.6-2 respectively. ClonD3D12 driver is available as an OpenCL ICD. For information on how to deploy see usage notes. CLonD3D12 officially requires Windows 10 v10.0.19041.488 or newer and it depends on DirectX IL for redistribution —dxil.dll
to load, which can be installed via deployment tools. CLonD3D12 is operating as wrapper returning D3D12 API calls. Due to this nature it can use D3D12 GPU accelleration if available otherwise Windows built-in WARP software rendering is used. Even when using WARP CLonD3D12 advertises CL_DEVICE_TYPE_GPU, but this can change anytime to CL_DEVICE_TYPE_CPU. Some programs ignore drivers with CL_DEVICE_TYPE_CPU set on purpose. - clover OpenCL stack has been removed from release package in 22.1.1 until Windows support is finalized as it’s currently unusable. File names:
MesaOpenCL.dll
(ICD),OpenCL.dll
(standalone runtime), andpipe_swrast.dll
(pipe loader). The runtime can be deployed with per app deployment tool since 21.3.7 or on older versions via copy-paste along with all available pipe loaders which it depends on. While deployed, the runtime hides all other OpenCL ICDs present on the system and only lets software use Mesa3D clover as the only OpenCL driver. For information on how to deploy the ICD see usage notes.
Direct3D drivers, libraries and tools
- D3D10 software renderer is available in MSVC package since 21.2.0. File name:
d3d10sw.dll
. This is a drop in replacement for Microsoft WARP and unfortunately there is no clean way of deploying it. - SPIR-V to DXIL tool and library are available in MSVC package since 21.0.0 and since 22.2.0 in MinGW package as well. File names:
libspirv_to_dxil.dll
,spirv_to_dxil.dll
andspirv2dxil.exe
.
VA-API drivers
- VA-API D3D12 driver. File names:
vaon12_drv_video.dll
(MSVC) andlibvaon12_drv_video.dll
(MinGW). This driver was made available in 22.3.0. Unfortunately there is very little documentation on how to deploy and use VA-API drivers on Windows since it’s a new thing.
Testing library and tools
- Gallium raw interface. This deprecated component has been removed in Mesa3D 22.3.0. File names:
graw.dll
,graw_null.dll
. This is a dummy gallium driver without any graphics API mainly used for testing. Available for both x86 and x64 and in full (with window system support) and headless (no window) versions. Since 20.0.2 both windowed and windowless versions are available in both MSVC and MSYS2 Mingw-w64 packages. - test suite. Many executable unit tests.
Development packages
Headers and libraries for both 32-bit and 64-bit builds are located in a separate archive called development pack.
Debug packages
Starting with 22.2.0 a MSVC debug info package containing debug symbols in PDB format and a MinGW asserts enabled debug optimized build package are available. MinGW debug binaries can be used as drop-in replacements for their release counterparts. With software using per application deployment, this should be seamless, but for system-wide deployment, re-deployment is necessary to switch from release to debug builds and vice-versa. For more info on MinGW debugging, see debug/mingw-start-debugging.sh
Build Mesa3D yourself
Build instructions, if you want to replicate my builds, are available here.
Installation and usage
First choose between Mingw and MSVC package. See Differences between MSVC and MinGW packages section for details. Before extracting release package close all programs that use Mesa if any is running. After extraction you will have access to 2 deployment options, both located in the directory you installed Mesa. Both deployment utilities have a start-over mechanism so you can do all deployments you need in one session. The deployment tools only support OpenGL and OpenGL ES components of Mesa3D plus OpenCL clover standalone.
- A system-wide deployment tool. While intended for systems lacking hardware accelerated OpenGL support like virtual machines in cloud environments, it can also be used on any Windows system to replace the inbox software rendering OpenGL 1.1 driver extending OpenGL support for use cases where hardware accelerated OpenGL is not available like RDP connections. Due to potential issues with Virtualbox VMs running Windows it is recommended to disable 3D acceleration in such VMs if Mesa3D desktop OpenGL driver is installed inside them using the system-wide deployment tool, see #9.
- A per-application deployment tool, used to deploy Mesa3D for a single program regardless of hardware accelerated OpenGL support being present or not.
Per-app deployment utility changes are persistent and are being kept across upgrades and re-installations.
Per-app deployment utility helps you save storage and makes things easier as you won’t have to manually copy DLLs from Mesa installation directory as it creates symbolic links to whatever Mesa drivers you opt-in to use.
This behavior ensures all programs that use Mesa use the same up-to-date version.
Per-app deployment utility asks for path to directory containing application executable, application executable filename (optional, it can remain blank but if specified can force some programs to use Mesa3D when they won’t otherwise), if the app is 64-bit or 32-bit and the drivers you need.
32-bit applications have their names marked in Task Manager while running.
Most applications will use Mesa regardless of GPU capabilities, but some applications may be smart enough to load OpenGL from system directory only.
By providing the application filename, a .local file is generated in an attempt to force the application to use Mesa3D when it doesn’t want to.
Also, Federico Dossena’s Mesainjector can be used to workaround this issue as well.
Build instructions for Mesainjector.
Usage notes
- Old applications from early 200x and older may need MESA_EXTENSION_MAX_YEAR environment variable set, see legacy software compatibility section.
- Applications requiring OpenGL 3.2 or newer may need OpenGL context configuration override.
Examples on OpenGL context configuration override, switch to other driver and old applications compatibility are available here.
- The official Mesa3D documentation is available here.
- OpenCL ICDs deployment is done through registration of ICD file with system OpenCL runtime (e.g.
opencl.dll
fromWindowssystem32
). If you don’t have system OpenCL runtime you can get it by installing Intel OpenCL CPU runtime. It works for AMD CPUs as well. - Deployment for Vulkan drivers is done through Vulkan runtime using ICD discovery method. Note that Vulkan runtime commes bundled with graphics drivers supporting Vulkan so manually installing it may not be necessary.
Uninstall Mesa3D
- Run system wide deployment and perform uninstall operation if available, then exit;
- Download and run Everything tool (any flavor should work);
- Run per application deployment tool and leave it running;
- In Everything tool, in text field under menu enter
libgallium_wgl.dll attrib:L
and keep Everything tool running; - For each search result in Everything tool:
- open its location in Windows Explorer via Open Path or Open File location context menu option;
- find *.local files and remove them, but only if you are certain you specified a filename during deployment to that location;
- copy location from address bar and feed it to per application deployment tool;
- send no to all deployments until you are asked to do more deployments, send yes there.
- Repeat steps 4 and 5 using osmesa.dll and graw.dll filenames respectively the same way was done for libgallium_wgl.dll;
- Close per application deployment and Everything tools;
- Revert any registry changes and any environment variables that configure Vulkan runtime to use any of Mesa3D Vulkan drivers;
- Repeat stepp 8, but for OpenCL.
WARNING: Programs for which certain files have been overwritten by per application deployment tool may need re-installation/repair. Per application deployment tool detects and warns about this deployment scenario since 22.0.0.
Legacy software compatibility
Old applications from early 200x and older may need MESA_EXTENSION_MAX_YEAR environment variable set to avoid buffer overflows. It expects a year number as value, most commonly used being 2001. It trims the extensions list returned by Mesa3D to extensions released up to and including provided year as Mesa3D extensions list is sorted by year.
Ex: set MESA_EXTENSION_MAX_YEAR=2001
. See How to set environment variables.
OpenGL context configuration override
With release of OpenGL 3.1 many features marked as deprecated in OpenGL 3.0 have been removed and since OpenGL 3.2 launch this OpenGL specification branch is known as OpenGL core profile. Also in OpenGL 3.3 a new branch of the OpenGL specification known as forward compatible context was introduced which removes the OpenGL 3.0 deprecated features that were not removed in OpenGL 3.1.
Most proprietary drivers implemented the exemptions from these changes offered in the form of GL_ARB_compatibility extension for OpenGL 3.1 and compatibility contexts for OpenGL 3.2 and above.
Due to complexity and especially lack of correct implementation tests for GL_ARB_compatibility and compatibility contexts, Mesa3D developers chose to delay work in this area until Mesa 18.1 introduced GL_ARB_compatibility support and then Mesa 21.3 bumped compatibility contexts support to OpenGL 4.5 for llvmpipe.
In conclusion programs requesting OpenGL compatibility context won’t get above OpenGL 3.0 for Mesa 18.0, 3.1 for Mesa 18.1 and 4.5 for Mesa 21.3 and newer.
Unfortunately these kind of programs are prevalent on Windows where developers tend to avoid using context flags required by core profile.
Fortunately Mesa3D provides a mechanism to override the OpenGL context requested.
There are 2 environment variables that override OpenGL context configuration:
- MESA_GL_VERSION_OVERRIDE
It is used to specify OpenGL context version and type.
It expects a value in the following format
OpenGLMajorVersion.OpenGLMinorVersion{FC|COMPAT].
FC means a forward compatible context.
COMPAT means a compatibility context for OpenGL 3.2 and newer and GL_ARB_compatibility being enabled for OpenGL 3.1.
Absence of any string after version number means the Mesa3D default context type for OpenGL version specified which is as follows: deprecated features enabled for OpenGL 3.0, GL_ARB_compatibility enabled for OpenGL 3.1 since Mesa 18.1 and core profile for OpenGL 3.2 and above.
Examples: 3.3FC means OpenGL 3.3 forward compatible context, 3.1COMPAT means OpenGL 3.1 with GL_ARB_compatibility , 3.2 means OpenGL 3.2 core profile.
The default value for llvmpipe driver is 4.5COMPAT for Mesa>=21.3, 3.1COMPAT for Mesa>=18.1 and 3.0COMPAT for Mesa<=18.0.
A very important feature provided by this variable is the possibility to configure an incomplete OpenGL context.
Programs can only request up to the highest OpenGL context with Khronos certification as complete from Mesa3D driver in use.
Currently llvmpipe is certified for OpenGL 4.5 in all OpenGL profiles. Currently swr and GLonD3D12 are certified for OpenGL 3.3 in core profile / forward compatible context and 3.1 in compatibility profile. zink OpenGL support depends on underlying Vulkan driver.
Since Mesa 17.3 values meant for OpenGL 4.6 are recognized.
- MESA_GLSL_VERSION_OVERRIDE
Used to specify shading language version.
Supported values are version numbers converted to integer: 110, 120, 130, 140. 150, 330, 400, 410, 420, 430, 440, 450 and 460. Value 460 is only recognized since Mesa 17.3. Value 130 for example matches GLSL 1.30. It is always a good idea to keep OpenGL context and shading language versions in sync to avoid programs confusion which may result in crashes or glitches. This can happen because most applications rely on proprietary drivers behavior of having OpenGL and GLSL versions in sync. Here is the OpenGL — GLSL correlation table.
Default values for llvmpipe: 450 for Mesa 21.3, 140 for Mesa 18.1 and 130 for Mesa 18.0 if MESA_GL_VERSION_OVERRIDE is undefined or matching core profile’s otherwise.
How to set environment variables
Under Windows the easiest way to set environment variables is by writing batch files. You’ll most likely need to do so:
- for every application requiring higher OpenGL and GLSL versions than what is exposed by selected Mesa3D driver by default;
- if you want to select a non-default driver for desktop OpenGL;
- if you need to trim extensions list for old programs compatibility.
Simply open Notepad, write the batch script. When saving, end the file name with .bat or .cmd, change save as type to all files and change save location to where the application executable is located. If you have some skill with batch scripts you can change the current directory during script execution using CD command opening the possibility to save the script anywhere you want as shown in rpcs3 and GPU Caps Viewer examples.
Documentation of most environment variables used by Mesa is available here.
Complete examples are available here.
You can set multiple environment variables on same batch script to mix the functionality provided by Mesa3D.
Содержание
- Mesa for windows x64
- Mesa for windows x64
- Introduction
- Preparation
- Building LLVM
- Building Mesa
- And there you have it, Mesa on Windows!
- Credits
Mesa for windows x64
Mesa 21.2.5 builds with Visual Studio and MSYS2 Mingw-w64 are now available in releases section.
Run fix-libvulkan-1.dll-missing-error.cmd from MinGW release package to correct it. This tool supports unattended execution via auto command line option. This tool is only bundled in MinGW release package when needed because only releases for which zink driver was built with MSYS2 MinGW-W64 vulkan-devel package group are affected. The decision to use this Vulkan SDK over LunarG’s is done based on which comes with newer loader and headers.
This is due to 64-bit binaries containing swr driver which leaks AVX usage into common code. This is an upstream bug reported here, here and here.
This is an upstream regression introduced when zink driver was patched to support Windows.
This is not a defect but rather a behavior change of Mesa when environment variables are misconfigured. It usually happens when selecting a Mesa driver that doesn’t exist in release package used or it fails to initialize due to host system not meeting hardware requirements or lacking dependencies. Reading differences between MSVC and MinGW packages and Mingw and MSVC Package contents should aid in troubleshooting.
You may experience them with programs that use any Mesa3D desktop OpenGL driver via per app deployment tool, system wide deployment is unaffected. You may experience them if per app deployment was done before shared glapi support was introduced. shared glapi has been consistently available in both MSVC and MinGW packages since 20.0.2.
To correct these errors regardless of cause you have to re-deploy. If you don’t remember if an affected program is 32-bit or 64-bit, right click on opengl32.dll shortcut in the folder where the program executable is located and select open file location. If location ends in x64 then it’s 64-bit, otherwise it’s 32-bit.
Same problem with same solution applies to osmesa if you are upgrading from 17.3.5.501-1 or older.
Differences between MSVC and MinGW packages
If you need to migrate from Mingw to MSVC binaries you just need to replace Mesa binaries folder from Mingw package with MSVC counterpart.
Mingw and MSVC Package contents
The following Mesa3D drivers and build artifacts are shipped in each release:
Build instructions, if you want to replicate my builds, are available here.
Installation and usage
First choose between Mingw and MSVC package. See About Mingw package section for details. Before extracting release package close all programs that use Mesa if any is running. After extraction you will have access to 2 deployment options, both located in the directory you installed Mesa. Both deployment utilities have a start-over mechanism so you can do all deployments you need in one session.
Examples on OpenGL context configuration override, switch to swr driver and old applications compatibility are available here.
Legacy software compatibility
Old applications from early 200x and older may need MESA_EXTENSION_MAX_YEAR environment variable set to avoid buffer overflows. It expects a year number as value, most commonly used being 2001. It trims the extensions list returned by Mesa3D to extensions released up to and including provided year as Mesa3D extensions list is sorted by year.
OpenGL context configuration override
With release of OpenGL 3.1 many features marked as deprecated in OpenGL 3.0 have been removed and since OpenGL 3.2 launch this OpenGL specification branch is known as OpenGL core profile. Also in OpenGL 3.3 a new branch of the OpenGL specification known as forward compatible context was introduced which removes the OpenGL 3.0 deprecated features that were not removed in OpenGL 3.1. Most proprietary drivers implemented the exemptions from these changes offered in the form of GL_ARB_compatibility extension for OpenGL 3.1 and compatibility contexts for OpenGL 3.2 and above. Due to complexity and especially lack of correct implementation tests for GL_ARB_compatibility and compatibility contexts, Mesa3D developers chose to retain features deprecated in OpenGL 3.0 and implement core profile and forward compatible contexts. Mesa 18.1 introduced GL_ARB_compatibility support making the first step toward having compatibility contexts support in the future. Because GL_ARB_compatibility is only for OpenGL 3.1, programs requesting OpenGL compatibility context won’t get above OpenGL 3.0 for Mesa 18.0 and 3.1 for Mesa 18.1 and newer. Unfortunately these kind of programs are prevalent on Windows where developers tend to avoid using context flags required by core profile. Fortunately Mesa3D provides a mechanism to override the OpenGL context requested. There are 2 environment variables that override OpenGL context configuration:
It is used to specify OpenGL context version and type. It expects a value in the following format
A very important feature provided by this variable is the possibility to configure an incomplete OpenGL context. Programs can only request up to the highest OpenGL context with Khronos certification as complete from Mesa3D driver in use. Currently llvmpipe is certified for OpenGL 4.5 in core profile / forward compatible context and 3.1 in compatibility profile. Currently swr is certified for OpenGL 3.3 in core profile / forward compatible context and 3.1 in compatibility profile. Since Mesa 17.3 values meant for OpenGL 4.6 are recognized.
How to set environment variables
Under Windows the easiest way to set environment variables is by writing batch files. You’ll most likely need to do so:
You can set multiple environment variables on same batch script to mix the functionality provided by Mesa3D.
Источник
Mesa for windows x64
If you just need prebuilt binaries, click here.
Introduction
Let’s start by answering an obvious question: why would you want Mesa3D on Windows?
The answer is simple: old software. You see, sometimes old apps and games that use OpenGL do not work on modern systems because the implementation of older OpenGL versions in modern video drivers (especially AMD’s) is dreadful. Mesa3D comes with a software renderer, which means it can run those applications by emulating OpenGL on the CPU. Of course, it’s slow, but it’s fast enough to play Quake 3 and Star Trek Voyager Elite Force (on an i7), so that’s good enough. It’s also good if you have an old GPU that doesn’t support modern OpenGL.
Please excuse me if I’ll refer to Mesa3D, Gallium, Gallium, LLVMpipe, etc. simply as «Mesa».
For this tutorial we need:
Preparation
We will need the following things to build LLVM first and then Mesa:
Visual Studio
We will be using Visual Studio 2019 Community Edition, which is free and can be downloaded from Visual Studio website.
Run the installer and select Desktop development with C++. Nothing else is required. This will take a while to download and install.
Win Flex-Bison
Make a new folder in your C drive called winflexbison and extract the downloaded archive into it using 7-zip.
Press start and type «Environment variables», select Edit the system environment variables, and click Environment variables (at the bottom).
In the system variables, select PATH and click Edit.
Add C:winflexbison at the end and press OK.
CMake
Choose to add CMake to the system PATH for all users, and create the desktop icon.
Python
Go to the Python website and get the latest version of Python 2.7 64bit.
Run the installer and choose to install Python to all users and to add it to the PATH variable.
Pywin32
Go to the pywin32 github page and get the latest release for Python 2.7 64bit.
Install the downloaded file.
Mako, setuptools, scons
Press start, type «command prompt», and run it (not as administrator). Type the following commands:
Building LLVM
Get the LLVM source code tar from their website and extract it to your desktop using 7-zip.
Run CMake from the shortcut on your desktop, select the LLVM source directory for the source code, and a new llvmbuild directory on your dekstop for the binaries.
It will look like this:
Now use the Add Entry button and add the following parameters that tell LLVM what the target system is.
Be careful when copying them. It is case sensitive, and do not add spaces by accident.
Name | Type | Value (64 bit builds) | Value (32 bit builds) |
---|---|---|---|
LLVM_DEFAULT_TARGET_TRIPLE | STRING | x86_64-pc-windows-msvc19 | i686-pc-win32 |
LLVM_HOST_TRIPLE | STRING | x86_64-pc-windows | i686-pc-win32 |
LLVM_TARGETS_TO_BUILD | STRING | X86 | X86 |
LLVM_TARGET_ARCH | STRING | x86_64 | i686 |
LLVM_USE_CRT_DEBUG | STRING | MTd | MTd |
LLVM_USE_CRT_RELEASE | STRING | MT | MT |
When you’re done and it looks like this, press Configure.
It will ask which version of Visual Studio you’re using and which platform. Select Visual Studio 16 2019, and x64 for 64bit builds or Win32 for 32bit builds.
It will take a few minutes.
When it’s done, it will add a bunch of parameters of its own. Click Generate and wait a few seconds.
Click Open Project to load the project in Visual Studio.
It will take some time to load. When it’s done, select Release for compiling. It will take some time to switch.
Right click the LLVM solution and select Build Solution.
This process takes about a hour. Perfect time to watch a Star Trek episode while sipping a nice cup of Earl Grey.
Now that LLVM is ready, we need to move some files. Be very careful here as it’s easy to get wrong:
Now open the Environment Variables again and add a new system variable called LLVM, that points to the llvmbuild directory on your desktop.
LLVM is now configured and ready. If you plan to build Mesa on this machine again, you will not need to repeat these steps.
Building Mesa
Download the latest Mesa source tar from their website and extract it to your desktop using 7-zip.
To get better performance in games that use the S3TC texture format, open the Mesa folder, edit srcgalliumdriversllvmpipelp_tex_sample.h and set LP_USE_TEXTURE_CACHE to 1.
Go back to the Mesa folder on your desktop, select File and run PowerShell (not as administrator).
For a 64 bit build, use this command:
For a 32 bit build, use this command:
Watch the rest of your Star Trek episode, and when it’s over it should be done compiling.
Inside the Mesa folder, browse to buildwindows-x86_64galliumtargetslibgl-gdi (64bit build) or buildwindows-x86galliumtargetslibgl-gdi (32bit build), and here you will find opengl32.dll. This DLL is Mesa.
And there you have it, Mesa on Windows!
Credits
Thanks to Lorenzo «lowenz» Donizetti for figuring out some of the cryptic stuff going on with LLVM.
Источник
Для тех, кто придерживается графических драйверов с открытым исходным кодом, могут легко установить самую новую библиотеку Mesa 3D graphics library с помощью Ubuntu PPA.
Mesa – это программная реализация OpenGL, Vulkan, VDPAU, VA-API и других спецификаций графических API с открытым исходным кодом.
Ubuntu использует Mesa в качестве реализации OpenGL, если не используется проприетарный драйвер. Однако она всегда старая. Для пользователей, которые хотят играть в игры с открытыми драйверами RadeonSI, RADV, Intel или Nouveau, вы можете попробовать последнюю версию Mesa через PPA.
Существует надежный Ubuntu PPA, который содержит последние стабильные пакеты Mesa для Ubuntu 18.04, Ubuntu 20.04. Он также предоставляет пакеты для Ubuntu 20.10 и Ubuntu 21.04, но он не был протестирован.
- Добавьте репозиторий PPA:
Найдите и откройте терминал из меню системных приложений. Выполните команду для добавления PPA:
sudo add-apt-repository ppa:kisak/kisak-mesa
Прочитайте описание PPA по своему усмотрению и нажмите Enter, чтобы продолжить.
- Установите пакеты Mesa:
Для Ubuntu 18.04, Linux Mint, вам нужно обновить кэш пакетов, хотя в Ubuntu 20.04 и выше это делается автоматически.
sudo apt update
Наконец, установите доступные обновления всех пакетов, включая библиотеку Mesa, с помощью команды:
sudo apt full-upgrade
- Проверьте версию mesa:
Чтобы узнать версию пакета, используйте команду:
glxinfo | grep "OpenGL version".
Восстановите исходные пакеты Mesa:
Чтобы восстановить исходное состояние графического драйвера, сначала установите ppa-purge с помощью команды:
sudo apt install ppa-purge
Затем очистите Ubuntu PPA, что приведет к понижению рейтинга всех установленных пакетов:
sudo ppa-purge ppa:kisak/kisak-mesa
Для Linux Mint 20 рекомендуется добавить флаг -d focal для безопасной работы:
sudo ppa-purge -d focal ppa:kisak/kisak-mesa
Вот и все. Всем удачного дня.
Table of Contents
- Downloads
- Sponsorship
- Known issues
- Differences between MSVC and MinGW packages
-
Mingw and MSVC Package contents
- OpenGL and OpenGL ES common shared libraries
- Microsoft CLonD3D12, GLonD3D12 and D3D12 VA-API common dependency
- Desktop OpenGL drivers
- OpenGL off-screen rendering driver
- OpenGL ES drivers and EGL library
- Vulkan drivers
- OpenCL drivers, compilers and backends
- Direct3D drivers, libraries and tools
- VA-API drivers
- Testing library and tools
- Development packages
- Debug packages
- Build Mesa3D yourself
-
Installation and usage
- Usage notes
- Uninstall Mesa3D
- Legacy software compatibility
- OpenGL context configuration override
- How to set environment variables
Downloads
Mesa 22.3.4 builds with Visual Studio and MSYS2 Mingw-w64 are now available in releases section.
Sponsorship
mesa-dist-win project was given an extensible sponsorship with initial due date of November 1st 2023. Sponsorship consists in a free VPS to use as build machine with 12 GB RAM, 6 threads AMD EPYC 7413 and 150 GB NVMe SSD from Petrosky, a virtual private server hosting company thanks to @Directox01.
Known issues
This is a list of all comonly encountered issues with known solutions or workarounds. A specific release is only affected by a subset of them.
-
libgallium_wgl.dll
missing error with Mesa3D OpenGL ES and desktop OpenGL drivers
This is encountered with existing per application deployments made with 21.2.x or older when updating to 21.3.0 or newer. Just redo per app deployment to fix it. Gallium megadriver separation from opengl32.dll
was a very invasive change that existing per app deployments didn’t stand a chance against. If you don’t remember if an affected program is 32-bit or 64-bit, right click on opengl32.dll
shortcut in the folder where the program executable is located and select open file location. If location ends in x64 then it’s 64-bit, otherwise it’s 32-bit.
-
libEGL.dll
missing error with Mesa3D OpenGL ES
This is encountered with existing per application deployments made with 21.2.x or older when updating to 21.3.0 or newer. Just redo per app deployment to fix it. The EGL support was a very invasive change that existing per app deployments didn’t stand a chance against. If you don’t remember if an affected program is 32-bit or 64-bit, right click on opengl32.dll
shortcut in the folder where the program executable is located and select open file location. If location ends in x64 then it’s 64-bit, otherwise it’s 32-bit.
-
libvulkan-1.dll
missing error with Mesa3Dopengl32.dll
from MinGW release package
Only releases prior to 22.2.0 for which zink driver was built with MSYS2 MinGW-W64 vulkan-devel package group are affected. Run fix-libvulkan-1.dll-missing-error.cmd
from MinGW release package to correct it. This tool supports unattended execution via auto
command line option. This tool is only bundled in MinGW release package when needed otherwise it’s intentionally missing. The decision to use this Vulkan SDK over LunarG’s is done based on which comes with newer loader and headers.
- 64-bit binaries in both MSVC and MinGW packages require a CPU with AVX even though they shouldn’t
This is no longer an issue as of Mesa 22.0 or newer. This issue is caused by 64-bit binaries containing swr driver which leaks AVX usage into common code. This is an upstream bug reported here, here and here.
- Mesa
opengl32.dll
from MinGW package depends on Vulkan runtime since 21.0.0
This was fixed in 22.2.0 by containing this requirement to zink driver explicit usage. This is an upstream regression introduced when zink driver was patched to support Windows.
- Programs can behave like there is no OpenGL support when using Mesa
opengl32.dll
since 21.0.0
This is not a defect but rather a behavior change of Mesa when environment variables are misconfigured. It usually happens when selecting a Mesa driver that doesn’t exist in release package used or it fails to initialize due to host system not meeting hardware requirements or lacking dependencies. Reading differences between MSVC and MinGW packages and Mingw and MSVC Package contents should aid in troubleshooting.
- Important notes about errors related to missing
libglapi.dll
You may experience them with programs that use any Mesa3D desktop OpenGL driver via per app deployment tool, system wide deployment is unaffected. You may experience them if per app deployment was done before shared glapi support was introduced. shared glapi has been consistently available in both MSVC and MinGW packages since 20.0.2.
To correct these errors regardless of cause you have to re-deploy. If you don’t remember if an affected program is 32-bit or 64-bit, right click on opengl32.dll
shortcut in the folder where the program executable is located and select open file location. If location ends in x64 then it’s 64-bit, otherwise it’s 32-bit.
Same problem with same solution applies to osmesa if you are upgrading from 17.3.5.501-1 or older.
Differences between MSVC and MinGW packages
- MinGW package requires a CPU with SSSE3 with benefit of providing 3-5% performance boost with software rendering drivers;
- d3d10sw introduced in 21.2.0 is only available in MSVC package;
- MinGW package uses ZSTD for certain compression tasks since 20.1.8.
If you need to migrate from Mingw to MSVC binaries you just need to replace Mesa binaries folder from Mingw package with MSVC counterpart.
Mingw and MSVC Package contents
The following Mesa3D drivers and build artifacts are shipped in each release:
OpenGL and OpenGL ES common shared libraries
- GLAPI shared library. File name:
libglapi.dll
. Its presence is required when providing both OpenGL and OpenGL ES support. Mesa3D off-screen renderer and all Mesa3D OpenGL and OpenGL ES drivers depend on it when present. Since 20.0.2 it’s available in both MSVC and MSYS2 Mingw-w64 packages. - Gallium OpenGL megadriver. File name:
libgallium_wgl.dll
. When present it contains all Mesa3D desktop OpenGL drivers instead ofopengl32.dll
. It debuted in 21.3.0. Mesa3D EGL library and OpenGL ES drivers depend on it when present. - Mesa3D WGL runtime. File name:
opengl32.dll
. This used to contain all Mesa3D desktop OpenGL drivers and OpenGL ES depended on it, but since 21.3.0 it was reduced to only being a loader for gallium OpenGL megadriver, so only programs using Mesa3D desktop OpenGL drivers via per-application deployment depend on it now.
Microsoft CLonD3D12, GLonD3D12 and D3D12 VA-API common dependency
- DirectX IL for redistribution. File name:
dxil.dll
. This Windows SDK binary is installable via deployment tools as necessary.
Desktop OpenGL drivers
-
llvmpipe. llvmpipe is a Desktop OpenGL software renderer intended as fallback when hardware acceleration is not possible. It can only handle very light gaming with good performance. This is the default Mesa3D desktop OpenGL driver when GLonD3D12 is either unavailable or fails to load. It’s available for both x86 and x64 as part of Mesa3D Desktop OpenGL bundle
opengl32.dll
orlibgallium_wgl.dll
if the latter is available. When it’s not the default driver select it by setting environment variableGALLIUM_DRIVER=llvmpipe
. - softpipe is a reference implementation of a Desktop OpenGL software renderer with no focus towards gaming performance. It’s available for both x86 and x64 as part of Mesa3D Desktop OpenGL bundle
opengl32.dll
orlibgallium_wgl.dll
if the latter is available. Select it by setting environment variableGALLIUM_DRIVER=softpipe
. -
GLonD3D12. It’s available for both x86 and x64 in MSVC package and since 22.2.0 in MinGW package as well as part of Mesa3D Desktop OpenGL bundle
opengl32.dll
orlibgallium_wgl.dll
if the latter is available and prior to 22.3.0 as standaloneopenglon12.dll
as well. In addition to officially requiring Windows 10 v10.0.19041.488 or newer, it also depends on DirectX IL for redistribution —dxil.dll
to load, which can be installed via deployment tools. When available and if it can load, this is the default Mesa3D desktop OpenGL driver on D3D12 GPU accelerated systems. This driver introduced in 21.0.0 is operating as wrapper returning D3D12 API calls. Due to this nature it can use GPU accelleration. If it’s not selected by default you can test it with Direct3D WARP software renderer built into Windows by settingGALLIUM_DRIVER=d3d12
andLIBGL_ALWAYS_SOFTWARE=1
environment variables. The standalone copy doesn’t needGALLIUM_DRIVER=d3d12
being set and it can only be installed via system-wide deployment tool. The standalone GLonD3D12 and Mesa3D Desktop OpenGL bundle replace each other when using system-wide deployment tool but you can reverse it any time. -
zink. This driver introduced in MinGW package in 21.0.0 and MSVC package in 21.2.0 it’s available for both x86 and x64 as part of Mesa3D Desktop OpenGL bundle
opengl32.dll
orlibgallium_wgl.dll
if the latter is available. Similarly to GLonD3D12, it operates as wrapper returning Vulkan API calls. Due to this nature it uses GPU accelleration by default but it supports software rendering too. Select it viaGALLIUM_DRIVER=zink
environment variable, but note that it requires at least 1 Vulkan device and Vulkan loader/runtime to initialize. zink ignored Vulkan CPU type devices by default until 22.1.0. Nowdays it uses a priority system that automatically selects a Vulkan CPU type device if no higher priority Vulkan type device exists. You can test zink with Vulkan CPU type devices only by settingLIBGL_ALWAYS_SOFTWARE=1
(Mesa 22.1.0 and newer) orZINK_USE_LAVAPIPE=true
(deprecated in Mesa 22.1.0). -
swr. This driver is no longer available in Mesa 22.0 and newer. File names:
swrAVX.dll
,swrAVX2.dll
,swrSKX.dll
,swrKNL.dll
. Even though it resides outside of Mesa3D Desktop OpenGL bundleopengl32.dll
orlibgallium_wgl.dll
if the latter is available, it still depends on it. This alternative desktop OpenGL software rendering driver developed by Intel is optimized for visualization software. It’s available in MSVC package and since 20.1.7 in MinGW package as well. It only supports x64, x86 is officially unsupported. There are currently 4 DLLs, only one being loaded based on what the user CPU can do. You can switch to swr by setting GALLIUM_DRIVER environment variable value to swr.
OpenGL off-screen rendering driver
-
osmesa. File name:
osmesa.dll
. Available for both x86 and x64. This driver is used in special cases by software that is designed to use Mesa code to render without any kind of window system or operating system dependency. Since 21.0.0 only osmesa gallium remained. It supports OpenGL 3.x and newer. Since 20.0.2 osmesa integration with standalone GLLES drivers is available in both MSVC and MSYS2 Mingw-w64 packages requiringlibglapi.dll
in the process.
OpenGL ES drivers and EGL library
-
EGL library. File name:
libEGL.dll
. Mesa3D EGL library used by OpenGL ES drivers. This debuted in 21.3.0 and it’s available for 32-bit and 64-bit applications in both MSVC and MSYS2 packages. It depends on desktop OpenGL bundleopengl32.dll
orlibgallium_wgl.dll
if the latter is available. -
OpenGL ES standalone drivers. File names:
libGLESv1_CM.dll
andlibGLESv2.dll
. OpenGL ES 1.x, 2.x and 3.x standalone drivers available for 32-bit and 64-bit applications. Since 20.0.2 they are available in both MSVC and MSYS2 Mingw-w64 packages. They depend on Mesa3D EGL library if available and desktop OpenGL bundleopengl32.dll
orlibgallium_wgl.dll
if the latter is available.
Vulkan drivers
- lavapipe Vulkan CPU driver is available in both MSVC and MinGW packages since 21.1.0. File names:
lvp_icd.x86_64.json
,lvp_icd.x86.json
,vulkan_lvp.dll
. Note that some programs may ignore Vulkan CPU type devices on purpose. For information on how to deploy see usage notes. - Microsoft dozen Vulkan driver is available since 22.1.0 in MSVC package and since 22.2.0 in MinGW package as well. This driver relies on D3D12 API to function and it can use GPU acceleration on supported systems. File names:
dzn_icd.x86_64.json
,dzn_icd.x86.json
,vulkan_dzn.dll
. For information on how to deploy see usage notes. - Vulkan driver for AMD graphics (radv) is no longer available since 22.1.0 per @zmike suggestion as it won’t work anytime soon. RADV was available in both MSVC and MinGW packages since 21.2.0. 32-bit binary of it was available since Mesa 22.0. File names:
radeon_icd.x86_64.json
,radeon_icd.x86.json
,libvulkan_radeon.dll
andvulkan_radeon.dll
. For information on how to deploy see usage notes.
OpenCL drivers, compilers and backends
- Microsoft OpenCL stack. File names:
clon12compiler.dll
(compiler),openclon12.dll
(ICD) andWinPixEventRuntime.dll
(x64 only dependency). These components introduced in 21.0.0 are finally provided by mesa-dist-win since 21.3.0 (compiler only) and 21.3.6-2 respectively. ClonD3D12 driver is available as an OpenCL ICD. For information on how to deploy see usage notes. CLonD3D12 officially requires Windows 10 v10.0.19041.488 or newer and it depends on DirectX IL for redistribution —dxil.dll
to load, which can be installed via deployment tools. CLonD3D12 is operating as wrapper returning D3D12 API calls. Due to this nature it can use D3D12 GPU accelleration if available otherwise Windows built-in WARP software rendering is used. Even when using WARP CLonD3D12 advertises CL_DEVICE_TYPE_GPU, but this can change anytime to CL_DEVICE_TYPE_CPU. Some programs ignore drivers with CL_DEVICE_TYPE_CPU set on purpose. - clover OpenCL stack has been removed from release package in 22.1.1 until Windows support is finalized as it’s currently unusable. File names:
MesaOpenCL.dll
(ICD),OpenCL.dll
(standalone runtime), andpipe_swrast.dll
(pipe loader). The runtime can be deployed with per app deployment tool since 21.3.7 or on older versions via copy-paste along with all available pipe loaders which it depends on. While deployed, the runtime hides all other OpenCL ICDs present on the system and only lets software use Mesa3D clover as the only OpenCL driver. For information on how to deploy the ICD see usage notes.
Direct3D drivers, libraries and tools
- D3D10 software renderer is available in MSVC package since 21.2.0. File name:
d3d10sw.dll
. This is a drop in replacement for Microsoft WARP and unfortunately there is no clean way of deploying it. - SPIR-V to DXIL tool and library are available in MSVC package since 21.0.0 and since 22.2.0 in MinGW package as well. File names:
libspirv_to_dxil.dll
,spirv_to_dxil.dll
andspirv2dxil.exe
.
VA-API drivers
- VA-API D3D12 driver. File names:
vaon12_drv_video.dll
(MSVC) andlibvaon12_drv_video.dll
(MinGW). This driver was made available in 22.3.0. Unfortunately there is very little documentation on how to deploy and use VA-API drivers on Windows since it’s a new thing.
Testing library and tools
- Gallium raw interface. This deprecated component has been removed in Mesa3D 22.3.0. File names:
graw.dll
,graw_null.dll
. This is a dummy gallium driver without any graphics API mainly used for testing. Available for both x86 and x64 and in full (with window system support) and headless (no window) versions. Since 20.0.2 both windowed and windowless versions are available in both MSVC and MSYS2 Mingw-w64 packages. - test suite. Many executable unit tests.
Development packages
Headers and libraries for both 32-bit and 64-bit builds are located in a separate archive called development pack.
Debug packages
Starting with 22.2.0 a MSVC debug info package containing debug symbols in PDB format and a MinGW asserts enabled debug optimized build package are available. MinGW debug binaries can be used as drop-in replacements for their release counterparts. With software using per application deployment, this should be seamless, but for system-wide deployment, re-deployment is necessary to switch from release to debug builds and vice-versa. For more info on MinGW debugging, see debug/mingw-start-debugging.sh
Build Mesa3D yourself
Build instructions, if you want to replicate my builds, are available here.
Installation and usage
First choose between Mingw and MSVC package. See Differences between MSVC and MinGW packages section for details. Before extracting release package close all programs that use Mesa if any is running. After extraction you will have access to 2 deployment options, both located in the directory you installed Mesa. Both deployment utilities have a start-over mechanism so you can do all deployments you need in one session. The deployment tools only support OpenGL and OpenGL ES components of Mesa3D plus OpenCL clover standalone.
- A system-wide deployment tool. While intended for systems lacking hardware accelerated OpenGL support like virtual machines in cloud environments, it can also be used on any Windows system to replace the inbox software rendering OpenGL 1.1 driver extending OpenGL support for use cases where hardware accelerated OpenGL is not available like RDP connections. Due to potential issues with Virtualbox VMs running Windows it is recommended to disable 3D acceleration in such VMs if Mesa3D desktop OpenGL driver is installed inside them using the system-wide deployment tool, see #9.
- A per-application deployment tool, used to deploy Mesa3D for a single program regardless of hardware accelerated OpenGL support being present or not.
Per-app deployment utility changes are persistent and are being kept across upgrades and re-installations.
Per-app deployment utility helps you save storage and makes things easier as you won’t have to manually copy DLLs from Mesa installation directory as it creates symbolic links to whatever Mesa drivers you opt-in to use.
This behavior ensures all programs that use Mesa use the same up-to-date version.
Per-app deployment utility asks for path to directory containing application executable, application executable filename (optional, it can remain blank but if specified can force some programs to use Mesa3D when they won’t otherwise), if the app is 64-bit or 32-bit and the drivers you need.
32-bit applications have their names marked in Task Manager while running.
Most applications will use Mesa regardless of GPU capabilities, but some applications may be smart enough to load OpenGL from system directory only.
By providing the application filename, a .local file is generated in an attempt to force the application to use Mesa3D when it doesn’t want to.
Also, Federico Dossena’s Mesainjector can be used to workaround this issue as well.
Build instructions for Mesainjector.
Usage notes
- Old applications from early 200x and older may need MESA_EXTENSION_MAX_YEAR environment variable set, see legacy software compatibility section.
- Applications requiring OpenGL 3.2 or newer may need OpenGL context configuration override.
Examples on OpenGL context configuration override, switch to other driver and old applications compatibility are available here.
- The official Mesa3D documentation is available here.
- OpenCL ICDs deployment is done through registration of ICD file with system OpenCL runtime (e.g.
opencl.dll
fromWindowssystem32
). If you don’t have system OpenCL runtime you can get it by installing Intel OpenCL CPU runtime. It works for AMD CPUs as well. - Deployment for Vulkan drivers is done through Vulkan runtime using ICD discovery method. Note that Vulkan runtime commes bundled with graphics drivers supporting Vulkan so manually installing it may not be necessary.
Uninstall Mesa3D
- Run system wide deployment and perform uninstall operation if available, then exit;
- Download and run Everything tool (any flavor should work);
- Run per application deployment tool and leave it running;
- In Everything tool, in text field under menu enter
libgallium_wgl.dll attrib:L
and keep Everything tool running; - For each search result in Everything tool:
- open its location in Windows Explorer via Open Path or Open File location context menu option;
- find *.local files and remove them, but only if you are certain you specified a filename during deployment to that location;
- copy location from address bar and feed it to per application deployment tool;
- send no to all deployments until you are asked to do more deployments, send yes there.
- Repeat steps 4 and 5 using osmesa.dll and graw.dll filenames respectively the same way was done for libgallium_wgl.dll;
- Close per application deployment and Everything tools;
- Revert any registry changes and any environment variables that configure Vulkan runtime to use any of Mesa3D Vulkan drivers;
- Repeat stepp 8, but for OpenCL.
WARNING: Programs for which certain files have been overwritten by per application deployment tool may need re-installation/repair. Per application deployment tool detects and warns about this deployment scenario since 22.0.0.
Legacy software compatibility
Old applications from early 200x and older may need MESA_EXTENSION_MAX_YEAR environment variable set to avoid buffer overflows. It expects a year number as value, most commonly used being 2001. It trims the extensions list returned by Mesa3D to extensions released up to and including provided year as Mesa3D extensions list is sorted by year.
Ex: set MESA_EXTENSION_MAX_YEAR=2001
. See How to set environment variables.
OpenGL context configuration override
With release of OpenGL 3.1 many features marked as deprecated in OpenGL 3.0 have been removed and since OpenGL 3.2 launch this OpenGL specification branch is known as OpenGL core profile. Also in OpenGL 3.3 a new branch of the OpenGL specification known as forward compatible context was introduced which removes the OpenGL 3.0 deprecated features that were not removed in OpenGL 3.1.
Most proprietary drivers implemented the exemptions from these changes offered in the form of GL_ARB_compatibility extension for OpenGL 3.1 and compatibility contexts for OpenGL 3.2 and above.
Due to complexity and especially lack of correct implementation tests for GL_ARB_compatibility and compatibility contexts, Mesa3D developers chose to delay work in this area until Mesa 18.1 introduced GL_ARB_compatibility support and then Mesa 21.3 bumped compatibility contexts support to OpenGL 4.5 for llvmpipe.
In conclusion programs requesting OpenGL compatibility context won’t get above OpenGL 3.0 for Mesa 18.0, 3.1 for Mesa 18.1 and 4.5 for Mesa 21.3 and newer.
Unfortunately these kind of programs are prevalent on Windows where developers tend to avoid using context flags required by core profile.
Fortunately Mesa3D provides a mechanism to override the OpenGL context requested.
There are 2 environment variables that override OpenGL context configuration:
- MESA_GL_VERSION_OVERRIDE
It is used to specify OpenGL context version and type.
It expects a value in the following format
OpenGLMajorVersion.OpenGLMinorVersion{FC|COMPAT].
FC means a forward compatible context.
COMPAT means a compatibility context for OpenGL 3.2 and newer and GL_ARB_compatibility being enabled for OpenGL 3.1.
Absence of any string after version number means the Mesa3D default context type for OpenGL version specified which is as follows: deprecated features enabled for OpenGL 3.0, GL_ARB_compatibility enabled for OpenGL 3.1 since Mesa 18.1 and core profile for OpenGL 3.2 and above.
Examples: 3.3FC means OpenGL 3.3 forward compatible context, 3.1COMPAT means OpenGL 3.1 with GL_ARB_compatibility , 3.2 means OpenGL 3.2 core profile.
The default value for llvmpipe driver is 4.5COMPAT for Mesa>=21.3, 3.1COMPAT for Mesa>=18.1 and 3.0COMPAT for Mesa<=18.0.
A very important feature provided by this variable is the possibility to configure an incomplete OpenGL context.
Programs can only request up to the highest OpenGL context with Khronos certification as complete from Mesa3D driver in use.
Currently llvmpipe is certified for OpenGL 4.5 in all OpenGL profiles. Currently swr and GLonD3D12 are certified for OpenGL 3.3 in core profile / forward compatible context and 3.1 in compatibility profile. zink OpenGL support depends on underlying Vulkan driver.
Since Mesa 17.3 values meant for OpenGL 4.6 are recognized.
- MESA_GLSL_VERSION_OVERRIDE
Used to specify shading language version.
Supported values are version numbers converted to integer: 110, 120, 130, 140. 150, 330, 400, 410, 420, 430, 440, 450 and 460. Value 460 is only recognized since Mesa 17.3. Value 130 for example matches GLSL 1.30. It is always a good idea to keep OpenGL context and shading language versions in sync to avoid programs confusion which may result in crashes or glitches. This can happen because most applications rely on proprietary drivers behavior of having OpenGL and GLSL versions in sync. Here is the OpenGL — GLSL correlation table.
Default values for llvmpipe: 450 for Mesa 21.3, 140 for Mesa 18.1 and 130 for Mesa 18.0 if MESA_GL_VERSION_OVERRIDE is undefined or matching core profile’s otherwise.
How to set environment variables
Under Windows the easiest way to set environment variables is by writing batch files. You’ll most likely need to do so:
- for every application requiring higher OpenGL and GLSL versions than what is exposed by selected Mesa3D driver by default;
- if you want to select a non-default driver for desktop OpenGL;
- if you need to trim extensions list for old programs compatibility.
Simply open Notepad, write the batch script. When saving, end the file name with .bat or .cmd, change save as type to all files and change save location to where the application executable is located. If you have some skill with batch scripts you can change the current directory during script execution using CD command opening the possibility to save the script anywhere you want as shown in rpcs3 and GPU Caps Viewer examples.
Documentation of most environment variables used by Mesa is available here.
Complete examples are available here.
You can set multiple environment variables on same batch script to mix the functionality provided by Mesa3D.
Open Source Agenda is not affiliated with «Mesa Dist Win» Project. README Source: pal1000/mesa-dist-win