mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-22 23:41:01 +01:00
`ExternalTexture` will form the basis of wgpu's implementation of
WebGPU's `GPUExternalTexture`. [1]
The application will be responsible for creating `Texture`(s) and
`TextureView`(s) from the external texture source and managing their
lifecycle. It may have a single RGBA texture, or it may have multiple
textures for separate Y and Cb/Cr planes. It can then create an external
texture by calling `create_external_texture()`, providing the texture
views and a descriptor. The descriptor provides the following required
information:
* Whether the texture data is RGBA, or multiplanar or interleaved
YCbCr.
* The purpoted size of the external texture, which may not match the
actual size of the underlying textures.
* A matrix for converting from YCbCr to RGBA, if required.
* A transform to apply to texture sample coordinates, allowing for
rotation and crop rects.
The external texture stores a reference to the provided texture views,
and additionally owns a `Buffer`. This buffer holds data of the type
`ExternalTextureParams`, and will be provided as a uniform buffer to
shaders containing external textures. This contains information that
will be required by the shaders to handle external textures correctly.
Note that attempting to create an external texture will fail unless the
`Feature::EXTERNAL_TEXTURE` feature is enabled, which as of yet is not
supported by any HAL backends.
Additionally add the relevant API to wgpu, implemented for the
wgpu-core backend. The web and custom backends are unimplemented.
[1] https://www.w3.org/TR/webgpu/#gpuexternaltexture
196 lines
7.0 KiB
TOML
196 lines
7.0 KiB
TOML
[package]
|
||
name = "wgpu-core"
|
||
version.workspace = true
|
||
authors.workspace = true
|
||
edition.workspace = true
|
||
description = "Core implementation logic of wgpu, the cross-platform, safe, pure-rust graphics API"
|
||
homepage.workspace = true
|
||
repository.workspace = true
|
||
keywords.workspace = true
|
||
license.workspace = true
|
||
|
||
# Override the workspace's `rust-version` key. Firefox uses `cargo vendor` to
|
||
# copy the crates it actually uses out of the workspace, so it's meaningful for
|
||
# them to have less restrictive MSRVs individually than the workspace as a
|
||
# whole, if their code permits. See `../README.md` for details.
|
||
rust-version = "1.82.0"
|
||
|
||
[package.metadata.docs.rs]
|
||
all-features = true
|
||
rustdoc-args = ["--cfg", "docsrs"]
|
||
targets = [
|
||
"x86_64-unknown-linux-gnu",
|
||
"x86_64-apple-darwin",
|
||
"x86_64-pc-windows-msvc",
|
||
"wasm32-unknown-unknown",
|
||
]
|
||
|
||
[package.metadata.cargo-machete]
|
||
# Cargo machete can't check build.rs dependencies. See https://github.com/bnjbvr/cargo-machete/issues/100
|
||
ignored = ["cfg_aliases"]
|
||
|
||
[lints.rust]
|
||
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(wgpu_validate_locks)'] }
|
||
|
||
[lib]
|
||
|
||
[features]
|
||
#! See documentation for the `wgpu` crate for more in-depth information on these features.
|
||
|
||
# TODO(https://github.com/gfx-rs/wgpu/issues/6826): "std" is a default feature for
|
||
# compatibility with prior behavior only, and should be removed once we know how
|
||
# wgpu-core’s dependents want to handle no_std.
|
||
default = ["std"]
|
||
|
||
#! ### Logging Configuration
|
||
# --------------------------------------------------------------------
|
||
|
||
## Log all API entry points at info instead of trace level.
|
||
## Also, promotes certain debug log calls to info.
|
||
api_log_info = []
|
||
|
||
## Log resource lifecycle management at info instead of trace level.
|
||
resource_log_info = []
|
||
|
||
#! ### Runtime Checks
|
||
# --------------------------------------------------------------------
|
||
|
||
## 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 = ["wgpu-types/strict_asserts"]
|
||
|
||
#! ### Debugging
|
||
# --------------------------------------------------------------------
|
||
|
||
## Enable lock order observation.
|
||
observe_locks = ["std", "dep:ron", "serde/serde_derive"]
|
||
|
||
#! ### Serialization
|
||
# --------------------------------------------------------------------
|
||
|
||
## Enables serialization via `serde` on common wgpu types.
|
||
serde = ["dep:serde", "wgpu-types/serde", "arrayvec/serde", "hashbrown/serde"]
|
||
|
||
## Enable API tracing.
|
||
trace = ["serde", "std", "dep:ron", "naga/serialize", "wgpu-types/trace"]
|
||
|
||
## Enable API replaying
|
||
replay = ["serde", "naga/deserialize"]
|
||
|
||
#! ### Surface Support
|
||
# --------------------------------------------------------------------
|
||
|
||
## Enable creating surfaces using raw-window-handle
|
||
raw-window-handle = ["dep:raw-window-handle"]
|
||
|
||
#! ### Shading Language Support
|
||
# --------------------------------------------------------------------
|
||
|
||
## Enable `ShaderModuleSource::Wgsl`
|
||
wgsl = ["naga/wgsl-in"]
|
||
|
||
## Enable `ShaderModuleSource::Glsl`
|
||
glsl = ["naga/glsl-in"]
|
||
|
||
## Enable `ShaderModuleSource::SpirV`
|
||
spirv = ["naga/spv-in"]
|
||
|
||
#! ### Other
|
||
# --------------------------------------------------------------------
|
||
|
||
## Internally count resources and events for debugging purposes. If the counters
|
||
## feature is disabled, the counting infrastructure is removed from the build and
|
||
## the exposed counters always return 0.
|
||
counters = ["wgpu-types/counters"]
|
||
|
||
## Implement `Send` and `Sync` on Wasm, but only if atomics are not enabled.
|
||
fragile-send-sync-non-atomic-wasm = [
|
||
"wgpu-hal/fragile-send-sync-non-atomic-wasm",
|
||
]
|
||
|
||
## Enable certain items to be `Send` and `Sync` when they would not otherwise be.
|
||
## Also enables backtraces in some error cases when also under cfg(debug_assertions).
|
||
std = []
|
||
|
||
#! ### External libraries
|
||
# --------------------------------------------------------------------
|
||
#! The following features facilitate integration with third-party supporting libraries.
|
||
|
||
## Enable using the `mach-dxcompiler-rs` crate to compile DX12 shaders.
|
||
static-dxc = ["wgpu-hal/static-dxc"]
|
||
|
||
## Enable portable atomics on platforms that do not support 64bit atomics.
|
||
portable-atomic = ["dep:portable-atomic", "wgpu-hal/portable-atomic"]
|
||
|
||
#! ### Target Conditional Features
|
||
# --------------------------------------------------------------------
|
||
# Look to wgpu-hal's Cargo.toml for explaination how these features and the wgpu-core
|
||
# platform crates collude to provide platform-specific behavior.
|
||
|
||
## DX12 backend
|
||
dx12 = ["wgpu-core-deps-windows-linux-android/dx12"]
|
||
## Metal backend
|
||
metal = ["wgpu-core-deps-apple/metal"]
|
||
## Vulkan backend, only available on Windows, Linux, Android
|
||
vulkan = ["wgpu-core-deps-windows-linux-android/vulkan"]
|
||
## OpenGL backend, only available on Windows, Linux, Android, and Emscripten
|
||
gles = [
|
||
"wgpu-core-deps-windows-linux-android/gles",
|
||
"wgpu-core-deps-emscripten/gles",
|
||
]
|
||
|
||
## WebGL backend, only available on Emscripten
|
||
webgl = ["wgpu-core-deps-wasm/webgl", "wgpu-types/web"]
|
||
## OpenGL backend, on macOS only
|
||
angle = ["wgpu-core-deps-apple/angle"]
|
||
## Vulkan portability backend, only available on macOS
|
||
vulkan-portability = ["wgpu-core-deps-apple/vulkan-portability"]
|
||
## Renderdoc integration, only available on Windows, Linux, and Android
|
||
renderdoc = ["wgpu-core-deps-windows-linux-android/renderdoc"]
|
||
|
||
## Enable the `noop` backend.
|
||
# TODO(https://github.com/gfx-rs/wgpu/issues/7120): there should be a hal feature
|
||
noop = []
|
||
|
||
# The target limitation here isn't needed, but prevents more than one of these
|
||
# platform crates from being included in the build at a time, preventing users
|
||
# from getting confused by seeing them in the list of crates.
|
||
[target.'cfg(target_vendor = "apple")'.dependencies]
|
||
wgpu-core-deps-apple = { workspace = true, optional = true }
|
||
[target.'cfg(target_os = "emscripten")'.dependencies]
|
||
wgpu-core-deps-emscripten = { workspace = true, optional = true }
|
||
[target.'cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))'.dependencies]
|
||
wgpu-core-deps-wasm = { workspace = true, optional = true }
|
||
[target.'cfg(any(windows, target_os = "linux", target_os = "android"))'.dependencies]
|
||
wgpu-core-deps-windows-linux-android = { workspace = true, optional = true }
|
||
|
||
[dependencies]
|
||
naga.workspace = true
|
||
wgpu-hal.workspace = true
|
||
wgpu-types.workspace = true
|
||
|
||
arrayvec.workspace = true
|
||
bit-vec.workspace = true
|
||
bit-set.workspace = true
|
||
bitflags.workspace = true
|
||
bytemuck.workspace = true
|
||
document-features.workspace = true
|
||
hashbrown.workspace = true
|
||
indexmap.workspace = true
|
||
log.workspace = true
|
||
once_cell = { workspace = true, features = ["std"] }
|
||
parking_lot.workspace = true
|
||
profiling = { workspace = true, default-features = false }
|
||
raw-window-handle = { workspace = true, optional = true }
|
||
ron = { workspace = true, optional = true }
|
||
rustc-hash.workspace = true
|
||
serde = { workspace = true, features = ["default", "derive"], optional = true }
|
||
smallvec.workspace = true
|
||
thiserror.workspace = true
|
||
|
||
[target.'cfg(not(target_has_atomic = "64"))'.dependencies]
|
||
portable-atomic = { workspace = true, optional = true }
|
||
|
||
[build-dependencies]
|
||
cfg_aliases.workspace = true
|