mirror of
https://github.com/mitch030504/Wiicompiled_VR_Frame.git
synced 2026-10-06 04:04:18 +02:00
Added Vulkan PC OpenXR Support
This commit is contained in:
1 parent
fbc9ce7217
commit
e7b670b2cc
23 files changed
+2174
-22
No files matched your search
@@ -0,0 +1,52 @@
|
||||
# Builds the pinned Dawn DLL with Aurora's native Windows Vulkan/OpenXR bridge.
|
||||
# Run on a maintainer machine with VS 2022 C++ tools, CMake, Git and Python 3.
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[string]$WorkDirectory = (Join-Path $PSScriptRoot 'artifacts\dawn-vulkan-build'),
|
||||
[string]$Destination = (Join-Path $PSScriptRoot 'artifacts\dawn-vulkan'),
|
||||
[string]$Python = 'python',
|
||||
[int]$Jobs = 8
|
||||
)
|
||||
$ErrorActionPreference = 'Stop'
|
||||
Set-StrictMode -Version 3.0
|
||||
$revision = '13abc3bc8ea2d3c2050f9e77a12d012108ceee24'
|
||||
$archiveHash = '713bea5b92d4f6c5175752fd7cbf1c3c5ce36598ff5dd98685d8a1216614ebba'
|
||||
$WorkDirectory = [IO.Path]::GetFullPath($WorkDirectory)
|
||||
$Destination = [IO.Path]::GetFullPath($Destination)
|
||||
[IO.Directory]::CreateDirectory($WorkDirectory) | Out-Null
|
||||
$archive = Join-Path $WorkDirectory 'dawn-source.tar.gz'
|
||||
if (-not (Test-Path -LiteralPath $archive)) {
|
||||
Invoke-WebRequest "https://github.com/google/dawn/archive/$revision.tar.gz" -OutFile $archive -UseBasicParsing
|
||||
}
|
||||
if ((Get-FileHash -LiteralPath $archive -Algorithm SHA256).Hash.ToLowerInvariant() -ne $archiveHash) {
|
||||
throw 'Dawn source archive does not match the pinned SHA-256.'
|
||||
}
|
||||
$source = Join-Path $WorkDirectory "dawn-$revision"
|
||||
if (-not (Test-Path -LiteralPath $source)) {
|
||||
& $Python -c 'import sys,tarfile; tarfile.open(sys.argv[1]).extractall(sys.argv[2], filter="data")' $archive $WorkDirectory
|
||||
if ($LASTEXITCODE -ne 0) { throw 'Dawn source extraction failed (Python 3.12+ required).' }
|
||||
}
|
||||
$patch = Join-Path $PSScriptRoot '..\aurora-main\patches\dawn\apply.py'
|
||||
& $Python $patch $source
|
||||
if ($LASTEXITCODE -ne 0) { throw 'Applying the Aurora Dawn bridge failed.' }
|
||||
$build = Join-Path $WorkDirectory 'build'
|
||||
& cmake -S $source -B $build -G 'Visual Studio 17 2022' -A x64 `
|
||||
"-DPython3_EXECUTABLE=$Python" -DDAWN_FETCH_DEPENDENCIES=ON `
|
||||
-DDAWN_BUILD_MONOLITHIC_LIBRARY=SHARED -DDAWN_ENABLE_INSTALL=ON `
|
||||
-DDAWN_BUILD_SAMPLES=OFF -DDAWN_BUILD_TESTS=OFF -DDAWN_BUILD_BENCHMARKS=OFF `
|
||||
-DTINT_BUILD_TESTS=OFF -DTINT_BUILD_CMD_TOOLS=OFF -DDAWN_USE_GLFW=OFF `
|
||||
-DDAWN_ENABLE_D3D11=OFF -DDAWN_ENABLE_D3D12=ON -DDAWN_ENABLE_VULKAN=ON `
|
||||
-DDAWN_ENABLE_DESKTOP_GL=OFF -DDAWN_ENABLE_OPENGLES=OFF "-DCMAKE_INSTALL_PREFIX=$Destination"
|
||||
if ($LASTEXITCODE -ne 0) { throw 'Dawn configuration failed.' }
|
||||
& cmake --build $build --config Release --parallel $Jobs
|
||||
if ($LASTEXITCODE -ne 0) { throw 'Dawn build failed.' }
|
||||
& cmake --install $build --config Release
|
||||
if ($LASTEXITCODE -ne 0) { throw 'Dawn installation failed.' }
|
||||
$dll = Join-Path $Destination 'bin\webgpu_dawn.dll'
|
||||
if (-not (Test-Path -LiteralPath $dll)) { throw "Dawn DLL missing: $dll" }
|
||||
[ordered]@{
|
||||
SourceRevision = $revision
|
||||
AuroraVulkanAbi = 1
|
||||
DllSha256 = (Get-FileHash -LiteralPath $dll -Algorithm SHA256).Hash.ToLowerInvariant()
|
||||
} | ConvertTo-Json | Set-Content -LiteralPath (Join-Path $Destination 'aurora-vulkan.json') -Encoding UTF8
|
||||
Write-Host "Custom Dawn package ready: $Destination"
|
||||
@@ -99,7 +99,7 @@ Assert-File (Join-Path $portableTools 'Ninja\ninja.exe') 'Portable Ninja'
|
||||
# to compile (launcher/Prepare-NativePrebuilt.ps1).
|
||||
# Kept in step with InstalledLayout.DependencyNames by Test-PinnedFacts.ps1: the installed host
|
||||
# refuses to call a toolkit complete unless every one of these directories is present.
|
||||
$requiredDependencies = @('abseil-cpp','cppwinrt','dawn_prebuilt','fmt','freetype','imgui','libusb','native_prebuilt','openxr','png','SDL','sqlite3','tracy','xxhash','zlib','zstd')
|
||||
$requiredDependencies = @('abseil-cpp','cppwinrt','dawn_prebuilt','fmt','freetype','imgui','libusb','native_prebuilt','openxr','png','SDL','sqlite3','tracy','vulkan_headers','xxhash','zlib','zstd')
|
||||
$missingSources = @($requiredDependencies | Where-Object { $_ -ne 'native_prebuilt' } |
|
||||
Where-Object { -not (Test-Path -LiteralPath (Join-Path $dependencySources $_) -PathType Container) })
|
||||
if ($missingSources.Count -gt 0) {
|
||||
|
||||
@@ -9,7 +9,9 @@ param(
|
||||
[string]$Destination,
|
||||
# Windows metadata source for cppwinrt.exe: 'local' (this machine's WinMetadata), 'sdk', or an
|
||||
# installed SDK version such as 10.0.26100.0.
|
||||
[string]$CppWinRtInput = 'local'
|
||||
[string]$CppWinRtInput = 'local',
|
||||
# Output of Build-DawnVulkan.ps1. Rebuild native_prebuilt after changing Dawn.
|
||||
[string]$DawnVulkanPackage
|
||||
)
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
@@ -27,6 +29,11 @@ $runtimeCMake = Join-Path $repoRoot 'runtime\CMakeLists.txt'
|
||||
# FETCHCONTENT_SOURCE_DIR_<UPPERCASE NAME> (NativeBuildFlags.ps1), so the names are the declared
|
||||
# FetchContent names, not the upstream project names.
|
||||
$packages = @(
|
||||
[pscustomobject]@{
|
||||
Name = 'vulkan_headers'; File = 'vulkan-headers-015e25c3c91b70eb1a754d36fb14c4ba6ad9b0b9.tar.gz'
|
||||
Uris = @('https://github.com/KhronosGroup/Vulkan-Headers/archive/015e25c3c91b70eb1a754d36fb14c4ba6ad9b0b9.tar.gz')
|
||||
Pins = @(@{ File = $runtimeCMake; Text = 'Vulkan-Headers/archive/015e25c3c91b70eb1a754d36fb14c4ba6ad9b0b9.tar.gz' })
|
||||
},
|
||||
[pscustomobject]@{
|
||||
Name = 'SDL'; File = 'SDL3-3.4.4.tar.gz'
|
||||
Uris = @('https://github.com/libsdl-org/SDL/releases/download/release-3.4.4/SDL3-3.4.4.tar.gz')
|
||||
@@ -175,6 +182,22 @@ function Expand-Package([string]$Archive, [string]$Target) {
|
||||
foreach ($package in $packages) {
|
||||
Assert-Pinned $package
|
||||
$target = Join-Path $Destination $package.Name
|
||||
if ($package.Name -eq 'dawn_prebuilt' -and $DawnVulkanPackage) {
|
||||
$custom = [IO.Path]::GetFullPath($DawnVulkanPackage)
|
||||
$manifest = Get-Content -LiteralPath (Join-Path $custom 'aurora-vulkan.json') -Raw | ConvertFrom-Json
|
||||
$dll = Join-Path $custom 'bin\webgpu_dawn.dll'
|
||||
if ($manifest.SourceRevision -ne '13abc3bc8ea2d3c2050f9e77a12d012108ceee24' -or
|
||||
$manifest.AuroraVulkanAbi -ne 1 -or
|
||||
(Get-FileHash -LiteralPath $dll -Algorithm SHA256).Hash.ToLowerInvariant() -ne $manifest.DllSha256) {
|
||||
throw 'Custom Dawn package provenance or DLL hash does not match.'
|
||||
}
|
||||
if (Test-Path -LiteralPath $target) {
|
||||
throw "Use a fresh dependency destination for custom Dawn: $target already exists."
|
||||
}
|
||||
Copy-Item -LiteralPath $custom -Destination $target -Recurse
|
||||
Write-Host 'Prepared custom Dawn with Windows Vulkan OpenXR support'
|
||||
continue
|
||||
}
|
||||
if (Test-Path -LiteralPath $target -PathType Container) { continue }
|
||||
Expand-Package (Get-Archive $package) $target
|
||||
Write-Host "Prepared $($package.Name)"
|
||||
|
||||
@@ -27,7 +27,7 @@ internal static class InstalledLayout
|
||||
public static readonly string[] DependencyNames =
|
||||
[
|
||||
"abseil-cpp", "cppwinrt", "dawn_prebuilt", "fmt", "freetype", "imgui", "libusb", "native_prebuilt",
|
||||
"openxr", "png", "SDL", "sqlite3", "tracy", "xxhash", "zlib", "zstd"
|
||||
"openxr", "png", "SDL", "sqlite3", "tracy", "vulkan_headers", "xxhash", "zlib", "zstd"
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user