mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-25 16:24:24 +00:00
Unify CI and testing
This commit is contained in:
parent
e2bcb72bf4
commit
130ddcf561
279
.github/workflows/ci.yml
vendored
279
.github/workflows/ci.yml
vendored
@ -8,173 +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
|
||||
channel: stable
|
||||
os: macos-10.15
|
||||
prepare_command:
|
||||
clippy_params:
|
||||
additional_core_features:
|
||||
additional_player_features: winit
|
||||
wrapper_features: trace
|
||||
- name: MacOS Nightly
|
||||
os: macos-10.15
|
||||
channel: nightly
|
||||
prepare_command:
|
||||
clippy_params:
|
||||
additional_core_features:
|
||||
additional_player_features:
|
||||
wrapper_features:
|
||||
- name: Ubuntu Stable
|
||||
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
|
||||
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
|
||||
# Windows
|
||||
- name: Windows x86_64
|
||||
os: windows-2019
|
||||
channel: stable
|
||||
prepare_command: rustup default stable-msvc
|
||||
clippy_params:
|
||||
additional_core_features:
|
||||
additional_player_features:
|
||||
wrapper_features:
|
||||
- name: Windows Nightly
|
||||
os: windows-2019
|
||||
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
|
||||
channel: stable
|
||||
target: x86_64-apple-darwin
|
||||
kind: compile
|
||||
|
||||
|
||||
# IOS
|
||||
- name: IOS aarch64
|
||||
os: macos-10.15
|
||||
channel: stable
|
||||
target: aarch64-apple-ios
|
||||
kind: compile
|
||||
|
||||
|
||||
# Linux
|
||||
- name: Linux x86_64
|
||||
os: ubuntu-20.04
|
||||
channel: stable
|
||||
target: x86_64-unknown-linux-gnu
|
||||
kind: test
|
||||
|
||||
- name: Linux Nightly x86_64
|
||||
os: ubuntu-20.04
|
||||
channel: nightly
|
||||
prepare_command: rustup default nightly-msvc
|
||||
clippy_params:
|
||||
additional_core_features:
|
||||
additional_player_features:
|
||||
wrapper_features:
|
||||
target: x86_64-unknown-linux-gnu
|
||||
kind: compile
|
||||
|
||||
|
||||
# Android
|
||||
- name: Android aarch64
|
||||
os: ubuntu-20.04
|
||||
channel: stable
|
||||
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
|
||||
- name: Install latest nightly
|
||||
- name: checkout repo
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: install rust
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: ${{ matrix.channel }}
|
||||
target: ${{ matrix.target }}
|
||||
override: true
|
||||
profile: minimal
|
||||
components: clippy
|
||||
|
||||
- if: matrix.clippy_params != ''
|
||||
run: rustup component add 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
|
||||
|
||||
# prepare #
|
||||
- if: matrix.prepare_command != ''
|
||||
run: ${{ matrix.prepare_command }}
|
||||
- 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
|
||||
|
||||
# regular build #
|
||||
- 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-
|
||||
|
||||
# build
|
||||
- if: matrix.additional_core_features != ''
|
||||
run: cargo check --manifest-path wgpu-core/Cargo.toml --features ${{ matrix.additional_core_features }}
|
||||
# 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
|
||||
|
||||
- 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 }},
|
||||
- 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
|
||||
|
||||
# clippy
|
||||
- if: matrix.clippy_params != ''
|
||||
run: cargo clippy ${{ matrix.clippy_params }}
|
||||
# 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
|
||||
|
||||
- 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 --test-threads=1 # GLES is currently non-multithreadable
|
||||
- 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
|
||||
|
||||
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
|
||||
- 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
|
||||
|
||||
lint:
|
||||
name: Clippy
|
||||
# - 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
bors.toml
18
bors.toml
@ -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 aarch64",
|
||||
"Linux x86_64",
|
||||
"Linux Nightly x86_64",
|
||||
"Android aarch64",
|
||||
"WebAssembly",
|
||||
"Format",
|
||||
]
|
||||
|
@ -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,
|
||||
|
@ -229,10 +229,10 @@ impl super::Adapter {
|
||||
gl.get_parameter_i32(glow::MAX_VERTEX_UNIFORM_BLOCKS)
|
||||
.min(gl.get_parameter_i32(glow::MAX_FRAGMENT_UNIFORM_BLOCKS)) as u32;
|
||||
let max_storage_buffers_per_shader_stage = if vertex_shader_storage_blocks > 0 {
|
||||
vertex_shader_storage_blocks.min(fragment_shader_storage_blocks) as u32
|
||||
vertex_shader_storage_blocks.min(fragment_shader_storage_blocks)
|
||||
} else {
|
||||
fragment_shader_storage_blocks
|
||||
};
|
||||
} as u32;
|
||||
|
||||
let max_storage_textures_per_shader_stage =
|
||||
gl.get_parameter_i32(glow::MAX_FRAGMENT_IMAGE_UNIFORMS) as u32;
|
||||
@ -253,10 +253,10 @@ impl super::Adapter {
|
||||
max_uniform_buffer_binding_size: gl.get_parameter_i32(glow::MAX_UNIFORM_BLOCK_SIZE)
|
||||
as u32,
|
||||
max_storage_buffer_binding_size: if ver >= (3, 1) {
|
||||
gl.get_parameter_i32(glow::MAX_SHADER_STORAGE_BLOCK_SIZE) as u32
|
||||
gl.get_parameter_i32(glow::MAX_SHADER_STORAGE_BLOCK_SIZE)
|
||||
} else {
|
||||
0
|
||||
},
|
||||
} as u32,
|
||||
max_vertex_buffers: gl.get_parameter_i32(glow::MAX_VERTEX_ATTRIB_BINDINGS) as u32,
|
||||
max_vertex_attributes: (gl.get_parameter_i32(glow::MAX_VERTEX_ATTRIBS) as u32)
|
||||
.min(super::MAX_VERTEX_ATTRIBUTES as u32),
|
||||
@ -280,7 +280,7 @@ impl super::Adapter {
|
||||
ver >= (3, 1),
|
||||
);
|
||||
|
||||
let downlevel_limits = wgt::DownlevelLimits {};
|
||||
let downlevel_defaults = wgt::DownlevelLimits {};
|
||||
|
||||
Some(crate::ExposedAdapter {
|
||||
adapter: super::Adapter {
|
||||
@ -296,7 +296,7 @@ impl super::Adapter {
|
||||
limits,
|
||||
downlevel: wgt::DownlevelCapabilities {
|
||||
flags: downlevel_flags,
|
||||
limits: downlevel_limits,
|
||||
limits: downlevel_defaults,
|
||||
shader_model: wgt::ShaderModel::Sm5,
|
||||
},
|
||||
alignments: crate::Alignments {
|
||||
|
@ -460,7 +460,9 @@ impl crate::Instance<super::Api> for Instance {
|
||||
) -> Result<Surface, crate::InstanceError> {
|
||||
use raw_window_handle::RawWindowHandle as Rwh;
|
||||
|
||||
#[cfg_attr(target_os = "android", allow(unused_mut))]
|
||||
let mut inner = self.inner.lock();
|
||||
#[cfg_attr(target_os = "android", allow(unused_mut))]
|
||||
let mut wl_window = None;
|
||||
#[cfg(not(any(target_os = "android", target_os = "macos")))]
|
||||
let (mut temp_xlib_handle, mut temp_xcb_handle);
|
||||
|
@ -12,6 +12,7 @@ use objc::{
|
||||
};
|
||||
use parking_lot::Mutex;
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
#[link(name = "QuartzCore", kind = "framework")]
|
||||
extern "C" {
|
||||
#[allow(non_upper_case_globals)]
|
||||
|
@ -498,7 +498,7 @@ impl Features {
|
||||
/// Represents the sets of limits an adapter/device supports.
|
||||
///
|
||||
/// We provide two different defaults.
|
||||
/// - [`Limits::downlevel_limits()]. This is a set of limits that is guarenteed to
|
||||
/// - [`Limits::downlevel_defaults()]. This is a set of limits that is guarenteed to
|
||||
/// work on all backends, including "downlevel" backends such
|
||||
/// as OpenGL and D3D11. For most applications we recommend using these
|
||||
/// limits, assuming they are high enough for your application.
|
||||
@ -609,7 +609,7 @@ impl Default for Limits {
|
||||
|
||||
impl Limits {
|
||||
/// These default limits are guarenteed to be compatible with GLES3, WebGL, and D3D11
|
||||
pub fn downlevel_limits() -> Self {
|
||||
pub fn downlevel_defaults() -> Self {
|
||||
Self {
|
||||
max_texture_dimension_1d: 2096,
|
||||
max_texture_dimension_2d: 2096,
|
||||
@ -702,10 +702,15 @@ bitflags::bitflags! {
|
||||
const COMPARISON_SAMPLERS = 0x0000_0100;
|
||||
/// Supports different blending modes per color target.
|
||||
const INDEPENDENT_BLENDING = 0x0000_0200;
|
||||
/// Supports samplers with anisotropic filtering.
|
||||
const ANISOTROPIC_FILTERING = 0x0000_0400;
|
||||
/// Supports attaching storage buffers to vertex shaders.
|
||||
const VERTEX_ACCESSABLE_STORAGE_BUFFERS = 0x0000_0800;
|
||||
const VERTEX_ACCESSABLE_STORAGE_BUFFERS = 0x0000_0400;
|
||||
|
||||
|
||||
/// Supports samplers with anisotropic filtering. Note this isn't actually required by WebGPU,
|
||||
/// the implementation is allowed to completely ignore aniso clamp. This flag is here for native backends
|
||||
/// so they can comunicate to the user of aniso is enabled.
|
||||
const ANISOTROPIC_FILTERING = 0x8000_0000;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ async fn create_red_image_with_dimensions(
|
||||
&wgpu::DeviceDescriptor {
|
||||
label: None,
|
||||
features: wgpu::Features::empty(),
|
||||
limits: wgpu::Limits::downlevel_limits(),
|
||||
limits: wgpu::Limits::downlevel_defaults(),
|
||||
},
|
||||
None,
|
||||
)
|
||||
|
@ -41,7 +41,7 @@ pub trait Example: 'static + Sized {
|
||||
wgpu::Features::empty()
|
||||
}
|
||||
fn required_limits() -> wgpu::Limits {
|
||||
wgpu::Limits::downlevel_limits() // These downlevel limits will allow the code to run on all possible hardware
|
||||
wgpu::Limits::downlevel_defaults() // These downlevel limits will allow the code to run on all possible hardware
|
||||
}
|
||||
fn init(
|
||||
sc_desc: &wgpu::SwapChainDescriptor,
|
||||
|
@ -47,7 +47,7 @@ async fn execute_gpu(numbers: &[u32]) -> Option<Vec<u32>> {
|
||||
&wgpu::DeviceDescriptor {
|
||||
label: None,
|
||||
features: wgpu::Features::empty(),
|
||||
limits: wgpu::Limits::downlevel_limits(),
|
||||
limits: wgpu::Limits::downlevel_defaults(),
|
||||
},
|
||||
None,
|
||||
)
|
||||
|
@ -24,7 +24,7 @@ async fn run(event_loop: EventLoop<()>, window: Window) {
|
||||
&wgpu::DeviceDescriptor {
|
||||
label: None,
|
||||
features: wgpu::Features::empty(),
|
||||
limits: wgpu::Limits::downlevel_limits(),
|
||||
limits: wgpu::Limits::downlevel_defaults(),
|
||||
},
|
||||
None,
|
||||
)
|
||||
|
@ -85,7 +85,7 @@ async fn run(event_loop: EventLoop<()>, viewports: Vec<(Window, wgpu::Color)>) {
|
||||
&wgpu::DeviceDescriptor {
|
||||
label: None,
|
||||
features: wgpu::Features::empty(),
|
||||
limits: wgpu::Limits::downlevel_limits(),
|
||||
limits: wgpu::Limits::downlevel_defaults(),
|
||||
},
|
||||
None,
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user