diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /third_party/rust/naga/.github | |
parent | Initial commit. (diff) | |
download | firefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip |
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/rust/naga/.github')
5 files changed, 343 insertions, 0 deletions
diff --git a/third_party/rust/naga/.github/workflows/lazy.yml b/third_party/rust/naga/.github/workflows/lazy.yml new file mode 100644 index 0000000000..9423e22cb5 --- /dev/null +++ b/third_party/rust/naga/.github/workflows/lazy.yml @@ -0,0 +1,176 @@ +# Lazy jobs running on master post merges. +name: lazy +on: + push: + branches: [master] + +jobs: + coverage: + name: Coverage + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + - name: Generate report + uses: actions-rs/tarpaulin@v0.1 + with: + args: '--tests --all-features --workspace' + - name: Upload to codecov.io + uses: codecov/codecov-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + - name: Archive code coverage results + uses: actions/upload-artifact@v1 + with: + name: code-coverage-report + path: cobertura.xml + + parse-dota2: + name: Parse Dota2 shaders + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + - 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@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + - 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@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + - 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@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + - uses: actions-rs/cargo@v1 + name: Test minimal (without span) + with: + command: test + args: --features validate -p naga + - uses: actions-rs/cargo@v1 + name: Test all (without validation) + with: + command: test + args: --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 diff --git a/third_party/rust/naga/.github/workflows/pipeline.yml b/third_party/rust/naga/.github/workflows/pipeline.yml new file mode 100644 index 0000000000..46c427ee0f --- /dev/null +++ b/third_party/rust/naga/.github/workflows/pipeline.yml @@ -0,0 +1,100 @@ +# Regular testing. +name: pipeline +on: [push, pull_request] + +jobs: + test-msrv: + name: Test MSRV and dependencies minimal-versions + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: "1.56.0" + override: true + - uses: taiki-e/install-action@cargo-hack + - uses: taiki-e/install-action@cargo-minimal-versions + # nightly is only used by cargo-minimal-versions to regenerate the lock file + - run: rustup toolchain add nightly --no-self-update + - name: Test all features + run: cargo minimal-versions test --all-features --workspace + - name: Check snapshots + run: git diff --exit-code -- tests/out + test: + name: Test Nightly + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly + override: true + - uses: actions-rs/cargo@v1 + name: Default test + with: + # 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. + command: test + args: --package naga + - uses: actions-rs/cargo@v1 + name: Test all features + with: + command: test + args: --all-features --workspace + - name: Check snapshots + run: git diff --exit-code -- tests/out + - uses: actions-rs/cargo@v1 + name: Check benchmarks + with: + command: check + args: --benches + clippy: + name: Clippy + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + - run: rustup component add clippy + - uses: actions-rs/cargo@v1 + with: + command: clippy + args: --all-features --workspace -- -D warnings + documentation: + name: Documentation + runs-on: ubuntu-latest + env: + RUSTDOCFLAGS: -Dwarnings + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + - uses: actions-rs/cargo@v1 + with: + command: doc + args: -p naga --all-features --document-private-items + fmt: + name: Format + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + components: rustfmt + - name: run rustfmt + run: | + cargo fmt -- --check diff --git a/third_party/rust/naga/.github/workflows/validation-linux.yml b/third_party/rust/naga/.github/workflows/validation-linux.yml new file mode 100644 index 0000000000..1ac1a4759c --- /dev/null +++ b/third_party/rust/naga/.github/workflows/validation-linux.yml @@ -0,0 +1,22 @@ +name: validation-linux +on: + pull_request: + paths: + - 'tests/out/spv/*.spvasm' + - 'tests/out/glsl/*.glsl' + - 'tests/out/dot/*.dot' + - 'tests/out/wgsl/*.wgsl' + - 'src/front/wgsl/*' + +jobs: + validate-linux: + name: SPIR-V + GLSL + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + - name: Install tools + run: sudo apt-get install spirv-tools glslang-tools graphviz + - run: make validate-spv + - run: make validate-glsl + - run: make validate-dot + - run: make validate-wgsl diff --git a/third_party/rust/naga/.github/workflows/validation-macos.yml b/third_party/rust/naga/.github/workflows/validation-macos.yml new file mode 100644 index 0000000000..300d77803e --- /dev/null +++ b/third_party/rust/naga/.github/workflows/validation-macos.yml @@ -0,0 +1,13 @@ +name: validation-macos +on: + pull_request: + paths: + - 'tests/out/msl/*.msl' + +jobs: + validate-macos: + name: MSL + runs-on: macos-latest + steps: + - uses: actions/checkout@v2 + - run: make validate-msl diff --git a/third_party/rust/naga/.github/workflows/validation-windows.yml b/third_party/rust/naga/.github/workflows/validation-windows.yml new file mode 100644 index 0000000000..31f7ee3686 --- /dev/null +++ b/third_party/rust/naga/.github/workflows/validation-windows.yml @@ -0,0 +1,32 @@ +name: validation-windows +on: + pull_request: + paths: + - 'tests/out/hlsl/*.hlsl' + +jobs: + 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-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 |