Use latest wgpu
This commit is contained in:
parent
67f8da4b34
commit
0995950526
3 changed files with 13 additions and 19 deletions
|
|
@ -21,9 +21,6 @@ members = [
|
|||
"web",
|
||||
]
|
||||
|
||||
[features]
|
||||
vulkan = ["iced_wgpu/vulkan"]
|
||||
|
||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||
iced_winit = { version = "0.1.0-alpha", path = "winit" }
|
||||
iced_wgpu = { version = "0.1.0-alpha", path = "wgpu" }
|
||||
|
|
|
|||
|
|
@ -7,12 +7,9 @@ description = "A wgpu renderer for Iced"
|
|||
license = "MIT"
|
||||
repository = "https://github.com/hecrj/iced"
|
||||
|
||||
[features]
|
||||
vulkan = ["wgpu/vulkan"]
|
||||
|
||||
[dependencies]
|
||||
iced_native = { version = "0.1.0-alpha", path = "../native" }
|
||||
wgpu = "0.3"
|
||||
wgpu_glyph = "0.4"
|
||||
wgpu = { version = "0.3", git = "https://github.com/gfx-rs/wgpu-rs", rev = "cb25914b95b58fee0dc139b400867e7a731d98f4" }
|
||||
wgpu_glyph = { version = "0.4", git = "https://github.com/hecrj/wgpu_glyph", branch = "improvement/update-wgpu" }
|
||||
raw-window-handle = "0.1"
|
||||
log = "0.4"
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ use iced_native::{renderer::Debugger, Color, Layout, Point, Widget};
|
|||
|
||||
use raw_window_handle::HasRawWindowHandle;
|
||||
use wgpu::{
|
||||
Adapter, CommandEncoderDescriptor, Device, DeviceDescriptor, Extensions,
|
||||
Instance, Limits, PowerPreference, RequestAdapterOptions, Surface,
|
||||
Adapter, BackendBit, CommandEncoderDescriptor, Device, DeviceDescriptor,
|
||||
Extensions, Limits, PowerPreference, Queue, RequestAdapterOptions, Surface,
|
||||
SwapChain, SwapChainDescriptor, TextureFormat, TextureUsage,
|
||||
};
|
||||
use wgpu_glyph::{GlyphBrush, GlyphBrushBuilder, Section};
|
||||
|
|
@ -21,10 +21,10 @@ mod slider;
|
|||
mod text;
|
||||
|
||||
pub struct Renderer {
|
||||
instance: Instance,
|
||||
surface: Surface,
|
||||
adapter: Adapter,
|
||||
device: Device,
|
||||
queue: Queue,
|
||||
quad_pipeline: quad::Pipeline,
|
||||
|
||||
quads: Vec<Quad>,
|
||||
|
|
@ -40,20 +40,20 @@ pub struct Target {
|
|||
|
||||
impl Renderer {
|
||||
pub fn new<W: HasRawWindowHandle>(window: &W) -> Self {
|
||||
let instance = Instance::new();
|
||||
|
||||
let adapter = instance.request_adapter(&RequestAdapterOptions {
|
||||
let adapter = Adapter::request(&RequestAdapterOptions {
|
||||
power_preference: PowerPreference::LowPower,
|
||||
});
|
||||
backends: BackendBit::all(),
|
||||
})
|
||||
.expect("Request adapter");
|
||||
|
||||
let mut device = adapter.request_device(&DeviceDescriptor {
|
||||
let (mut device, queue) = adapter.request_device(&DeviceDescriptor {
|
||||
extensions: Extensions {
|
||||
anisotropic_filtering: false,
|
||||
},
|
||||
limits: Limits { max_bind_groups: 1 },
|
||||
});
|
||||
|
||||
let surface = instance.create_surface(window.raw_window_handle());
|
||||
let surface = Surface::create(window);
|
||||
|
||||
// TODO: Think about font loading strategy
|
||||
// Loading system fonts with fallback may be a good idea
|
||||
|
|
@ -66,10 +66,10 @@ impl Renderer {
|
|||
let quad_pipeline = quad::Pipeline::new(&mut device);
|
||||
|
||||
Self {
|
||||
instance,
|
||||
surface,
|
||||
adapter,
|
||||
device,
|
||||
queue,
|
||||
quad_pipeline,
|
||||
|
||||
quads: Vec::new(),
|
||||
|
|
@ -143,7 +143,7 @@ impl Renderer {
|
|||
)
|
||||
.expect("Draw text");
|
||||
|
||||
self.device.get_queue().submit(&[encoder.finish()]);
|
||||
self.queue.submit(&[encoder.finish()]);
|
||||
}
|
||||
|
||||
fn draw_primitive(&mut self, primitive: &Primitive) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue