Skip to content

Commit

Permalink
Add Rgb10a2Uint format (#2525)
Browse files Browse the repository at this point in the history
  • Loading branch information
teoxoy authored Oct 3, 2023
1 parent 613da72 commit 6668d06
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/back/glsl/features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ impl<'a, W> Writer<'a, W> {
| StorageFormat::Rg16Uint
| StorageFormat::Rg16Sint
| StorageFormat::Rg16Float
| StorageFormat::Rgb10a2Uint
| StorageFormat::Rgb10a2Unorm
| StorageFormat::Rg11b10Float
| StorageFormat::Rg32Uint
Expand Down
3 changes: 2 additions & 1 deletion src/back/glsl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4238,7 +4238,8 @@ const fn glsl_storage_format(format: crate::StorageFormat) -> &'static str {
Sf::Rgba8Snorm => "rgba8_snorm",
Sf::Rgba8Uint => "rgba8ui",
Sf::Rgba8Sint => "rgba8i",
Sf::Rgb10a2Unorm => "rgb10_a2ui",
Sf::Rgb10a2Uint => "rgb10_a2ui",
Sf::Rgb10a2Unorm => "rgb10_a2",
Sf::Rg11b10Float => "r11f_g11f_b10f",
Sf::Rg32Uint => "rg32ui",
Sf::Rg32Sint => "rg32i",
Expand Down
3 changes: 2 additions & 1 deletion src/back/hlsl/conv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ impl crate::StorageFormat {
| Self::Rgba16Uint
| Self::R32Uint
| Self::Rg32Uint
| Self::Rgba32Uint => "uint4",
| Self::Rgba32Uint
| Self::Rgb10a2Uint => "uint4",
Self::Rgba8Sint
| Self::Rgba16Sint
| Self::R32Sint
Expand Down
3 changes: 2 additions & 1 deletion src/back/spv/instructions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1064,7 +1064,8 @@ impl From<crate::StorageFormat> for spirv::ImageFormat {
Sf::Rgba8Snorm => Self::Rgba8Snorm,
Sf::Rgba8Uint => Self::Rgba8ui,
Sf::Rgba8Sint => Self::Rgba8i,
Sf::Rgb10a2Unorm => Self::Rgb10a2ui,
Sf::Rgb10a2Uint => Self::Rgb10a2ui,
Sf::Rgb10a2Unorm => Self::Rgb10A2,
Sf::Rg11b10Float => Self::R11fG11fB10f,
Sf::Rg32Uint => Self::Rg32ui,
Sf::Rg32Sint => Self::Rg32i,
Expand Down
1 change: 1 addition & 0 deletions src/back/wgsl/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1830,6 +1830,7 @@ const fn storage_format_str(format: crate::StorageFormat) -> &'static str {
Sf::Rgba8Snorm => "rgba8snorm",
Sf::Rgba8Uint => "rgba8uint",
Sf::Rgba8Sint => "rgba8sint",
Sf::Rgb10a2Uint => "rgb10a2uint",
Sf::Rgb10a2Unorm => "rgb10a2unorm",
Sf::Rg11b10Float => "rg11b10float",
Sf::Rg32Uint => "rg32uint",
Expand Down
1 change: 1 addition & 0 deletions src/front/glsl/parser/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ fn map_image_format(word: &str) -> Option<crate::StorageFormat> {
"r32f" => Sf::R32Float,
"r16f" => Sf::R16Float,
"rgba16" => Sf::Rgba16Unorm,
"rgb10_a2ui" => Sf::Rgb10a2Uint,
"rgb10_a2" => Sf::Rgb10a2Unorm,
"rgba8" => Sf::Rgba8Unorm,
"rg16" => Sf::Rg16Unorm,
Expand Down
3 changes: 2 additions & 1 deletion src/front/spv/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ pub(super) fn map_image_format(word: spirv::Word) -> Result<crate::StorageFormat
Some(spirv::ImageFormat::Rgba8Snorm) => Ok(crate::StorageFormat::Rgba8Snorm),
Some(spirv::ImageFormat::Rgba8ui) => Ok(crate::StorageFormat::Rgba8Uint),
Some(spirv::ImageFormat::Rgba8i) => Ok(crate::StorageFormat::Rgba8Sint),
Some(spirv::ImageFormat::Rgb10a2ui) => Ok(crate::StorageFormat::Rgb10a2Unorm),
Some(spirv::ImageFormat::Rgb10a2ui) => Ok(crate::StorageFormat::Rgb10a2Uint),
Some(spirv::ImageFormat::Rgb10A2) => Ok(crate::StorageFormat::Rgb10a2Unorm),
Some(spirv::ImageFormat::R11fG11fB10f) => Ok(crate::StorageFormat::Rg11b10Float),
Some(spirv::ImageFormat::Rg32ui) => Ok(crate::StorageFormat::Rg32Uint),
Some(spirv::ImageFormat::Rg32i) => Ok(crate::StorageFormat::Rg32Sint),
Expand Down
1 change: 1 addition & 0 deletions src/front/wgsl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ impl crate::StorageFormat {
Sf::Rgba8Snorm => "rgba8snorm",
Sf::Rgba8Uint => "rgba8uint",
Sf::Rgba8Sint => "rgba8sint",
Sf::Rgb10a2Uint => "rgb10a2uint",
Sf::Rgb10a2Unorm => "rgb10a2unorm",
Sf::Rg11b10Float => "rg11b10float",
Sf::Rg32Uint => "rg32uint",
Expand Down
1 change: 1 addition & 0 deletions src/front/wgsl/parse/conv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ pub fn map_storage_format(word: &str, span: Span) -> Result<crate::StorageFormat
"rgba8snorm" => Sf::Rgba8Snorm,
"rgba8uint" => Sf::Rgba8Uint,
"rgba8sint" => Sf::Rgba8Sint,
"rgb10a2uint" => Sf::Rgb10a2Uint,
"rgb10a2unorm" => Sf::Rgb10a2Unorm,
"rg11b10float" => Sf::Rg11b10Float,
"rg32uint" => Sf::Rg32Uint,
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,7 @@ pub enum StorageFormat {
Rgba8Sint,

// Packed 32-bit formats
Rgb10a2Uint,
Rgb10a2Unorm,
Rg11b10Float,

Expand Down
1 change: 1 addition & 0 deletions src/proc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ impl From<super::StorageFormat> for super::ScalarKind {
Sf::Rgba8Snorm => Sk::Float,
Sf::Rgba8Uint => Sk::Uint,
Sf::Rgba8Sint => Sk::Sint,
Sf::Rgb10a2Uint => Sk::Uint,
Sf::Rgb10a2Unorm => Sk::Float,
Sf::Rg11b10Float => Sk::Float,
Sf::Rg32Uint => Sk::Uint,
Expand Down

0 comments on commit 6668d06

Please sign in to comment.