Skip to content

Instantly share code, notes, and snippets.

@2xsaiko
Last active November 7, 2018 12:45
Show Gist options
  • Save 2xsaiko/8dd1a3d908d8ec4330f29e083e463721 to your computer and use it in GitHub Desktop.
Save 2xsaiko/8dd1a3d908d8ec4330f29e083e463721 to your computer and use it in GitHub Desktop.
Vulkan on Wine setup script
#!/bin/bash
query_abort() {
printf "==> %s [Y/n] " "$1"
read -n 1 response
case "$response" in
'Y'|'y'|'')
;;
*)
printf "\n%s\n" "Aborting."
exit 1
esac
}
wine --version | grep -q Staging || query_abort "WARNING: Wine Staging not installed. Apparently Vulkan doesn't work that well with normal Wine (as of 3.4). Proceed?"
if [ "x$WINEPREFIX" = "x" ]; then
query_abort "WINEPREFIX is not set. Proceed and use ~/.wine as WINEPREFIX?"
WINEPREFIX="$HOME/.wine"
fi
export WINEPREFIX
set -e
is_wine_64bit() {
test "x$WINEARCH" = "xwin64" && return 0
test "x$WINEARCH" = "xwin32" && return 1
which wine64 2> /dev/null > /dev/null
}
install_vulkansdk() {
# Apparently, the winetricks that has 'vulkansdk' is still too new, so we're manually downloading the thing for now
#winetricks vulkansdk
test ! -f /tmp/vulkansdk.exe &&
wget -O /tmp/vulkansdk.exe 'https://sdk.lunarg.com/sdk/download/1.0.68.0/windows/VulkanSDK-1.0.68.0-Installer.exe'
wine /tmp/vulkansdk.exe /S
}
setup_cfg() {
cat > "$WINEPREFIX/drive_c/windows/winevulkan.json" <<EOF
{
"file_format_version": "1.0.0",
"ICD": {
"library_path": "c:\\\\windows\\\\system32\\\\winevulkan.dll",
"api_version": "1.0.51"
}
}
EOF
}
setup_registry() {
cat > "/tmp/vulkan.reg" <<EOF
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Khronos\\Vulkan\\Drivers\\]
"C:\\\\Windows\\\\winevulkan.json"=dword:00000000
EOF
"wine$1" reg import "/tmp/vulkan.reg"
}
wineboot
install_vulkansdk
setup_cfg
setup_registry
is_wine_64bit && setup_registry 64
printf "%s\n" "==> Done! Enjoy Vulkan :)"
@Hairo
Copy link

Hairo commented Mar 18, 2018

Getting this when trying to run vulkaninfo.exe

===========
VULKAN INFO
===========

Vulkan API Version: 1.0.68

002c:fixme:setupapi:CM_Get_Device_ID_List_SizeA 0x23edf0 "{4d36e968-e325-11ce-bfc1-08002be10318}" 0x00000300: stub
002c:fixme:setupapi:CM_Get_Device_ID_ListA "{4d36e968-e325-11ce-bfc1-08002be10318}" 0x999b0 0 0x00000300: stub
002c:fixme:setupapi:CM_Locate_DevNodeA 0x23edec "\x10\x03\x01" 0x00000000: stub
002c:fixme:setupapi:CM_Get_Device_ID_List_SizeA 0x23ed80 "{4d36e968-e325-11ce-bfc1-08002be10318}" 0x00000300: stub
002c:fixme:setupapi:CM_Get_Device_ID_ListA "{4d36e968-e325-11ce-bfc1-08002be10318}" 0x999e0 0 0x00000300: stub
002c:fixme:setupapi:CM_Locate_DevNodeA 0x23ed7c "\x10\x03\x01" 0x00000000: stub
002c:fixme:setupapi:CM_Get_Device_ID_List_SizeA 0x23ed80 "{4d36e968-e325-11ce-bfc1-08002be10318}" 0x00000300: stub
002c:fixme:setupapi:CM_Get_Device_ID_ListA "{4d36e968-e325-11ce-bfc1-08002be10318}" 0x999e0 0 0x00000300: stub
002c:fixme:setupapi:CM_Locate_DevNodeA 0x23ed7c "\x10\x03\x01" 0x00000000: stub
002c:fixme:setupapi:CM_Get_Device_ID_List_SizeA 0x23edf0 "{4d36e968-e325-11ce-bfc1-08002be10318}" 0x00000300: stub
002c:fixme:setupapi:CM_Get_Device_ID_ListA "{4d36e968-e325-11ce-bfc1-08002be10318}" 0x99a10 0 0x00000300: stub
002c:fixme:setupapi:CM_Locate_DevNodeA 0x23edec "\x10\x03\x01" 0x00000000: stub
002c:fixme:setupapi:CM_Get_Device_ID_List_SizeA 0x23ed80 "{4d36e968-e325-11ce-bfc1-08002be10318}" 0x00000300: stub
002c:fixme:setupapi:CM_Get_Device_ID_ListA "{4d36e968-e325-11ce-bfc1-08002be10318}" 0x99a40 0 0x00000300: stub
002c:fixme:setupapi:CM_Locate_DevNodeA 0x23ed7c "\x10\x03\x01" 0x00000000: stub
002c:fixme:setupapi:CM_Get_Device_ID_List_SizeA 0x23ed80 "{4d36e968-e325-11ce-bfc1-08002be10318}" 0x00000300: stub
002c:fixme:setupapi:CM_Get_Device_ID_ListA "{4d36e968-e325-11ce-bfc1-08002be10318}" 0x99a40 0 0x00000300: stub
002c:fixme:setupapi:CM_Locate_DevNodeA 0x23ed7c "\x10\x03\x01" 0x00000000: stub
002c:fixme:setupapi:CM_Get_Device_ID_List_SizeA 0x23edc0 "{4d36e968-e325-11ce-bfc1-08002be10318}" 0x00000300: stub
002c:fixme:setupapi:CM_Get_Device_ID_ListA "{4d36e968-e325-11ce-bfc1-08002be10318}" 0x999b0 0 0x00000300: stub
002c:fixme:setupapi:CM_Locate_DevNodeA 0x23edbc "\x10\x01\x01" 0x00000000: stub
002c:fixme:setupapi:CM_Get_Device_ID_List_SizeA 0x23e8f0 "{4d36e968-e325-11ce-bfc1-08002be10318}" 0x00000300: stub
002c:fixme:setupapi:CM_Get_Device_ID_ListA "{4d36e968-e325-11ce-bfc1-08002be10318}" 0x99be0 0 0x00000300: stub
002c:fixme:setupapi:CM_Locate_DevNodeA 0x23e8ec "\x10\x03\x01" 0x00000000: stub
002c:fixme:setupapi:CM_Get_Device_ID_List_SizeA 0x23edc0 "{4d36e968-e325-11ce-bfc1-08002be10318}" 0x00000300: stub
002c:fixme:setupapi:CM_Get_Device_ID_ListA "{4d36e968-e325-11ce-bfc1-08002be10318}" 0x99be0 0 0x00000300: stub
002c:fixme:setupapi:CM_Locate_DevNodeA 0x23edbc "\x10\x03\x01" 0x00000000: stub
002c:fixme:setupapi:CM_Get_Device_ID_List_SizeA 0x23e8f0 "{4d36e968-e325-11ce-bfc1-08002be10318}" 0x00000300: stub
002c:fixme:setupapi:CM_Get_Device_ID_ListA "{4d36e968-e325-11ce-bfc1-08002be10318}" 0x99de0 0 0x00000300: stub
002c:fixme:setupapi:CM_Locate_DevNodeA 0x23e8ec "\x10\x03\x01" 0x00000000: stub
002c:fixme:setupapi:CM_Get_Device_ID_List_SizeA 0x23ee10 "{4d36e968-e325-11ce-bfc1-08002be10318}" 0x00000300: stub
002c:fixme:setupapi:CM_Get_Device_ID_ListA "{4d36e968-e325-11ce-bfc1-08002be10318}" 0x99ea0 0 0x00000300: stub
002c:fixme:setupapi:CM_Locate_DevNodeA 0x23ee0c "\x10\x03\x01" 0x00000000: stub
ERROR: [loader] Code 0 : loaderGetRegistryFiles: failed to open DevNode 
WARNING: [loader] Code 0 : loader_get_manifest_files: Registry lookup failed to get layer manifest files.
002c:fixme:setupapi:CM_Get_Device_ID_List_SizeA 0x23ee10 "{4d36e968-e325-11ce-bfc1-08002be10318}" 0x00000300: stub
002c:fixme:setupapi:CM_Get_Device_ID_ListA "{4d36e968-e325-11ce-bfc1-08002be10318}" 0x99ea0 0 0x00000300: stub
002c:fixme:setupapi:CM_Locate_DevNodeA 0x23ee0c "\x10\x03\x01" 0x00000000: stub
ERROR: [loader] Code 0 : loaderGetRegistryFiles: failed to open DevNode 
002c:fixme:setupapi:CM_Get_Device_ID_List_SizeA 0x23e9f0 "{4d36e968-e325-11ce-bfc1-08002be10318}" 0x00000300: stub
002c:fixme:setupapi:CM_Get_Device_ID_ListA "{4d36e968-e325-11ce-bfc1-08002be10318}" 0x9a070 0 0x00000300: stub
002c:fixme:setupapi:CM_Locate_DevNodeA 0x23e9ec "\xf0\x02\x01" 0x00000000: stub
ERROR: [loader] Code 0 : loaderGetRegistryFiles: failed to open DevNode ­
ERROR: [loader] Code 0 : loader_get_manifest_files: Registry lookup failed to get ICD manifest files.  Possibly missing Vulkan driver?
Cannot create Vulkan instance.
C:\VulkanSDKBuild\workspace\LoaderAndValidationLayers\demos\vulkaninfo.c:808: failed with VK_ERROR_INCOMPATIBLE_DRIVER
002c:fixme:console:GetConsoleProcessList (0x23f9d0,2): stub
^C0031:fixme:console:CONSOLE_DefaultHandler Terminating process 2b on event 0

@2xsaiko
Copy link
Author

2xsaiko commented Mar 18, 2018

Hmm. Does the file c:\windows\system32\winevulkan.dll exist?

@TiZ-HugLife
Copy link

TiZ-HugLife commented Mar 20, 2018

I've got some problems too, but different ones. Sorry to cut in. My log ends like this:

0009:err:vulkan:wine_vk_init Failed to load Wine graphics driver supporting Vulkan.
ERROR: [loader] Code 0 : Failed to open dynamic library "c:\windows\system32\winevulkan.dll" with error 1114
Cannot create Vulkan instance.
C:\VulkanSDKBuild\workspace\LoaderAndValidationLayers\demos\vulkaninfo.c:808: failed with VK_ERROR_INCOMPATIBLE_DRIVER
0009:fixme:console:GetConsoleProcessList (0x32fbf8,2): stub
0032:fixme:console:CONSOLE_DefaultHandler Terminating process 8 on event 0

Doesn't matter if I use vulkan-3.3, 3.4, staging-3.4 (these three from Lutris's runners repo; I'm not actually using Lutris itself), or the official 3.4 from the WineHQ PPA. Also doesn't matter if I use your setup script or do it manually after installing the SDK with winetricks.

@Firenox89
Copy link

@Hairo This line looks like it does not find your winevulkan.json file.
loader_get_manifest_files: Registry lookup failed to get ICD manifest files. Possibly missing Vulkan driver?

@TiZ-EX1 I got pretty much the same issue.

From vulkaninfo.exe
Vulkan API Version: 1.0.68

From vulkaninfo (on linux)
Vulkan Instance Version: 1.1.70

Could this be a problem or should this work out?
Could a guy with a working setup post his versions?

@2xsaiko
Copy link
Author

2xsaiko commented Mar 23, 2018

sure, mine works, so why not:

OS: Arch Linux
wine version: wine-3.4 (Staging)
wine package: wine-staging 3.4-1
vulkan version (native): 1.1.70
vulkan version (wine): 1.0.68
Just made a new wineprefix and ran the setup script, and then wine vulkaninfo to get that version

@Hairo
Copy link

Hairo commented Mar 23, 2018

Ok, tried again with wine 3.4-staging and it's workng now, was using stable 3.4 before, maybe it doesn't work with the stable branch?

@winiciuscota
Copy link

winiciuscota commented Mar 27, 2018

@Hairo samething here. Only worked on the staging version

@2xsaiko
Copy link
Author

2xsaiko commented Mar 30, 2018

added a warning when not using staging

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment