mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-19 05:51:03 +01:00
build: Exclude wgpu-core when building the WebGPU-backend samples (#9557)
This commit is contained in:
1 parent
98a70621f2
commit
08b244df91
8 files changed
+38
-14
No files matched your search
@@ -83,7 +83,6 @@ wgpu = { version = "29.0.0", path = "./wgpu", default-features = false, features
|
||||
"vulkan-portability",
|
||||
"angle",
|
||||
"static-dxc",
|
||||
"noop", # This should be removed if we ever have non-test crates that depend on wgpu
|
||||
] }
|
||||
wgpu-core = { version = "29.0.0", path = "./wgpu-core" }
|
||||
wgpu-hal = { version = "29.0.0", path = "./wgpu-hal" }
|
||||
|
||||
@@ -24,7 +24,7 @@ fn check_feature_dependency(requirement: Requirement) {
|
||||
println!("Checking: {}", requirement.human_readable_name);
|
||||
|
||||
let mut args = Vec::new();
|
||||
args.extend(["tree", "--target", requirement.target]);
|
||||
args.extend(["tree", "--edges", "no-dev", "--target", requirement.target]);
|
||||
|
||||
for package in requirement.packages {
|
||||
args.push("--package");
|
||||
@@ -43,11 +43,15 @@ fn check_feature_dependency(requirement: Requirement) {
|
||||
|
||||
println!("$ cargo {}", args.join(" "));
|
||||
|
||||
let output = Command::new("cargo")
|
||||
.args(&args)
|
||||
.output()
|
||||
.expect("Failed to run cargo tree")
|
||||
.stdout;
|
||||
let output = match Command::new("cargo").args(&args).output() {
|
||||
Ok(o) if o.status.success() => o.stdout,
|
||||
Ok(o) => panic!(
|
||||
"cargo tree failed ({}):\n{}",
|
||||
o.status,
|
||||
String::from_utf8_lossy(&o.stderr)
|
||||
),
|
||||
Err(e) => panic!("Failed to run cargo tree: {e}"),
|
||||
};
|
||||
let output = String::from_utf8(output).expect("Output is not valid UTF-8");
|
||||
|
||||
let mut any_failed = false;
|
||||
@@ -117,6 +121,15 @@ fn wasm32_without_webgl_or_noop_does_not_depend_on_wgpu_core() {
|
||||
default_features: false,
|
||||
search_terms: &[Search::Negative("wgpu-core")],
|
||||
});
|
||||
|
||||
check_feature_dependency(Requirement {
|
||||
human_readable_name: "wasm32 with only `webgpu` feature does not depend on `wgpu-core`",
|
||||
target: "wasm32-unknown-unknown",
|
||||
packages: &["wgpu-examples"],
|
||||
features: &["webgpu"],
|
||||
default_features: false,
|
||||
search_terms: &[Search::Negative("wgpu-core")],
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -129,6 +142,15 @@ fn wasm32_with_webgpu_and_wgsl_does_not_depend_on_naga() {
|
||||
default_features: false,
|
||||
search_terms: &[Search::Negative("naga")],
|
||||
});
|
||||
|
||||
check_feature_dependency(Requirement {
|
||||
human_readable_name: "wasm32 with only `webgpu` feature does not depend on `naga`",
|
||||
target: "wasm32-unknown-unknown",
|
||||
packages: &["wgpu-examples"],
|
||||
features: &["webgpu"],
|
||||
default_features: false,
|
||||
search_terms: &[Search::Negative("naga")],
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -44,7 +44,7 @@ serde = ["dep:serde", "bitflags/serde"]
|
||||
# Enables some internal instrumentation for debugging purposes.
|
||||
counters = []
|
||||
# Enables variants of `Trace` other than `Trace::Off`
|
||||
trace = ["std"]
|
||||
trace = ["std", "serde/std"]
|
||||
# Enable web-specific dependencies for wasm.
|
||||
web = ["dep:js-sys", "dep:web-sys"]
|
||||
exhaust = ["dep:exhaust"]
|
||||
|
||||
+2
-2
@@ -130,8 +130,8 @@ strict_asserts = ["wgpu-core?/strict_asserts", "wgpu-types/strict_asserts"]
|
||||
## Enables serialization via `serde` on common wgpu types.
|
||||
serde = ["wgpu-core?/serde", "wgpu-types/serde"]
|
||||
|
||||
# ## Allow writing of trace capture files. See [`Adapter::request_device`].
|
||||
trace = ["serde", "wgpu-core?/trace"]
|
||||
## Allow writing of trace capture files. See [`Adapter::request_device`].
|
||||
trace = ["serde", "wgpu-core?/trace", "wgpu-types/trace"]
|
||||
|
||||
#! ### External libraries
|
||||
# --------------------------------------------------------------------
|
||||
|
||||
@@ -2,7 +2,7 @@ use alloc::{boxed::Box, string::String, sync::Arc, vec::Vec};
|
||||
use core::{
|
||||
error, fmt,
|
||||
num::NonZero,
|
||||
ops::{Bound, Deref, Range, RangeBounds},
|
||||
ops::{Bound, Range, RangeBounds},
|
||||
};
|
||||
|
||||
use crate::util::Mutex;
|
||||
@@ -287,7 +287,7 @@ impl Buffer {
|
||||
#[cfg(wgpu_core)]
|
||||
pub unsafe fn as_hal<A: hal::Api>(
|
||||
&self,
|
||||
) -> Option<impl Deref<Target = A::Buffer> + WasmNotSendSync> {
|
||||
) -> Option<impl core::ops::Deref<Target = A::Buffer> + WasmNotSendSync> {
|
||||
let buffer = self.inner.as_core_opt()?;
|
||||
unsafe { buffer.context.buffer_as_hal::<A>(buffer) }
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use alloc::boxed::Box;
|
||||
use core::ops::{Deref, RangeBounds};
|
||||
use core::ops::RangeBounds;
|
||||
|
||||
use crate::{api::DeferredCommandBufferActions, *};
|
||||
|
||||
@@ -338,7 +338,7 @@ impl Queue {
|
||||
#[cfg(wgpu_core)]
|
||||
pub unsafe fn as_hal<A: hal::Api>(
|
||||
&self,
|
||||
) -> Option<impl Deref<Target = A::Queue> + WasmNotSendSync> {
|
||||
) -> Option<impl core::ops::Deref<Target = A::Queue> + WasmNotSendSync> {
|
||||
let queue = self.inner.as_core_opt()?;
|
||||
unsafe { queue.context.queue_as_hal::<A>(queue) }
|
||||
}
|
||||
|
||||
@@ -603,6 +603,8 @@ pub trait QueueWriteBufferInterface: CommonTraits {
|
||||
}
|
||||
|
||||
pub trait BufferMappedRangeInterface: CommonTraits {
|
||||
// Used only in wgpu_core's `impl QueueWriteBufferInterface`
|
||||
#[cfg_attr(not(wgpu_core), expect(unused))]
|
||||
fn len(&self) -> usize;
|
||||
|
||||
/// # Safety
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//! Convenience macros
|
||||
#![cfg_attr(not(wgpu_core), expect(unused_macros, unused_imports))]
|
||||
|
||||
#[cfg(doc)]
|
||||
use crate::{VertexAttribute, VertexBufferLayout, VertexFormat};
|
||||
|
||||
Reference in new issue
Block a user