upgrade to wgpu 0.5.0
This commit is contained in:
		
							parent
							
								
									89d72ae044
								
							
						
					
					
						commit
						7b48960d42
					
				| @ -25,7 +25,7 @@ impl OrthographicCamera { | ||||
|             self.near, | ||||
|             self.far, | ||||
|         ); | ||||
|         opengl_to_wgpu_matrix() * projection | ||||
|         projection | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| @ -52,7 +52,7 @@ pub struct PerspectiveCamera { | ||||
| impl PerspectiveCamera { | ||||
|     pub fn get_view_matrix(&self) -> Mat4 { | ||||
|         let projection = Mat4::perspective_rh_gl(self.fov, self.aspect_ratio, self.near, self.far); | ||||
|         opengl_to_wgpu_matrix() * projection | ||||
|         projection | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| @ -116,9 +116,3 @@ impl Camera { | ||||
|         } | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| pub fn opengl_to_wgpu_matrix() -> Mat4 { | ||||
|     Mat4::from_cols_array(&[ | ||||
|         1.0, 0.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.5, 1.0, | ||||
|     ]) | ||||
| } | ||||
|  | ||||
| @ -11,7 +11,7 @@ pub struct SamplerDescriptor { | ||||
|     pub mipmap_filter: FilterMode, | ||||
|     pub lod_min_clamp: f32, | ||||
|     pub lod_max_clamp: f32, | ||||
|     pub compare_function: Option<CompareFunction>, | ||||
|     pub compare_function: CompareFunction, | ||||
| } | ||||
| 
 | ||||
| impl From<&Texture> for SamplerDescriptor { | ||||
| @ -25,7 +25,7 @@ impl From<&Texture> for SamplerDescriptor { | ||||
|             mipmap_filter: FilterMode::Nearest, | ||||
|             lod_min_clamp: -100.0, | ||||
|             lod_max_clamp: 100.0, | ||||
|             compare_function: Some(CompareFunction::Always), | ||||
|             compare_function: CompareFunction::Always, | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -18,7 +18,8 @@ bevy_winit = { path = "../bevy_winit", version = "0.1.0", optional = true } | ||||
| legion = { path = "../bevy_legion" } | ||||
| 
 | ||||
| # render | ||||
| wgpu = { git = "https://github.com/gfx-rs/wgpu-rs.git", rev = "d08f83762426c2c42eda74c7ca9c43d8d950fc0a" } | ||||
| # wgpu = { git = "https://github.com/gfx-rs/wgpu-rs.git", rev = "d08f83762426c2c42eda74c7ca9c43d8d950fc0a" } | ||||
| wgpu = { version = "0.5.0" } | ||||
| 
 | ||||
| futures = "0.3" | ||||
| log = { version = "0.4", features = ["release_max_level_info"] } | ||||
| @ -47,6 +47,7 @@ impl WgpuRenderer { | ||||
|         let adapter = wgpu::Adapter::request( | ||||
|             &wgpu::RequestAdapterOptions { | ||||
|                 power_preference: wgpu::PowerPreference::Default, | ||||
|                 compatible_surface: None, | ||||
|             }, | ||||
|             wgpu::BackendBit::PRIMARY, | ||||
|         ) | ||||
| @ -223,7 +224,7 @@ impl WgpuRenderer { | ||||
|         self.encoder = Some( | ||||
|             self.device | ||||
|                 .borrow() | ||||
|                 .create_command_encoder(&wgpu::CommandEncoderDescriptor { todo: 0 }), | ||||
|                 .create_command_encoder(&wgpu::CommandEncoderDescriptor { label: None }), | ||||
|         ); | ||||
| 
 | ||||
|         let mut render_graph = resources.get_mut::<RenderGraph>().unwrap(); | ||||
| @ -359,7 +360,7 @@ impl Renderer for WgpuRenderer { | ||||
|         self.encoder = Some( | ||||
|             self.device | ||||
|                 .borrow() | ||||
|                 .create_command_encoder(&wgpu::CommandEncoderDescriptor { todo: 0 }), | ||||
|                 .create_command_encoder(&wgpu::CommandEncoderDescriptor { label: None }), | ||||
|         ); | ||||
| 
 | ||||
|         self.update_resource_providers(world, resources); | ||||
| @ -570,6 +571,7 @@ impl Renderer for WgpuRenderer { | ||||
|                 let wgpu_bind_group_layout = | ||||
|                     device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor { | ||||
|                         bindings: bind_group_layout_binding.as_slice(), | ||||
|                         label: None, | ||||
|                     }); | ||||
| 
 | ||||
|                 self.wgpu_resources | ||||
|  | ||||
| @ -118,6 +118,7 @@ impl WgpuResources { | ||||
|                 .get(&bind_group_descriptor.id) | ||||
|                 .unwrap(); | ||||
|             let wgpu_bind_group_descriptor = wgpu::BindGroupDescriptor { | ||||
|                 label: None, | ||||
|                 layout: bind_group_layout, | ||||
|                 bindings: bindings.as_slice(), | ||||
|             }; | ||||
| @ -148,6 +149,7 @@ impl WgpuResources { | ||||
|         buffer_info: BufferInfo, | ||||
|     ) -> RenderResource { | ||||
|         let buffer = device.create_buffer(&wgpu::BufferDescriptor { | ||||
|             label: None, | ||||
|             size: buffer_info.size as u64, | ||||
|             usage: buffer_info.buffer_usage.wgpu_into(), | ||||
|         }); | ||||
| @ -199,8 +201,11 @@ impl WgpuResources { | ||||
|         let device = device_rc.borrow(); | ||||
| 
 | ||||
|         let mut mapped = device.create_buffer_mapped( | ||||
|             buffer_info.size as usize, | ||||
|             buffer_info.buffer_usage.wgpu_into(), | ||||
|             &wgpu::BufferDescriptor { | ||||
|                 size: buffer_info.size as u64, | ||||
|                 usage: buffer_info.buffer_usage.wgpu_into(), | ||||
|                 label: None, | ||||
|             } | ||||
|         ); | ||||
|         setup_data(&mut mapped.data, renderer); | ||||
|         mapped.finish() | ||||
|  | ||||
| @ -216,9 +216,10 @@ impl WgpuFrom<Extent3d> for wgpu::Extent3d { | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| impl WgpuFrom<TextureDescriptor> for wgpu::TextureDescriptor { | ||||
| impl WgpuFrom<TextureDescriptor> for wgpu::TextureDescriptor<'_> { | ||||
|     fn from(texture_descriptor: TextureDescriptor) -> Self { | ||||
|         wgpu::TextureDescriptor { | ||||
|             label: None, | ||||
|             size: texture_descriptor.size.wgpu_into(), | ||||
|             array_layer_count: texture_descriptor.array_layer_count, | ||||
|             mip_level_count: texture_descriptor.mip_level_count, | ||||
| @ -494,7 +495,7 @@ impl WgpuFrom<IndexFormat> for wgpu::IndexFormat { | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| impl WgpuFrom<SamplerDescriptor> for wgpu::SamplerDescriptor<'_> { | ||||
| impl WgpuFrom<SamplerDescriptor> for wgpu::SamplerDescriptor { | ||||
|     fn from(sampler_descriptor: SamplerDescriptor) -> Self { | ||||
|         wgpu::SamplerDescriptor { | ||||
|             address_mode_u: sampler_descriptor.address_mode_u.wgpu_into(), | ||||
| @ -505,7 +506,7 @@ impl WgpuFrom<SamplerDescriptor> for wgpu::SamplerDescriptor<'_> { | ||||
|             mipmap_filter: sampler_descriptor.mipmap_filter.wgpu_into(), | ||||
|             lod_min_clamp: sampler_descriptor.lod_min_clamp, | ||||
|             lod_max_clamp: sampler_descriptor.lod_max_clamp, | ||||
|             compare: sampler_descriptor.compare_function.map(|c| c.wgpu_into()), | ||||
|             compare: sampler_descriptor.compare_function.wgpu_into(), | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Carter Anderson
						Carter Anderson