refactor(types): Move ExternalTextureTransferFunction to naga-types

This commit is contained in:
Andy Leiserson authored and mergify[bot] committed 2026-10-13 19:34:06 +00:00
1 parent eb4678dd08
commit 66e992c3a1
4 files changed
+30 -25

No files matched your search

Generated
+1
View File
@@ -2491,6 +2491,7 @@ name = "naga-types"
version = "30.0.0"
dependencies = [
"arbitrary",
"bytemuck",
"hashbrown 0.17.1",
"indexmap",
"rustc-hash 1.1.0",
+1
View File
@@ -22,6 +22,7 @@ std = []
[dependencies]
arbitrary = { workspace = true, features = ["derive"], optional = true }
bytemuck = { workspace = true, features = ["derive"] }
hashbrown.workspace = true
indexmap.workspace = true
rustc-hash.workspace = true
+26
View File
@@ -100,6 +100,32 @@ pub struct TaskDispatchLimits {
pub max_mesh_workgroups_total: u32,
}
/// Parameters describing a gamma encoding transfer function in the form
/// tf = { k * linear | linear < b
/// { a * pow(linear, 1/g) - (a-1) | linear >= b
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq, bytemuck::Zeroable, bytemuck::Pod)]
#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
#[allow(missing_docs)]
pub struct ExternalTextureTransferFunction {
pub a: f32,
pub b: f32,
pub g: f32,
pub k: f32,
}
impl Default for ExternalTextureTransferFunction {
fn default() -> Self {
Self {
a: 1.0,
b: 1.0,
g: 1.0,
k: 1.0,
}
}
}
/// Corresponds to [WebGPU `GPUVertexFormat`](
/// https://gpuweb.github.io/gpuweb/#enumdef-gpuvertexformat).
#[repr(u32)]
+2 -25
View File
@@ -4,6 +4,8 @@ use serde::{Deserialize, Serialize};
#[cfg(doc)]
use crate::TextureFormat;
pub use nt::ExternalTextureTransferFunction;
/// Format of an `ExternalTexture`. This indicates the number of underlying
/// planes used by the `ExternalTexture` as well as each plane's format.
#[repr(C)]
@@ -19,31 +21,6 @@ pub enum ExternalTextureFormat {
Yu12,
}
/// Parameters describing a gamma encoding transfer function in the form
/// tf = { k * linear | linear < b
/// { a * pow(linear, 1/g) - (a-1) | linear >= b
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq, bytemuck::Zeroable, bytemuck::Pod)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[allow(missing_docs)]
pub struct ExternalTextureTransferFunction {
pub a: f32,
pub b: f32,
pub g: f32,
pub k: f32,
}
impl Default for ExternalTextureTransferFunction {
fn default() -> Self {
Self {
a: 1.0,
b: 1.0,
g: 1.0,
k: 1.0,
}
}
}
/// Describes an [`ExternalTexture`](../wgpu/struct.ExternalTexture.html).
///
/// Note that [`width`] and [`height`] are the values that should be returned by