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 | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 52 |
|
David Pinedo | c27e044 | 2016-03-15 11:07:19 -0600 | [diff] [blame^] | 53 | function notNumeric ($x) {
|
| 54 | try {
|
| 55 | 0 + $x | Out-Null
|
| 56 | return $false
|
| 57 | } catch {
|
| 58 | return $true
|
| 59 | }
|
| 60 | }
|
| 61 |
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 62 | # The name of the versioned vulkan dll file is one of the following:
|
| 63 | #
|
David Pinedo | 3bdbe5d | 2016-01-12 16:14:53 -0700 | [diff] [blame] | 64 | # vulkan-<majorabi>-<major>-<minor>-<patch>-<buildno>-<prerelease>-<prebuildno>
|
| 65 | # vulkan-<majorabi>-<major>-<minor>-<patch>-<buildno>-<prerelease>
|
| 66 | # vulkan-<majorabi>-<major>-<minor>-<patch>-<buildno>-<prebuildno>
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 67 | # vulkan-<majorabi>-<major>-<minor>-<patch>-<buildno>.dll
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 68 | #
|
David Pinedo | 3bdbe5d | 2016-01-12 16:14:53 -0700 | [diff] [blame] | 69 | # <major>, <minor>, <patch>, <buildno> and <prebuildno> are 1 to 10 numeric digits.
|
| 70 | # <prerelease> is any combination of alpha and numeric characters.
|
| 71 | # If <prerelease> and/or <prebuildno> are present, this identifies a prerelease,
|
| 72 | # and the vulkan dll file will be considered less recent than one with the same
|
| 73 | # <major>, <minor>, <patch>, <buildno> numbers without the <prerelease> and/or
|
| 74 | # <prebuildno>.
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 75 |
|
| 76 |
|
| 77 | # 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] | 78 | # C:\Windows\System32 (and C:\Windows\SysWOW64 on 64-bit systems), with each element
|
| 79 | # containing:
|
David Pinedo | 3bdbe5d | 2016-01-12 16:14:53 -0700 | [diff] [blame] | 80 | # <major>=<minor>=<patch>=<buildno>=<prerelease>=<prebuildno>=
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 81 | # filename
|
David Pinedo | 3bdbe5d | 2016-01-12 16:14:53 -0700 | [diff] [blame] | 82 | # @<major>@<minor>@<patch>@<buildno>@<prerelease>@<prebuildno>@
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 83 | # [Note that the above three lines are one element in the array.]
|
| 84 | # The build identifiers separated by "=" are suitable for sorting, i.e.
|
David Pinedo | 3bdbe5d | 2016-01-12 16:14:53 -0700 | [diff] [blame] | 85 | # expanded to 10 digits with leading 0s. If <prerelease> or <prebuildno> are
|
| 86 | # not specified, "zzzzzzzzzz" is substituted for them, so that they sort
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 87 | # to a position after those that do specify them.
|
| 88 | # The build identifiers separated by "@" are the original values extracted
|
| 89 | # from the file name. They are used later to find the path to the SDK
|
| 90 | # install directory for the given filename.
|
| 91 |
|
David Pinedo | c27e044 | 2016-03-15 11:07:19 -0600 | [diff] [blame^] | 92 |
|
Mark Young | d6897a3 | 2016-01-20 14:48:21 -0700 | [diff] [blame] | 93 | function UpdateVulkanSysFolder([string]$dir, [int]$writeSdkName)
|
Mark Young | a81e608 | 2016-01-15 12:35:39 -0700 | [diff] [blame] | 94 | {
|
| 95 | # Push the current path on the stack and go to $dir
|
| 96 | Push-Location -Path $dir
|
David Pinedo | 1e368f7 | 2016-02-04 17:04:44 -0700 | [diff] [blame] | 97 |
|
Mark Young | a81e608 | 2016-01-15 12:35:39 -0700 | [diff] [blame] | 98 | # Create a list for all the DLLs in the folder
|
| 99 | $VulkanDllList=@()
|
David Pinedo | 1e368f7 | 2016-02-04 17:04:44 -0700 | [diff] [blame] | 100 |
|
Mark Young | a81e608 | 2016-01-15 12:35:39 -0700 | [diff] [blame] | 101 | # Find all DLL objects in this directory
|
| 102 | dir -name vulkan-$majorabi-*.dll |
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 103 | ForEach-Object {
|
David Pinedo | c27e044 | 2016-03-15 11:07:19 -0600 | [diff] [blame^] | 104 | if ($_ -match "=" -or
|
| 105 | $_ -match "@" -or
|
| 106 | $_ -match " " -or
|
| 107 | ($_.Split('-').count -lt 6) -or
|
| 108 | ($_.Split('-').count -gt 8))
|
| 109 | {
|
| 110 | # If a file name contains "=", "@", or " ", or it contains less then 5 dashes or more than
|
| 111 | # 7 dashes, it wasn't installed by the Vulkan Run Time.
|
| 112 | # Note that we need to use return inside of ForEach-Object is to continue with iteration.
|
| 113 | return
|
| 114 | }
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 115 | $major=$_.Split('-')[2]
|
| 116 | $majorOrig=$major
|
| 117 | $minor=$_.Split('-')[3]
|
| 118 | $minorOrig=$minor
|
| 119 | $patch=$_.Split('-')[4]
|
David Pinedo | 3bdbe5d | 2016-01-12 16:14:53 -0700 | [diff] [blame] | 120 | $patchOrig=$patch
|
| 121 | $buildno=$_.Split('-')[5]
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 122 |
|
David Pinedo | 3bdbe5d | 2016-01-12 16:14:53 -0700 | [diff] [blame] | 123 | if ($buildno -match ".dll") {
|
David Pinedo | c27e044 | 2016-03-15 11:07:19 -0600 | [diff] [blame^] | 124 | # prerelease and prebuildno are not in the name
|
| 125 | # Extract buildno, and set prerelease and prebuildno to "z"s
|
| 126 | $buildno=$buildno -replace ".dll",""
|
| 127 | $buildnoOrig=$buildno
|
| 128 | $prerelease="z"*10
|
| 129 | $prereleaseOrig=""
|
| 130 | $prebuildno="z"*10
|
| 131 | $prebuildnoOrig=""
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 132 | } else {
|
David Pinedo | c27e044 | 2016-03-15 11:07:19 -0600 | [diff] [blame^] | 133 | # Extract buildno, prerelease, and prebuildno
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 134 | $f=$_ -replace ".dll",""
|
David Pinedo | 3bdbe5d | 2016-01-12 16:14:53 -0700 | [diff] [blame] | 135 | $buildno=$f.Split('-')[5]
|
David Pinedo | 5da20dd | 2016-01-13 16:22:19 -0700 | [diff] [blame] | 136 | $buildnoOrig=$buildno
|
David Pinedo | 3bdbe5d | 2016-01-12 16:14:53 -0700 | [diff] [blame] | 137 | $prerelease=$f.Split('-')[6]
|
| 138 | $prebuildno=$f.Split('-')[7]
|
| 139 | if ($prebuildno.Length -eq 0) {
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 140 | if ($prerelease -match "^[0-9]") {
|
David Pinedo | 3bdbe5d | 2016-01-12 16:14:53 -0700 | [diff] [blame] | 141 | # prerelease starts with a digit, it must be the prebuildno
|
| 142 | $prebuildno=$prerelease
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 143 | $prerelease=""
|
| 144 | }
|
| 145 | }
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 146 | $prereleaseOrig=$prerelease
|
David Pinedo | 3bdbe5d | 2016-01-12 16:14:53 -0700 | [diff] [blame] | 147 | $prebuildnoOrig=$prebuildno
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 148 |
|
| 149 | if ($prerelease.Length -eq 0) {
|
| 150 | $prerelease="z"*10
|
| 151 | }
|
David Pinedo | 3bdbe5d | 2016-01-12 16:14:53 -0700 | [diff] [blame] | 152 | if ($prebuildno.Length -eq 0) {
|
| 153 | $prebuildno="z"*10
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 154 | }
|
| 155 | }
|
| 156 |
|
David Pinedo | c27e044 | 2016-03-15 11:07:19 -0600 | [diff] [blame^] | 157 | # Make sure fields that are supposed to be numbers are numbers
|
| 158 | if (notNumeric($major)) {return}
|
| 159 | if (notNumeric($minor)) {return}
|
| 160 | if (notNumeric($patch)) {return}
|
| 161 | if (notNumeric($buildno)) {return}
|
| 162 | if (notNumeric($prebuildno)) {
|
| 163 | if ($prebuildno -ne "z"*10) {return}
|
| 164 | }
|
| 165 |
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 166 | $major = $major.padleft(10,'0')
|
| 167 | $minor = $minor.padleft(10,'0')
|
| 168 | $patch = $patch.padleft(10,'0')
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 169 | $buildno = $buildno.padleft(10,'0')
|
David Pinedo | 3bdbe5d | 2016-01-12 16:14:53 -0700 | [diff] [blame] | 170 | $prerelease = $prerelease.padleft(10,'0')
|
| 171 | $prebuildno = $prebuildno.padleft(10,'0')
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 172 |
|
| 173 | # Add a new element to the $VulkanDllList array
|
David Pinedo | 5da20dd | 2016-01-13 16:22:19 -0700 | [diff] [blame] | 174 | $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] | 175 | }
|
| 176 |
|
Mark Young | a81e608 | 2016-01-15 12:35:39 -0700 | [diff] [blame] | 177 | # If $VulkanDllList contains at least one element, there's at least one vulkan*.dll file.
|
| 178 | # 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] | 179 |
|
Mark Young | a81e608 | 2016-01-15 12:35:39 -0700 | [diff] [blame] | 180 | if ($VulkanDllList.Length -gt 0) {
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 181 |
|
Mark Young | a81e608 | 2016-01-15 12:35:39 -0700 | [diff] [blame] | 182 | # Sort the list. The most recent vulkan-*.dll will be in the last element of the list.
|
| 183 | [array]::sort($VulkanDllList)
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 184 |
|
Mark Young | a81e608 | 2016-01-15 12:35:39 -0700 | [diff] [blame] | 185 | # Put the name of the most recent vulkan-*.dll in $mrVulkanDLL.
|
| 186 | # The most recent vulkanDLL is the second word in the last element of the
|
| 187 | # sorted $VulkanDllList. Copy it to $vulkandll.
|
| 188 | $mrVulkanDll=$VulkanDllList[-1].Split(' ')[1]
|
| 189 | copy $mrVulkanDll $vulkandll
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 190 |
|
Mark Young | a81e608 | 2016-01-15 12:35:39 -0700 | [diff] [blame] | 191 | # Copy the most recent version of vulkaninfo-<abimajor>-*.exe to vulkaninfo.exe.
|
| 192 | # We create the source file name for the copy from $mrVulkanDll.
|
| 193 | $mrVulkaninfo=$mrVulkanDll -replace ".dll",".exe"
|
| 194 | $mrVulkaninfo=$mrVulkaninfo -replace "vulkan","vulkaninfo"
|
| 195 | copy $mrVulkaninfo vulkaninfo.exe
|
David Pinedo | 1e368f7 | 2016-02-04 17:04:44 -0700 | [diff] [blame] | 196 |
|
Mark Young | a81e608 | 2016-01-15 12:35:39 -0700 | [diff] [blame] | 197 | # Create the name used in the registry for the SDK associated with $mrVulkanDll.
|
| 198 | $major=$VulkanDLLList[-1].Split('@')[1]
|
| 199 | $minor=$VulkanDLLList[-1].Split('@')[2]
|
| 200 | $patch=$VulkanDLLList[-1].Split('@')[3]
|
| 201 | $buildno=$VulkanDLLList[-1].Split('@')[4]
|
| 202 | $prerelease=$VulkanDLLList[-1].Split('@')[5]
|
| 203 | $prebuildno=$VulkanDLLList[-1].Split('@')[6]
|
David Pinedo | 1e368f7 | 2016-02-04 17:04:44 -0700 | [diff] [blame] | 204 |
|
Mark Young | d6897a3 | 2016-01-20 14:48:21 -0700 | [diff] [blame] | 205 | $sdktempname="VulkanSDK"+$major + "." + $minor + "." + $patch + "." + $buildno
|
Mark Young | a81e608 | 2016-01-15 12:35:39 -0700 | [diff] [blame] | 206 | if ($prerelease -ne "") {
|
Mark Young | d6897a3 | 2016-01-20 14:48:21 -0700 | [diff] [blame] | 207 | $sdktempname=$sdktempname + "." + $prerelease
|
Mark Young | a81e608 | 2016-01-15 12:35:39 -0700 | [diff] [blame] | 208 | }
|
| 209 | if ($prebuildno -ne "") {
|
Mark Young | d6897a3 | 2016-01-20 14:48:21 -0700 | [diff] [blame] | 210 | $sdktempname=$sdktempname + "." + $prebuildno
|
Mark Young | a81e608 | 2016-01-15 12:35:39 -0700 | [diff] [blame] | 211 | }
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 212 | }
|
David Pinedo | 1e368f7 | 2016-02-04 17:04:44 -0700 | [diff] [blame] | 213 |
|
Mark Young | d6897a3 | 2016-01-20 14:48:21 -0700 | [diff] [blame] | 214 | # Return to our previous folder
|
| 215 | Pop-Location
|
| 216 |
|
| 217 | # Only update the overall script-scope SDK name if we're told to
|
| 218 | if ($writeSdkName -ne 0) {
|
| 219 | $script:sdkname = $sdktempname
|
| 220 | }
|
| 221 |
|
| 222 | return
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 223 | }
|
| 224 |
|
Mark Young | 4b8b548 | 2016-01-15 15:09:39 -0700 | [diff] [blame] | 225 | # 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] | 226 | if ($ossize -eq 64) {
|
Mark Young | 4b8b548 | 2016-01-15 15:09:39 -0700 | [diff] [blame] | 227 | # Update the SYSWOW64 Vulkan DLLS/EXEs
|
Mark Young | 71e2a40 | 2016-02-12 12:07:45 -0700 | [diff] [blame] | 228 | UpdateVulkanSysFolder $winfolder\SYSWOW64 0
|
Mark Young | 4b8b548 | 2016-01-15 15:09:39 -0700 | [diff] [blame] | 229 | }
|
| 230 |
|
| 231 | # Update the SYSTEM32 Vulkan DLLS/EXEs
|
Mark Young | 71e2a40 | 2016-02-12 12:07:45 -0700 | [diff] [blame] | 232 | UpdateVulkanSysFolder $winfolder\SYSTEM32 1
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 233 |
|
| 234 | # Create an array of vulkan sdk install dirs
|
| 235 |
|
| 236 | $mrVulkanDllInstallDir=""
|
| 237 | $VulkanSdkDirs=@()
|
David Pinedo | 1e368f7 | 2016-02-04 17:04:44 -0700 | [diff] [blame] | 238 | Get-ChildItem -Path Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall |
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 239 | ForEach-Object {
|
| 240 | $regkey=$_ -replace ".*\\",""
|
| 241 | if ($_ -match "\\VulkanSDK") {
|
| 242 | # Get the install path from UninstallString
|
| 243 | $tmp=Get-ItemProperty -Path Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$regkey -Name UninstallString
|
| 244 | $tmp=$tmp -replace "\\Uninstall.exe.*",""
|
| 245 | $tmp=$tmp -replace ".*=.",""
|
| 246 | $VulkanSdkDirs+=$tmp
|
Mark Young | d6897a3 | 2016-01-20 14:48:21 -0700 | [diff] [blame] | 247 | if ($regkey -eq $script:sdkname) {
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 248 | # Save away the sdk install dir for the the most recent vulkandll
|
| 249 | $mrVulkanDllInstallDir=$tmp
|
| 250 | }
|
| 251 | }
|
| 252 | }
|
| 253 |
|
| 254 | # Add C:\Vulkan\SDK\0.9.3 to list of SDK install dirs.
|
| 255 | # We do this because there is in a bug in SDK 0.9.3 in which layer
|
| 256 | # reg entries were not removed on uninstall. So we'll try to clean up
|
| 257 | # and remove them now.
|
| 258 | # This works only if 0.9.3 was installed to the default location.
|
| 259 | # If it was not installed to the default location, those entries will
|
| 260 | # need to be cleaned up manually.
|
| 261 |
|
| 262 | $VulkanSdkDirs+="C:\VulkanSDK\0.9.3"
|
Mark Young | 71e2a40 | 2016-02-12 12:07:45 -0700 | [diff] [blame] | 263 | $VulkanSdkDirs+="$windrive\VulkanSDK\0.9.3"
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 264 |
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 265 | # Remove layer registry entries associated with all installed Vulkan SDKs.
|
| 266 | # Note that we remove only those entries created by Vulkan SDKs. If other
|
| 267 | # layers were installed that are not from an SDK, we don't mess with them.
|
| 268 |
|
| 269 | Get-Item -Path Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Khronos\Vulkan\ExplicitLayers | Select-Object -ExpandProperty Property |
|
| 270 | ForEach-Object {
|
| 271 | $regval=$_
|
| 272 | ForEach ($sdkdir in $VulkanSdkDirs) {
|
| 273 | if ($regval -like "$sdkdir\*.json") {
|
David Pinedo | 9bb478f | 2016-01-19 21:19:11 -0700 | [diff] [blame] | 274 | Remove-ItemProperty -ErrorAction SilentlyContinue -Path HKLM:\SOFTWARE\Khronos\Vulkan\ExplicitLayers -name $regval
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 275 | }
|
| 276 | }
|
| 277 | }
|
Mark Young | b628d16 | 2016-01-19 15:29:34 -0700 | [diff] [blame] | 278 | # Remove 32-bit layer registry entries if we're targeting a 64-bit OS
|
| 279 | if ($ossize -eq 64) {
|
| 280 | Get-Item -Path Registry::HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Khronos\Vulkan\ExplicitLayers | Select-Object -ExpandProperty Property |
|
| 281 | ForEach-Object {
|
| 282 | $regval=$_
|
| 283 | ForEach ($sdkdir in $VulkanSdkDirs) {
|
| 284 | if ($regval -like "$sdkdir\*.json") {
|
Mark Young | d6897a3 | 2016-01-20 14:48:21 -0700 | [diff] [blame] | 285 | 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] | 286 | }
|
| 287 | }
|
| 288 | }
|
| 289 | }
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 290 |
|
| 291 |
|
| 292 | # Create layer registry entries associated with Vulkan SDK from which $mrVulkanDll is from
|
| 293 |
|
| 294 | if ($mrVulkanDllInstallDir -ne "") {
|
Mark Young | b628d16 | 2016-01-19 15:29:34 -0700 | [diff] [blame] | 295 | if ($ossize -eq 64) {
|
Mark Young | 51d3507 | 2016-02-09 15:30:34 -0700 | [diff] [blame] | 296 |
|
| 297 | # Create registry entires in normal registry location for 64-bit items on a 64-bit OS
|
| 298 | New-Item -Force -ErrorAction SilentlyContinue -Path HKLM:\SOFTWARE\Khronos\Vulkan\ExplicitLayers | out-null
|
| 299 | Get-ChildItem $mrVulkanDllInstallDir\Bin -Filter VkLayer*json |
|
| 300 | ForEach-Object {
|
| 301 | New-ItemProperty -Path HKLM:\SOFTWARE\Khronos\Vulkan\ExplicitLayers -Name $mrVulkanDllInstallDir\Bin\$_ -PropertyType DWord -Value 0 | out-null
|
| 302 | }
|
| 303 |
|
| 304 | # Create registry entires for the WOW6432Node registry location for 32-bit items on a 64-bit OS
|
| 305 | 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] | 306 | Get-ChildItem $mrVulkanDllInstallDir\Bin32 -Filter VkLayer*json |
|
Mark Young | b628d16 | 2016-01-19 15:29:34 -0700 | [diff] [blame] | 307 | ForEach-Object {
|
Mark Young | d6897a3 | 2016-01-20 14:48:21 -0700 | [diff] [blame] | 308 | 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] | 309 | }
|
Mark Young | 51d3507 | 2016-02-09 15:30:34 -0700 | [diff] [blame] | 310 |
|
| 311 | } else {
|
| 312 |
|
| 313 | # Create registry entires in normal registry location for 32-bit items on a 32-bit OS
|
| 314 | New-Item -Force -ErrorAction SilentlyContinue -Path HKLM:\SOFTWARE\Khronos\Vulkan\ExplicitLayers | out-null
|
| 315 | Get-ChildItem $mrVulkanDllInstallDir\Bin32 -Filter VkLayer*json |
|
| 316 | ForEach-Object {
|
| 317 | New-ItemProperty -Path HKLM:\SOFTWARE\Khronos\Vulkan\ExplicitLayers -Name $mrVulkanDllInstallDir\Bin32\$_ -PropertyType DWord -Value 0 | out-null
|
| 318 | }
|
| 319 |
|
Mark Young | b628d16 | 2016-01-19 15:29:34 -0700 | [diff] [blame] | 320 | }
|
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 321 | }
|