David Pinedo | 1e368f7 | 2016-02-04 17:04:44 -0700 | [diff] [blame] | 1 | # Copyright (c) 2015-2016 The Khronos Group Inc.
|
| 2 | # Copyright (c) 2015-2016 Valve Corporation
|
| 3 | # Copyright (c) 2015-2016 LunarG, Inc.
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 4 | #
|
David Pinedo | 1e368f7 | 2016-02-04 17:04:44 -0700 | [diff] [blame] | 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 | # of this software and/or associated documentation files (the "Materials"), to
|
| 7 | # deal in the Materials without restriction, including without limitation the
|
| 8 | # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
| 9 | # sell copies of the Materials, and to permit persons to whom the Materials are
|
| 10 | # furnished to do so, subject to the following conditions:
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 11 | #
|
David Pinedo | 1e368f7 | 2016-02-04 17:04:44 -0700 | [diff] [blame] | 12 | # The above copyright notice(s) and this permission notice shall be included in
|
| 13 | # all copies or substantial portions of the Materials.
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 14 | #
|
David Pinedo | 1e368f7 | 2016-02-04 17:04:44 -0700 | [diff] [blame] | 15 | # THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
David Pinedo | 1e368f7 | 2016-02-04 17:04:44 -0700 | [diff] [blame] | 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
| 18 | #
|
| 19 | # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
| 20 | # DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
| 21 | # OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE
|
| 22 | # USE OR OTHER DEALINGS IN THE MATERIALS.
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 23 | #
|
| 24 | # Author: David Pinedo <david@LunarG.com>
|
David Pinedo | 1e368f7 | 2016-02-04 17:04:44 -0700 | [diff] [blame] | 25 | # Author: Mark Young <mark@LunarG.com>
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 26 | #
|
| 27 |
|
David Pinedo | 1e368f7 | 2016-02-04 17:04:44 -0700 | [diff] [blame] | 28 |
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 29 | # This Powershell script is used by the Vulkan Run Time Installer/Uninstaller to:
|
| 30 | # - Copy the most recent vulkan-<majorabi>-*.dll in C:\Windows\System32
|
| 31 | # to vulkan-<majorabi>.dll
|
| 32 | # - Copy the most recent version of vulkaninfo-<abimajor>-*.exe in
|
| 33 | # C:\Windows\System32 to vulkaninfo.exe
|
Mark Young | 4b8b548 | 2016-01-15 15:09:39 -0700 | [diff] [blame] | 34 | # - The same thing is done for those files in C:\Windows\SysWOW64 on a 64-bit
|
| 35 | # target.
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 36 | # - Set the layer registry entries to point to the layer json files
|
| 37 | # in the Vulkan SDK associated with the most recent vulkan*dll.
|
| 38 | #
|
Mark Young | af87f22 | 2016-01-20 16:33:18 -0700 | [diff] [blame] | 39 | # This script takes the following parameters:
|
Mark Young | 4b8b548 | 2016-01-15 15:09:39 -0700 | [diff] [blame] | 40 | # $majorabi : a single string number specifying the major abi version.
|
Mark Young | af87f22 | 2016-01-20 16:33:18 -0700 | [diff] [blame] | 41 | # $ossize : an integer indicating if the target is a 64 (64) or 32 (32) bit OS.
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 42 | #
|
| 43 |
|
Mark Young | 4b8b548 | 2016-01-15 15:09:39 -0700 | [diff] [blame] | 44 | Param(
|
| 45 | [string]$majorabi,
|
| 46 | [int]$ossize
|
| 47 | )
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 48 |
|
| 49 | $vulkandll = "vulkan-"+$majorabi+".dll"
|
Mark Young | 71e2a40 | 2016-02-12 12:07:45 -0700 | [diff] [blame] | 50 | $windrive = $env:SYSTEMDRIVE
|
| 51 | $winfolder = $env:SYSTEMROOT
|
David Pinedo | d133b78 | 2016-03-16 14:41:56 -0600 | [diff] [blame] | 52 | $script:VulkanDllList=@()
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 53 |
|
David Pinedo | c27e044 | 2016-03-15 11:07:19 -0600 | [diff] [blame] | 54 | function notNumeric ($x) {
|
| 55 | try {
|
| 56 | 0 + $x | Out-Null
|
| 57 | return $false
|
| 58 | } catch {
|
| 59 | return $true
|
| 60 | }
|
| 61 | }
|
| 62 |
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 63 | # The name of the versioned vulkan dll file is one of the following:
|
| 64 | #
|
David Pinedo | 3bdbe5d | 2016-01-12 16:14:53 -0700 | [diff] [blame] | 65 | # vulkan-<majorabi>-<major>-<minor>-<patch>-<buildno>-<prerelease>-<prebuildno>
|
| 66 | # vulkan-<majorabi>-<major>-<minor>-<patch>-<buildno>-<prerelease>
|
| 67 | # vulkan-<majorabi>-<major>-<minor>-<patch>-<buildno>-<prebuildno>
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 68 | # vulkan-<majorabi>-<major>-<minor>-<patch>-<buildno>.dll
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 69 | #
|
David Pinedo | 3bdbe5d | 2016-01-12 16:14:53 -0700 | [diff] [blame] | 70 | # <major>, <minor>, <patch>, <buildno> and <prebuildno> are 1 to 10 numeric digits.
|
| 71 | # <prerelease> is any combination of alpha and numeric characters.
|
| 72 | # If <prerelease> and/or <prebuildno> are present, this identifies a prerelease,
|
| 73 | # and the vulkan dll file will be considered less recent than one with the same
|
| 74 | # <major>, <minor>, <patch>, <buildno> numbers without the <prerelease> and/or
|
| 75 | # <prebuildno>.
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 76 |
|
| 77 |
|
| 78 | # We first create an array, with one array element for each vulkan-*dll in
|
Mark Young | 4b8b548 | 2016-01-15 15:09:39 -0700 | [diff] [blame] | 79 | # C:\Windows\System32 (and C:\Windows\SysWOW64 on 64-bit systems), with each element
|
| 80 | # containing:
|
David Pinedo | 3bdbe5d | 2016-01-12 16:14:53 -0700 | [diff] [blame] | 81 | # <major>=<minor>=<patch>=<buildno>=<prerelease>=<prebuildno>=
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 82 | # filename
|
David Pinedo | 3bdbe5d | 2016-01-12 16:14:53 -0700 | [diff] [blame] | 83 | # @<major>@<minor>@<patch>@<buildno>@<prerelease>@<prebuildno>@
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 84 | # [Note that the above three lines are one element in the array.]
|
| 85 | # The build identifiers separated by "=" are suitable for sorting, i.e.
|
David Pinedo | 3bdbe5d | 2016-01-12 16:14:53 -0700 | [diff] [blame] | 86 | # expanded to 10 digits with leading 0s. If <prerelease> or <prebuildno> are
|
| 87 | # not specified, "zzzzzzzzzz" is substituted for them, so that they sort
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 88 | # to a position after those that do specify them.
|
| 89 | # The build identifiers separated by "@" are the original values extracted
|
| 90 | # from the file name. They are used later to find the path to the SDK
|
| 91 | # install directory for the given filename.
|
| 92 |
|
David Pinedo | c27e044 | 2016-03-15 11:07:19 -0600 | [diff] [blame] | 93 |
|
Mark Young | d6897a3 | 2016-01-20 14:48:21 -0700 | [diff] [blame] | 94 | function UpdateVulkanSysFolder([string]$dir, [int]$writeSdkName)
|
Mark Young | a81e608 | 2016-01-15 12:35:39 -0700 | [diff] [blame] | 95 | {
|
| 96 | # Push the current path on the stack and go to $dir
|
| 97 | Push-Location -Path $dir
|
David Pinedo | 1e368f7 | 2016-02-04 17:04:44 -0700 | [diff] [blame] | 98 |
|
David Pinedo | d133b78 | 2016-03-16 14:41:56 -0600 | [diff] [blame] | 99 | # Create a list for all the DLLs in the folder.
|
| 100 | # First Initialize the list to empty
|
| 101 | $script:VulkanDllList = @()
|
David Pinedo | 1e368f7 | 2016-02-04 17:04:44 -0700 | [diff] [blame] | 102 |
|
Mark Young | a81e608 | 2016-01-15 12:35:39 -0700 | [diff] [blame] | 103 | # Find all DLL objects in this directory
|
| 104 | dir -name vulkan-$majorabi-*.dll |
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 105 | ForEach-Object {
|
David Pinedo | c27e044 | 2016-03-15 11:07:19 -0600 | [diff] [blame] | 106 | if ($_ -match "=" -or
|
| 107 | $_ -match "@" -or
|
| 108 | $_ -match " " -or
|
| 109 | ($_.Split('-').count -lt 6) -or
|
| 110 | ($_.Split('-').count -gt 8))
|
| 111 | {
|
| 112 | # If a file name contains "=", "@", or " ", or it contains less then 5 dashes or more than
|
| 113 | # 7 dashes, it wasn't installed by the Vulkan Run Time.
|
| 114 | # Note that we need to use return inside of ForEach-Object is to continue with iteration.
|
| 115 | return
|
| 116 | }
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 117 | $major=$_.Split('-')[2]
|
| 118 | $majorOrig=$major
|
| 119 | $minor=$_.Split('-')[3]
|
| 120 | $minorOrig=$minor
|
| 121 | $patch=$_.Split('-')[4]
|
David Pinedo | 3bdbe5d | 2016-01-12 16:14:53 -0700 | [diff] [blame] | 122 | $patchOrig=$patch
|
| 123 | $buildno=$_.Split('-')[5]
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 124 |
|
David Pinedo | 3bdbe5d | 2016-01-12 16:14:53 -0700 | [diff] [blame] | 125 | if ($buildno -match ".dll") {
|
David Pinedo | c27e044 | 2016-03-15 11:07:19 -0600 | [diff] [blame] | 126 | # prerelease and prebuildno are not in the name
|
| 127 | # Extract buildno, and set prerelease and prebuildno to "z"s
|
| 128 | $buildno=$buildno -replace ".dll",""
|
| 129 | $buildnoOrig=$buildno
|
| 130 | $prerelease="z"*10
|
| 131 | $prereleaseOrig=""
|
| 132 | $prebuildno="z"*10
|
| 133 | $prebuildnoOrig=""
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 134 | } else {
|
David Pinedo | c27e044 | 2016-03-15 11:07:19 -0600 | [diff] [blame] | 135 | # Extract buildno, prerelease, and prebuildno
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 136 | $f=$_ -replace ".dll",""
|
David Pinedo | 3bdbe5d | 2016-01-12 16:14:53 -0700 | [diff] [blame] | 137 | $buildno=$f.Split('-')[5]
|
David Pinedo | 5da20dd | 2016-01-13 16:22:19 -0700 | [diff] [blame] | 138 | $buildnoOrig=$buildno
|
David Pinedo | 3bdbe5d | 2016-01-12 16:14:53 -0700 | [diff] [blame] | 139 | $prerelease=$f.Split('-')[6]
|
| 140 | $prebuildno=$f.Split('-')[7]
|
| 141 | if ($prebuildno.Length -eq 0) {
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 142 | if ($prerelease -match "^[0-9]") {
|
David Pinedo | 3bdbe5d | 2016-01-12 16:14:53 -0700 | [diff] [blame] | 143 | # prerelease starts with a digit, it must be the prebuildno
|
| 144 | $prebuildno=$prerelease
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 145 | $prerelease=""
|
| 146 | }
|
| 147 | }
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 148 | $prereleaseOrig=$prerelease
|
David Pinedo | 3bdbe5d | 2016-01-12 16:14:53 -0700 | [diff] [blame] | 149 | $prebuildnoOrig=$prebuildno
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 150 |
|
| 151 | if ($prerelease.Length -eq 0) {
|
| 152 | $prerelease="z"*10
|
| 153 | }
|
David Pinedo | 3bdbe5d | 2016-01-12 16:14:53 -0700 | [diff] [blame] | 154 | if ($prebuildno.Length -eq 0) {
|
| 155 | $prebuildno="z"*10
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 156 | }
|
| 157 | }
|
| 158 |
|
David Pinedo | c27e044 | 2016-03-15 11:07:19 -0600 | [diff] [blame] | 159 | # Make sure fields that are supposed to be numbers are numbers
|
| 160 | if (notNumeric($major)) {return}
|
| 161 | if (notNumeric($minor)) {return}
|
| 162 | if (notNumeric($patch)) {return}
|
| 163 | if (notNumeric($buildno)) {return}
|
| 164 | if (notNumeric($prebuildno)) {
|
| 165 | if ($prebuildno -ne "z"*10) {return}
|
| 166 | }
|
| 167 |
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 168 | $major = $major.padleft(10,'0')
|
| 169 | $minor = $minor.padleft(10,'0')
|
| 170 | $patch = $patch.padleft(10,'0')
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 171 | $buildno = $buildno.padleft(10,'0')
|
David Pinedo | 3bdbe5d | 2016-01-12 16:14:53 -0700 | [diff] [blame] | 172 | $prerelease = $prerelease.padleft(10,'0')
|
| 173 | $prebuildno = $prebuildno.padleft(10,'0')
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 174 |
|
| 175 | # Add a new element to the $VulkanDllList array
|
David Pinedo | d133b78 | 2016-03-16 14:41:56 -0600 | [diff] [blame] | 176 | $script:VulkanDllList+="$major=$minor=$patch=$buildno=$prerelease=$prebuildno= $_ @$majorOrig@$minorOrig@$patchOrig@$buildnoOrig@$prereleaseOrig@$prebuildnoOrig@"
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 177 | }
|
| 178 |
|
Mark Young | a81e608 | 2016-01-15 12:35:39 -0700 | [diff] [blame] | 179 | # If $VulkanDllList contains at least one element, there's at least one vulkan*.dll file.
|
| 180 | # Copy the most recent vulkan*.dll (named in the last element of $VulkanDllList) to vulkan-$majorabi.dll.
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 181 |
|
David Pinedo | d133b78 | 2016-03-16 14:41:56 -0600 | [diff] [blame] | 182 | if ($script:VulkanDllList.Length -gt 0) {
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 183 |
|
Mark Young | a81e608 | 2016-01-15 12:35:39 -0700 | [diff] [blame] | 184 | # Sort the list. The most recent vulkan-*.dll will be in the last element of the list.
|
David Pinedo | d133b78 | 2016-03-16 14:41:56 -0600 | [diff] [blame] | 185 | [array]::sort($script:VulkanDllList)
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 186 |
|
Mark Young | a81e608 | 2016-01-15 12:35:39 -0700 | [diff] [blame] | 187 | # Put the name of the most recent vulkan-*.dll in $mrVulkanDLL.
|
| 188 | # The most recent vulkanDLL is the second word in the last element of the
|
| 189 | # sorted $VulkanDllList. Copy it to $vulkandll.
|
David Pinedo | d133b78 | 2016-03-16 14:41:56 -0600 | [diff] [blame] | 190 | $mrVulkanDll=$script:VulkanDllList[-1].Split(' ')[1]
|
Mark Young | a81e608 | 2016-01-15 12:35:39 -0700 | [diff] [blame] | 191 | copy $mrVulkanDll $vulkandll
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 192 |
|
Mark Young | a81e608 | 2016-01-15 12:35:39 -0700 | [diff] [blame] | 193 | # Copy the most recent version of vulkaninfo-<abimajor>-*.exe to vulkaninfo.exe.
|
| 194 | # We create the source file name for the copy from $mrVulkanDll.
|
| 195 | $mrVulkaninfo=$mrVulkanDll -replace ".dll",".exe"
|
| 196 | $mrVulkaninfo=$mrVulkaninfo -replace "vulkan","vulkaninfo"
|
| 197 | copy $mrVulkaninfo vulkaninfo.exe
|
David Pinedo | 1e368f7 | 2016-02-04 17:04:44 -0700 | [diff] [blame] | 198 |
|
Mark Young | a81e608 | 2016-01-15 12:35:39 -0700 | [diff] [blame] | 199 | # Create the name used in the registry for the SDK associated with $mrVulkanDll.
|
David Pinedo | d133b78 | 2016-03-16 14:41:56 -0600 | [diff] [blame] | 200 | $major=$script:VulkanDllList[-1].Split('@')[1]
|
| 201 | $minor=$script:VulkanDllList[-1].Split('@')[2]
|
| 202 | $patch=$script:VulkanDllList[-1].Split('@')[3]
|
| 203 | $buildno=$script:VulkanDllList[-1].Split('@')[4]
|
| 204 | $prerelease=$script:VulkanDllList[-1].Split('@')[5]
|
| 205 | $prebuildno=$script:VulkanDllList[-1].Split('@')[6]
|
David Pinedo | 1e368f7 | 2016-02-04 17:04:44 -0700 | [diff] [blame] | 206 |
|
Mark Young | d6897a3 | 2016-01-20 14:48:21 -0700 | [diff] [blame] | 207 | $sdktempname="VulkanSDK"+$major + "." + $minor + "." + $patch + "." + $buildno
|
Mark Young | a81e608 | 2016-01-15 12:35:39 -0700 | [diff] [blame] | 208 | if ($prerelease -ne "") {
|
Mark Young | d6897a3 | 2016-01-20 14:48:21 -0700 | [diff] [blame] | 209 | $sdktempname=$sdktempname + "." + $prerelease
|
Mark Young | a81e608 | 2016-01-15 12:35:39 -0700 | [diff] [blame] | 210 | }
|
| 211 | if ($prebuildno -ne "") {
|
Mark Young | d6897a3 | 2016-01-20 14:48:21 -0700 | [diff] [blame] | 212 | $sdktempname=$sdktempname + "." + $prebuildno
|
Mark Young | a81e608 | 2016-01-15 12:35:39 -0700 | [diff] [blame] | 213 | }
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 214 | }
|
David Pinedo | 1e368f7 | 2016-02-04 17:04:44 -0700 | [diff] [blame] | 215 |
|
Mark Young | d6897a3 | 2016-01-20 14:48:21 -0700 | [diff] [blame] | 216 | # Return to our previous folder
|
| 217 | Pop-Location
|
| 218 |
|
| 219 | # Only update the overall script-scope SDK name if we're told to
|
| 220 | if ($writeSdkName -ne 0) {
|
| 221 | $script:sdkname = $sdktempname
|
| 222 | }
|
| 223 |
|
| 224 | return
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 225 | }
|
| 226 |
|
Mark Young | 4b8b548 | 2016-01-15 15:09:39 -0700 | [diff] [blame] | 227 | # We only care about SYSWOW64 if we're targeting a 64-bit OS
|
Mark Young | b628d16 | 2016-01-19 15:29:34 -0700 | [diff] [blame] | 228 | if ($ossize -eq 64) {
|
Mark Young | 4b8b548 | 2016-01-15 15:09:39 -0700 | [diff] [blame] | 229 | # Update the SYSWOW64 Vulkan DLLS/EXEs
|
Mark Young | 71e2a40 | 2016-02-12 12:07:45 -0700 | [diff] [blame] | 230 | UpdateVulkanSysFolder $winfolder\SYSWOW64 0
|
Mark Young | 4b8b548 | 2016-01-15 15:09:39 -0700 | [diff] [blame] | 231 | }
|
| 232 |
|
| 233 | # Update the SYSTEM32 Vulkan DLLS/EXEs
|
Mark Young | 71e2a40 | 2016-02-12 12:07:45 -0700 | [diff] [blame] | 234 | UpdateVulkanSysFolder $winfolder\SYSTEM32 1
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 235 |
|
| 236 | # Create an array of vulkan sdk install dirs
|
| 237 |
|
| 238 | $mrVulkanDllInstallDir=""
|
| 239 | $VulkanSdkDirs=@()
|
David Pinedo | 1e368f7 | 2016-02-04 17:04:44 -0700 | [diff] [blame] | 240 | Get-ChildItem -Path Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall |
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 241 | ForEach-Object {
|
| 242 | $regkey=$_ -replace ".*\\",""
|
| 243 | if ($_ -match "\\VulkanSDK") {
|
| 244 | # Get the install path from UninstallString
|
| 245 | $tmp=Get-ItemProperty -Path Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$regkey -Name UninstallString
|
| 246 | $tmp=$tmp -replace "\\Uninstall.exe.*",""
|
| 247 | $tmp=$tmp -replace ".*=.",""
|
| 248 | $VulkanSdkDirs+=$tmp
|
Mark Young | d6897a3 | 2016-01-20 14:48:21 -0700 | [diff] [blame] | 249 | if ($regkey -eq $script:sdkname) {
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 250 | # Save away the sdk install dir for the the most recent vulkandll
|
| 251 | $mrVulkanDllInstallDir=$tmp
|
| 252 | }
|
| 253 | }
|
| 254 | }
|
| 255 |
|
David Pinedo | d133b78 | 2016-03-16 14:41:56 -0600 | [diff] [blame] | 256 |
|
| 257 | # Search list of sdk install dirs for an sdk compatible with $script:sdkname.
|
| 258 | # We go backwards through VulkanDllList to generate SDK names, because we want the most recent SDK.
|
| 259 | if ($mrVulkanDllInstallDir -eq "") {
|
| 260 | ForEach ($idx in ($script:VulkanDllList.Length-1)..0) {
|
| 261 | $vulkanDllMajor=$script:VulkanDllList[$idx].Split('@')[1]
|
| 262 | $vulkanDllMinor=$script:VulkanDllList[$idx].Split('@')[2]
|
| 263 | $vulkanDllPatch=$script:VulkanDllList[$idx].Split('@')[3]
|
| 264 | $vulkanDllBuildno=$script:VulkanDllList[$idx].Split('@')[4]
|
| 265 | $vulkanDllPrerelease=$script:VulkanDllList[$idx].Split('@')[5]
|
| 266 | $vulkanDllPrebuildno=$script:VulkanDllList[$idx].Split('@')[6]
|
| 267 | $regEntry="VulkanSDK"+$vulkanDllMajor+"."+$vulkanDllMinor+"."+$vulkanDllPatch+"."+$vulkanDllBuildno
|
| 268 | if ($vulkanDllPrerelease) {
|
| 269 | $regEntry=$regEntry+"."+$vulkanDllPrerelease
|
| 270 | }
|
| 271 | if ($vulkanDllPrebuildno) {
|
| 272 | $regEntry=$regEntry+"."+$vulkanDllPrebuildno
|
| 273 | }
|
| 274 | $rval=Get-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$regEntry -ErrorAction SilentlyContinue
|
| 275 | $instDir=$rval
|
| 276 | $instDir=$instDir -replace "\\Uninstall.exe.*",""
|
| 277 | $instDir=$instDir -replace ".*=.",""
|
| 278 | if ($rval) {
|
| 279 | $rval=$rval -replace ".* DisplayVersion=",""
|
| 280 | $rval=$rval -replace ";.*",""
|
| 281 | $reMajor=$rval.Split('.')[0]
|
| 282 | $reMinor=$rval.Split('.')[1]
|
| 283 | $rePatch=$rval.Split('.')[2]
|
| 284 | if ($reMajor+$reMinor+$rePatch -eq $vulkanDllMajor+$vulkanDllMinor+$vulkanDllPatch) {
|
| 285 | $mrVulkanDllInstallDir=$instDir
|
| 286 | break
|
| 287 | }
|
| 288 | }
|
| 289 | }
|
| 290 | }
|
| 291 |
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 292 | # Add C:\Vulkan\SDK\0.9.3 to list of SDK install dirs.
|
| 293 | # We do this because there is in a bug in SDK 0.9.3 in which layer
|
| 294 | # reg entries were not removed on uninstall. So we'll try to clean up
|
| 295 | # and remove them now.
|
| 296 | # This works only if 0.9.3 was installed to the default location.
|
| 297 | # If it was not installed to the default location, those entries will
|
| 298 | # need to be cleaned up manually.
|
| 299 |
|
| 300 | $VulkanSdkDirs+="C:\VulkanSDK\0.9.3"
|
Mark Young | 71e2a40 | 2016-02-12 12:07:45 -0700 | [diff] [blame] | 301 | $VulkanSdkDirs+="$windrive\VulkanSDK\0.9.3"
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 302 |
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 303 | # Remove layer registry entries associated with all installed Vulkan SDKs.
|
| 304 | # Note that we remove only those entries created by Vulkan SDKs. If other
|
| 305 | # layers were installed that are not from an SDK, we don't mess with them.
|
| 306 |
|
| 307 | Get-Item -Path Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Khronos\Vulkan\ExplicitLayers | Select-Object -ExpandProperty Property |
|
| 308 | ForEach-Object {
|
| 309 | $regval=$_
|
| 310 | ForEach ($sdkdir in $VulkanSdkDirs) {
|
| 311 | if ($regval -like "$sdkdir\*.json") {
|
David Pinedo | 9bb478f | 2016-01-19 21:19:11 -0700 | [diff] [blame] | 312 | Remove-ItemProperty -ErrorAction SilentlyContinue -Path HKLM:\SOFTWARE\Khronos\Vulkan\ExplicitLayers -name $regval
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 313 | }
|
| 314 | }
|
| 315 | }
|
Mark Young | b628d16 | 2016-01-19 15:29:34 -0700 | [diff] [blame] | 316 | # Remove 32-bit layer registry entries if we're targeting a 64-bit OS
|
| 317 | if ($ossize -eq 64) {
|
| 318 | Get-Item -Path Registry::HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Khronos\Vulkan\ExplicitLayers | Select-Object -ExpandProperty Property |
|
| 319 | ForEach-Object {
|
| 320 | $regval=$_
|
| 321 | ForEach ($sdkdir in $VulkanSdkDirs) {
|
| 322 | if ($regval -like "$sdkdir\*.json") {
|
Mark Young | d6897a3 | 2016-01-20 14:48:21 -0700 | [diff] [blame] | 323 | Remove-ItemProperty -ErrorAction SilentlyContinue -Path HKLM:\SOFTWARE\WOW6432Node\Khronos\Vulkan\ExplicitLayers -name $regval
|
Mark Young | b628d16 | 2016-01-19 15:29:34 -0700 | [diff] [blame] | 324 | }
|
| 325 | }
|
| 326 | }
|
| 327 | }
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 328 |
|
| 329 |
|
| 330 | # Create layer registry entries associated with Vulkan SDK from which $mrVulkanDll is from
|
| 331 |
|
| 332 | if ($mrVulkanDllInstallDir -ne "") {
|
Mark Young | b628d16 | 2016-01-19 15:29:34 -0700 | [diff] [blame] | 333 | if ($ossize -eq 64) {
|
Mark Young | 51d3507 | 2016-02-09 15:30:34 -0700 | [diff] [blame] | 334 |
|
| 335 | # Create registry entires in normal registry location for 64-bit items on a 64-bit OS
|
| 336 | New-Item -Force -ErrorAction SilentlyContinue -Path HKLM:\SOFTWARE\Khronos\Vulkan\ExplicitLayers | out-null
|
| 337 | Get-ChildItem $mrVulkanDllInstallDir\Bin -Filter VkLayer*json |
|
| 338 | ForEach-Object {
|
| 339 | New-ItemProperty -Path HKLM:\SOFTWARE\Khronos\Vulkan\ExplicitLayers -Name $mrVulkanDllInstallDir\Bin\$_ -PropertyType DWord -Value 0 | out-null
|
| 340 | }
|
| 341 |
|
| 342 | # Create registry entires for the WOW6432Node registry location for 32-bit items on a 64-bit OS
|
| 343 | New-Item -Force -ErrorAction SilentlyContinue -Path HKLM:\SOFTWARE\WOW6432Node\Khronos\Vulkan\ExplicitLayers | out-null
|
David Pinedo | 431b82a | 2016-02-05 09:48:26 -0700 | [diff] [blame] | 344 | Get-ChildItem $mrVulkanDllInstallDir\Bin32 -Filter VkLayer*json |
|
Mark Young | b628d16 | 2016-01-19 15:29:34 -0700 | [diff] [blame] | 345 | ForEach-Object {
|
Mark Young | d6897a3 | 2016-01-20 14:48:21 -0700 | [diff] [blame] | 346 | New-ItemProperty -Path HKLM:\SOFTWARE\WOW6432Node\Khronos\Vulkan\ExplicitLayers -Name $mrVulkanDllInstallDir\Bin32\$_ -PropertyType DWord -Value 0 | out-null
|
Mark Young | b628d16 | 2016-01-19 15:29:34 -0700 | [diff] [blame] | 347 | }
|
Mark Young | 51d3507 | 2016-02-09 15:30:34 -0700 | [diff] [blame] | 348 |
|
| 349 | } else {
|
| 350 |
|
| 351 | # Create registry entires in normal registry location for 32-bit items on a 32-bit OS
|
| 352 | New-Item -Force -ErrorAction SilentlyContinue -Path HKLM:\SOFTWARE\Khronos\Vulkan\ExplicitLayers | out-null
|
| 353 | Get-ChildItem $mrVulkanDllInstallDir\Bin32 -Filter VkLayer*json |
|
| 354 | ForEach-Object {
|
| 355 | New-ItemProperty -Path HKLM:\SOFTWARE\Khronos\Vulkan\ExplicitLayers -Name $mrVulkanDllInstallDir\Bin32\$_ -PropertyType DWord -Value 0 | out-null
|
| 356 | }
|
| 357 |
|
Mark Young | b628d16 | 2016-01-19 15:29:34 -0700 | [diff] [blame] | 358 | }
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 359 | }
|