@@ -766,7 +766,7 @@ impl<'a, W: Write> Writer<'a, W> {
766
766
write ! ( self . out, "binding = {binding}" ) ?;
767
767
}
768
768
if let Some ( ( format, _) ) = storage_format_access {
769
- let format_str = glsl_storage_format ( format) ;
769
+ let format_str = glsl_storage_format ( format) ? ;
770
770
let separator = match layout_binding {
771
771
Some ( _) => "," ,
772
772
None => "" ,
@@ -1491,7 +1491,7 @@ impl<'a, W: Write> Writer<'a, W> {
1491
1491
..
1492
1492
} = this. module . types [ arg. ty ] . inner
1493
1493
{
1494
- write ! ( this. out, "layout({}) " , glsl_storage_format( format) ) ?;
1494
+ write ! ( this. out, "layout({}) " , glsl_storage_format( format) ? ) ?;
1495
1495
}
1496
1496
1497
1497
// write the type
@@ -4213,10 +4213,10 @@ const fn glsl_dimension(dim: crate::ImageDimension) -> &'static str {
4213
4213
}
4214
4214
4215
4215
/// Helper function that returns the glsl storage format string of [`StorageFormat`](crate::StorageFormat)
4216
- const fn glsl_storage_format ( format : crate :: StorageFormat ) -> & ' static str {
4216
+ fn glsl_storage_format ( format : crate :: StorageFormat ) -> Result < & ' static str , Error > {
4217
4217
use crate :: StorageFormat as Sf ;
4218
4218
4219
- match format {
4219
+ Ok ( match format {
4220
4220
Sf :: R8Unorm => "r8" ,
4221
4221
Sf :: R8Snorm => "r8_snorm" ,
4222
4222
Sf :: R8Uint => "r8ui" ,
@@ -4256,7 +4256,13 @@ const fn glsl_storage_format(format: crate::StorageFormat) -> &'static str {
4256
4256
Sf :: Rg16Snorm => "rg16_snorm" ,
4257
4257
Sf :: Rgba16Unorm => "rgba16" ,
4258
4258
Sf :: Rgba16Snorm => "rgba16_snorm" ,
4259
- }
4259
+
4260
+ Sf :: Bgra8Unorm => {
4261
+ return Err ( Error :: Custom (
4262
+ "Support format BGRA8 is not implemented" . into ( ) ,
4263
+ ) )
4264
+ }
4265
+ } )
4260
4266
}
4261
4267
4262
4268
fn is_value_init_supported ( module : & crate :: Module , ty : Handle < crate :: Type > ) -> bool {
0 commit comments