-# Ensure that dxil.dll in on the %PATH%\r
-$dxil_dll = cmd.exe /C "C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=amd64 -no_logo && where dxil.dll" 2>&1\r
-if ($dxil_dll -notmatch "dxil.dll$") {\r
- Write-Output "Couldn't get path to dxil.dll"\r
- exit 1\r
-}\r
-$env:Path = "$(Split-Path $dxil_dll);$env:Path"\r
-\r
-$exec_mode_to_stage = @{ Fragment = "fragment"; Vertex = "vertex"; GLCompute = "compute" }\r
-\r
-$spvasm_files = (Get-ChildItem C:\spirv-samples\spvasm\*.spvasm) | Sort-Object Name\r
-foreach ($spvasm in $spvasm_files) {\r
- $test_name = "Test:$($spvasm.Name):"\r
- $spvfile = ($spvasm -replace '\.spvasm$', '.spv')\r
- $content = Get-Content $spvasm\r
- $spv_version = "1.0"\r
- if ($content | Where-Object { $_ -match 'Version:\s(\d+\.\d+)' }) {\r
- $spv_version = $Matches[1]\r
- }\r
- \r
- $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\r
- if ($LASTEXITCODE -ne 0) {\r
- Write-Output "$test_name Skip: Unable to assemble shader"\r
- Write-Output "$as_output`n"\r
- continue\r
- }\r
-\r
- $entry_points = $content | Select-String -Pattern '^OpEntryPoint\s(\w+)[^"]+"(\w+)"' | Select-Object -ExpandProperty Matches -First 1\r
- if ($entry_points.Count -eq 0) {\r
- Write-Output "$test_name Skip"\r
- Write-Output "No OpEntryPoint not found`n"\r
- continue\r
- }\r
-\r
- foreach ($match in $entry_points) {\r
- $exec_mode, $entry_point = $match.Groups[1].Value, $match.Groups[2].Value\r
- $subtest = "$test_name$entry_point|${exec_mode}:"\r
- $stage = $exec_mode_to_stage[$exec_mode]\r
- if ($stage -eq '') {\r
- Write-Output "$subtest Fail: Unknown shader type ($exec_mode)"\r
- continue\r
- }\r
- \r
- $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\r
- if ($LASTEXITCODE -eq 0) {\r
- Write-Output "$subtest Pass"\r
- }\r
- else {\r
- Write-Output "$subtest Fail"\r
- $sanitized_output = $s2d_output -replace ', file .+, line \d+' -replace ' In file .+:\d+'\r
- Write-Output "$sanitized_output`n"\r
- }\r
- }\r
-}\r
+# 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"
+ $sanitized_output = $s2d_output -replace ', file .+, line \d+' -replace ' In file .+:\d+'
+ Write-Output "$sanitized_output`n"
+ }
+ }
+}
-. .\_install\spirv2dxil_check.ps1 2>&1 | Set-Content -Path .\spirv2dxil_results.txt\r
-$reference = Get-Content .\_install\spirv2dxil_reference.txt\r
-$result = Get-Content .\spirv2dxil_results.txt\r
-if (-Not ($reference -And $result)) {\r
- Exit 1\r
-}\r
- \r
-$diff = Compare-Object -ReferenceObject $reference -DifferenceObject $result\r
-if (-Not $diff) {\r
- Exit 0\r
-}\r
-\r
-Write-Host "Unexpected change in results:"\r
-Write-Output $diff | Format-Table -Property SideIndicator, InputObject -Wrap\r
-\r
-Exit 1\r
+. .\_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