ci/windows: Add validation tests for spriv_to_dxil

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13655>
This commit is contained in:
Enrico Galli 2021-11-03 11:36:01 -07:00 committed by Marge Bot
parent 37c366e283
commit 13ee05f2b4
6 changed files with 1605 additions and 1 deletions

View File

@ -550,7 +550,7 @@ debian/arm_test:
variables:
MESA_IMAGE: "$CI_REGISTRY_IMAGE/${MESA_IMAGE_PATH}:${MESA_IMAGE_TAG}"
MESA_IMAGE_PATH: "windows/x64_build"
MESA_IMAGE_TAG: "2021-06-24-zink-msvc"
MESA_IMAGE_TAG: "2021-11-04-spirv-shaders"
MESA_UPSTREAM_IMAGE: "$CI_REGISTRY/$FDO_UPSTREAM_REPO/$MESA_IMAGE_PATH:${MESA_IMAGE_TAG}"
windows_build_vs2019:
@ -1054,6 +1054,26 @@ test-d3d12-windows:
paths:
- summary/
test-spirv2dxil-windows:
extends:
- .build-windows
- .use-windows_build_vs2019
- .windows-test-rules
stage: layered-backends
dependencies:
- windows-vs2019
needs:
- windows-vs2019
variables:
GIT_STRATEGY: none # testing doesn't build anything from source
script:
- . _install/spirv2dxil_run.ps1
artifacts:
when: on_failure
name: "mesa_${CI_JOB_NAME}"
paths:
- spirv2dxil_results.txt
debian-clover:
extends: .meson-build
variables:

View File

@ -22,3 +22,7 @@ if (!$buildstatus) {
Copy-Item ".\.gitlab-ci\windows\piglit_run.ps1" -Destination $installdir
Copy-Item ".\.gitlab-ci\windows\quick_gl.txt" -Destination $installdir
Copy-Item ".\.gitlab-ci\windows\spirv2dxil_check.ps1" -Destination $installdir
Copy-Item ".\.gitlab-ci\windows\spirv2dxil_run.ps1" -Destination $installdir
Copy-Item ".\.gitlab-ci\windows\spirv2dxil_reference.txt" -Destination $installdir

View File

@ -201,5 +201,12 @@ if (!$buildstatus -Or !$installstatus) {
Copy-Item -Path C:\freeglut\bin\x64\freeglut.dll -Destination C:\Piglit\lib\piglit\bin\freeglut.dll
Get-Date
Write-Host "Cloning spirv-samples"
git clone --no-progress --single-branch --no-checkout https://github.com/dneto0/spirv-samples.git C:\spirv-samples\
Push-Location -Path C:\spirv-samples\
git checkout 7ac0ad5a7fe0ec884faba1dc2916028d0268eeef
Pop-Location
Get-Date
Write-Host "Complete"

View File

@ -0,0 +1,53 @@
# Ensure that dxil.dll in on the %PATH%
$dxil_dll = cmd.exe /C "C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=amd64 -no_logo && where dxil.dll" 2>&1
if ($dxil_dll -notmatch "dxil.dll$") {
Write-Output "Couldn't get path to dxil.dll"
exit 1
}
$env:Path = "$(Split-Path $dxil_dll);$env:Path"
$exec_mode_to_stage = @{ Fragment = "fragment"; Vertex = "vertex"; GLCompute = "compute" }
$spvasm_files = (Get-ChildItem C:\spirv-samples\spvasm\*.spvasm) | Sort-Object Name
foreach ($spvasm in $spvasm_files) {
$test_name = "Test:$($spvasm.Name):"
$spvfile = ($spvasm -replace '\.spvasm$', '.spv')
$content = Get-Content $spvasm
$spv_version = "1.0"
if ($content | Where-Object { $_ -match 'Version:\s(\d+\.\d+)' }) {
$spv_version = $Matches[1]
}
$as_output = C:\spirv-tools\bin\spirv-as.exe --target-env spv$spv_version --preserve-numeric-ids -o $spvfile $spvasm 2>&1 | % { if ($_ -is [System.Management.Automation.ErrorRecord]) { $_.Exception.Message } else { $_ } } | Out-String
if ($LASTEXITCODE -ne 0) {
Write-Output "$test_name Skip: Unable to assemble shader"
Write-Output "$as_output`n"
continue
}
$entry_points = $content | Select-String -Pattern '^OpEntryPoint\s(\w+)[^"]+"(\w+)"' | Select-Object -ExpandProperty Matches -First 1
if ($entry_points.Count -eq 0) {
Write-Output "$test_name Skip"
Write-Output "No OpEntryPoint not found`n"
continue
}
foreach ($match in $entry_points) {
$exec_mode, $entry_point = $match.Groups[1].Value, $match.Groups[2].Value
$subtest = "$test_name$entry_point|${exec_mode}:"
$stage = $exec_mode_to_stage[$exec_mode]
if ($stage -eq '') {
Write-Output "$subtest Fail: Unknown shader type ($exec_mode)"
continue
}
$s2d_output = .\_install\bin\spirv2dxil.exe -v -e "$entry_point" -s "$stage" -o NUL $spvfile 2>&1 | ForEach-Object { if ($_ -is [System.Management.Automation.ErrorRecord]) { $_.Exception.Message } else { $_ } } | Out-String
if ($LASTEXITCODE -eq 0) {
Write-Output "$subtest Pass"
}
else {
Write-Output "$subtest Fail"
Write-Output "$s2d_output`n"
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,16 @@
. .\_install\spirv2dxil_check.ps1 2>&1 | Set-Content -Path .\spirv2dxil_results.txt
$reference = Get-Content .\_install\spirv2dxil_reference.txt
$result = Get-Content .\spirv2dxil_results.txt
if (-Not ($reference -And $result)) {
Exit 1
}
$diff = Compare-Object -ReferenceObject $reference -DifferenceObject $result
if (-Not $diff) {
Exit 0
}
Write-Host "Unexpected change in results:"
Write-Output $diff | Format-Table -Property SideIndicator, InputObject -Wrap
Exit 1