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
-
Hi all! I am maintaining a Direct Volume Rendering(DVR) app which depends on
wgpu
andwinit
. 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:
winit
decided to make their event handling APIs to be trait-based. In its documentation, the example needs to store awindow: Option<Windows>
forresume
method and requesting redraws.https://github.com/rust-windowing/winit/blob/73c01fff96266a6a7d9159e9bd26acc00df0bbc9/src/lib.rs#L79
Surface
has a reference to a window, in the case of my app, towinit::Window
https://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::Window
to request redraw and get its size if the window's scaling factor gets changed.surface: wgpu: Surface<'window>
to useSurface::get_current_texture
before doing the actual rendering.I can use
ouroboros
to create self-referential types but I don't know what will happen if aWindow
got 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::Window
andwgpu::Surface<'window>
together?winit::Window
gets replaced duringwinit::application::ApplicationHandler::resumed
?Further references:
main
branch works withwgpu 22.0.0
andwinit 0.29
winit0.30
branch fails compilation due to self reference.....Beta Was this translation helpful? Give feedback.
All reactions