Format extent and origin types as tuples. (#4853)

* Format extent and origin types as tuples.

* Update wgpu-types/src/lib.rs

Co-authored-by: Andreas Reich <r_andreas2@web.de>

---------

Co-authored-by: Andreas Reich <r_andreas2@web.de>
This commit is contained in:
Nicolas Silva
2023-12-09 23:43:53 +01:00
committed by GitHub
parent d801c6111d
commit af701fb26d

View File

@@ -5274,7 +5274,7 @@ pub enum TextureDimension {
/// Corresponds to [WebGPU `GPUOrigin2D`](
/// https://gpuweb.github.io/gpuweb/#dictdef-gpuorigin2ddict).
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
#[derive(Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "trace", derive(Serialize))]
#[cfg_attr(feature = "replay", derive(Deserialize))]
#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
@@ -5299,12 +5299,18 @@ impl Origin2d {
}
}
impl std::fmt::Debug for Origin2d {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
(self.x, self.y).fmt(f)
}
}
/// Origin of a copy to/from a texture.
///
/// Corresponds to [WebGPU `GPUOrigin3D`](
/// https://gpuweb.github.io/gpuweb/#dictdef-gpuorigin3ddict).
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
#[derive(Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "trace", derive(Serialize))]
#[cfg_attr(feature = "replay", derive(Deserialize))]
#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
@@ -5336,12 +5342,18 @@ impl Default for Origin3d {
}
}
impl std::fmt::Debug for Origin3d {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
(self.x, self.y, self.z).fmt(f)
}
}
/// Extent of a texture related operation.
///
/// Corresponds to [WebGPU `GPUExtent3D`](
/// https://gpuweb.github.io/gpuweb/#dictdef-gpuextent3ddict).
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
#[derive(Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "trace", derive(Serialize))]
#[cfg_attr(feature = "replay", derive(Deserialize))]
#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
@@ -5355,6 +5367,12 @@ pub struct Extent3d {
pub depth_or_array_layers: u32,
}
impl std::fmt::Debug for Extent3d {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
(self.width, self.height, self.depth_or_array_layers).fmt(f)
}
}
#[cfg(feature = "serde")]
fn default_depth() -> u32 {
1