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

Test --all-features #3488

Closed
Closed
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
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,13 @@ jobs:
set -e

# build for Emscripten/WebGL
cargo clippy --target ${{ matrix.target }} -p wgpu -p wgpu-hal --no-default-features --features webgl,emscripten
cargo clippy --target ${{ matrix.target }} -p wgpu -p wgpu-hal --no-default-features

# build cube example
cargo clippy --target ${{ matrix.target }} --example cube --features webgl,emscripten
cargo clippy --target ${{ matrix.target }} --example cube

# build raw-gles example
cargo clippy --target ${{ matrix.target }} --example raw-gles --features webgl,emscripten
cargo clippy --target ${{ matrix.target }} --example raw-gles

- name: check native
if: matrix.kind == 'native'
Expand All @@ -160,13 +160,13 @@ jobs:
# (But watch out for backend-selection features in wgpu-core; some of
# those only build on the right platforms.)
cargo clippy --target ${{ matrix.target }} -p wgpu -p wgpu-info -p player --tests --all-features
cargo clippy --target ${{ matrix.target }} -p wgpu-core --tests --features="portable_features"
cargo clippy --target ${{ matrix.target }} -p wgpu-core --tests --all-features

# build docs
# (Watch out for backend-selection features in wgpu-core; some of
# those only build on the right platforms.)
cargo doc --target ${{ matrix.target }} -p wgpu -p wgpu-info -p player --all-features --no-deps
cargo doc --target ${{ matrix.target }} -p wgpu-core --no-deps --features="portable_features"
cargo doc --target ${{ matrix.target }} -p wgpu-core --no-deps --all-features

wasm-test:
name: Test WebAssembly
Expand Down
2 changes: 1 addition & 1 deletion deno_webgpu/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ workspace = true
features = ["dx11", "dx12"]

# We want the wgpu-core Vulkan backend on Unix (but not Emscripten) and Windows.
[target.'cfg(any(windows, all(unix, not(target_arch = "emscripten"))))'.dependencies.wgpu-core]
[target.'cfg(any(windows, all(unix, not(target_os = "emscripten"))))'.dependencies.wgpu-core]
workspace = true
features = ["vulkan"]
2 changes: 1 addition & 1 deletion player/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ features = ["metal"]
workspace = true
features = ["dx11", "dx12"]

[target.'cfg(any(windows, all(unix, not(target_arch = "emscripten"), not(target_os = "ios"), not(target_os = "macos"))))'.dependencies.wgc]
[target.'cfg(any(windows, all(unix, not(target_os = "emscripten"), not(target_os = "ios"), not(target_os = "macos"))))'.dependencies.wgc]
workspace = true
features = ["vulkan"]

Expand Down
6 changes: 0 additions & 6 deletions wgpu-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ dx12 = ["hal/dx12"]
# https://renderdoc.org/
renderdoc = ["hal/renderdoc"]

# Compile for the Emscripten POSIX-in-a-web-page emulation environment.
emscripten = ["hal/emscripten"]

# Apply run-time checks, even in release builds. These are in addition
# to the validation carried out at public APIs in all builds.
strict_asserts = ["wgt/strict_asserts"]
Expand All @@ -52,9 +49,6 @@ id32 = []
# Enable `ShaderModuleSource::Wgsl`
wgsl = ["naga/wgsl-in"]

# Features that are intended to work on all platforms.
portable_features = ["gles", "strict_asserts", "trace", "replay", "serial-pass", "id32", "wgsl"]

[dependencies]
arrayvec = "0.7"
bitflags = "1"
Expand Down
2 changes: 1 addition & 1 deletion wgpu-core/src/conv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub fn is_valid_copy_dst_texture_format(
}

#[cfg_attr(
any(not(target_arch = "wasm32"), feature = "emscripten"),
any(not(target_arch = "wasm32"), target_os = "emscripten"),
allow(unused)
)]
pub fn is_valid_external_image_copy_dst_texture_format(format: wgt::TextureFormat) -> bool {
Expand Down
8 changes: 4 additions & 4 deletions wgpu-core/src/device/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5530,22 +5530,22 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
let mut closures = UserClosures::default();
let mut all_queue_empty = true;

#[cfg(feature = "vulkan")]
#[cfg(all(feature = "vulkan", not(target_arch = "wasm32")))]
{
all_queue_empty = self.poll_devices::<hal::api::Vulkan>(force_wait, &mut closures)?
&& all_queue_empty;
}
#[cfg(feature = "metal")]
#[cfg(all(feature = "metal", any(target_os = "macos", target_os = "ios")))]
{
all_queue_empty =
self.poll_devices::<hal::api::Metal>(force_wait, &mut closures)? && all_queue_empty;
}
#[cfg(feature = "dx12")]
#[cfg(all(feature = "dx12", windows))]
{
all_queue_empty =
self.poll_devices::<hal::api::Dx12>(force_wait, &mut closures)? && all_queue_empty;
}
#[cfg(feature = "dx11")]
#[cfg(all(feature = "dx11", windows))]
{
all_queue_empty =
self.poll_devices::<hal::api::Dx11>(force_wait, &mut closures)? && all_queue_empty;
Expand Down
2 changes: 1 addition & 1 deletion wgpu-core/src/device/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
Ok(())
}

#[cfg(all(target_arch = "wasm32", not(feature = "emscripten")))]
#[cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))]
pub fn queue_copy_external_image_to_texture<A: HalApi>(
&self,
queue_id: id::QueueId,
Expand Down
48 changes: 24 additions & 24 deletions wgpu-core/src/hub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1057,13 +1057,13 @@ impl<A: HalApi, F: GlobalIdentityHandlerFactory> Hub<A, F> {
}

pub struct Hubs<F: GlobalIdentityHandlerFactory> {
#[cfg(feature = "vulkan")]
#[cfg(all(feature = "vulkan", not(target_arch = "wasm32")))]
vulkan: Hub<hal::api::Vulkan, F>,
#[cfg(feature = "metal")]
#[cfg(all(feature = "metal", any(target_os = "macos", target_os = "ios")))]
metal: Hub<hal::api::Metal, F>,
#[cfg(feature = "dx12")]
#[cfg(all(feature = "dx12", windows))]
dx12: Hub<hal::api::Dx12, F>,
#[cfg(feature = "dx11")]
#[cfg(all(feature = "dx11", windows))]
dx11: Hub<hal::api::Dx11, F>,
#[cfg(feature = "gles")]
gl: Hub<hal::api::Gles, F>,
Expand All @@ -1072,13 +1072,13 @@ pub struct Hubs<F: GlobalIdentityHandlerFactory> {
impl<F: GlobalIdentityHandlerFactory> Hubs<F> {
fn new(factory: &F) -> Self {
Self {
#[cfg(feature = "vulkan")]
#[cfg(all(feature = "vulkan", not(target_arch = "wasm32")))]
vulkan: Hub::new(factory),
#[cfg(feature = "metal")]
#[cfg(all(feature = "metal", any(target_os = "macos", target_os = "ios")))]
metal: Hub::new(factory),
#[cfg(feature = "dx12")]
#[cfg(all(feature = "dx12", windows))]
dx12: Hub::new(factory),
#[cfg(feature = "dx11")]
#[cfg(all(feature = "dx11", windows))]
dx11: Hub::new(factory),
#[cfg(feature = "gles")]
gl: Hub::new(factory),
Expand All @@ -1089,13 +1089,13 @@ impl<F: GlobalIdentityHandlerFactory> Hubs<F> {
#[derive(Debug)]
pub struct GlobalReport {
pub surfaces: StorageReport,
#[cfg(feature = "vulkan")]
#[cfg(all(feature = "vulkan", not(target_arch = "wasm32")))]
pub vulkan: Option<HubReport>,
#[cfg(feature = "metal")]
#[cfg(all(feature = "metal", any(target_os = "macos", target_os = "ios")))]
pub metal: Option<HubReport>,
#[cfg(feature = "dx12")]
#[cfg(all(feature = "dx12", windows))]
pub dx12: Option<HubReport>,
#[cfg(feature = "dx11")]
#[cfg(all(feature = "dx11", windows))]
pub dx11: Option<HubReport>,
#[cfg(feature = "gles")]
pub gl: Option<HubReport>,
Expand Down Expand Up @@ -1162,25 +1162,25 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
pub fn generate_report(&self) -> GlobalReport {
GlobalReport {
surfaces: self.surfaces.data.read().generate_report(),
#[cfg(feature = "vulkan")]
#[cfg(all(feature = "vulkan", not(target_arch = "wasm32")))]
vulkan: if self.instance.vulkan.is_some() {
Some(self.hubs.vulkan.generate_report())
} else {
None
},
#[cfg(feature = "metal")]
#[cfg(all(feature = "metal", any(target_os = "macos", target_os = "ios")))]
metal: if self.instance.metal.is_some() {
Some(self.hubs.metal.generate_report())
} else {
None
},
#[cfg(feature = "dx12")]
#[cfg(all(feature = "dx12", windows))]
dx12: if self.instance.dx12.is_some() {
Some(self.hubs.dx12.generate_report())
} else {
None
},
#[cfg(feature = "dx11")]
#[cfg(all(feature = "dx11", windows))]
dx11: if self.instance.dx11.is_some() {
Some(self.hubs.dx11.generate_report())
} else {
Expand All @@ -1203,19 +1203,19 @@ impl<G: GlobalIdentityHandlerFactory> Drop for Global<G> {
let mut surface_guard = self.surfaces.data.write();

// destroy hubs before the instance gets dropped
#[cfg(feature = "vulkan")]
#[cfg(all(feature = "vulkan", not(target_arch = "wasm32")))]
{
self.hubs.vulkan.clear(&mut surface_guard, true);
}
#[cfg(feature = "metal")]
#[cfg(all(feature = "metal", any(target_os = "macos", target_os = "ios")))]
{
self.hubs.metal.clear(&mut surface_guard, true);
}
#[cfg(feature = "dx12")]
#[cfg(all(feature = "dx12", windows))]
{
self.hubs.dx12.clear(&mut surface_guard, true);
}
#[cfg(feature = "dx11")]
#[cfg(all(feature = "dx11", windows))]
{
self.hubs.dx11.clear(&mut surface_guard, true);
}
Expand Down Expand Up @@ -1261,7 +1261,7 @@ impl HalApi for hal::api::Empty {
}
}

#[cfg(feature = "vulkan")]
#[cfg(all(feature = "vulkan", not(target_arch = "wasm32")))]
impl HalApi for hal::api::Vulkan {
const VARIANT: Backend = Backend::Vulkan;
fn create_instance_from_hal(name: &str, hal_instance: Self::Instance) -> Instance {
Expand All @@ -1285,7 +1285,7 @@ impl HalApi for hal::api::Vulkan {
}
}

#[cfg(feature = "metal")]
#[cfg(all(feature = "metal", any(target_os = "macos", target_os = "ios")))]
impl HalApi for hal::api::Metal {
const VARIANT: Backend = Backend::Metal;
fn create_instance_from_hal(name: &str, hal_instance: Self::Instance) -> Instance {
Expand All @@ -1309,7 +1309,7 @@ impl HalApi for hal::api::Metal {
}
}

#[cfg(feature = "dx12")]
#[cfg(all(feature = "dx12", windows))]
impl HalApi for hal::api::Dx12 {
const VARIANT: Backend = Backend::Dx12;
fn create_instance_from_hal(name: &str, hal_instance: Self::Instance) -> Instance {
Expand All @@ -1333,7 +1333,7 @@ impl HalApi for hal::api::Dx12 {
}
}

#[cfg(feature = "dx11")]
#[cfg(all(feature = "dx11", windows))]
impl HalApi for hal::api::Dx11 {
const VARIANT: Backend = Backend::Dx11;
fn create_instance_from_hal(name: &str, hal_instance: Self::Instance) -> Instance {
Expand Down
Loading