@@ -23,7 +23,7 @@ use bevy::{
23
23
VertexBufferLayout , VertexFormat , VertexState , VertexStepMode ,
24
24
} ,
25
25
texture:: BevyDefault ,
26
- view:: { ComputedVisibility , Msaa , VisibleEntities } ,
26
+ view:: { ComputedVisibility , ExtractedView , Msaa , ViewTarget , VisibleEntities } ,
27
27
Extract , RenderApp , RenderStage ,
28
28
} ,
29
29
sprite:: {
@@ -86,7 +86,11 @@ impl SpecializedRenderPipeline for ShapePipeline {
86
86
shader_defs : Vec :: new ( ) ,
87
87
entry_point : "fragment" . into ( ) ,
88
88
targets : vec ! [ Some ( ColorTargetState {
89
- format: TextureFormat :: bevy_default( ) ,
89
+ format: if key. contains( Mesh2dPipelineKey :: HDR ) {
90
+ ViewTarget :: TEXTURE_FORMAT_HDR
91
+ } else {
92
+ TextureFormat :: bevy_default( )
93
+ } ,
90
94
blend: Some ( BlendState :: ALPHA_BLENDING ) ,
91
95
write_mask: ColorWrites :: ALL ,
92
96
} ) ] ,
@@ -185,19 +189,24 @@ fn queue_shape(
185
189
msaa : Res < Msaa > ,
186
190
render_meshes : Res < RenderAssets < Mesh > > ,
187
191
shape : Query < ( & Mesh2dHandle , & Mesh2dUniform ) , With < Shape > > ,
188
- mut views : Query < ( & VisibleEntities , & mut RenderPhase < Transparent2d > ) > ,
192
+ mut views : Query < (
193
+ & ExtractedView ,
194
+ & VisibleEntities ,
195
+ & mut RenderPhase < Transparent2d > ,
196
+ ) > ,
189
197
) {
190
198
if shape. is_empty ( ) {
191
199
return ;
192
200
}
193
201
// Iterate each view (a camera is a view)
194
- for ( visible_entities, mut transparent_phase) in views. iter_mut ( ) {
202
+ for ( view , visible_entities, mut transparent_phase) in views. iter_mut ( ) {
195
203
let draw_shape = transparent_draw_functions
196
204
. read ( )
197
205
. get_id :: < DrawShape > ( )
198
206
. unwrap ( ) ;
199
207
200
- let mesh_key = Mesh2dPipelineKey :: from_msaa_samples ( msaa. samples ) ;
208
+ let mesh_key = Mesh2dPipelineKey :: from_msaa_samples ( msaa. samples )
209
+ | Mesh2dPipelineKey :: from_hdr ( view. hdr ) ;
201
210
202
211
// Queue all entities visible to that view
203
212
for visible_entity in & visible_entities. entities {
0 commit comments