From ab5ae2668aaa9aab44e49c22839ecc800a0381f4 Mon Sep 17 00:00:00 2001 From: Locietta Date: Fri, 16 Dec 2022 14:12:31 +0800 Subject: [PATCH] vulkan@1.3.231.1: Add registry notes and cleanup (Fix #4218) (#4222) * vulkan@1.3.231.1: Add registry notes and cleanup (Fix #4218) * vulkan: Update to version 1.3.236.0 * vulkan: workaround CI error --- bucket/vulkan.json | 28 +++++++++++++++++++++++++++- scripts/vulkan/install-vk-layers.ps1 | 15 +++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 scripts/vulkan/install-vk-layers.ps1 diff --git a/bucket/vulkan.json b/bucket/vulkan.json index 322c9b294b..124fde69d7 100644 --- a/bucket/vulkan.json +++ b/bucket/vulkan.json @@ -8,11 +8,25 @@ }, "notes": [ "Make sure you have the vulkan driver installed.", - "Variety of drivers of different graphic card vendors could be found at the bottom of 'https://www.khronos.org/vulkan/'" + "Variety of drivers of different graphic card vendors could be found at the bottom of 'https://www.khronos.org/vulkan/'", + "", + "Allow vulkan applications to find VK layers provided by Khronos, run \"$dir\\install-vk-layers.ps1\"", + "(\"powershell \"$dir\\install-vk-layers.ps1\"\" under cmd)" ], "url": "https://sdk.lunarg.com/sdk/download/1.3.236.0/windows/VulkanSDK-1.3.236.0-Installer.exe#/dl.7z", "hash": "0b21c602ef0d62ee49c39e03b35207d136130bf110682d7cad2c620265031dcc", "pre_install": "Remove-Item \"$dir\\`$*\", \"$dir\\Uninstal*\" -Recurse", + "post_install": [ + "$script_path = \"$bucketsdir\\main\\scripts\\$app\\install-vk-layers.ps1\"", + "if (Test-Path $script_path) {", + " $vulkan_bin = if ($architecture -eq '64bit') { \"$dir\\Bin\" } else { \"$dir\\Bin32\" }", + " $content = Get-Content $script_path", + " $content = $content.Replace('$vulkan_bin', \"\"\"$vulkan_bin\"\"\")", + " $content = $content.Replace('$global', $(if ($global) { '$true' } else { '$false' }))", + " $content = $content.Replace('$is_admin', $(if (is_admin) { '$true' } else { '$false' }))", + "}", + "Set-Content -Path \"$dir\\install-vk-layers.ps1\" -Value $content -Encoding UTF8" + ], "architecture": { "64bit": { "env_add_path": [ @@ -31,6 +45,18 @@ "VULKAN_SDK": "$dir", "VK_SDK_PATH": "$dir" }, + "pre_uninstall": [ + "$reg_root = if ($global) { [Microsoft.Win32.Registry]::LocalMachine } else { [Microsoft.Win32.Registry]::CurrentUser }", + "$vk_explicit_reg_path = 'SOFTWARE\\Khronos\\Vulkan\\ExplicitLayers'", + "$bin_dir = if ($architecture -eq '64bit') { 'Bin' } else { 'Bin32' }", + "$vulkan_bin = if ($global) { \"$globaldir\\apps\\$app\\current\\$bin_dir\" } else { \"$scoopdir\\apps\\$app\\current\\$bin_dir\" }", + "$vk_layers = Get-ChildItem -Path $vulkan_bin -Filter '*.json' | ForEach-Object { $_.FullName }", + "$vk_explicit_reg = $reg_root.CreateSubKey($vk_explicit_reg_path)", + "foreach ($vk_layer in $vk_layers) {", + " $vk_explicit_reg.DeleteValue($vk_layer, $false)", + "}", + "$vk_explicit_reg.Close()" + ], "checkver": { "url": "https://vulkan.lunarg.com/sdk/latest/windows.json", "jsonpath": "$.windows" diff --git a/scripts/vulkan/install-vk-layers.ps1 b/scripts/vulkan/install-vk-layers.ps1 new file mode 100644 index 0000000000..9b6539a778 --- /dev/null +++ b/scripts/vulkan/install-vk-layers.ps1 @@ -0,0 +1,15 @@ +if ($global -and (-not $is_admin)) { + Write-Host "ERROR write registries for global installation needs admin rights!" -ForegroundColor DarkRed + exit 1 +} + +$reg_root = if ($global) { [Microsoft.Win32.Registry]::LocalMachine } else { [Microsoft.Win32.Registry]::CurrentUser } +$vk_explicit_reg_path = 'SOFTWARE\Khronos\Vulkan\ExplicitLayers' +$vk_explicit_reg = $reg_root.CreateSubKey($vk_explicit_reg_path) + +$vk_layers = Get-ChildItem -Path $vulkan_bin -Filter '*.json' | ForEach-Object { $_.FullName } +foreach ($vk_layer in $vk_layers) { + $vk_explicit_reg.SetValue($vk_layer, 0, [Microsoft.Win32.RegistryValueKind]::DWord) +} + +$vk_explicit_reg.Close()