-
Notifications
You must be signed in to change notification settings - Fork 946
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'naga-master' into naga-merge
- Loading branch information
Showing
608 changed files
with
128,144 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[alias] | ||
xtask = "run --manifest-path xtask/Cargo.toml --" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
tests/out/**/* text eol=lf |
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* @gfx-rs/naga |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
name: CI | ||
on: [push, pull_request] | ||
|
||
env: | ||
CARGO_INCREMENTAL: false | ||
CARGO_TERM_COLOR: always | ||
RUST_BACKTRACE: full | ||
MSRV: 1.65 | ||
|
||
jobs: | ||
check-msrv: | ||
name: Check MSRV and minimal-versions | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install MSRV toolchain | ||
run: rustup toolchain install $MSRV --no-self-update --profile=minimal --component clippy | ||
|
||
- name: Install nightly toolchain | ||
run: rustup toolchain install nightly --no-self-update --profile=minimal | ||
|
||
- name: Install cargo-hack | ||
uses: taiki-e/install-action@v2 | ||
with: | ||
tool: cargo-hack | ||
|
||
# -Z avoid-dev-deps doesn't work | ||
- run: cargo +nightly hack generate-lockfile --remove-dev-deps -Z minimal-versions | ||
|
||
- name: Test all features | ||
run: cargo +$MSRV clippy --all-features --workspace -- -D warnings | ||
|
||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install cargo-nextest and cargo-llvm-cov | ||
uses: taiki-e/install-action@v2 | ||
with: | ||
tool: cargo-nextest,cargo-llvm-cov | ||
|
||
- name: Default test | ||
# Our intention here is to test `naga` with no features enabled. But | ||
# since `cli` is the default package, a plain `cargo test` will build | ||
# `naga` with the features requested in `cli/Cargo.toml`. Passing | ||
# `--package naga` causes us to use the default features in the | ||
# top-level `Cargo.toml` instead. | ||
run: cargo nextest run --package naga | ||
|
||
- name: Test all features | ||
run: cargo llvm-cov --lcov --output-path lcov.info nextest --all-features --workspace | ||
|
||
- name: Upload coverage report to codecov | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
files: lcov.info | ||
|
||
- name: Check snapshots | ||
run: git diff --exit-code -- tests/out | ||
|
||
check: | ||
name: Check benchmarks and naga-fuzz | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Check benchmarks | ||
run: cargo check --benches | ||
|
||
- name: Check naga-fuzz | ||
run: | | ||
cd fuzz | ||
cargo check | ||
documentation: | ||
name: Documentation | ||
runs-on: ubuntu-latest | ||
env: | ||
RUSTDOCFLAGS: -Dwarnings | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- run: cargo doc -p naga --all-features --document-private-items | ||
|
||
fmt: | ||
name: Format | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- run: cargo fmt -- --check |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
# Lazy jobs running on master post merges. | ||
name: lazy | ||
on: | ||
push: | ||
branches: [master] | ||
pull_request: | ||
paths: | ||
- '.github/workflows/lazy.yml' | ||
|
||
env: | ||
CARGO_INCREMENTAL: false | ||
CARGO_TERM_COLOR: always | ||
RUST_BACKTRACE: full | ||
|
||
jobs: | ||
parse-dota2: | ||
name: Parse Dota2 shaders | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- run: mkdir data | ||
|
||
- name: Download shaders | ||
run: curl https://user.fm/files/v2-5573e18b9f03f42c6ae53c392083da35/dota2-shaders.zip -o data/all.zip | ||
|
||
- name: Unpack shaders | ||
run: cd data && unzip all.zip | ||
|
||
- name: Build Naga | ||
run: cargo build --release --bin naga | ||
|
||
- name: Convert shaders | ||
run: for file in data/*.spv ; do echo "Translating" ${file} && target/release/naga --validate 27 ${file} ${file}.metal; done | ||
|
||
parse-vulkan-tutorial-shaders: | ||
name: Parse Sascha Willems Vulkan tutorial shaders | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Download shaders | ||
run: git clone https://github.com/SaschaWillems/Vulkan.git | ||
|
||
- name: Build Naga | ||
run: cargo build --release --bin naga | ||
|
||
- name: Convert metal shaders | ||
run: | | ||
# No needed to stop workflow if we can't validate one file | ||
set +e | ||
touch counter | ||
SUCCESS_RESULT_COUNT=0 | ||
FILE_COUNT=0 | ||
mkdir -p out | ||
find "Vulkan/data/shaders/glsl/" -name '*.spv' | while read fname; | ||
do | ||
echo "Convert: $fname" | ||
FILE_COUNT=$((FILE_COUNT+1)) | ||
target/release/naga --validate 27 $(realpath ${fname}) out/$(basename ${fname}).metal | ||
if [[ $? -eq 0 ]]; then | ||
SUCCESS_RESULT_COUNT=$((SUCCESS_RESULT_COUNT + 1)) | ||
fi | ||
echo "Result: $(expr $FILE_COUNT - $SUCCESS_RESULT_COUNT) / $FILE_COUNT" > counter | ||
done | ||
cat counter | ||
dneto0_spirv-samples: | ||
name: Parse dneto0 spirv-samples | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Download shaders | ||
run: git clone https://github.com/dneto0/spirv-samples.git | ||
|
||
- name: Build Naga | ||
run: cargo build --release --bin naga | ||
|
||
- name: Install spirv-tools | ||
run: | | ||
wget -q https://storage.googleapis.com/spirv-tools/artifacts/prod/graphics_shader_compiler/spirv-tools/linux-clang-release/continuous/1489/20210629-121459/install.tgz | ||
tar zxf install.tgz | ||
./install/bin/spirv-as --version | ||
- name: Compile spv from spvasm | ||
run: | | ||
cd spirv-samples | ||
mkdir -p spv | ||
find "./spvasm" -name '*.spvasm' | while read fname; | ||
do | ||
echo "Convert to spv with spirv-as: $fname" | ||
../install/bin/spirv-as --target-env spv1.3 $(realpath ${fname}) -o ./spv/$(basename ${fname}).spv | ||
done; | ||
- name: Validate spv and generate wgsl | ||
run: | | ||
set +e | ||
cd spirv-samples | ||
SUCCESS_RESULT_COUNT=0 | ||
FILE_COUNT=0 | ||
mkdir -p spv | ||
mkdir -p wgsl | ||
echo "==== Validate spv and generate wgsl ====" | ||
rm -f counter | ||
touch counter | ||
find "./spv" -name '*.spv' | while read fname; | ||
do | ||
echo "Convert: $fname" | ||
FILE_COUNT=$((FILE_COUNT+1)) | ||
../target/release/naga --validate 27 $(realpath ${fname}) ./wgsl/$(basename ${fname}).wgsl | ||
if [[ $? -eq 0 ]]; then | ||
SUCCESS_RESULT_COUNT=$((SUCCESS_RESULT_COUNT + 1)) | ||
fi | ||
echo "Result: $(expr $FILE_COUNT - $SUCCESS_RESULT_COUNT) / $FILE_COUNT" > counter | ||
done | ||
cat counter | ||
- name: Validate output wgsl | ||
run: | | ||
set +e | ||
cd spirv-samples | ||
SUCCESS_RESULT_COUNT=0 | ||
FILE_COUNT=0 | ||
rm -f counter | ||
touch counter | ||
find "./wgsl" -name '*.wgsl' | while read fname; | ||
do | ||
echo "Validate: $fname" | ||
FILE_COUNT=$((FILE_COUNT+1)) | ||
../target/release/naga --validate 27 $(realpath ${fname}) | ||
if [[ $? -eq 0 ]]; then | ||
SUCCESS_RESULT_COUNT=$((SUCCESS_RESULT_COUNT + 1)) | ||
fi | ||
echo "Result: $(expr $FILE_COUNT - $SUCCESS_RESULT_COUNT) / $FILE_COUNT" > counter | ||
done | ||
cat counter | ||
check-snapshots-extra: | ||
name: Check snapshots (validated or not) | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install cargo-nextest | ||
uses: taiki-e/install-action@v2 | ||
with: | ||
tool: cargo-nextest | ||
|
||
- name: Test minimal (without span) | ||
run: cargo nextest run --features validate -p naga | ||
|
||
- name: Test all (without validation) | ||
run: cargo nextest run --features wgsl-in,wgsl-out,glsl-in,glsl-out,spv-in,spv-out,msl-out,hlsl-out,dot-out --workspace | ||
|
||
- name: Check snapshots (without validation) | ||
run: git diff --exit-code -- tests/out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: validation-linux | ||
on: | ||
pull_request: | ||
paths: | ||
- '.github/workflows/validation-linux.yml' | ||
- 'tests/out/spv/*.spvasm' | ||
- 'tests/out/glsl/*.glsl' | ||
- 'tests/out/dot/*.dot' | ||
- 'tests/out/wgsl/*.wgsl' | ||
- 'src/front/wgsl/*' | ||
- 'xtask/**' | ||
|
||
jobs: | ||
validate-linux: | ||
name: SPIR-V + GLSL | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install tools | ||
run: sudo apt-get install spirv-tools glslang-tools graphviz | ||
|
||
- uses: Swatinem/rust-cache@v2 | ||
with: | ||
workspaces: | | ||
xtask -> target | ||
- run: cargo xtask validate spv | ||
|
||
- run: cargo xtask validate glsl | ||
|
||
- run: cargo xtask validate dot | ||
|
||
- run: cargo xtask validate wgsl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: validation-macos | ||
on: | ||
pull_request: | ||
paths: | ||
- '.github/workflows/validation-macos.yml' | ||
- 'tests/out/msl/*.msl' | ||
- 'xtask/**' | ||
|
||
jobs: | ||
validate-macos: | ||
name: MSL | ||
runs-on: macos-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: Swatinem/rust-cache@v2 | ||
with: | ||
workspaces: | | ||
xtask -> target | ||
- run: cargo xtask validate msl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: validation-windows | ||
on: | ||
pull_request: | ||
paths: | ||
- '.github/workflows/validation-windows.yml' | ||
- 'tests/out/hlsl/*.hlsl' | ||
- 'tests/out/hlsl/*.ron' | ||
- 'xtask/**' | ||
- 'hlsl-snapshots/**' | ||
|
||
jobs: | ||
validate-windows-dxc: | ||
name: HLSL via DXC | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Add DirectXShaderCompiler | ||
uses: napokue/[email protected] | ||
|
||
- uses: Swatinem/rust-cache@v2 | ||
with: | ||
workspaces: | | ||
xtask -> target | ||
- run: cargo xtask validate hlsl dxc | ||
|
||
validate-windows-fxc: | ||
name: HLSL via FXC | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- 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 | ||
|
||
- uses: Swatinem/rust-cache@v2 | ||
with: | ||
workspaces: | | ||
xtask -> target | ||
- run: cargo xtask validate hlsl fxc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/target | ||
**/*.rs.bk | ||
Cargo.lock | ||
.DS_Store | ||
.fuse_hidden* | ||
.idea | ||
.vscode | ||
*.swp | ||
/*.dot | ||
/*.metal | ||
/*.metallib | ||
/*.ron | ||
/*.spv | ||
/*.vert | ||
/*.frag | ||
/*.comp | ||
/*.wgsl | ||
/*.hlsl | ||
/*.txt |
Oops, something went wrong.