Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration of Naga into Repo #4296

Merged
merged 8 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ allow = [
"ISC",
"MIT",
"MIT-0",
"MPL-2.0",
"Unicode-DFS-2016",
"Zlib",
]
Expand Down
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@

/cts_runner/ @gfx-rs/deno @gfx-rs/wgpu
/deno_webgpu/ @gfx-rs/deno @gfx-rs/wgpu
/naga/ @gfx-rs/naga
49 changes: 49 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,52 @@ jobs:
# check wgpu-core with all features. This will also get wgpu-hal and wgpu-types.
cargo check --target ${{ matrix.target }} --all-features -p wgpu-core

naga-minimal-versions:
name: MSRV naga Minimal Versions
runs-on: ubuntu-22.04

steps:
- name: checkout repo
uses: actions/checkout@v4

- name: Install Core MSRV toolchain
run: |
rustup toolchain install ${{ env.CORE_MSRV }} --no-self-update --profile=minimal --component clippy
rustup override set ${{ env.CORE_MSRV }}
cargo -V

- name: Install Nightly toolchain
run: |
rustup toolchain install nightly --no-self-update --profile=minimal --component clippy
cargo +nightly -V

- name: Install cargo-hack
uses: taiki-e/install-action@v2
with:
tool: cargo-hack

- name: disable debug
shell: bash
run: |
mkdir -p .cargo
echo """
[profile.dev]
debug = false" >> .cargo/config.toml

- name: Set Minimal Versions
shell: bash
run: |
set -e

cargo +nightly hack generate-lockfile --remove-dev-deps -Z minimal-versions -p naga -p naga-cli

- name: Clippy
shell: bash
run: |
set -e

cargo clippy --all-features -p naga -p naga-cli

wasm-test:
name: Test WebAssembly
runs-on: ubuntu-latest
Expand Down Expand Up @@ -378,6 +424,9 @@ jobs:

cargo xtask test --llvm-cov

- name: check naga snapshots
run: git diff --exit-code -- naga/tests/out

- uses: actions/upload-artifact@v3
if: always() # We want artifacts even if the tests fail.
with:
Expand Down
96 changes: 0 additions & 96 deletions .github/workflows/cts.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Documentation
name: Docs

on:
push:
Expand Down
83 changes: 38 additions & 45 deletions naga/.github/workflows/lazy.yml → .github/workflows/lazy.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Lazy jobs running on master post merges.
name: lazy
# Lazy jobs running on trunk post merges.
name: Lazy
on:
push:
branches: [master]
pull_request:
paths:
- '.github/workflows/lazy.yml'
push:
branches: [trunk]

env:
CARGO_INCREMENTAL: false
Expand All @@ -14,41 +14,50 @@ env:

jobs:
parse-dota2:
name: Parse Dota2 shaders
name: "Validate Shaders: Dota2"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- run: mkdir data
- run: mkdir naga/data

- name: Download shaders
run: curl https://user.fm/files/v2-5573e18b9f03f42c6ae53c392083da35/dota2-shaders.zip -o data/all.zip
run: curl https://user.fm/files/v2-5573e18b9f03f42c6ae53c392083da35/dota2-shaders.zip -o naga/data/all.zip

- name: Unpack shaders
run: cd data && unzip all.zip
run: |
cd naga/data
unzip all.zip

- name: Build Naga
run: cargo build --release --bin naga
run: |
cd naga
cargo build --release -p naga-cli

- name: Convert shaders
run: for file in data/*.spv ; do echo "Translating" ${file} && target/release/naga --validate 27 ${file} ${file}.metal; done
run: |
cd naga
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
name: "Validate Shaders: Sascha Willems Vulkan Tutorial"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Download shaders
run: git clone https://github.com/SaschaWillems/Vulkan.git
run: cd naga && git clone https://github.com/SaschaWillems/Vulkan.git

- name: Build Naga
run: cargo build --release --bin naga
run: |
cd naga
cargo build --release -p naga-cli

- name: Convert metal shaders
run: |
# No needed to stop workflow if we can't validate one file
set +e
cd naga
touch counter
SUCCESS_RESULT_COUNT=0
FILE_COUNT=0
Expand All @@ -57,7 +66,7 @@ jobs:
do
echo "Convert: $fname"
FILE_COUNT=$((FILE_COUNT+1))
target/release/naga --validate 27 $(realpath ${fname}) out/$(basename ${fname}).metal
../target/release/naga --validate 27 $(realpath ${fname}) out/$(basename ${fname}).metal
if [[ $? -eq 0 ]]; then
SUCCESS_RESULT_COUNT=$((SUCCESS_RESULT_COUNT + 1))
fi
Expand All @@ -66,26 +75,30 @@ jobs:
cat counter

dneto0_spirv-samples:
name: Parse dneto0 spirv-samples
name: "Validate Shaders: 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
run: |
cd naga
git clone https://github.com/dneto0/spirv-samples.git

- name: Build Naga
run: cargo build --release --bin naga
run: |
cargo build --release -p naga-cli

- 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
cd naga
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
cd naga/spirv-samples
mkdir -p spv

find "./spvasm" -name '*.spvasm' | while read fname;
Expand All @@ -97,7 +110,7 @@ jobs:
- name: Validate spv and generate wgsl
run: |
set +e
cd spirv-samples
cd naga/spirv-samples
SUCCESS_RESULT_COUNT=0
FILE_COUNT=0
mkdir -p spv
Expand All @@ -111,7 +124,7 @@ jobs:
do
echo "Convert: $fname"
FILE_COUNT=$((FILE_COUNT+1))
../target/release/naga --validate 27 $(realpath ${fname}) ./wgsl/$(basename ${fname}).wgsl
../../target/release/naga --validate 27 $(realpath ${fname}) ./wgsl/$(basename ${fname}).wgsl
if [[ $? -eq 0 ]]; then
SUCCESS_RESULT_COUNT=$((SUCCESS_RESULT_COUNT + 1))
fi
Expand All @@ -122,7 +135,7 @@ jobs:
- name: Validate output wgsl
run: |
set +e
cd spirv-samples
cd naga/spirv-samples
SUCCESS_RESULT_COUNT=0
FILE_COUNT=0

Expand All @@ -133,30 +146,10 @@ jobs:
do
echo "Validate: $fname"
FILE_COUNT=$((FILE_COUNT+1))
../target/release/naga --validate 27 $(realpath ${fname})
../../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
5 changes: 2 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ name: Publish

on:
push:
branches: ["*"]
pull_request:
merge_group:
branches:
- trunk

env:
CARGO_INCREMENTAL: false
Expand Down
Loading
Loading