diff --git a/.github/workflows/validation-windows.yml b/.github/workflows/validation-windows.yml index c9bd5ae1f..31f7ee368 100644 --- a/.github/workflows/validation-windows.yml +++ b/.github/workflows/validation-windows.yml @@ -5,12 +5,28 @@ on: - 'tests/out/hlsl/*.hlsl' jobs: - validate-windows: - name: HLSL + validate-windows-dxc: + name: HLSL via DXC runs-on: windows-latest steps: - uses: actions/checkout@v2 - name: Add DirectXShaderCompiler uses: napokue/setup-dxc@v1.0.0 - - run: make validate-hlsl + - run: make validate-hlsl-dxc shell: sh + + validate-windows-fxc: + name: HLSL via FXC + runs-on: windows-latest + steps: + - uses: actions/checkout@v2 + - name: Add fxc bin to PATH + run: | + Get-Childitem -Path "C:\Program Files (x86)\Windows Kits\10\bin\**\x64\fxc.exe" ` + | Sort-Object -Property LastWriteTime -Descending ` + | Select-Object -First 1 ` + | Split-Path -Parent ` + | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf8 -Append + shell: powershell + - run: make validate-hlsl-fxc + shell: sh \ No newline at end of file diff --git a/Makefile b/Makefile index 4622fdbb5..a491722af 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: all clean validate-spv validate-msl validate-glsl validate-dot validate-wgsl validate-hlsl +.PHONY: all clean validate-spv validate-msl validate-glsl validate-dot validate-wgsl validate-hlsl-dxc validate-hlsl-fxc .SECONDARY: boids.metal quad.metal SNAPSHOTS_BASE_IN=tests/in SNAPSHOTS_BASE_OUT=tests/out @@ -69,10 +69,10 @@ validate-wgsl: $(SNAPSHOTS_BASE_OUT)/wgsl/*.wgsl cargo run $${file}; \ done -validate-hlsl: SHELL:=/bin/bash # required because config files uses arrays -validate-hlsl: $(SNAPSHOTS_BASE_OUT)/hlsl/*.hlsl +validate-hlsl-dxc: SHELL:=/bin/bash # required because config files uses arrays +validate-hlsl-dxc: $(SNAPSHOTS_BASE_OUT)/hlsl/*.hlsl @set -e && for file in $^ ; do \ - DXC_PARAMS="-Wno-parentheses-equality -Zi -Qembed_debug"; \ + DXC_PARAMS="-Wno-parentheses-equality -Zi -Qembed_debug -Od"; \ echo "Validating" $${file#"$(SNAPSHOTS_BASE_OUT)/"}; \ config="$$(dirname $${file})/$$(basename $${file}).config"; \ . $${config}; \ @@ -93,3 +93,37 @@ validate-hlsl: $(SNAPSHOTS_BASE_OUT)/hlsl/*.hlsl done; \ echo "======================"; \ done + +validate-hlsl-fxc: SHELL:=/bin/bash # required because config files uses arrays +validate-hlsl-fxc: $(SNAPSHOTS_BASE_OUT)/hlsl/*.hlsl + @set -e && for file in $^ ; do \ + FXC_PARAMS="-Zi -Od"; \ + echo "Validating" $${file#"$(SNAPSHOTS_BASE_OUT)/"}; \ + config="$$(dirname $${file})/$$(basename $${file}).config"; \ + . $${config}; \ + for (( i=0; i<$${#vertex[@]}; i++ )); do \ + name=`echo $${vertex[i]} | cut -d \: -f 1`; \ + profile=`echo $${vertex[i]} | cut -d \: -f 2`; \ + sm=`echo $${profile} | cut -d \_ -f 2`; \ + if (( sm < 6 )); then \ + (set -x; fxc $${file} -T $${profile} -E $${name} $${FXC_PARAMS} > /dev/null); \ + fi \ + done; \ + for (( i=0; i<$${#fragment[@]}; i++ )); do \ + name=`echo $${fragment[i]} | cut -d \: -f 1`; \ + profile=`echo $${fragment[i]} | cut -d \: -f 2`; \ + sm=`echo $${profile} | cut -d \_ -f 2`; \ + if (( sm < 6 )); then \ + (set -x; fxc $${file} -T $${profile} -E $${name} $${FXC_PARAMS} > /dev/null); \ + fi \ + done; \ + for (( i=0; i<$${#compute[@]}; i++ )); do \ + name=`echo $${compute[i]} | cut -d \: -f 1`; \ + profile=`echo $${compute[i]} | cut -d \: -f 2`; \ + sm=`echo $${profile} | cut -d \_ -f 2`; \ + if (( sm < 6 )); then \ + (set -x; fxc $${file} -T $${profile} -E $${name} $${FXC_PARAMS} > /dev/null); \ + fi \ + done; \ + echo "======================"; \ + done diff --git a/README.md b/README.md index fbaa063d7..762822a11 100644 --- a/README.md +++ b/README.md @@ -81,5 +81,7 @@ make validate-msl # for Metal shaders, requires XCode command-line tools install make validate-glsl # for OpenGL shaders, requires GLSLang installed make validate-dot # for dot files, requires GraphViz installed make validate-wgsl # for WGSL shaders -make validate-hlsl # for HLSL shaders. Note: this Make target makes use of the "sh" shell. This is not the default shell in Windows. +make validate-hlsl-dxc # for HLSL shaders via DXC +make validate-hlsl-fxc # for HLSL shaders via FXC +# Note: HLSL Make targets make use of the "sh" shell. This is not the default shell in Windows. ```