aboutsummaryrefslogtreecommitdiff
path: root/windowsRuntimeInstaller/ConfigLayersAndVulkanDLL.ps1
diff options
context:
space:
mode:
authorDavid Pinedo <david@lunarg.com>2016-03-16 14:41:56 -0600
committerDavid Pinedo <david@lunarg.com>2016-03-16 14:58:03 -0600
commitcc838f0850abf58243bca037288303c05899bc88 (patch)
tree783e2d5868bf0806530727dbc0609a3b8df70cc3 /windowsRuntimeInstaller/ConfigLayersAndVulkanDLL.ps1
parent647d6876f2bf00685a96281e9966f26e0bdf38c4 (diff)
downloadusermoji-cc838f0850abf58243bca037288303c05899bc88.tar.xz
winrtinstaller: Allow layers from SDK older than RT to be configured for use
Layers from SDK can be used by an RT if their major, minor, and patch numbers are the same. For example, if SDK 1.0.5.0 is already installed, and then RT 1.0.5.1 is installed. During the RT installation, the layer registry entries will be set to point to the layers in SDK 1.0.5.0.
Diffstat (limited to 'windowsRuntimeInstaller/ConfigLayersAndVulkanDLL.ps1')
-rw-r--r--windowsRuntimeInstaller/ConfigLayersAndVulkanDLL.ps162
1 files changed, 50 insertions, 12 deletions
diff --git a/windowsRuntimeInstaller/ConfigLayersAndVulkanDLL.ps1 b/windowsRuntimeInstaller/ConfigLayersAndVulkanDLL.ps1
index 4666f334..00c7ee6c 100644
--- a/windowsRuntimeInstaller/ConfigLayersAndVulkanDLL.ps1
+++ b/windowsRuntimeInstaller/ConfigLayersAndVulkanDLL.ps1
@@ -49,6 +49,7 @@ Param(
$vulkandll = "vulkan-"+$majorabi+".dll"
$windrive = $env:SYSTEMDRIVE
$winfolder = $env:SYSTEMROOT
+$script:VulkanDllList=@()
function notNumeric ($x) {
try {
@@ -95,8 +96,9 @@ function UpdateVulkanSysFolder([string]$dir, [int]$writeSdkName)
# Push the current path on the stack and go to $dir
Push-Location -Path $dir
- # Create a list for all the DLLs in the folder
- $VulkanDllList=@()
+ # Create a list for all the DLLs in the folder.
+ # First Initialize the list to empty
+ $script:VulkanDllList = @()
# Find all DLL objects in this directory
dir -name vulkan-$majorabi-*.dll |
@@ -171,21 +173,21 @@ function UpdateVulkanSysFolder([string]$dir, [int]$writeSdkName)
$prebuildno = $prebuildno.padleft(10,'0')
# Add a new element to the $VulkanDllList array
- $VulkanDllList+="$major=$minor=$patch=$buildno=$prerelease=$prebuildno= $_ @$majorOrig@$minorOrig@$patchOrig@$buildnoOrig@$prereleaseOrig@$prebuildnoOrig@"
+ $script:VulkanDllList+="$major=$minor=$patch=$buildno=$prerelease=$prebuildno= $_ @$majorOrig@$minorOrig@$patchOrig@$buildnoOrig@$prereleaseOrig@$prebuildnoOrig@"
}
# If $VulkanDllList contains at least one element, there's at least one vulkan*.dll file.
# Copy the most recent vulkan*.dll (named in the last element of $VulkanDllList) to vulkan-$majorabi.dll.
- if ($VulkanDllList.Length -gt 0) {
+ if ($script:VulkanDllList.Length -gt 0) {
# Sort the list. The most recent vulkan-*.dll will be in the last element of the list.
- [array]::sort($VulkanDllList)
+ [array]::sort($script:VulkanDllList)
# Put the name of the most recent vulkan-*.dll in $mrVulkanDLL.
# The most recent vulkanDLL is the second word in the last element of the
# sorted $VulkanDllList. Copy it to $vulkandll.
- $mrVulkanDll=$VulkanDllList[-1].Split(' ')[1]
+ $mrVulkanDll=$script:VulkanDllList[-1].Split(' ')[1]
copy $mrVulkanDll $vulkandll
# Copy the most recent version of vulkaninfo-<abimajor>-*.exe to vulkaninfo.exe.
@@ -195,12 +197,12 @@ function UpdateVulkanSysFolder([string]$dir, [int]$writeSdkName)
copy $mrVulkaninfo vulkaninfo.exe
# Create the name used in the registry for the SDK associated with $mrVulkanDll.
- $major=$VulkanDLLList[-1].Split('@')[1]
- $minor=$VulkanDLLList[-1].Split('@')[2]
- $patch=$VulkanDLLList[-1].Split('@')[3]
- $buildno=$VulkanDLLList[-1].Split('@')[4]
- $prerelease=$VulkanDLLList[-1].Split('@')[5]
- $prebuildno=$VulkanDLLList[-1].Split('@')[6]
+ $major=$script:VulkanDllList[-1].Split('@')[1]
+ $minor=$script:VulkanDllList[-1].Split('@')[2]
+ $patch=$script:VulkanDllList[-1].Split('@')[3]
+ $buildno=$script:VulkanDllList[-1].Split('@')[4]
+ $prerelease=$script:VulkanDllList[-1].Split('@')[5]
+ $prebuildno=$script:VulkanDllList[-1].Split('@')[6]
$sdktempname="VulkanSDK"+$major + "." + $minor + "." + $patch + "." + $buildno
if ($prerelease -ne "") {
@@ -251,6 +253,42 @@ Get-ChildItem -Path Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Curr
}
}
+
+# Search list of sdk install dirs for an sdk compatible with $script:sdkname.
+# We go backwards through VulkanDllList to generate SDK names, because we want the most recent SDK.
+if ($mrVulkanDllInstallDir -eq "") {
+ ForEach ($idx in ($script:VulkanDllList.Length-1)..0) {
+ $vulkanDllMajor=$script:VulkanDllList[$idx].Split('@')[1]
+ $vulkanDllMinor=$script:VulkanDllList[$idx].Split('@')[2]
+ $vulkanDllPatch=$script:VulkanDllList[$idx].Split('@')[3]
+ $vulkanDllBuildno=$script:VulkanDllList[$idx].Split('@')[4]
+ $vulkanDllPrerelease=$script:VulkanDllList[$idx].Split('@')[5]
+ $vulkanDllPrebuildno=$script:VulkanDllList[$idx].Split('@')[6]
+ $regEntry="VulkanSDK"+$vulkanDllMajor+"."+$vulkanDllMinor+"."+$vulkanDllPatch+"."+$vulkanDllBuildno
+ if ($vulkanDllPrerelease) {
+ $regEntry=$regEntry+"."+$vulkanDllPrerelease
+ }
+ if ($vulkanDllPrebuildno) {
+ $regEntry=$regEntry+"."+$vulkanDllPrebuildno
+ }
+ $rval=Get-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$regEntry -ErrorAction SilentlyContinue
+ $instDir=$rval
+ $instDir=$instDir -replace "\\Uninstall.exe.*",""
+ $instDir=$instDir -replace ".*=.",""
+ if ($rval) {
+ $rval=$rval -replace ".* DisplayVersion=",""
+ $rval=$rval -replace ";.*",""
+ $reMajor=$rval.Split('.')[0]
+ $reMinor=$rval.Split('.')[1]
+ $rePatch=$rval.Split('.')[2]
+ if ($reMajor+$reMinor+$rePatch -eq $vulkanDllMajor+$vulkanDllMinor+$vulkanDllPatch) {
+ $mrVulkanDllInstallDir=$instDir
+ break
+ }
+ }
+ }
+}
+
# Add C:\Vulkan\SDK\0.9.3 to list of SDK install dirs.
# We do this because there is in a bug in SDK 0.9.3 in which layer
# reg entries were not removed on uninstall. So we'll try to clean up