mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-29 17:44:09 +01:00
Integration of Naga into Repo (#4296)
This commit is contained in:
1 parent
4445e55e1a
commit
34e947de4b
33 files changed
+554
-525
No files matched your search
@@ -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
|
||||
@@ -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:
|
||||
|
||||
@@ -1,96 +0,0 @@
|
||||
name: CTS
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master, staging]
|
||||
tags: [v0.*]
|
||||
pull_request:
|
||||
types: [labeled, opened, synchronize]
|
||||
|
||||
env:
|
||||
CARGO_INCREMENTAL: false
|
||||
CARGO_TERM_COLOR: always
|
||||
RUST_BACKTRACE: full
|
||||
MSRV: "1.70"
|
||||
|
||||
jobs:
|
||||
cts:
|
||||
# Only run if we add this label
|
||||
if: contains(github.event.pull_request.labels.*.name, 'needs testing')
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
# Windows
|
||||
- name: Windows x86_64
|
||||
os: windows-2019
|
||||
target: x86_64-pc-windows-msvc
|
||||
backends: dx12 # dx11
|
||||
|
||||
# Linux
|
||||
#- name: Linux x86_64
|
||||
# os: ubuntu-20.04
|
||||
# target: x86_64-unknown-linux-gnu
|
||||
# backends: vulkan # gl
|
||||
|
||||
name: CTS ${{ matrix.name }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- name: checkout repo
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
path: wgpu
|
||||
|
||||
- name: checkout cts
|
||||
run: |
|
||||
git clone https://github.com/gpuweb/cts.git
|
||||
cd cts
|
||||
git checkout $(cat ../wgpu/cts_runner/revision.txt)
|
||||
|
||||
- name: Install Repo MSRV toolchain
|
||||
run: |
|
||||
rustup toolchain install ${{ env.MSRV }} --no-self-update --profile=minimal --target ${{ matrix.target }}
|
||||
rustup override set ${{ env.MSRV }}
|
||||
cargo -V
|
||||
|
||||
- name: caching
|
||||
uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
key: cts-a # suffix for cache busting
|
||||
working-directory: wgpu/cts_runner
|
||||
target-dir: wgpu/cts_runner/target
|
||||
|
||||
- name: install llvmpipe and lavapipe
|
||||
if: matrix.os == 'ubuntu-20.04'
|
||||
run: |
|
||||
sudo apt-get update -y -qq
|
||||
sudo add-apt-repository ppa:oibaf/graphics-drivers -y
|
||||
sudo apt-get update
|
||||
sudo apt install -y libxcb-xfixes0-dev mesa-vulkan-drivers
|
||||
# libegl1-mesa libgl1-mesa-dri for gl
|
||||
|
||||
# We enable line numbers for panics, but that's it
|
||||
- name: disable debug
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p wgpu/.cargo
|
||||
echo """[profile.dev]
|
||||
debug = 1" > wgpu/.cargo/config.toml
|
||||
|
||||
- name: build CTS runner
|
||||
run: |
|
||||
cargo build --manifest-path wgpu/cts_runner/Cargo.toml
|
||||
|
||||
- name: run CTS
|
||||
shell: bash
|
||||
run: |
|
||||
cd cts;
|
||||
for backend in ${{ matrix.backends }}; do
|
||||
echo "======= CTS TESTS $backend ======";
|
||||
grep -v '^//' ../wgpu/cts_runner/test.lst | while IFS=$' \t\r\n' read test; do
|
||||
echo "=== Running $test ===";
|
||||
DENO_WEBGPU_BACKEND=$backend cargo run --manifest-path ../wgpu/cts_runner/Cargo.toml --frozen -- ./tools/run_deno --verbose "$test";
|
||||
done
|
||||
done
|
||||
@@ -1,4 +1,4 @@
|
||||
name: Documentation
|
||||
name: Docs
|
||||
|
||||
on:
|
||||
push:
|
||||
|
||||
@@ -0,0 +1,155 @@
|
||||
# Lazy jobs running on trunk post merges.
|
||||
name: Lazy
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- '.github/workflows/lazy.yml'
|
||||
push:
|
||||
branches: [trunk]
|
||||
|
||||
env:
|
||||
CARGO_INCREMENTAL: false
|
||||
CARGO_TERM_COLOR: always
|
||||
RUST_BACKTRACE: full
|
||||
|
||||
jobs:
|
||||
parse-dota2:
|
||||
name: "Validate Shaders: Dota2"
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- run: mkdir naga/data
|
||||
|
||||
- name: Download shaders
|
||||
run: curl https://user.fm/files/v2-5573e18b9f03f42c6ae53c392083da35/dota2-shaders.zip -o naga/data/all.zip
|
||||
|
||||
- name: Unpack shaders
|
||||
run: |
|
||||
cd naga/data
|
||||
unzip all.zip
|
||||
|
||||
- name: Build Naga
|
||||
run: |
|
||||
cd naga
|
||||
cargo build --release -p naga-cli
|
||||
|
||||
- name: Convert shaders
|
||||
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: "Validate Shaders: Sascha Willems Vulkan Tutorial"
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Download shaders
|
||||
run: cd naga && git clone https://github.com/SaschaWillems/Vulkan.git
|
||||
|
||||
- name: Build 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
|
||||
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: "Validate Shaders: dneto0 spirv-samples"
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Download shaders
|
||||
run: |
|
||||
cd naga
|
||||
git clone https://github.com/dneto0/spirv-samples.git
|
||||
|
||||
- name: Build Naga
|
||||
run: |
|
||||
cargo build --release -p naga-cli
|
||||
|
||||
- name: Install spirv-tools
|
||||
run: |
|
||||
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 naga/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 naga/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 naga/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
|
||||
@@ -2,9 +2,8 @@ name: Publish
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ["*"]
|
||||
pull_request:
|
||||
merge_group:
|
||||
branches:
|
||||
- trunk
|
||||
|
||||
env:
|
||||
CARGO_INCREMENTAL: false
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
name: Shaders
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ["*"]
|
||||
tags: [v0.*]
|
||||
pull_request:
|
||||
merge_group:
|
||||
|
||||
jobs:
|
||||
naga-validate-windows:
|
||||
name: "Validate: HLSL"
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup DXC
|
||||
uses: napokue/setup-dxc@v1.1.0
|
||||
|
||||
- name: Setup FXC
|
||||
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: |
|
||||
naga/xtask -> naga/xtask/target
|
||||
|
||||
- run: |
|
||||
cd naga
|
||||
cargo xtask validate hlsl dxc
|
||||
cargo xtask validate hlsl fxc
|
||||
|
||||
naga-validate-macos:
|
||||
name: "Validate: MSL"
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
workspaces: |
|
||||
naga/xtask -> naga/xtask/target
|
||||
|
||||
- run: |
|
||||
cd naga
|
||||
cargo xtask validate msl
|
||||
|
||||
naga-validate-linux:
|
||||
name: "Validate: SPIR-V/GLSL/DOT/WGSL"
|
||||
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: |
|
||||
naga/xtask -> naga/xtask/target
|
||||
|
||||
- run: cd naga; cargo xtask validate spv
|
||||
|
||||
- run: cd naga; cargo xtask validate glsl
|
||||
|
||||
- run: cd naga; cargo xtask validate dot
|
||||
|
||||
- run: cd naga; cargo xtask validate wgsl
|
||||
|
||||
Reference in new issue
Block a user