@@ -7,19 +7,18 @@ use bevy_ecs::{
77} ;
88use rhyolite:: {
99 ash:: vk,
10- descriptor:: { DescriptorPool , DescriptorSetWrite , DescriptorSetLayout } ,
10+ descriptor:: { DescriptorPool , DescriptorSetLayout , DescriptorSetWrite } ,
1111 future:: {
1212 run, use_per_frame_state, DisposeContainer , GPUCommandFuture , RenderData , RenderImage ,
1313 RenderRes ,
1414 } ,
15- utils:: { retainer:: Retainer , format:: { ColorSpacePrimaries , ColorSpaceTransferFunction } } ,
15+ utils:: {
16+ format:: { ColorSpacePrimaries , ColorSpaceTransferFunction } ,
17+ retainer:: Retainer ,
18+ } ,
1619 BufferExt , BufferLike , ComputePipeline , HasDevice , ImageViewExt , ImageViewLike , PipelineLayout ,
1720} ;
18- use rhyolite:: {
19- future:: Disposable ,
20- macros:: commands,
21- utils:: format:: ColorSpace ,
22- } ;
21+ use rhyolite:: { future:: Disposable , macros:: commands, utils:: format:: ColorSpace } ;
2322use rhyolite_bevy:: Queues ;
2423
2524use crate :: { CachedPipeline , PipelineCache , ShaderModule , SpecializedShader } ;
@@ -41,7 +40,6 @@ impl FromWorld for ToneMappingPipeline {
4140 let num_frame_in_flight = queues. num_frame_in_flight ( ) ;
4241 let device = queues. device ( ) . clone ( ) ;
4342
44-
4543 let set0 = playout_macro:: layout!( "../../../../../assets/shaders/tone_map.playout" , 0 ) ;
4644 let set0 = DescriptorSetLayout :: new ( device. clone ( ) , & set0, Default :: default ( ) ) . unwrap ( ) ;
4745 let layout = Arc :: new (
@@ -64,7 +62,7 @@ impl FromWorld for ToneMappingPipeline {
6462 pipeline : None ,
6563 display_color_space_transfer_fn : ColorSpaceTransferFunction :: LINEAR ,
6664 desc_pool : Retainer :: new ( desc_pool) ,
67- scene_color_space : ColorSpacePrimaries :: ACES_AP1
65+ scene_color_space : ColorSpacePrimaries :: ACES_AP1 ,
6866 }
6967 }
7068}
@@ -95,31 +93,29 @@ impl ToneMappingPipeline {
9593 self . pipeline = None ;
9694 self . display_color_space_transfer_fn = output_color_space. transfer_function ;
9795 }
98- let pipeline = self
99- . pipeline
100- . get_or_insert_with ( || {
101- let mat = self
102- . scene_color_space
103- . to_color_space ( & output_color_space. primaries ) ;
104- let transfer_function = output_color_space. transfer_function as u32 ;
96+ let pipeline = self . pipeline . get_or_insert_with ( || {
97+ let mat = self
98+ . scene_color_space
99+ . to_color_space ( & output_color_space. primaries ) ;
100+ let transfer_function = output_color_space. transfer_function as u32 ;
105101
106- let shader = asset_server. load ( "shaders/tone_map.comp" ) ;
107- pipeline_cache. add_compute_pipeline (
108- self . layout . clone ( ) ,
109- SpecializedShader :: for_shader ( shader, vk:: ShaderStageFlags :: COMPUTE )
110- . with_const ( 0 , transfer_function)
111- . with_const ( 1 , mat. x_axis . x )
112- . with_const ( 2 , mat. x_axis . y )
113- . with_const ( 3 , mat. x_axis . z )
114- . with_const ( 4 , mat. y_axis . x )
115- . with_const ( 5 , mat. y_axis . y )
116- . with_const ( 6 , mat. y_axis . z )
117- . with_const ( 7 , mat. z_axis . x )
118- . with_const ( 8 , mat. z_axis . y )
119- . with_const ( 9 , mat. z_axis . z )
120- . into ( ) ,
121- )
122- } ) ;
102+ let shader = asset_server. load ( "shaders/tone_map.comp" ) ;
103+ pipeline_cache. add_compute_pipeline (
104+ self . layout . clone ( ) ,
105+ SpecializedShader :: for_shader ( shader, vk:: ShaderStageFlags :: COMPUTE )
106+ . with_const ( 0 , transfer_function)
107+ . with_const ( 1 , mat. x_axis . x )
108+ . with_const ( 2 , mat. x_axis . y )
109+ . with_const ( 3 , mat. x_axis . z )
110+ . with_const ( 4 , mat. y_axis . x )
111+ . with_const ( 5 , mat. y_axis . y )
112+ . with_const ( 6 , mat. y_axis . z )
113+ . with_const ( 7 , mat. z_axis . x )
114+ . with_const ( 8 , mat. z_axis . y )
115+ . with_const ( 9 , mat. z_axis . z )
116+ . into ( ) ,
117+ )
118+ } ) ;
123119 let desc_pool = & mut self . desc_pool ;
124120 commands ! { move
125121 let Some ( pipeline) = pipeline_cache. retrieve( pipeline, shader_assets) else {
0 commit comments