From 6c2054558551710c2e136ec8839fb82eba7ac068 Mon Sep 17 00:00:00 2001 From: Nicolas Silva Date: Fri, 6 Oct 2023 10:00:31 +0200 Subject: [PATCH] Add StorageFormat::Bgra8Unorm --- src/back/glsl/mod.rs | 1 + src/back/hlsl/conv.rs | 2 +- src/back/spv/instructions.rs | 1 + src/back/wgsl/writer.rs | 1 + src/front/wgsl/mod.rs | 1 + src/lib.rs | 1 + src/proc/mod.rs | 1 + 7 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/back/glsl/mod.rs b/src/back/glsl/mod.rs index ddef6a4c03..1efd42bb91 100644 --- a/src/back/glsl/mod.rs +++ b/src/back/glsl/mod.rs @@ -4238,6 +4238,7 @@ const fn glsl_storage_format(format: crate::StorageFormat) -> &'static str { Sf::Rgba8Snorm => "rgba8_snorm", Sf::Rgba8Uint => "rgba8ui", Sf::Rgba8Sint => "rgba8i", + Sf::Bgra8Unorm => "rgba8", // Note: there is no bgra8 or unknow qualifier to pick here. Sf::Rgb10a2Uint => "rgb10_a2ui", Sf::Rgb10a2Unorm => "rgb10_a2", Sf::Rg11b10Float => "r11f_g11f_b10f", diff --git a/src/back/hlsl/conv.rs b/src/back/hlsl/conv.rs index dcbda3d746..c30863cff4 100644 --- a/src/back/hlsl/conv.rs +++ b/src/back/hlsl/conv.rs @@ -122,7 +122,7 @@ impl crate::StorageFormat { Self::Rg11b10Float => "float3", Self::Rgba16Float | Self::R32Float | Self::Rg32Float | Self::Rgba32Float => "float4", - Self::Rgba8Unorm | Self::Rgba16Unorm | Self::Rgb10a2Unorm => "unorm float4", + Self::Rgba8Unorm | Self::Bgra8Unorm | Self::Rgba16Unorm | Self::Rgb10a2Unorm => "unorm float4", Self::Rgba8Snorm | Self::Rgba16Snorm => "snorm float4", Self::Rgba8Uint diff --git a/src/back/spv/instructions.rs b/src/back/spv/instructions.rs index 86b3fd8656..b963793ad3 100644 --- a/src/back/spv/instructions.rs +++ b/src/back/spv/instructions.rs @@ -1064,6 +1064,7 @@ impl From for spirv::ImageFormat { Sf::Rgba8Snorm => Self::Rgba8Snorm, Sf::Rgba8Uint => Self::Rgba8ui, Sf::Rgba8Sint => Self::Rgba8i, + Sf::Bgra8Unorm => Self::Unknown, Sf::Rgb10a2Uint => Self::Rgb10a2ui, Sf::Rgb10a2Unorm => Self::Rgb10A2, Sf::Rg11b10Float => Self::R11fG11fB10f, diff --git a/src/back/wgsl/writer.rs b/src/back/wgsl/writer.rs index 8f6b4074a3..e41460061d 100644 --- a/src/back/wgsl/writer.rs +++ b/src/back/wgsl/writer.rs @@ -1829,6 +1829,7 @@ const fn storage_format_str(format: crate::StorageFormat) -> &'static str { Sf::Rgba8Snorm => "rgba8snorm", Sf::Rgba8Uint => "rgba8uint", Sf::Rgba8Sint => "rgba8sint", + Sf::Bgra8Unorm => "bgra8unorm", Sf::Rgb10a2Uint => "rgb10a2uint", Sf::Rgb10a2Unorm => "rgb10a2unorm", Sf::Rg11b10Float => "rg11b10float", diff --git a/src/front/wgsl/mod.rs b/src/front/wgsl/mod.rs index 6982e850b1..56834d5d92 100644 --- a/src/front/wgsl/mod.rs +++ b/src/front/wgsl/mod.rs @@ -71,6 +71,7 @@ impl crate::StorageFormat { Sf::Rgba8Snorm => "rgba8snorm", Sf::Rgba8Uint => "rgba8uint", Sf::Rgba8Sint => "rgba8sint", + Sf::Bgra8Unorm => "bgra8unorm", Sf::Rgb10a2Uint => "rgb10a2uint", Sf::Rgb10a2Unorm => "rgb10a2unorm", Sf::Rg11b10Float => "rg11b10float", diff --git a/src/lib.rs b/src/lib.rs index 563325a7d2..93ecaa1ab3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -599,6 +599,7 @@ pub enum StorageFormat { Rgba8Snorm, Rgba8Uint, Rgba8Sint, + Bgra8Unorm, // Packed 32-bit formats Rgb10a2Uint, diff --git a/src/proc/mod.rs b/src/proc/mod.rs index 90fd9500ab..0d12126acb 100644 --- a/src/proc/mod.rs +++ b/src/proc/mod.rs @@ -39,6 +39,7 @@ impl From for super::ScalarKind { Sf::Rgba8Snorm => Sk::Float, Sf::Rgba8Uint => Sk::Uint, Sf::Rgba8Sint => Sk::Sint, + Sf::Bgra8Unorm => Sk::Float, Sf::Rgb10a2Uint => Sk::Uint, Sf::Rgb10a2Unorm => Sk::Float, Sf::Rg11b10Float => Sk::Float,