add HLSL validation via FXC to CI

This commit is contained in:
teoxoy authored and Dzmitry Malyshau committed 2022-05-22 08:53:46 -07:00
1 parent 104f4dc7ec
commit 62da3bf348
3 files changed
+60 -8

No files matched your search

+19 -3
View File
@@ -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
+38 -4
View File
@@ -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
+3 -1
View File
@@ -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.
```