@@ -12,8 +12,7 @@ use glass::{
1212use wgpu:: {
1313 Backends , BindGroup , BindGroupDescriptor , CommandBuffer , CommandEncoder , ComputePassDescriptor ,
1414 ComputePipeline , ComputePipelineDescriptor , Extent3d , InstanceFlags , Limits , MemoryHints ,
15- PowerPreference , PresentMode , PushConstantRange , ShaderStages , StorageTextureAccess , StoreOp ,
16- TextureFormat , TextureUsages ,
15+ PowerPreference , PresentMode , StorageTextureAccess , StoreOp , TextureFormat , TextureUsages ,
1716} ;
1817use winit:: {
1918 event:: { ElementState , MouseButton , WindowEvent } ,
@@ -37,10 +36,10 @@ fn config() -> GlassConfig {
3736 device_config : DeviceConfig {
3837 power_preference : PowerPreference :: HighPerformance ,
3938 memory_hints : MemoryHints :: Performance ,
40- features : wgpu:: Features :: PUSH_CONSTANTS
39+ features : wgpu:: Features :: IMMEDIATES
4140 | wgpu:: Features :: TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES ,
4241 limits : Limits {
43- max_push_constant_size : 128 ,
42+ max_immediate_size : 128 ,
4443 ..Limits :: default ( )
4544 } ,
4645 backends : Backends :: all ( ) ,
@@ -107,12 +106,9 @@ impl GlassApp for GameOfLifeApp {
107106 fn update ( & mut self , context : & mut GlassContext ) {
108107 run_update ( self , context) ;
109108
110- context. primary_render_window ( ) . render_default (
111- context. device ( ) ,
112- context. queue ( ) ,
113- self ,
114- render,
115- ) ;
109+ context
110+ . primary_render_window_mut ( )
111+ . render_default ( self , render) ;
116112 }
117113}
118114
@@ -240,6 +236,7 @@ fn render(app: &mut GameOfLifeApp, render_data: RenderData) -> Option<Vec<Comman
240236 depth_stencil_attachment : None ,
241237 timestamp_writes : None ,
242238 occlusion_query_set : None ,
239+ multiview_mask : None ,
243240 } ) ;
244241 quad_pipeline. draw (
245242 & mut rpass,
@@ -297,7 +294,7 @@ fn draw_game_of_life(
297294 let pc = GameOfLifePushConstants :: new ( start, end, 10.0 ) ;
298295 cpass. set_pipeline ( draw_pipeline) ;
299296 cpass. set_bind_group ( 0 , & data. draw_bind_group , & [ ] ) ;
300- cpass. set_push_constants ( 0 , bytemuck:: cast_slice ( & [ pc] ) ) ;
297+ cpass. set_immediates ( 0 , bytemuck:: cast_slice ( & [ pc] ) ) ;
301298 cpass. dispatch_workgroups ( WIDTH / 8 , HEIGHT / 8 , 1 ) ;
302299}
303300
@@ -339,7 +336,7 @@ fn update_game_of_life(
339336 let pc = GameOfLifePushConstants :: new ( Vec2 :: ZERO , Vec2 :: ZERO , 0.0 ) ;
340337 cpass. set_pipeline ( game_of_life_pipeline) ;
341338 cpass. set_bind_group ( 0 , & update_bind_group, & [ ] ) ;
342- cpass. set_push_constants ( 0 , bytemuck:: cast_slice ( & [ pc] ) ) ;
339+ cpass. set_immediates ( 0 , bytemuck:: cast_slice ( & [ pc] ) ) ;
343340 cpass. dispatch_workgroups ( WIDTH / 8 , HEIGHT / 8 , 1 ) ;
344341
345342 app. count += 1 ;
@@ -366,7 +363,7 @@ fn init_game_of_life(app: &mut GameOfLifeApp, context: &GlassContext) {
366363 } ) ;
367364 cpass. set_pipeline ( init_pipeline) ;
368365 cpass. set_bind_group ( 0 , & data. init_bind_group , & [ ] ) ;
369- cpass. set_push_constants (
366+ cpass. set_immediates (
370367 0 ,
371368 bytemuck:: cast_slice ( & [ GameOfLifePushConstants :: new ( Vec2 :: ZERO , Vec2 :: ZERO , 0.0 ) ] ) ,
372369 ) ;
@@ -535,11 +532,8 @@ fn create_game_of_life_pipeline(
535532 . device ( )
536533 . create_pipeline_layout ( & wgpu:: PipelineLayoutDescriptor {
537534 label : Some ( "Game of Life Init Layout" ) ,
538- bind_group_layouts : & [ & bg_layout] ,
539- push_constant_ranges : & [ PushConstantRange {
540- stages : ShaderStages :: COMPUTE ,
541- range : 0 ..std:: mem:: size_of :: < GameOfLifePushConstants > ( ) as u32 ,
542- } ] ,
535+ bind_group_layouts : & [ Some ( & bg_layout) ] ,
536+ immediate_size : size_of :: < GameOfLifePushConstants > ( ) as u32 ,
543537 } ) ;
544538 let init_pipeline = context
545539 . device ( )
@@ -557,11 +551,8 @@ fn create_game_of_life_pipeline(
557551 . device ( )
558552 . create_pipeline_layout ( & wgpu:: PipelineLayoutDescriptor {
559553 label : Some ( "Game of Life Layout" ) ,
560- bind_group_layouts : & [ & bg_layout] ,
561- push_constant_ranges : & [ PushConstantRange {
562- stages : ShaderStages :: COMPUTE ,
563- range : 0 ..std:: mem:: size_of :: < GameOfLifePushConstants > ( ) as u32 ,
564- } ] ,
554+ bind_group_layouts : & [ Some ( & bg_layout) ] ,
555+ immediate_size : size_of :: < GameOfLifePushConstants > ( ) as u32 ,
565556 } ) ;
566557 let update_pipeline = context
567558 . device ( )
@@ -578,11 +569,8 @@ fn create_game_of_life_pipeline(
578569 . device ( )
579570 . create_pipeline_layout ( & wgpu:: PipelineLayoutDescriptor {
580571 label : Some ( "Draw Layout" ) ,
581- bind_group_layouts : & [ & dr_layout] ,
582- push_constant_ranges : & [ PushConstantRange {
583- stages : ShaderStages :: COMPUTE ,
584- range : 0 ..std:: mem:: size_of :: < GameOfLifePushConstants > ( ) as u32 ,
585- } ] ,
572+ bind_group_layouts : & [ Some ( & dr_layout) ] ,
573+ immediate_size : size_of :: < GameOfLifePushConstants > ( ) as u32 ,
586574 } ) ;
587575 let draw_pipeline = context
588576 . device ( )
0 commit comments