mirror of
https://github.com/gfx-rs/wgpu.git
synced 2025-02-16 08:53:20 +00:00
Implement Unorm10_10_10_2 VertexFormat (#5477)
This commit is contained in:
parent
ed843f8029
commit
3db0e46f7d
@ -51,6 +51,7 @@ Bottom level categories:
|
||||
|
||||
#### General
|
||||
|
||||
- Implemented the `Unorm10_10_10_2` VertexFormat.
|
||||
- Many numeric built-ins have had a constant evaluation implementation added for them, which allows them to be used in a `const` context:
|
||||
- [#4879](https://github.com/gfx-rs/wgpu/pull/4879) by @ErichDonGubler:
|
||||
- `abs`
|
||||
|
@ -6391,6 +6391,7 @@ webidl.converters["GPUVertexFormat"] = webidl.createEnumConverter(
|
||||
"sint32x2",
|
||||
"sint32x3",
|
||||
"sint32x4",
|
||||
"unorm10-10-10-2",
|
||||
],
|
||||
);
|
||||
|
||||
|
@ -832,6 +832,7 @@ enum GPUVertexFormat {
|
||||
"sint32x2",
|
||||
"sint32x3",
|
||||
"sint32x4",
|
||||
"unorm10-10-10-2",
|
||||
};
|
||||
|
||||
enum GPUVertexStepMode {
|
||||
|
@ -655,7 +655,8 @@ impl NumericType {
|
||||
| Vf::Unorm16x4
|
||||
| Vf::Snorm16x4
|
||||
| Vf::Float16x4
|
||||
| Vf::Float32x4 => (NumericDimension::Vector(Vs::Quad), Scalar::F32),
|
||||
| Vf::Float32x4
|
||||
| Vf::Unorm10_10_10_2 => (NumericDimension::Vector(Vs::Quad), Scalar::F32),
|
||||
Vf::Float64 => (NumericDimension::Scalar, Scalar::F64),
|
||||
Vf::Float64x2 => (NumericDimension::Vector(Vs::Bi), Scalar::F64),
|
||||
Vf::Float64x3 => (NumericDimension::Vector(Vs::Tri), Scalar::F64),
|
||||
|
@ -261,6 +261,7 @@ pub fn map_vertex_format(format: wgt::VertexFormat) -> dxgiformat::DXGI_FORMAT {
|
||||
Vf::Uint32x4 => DXGI_FORMAT_R32G32B32A32_UINT,
|
||||
Vf::Sint32x4 => DXGI_FORMAT_R32G32B32A32_SINT,
|
||||
Vf::Float32x4 => DXGI_FORMAT_R32G32B32A32_FLOAT,
|
||||
Vf::Unorm10_10_10_2 => DXGI_FORMAT_R10G10B10A2_UNORM,
|
||||
Vf::Float64 | Vf::Float64x2 | Vf::Float64x3 | Vf::Float64x4 => unimplemented!(),
|
||||
}
|
||||
}
|
||||
|
@ -212,6 +212,7 @@ pub(super) fn describe_vertex_format(vertex_format: wgt::VertexFormat) -> super:
|
||||
Vf::Uint32x4 => (4, glow::UNSIGNED_INT, Vak::Integer),
|
||||
Vf::Sint32x4 => (4, glow::INT, Vak::Integer),
|
||||
Vf::Float32x4 => (4, glow::FLOAT, Vak::Float),
|
||||
Vf::Unorm10_10_10_2 => (4, glow::UNSIGNED_INT_10_10_10_2, Vak::Float),
|
||||
Vf::Float64 | Vf::Float64x2 | Vf::Float64x3 | Vf::Float64x4 => unimplemented!(),
|
||||
};
|
||||
|
||||
|
@ -222,6 +222,7 @@ pub fn map_vertex_format(format: wgt::VertexFormat) -> metal::MTLVertexFormat {
|
||||
Vf::Uint32x4 => UInt4,
|
||||
Vf::Sint32x4 => Int4,
|
||||
Vf::Float32x4 => Float4,
|
||||
Vf::Unorm10_10_10_2 => UInt1010102Normalized,
|
||||
Vf::Float64 | Vf::Float64x2 | Vf::Float64x3 | Vf::Float64x4 => unimplemented!(),
|
||||
}
|
||||
}
|
||||
|
@ -399,6 +399,7 @@ pub fn map_vertex_format(vertex_format: wgt::VertexFormat) -> vk::Format {
|
||||
Vf::Float64x2 => vk::Format::R64G64_SFLOAT,
|
||||
Vf::Float64x3 => vk::Format::R64G64B64_SFLOAT,
|
||||
Vf::Float64x4 => vk::Format::R64G64B64A64_SFLOAT,
|
||||
Vf::Unorm10_10_10_2 => vk::Format::A2B10G10R10_UNORM_PACK32,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4942,6 +4942,9 @@ pub enum VertexFormat {
|
||||
Float64x3 = 32,
|
||||
/// Four double-precision floats (f64). `vec4<f32>` in shaders. Requires [`Features::VERTEX_ATTRIBUTE_64BIT`].
|
||||
Float64x4 = 33,
|
||||
/// Three unsigned 10-bit integers and one 2-bit integer, packed into a 32-bit integer (u32). [0, 1024] converted to float [0, 1] `vec4<f32>` in shaders.
|
||||
#[cfg_attr(feature = "serde", serde(rename = "unorm10-10-10-2"))]
|
||||
Unorm10_10_10_2 = 34,
|
||||
}
|
||||
|
||||
impl VertexFormat {
|
||||
@ -4960,7 +4963,8 @@ impl VertexFormat {
|
||||
| Self::Float16x2
|
||||
| Self::Float32
|
||||
| Self::Uint32
|
||||
| Self::Sint32 => 4,
|
||||
| Self::Sint32
|
||||
| Self::Unorm10_10_10_2 => 4,
|
||||
Self::Uint16x4
|
||||
| Self::Sint16x4
|
||||
| Self::Unorm16x4
|
||||
|
@ -480,6 +480,7 @@ fn map_vertex_format(format: wgt::VertexFormat) -> webgpu_sys::GpuVertexFormat {
|
||||
VertexFormat::Sint32x2 => vf::Sint32x2,
|
||||
VertexFormat::Sint32x3 => vf::Sint32x3,
|
||||
VertexFormat::Sint32x4 => vf::Sint32x4,
|
||||
VertexFormat::Unorm10_10_10_2 => vf::Unorm1010102,
|
||||
VertexFormat::Float64
|
||||
| VertexFormat::Float64x2
|
||||
| VertexFormat::Float64x3
|
||||
|
Loading…
Reference in New Issue
Block a user