Skip to content

Use raw-window-handle to tie wgpu with winit#256

Closed
aclysma wants to merge 1 commit intobevyengine:mainfrom
aclysma:use-raw-window-handle
Closed

Use raw-window-handle to tie wgpu with winit#256
aclysma wants to merge 1 commit intobevyengine:mainfrom
aclysma:use-raw-window-handle

Conversation

@aclysma
Copy link
Copy Markdown
Contributor

@aclysma aclysma commented Aug 20, 2020

This makes it possible for other backends like SDL2 to be integrated. https://github.com/aclysma/prototype_bevy_sdl2 demonstrates this being used.

There is some unsafety in wrapping RawWIndowHandle in BevyRawWindowHandle to force it to be Send/Sync. The resources within the RawWindowHandle are raw FFI pointers. On one hand, since they're just pointers there's a good chance they are safe as long as they aren't in practice used from multiple threads - and it does work on macOS. On the other hand, I have not reviewed the API docs in detail for every platform RawWindowHandle is compatible with and those platforms might prohibit using those resources in certain ways from a different thread.

I'm creating this as a draft so that we can discuss if this is a possible approach, or if someone can come up with an alternative. For example, perhaps a handler could be made available to the windowing code so that the wire-up with the rendering API to create the surface can happen immediately in the windowing code.

@karroffel karroffel added C-Feature A new feature, making something new possible C-Dependencies A change to the crates that Bevy depends on A-Windowing Platform-agnostic interface layer to run your app in labels Aug 20, 2020
…ible for other backends like SDL2 to be integrated.
@aclysma aclysma force-pushed the use-raw-window-handle branch from 019769b to eeb795c Compare August 27, 2020 04:52
@aclysma
Copy link
Copy Markdown
Contributor Author

aclysma commented Aug 27, 2020

Rebased to head

@DJMcNab DJMcNab mentioned this pull request Jan 21, 2021
@alice-i-cecile alice-i-cecile added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Feb 17, 2021
Base automatically changed from master to main February 19, 2021 20:44
@DJMcNab DJMcNab removed the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Feb 23, 2021
@cart cart added the S-Pre-Relicense This PR was made before Bevy added the Apache license. Cannot be merged or used for other work label Jul 23, 2021
@mockersf mockersf removed the S-Pre-Relicense This PR was made before Bevy added the Apache license. Cannot be merged or used for other work label Jul 24, 2021
@aclysma
Copy link
Copy Markdown
Contributor Author

aclysma commented Aug 7, 2021

Closing, I heard the renderer rework is using raw window handle directly. In any case, enough time has passed that anyone wanting to implement this probably should start from scratch.

@aclysma aclysma closed this Aug 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Windowing Platform-agnostic interface layer to run your app in C-Dependencies A change to the crates that Bevy depends on C-Feature A new feature, making something new possible

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants