mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-21 22:33:49 +00:00
Rg11b10Float
-> Rg11b10UFloat
and deduplicate entries in TEXTURE_FORMAT_LIST
(#6108)
* Resync `TEXTURE_FORMAT_LIST` to match `TextureFormat` Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * `Rg11b10Float` -> `Rg11b10UFloat` Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Add changelog entry Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> --------- Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
parent
5533c37786
commit
c6a3d92734
@ -62,6 +62,7 @@ Bottom level categories:
|
|||||||
### Changes
|
### Changes
|
||||||
|
|
||||||
- Reduce the amount of debug and trace logs emitted by wgpu-core and wgpu-hal. By @nical in [#6065](https://github.com/gfx-rs/wgpu/issues/6065)
|
- Reduce the amount of debug and trace logs emitted by wgpu-core and wgpu-hal. By @nical in [#6065](https://github.com/gfx-rs/wgpu/issues/6065)
|
||||||
|
- `Rg11b10Float` is renamed to `Rg11b10UFloat`. By @sagudev in [#6108](https://github.com/gfx-rs/wgpu/pull/6108)
|
||||||
|
|
||||||
### Dependency Updates
|
### Dependency Updates
|
||||||
|
|
||||||
|
@ -399,7 +399,7 @@ impl<'a, W> Writer<'a, W> {
|
|||||||
| StorageFormat::Rg16Float
|
| StorageFormat::Rg16Float
|
||||||
| StorageFormat::Rgb10a2Uint
|
| StorageFormat::Rgb10a2Uint
|
||||||
| StorageFormat::Rgb10a2Unorm
|
| StorageFormat::Rgb10a2Unorm
|
||||||
| StorageFormat::Rg11b10Float
|
| StorageFormat::Rg11b10UFloat
|
||||||
| StorageFormat::Rg32Uint
|
| StorageFormat::Rg32Uint
|
||||||
| StorageFormat::Rg32Sint
|
| StorageFormat::Rg32Sint
|
||||||
| StorageFormat::Rg32Float => {
|
| StorageFormat::Rg32Float => {
|
||||||
|
@ -4820,7 +4820,7 @@ fn glsl_storage_format(format: crate::StorageFormat) -> Result<&'static str, Err
|
|||||||
Sf::Rgba8Sint => "rgba8i",
|
Sf::Rgba8Sint => "rgba8i",
|
||||||
Sf::Rgb10a2Uint => "rgb10_a2ui",
|
Sf::Rgb10a2Uint => "rgb10_a2ui",
|
||||||
Sf::Rgb10a2Unorm => "rgb10_a2",
|
Sf::Rgb10a2Unorm => "rgb10_a2",
|
||||||
Sf::Rg11b10Float => "r11f_g11f_b10f",
|
Sf::Rg11b10UFloat => "r11f_g11f_b10f",
|
||||||
Sf::Rg32Uint => "rg32ui",
|
Sf::Rg32Uint => "rg32ui",
|
||||||
Sf::Rg32Sint => "rg32i",
|
Sf::Rg32Sint => "rg32i",
|
||||||
Sf::Rg32Float => "rg32f",
|
Sf::Rg32Float => "rg32f",
|
||||||
|
@ -132,7 +132,7 @@ impl crate::StorageFormat {
|
|||||||
Self::Rg8Sint | Self::Rg16Sint => "int2",
|
Self::Rg8Sint | Self::Rg16Sint => "int2",
|
||||||
Self::Rg8Uint | Self::Rg16Uint => "uint2",
|
Self::Rg8Uint | Self::Rg16Uint => "uint2",
|
||||||
|
|
||||||
Self::Rg11b10Float => "float3",
|
Self::Rg11b10UFloat => "float3",
|
||||||
|
|
||||||
Self::Rgba16Float | Self::R32Float | Self::Rg32Float | Self::Rgba32Float => "float4",
|
Self::Rgba16Float | Self::R32Float | Self::Rg32Float | Self::Rgba32Float => "float4",
|
||||||
Self::Rgba8Unorm | Self::Bgra8Unorm | Self::Rgba16Unorm | Self::Rgb10a2Unorm => {
|
Self::Rgba8Unorm | Self::Bgra8Unorm | Self::Rgba16Unorm | Self::Rgb10a2Unorm => {
|
||||||
|
@ -1170,7 +1170,7 @@ impl From<crate::StorageFormat> for spirv::ImageFormat {
|
|||||||
Sf::Bgra8Unorm => Self::Unknown,
|
Sf::Bgra8Unorm => Self::Unknown,
|
||||||
Sf::Rgb10a2Uint => Self::Rgb10a2ui,
|
Sf::Rgb10a2Uint => Self::Rgb10a2ui,
|
||||||
Sf::Rgb10a2Unorm => Self::Rgb10A2,
|
Sf::Rgb10a2Unorm => Self::Rgb10A2,
|
||||||
Sf::Rg11b10Float => Self::R11fG11fB10f,
|
Sf::Rg11b10UFloat => Self::R11fG11fB10f,
|
||||||
Sf::Rg32Uint => Self::Rg32ui,
|
Sf::Rg32Uint => Self::Rg32ui,
|
||||||
Sf::Rg32Sint => Self::Rg32i,
|
Sf::Rg32Sint => Self::Rg32i,
|
||||||
Sf::Rg32Float => Self::Rg32f,
|
Sf::Rg32Float => Self::Rg32f,
|
||||||
|
@ -2015,7 +2015,7 @@ const fn storage_format_str(format: crate::StorageFormat) -> &'static str {
|
|||||||
Sf::Bgra8Unorm => "bgra8unorm",
|
Sf::Bgra8Unorm => "bgra8unorm",
|
||||||
Sf::Rgb10a2Uint => "rgb10a2uint",
|
Sf::Rgb10a2Uint => "rgb10a2uint",
|
||||||
Sf::Rgb10a2Unorm => "rgb10a2unorm",
|
Sf::Rgb10a2Unorm => "rgb10a2unorm",
|
||||||
Sf::Rg11b10Float => "rg11b10float",
|
Sf::Rg11b10UFloat => "rg11b10float",
|
||||||
Sf::Rg32Uint => "rg32uint",
|
Sf::Rg32Uint => "rg32uint",
|
||||||
Sf::Rg32Sint => "rg32sint",
|
Sf::Rg32Sint => "rg32sint",
|
||||||
Sf::Rg32Float => "rg32float",
|
Sf::Rg32Float => "rg32float",
|
||||||
|
@ -397,7 +397,7 @@ fn map_image_format(word: &str) -> Option<crate::StorageFormat> {
|
|||||||
"rgba16f" => Sf::Rgba16Float,
|
"rgba16f" => Sf::Rgba16Float,
|
||||||
"rg32f" => Sf::Rg32Float,
|
"rg32f" => Sf::Rg32Float,
|
||||||
"rg16f" => Sf::Rg16Float,
|
"rg16f" => Sf::Rg16Float,
|
||||||
"r11f_g11f_b10f" => Sf::Rg11b10Float,
|
"r11f_g11f_b10f" => Sf::Rg11b10UFloat,
|
||||||
"r32f" => Sf::R32Float,
|
"r32f" => Sf::R32Float,
|
||||||
"r16f" => Sf::R16Float,
|
"r16f" => Sf::R16Float,
|
||||||
"rgba16" => Sf::Rgba16Unorm,
|
"rgba16" => Sf::Rgba16Unorm,
|
||||||
|
@ -104,7 +104,7 @@ pub(super) fn map_image_format(word: spirv::Word) -> Result<crate::StorageFormat
|
|||||||
Some(spirv::ImageFormat::Rgba8i) => Ok(crate::StorageFormat::Rgba8Sint),
|
Some(spirv::ImageFormat::Rgba8i) => Ok(crate::StorageFormat::Rgba8Sint),
|
||||||
Some(spirv::ImageFormat::Rgb10a2ui) => Ok(crate::StorageFormat::Rgb10a2Uint),
|
Some(spirv::ImageFormat::Rgb10a2ui) => Ok(crate::StorageFormat::Rgb10a2Uint),
|
||||||
Some(spirv::ImageFormat::Rgb10A2) => Ok(crate::StorageFormat::Rgb10a2Unorm),
|
Some(spirv::ImageFormat::Rgb10A2) => Ok(crate::StorageFormat::Rgb10a2Unorm),
|
||||||
Some(spirv::ImageFormat::R11fG11fB10f) => Ok(crate::StorageFormat::Rg11b10Float),
|
Some(spirv::ImageFormat::R11fG11fB10f) => Ok(crate::StorageFormat::Rg11b10UFloat),
|
||||||
Some(spirv::ImageFormat::Rg32ui) => Ok(crate::StorageFormat::Rg32Uint),
|
Some(spirv::ImageFormat::Rg32ui) => Ok(crate::StorageFormat::Rg32Uint),
|
||||||
Some(spirv::ImageFormat::Rg32i) => Ok(crate::StorageFormat::Rg32Sint),
|
Some(spirv::ImageFormat::Rg32i) => Ok(crate::StorageFormat::Rg32Sint),
|
||||||
Some(spirv::ImageFormat::Rg32f) => Ok(crate::StorageFormat::Rg32Float),
|
Some(spirv::ImageFormat::Rg32f) => Ok(crate::StorageFormat::Rg32Float),
|
||||||
|
@ -92,7 +92,7 @@ pub fn map_storage_format(word: &str, span: Span) -> Result<crate::StorageFormat
|
|||||||
"rgba8sint" => Sf::Rgba8Sint,
|
"rgba8sint" => Sf::Rgba8Sint,
|
||||||
"rgb10a2uint" => Sf::Rgb10a2Uint,
|
"rgb10a2uint" => Sf::Rgb10a2Uint,
|
||||||
"rgb10a2unorm" => Sf::Rgb10a2Unorm,
|
"rgb10a2unorm" => Sf::Rgb10a2Unorm,
|
||||||
"rg11b10float" => Sf::Rg11b10Float,
|
"rg11b10float" => Sf::Rg11b10UFloat,
|
||||||
"rg32uint" => Sf::Rg32Uint,
|
"rg32uint" => Sf::Rg32Uint,
|
||||||
"rg32sint" => Sf::Rg32Sint,
|
"rg32sint" => Sf::Rg32Sint,
|
||||||
"rg32float" => Sf::Rg32Float,
|
"rg32float" => Sf::Rg32Float,
|
||||||
|
@ -175,7 +175,7 @@ impl crate::StorageFormat {
|
|||||||
Sf::Bgra8Unorm => "bgra8unorm",
|
Sf::Bgra8Unorm => "bgra8unorm",
|
||||||
Sf::Rgb10a2Uint => "rgb10a2uint",
|
Sf::Rgb10a2Uint => "rgb10a2uint",
|
||||||
Sf::Rgb10a2Unorm => "rgb10a2unorm",
|
Sf::Rgb10a2Unorm => "rgb10a2unorm",
|
||||||
Sf::Rg11b10Float => "rg11b10float",
|
Sf::Rg11b10UFloat => "rg11b10float",
|
||||||
Sf::Rg32Uint => "rg32uint",
|
Sf::Rg32Uint => "rg32uint",
|
||||||
Sf::Rg32Sint => "rg32sint",
|
Sf::Rg32Sint => "rg32sint",
|
||||||
Sf::Rg32Float => "rg32float",
|
Sf::Rg32Float => "rg32float",
|
||||||
|
@ -615,7 +615,7 @@ pub enum StorageFormat {
|
|||||||
// Packed 32-bit formats
|
// Packed 32-bit formats
|
||||||
Rgb10a2Uint,
|
Rgb10a2Uint,
|
||||||
Rgb10a2Unorm,
|
Rgb10a2Unorm,
|
||||||
Rg11b10Float,
|
Rg11b10UFloat,
|
||||||
|
|
||||||
// 64-bit formats
|
// 64-bit formats
|
||||||
Rg32Uint,
|
Rg32Uint,
|
||||||
|
@ -48,7 +48,7 @@ impl From<super::StorageFormat> for super::ScalarKind {
|
|||||||
Sf::Bgra8Unorm => Sk::Float,
|
Sf::Bgra8Unorm => Sk::Float,
|
||||||
Sf::Rgb10a2Uint => Sk::Uint,
|
Sf::Rgb10a2Uint => Sk::Uint,
|
||||||
Sf::Rgb10a2Unorm => Sk::Float,
|
Sf::Rgb10a2Unorm => Sk::Float,
|
||||||
Sf::Rg11b10Float => Sk::Float,
|
Sf::Rg11b10UFloat => Sk::Float,
|
||||||
Sf::Rg32Uint => Sk::Uint,
|
Sf::Rg32Uint => Sk::Uint,
|
||||||
Sf::Rg32Sint => Sk::Sint,
|
Sf::Rg32Sint => Sk::Sint,
|
||||||
Sf::Rg32Float => Sk::Float,
|
Sf::Rg32Float => Sk::Float,
|
||||||
|
@ -26,7 +26,7 @@ static TEXTURE_FORMATS_UNCOMPRESSED_GLES_COMPAT: &[wgpu::TextureFormat] = &[
|
|||||||
wgpu::TextureFormat::Bgra8UnormSrgb,
|
wgpu::TextureFormat::Bgra8UnormSrgb,
|
||||||
wgpu::TextureFormat::Rgb10a2Uint,
|
wgpu::TextureFormat::Rgb10a2Uint,
|
||||||
wgpu::TextureFormat::Rgb10a2Unorm,
|
wgpu::TextureFormat::Rgb10a2Unorm,
|
||||||
wgpu::TextureFormat::Rg11b10Float,
|
wgpu::TextureFormat::Rg11b10UFloat,
|
||||||
wgpu::TextureFormat::Rg32Uint,
|
wgpu::TextureFormat::Rg32Uint,
|
||||||
wgpu::TextureFormat::Rg32Sint,
|
wgpu::TextureFormat::Rg32Sint,
|
||||||
wgpu::TextureFormat::Rg32Float,
|
wgpu::TextureFormat::Rg32Float,
|
||||||
|
@ -275,7 +275,7 @@ fn map_storage_format_to_naga(format: wgt::TextureFormat) -> Option<naga::Storag
|
|||||||
|
|
||||||
Tf::Rgb10a2Uint => Sf::Rgb10a2Uint,
|
Tf::Rgb10a2Uint => Sf::Rgb10a2Uint,
|
||||||
Tf::Rgb10a2Unorm => Sf::Rgb10a2Unorm,
|
Tf::Rgb10a2Unorm => Sf::Rgb10a2Unorm,
|
||||||
Tf::Rg11b10Float => Sf::Rg11b10Float,
|
Tf::Rg11b10UFloat => Sf::Rg11b10UFloat,
|
||||||
|
|
||||||
Tf::Rg32Uint => Sf::Rg32Uint,
|
Tf::Rg32Uint => Sf::Rg32Uint,
|
||||||
Tf::Rg32Sint => Sf::Rg32Sint,
|
Tf::Rg32Sint => Sf::Rg32Sint,
|
||||||
@ -331,7 +331,7 @@ fn map_storage_format_from_naga(format: naga::StorageFormat) -> wgt::TextureForm
|
|||||||
|
|
||||||
Sf::Rgb10a2Uint => Tf::Rgb10a2Uint,
|
Sf::Rgb10a2Uint => Tf::Rgb10a2Uint,
|
||||||
Sf::Rgb10a2Unorm => Tf::Rgb10a2Unorm,
|
Sf::Rgb10a2Unorm => Tf::Rgb10a2Unorm,
|
||||||
Sf::Rg11b10Float => Tf::Rg11b10Float,
|
Sf::Rg11b10UFloat => Tf::Rg11b10UFloat,
|
||||||
|
|
||||||
Sf::Rg32Uint => Tf::Rg32Uint,
|
Sf::Rg32Uint => Tf::Rg32Uint,
|
||||||
Sf::Rg32Sint => Tf::Rg32Sint,
|
Sf::Rg32Sint => Tf::Rg32Sint,
|
||||||
@ -658,7 +658,7 @@ impl NumericType {
|
|||||||
Tf::Rgba8Sint | Tf::Rgba16Sint | Tf::Rgba32Sint => {
|
Tf::Rgba8Sint | Tf::Rgba16Sint | Tf::Rgba32Sint => {
|
||||||
(NumericDimension::Vector(Vs::Quad), Scalar::I32)
|
(NumericDimension::Vector(Vs::Quad), Scalar::I32)
|
||||||
}
|
}
|
||||||
Tf::Rg11b10Float => (NumericDimension::Vector(Vs::Tri), Scalar::F32),
|
Tf::Rg11b10UFloat => (NumericDimension::Vector(Vs::Tri), Scalar::F32),
|
||||||
Tf::Stencil8
|
Tf::Stencil8
|
||||||
| Tf::Depth16Unorm
|
| Tf::Depth16Unorm
|
||||||
| Tf::Depth32Float
|
| Tf::Depth32Float
|
||||||
|
@ -44,7 +44,7 @@ pub fn map_texture_format_failable(format: wgt::TextureFormat) -> Option<dxgifor
|
|||||||
Tf::Rgb9e5Ufloat => DXGI_FORMAT_R9G9B9E5_SHAREDEXP,
|
Tf::Rgb9e5Ufloat => DXGI_FORMAT_R9G9B9E5_SHAREDEXP,
|
||||||
Tf::Rgb10a2Uint => DXGI_FORMAT_R10G10B10A2_UINT,
|
Tf::Rgb10a2Uint => DXGI_FORMAT_R10G10B10A2_UINT,
|
||||||
Tf::Rgb10a2Unorm => DXGI_FORMAT_R10G10B10A2_UNORM,
|
Tf::Rgb10a2Unorm => DXGI_FORMAT_R10G10B10A2_UNORM,
|
||||||
Tf::Rg11b10Float => DXGI_FORMAT_R11G11B10_FLOAT,
|
Tf::Rg11b10UFloat => DXGI_FORMAT_R11G11B10_FLOAT,
|
||||||
Tf::Rg32Uint => DXGI_FORMAT_R32G32_UINT,
|
Tf::Rg32Uint => DXGI_FORMAT_R32G32_UINT,
|
||||||
Tf::Rg32Sint => DXGI_FORMAT_R32G32_SINT,
|
Tf::Rg32Sint => DXGI_FORMAT_R32G32_SINT,
|
||||||
Tf::Rg32Float => DXGI_FORMAT_R32G32_FLOAT,
|
Tf::Rg32Float => DXGI_FORMAT_R32G32_FLOAT,
|
||||||
|
@ -1097,7 +1097,7 @@ impl crate::Adapter for super::Adapter {
|
|||||||
Tf::Rgba8Sint => renderable | storage,
|
Tf::Rgba8Sint => renderable | storage,
|
||||||
Tf::Rgb10a2Uint => renderable,
|
Tf::Rgb10a2Uint => renderable,
|
||||||
Tf::Rgb10a2Unorm => filterable_renderable,
|
Tf::Rgb10a2Unorm => filterable_renderable,
|
||||||
Tf::Rg11b10Float => filterable | float_renderable,
|
Tf::Rg11b10UFloat => filterable | float_renderable,
|
||||||
Tf::Rg32Uint => renderable,
|
Tf::Rg32Uint => renderable,
|
||||||
Tf::Rg32Sint => renderable,
|
Tf::Rg32Sint => renderable,
|
||||||
Tf::Rg32Float => unfilterable | float_renderable | texture_float_linear,
|
Tf::Rg32Float => unfilterable | float_renderable | texture_float_linear,
|
||||||
|
@ -45,7 +45,7 @@ impl super::AdapterShared {
|
|||||||
glow::RGBA,
|
glow::RGBA,
|
||||||
glow::UNSIGNED_INT_2_10_10_10_REV,
|
glow::UNSIGNED_INT_2_10_10_10_REV,
|
||||||
),
|
),
|
||||||
Tf::Rg11b10Float => (
|
Tf::Rg11b10UFloat => (
|
||||||
glow::R11F_G11F_B10F,
|
glow::R11F_G11F_B10F,
|
||||||
glow::RGB,
|
glow::RGB,
|
||||||
glow::UNSIGNED_INT_10F_11F_11F_REV,
|
glow::UNSIGNED_INT_10F_11F_11F_REV,
|
||||||
|
@ -178,7 +178,7 @@ impl crate::Adapter for super::Adapter {
|
|||||||
flags.set(Tfc::STORAGE, pc.format_rgb10a2_unorm_all);
|
flags.set(Tfc::STORAGE, pc.format_rgb10a2_unorm_all);
|
||||||
flags
|
flags
|
||||||
}
|
}
|
||||||
Tf::Rg11b10Float => {
|
Tf::Rg11b10UFloat => {
|
||||||
let mut flags = all_caps;
|
let mut flags = all_caps;
|
||||||
flags.set(Tfc::STORAGE, pc.format_rg11b10_all);
|
flags.set(Tfc::STORAGE, pc.format_rg11b10_all);
|
||||||
flags
|
flags
|
||||||
@ -1036,7 +1036,7 @@ impl super::PrivateCapabilities {
|
|||||||
Tf::Rgba8Sint => RGBA8Sint,
|
Tf::Rgba8Sint => RGBA8Sint,
|
||||||
Tf::Rgb10a2Uint => RGB10A2Uint,
|
Tf::Rgb10a2Uint => RGB10A2Uint,
|
||||||
Tf::Rgb10a2Unorm => RGB10A2Unorm,
|
Tf::Rgb10a2Unorm => RGB10A2Unorm,
|
||||||
Tf::Rg11b10Float => RG11B10Float,
|
Tf::Rg11b10UFloat => RG11B10Float,
|
||||||
Tf::Rg32Uint => RG32Uint,
|
Tf::Rg32Uint => RG32Uint,
|
||||||
Tf::Rg32Sint => RG32Sint,
|
Tf::Rg32Sint => RG32Sint,
|
||||||
Tf::Rg32Float => RG32Float,
|
Tf::Rg32Float => RG32Float,
|
||||||
|
@ -36,7 +36,7 @@ impl super::PrivateCapabilities {
|
|||||||
Tf::Rgba8Sint => F::R8G8B8A8_SINT,
|
Tf::Rgba8Sint => F::R8G8B8A8_SINT,
|
||||||
Tf::Rgb10a2Uint => F::A2B10G10R10_UINT_PACK32,
|
Tf::Rgb10a2Uint => F::A2B10G10R10_UINT_PACK32,
|
||||||
Tf::Rgb10a2Unorm => F::A2B10G10R10_UNORM_PACK32,
|
Tf::Rgb10a2Unorm => F::A2B10G10R10_UNORM_PACK32,
|
||||||
Tf::Rg11b10Float => F::B10G11R11_UFLOAT_PACK32,
|
Tf::Rg11b10UFloat => F::B10G11R11_UFLOAT_PACK32,
|
||||||
Tf::Rg32Uint => F::R32G32_UINT,
|
Tf::Rg32Uint => F::R32G32_UINT,
|
||||||
Tf::Rg32Sint => F::R32G32_SINT,
|
Tf::Rg32Sint => F::R32G32_SINT,
|
||||||
Tf::Rg32Float => F::R32G32_SFLOAT,
|
Tf::Rg32Float => F::R32G32_SFLOAT,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// Lets keep these on one line
|
// Lets keep these on one line
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
pub const TEXTURE_FORMAT_LIST: [wgpu::TextureFormat; 119] = [
|
pub const TEXTURE_FORMAT_LIST: [wgpu::TextureFormat; 116] = [
|
||||||
wgpu::TextureFormat::R8Unorm,
|
wgpu::TextureFormat::R8Unorm,
|
||||||
wgpu::TextureFormat::R8Snorm,
|
wgpu::TextureFormat::R8Snorm,
|
||||||
wgpu::TextureFormat::R8Uint,
|
wgpu::TextureFormat::R8Uint,
|
||||||
@ -29,9 +29,10 @@ pub const TEXTURE_FORMAT_LIST: [wgpu::TextureFormat; 119] = [
|
|||||||
wgpu::TextureFormat::Rgba8Sint,
|
wgpu::TextureFormat::Rgba8Sint,
|
||||||
wgpu::TextureFormat::Bgra8Unorm,
|
wgpu::TextureFormat::Bgra8Unorm,
|
||||||
wgpu::TextureFormat::Bgra8UnormSrgb,
|
wgpu::TextureFormat::Bgra8UnormSrgb,
|
||||||
|
wgpu::TextureFormat::Rgb9e5Ufloat,
|
||||||
wgpu::TextureFormat::Rgb10a2Uint,
|
wgpu::TextureFormat::Rgb10a2Uint,
|
||||||
wgpu::TextureFormat::Rgb10a2Unorm,
|
wgpu::TextureFormat::Rgb10a2Unorm,
|
||||||
wgpu::TextureFormat::Rg11b10Float,
|
wgpu::TextureFormat::Rg11b10UFloat,
|
||||||
wgpu::TextureFormat::Rg32Uint,
|
wgpu::TextureFormat::Rg32Uint,
|
||||||
wgpu::TextureFormat::Rg32Sint,
|
wgpu::TextureFormat::Rg32Sint,
|
||||||
wgpu::TextureFormat::Rg32Float,
|
wgpu::TextureFormat::Rg32Float,
|
||||||
@ -45,14 +46,10 @@ pub const TEXTURE_FORMAT_LIST: [wgpu::TextureFormat; 119] = [
|
|||||||
wgpu::TextureFormat::Rgba32Float,
|
wgpu::TextureFormat::Rgba32Float,
|
||||||
wgpu::TextureFormat::Stencil8,
|
wgpu::TextureFormat::Stencil8,
|
||||||
wgpu::TextureFormat::Depth16Unorm,
|
wgpu::TextureFormat::Depth16Unorm,
|
||||||
wgpu::TextureFormat::Depth32Float,
|
|
||||||
wgpu::TextureFormat::Depth32FloatStencil8,
|
|
||||||
wgpu::TextureFormat::Depth24Plus,
|
wgpu::TextureFormat::Depth24Plus,
|
||||||
wgpu::TextureFormat::Depth24PlusStencil8,
|
wgpu::TextureFormat::Depth24PlusStencil8,
|
||||||
wgpu::TextureFormat::Rgb9e5Ufloat,
|
wgpu::TextureFormat::Depth32Float,
|
||||||
wgpu::TextureFormat::Rgb10a2Uint,
|
wgpu::TextureFormat::Depth32FloatStencil8,
|
||||||
wgpu::TextureFormat::Rgb10a2Unorm,
|
|
||||||
wgpu::TextureFormat::Rg11b10Float,
|
|
||||||
wgpu::TextureFormat::NV12,
|
wgpu::TextureFormat::NV12,
|
||||||
wgpu::TextureFormat::Bc1RgbaUnorm,
|
wgpu::TextureFormat::Bc1RgbaUnorm,
|
||||||
wgpu::TextureFormat::Bc1RgbaUnormSrgb,
|
wgpu::TextureFormat::Bc1RgbaUnormSrgb,
|
||||||
@ -122,6 +119,19 @@ pub const TEXTURE_FORMAT_LIST: [wgpu::TextureFormat; 119] = [
|
|||||||
wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B12x12, channel: wgpu::AstcChannel::Hdr },
|
wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B12x12, channel: wgpu::AstcChannel::Hdr },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_uniqueness_in_texture_format_list() {
|
||||||
|
use std::collections::HashSet;
|
||||||
|
|
||||||
|
let uniq: HashSet<wgpu::TextureFormat> = TEXTURE_FORMAT_LIST.into_iter().collect();
|
||||||
|
let mut duplicated = TEXTURE_FORMAT_LIST.to_vec();
|
||||||
|
uniq.iter().for_each(|u| {
|
||||||
|
let first_occurrence = duplicated.iter().position(|el| u == el).unwrap();
|
||||||
|
duplicated.remove(first_occurrence);
|
||||||
|
});
|
||||||
|
assert_eq!(duplicated, vec![]);
|
||||||
|
}
|
||||||
|
|
||||||
pub fn max_texture_format_string_size() -> usize {
|
pub fn max_texture_format_string_size() -> usize {
|
||||||
TEXTURE_FORMAT_LIST
|
TEXTURE_FORMAT_LIST
|
||||||
.into_iter()
|
.into_iter()
|
||||||
|
@ -399,7 +399,7 @@ bitflags::bitflags! {
|
|||||||
const SHADER_F16 = 1 << 8;
|
const SHADER_F16 = 1 << 8;
|
||||||
|
|
||||||
|
|
||||||
/// Allows for usage of textures of format [`TextureFormat::Rg11b10Float`] as a render target
|
/// Allows for usage of textures of format [`TextureFormat::Rg11b10UFloat`] as a render target
|
||||||
///
|
///
|
||||||
/// Supported platforms:
|
/// Supported platforms:
|
||||||
/// - Vulkan
|
/// - Vulkan
|
||||||
@ -2515,7 +2515,7 @@ pub enum TextureFormat {
|
|||||||
/// Red, green, blue, and alpha channels. 10 bit integer for RGB channels, 2 bit integer for alpha channel. [0, 1023] ([0, 3] for alpha) converted to/from float [0, 1] in shader.
|
/// Red, green, blue, and alpha channels. 10 bit integer for RGB channels, 2 bit integer for alpha channel. [0, 1023] ([0, 3] for alpha) converted to/from float [0, 1] in shader.
|
||||||
Rgb10a2Unorm,
|
Rgb10a2Unorm,
|
||||||
/// Red, green, and blue channels. 11 bit float with no sign bit for RG channels. 10 bit float with no sign bit for blue channel. Float in shader.
|
/// Red, green, and blue channels. 11 bit float with no sign bit for RG channels. 10 bit float with no sign bit for blue channel. Float in shader.
|
||||||
Rg11b10Float,
|
Rg11b10UFloat,
|
||||||
|
|
||||||
// Normal 64 bit formats
|
// Normal 64 bit formats
|
||||||
/// Red and green channels. 32 bit integer per channel. Unsigned in shader.
|
/// Red and green channels. 32 bit integer per channel. Unsigned in shader.
|
||||||
@ -2803,7 +2803,7 @@ impl<'de> Deserialize<'de> for TextureFormat {
|
|||||||
"bgra8unorm-srgb" => TextureFormat::Bgra8UnormSrgb,
|
"bgra8unorm-srgb" => TextureFormat::Bgra8UnormSrgb,
|
||||||
"rgb10a2uint" => TextureFormat::Rgb10a2Uint,
|
"rgb10a2uint" => TextureFormat::Rgb10a2Uint,
|
||||||
"rgb10a2unorm" => TextureFormat::Rgb10a2Unorm,
|
"rgb10a2unorm" => TextureFormat::Rgb10a2Unorm,
|
||||||
"rg11b10ufloat" => TextureFormat::Rg11b10Float,
|
"rg11b10ufloat" => TextureFormat::Rg11b10UFloat,
|
||||||
"rg32uint" => TextureFormat::Rg32Uint,
|
"rg32uint" => TextureFormat::Rg32Uint,
|
||||||
"rg32sint" => TextureFormat::Rg32Sint,
|
"rg32sint" => TextureFormat::Rg32Sint,
|
||||||
"rg32float" => TextureFormat::Rg32Float,
|
"rg32float" => TextureFormat::Rg32Float,
|
||||||
@ -2931,7 +2931,7 @@ impl Serialize for TextureFormat {
|
|||||||
TextureFormat::Bgra8UnormSrgb => "bgra8unorm-srgb",
|
TextureFormat::Bgra8UnormSrgb => "bgra8unorm-srgb",
|
||||||
TextureFormat::Rgb10a2Uint => "rgb10a2uint",
|
TextureFormat::Rgb10a2Uint => "rgb10a2uint",
|
||||||
TextureFormat::Rgb10a2Unorm => "rgb10a2unorm",
|
TextureFormat::Rgb10a2Unorm => "rgb10a2unorm",
|
||||||
TextureFormat::Rg11b10Float => "rg11b10ufloat",
|
TextureFormat::Rg11b10UFloat => "rg11b10ufloat",
|
||||||
TextureFormat::Rg32Uint => "rg32uint",
|
TextureFormat::Rg32Uint => "rg32uint",
|
||||||
TextureFormat::Rg32Sint => "rg32sint",
|
TextureFormat::Rg32Sint => "rg32sint",
|
||||||
TextureFormat::Rg32Float => "rg32float",
|
TextureFormat::Rg32Float => "rg32float",
|
||||||
@ -3161,7 +3161,7 @@ impl TextureFormat {
|
|||||||
| Self::Rgb9e5Ufloat
|
| Self::Rgb9e5Ufloat
|
||||||
| Self::Rgb10a2Uint
|
| Self::Rgb10a2Uint
|
||||||
| Self::Rgb10a2Unorm
|
| Self::Rgb10a2Unorm
|
||||||
| Self::Rg11b10Float
|
| Self::Rg11b10UFloat
|
||||||
| Self::Rg32Uint
|
| Self::Rg32Uint
|
||||||
| Self::Rg32Sint
|
| Self::Rg32Sint
|
||||||
| Self::Rg32Float
|
| Self::Rg32Float
|
||||||
@ -3266,7 +3266,7 @@ impl TextureFormat {
|
|||||||
| Self::Rgb9e5Ufloat
|
| Self::Rgb9e5Ufloat
|
||||||
| Self::Rgb10a2Uint
|
| Self::Rgb10a2Uint
|
||||||
| Self::Rgb10a2Unorm
|
| Self::Rgb10a2Unorm
|
||||||
| Self::Rg11b10Float
|
| Self::Rg11b10UFloat
|
||||||
| Self::Rg32Uint
|
| Self::Rg32Uint
|
||||||
| Self::Rg32Sint
|
| Self::Rg32Sint
|
||||||
| Self::Rg32Float
|
| Self::Rg32Float
|
||||||
@ -3384,7 +3384,7 @@ impl TextureFormat {
|
|||||||
Self::Bgra8UnormSrgb => (msaa_resolve, attachment),
|
Self::Bgra8UnormSrgb => (msaa_resolve, attachment),
|
||||||
Self::Rgb10a2Uint => ( msaa, attachment),
|
Self::Rgb10a2Uint => ( msaa, attachment),
|
||||||
Self::Rgb10a2Unorm => (msaa_resolve, attachment),
|
Self::Rgb10a2Unorm => (msaa_resolve, attachment),
|
||||||
Self::Rg11b10Float => ( msaa, rg11b10f),
|
Self::Rg11b10UFloat => ( msaa, rg11b10f),
|
||||||
Self::Rg32Uint => ( noaa, all_flags),
|
Self::Rg32Uint => ( noaa, all_flags),
|
||||||
Self::Rg32Sint => ( noaa, all_flags),
|
Self::Rg32Sint => ( noaa, all_flags),
|
||||||
Self::Rg32Float => ( noaa, all_flags),
|
Self::Rg32Float => ( noaa, all_flags),
|
||||||
@ -3494,7 +3494,7 @@ impl TextureFormat {
|
|||||||
| Self::Rg16Float
|
| Self::Rg16Float
|
||||||
| Self::Rgba16Float
|
| Self::Rgba16Float
|
||||||
| Self::Rgb10a2Unorm
|
| Self::Rgb10a2Unorm
|
||||||
| Self::Rg11b10Float => Some(float),
|
| Self::Rg11b10UFloat => Some(float),
|
||||||
|
|
||||||
Self::R32Float | Self::Rg32Float | Self::Rgba32Float => Some(float32_sample_type),
|
Self::R32Float | Self::Rg32Float | Self::Rgba32Float => Some(float32_sample_type),
|
||||||
|
|
||||||
@ -3624,7 +3624,7 @@ impl TextureFormat {
|
|||||||
| Self::Rg16Sint
|
| Self::Rg16Sint
|
||||||
| Self::Rg16Float => Some(4),
|
| Self::Rg16Float => Some(4),
|
||||||
Self::R32Uint | Self::R32Sint | Self::R32Float => Some(4),
|
Self::R32Uint | Self::R32Sint | Self::R32Float => Some(4),
|
||||||
Self::Rgb9e5Ufloat | Self::Rgb10a2Uint | Self::Rgb10a2Unorm | Self::Rg11b10Float => {
|
Self::Rgb9e5Ufloat | Self::Rgb10a2Uint | Self::Rgb10a2Unorm | Self::Rg11b10UFloat => {
|
||||||
Some(4)
|
Some(4)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3726,7 +3726,7 @@ impl TextureFormat {
|
|||||||
| Self::Rg32Float
|
| Self::Rg32Float
|
||||||
| Self::Rgb10a2Uint
|
| Self::Rgb10a2Uint
|
||||||
| Self::Rgb10a2Unorm
|
| Self::Rgb10a2Unorm
|
||||||
| Self::Rg11b10Float => Some(8),
|
| Self::Rg11b10UFloat => Some(8),
|
||||||
Self::Rgba32Uint | Self::Rgba32Sint | Self::Rgba32Float => Some(16),
|
Self::Rgba32Uint | Self::Rgba32Sint | Self::Rgba32Float => Some(16),
|
||||||
Self::Stencil8
|
Self::Stencil8
|
||||||
| Self::Depth16Unorm
|
| Self::Depth16Unorm
|
||||||
@ -3808,7 +3808,7 @@ impl TextureFormat {
|
|||||||
| Self::Rgba32Float
|
| Self::Rgba32Float
|
||||||
| Self::Rgb10a2Uint
|
| Self::Rgb10a2Uint
|
||||||
| Self::Rgb10a2Unorm
|
| Self::Rgb10a2Unorm
|
||||||
| Self::Rg11b10Float => Some(4),
|
| Self::Rg11b10UFloat => Some(4),
|
||||||
Self::Stencil8
|
Self::Stencil8
|
||||||
| Self::Depth16Unorm
|
| Self::Depth16Unorm
|
||||||
| Self::Depth24Plus
|
| Self::Depth24Plus
|
||||||
@ -3897,7 +3897,7 @@ impl TextureFormat {
|
|||||||
| Self::Rgba32Sint
|
| Self::Rgba32Sint
|
||||||
| Self::Rgba32Float => 4,
|
| Self::Rgba32Float => 4,
|
||||||
|
|
||||||
Self::Rgb9e5Ufloat | Self::Rg11b10Float => 3,
|
Self::Rgb9e5Ufloat | Self::Rg11b10UFloat => 3,
|
||||||
Self::Rgb10a2Uint | Self::Rgb10a2Unorm => 4,
|
Self::Rgb10a2Uint | Self::Rgb10a2Unorm => 4,
|
||||||
|
|
||||||
Self::Stencil8 | Self::Depth16Unorm | Self::Depth24Plus | Self::Depth32Float => 1,
|
Self::Stencil8 | Self::Depth16Unorm | Self::Depth24Plus | Self::Depth32Float => 1,
|
||||||
@ -4112,7 +4112,7 @@ fn texture_format_serialize() {
|
|||||||
"\"rgb10a2unorm\"".to_string()
|
"\"rgb10a2unorm\"".to_string()
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
serde_json::to_string(&TextureFormat::Rg11b10Float).unwrap(),
|
serde_json::to_string(&TextureFormat::Rg11b10UFloat).unwrap(),
|
||||||
"\"rg11b10ufloat\"".to_string()
|
"\"rg11b10ufloat\"".to_string()
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
@ -4409,7 +4409,7 @@ fn texture_format_deserialize() {
|
|||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
serde_json::from_str::<TextureFormat>("\"rg11b10ufloat\"").unwrap(),
|
serde_json::from_str::<TextureFormat>("\"rg11b10ufloat\"").unwrap(),
|
||||||
TextureFormat::Rg11b10Float
|
TextureFormat::Rg11b10UFloat
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
serde_json::from_str::<TextureFormat>("\"rg32uint\"").unwrap(),
|
serde_json::from_str::<TextureFormat>("\"rg32uint\"").unwrap(),
|
||||||
|
@ -261,7 +261,7 @@ fn map_texture_format(texture_format: wgt::TextureFormat) -> webgpu_sys::GpuText
|
|||||||
unimplemented!("Current version of web_sys is missing {texture_format:?}")
|
unimplemented!("Current version of web_sys is missing {texture_format:?}")
|
||||||
}
|
}
|
||||||
TextureFormat::Rgb10a2Unorm => tf::Rgb10a2unorm,
|
TextureFormat::Rgb10a2Unorm => tf::Rgb10a2unorm,
|
||||||
TextureFormat::Rg11b10Float => tf::Rg11b10ufloat,
|
TextureFormat::Rg11b10UFloat => tf::Rg11b10ufloat,
|
||||||
// 64-bit formats
|
// 64-bit formats
|
||||||
TextureFormat::Rg32Uint => tf::Rg32uint,
|
TextureFormat::Rg32Uint => tf::Rg32uint,
|
||||||
TextureFormat::Rg32Sint => tf::Rg32sint,
|
TextureFormat::Rg32Sint => tf::Rg32sint,
|
||||||
|
Loading…
Reference in New Issue
Block a user