File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed
crates/bevy_render/src/view/window Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -338,15 +338,24 @@ pub fn create_surfaces(
338
338
// For future HDR output support, we'll need to request a format that supports HDR,
339
339
// but as of wgpu 0.15 that is not yet supported.
340
340
// Prefer sRGB formats for surfaces, but fall back to first available format if no sRGB formats are available.
341
- let mut format = * formats. first ( ) . expect ( "No supported formats for surface" ) ;
341
+ let mut sdr_format = None ;
342
+ let mut hdr_format = None ;
342
343
for available_format in formats {
343
344
// Rgba8UnormSrgb and Bgra8UnormSrgb and the only sRGB formats wgpu exposes that we can use for surfaces.
344
- if available_format == TextureFormat :: Rgba8UnormSrgb
345
- || available_format == TextureFormat :: Bgra8UnormSrgb
345
+ if sdr_format . is_none ( ) && ( available_format == TextureFormat :: Rgba8UnormSrgb
346
+ || available_format == TextureFormat :: Bgra8UnormSrgb )
346
347
{
347
- format = available_format;
348
- break ;
348
+ sdr_format = Some ( available_format) ;
349
349
}
350
+ if hdr_format. is_none ( ) && available_format == TextureFormat :: Rgba16Float
351
+ {
352
+ hdr_format = Some ( available_format) ;
353
+ }
354
+
355
+ }
356
+ let format = hdr_format. or ( sdr_format) . expect ( "No supported formats for surface" ) ;
357
+ if format == TextureFormat :: Rgba16Float {
358
+ bevy_utils:: tracing:: info!( "HDR ENABLED" ) ;
350
359
}
351
360
352
361
let configuration = SurfaceConfiguration {
You can’t perform that action at this time.
0 commit comments