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
106 changes: 42 additions & 64 deletions .github/workflows/visual-regression.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ name: Visual Regression
on:
pull_request:
paths:
- 'Src/Render/Vulkan/**'
- 'Src/Render/Render_Shader.h'
- 'Include/GFx_Renderer_Vulkan.h'
- 'Src/**'
- 'Include/**'
- 'Tests/VisualRegression/**'
- 'Bin/x64/Msvc10/GFxPlayerTinyVulkan/**'
- 'Lib/**/libgfxrender_vulkan*'
- 'CMakeLists.txt'
- 'cmake/**'
- '3rdParty/CMakeLists.txt'
- 'Apps/CMakeLists.txt'
- '.github/workflows/visual-regression.yml'
workflow_dispatch:

jobs:
Expand All @@ -24,69 +26,29 @@ jobs:
with:
python-version: '3.11'

# Install Vulkan SDK (headers + loader needed for build)
- name: Install Vulkan SDK
shell: pwsh
run: |
$sdkVersion = "1.3.290.0"
$url = "https://sdk.lunarg.com/sdk/download/$sdkVersion/windows/VulkanSDK-$sdkVersion-Installer.exe"
$installer = "$env:RUNNER_TEMP\VulkanSDK-Installer.exe"
Write-Host "Downloading Vulkan SDK $sdkVersion..."
Invoke-WebRequest -Uri $url -OutFile $installer -UseBasicParsing
Write-Host "Installing Vulkan SDK..."
Start-Process -FilePath $installer -ArgumentList "--accept-licenses --default-answer --confirm-command install" -Wait
$sdkPath = "C:\VulkanSDK\$sdkVersion"
echo "VULKAN_SDK=$sdkPath" >> $env:GITHUB_ENV
echo "VK_SDK_PATH=$sdkPath" >> $env:GITHUB_ENV
echo "$sdkPath\Bin" >> $env:GITHUB_PATH

# Build CaptureVulkan from source
# Install Vulkan SDK + SwiftShader (CPU-based Vulkan ICD for headless CI)
- name: Install Vulkan SDK + SwiftShader
uses: jakoch/install-vulkan-sdk-action@v1
with:
vulkan_version: 1.3.290.0
install_runtime: true
cache: true
stripdown: true
install_swiftshader: true

# Build CaptureVulkan from source using CMake
- name: Configure CMake
run: cmake --preset ci

- name: Build CaptureVulkan
shell: pwsh
run: |
# Build expat, Render_Vulkan lib, and CaptureVulkan (skip D3D11 — no libs in CI)
& Tests/VisualRegression/build_tests.ps1 -SkipD3D11
if (-not (Test-Path "Bin/x64/Msvc10/Tests/CaptureVulkan.exe")) {
cmake --build --preset ci-release
if (!(Test-Path "Bin/x64/Msvc10/Tests/CaptureVulkan.exe")) {
Write-Error "CaptureVulkan.exe was not built"
exit 1
}
Write-Host "CaptureVulkan.exe built successfully"

# Download and set up SwiftShader as the Vulkan ICD
- name: Install SwiftShader
shell: pwsh
run: |
$swiftshaderDir = "$env:RUNNER_TEMP\swiftshader"
New-Item -ItemType Directory -Force -Path $swiftshaderDir | Out-Null

# Download SwiftShader from official Chrome build artifacts
$url = "https://github.com/nicebyte/swiftshader-binaries/releases/download/v1/swiftshader-windows-x86_64.zip"
$zipPath = "$env:RUNNER_TEMP\swiftshader.zip"
Write-Host "Downloading SwiftShader from $url"
Invoke-WebRequest -Uri $url -OutFile $zipPath -UseBasicParsing
Expand-Archive -Path $zipPath -DestinationPath $swiftshaderDir -Force

# Find the ICD JSON and DLL
$icdJson = Get-ChildItem -Path $swiftshaderDir -Recurse -Filter "vk_swiftshader_icd.json" | Select-Object -First 1
if (-not $icdJson) {
Write-Error "vk_swiftshader_icd.json not found in downloaded archive"
exit 1
}
Write-Host "SwiftShader ICD: $($icdJson.FullName)"

# Set VK_ICD_FILENAMES so the Vulkan loader picks up SwiftShader
echo "VK_ICD_FILENAMES=$($icdJson.FullName)" >> $env:GITHUB_ENV
echo "SWIFTSHADER_DIR=$($icdJson.DirectoryName)" >> $env:GITHUB_ENV

- name: Verify SwiftShader
shell: pwsh
run: |
Write-Host "VK_ICD_FILENAMES=$env:VK_ICD_FILENAMES"
if (-not (Test-Path $env:VK_ICD_FILENAMES)) {
Write-Error "SwiftShader ICD file not found"
exit 1
}
Write-Host "SwiftShader ready"

# Run CaptureVulkan for each test in the manifest
- name: Capture Vulkan frames (SwiftShader)
Expand All @@ -105,9 +67,15 @@ jobs:
exit 1
}

# Tests that crash SwiftShader at high-complexity frames
$exclude = @("Mask_AS2", "Mask_AS3", "MMOPackedRender")
$failed = 0
foreach ($test in $manifest.tests) {
$name = $test.name
if ($exclude -contains $name) {
Write-Host "=== $name === [SKIP — crashes SwiftShader]" -ForegroundColor DarkGray
continue
}
$swf = Join-Path $dataDir $test.swf
$outDir = Join-Path $outputRoot $name
New-Item -ItemType Directory -Force -Path $outDir | Out-Null
Expand All @@ -120,14 +88,23 @@ jobs:
$proc = Start-Process -FilePath $captureExe `
-ArgumentList "`"$swf`" `"$outDir`" --frames $frames --width $w --height $h" `
-NoNewWindow -PassThru -Wait
if ($proc.ExitCode -ne 0) {
Write-Host " FAILED (exit code $($proc.ExitCode))" -ForegroundColor Red
# Check output files rather than exit code — CaptureVulkan may crash
# during cleanup after successfully writing all frames (known issue)
$frameList = $frames -split ","
$missingFrames = $frameList | Where-Object {
-not (Test-Path (Join-Path $outDir "frame_$($_.PadLeft(4,'0')).ppm"))
}
if ($missingFrames.Count -gt 0) {
Write-Host " FAILED — missing frames: $($missingFrames -join ',')" -ForegroundColor Red
$failed++
} elseif ($proc.ExitCode -ne 0) {
Write-Host " OK (captured all frames, exit code $($proc.ExitCode) during cleanup)" -ForegroundColor Yellow
}
}

if ($failed -gt 0) {
Write-Warning "$failed test(s) failed to capture"
Write-Error "$failed of $($manifest.tests.Count) test(s) failed to capture"
exit 1
}

# Convert PPM captures to PNG for comparison
Expand Down Expand Up @@ -189,6 +166,7 @@ jobs:
python Tests/VisualRegression/compare_reference.py
--vulkan-dir Tests/VisualRegression/Output/Captures/vulkan_swiftshader
--threshold 16
--exclude Mask_AS2 Mask_AS3 MMOPackedRender

- name: Upload captures on failure
if: failure()
Expand Down
87 changes: 66 additions & 21 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
# CMake build directory
build/

##### Backup
*.bak
*.gho
*.ori
*.orig
*.tmp

# Log file - the following switch allows to specify the file that will be
# used to write all messages from simulation: -l <filename>
# Log files
*.log

##### Qt
# C++ objects and libs
# C++ objects and intermediate files
*.slo
*.lo
*.o
Expand All @@ -19,48 +20,92 @@
*.lai
*.so
*.so.*
#*.dll
*.dylib
*.user
*.suo
*.[Cc]ache
*.bak
*.ncb
*.log
*.DS_Store

# Build results
#*.dll
#*.exe
# Visual Studio 2015/2017 cache/options directory
# Visual Studio cache
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/

# GFxShaderMaker build output (generated by GFxShaderMaker_build.vcxproj)
Bin/Tools/GFxShaderMaker/GFxShaderMaker.exe
Bin/Tools/GFxShaderMaker/GFxShaderMaker.dll
Bin/Tools/GFxShaderMaker/GFxShaderMaker.pdb
Bin/Tools/GFxShaderMaker/GFxShaderMaker.deps.json
Bin/Tools/GFxShaderMaker/GFxShaderMaker.runtimeconfig.json

# Build intermediates
*.pdb
*.ilk
*.map
Obj/

# ---------------------------------------------------------------------------
# 3rdParty — prebuilt libs (now rebuilt from source via CMake)
# ---------------------------------------------------------------------------
3rdParty/expat-2.1.0/Obj/
3rdParty/expat-2.1.0/lib/Win32/
3rdParty/expat-2.1.0/lib/x64/
3rdParty/expat-2.1.0/lib/Xbox360/

3rdParty/jpeg-8d/.libs/
3rdParty/jpeg-8d/Obj/
3rdParty/jpeg-8d/Lib/Win32/
3rdParty/jpeg-8d/Lib/x64/
3rdParty/jpeg-8d/Lib/Xbox360/

3rdParty/libpng-1.5.13/Obj/
3rdParty/libpng-1.5.13/Lib/Win32/
3rdParty/libpng-1.5.13/Lib/x64/
3rdParty/libpng-1.5.13/Lib/Xbox360/

3rdParty/zlib-1.2.7/Obj/
3rdParty/zlib-1.2.7/Lib/Win32/
3rdParty/zlib-1.2.7/Lib/x64/
3rdParty/zlib-1.2.7/Lib/Xbox360/

3rdParty/pcre/Lib/Win32/
3rdParty/pcre/Lib/x64/
3rdParty/pcre/Lib/Xbox360/

3rdParty/nvtt/Lib/

# ---------------------------------------------------------------------------
# SDK libraries (rebuilt from source via CMake)
# ---------------------------------------------------------------------------
Lib/Win32/Msvc10/
Lib/x64/Msvc10/

# ---------------------------------------------------------------------------
# Sample/Kit executables (rebuilt from source via CMake)
# ---------------------------------------------------------------------------
Bin/Win32/Msvc10/GFxPlayer/*.exe
Bin/x64/Msvc10/GFxPlayer/*.exe
Bin/Win32/Msvc10/PlayerTiny/*.exe
Bin/Win32/Msvc10/PlayerTinyCompat/*.exe
Bin/Win32/Msvc10/DrawText/*.exe
Bin/Win32/Msvc10/ImageDelegate/*.exe
Bin/Win32/Msvc10/SWFToTexture/*.exe
Bin/Win32/Msvc10/TextureInSWF/*.exe
Bin/Win32/Msvc10/GFxPlayerTinyVulkan/
Bin/x64/Msvc10/GFxPlayerTinyVulkan/
Bin/Data/AS3/Kits/HUD/HUDKit.exe
Bin/Data/AS3/Kits/Menu/MenuKit.exe
Bin/Data/AS3/Kits/MMO/MMOKit.exe
Lib/Win32/Msvc10/Release/NonSCU/

# ---------------------------------------------------------------------------
# GFxShaderMaker build output (.NET tool)
# ---------------------------------------------------------------------------
Bin/Tools/GFxShaderMaker/GFxShaderMaker.exe
Bin/Tools/GFxShaderMaker/GFxShaderMaker.dll
Bin/Tools/GFxShaderMaker/GFxShaderMaker.pdb
Bin/Tools/GFxShaderMaker/GFxShaderMaker.deps.json
Bin/Tools/GFxShaderMaker/GFxShaderMaker.runtimeconfig.json

# Generated shader sources (rebuilt by GFxShaderMaker)
Src/Render/D3D1x/Shaders/
Src/Render/Vulkan/Shaders/

# Test build output (rebuilt from Tests/VisualRegression/build_tests.ps1)
# Test build output (rebuilt via CMake)
Bin/x64/Msvc10/Tests/
Bin/Win32/Msvc10/Tests/

# Visual regression test output
Tests/VisualRegression/Output/
Expand Down
Loading
Loading