glutin icon indicating copy to clipboard operation
glutin copied to clipboard

Allow context sharing for headless contexts on MacOS

Open bschwind opened this issue 3 years ago • 4 comments

  • [x] Tested on all platforms changed
  • [x] Compilation warnings were addressed
  • [x] cargo fmt has been run on this branch
  • [x] cargo doc builds successfully
  • [x] Added an entry to CHANGELOG.md if knowledge of this change could be valuable to users
  • [x] Updated documentation to reflect any user-facing changes, including notes of platform-specific behavior
  • [x] Created or updated an example program if it would help users understand this functionality

Original issue: #899

This was originally implemented in https://github.com/rust-windowing/glutin/pull/1132, however sharing support was never added for headless contexts. This is essentially the same change as before, just in new_headless.

I tested this in a company application which uses multi-threaded OpenGL contexts with texture sharing, and this change fixed an issue I was having. However, in master before this change, cargo run --example sharing just showed a black screen. It also showed a black screen after this change, so I can't claim the example runs correctly. There's some other issue for MacOS at play for that.

bschwind avatar Oct 13 '20 07:10 bschwind

Hi, I've rebased the PR on current master, added a Changelog entry, and @bschwind was kind to test it on a Mac.

Could somebody with permissions please approve the CI run and consider merging this? Thanks!

strohel avatar Sep 13 '21 09:09 strohel

I don't have the means to test this myself, so I'd be merging partially blind right now. As you said, @bschwind, the PR is pretty much identical to #1132, so I'd expect it to work based on that, but I'd really like more than one person to confirm that the fix works.

If either of @mcginty @xiaopengli89 could get a repro on the bug and fix (I see you two have given this PR a "👍"), then that would help soothe my worries.

maroider avatar Sep 13 '21 11:09 maroider

Full disclosure: me, @bschwind and @mcginty work together in the same company (tonari).

strohel avatar Sep 13 '21 11:09 strohel

Hi @maroider I've rebased on the latest master branch and can confirm this still works on MacOS, though I understand if you want others to test too.

bschwind avatar Feb 04 '22 08:02 bschwind

The context sharing is enabled on macOS, however headless was removed in some sense, but you can create a context without a window, so it might be fine?

kchibisov avatar Sep 03 '22 06:09 kchibisov

@kchibisov I see things have changed a bit since I submitted this PR.

I'll test out shared contexts on MacOS when I get the chance. If I can create a context without a window, I think that will suffice for my usage.

Edit: Tested it out, context sharing seems to work well on MacOS!

bschwind avatar Sep 03 '22 06:09 bschwind