fix new API use for android example

This commit is contained in:
Chad Brokaw 2022-07-14 15:03:27 -04:00
parent 8de34f8728
commit 58721dc5c2

View file

@ -13,8 +13,8 @@ use ndk::native_window::NativeWindow;
use ndk_glue::Event;
use piet_gpu_hal::{
CmdBuf, Error, ImageLayout, Instance, QueryPool, Semaphore, Session, SubmittedCmdBuf, Surface,
Swapchain,
CmdBuf, Error, ImageLayout, Instance, InstanceFlags, QueryPool, Semaphore, Session,
SubmittedCmdBuf, Surface, Swapchain,
};
use piet::kurbo::Point;
@ -54,9 +54,9 @@ fn my_main() -> Result<(), Error> {
let width = window.width() as usize;
let height = window.height() as usize;
let handle = get_handle(window);
let (instance, surface) = Instance::new(Some(&handle), Default::default())?;
gfx_state =
Some(GfxState::new(&instance, surface.as_ref(), width, height)?);
let instance = Instance::new(InstanceFlags::PRESENT)?;
let surface = instance.surface(&handle)?;
gfx_state = Some(GfxState::new(&instance, Some(&surface), width, height)?);
} else {
println!("native window is sadly none");
}
@ -100,7 +100,7 @@ impl GfxState {
height: usize,
) -> Result<GfxState, Error> {
unsafe {
let device = instance.device(surface)?;
let device = instance.device()?;
let swapchain = instance.swapchain(width, height, &device, surface.unwrap())?;
let session = Session::new(device);
let current_frame = 0;