@@ -91,77 +91,77 @@ impl MyRenderPipelineManager {
9191 ) ?;
9292
9393 let mut pipelines =
94- self
95- . device
96- . create_graphics_pipelines ( vk:: PipelineCache :: null ( ) , & [ vk:: GraphicsPipelineCreateInfo :: default ( )
97- . stages (
98- & [
99- vk:: PipelineShaderStageCreateInfo {
100- module : shader_module,
101- p_name : c"main_vs" . as_ptr ( ) ,
102- stage : vk:: ShaderStageFlags :: VERTEX ,
103- ..Default :: default ( )
104- } ,
105- vk:: PipelineShaderStageCreateInfo {
106- module : shader_module,
107- p_name : c"main_fs" . as_ptr ( ) ,
108- stage : vk:: ShaderStageFlags :: FRAGMENT ,
109- // NOTE(eddyb) this acts like an integration test for specialization constants.
110- p_specialization_info : & vk:: SpecializationInfo :: default ( )
111- . map_entries ( & [ vk:: SpecializationMapEntry :: default ( )
112- . constant_id ( 0x5007 )
113- . offset ( 0 )
114- . size ( 4 ) ] )
115- . data ( & u32:: to_le_bytes (
116- self . sky_fs_spec_id_0x5007_sun_intensity_extra_spec_const_factor ,
117- ) ) ,
118- ..Default :: default ( )
119- } ,
120- ] ,
121- )
122- . vertex_input_state ( & vk:: PipelineVertexInputStateCreateInfo :: default ( ) )
123- . input_assembly_state ( & vk:: PipelineInputAssemblyStateCreateInfo {
124- topology : vk:: PrimitiveTopology :: TRIANGLE_LIST ,
125- ..Default :: default ( )
126- } )
127- . rasterization_state ( & vk:: PipelineRasterizationStateCreateInfo {
128- front_face : vk:: FrontFace :: COUNTER_CLOCKWISE ,
129- line_width : 1.0 ,
130- ..Default :: default ( )
131- } )
132- . multisample_state ( & vk:: PipelineMultisampleStateCreateInfo {
133- rasterization_samples : vk:: SampleCountFlags :: TYPE_1 ,
134- ..Default :: default ( )
135- } )
136- . depth_stencil_state ( & vk:: PipelineDepthStencilStateCreateInfo :: default ( ) )
137- . color_blend_state (
138- & vk:: PipelineColorBlendStateCreateInfo :: default ( )
139- . attachments (
140- & [ vk:: PipelineColorBlendAttachmentState {
141- blend_enable : 0 ,
142- src_color_blend_factor : vk:: BlendFactor :: SRC_COLOR ,
143- dst_color_blend_factor : vk:: BlendFactor :: ONE_MINUS_DST_COLOR ,
144- color_blend_op : vk:: BlendOp :: ADD ,
145- src_alpha_blend_factor : vk:: BlendFactor :: ZERO ,
146- dst_alpha_blend_factor : vk:: BlendFactor :: ZERO ,
147- alpha_blend_op : vk:: BlendOp :: ADD ,
148- color_write_mask : vk:: ColorComponentFlags :: RGBA ,
149- } ] ,
150- ) ,
151- )
152- . dynamic_state (
153- & vk:: PipelineDynamicStateCreateInfo :: default ( )
154- . dynamic_states ( & [ vk:: DynamicState :: VIEWPORT , vk:: DynamicState :: SCISSOR ] ) ,
155- )
156- . viewport_state (
157- & vk:: PipelineViewportStateCreateInfo :: default ( )
158- . scissor_count ( 1 )
159- . viewport_count ( 1 ) ,
160- )
161- . layout ( pipeline_layout)
162- . push_next ( & mut vk:: PipelineRenderingCreateInfo :: default ( ) . color_attachment_formats ( & [ self . color_out_format ] ) )
163- ] , None ) . map_err ( |( _, e) | e)
164- . context ( "Unable to create graphics pipeline" ) ?;
94+ self
95+ . device
96+ . create_graphics_pipelines ( vk:: PipelineCache :: null ( ) , & [ vk:: GraphicsPipelineCreateInfo :: default ( )
97+ . stages (
98+ & [
99+ vk:: PipelineShaderStageCreateInfo {
100+ module : shader_module,
101+ p_name : c"main_vs" . as_ptr ( ) ,
102+ stage : vk:: ShaderStageFlags :: VERTEX ,
103+ ..Default :: default ( )
104+ } ,
105+ vk:: PipelineShaderStageCreateInfo {
106+ module : shader_module,
107+ p_name : c"main_fs" . as_ptr ( ) ,
108+ stage : vk:: ShaderStageFlags :: FRAGMENT ,
109+ // NOTE(eddyb) this acts like an integration test for specialization constants.
110+ p_specialization_info : & vk:: SpecializationInfo :: default ( )
111+ . map_entries ( & [ vk:: SpecializationMapEntry :: default ( )
112+ . constant_id ( 0x5007 )
113+ . offset ( 0 )
114+ . size ( 4 ) ] )
115+ . data ( & u32:: to_le_bytes (
116+ self . sky_fs_spec_id_0x5007_sun_intensity_extra_spec_const_factor ,
117+ ) ) ,
118+ ..Default :: default ( )
119+ } ,
120+ ] ,
121+ )
122+ . vertex_input_state ( & vk:: PipelineVertexInputStateCreateInfo :: default ( ) )
123+ . input_assembly_state ( & vk:: PipelineInputAssemblyStateCreateInfo {
124+ topology : vk:: PrimitiveTopology :: TRIANGLE_LIST ,
125+ ..Default :: default ( )
126+ } )
127+ . rasterization_state ( & vk:: PipelineRasterizationStateCreateInfo {
128+ front_face : vk:: FrontFace :: COUNTER_CLOCKWISE ,
129+ line_width : 1.0 ,
130+ ..Default :: default ( )
131+ } )
132+ . multisample_state ( & vk:: PipelineMultisampleStateCreateInfo {
133+ rasterization_samples : vk:: SampleCountFlags :: TYPE_1 ,
134+ ..Default :: default ( )
135+ } )
136+ . depth_stencil_state ( & vk:: PipelineDepthStencilStateCreateInfo :: default ( ) )
137+ . color_blend_state (
138+ & vk:: PipelineColorBlendStateCreateInfo :: default ( )
139+ . attachments (
140+ & [ vk:: PipelineColorBlendAttachmentState {
141+ blend_enable : 0 ,
142+ src_color_blend_factor : vk:: BlendFactor :: SRC_COLOR ,
143+ dst_color_blend_factor : vk:: BlendFactor :: ONE_MINUS_DST_COLOR ,
144+ color_blend_op : vk:: BlendOp :: ADD ,
145+ src_alpha_blend_factor : vk:: BlendFactor :: ZERO ,
146+ dst_alpha_blend_factor : vk:: BlendFactor :: ZERO ,
147+ alpha_blend_op : vk:: BlendOp :: ADD ,
148+ color_write_mask : vk:: ColorComponentFlags :: RGBA ,
149+ } ] ,
150+ ) ,
151+ )
152+ . dynamic_state (
153+ & vk:: PipelineDynamicStateCreateInfo :: default ( )
154+ . dynamic_states ( & [ vk:: DynamicState :: VIEWPORT , vk:: DynamicState :: SCISSOR ] ) ,
155+ )
156+ . viewport_state (
157+ & vk:: PipelineViewportStateCreateInfo :: default ( )
158+ . scissor_count ( 1 )
159+ . viewport_count ( 1 ) ,
160+ )
161+ . layout ( pipeline_layout)
162+ . push_next ( & mut vk:: PipelineRenderingCreateInfo :: default ( ) . color_attachment_formats ( & [ self . color_out_format ] ) )
163+ ] , None ) . map_err ( |( _, e) | e)
164+ . context ( "Unable to create graphics pipeline" ) ?;
165165
166166 // A single `pipeline_info` results in a single pipeline.
167167 assert_eq ! ( pipelines. len( ) , 1 ) ;
0 commit comments