smithay icon indicating copy to clipboard operation
smithay copied to clipboard

Can't use `backend.buffer_age()` on winit due to new `bind()` borrowing requirements

Open YaLTeR opened this issue 10 months ago • 4 comments

df08c6f29eb6ebfa2fce6fc374590483bcbaf21a made bind() mutably borrow the backend, making it impossible to get backend.buffer_age() while it is bound. However, when the backend is not bound, buffer_age() returns None. So effectively you can't use the buffer age on winit currently.

YaLTeR avatar Mar 10 '25 11:03 YaLTeR

I think it actually is possible, since the Renderer doesn't unbind when finishing a Frame, but that is still a super ackward api.

Drakulix avatar Mar 10 '25 11:03 Drakulix

If I'm not mistaken, GlesTarget unbinds on Drop, and it is one of the things borrowing the backend from bind(). So I'm not sure it's possible

YaLTeR avatar Mar 10 '25 11:03 YaLTeR

If I'm not mistaken, GlesTarget unbinds on Drop, and it is one of the things borrowing the backend from bind(). So I'm not sure it's possible

No, I am pretty sure it doesn't. It destroys framebuffer objects, but it doesn't call unbind to save instructions, if the user just binds the same framebuffer again next cycle.

Drakulix avatar Mar 10 '25 11:03 Drakulix

https://github.com/Smithay/smithay/pull/1673

Drakulix avatar Mar 10 '25 11:03 Drakulix