wsl-vulkan-mesa
                                
                                 wsl-vulkan-mesa copied to clipboard
                                
                                    wsl-vulkan-mesa copied to clipboard
                            
                            
                            
                        Mesa 3D graphics library (read-only mirror)
Valkan (lavapipe) for WSL
This repo (https://github.com/gnsmrky/wsl-vulkan-mesa) is based on mesa 20.3 repo, the 1st official release includes lavapipe.  lavapipe is the Vulkan frontend in mesa that uses llvmpipe as software renderer.
The original lavapipe does not support Windows Subsystem for Linux (WSL) in Windows 10.  This repo adds workarounds to allow lavapipe to work in WSL and display via VcXsrv.
Prerequisite
- WSL Ubuntu 18.04.5 or 20.04.1
- VcXsrv for Windows - Windows X Sever
 This repo uses VcXsrv as Windows X Server on Windows 10. Haven't tested with other X Server alternatives. Pls leave your feedbacks inissuesif you reccommend others.- Download and install VcXsrvfrom https://sourceforge.net/projects/vcxsrv/.
 
- Download and install 
Pre-built releases
- Install required packages
sudo apt update sudo apt install llvm libxcb-randr0 libxcb-shm0 libxcb-xfixes0
- Download tarball binaries from Releases.
- Extract to ~/mesa-localfolder- Ubuntu 18.04
mkdir ~/mesa-local tar xzvf wsl-ubuntu1804-vulkan-mesa20.3-20201220.tar.gz -C ~/mesa-local
- Ubuntu 20.04
mkdir ~/mesa-local tar xzvf wsl-ubuntu2004-vulkan-mesa20.3-20201220.tar.gz -C ~/mesa-local
 
- Ubuntu 18.04
- Follow Instsall mesa and run vulkan tools to install and run vulkan
Build mesa for WSL Ubuntu 18.04 or 20.04
Open WSL with Ubuntu 18.04 or 20.04.
- 
Update and install needed packages for development. sudo apt update sudo apt install build-essential git python3-pip pkg-config llvm \ valgrind vainfo bison flex llvm libdrm-dev libxdamage-dev libx11-dev \ libx11-xcb-dev libxext-dev libxcb-glx0-dev libxcb-dri2-0-dev \ libxcb-dri3-dev libxcb-present-dev libxcb-shm0-dev libxshmfence-dev \ libxxf86vm-dev x11-xserver-utils libxrandr-dev
- 
Setup python - 
Environment vars alias python=python3 && alias pip=pip3 && export PATH=~/.local/bin:$PATH
- 
Install python3 packages. 
 pip install meson ninja cmake mako
 
- 
- 
Get this repo and prepare for build env - Get this repo
 git clone https://github.com/gnsmrky/wsl-vulkan-mesa
- Change directory to the repo and create & change to buildfolder.cd wsl-vulkan-mesa mkdir build cd build
 
- Get this repo
- 
In buildfolder, config & build mesa.- 
This sets the target folder at /usr.meson -Dprefix=/usr -Ddri-drivers= -Dglx=dri -Dllvm=enabled \ -Ddri-driver-path=/usr/local/lib/x86_64-linux-gnu/dri \ -Dgallium-drivers="swrast" -Dplatforms=x11 -Dosmesa=gallium \ -Dvulkan-drivers=swrast ..
- 
Build mesa 
 ninja
- 
Install mesa to target folder ~/mesa-local.
 DESTDIR=~/mesa-local ninja install
 
- 
Install mesa and run vulkan tools.
- 
Config VcXsrvfor vulkan (also applies to OpenGL).- Launch VcXsrvon Windows 10. Upon launching, set the following:- Select Multiple window.
- Set Display numberto1.
- Select Start no client(should be default setting).
- Disable Native opengl.
 
- Select 
- In WSL, set DISPLAYenvar to1.
 export DISPLAY=:1
 
- Launch 
- 
In WSL, copy mesa build files from ~/mesa-localto/usrfolder.
 Warning: This will replace mesa library files in WSL (mesa will be udpated from v20.0.8 to v20.3.0)!
 sudo cp -R ~/mesa-local/usr/* /usr- Check the mesa versio after copying files.
 glxinfo -B | grep -i 'version string' | grep Mesa
 
- Check the mesa versio after copying files.
- 
Validate and run Vulkan tools. - 
On WSL Ubuntu 18.04, install vulkan-utilsand runvulkaninfosudo apt install vulkan-utils vulkaninfo | grep -i deviceNameReturns the following: WARNING: lavapipe is not a conformant vulkan implementation, testing use only. deviceName = llvmpipe (LLVM 6.0.0, 256 bits)- Run vulkan-smoketest.
  
 
- Run 
- 
On WSL Ubuntu 20.04, install vulkan-toolsand runvkcube.sudo apt install vulkan-tools vulkaninfo | grep -i deviceNameReturns the following: error: XDG_RUNTIME_DIR not set in the environment. WARNING: lavapipe is not a conformant vulkan implementation, testing use only. deviceName = llvmpipe (LLVM 10.0.0, 256 bits)- Run vkcube
  
 
- Run 
 
-