upgrade wgpu
This commit is contained in:
parent
0e63fd3838
commit
75f1362433
@ -78,7 +78,6 @@ impl BaseRenderGraphBuilder for RenderGraph {
|
||||
width: 1,
|
||||
height: 1,
|
||||
},
|
||||
array_layer_count: 1,
|
||||
mip_level_count: 1,
|
||||
sample_count: 1,
|
||||
dimension: TextureDimension::D2,
|
||||
|
@ -3,7 +3,6 @@ use super::{Extent3d, Texture, TextureDimension, TextureFormat, TextureUsage};
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct TextureDescriptor {
|
||||
pub size: Extent3d,
|
||||
pub array_layer_count: u32,
|
||||
pub mip_level_count: u32,
|
||||
pub sample_count: u32,
|
||||
pub dimension: TextureDimension,
|
||||
@ -19,7 +18,6 @@ impl From<&Texture> for TextureDescriptor {
|
||||
width: texture.width as u32,
|
||||
depth: 1,
|
||||
},
|
||||
array_layer_count: 1,
|
||||
mip_level_count: 1,
|
||||
sample_count: 1,
|
||||
dimension: TextureDimension::D2,
|
||||
|
@ -19,8 +19,8 @@ bevy_winit = { path = "../bevy_winit", optional = true }
|
||||
legion = { path = "../bevy_legion" }
|
||||
|
||||
# render
|
||||
# wgpu = { git = "https://github.com/gfx-rs/wgpu-rs.git", rev = "d08f83762426c2c42eda74c7ca9c43d8d950fc0a" }
|
||||
wgpu = { version = "0.5.0" }
|
||||
wgpu = { git = "https://github.com/gfx-rs/wgpu-rs.git", rev = "f79ee512eb3d0cb50390787b58694d627eee6c34" }
|
||||
# wgpu = { version = "0.5.0" }
|
||||
|
||||
futures = "0.3"
|
||||
log = { version = "0.4", features = ["release_max_level_info"] }
|
||||
|
@ -105,7 +105,7 @@ impl WgpuRenderGraphExecutor {
|
||||
node_outputs.extend(local_node_outputs.drain());
|
||||
}
|
||||
|
||||
queue.submit(&command_buffers);
|
||||
queue.submit(command_buffers.drain(..));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ use bevy_window::{WindowCreated, WindowResized, Windows};
|
||||
use legion::prelude::*;
|
||||
use std::{ops::Deref, sync::Arc};
|
||||
pub struct WgpuRenderer {
|
||||
pub instance: wgpu::Instance,
|
||||
pub device: Arc<wgpu::Device>,
|
||||
pub queue: wgpu::Queue,
|
||||
pub window_resized_event_reader: EventReader<WindowResized>,
|
||||
@ -23,26 +24,33 @@ impl WgpuRenderer {
|
||||
window_resized_event_reader: EventReader<WindowResized>,
|
||||
window_created_event_reader: EventReader<WindowCreated>,
|
||||
) -> Self {
|
||||
let adapter = wgpu::Adapter::request(
|
||||
&wgpu::RequestAdapterOptions {
|
||||
power_preference: wgpu::PowerPreference::Default,
|
||||
compatible_surface: None,
|
||||
},
|
||||
wgpu::BackendBit::PRIMARY,
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
let instance = wgpu::Instance::new();
|
||||
let adapter = instance
|
||||
.request_adapter(
|
||||
&wgpu::RequestAdapterOptions {
|
||||
power_preference: wgpu::PowerPreference::Default,
|
||||
compatible_surface: None,
|
||||
},
|
||||
wgpu::BackendBit::PRIMARY,
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
let (device, queue) = adapter
|
||||
.request_device(&wgpu::DeviceDescriptor {
|
||||
extensions: wgpu::Extensions {
|
||||
anisotropic_filtering: false,
|
||||
.request_device(
|
||||
&wgpu::DeviceDescriptor {
|
||||
extensions: wgpu::Extensions {
|
||||
anisotropic_filtering: false,
|
||||
},
|
||||
limits: wgpu::Limits::default(),
|
||||
},
|
||||
limits: wgpu::Limits::default(),
|
||||
})
|
||||
.await;
|
||||
None,
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
let device = Arc::new(device);
|
||||
WgpuRenderer {
|
||||
instance,
|
||||
device,
|
||||
queue,
|
||||
window_resized_event_reader,
|
||||
@ -70,7 +78,7 @@ impl WgpuRenderer {
|
||||
{
|
||||
let winit_windows = resources.get::<bevy_winit::WinitWindows>().unwrap();
|
||||
let winit_window = winit_windows.get_window(window.id).unwrap();
|
||||
let surface = wgpu::Surface::create(winit_window.deref());
|
||||
let surface = unsafe { self.instance.create_surface(winit_window.deref()) };
|
||||
render_resource_context
|
||||
.wgpu_resources
|
||||
.set_window_surface(window.id, surface);
|
||||
|
@ -180,7 +180,6 @@ impl WgpuResources {
|
||||
"created bind group for RenderResourceSet {:?}",
|
||||
render_resource_set_id
|
||||
);
|
||||
log::trace!("{:#?}", bind_group_descriptor);
|
||||
device.create_bind_group(bind_group_descriptor)
|
||||
}
|
||||
|
||||
@ -259,7 +258,7 @@ impl WgpuResources {
|
||||
usage: buffer_info.buffer_usage.wgpu_into(),
|
||||
label: None,
|
||||
});
|
||||
setup_data(&mut mapped.data, render_resources);
|
||||
setup_data(&mut mapped.data(), render_resources);
|
||||
mapped.finish()
|
||||
}
|
||||
|
||||
|
@ -221,7 +221,6 @@ impl WgpuFrom<TextureDescriptor> for wgpu::TextureDescriptor<'_> {
|
||||
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,
|
||||
sample_count: texture_descriptor.sample_count,
|
||||
dimension: texture_descriptor.dimension.wgpu_into(),
|
||||
@ -495,9 +494,10 @@ 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 {
|
||||
label: None,
|
||||
address_mode_u: sampler_descriptor.address_mode_u.wgpu_into(),
|
||||
address_mode_v: sampler_descriptor.address_mode_v.wgpu_into(),
|
||||
address_mode_w: sampler_descriptor.address_mode_w.wgpu_into(),
|
||||
|
@ -10,5 +10,5 @@ bevy_input = { path = "../bevy_input" }
|
||||
bevy_window = { path = "../bevy_window" }
|
||||
legion = { path = "../bevy_legion" }
|
||||
|
||||
winit = { version = "0.22.0" }
|
||||
winit = { version = "0.22.1" }
|
||||
log = { version = "0.4", features = ["release_max_level_info"] }
|
Loading…
Reference in New Issue
Block a user