Skip to content

Commit

Permalink
Merge #1599
Browse files Browse the repository at this point in the history
1599: Fix Limits for lava/llvmpipe and re-enable and re-work CI r=kvark,groves,wumpf a=cwfitzgerald

**Connections**

No longer fixes #1551.

**Description**

This PR has a couple things going on at once.

- Fixes limits for llvmpipe, lavapipe, and rpi4.
- Added a downlevel limit to express that RPI4 does not allow storage buffers in vertex shaders on GL.
- Added a `Limits::downlevel_default()` that takes minimum limits from GLES and adds some more documentation on how to choose limits.
- Moved all examples to the new downlevel limits
- Reworks CI to re-enable software testing and unify instructions.

**Testing**

It is

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
  • Loading branch information
bors[bot] and cwfitzgerald authored Jul 4, 2021
2 parents b5a73b6 + ab41b5f commit 63ce774
Show file tree
Hide file tree
Showing 23 changed files with 345 additions and 252 deletions.
284 changes: 144 additions & 140 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,166 +8,170 @@ on:
branches-ignore: [staging.tmp]

jobs:
ios_build:
name: iOS Stable
runs-on: macos-10.15
env:
TARGET: aarch64-apple-ios
steps:
- uses: actions/checkout@v2
- run: rustup component add clippy
- run: rustup target add ${{ env.TARGET }}
- run: cargo clippy --target ${{ env.TARGET }}

android_build:
name: Android Stable
runs-on: ubuntu-latest
env:
TARGET: aarch64-linux-android
PKG_CONFIG_ALLOW_CROSS: 1
steps:
- uses: actions/checkout@v2
- run: echo "$ANDROID_HOME/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin" >> $GITHUB_PATH
- run: rustup component add clippy
- run: rustup target add ${{ env.TARGET }}
- run: cargo clippy --target ${{ env.TARGET }}
- name: Additional core features
run: cargo check --manifest-path wgpu-core/Cargo.toml --features trace --target ${{ env.TARGET }}

wasm:
name: Web Assembly
runs-on: ubuntu-latest
env:
RUSTFLAGS: --cfg=web_sys_unstable_apis
steps:
- uses: actions/checkout@v2
- run: rustup target add wasm32-unknown-unknown
- name: Check WebGPU
run: cargo check --package wgpu --examples --target=wasm32-unknown-unknown
# disable until hal/Gles backend is setup
# - name: Check WebGL
# run: cargo check --all-targets --target=wasm32-unknown-unknown --features webgl

build:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-10.15, ubuntu-20.04, windows-2019]
channel: [stable, nightly]
include:
- name: MacOS Stable
# Windows
- name: Windows x86_64
os: windows-2019
channel: stable
target: x86_64-pc-windows-msvc
kind: compile

# MacOS

# Mac has no software runners, so don't run tests
- name: MacOS x86_64
os: macos-10.15
prepare_command:
clippy_params:
additional_core_features:
additional_player_features: winit
wrapper_features: trace
- name: MacOS Nightly
channel: stable
target: x86_64-apple-darwin
kind: compile


# IOS
- name: IOS Nightly x86_64
os: macos-10.15
channel: nightly
prepare_command:
clippy_params:
additional_core_features:
additional_player_features:
wrapper_features:
- name: Ubuntu Stable
channel: stable
target: aarch64-apple-ios
kind: compile


# Linux
- name: Linux x86_64
os: ubuntu-20.04
channel: stable
prepare_command:
clippy_params: --examples --all
additional_core_features: trace,serial-pass
additional_player_features: winit
wrapper_features: spirv,replay
- name: Ubuntu Nightly
target: x86_64-unknown-linux-gnu
kind: test

- name: Linux Nightly x86_64
os: ubuntu-20.04
channel: nightly
prepare_command: |
echo "Installing Vulkan"
sudo apt-get update -y -qq
sudo add-apt-repository ppa:ubuntu-x-swat/updates -y
sudo apt-get update
sudo apt install -y libxcb-xfixes0-dev mesa-vulkan-drivers
clippy_params:
additional_core_features: serial-pass
additional_player_features:
wrapper_features:
- name: Windows Stable
os: windows-2019
target: x86_64-unknown-linux-gnu
kind: compile


# Android
- name: Android aarch64
os: ubuntu-20.04
channel: stable
prepare_command: rustup default stable-msvc
clippy_params:
additional_core_features:
additional_player_features:
wrapper_features:
- name: Windows Nightly
os: windows-2019
channel: nightly
prepare_command: rustup default nightly-msvc
clippy_params:
additional_core_features:
additional_player_features:
wrapper_features:
target: aarch64-linux-android
kind: compile


# WebGPU/WebGL
- name: WebAssembly
os: ubuntu-20.04
channel: stable
target: wasm32-unknown-unknown
kind: webgl

name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}

env:
PKG_CONFIG_ALLOW_CROSS: 1 # allow android to work
RUSTFLAGS: --cfg=web_sys_unstable_apis

steps:
- uses: actions/checkout@v2
- if: matrix.channel == 'nightly'
name: Install latest nightly
- name: checkout repo
uses: actions/checkout@v2

- name: install rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
toolchain: ${{ matrix.channel }}
target: ${{ matrix.target }}
override: true
- if: matrix.clippy_params != ''
run: rustup component add clippy
# prepare
- if: matrix.prepare_command != ''
run: ${{ matrix.prepare_command }}
# regular build
- if: matrix.additional_core_features != ''
run: cargo check --manifest-path wgpu-core/Cargo.toml --features ${{ matrix.additional_core_features }}
- if: matrix.additional_player_features != ''
run: cargo check --manifest-path player/Cargo.toml --features ${{ matrix.additional_player_features }}
- run: cargo check --manifest-path wgpu/Cargo.toml --examples --features ${{ matrix.wrapper_features }},
# clippy
- if: matrix.clippy_params != ''
run: cargo clippy ${{ matrix.clippy_params }}
- if: matrix.channel == 'nightly'
run: cargo test -p wgpu-core -- --nocapture
# - if: matrix.channel == 'nightly'
# run: cargo run --bin wgpu-info -- cargo test -p wgpu -- --nocapture


docs:
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
- name: Install latest nightly
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
continue-on-error: true
- name: cargo doc
run: cargo --version; cargo doc --no-deps
continue-on-error: true

lint:
name: Clippy
profile: minimal
components: clippy

- name: add android apk to path
if: matrix.os == 'ubuntu-20.04' && matrix.target == 'aarch64-linux-android'
run: |
echo "$ANDROID_HOME/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin" >> $GITHUB_PATH
- name: install llvmpipe and lavapipe
if: matrix.os == 'ubuntu-20.04' && matrix.kind == 'test'
run: |
echo "Installing Vulkan"
sudo apt-get update -y -qq
sudo add-apt-repository ppa:ubuntu-x-swat/updates -y
sudo apt-get update
sudo apt install -y libxcb-xfixes0-dev mesa-vulkan-drivers
- name: load cache
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ matrix.name }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ matrix.name }}-cargo-
# This is separate for now because webgl isn't hooked up so we can't compile wgpu-core for wasm
- name: check web
if: matrix.kind == 'webgl'
run: |
cargo clippy --target ${{ matrix.target }} -p wgpu -- -D warnings
- name: check native stable (fatal warnings)
if: (matrix.kind == 'compile' || matrix.kind == 'test') && matrix.channel == 'stable'
run: |
# check with no features
cargo clippy --target ${{ matrix.target }} -p wgpu -p wgpu-core -p wgpu-info -p player -- -D warnings
# check with all features
# explicitly don't mention wgpu-hal so that --all-features don't apply to it
cargo clippy --target ${{ matrix.target }} -p wgpu -p wgpu-core -p wgpu-info -p player --examples --tests --all-features -- -D warnings
- name: check native nightly (non-fatal warnings)
if: (matrix.kind == 'compile' || matrix.kind == 'test') && matrix.channel != 'stable'
run: |
# check with no features
cargo clippy --target ${{ matrix.target }} -p wgpu -p wgpu-core -p wgpu-info -p player
# check with all features
# explicitly don't mention wgpu-hal so that --all-features don't apply to it
cargo clippy --target ${{ matrix.target }} -p wgpu -p wgpu-core -p wgpu-info -p player --examples --tests --all-features
- name: build tests
if: matrix.kind == 'test'
run: |
cargo build --target ${{ matrix.target }} --bin wgpu-info
cargo build --target ${{ matrix.target }} --tests -p player
cargo build --target ${{ matrix.target }} --examples --tests -p wgpu
# - name: tests
# if: matrix.kind == 'test'
# run: |
# # run wgpu-info
# cargo run --target ${{ matrix.target }} --bin wgpu-info

# # run player tests
# cargo test --target ${{ matrix.target }} -p player -- --nocapture

# # run coretests
# cargo run --target ${{ matrix.target }} --bin wgpu-info -- cargo test --target ${{ matrix.target }} -p wgpu -- --nocapture --test-threads=1 # GLES is currently non-multithreadable

fmt:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
- name: checkout repo
uses: actions/checkout@v2

- name: install rust
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: -- -D warnings
- uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check
components: rustfmt

- name: run rustfmt
run: |
cargo fmt -- --check
18 changes: 8 additions & 10 deletions bors.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
status = [
"iOS Stable",
"MacOS Stable",
"MacOS Nightly",
"Android Stable",
"Ubuntu Stable",
"Ubuntu Nightly",
"Windows Stable",
"Windows Nightly",
"Web Assembly",
#"Clippy",
"Windows x86_64",
"MacOS x86_64",
"IOS x86_64",
"Linux x86_64",
"Linux Nightly x86_64",
"Android aarch64",
"WebAssembly",
"Format",
]
11 changes: 11 additions & 0 deletions wgpu-core/src/device/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -980,6 +980,7 @@ impl<A: HalApi> Device<A> {
use wgt::BindingType as Bt;

let mut required_features = wgt::Features::empty();
let mut required_downlevel_flags = wgt::DownlevelFlags::empty();
let (array_feature, is_writable_storage) = match entry.ty {
Bt::Buffer {
ty: wgt::BufferBindingType::Uniform,
Expand Down Expand Up @@ -1029,6 +1030,9 @@ impl<A: HalApi> Device<A> {
error,
})?;
}
if entry.visibility.contains(wgt::ShaderStages::VERTEX) {
required_downlevel_flags |= wgt::DownlevelFlags::VERTEX_ACCESSABLE_STORAGE_BUFFERS;
}
if is_writable_storage && entry.visibility.contains(wgt::ShaderStages::VERTEX) {
required_features |= wgt::Features::VERTEX_WRITABLE_STORAGE;
}
Expand All @@ -1047,6 +1051,13 @@ impl<A: HalApi> Device<A> {
binding: entry.binding,
error,
})?;

self.require_downlevel_flags(required_downlevel_flags)
.map_err(binding_model::BindGroupLayoutEntryError::MissingDownlevelFlags)
.map_err(|error| binding_model::CreateBindGroupLayoutError::Entry {
binding: entry.binding,
error,
})?;
}

let mut hal_bindings = entry_map.values().cloned().collect::<Vec<_>>();
Expand Down
9 changes: 9 additions & 0 deletions wgpu-core/src/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,15 @@ fn check_limits(requested: &wgt::Limits, allowed: &wgt::Limits) -> Vec<FailedLim
failed
}

#[test]
fn downlevel_default_limits_less_than_default_limits() {
let res = check_limits(&wgt::Limits::downlevel_defaults(), &wgt::Limits::default());
assert(
res.is_empty(),
"Downlevel limits are greater than default limits",
)
}

pub struct Instance {
#[allow(dead_code)]
name: String,
Expand Down
Loading

0 comments on commit 63ce774

Please sign in to comment.