Encounter Self-referential type when using winit(>= 0.30) Window and wgpu's Surface
#6005
Replies: 1 comment 1 reply
-
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
cwfitzgerald
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all! I am maintaining a Direct Volume Rendering(DVR) app which depends on
wgpuandwinit. When I tried to update my app to usewinit>= 0.30, I was stuck in the problem of self reference. Do you have any ideas to resolve this?A bit of background:
winitdecided to make their event handling APIs to be trait-based. In its documentation, the example needs to store awindow: Option<Windows>forresumemethod and requesting redraws.https://github.com/rust-windowing/winit/blob/73c01fff96266a6a7d9159e9bd26acc00df0bbc9/src/lib.rs#L79
Surfacehas a reference to a window, in the case of my app, towinit::Windowhttps://docs.rs/wgpu/22.0.0/src/wgpu/lib.rs.html#584-606
In my case, I need these in my App states:
window: winit::Windowto request redraw and get its size if the window's scaling factor gets changed.surface: wgpu: Surface<'window>to useSurface::get_current_texturebefore doing the actual rendering.I can use
ouroborosto create self-referential types but I don't know what will happen if aWindowgot replaced by another duringwinit::application::ApplicationHandler::resumed.So I have actually 3 questions, which may be issues when using wgpu and winit in combo:
winit::Windowandwgpu::Surface<'window>together?winit::Windowgets replaced duringwinit::application::ApplicationHandler::resumed?Further references:
mainbranch works withwgpu 22.0.0andwinit 0.29winit0.30branch fails compilation due to self reference.....Beta Was this translation helpful? Give feedback.
All reactions