Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 15 additions & 65 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,9 @@ jobs:
#- { OS: ubuntu-24.04-arm }
#- { OS: macos-15 }
#- { OS: macos-15-arm }
rasterizer:
- swiftshader
- lavapipe

steps:

Expand All @@ -239,9 +242,9 @@ jobs:
cache: false
stripdown: true
# Swiftshader. Default: latest version.
install_swiftshader: true
install_swiftshader: ${{ matrix.rasterizer == 'swiftshader' }}
# Lavapipe. Default: latest version.
install_lavapipe: true
install_lavapipe: ${{ matrix.rasterizer == 'lavapipe' }}

- name: List Files
if: contains(matrix.config.OS, 'windows')
Expand All @@ -258,55 +261,18 @@ jobs:
# Register both drivers via ICD (Installable Client Driver) files in the Windows Registry before running vulkaninfoSDK.exe.
# The steps are splitted to easily access the "Output Device Name from Profile" in the CI logs.

- name: (Lavapipe) Register Driver
if: contains(matrix.config.OS, 'windows')
shell: pwsh
run: |
reg add "HKLM\SOFTWARE\Khronos\Vulkan\Drivers" /v "C:\lavapipe\share\vulkan\icd.d\lvp_icd.x86_64.json" /t REG_DWORD /d 0 /f

- name: (Lavapipe) Run vulkaninfoSDK
- name: Run vulkaninfoSDK
if: contains(matrix.config.OS, 'windows')
shell: pwsh
run: |
vulkaninfoSDK.exe -j -o lavapipe_profile.json
Get-Content -Raw lavapipe_profile.json
vulkaninfoSDK.exe -j -o profile.json
Get-Content -Raw profile.json

- name: (Lavapipe) Output Device Name from Profile
- name: Output Device Name from Profile
if: contains(matrix.config.OS, 'windows')
shell: pwsh
run: |
jq -r '.capabilities.device.properties.VkPhysicalDeviceProperties.deviceName' lavapipe_profile.json

- name: (Lavapipe) Unregister Driver
if: contains(matrix.config.OS, 'windows')
shell: pwsh
run: |
reg delete "HKLM\SOFTWARE\Khronos\Vulkan\Drivers" /v "C:\lavapipe\share\vulkan\icd.d\lvp_icd.x86_64.json" /f

- name: (SwiftShader) Register Driver
if: contains(matrix.config.OS, 'windows')
shell: pwsh
run: |
reg add "HKLM\SOFTWARE\Khronos\Vulkan\Drivers" /v "C:\Swiftshader\vk_swiftshader_icd.json" /t REG_DWORD /d 0 /f

- name: (SwiftShader) Run vulkaninfoSDK
if: contains(matrix.config.OS, 'windows')
shell: pwsh
run: |
vulkaninfoSDK.exe -j -o swiftshader_profile.json
Get-Content -Raw swiftshader_profile.json

- name: (SwiftShader) Output Device Name from Profile
if: contains(matrix.config.OS, 'windows')
shell: pwsh
run: |
jq -r '.capabilities.device.properties.VkPhysicalDeviceProperties.deviceName' swiftshader_profile.json

- name: (SwiftShader) Unregister Driver
if: contains(matrix.config.OS, 'windows')
shell: pwsh
run: |
reg delete "HKLM\SOFTWARE\Khronos\Vulkan\Drivers" /v "C:\Swiftshader\vk_swiftshader_icd.json" /f
jq -r '.capabilities.device.properties.VkPhysicalDeviceProperties.deviceName' profile.json

#- name: Show Env Vars and SDK folder (Linux)
# if: contains(matrix.config.OS, 'ubuntu')
Expand Down Expand Up @@ -388,39 +354,23 @@ jobs:
dir /s C:\Lavapipe
)

# Generate vulkaninfo profiles for both rasterizers (lavapipe_profile.json, swiftshader_profile.json).
# Register both drivers via ICD (Installable Client Driver) files in the Windows Registry before running vulkaninfoSDK.exe.
# The steps are splitted to easily access the "Output Device Name from Profile" in the CI logs.

- name: (Lavapipe) Register Driver
if: contains(matrix.config.OS, 'windows')
shell: pwsh
run: |
reg add "HKLM\SOFTWARE\Khronos\Vulkan\Drivers" /v "C:\lavapipe\share\vulkan\icd.d\lvp_icd.x86_64.json" /t REG_DWORD /d 0 /f

# And of course the file is named vulkaninfoSDK.exe when from the SDK
# and named vulkaninfo.exe when from the runtime only package.
# I see we love consistency at LunarG... :)
#working-directory: ${{env.VULKAN_SDK}}\${{env.VULKAN_VERSION}}\runtime\x64
- name: (Lavapipe) Run vulkaninfoSDK
- name: Run vulkaninfoSDK
if: contains(matrix.config.OS, 'windows')
shell: pwsh
run: |
$vulkanPath = Join-Path $env:VULKAN_SDK $env:VULKAN_VERSION
Set-Location "$vulkanPath\runtime\x64"
.\vulkaninfo.exe -j -o lavapipe_profile.json
Get-Content -Raw lavapipe_profile.json
.\vulkaninfo.exe -j -o profile.json
Get-Content -Raw profile.json

- name: (Lavapipe) Output Device Name from Profile
- name: Output Device Name from Profile
if: contains(matrix.config.OS, 'windows')
shell: pwsh
run: |
$vulkanPath = Join-Path $env:VULKAN_SDK $env:VULKAN_VERSION
Set-Location "$vulkanPath\runtime\x64"
jq -r '.capabilities.device.properties.VkPhysicalDeviceProperties.deviceName' lavapipe_profile.json

- name: (Lavapipe) Unregister Driver
if: contains(matrix.config.OS, 'windows')
shell: pwsh
run: |
reg delete "HKLM\SOFTWARE\Khronos\Vulkan\Drivers" /v "C:\lavapipe\share\vulkan\icd.d\lvp_icd.x86_64.json" /f
jq -r '.capabilities.device.properties.VkPhysicalDeviceProperties.deviceName' profile.json
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ third-party/
Thumbs.db

coverage

# IDE config
.idea/
27 changes: 25 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,10 @@ export async function run(): Promise<void> {
* Install SwiftShader
* ---------------------------------------------------------------------- */

let swiftshaderInstallPath;
if (platform.IS_WINDOWS && inputs.installSwiftshader) {
core.info(`🚀 Installing SwiftShader library...`)
const swiftshaderInstallPath = await installerSwiftshader.installSwiftShader(
swiftshaderInstallPath = await installerSwiftshader.installSwiftShader(
inputs.swiftshaderDestination,
inputs.useCache
)
Expand All @@ -236,12 +237,34 @@ export async function run(): Promise<void> {
* Install Lavapipe
* ---------------------------------------------------------------------- */

let LavapipeInstallPath;
if (platform.IS_WINDOWS && inputs.installLavapipe) {
core.info(`🚀 Installing Lavapipe library...`)
const LavapipeInstallPath = await installerLavapipe.installLavapipe(inputs.lavapipeDestination, inputs.useCache)
LavapipeInstallPath = await installerLavapipe.installLavapipe(inputs.lavapipeDestination, inputs.useCache)
core.info(`✔️ [INFO] Path to Lavapipe: ${LavapipeInstallPath}`)
}

/* ----------------------------------------------------------------------
* Setup drivers
* ---------------------------------------------------------------------- */

if (platform.IS_WINDOWS && inputs.installLavapipe) {
let idcs = [];
let path = [];
if (swiftshaderInstallPath) {
path.push(swiftshaderInstallPath)
idcs.push(`${swiftshaderInstallPath}/vk_swiftshader_icd.json`)
}
if (LavapipeInstallPath) {
path.push(LavapipeInstallPath)
idcs.push(`${LavapipeInstallPath}/share/vulkan/icd.d/lvp_icd.x86_64.json`)
}
let vkDriverFiles = `VK_DRIVER_FILES=${idcs.join(";")}`;
core.exportVariable('GITHUB_PATH', path.join(";"))
core.exportVariable('GITHUB_ENV', vkDriverFiles)
core.info(`✔️ [ENV] Set env variable "${vkDriverFiles}".`)
}

core.info(`✅ Done.`)
} catch (error) {
errors.handleError(error as Error)
Expand Down