mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-01-09 14:48:08 -05:00
Rename Empty backend to Noop.
This is in preparation for making it a more substantial test stub, able to execute nontrivial code, and usable from the safe `wgpu` API.
This commit is contained in:
committed by
Connor Fitzgerald
parent
ff907736ef
commit
0143b4aaa0
@@ -3,7 +3,7 @@
|
|||||||
//! and run the tests through them.
|
//! and run the tests through them.
|
||||||
//!
|
//!
|
||||||
//! Test requirements:
|
//! Test requirements:
|
||||||
//! - all IDs have the backend `Empty`
|
//! - all IDs have the backend `Noop`
|
||||||
//! - all expected buffers have `MAP_READ` usage
|
//! - all expected buffers have `MAP_READ` usage
|
||||||
//! - last action is `Submit`
|
//! - last action is `Submit`
|
||||||
//! - no swapchain use
|
//! - no swapchain use
|
||||||
@@ -74,9 +74,7 @@ impl Test<'_> {
|
|||||||
wgt::Backend::Gl => "Gl",
|
wgt::Backend::Gl => "Gl",
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
};
|
};
|
||||||
let string = read_to_string(&path)
|
let string = read_to_string(&path).unwrap().replace("Noop", backend_name);
|
||||||
.unwrap()
|
|
||||||
.replace("Empty", backend_name);
|
|
||||||
ron::de::from_str(&string)
|
ron::de::from_str(&string)
|
||||||
.unwrap_or_else(|e| panic!("{path:?}:{} {}", e.position.line, e.code))
|
.unwrap_or_else(|e| panic!("{path:?}:{} {}", e.position.line, e.code))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ pub trait HalApi: hal::Api + 'static + WasmNotSendSync {
|
|||||||
const VARIANT: Backend;
|
const VARIANT: Backend;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HalApi for hal::api::Empty {
|
impl HalApi for hal::api::Noop {
|
||||||
const VARIANT: Backend = Backend::Empty;
|
const VARIANT: Backend = Backend::Noop;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(vulkan)]
|
#[cfg(vulkan)]
|
||||||
|
|||||||
@@ -65,11 +65,11 @@ impl RawId {
|
|||||||
/// any backend, but the corresponding resource types ([`Texture<A>`], for
|
/// any backend, but the corresponding resource types ([`Texture<A>`], for
|
||||||
/// example) are always parameterized by a specific backend `A`.
|
/// example) are always parameterized by a specific backend `A`.
|
||||||
///
|
///
|
||||||
/// So the `T` in `Id<T>` is usually a resource type like `Texture<Empty>`,
|
/// So the `T` in `Id<T>` is usually a resource type like `Texture<Noop>`,
|
||||||
/// where [`Empty`] is the `wgpu_hal` dummy back end. These empty types are
|
/// where [`Noop`] is the `wgpu_hal` dummy back end. These empty types are
|
||||||
/// never actually used, beyond just making sure you access each `Storage` with
|
/// never actually used, beyond just making sure you access each `Storage` with
|
||||||
/// the right kind of identifier. The members of [`Hub<A>`] pair up each
|
/// the right kind of identifier. The members of [`Hub<A>`] pair up each
|
||||||
/// `X<Empty>` type with the resource type `X<A>`, for some specific backend
|
/// `X<Noop>` type with the resource type `X<A>`, for some specific backend
|
||||||
/// `A`.
|
/// `A`.
|
||||||
///
|
///
|
||||||
/// [`Global`]: crate::global::Global
|
/// [`Global`]: crate::global::Global
|
||||||
@@ -77,7 +77,7 @@ impl RawId {
|
|||||||
/// [`Hub<A>`]: crate::hub::Hub
|
/// [`Hub<A>`]: crate::hub::Hub
|
||||||
/// [`Texture<A>`]: crate::resource::Texture
|
/// [`Texture<A>`]: crate::resource::Texture
|
||||||
/// [`Registry`]: crate::hub::Registry
|
/// [`Registry`]: crate::hub::Registry
|
||||||
/// [`Empty`]: hal::api::Empty
|
/// [`Noop`]: hal::api::Noop
|
||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
#[cfg_attr(any(feature = "serde", feature = "trace"), derive(serde::Serialize))]
|
#[cfg_attr(any(feature = "serde", feature = "trace"), derive(serde::Serialize))]
|
||||||
#[cfg_attr(any(feature = "serde", feature = "replay"), derive(serde::Deserialize))]
|
#[cfg_attr(any(feature = "serde", feature = "replay"), derive(serde::Deserialize))]
|
||||||
|
|||||||
@@ -815,7 +815,7 @@ cfg_if::cfg_if! {
|
|||||||
}
|
}
|
||||||
// Fallback
|
// Fallback
|
||||||
else {
|
else {
|
||||||
type Api = hal::api::Empty;
|
type Api = hal::api::Noop;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1129,7 +1129,7 @@ cfg_if::cfg_if! {
|
|||||||
}
|
}
|
||||||
// Fallback
|
// Fallback
|
||||||
else {
|
else {
|
||||||
type Api = hal::api::Empty;
|
type Api = hal::api::Noop;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -239,14 +239,14 @@ extern crate wgpu_types as wgt;
|
|||||||
/// DirectX12 API internals.
|
/// DirectX12 API internals.
|
||||||
#[cfg(dx12)]
|
#[cfg(dx12)]
|
||||||
pub mod dx12;
|
pub mod dx12;
|
||||||
/// A dummy API implementation.
|
|
||||||
pub mod empty;
|
|
||||||
/// GLES API internals.
|
/// GLES API internals.
|
||||||
#[cfg(gles)]
|
#[cfg(gles)]
|
||||||
pub mod gles;
|
pub mod gles;
|
||||||
/// Metal API internals.
|
/// Metal API internals.
|
||||||
#[cfg(metal)]
|
#[cfg(metal)]
|
||||||
pub mod metal;
|
pub mod metal;
|
||||||
|
/// A dummy API implementation.
|
||||||
|
pub mod noop;
|
||||||
/// Vulkan API internals.
|
/// Vulkan API internals.
|
||||||
#[cfg(vulkan)]
|
#[cfg(vulkan)]
|
||||||
pub mod vulkan;
|
pub mod vulkan;
|
||||||
@@ -255,11 +255,11 @@ pub mod auxil;
|
|||||||
pub mod api {
|
pub mod api {
|
||||||
#[cfg(dx12)]
|
#[cfg(dx12)]
|
||||||
pub use super::dx12::Api as Dx12;
|
pub use super::dx12::Api as Dx12;
|
||||||
pub use super::empty::Api as Empty;
|
|
||||||
#[cfg(gles)]
|
#[cfg(gles)]
|
||||||
pub use super::gles::Api as Gles;
|
pub use super::gles::Api as Gles;
|
||||||
#[cfg(metal)]
|
#[cfg(metal)]
|
||||||
pub use super::metal::Api as Metal;
|
pub use super::metal::Api as Metal;
|
||||||
|
pub use super::noop::Api as Noop;
|
||||||
#[cfg(vulkan)]
|
#[cfg(vulkan)]
|
||||||
pub use super::vulkan::Api as Vulkan;
|
pub use super::vulkan::Api as Vulkan;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,8 +75,8 @@ pub const QUERY_SIZE: u32 = 8;
|
|||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||||
pub enum Backend {
|
pub enum Backend {
|
||||||
/// Dummy backend, used for testing.
|
/// Dummy backend, which may be used for testing.
|
||||||
Empty = 0,
|
Noop = 0,
|
||||||
/// Vulkan API (Windows, Linux, Android, MacOS via `vulkan-portability`/MoltenVK)
|
/// Vulkan API (Windows, Linux, Android, MacOS via `vulkan-portability`/MoltenVK)
|
||||||
Vulkan = 1,
|
Vulkan = 1,
|
||||||
/// Metal API (Apple platforms)
|
/// Metal API (Apple platforms)
|
||||||
@@ -94,7 +94,7 @@ impl Backend {
|
|||||||
#[must_use]
|
#[must_use]
|
||||||
pub const fn to_str(self) -> &'static str {
|
pub const fn to_str(self) -> &'static str {
|
||||||
match self {
|
match self {
|
||||||
Backend::Empty => "empty",
|
Backend::Noop => "noop",
|
||||||
Backend::Vulkan => "vulkan",
|
Backend::Vulkan => "vulkan",
|
||||||
Backend::Metal => "metal",
|
Backend::Metal => "metal",
|
||||||
Backend::Dx12 => "dx12",
|
Backend::Dx12 => "dx12",
|
||||||
|
|||||||
Reference in New Issue
Block a user