egl: support grabbing current context and display#1741
Open
Supreeeme wants to merge 3 commits intorust-windowing:masterfrom
Open
egl: support grabbing current context and display#1741Supreeeme wants to merge 3 commits intorust-windowing:masterfrom
Supreeeme wants to merge 3 commits intorust-windowing:masterfrom
Conversation
09dddec to
05184a3
Compare
05184a3 to
19bb537
Compare
kchibisov
requested changes
Feb 24, 2026
Member
kchibisov
left a comment
There was a problem hiding this comment.
In general, if you want to add raw contexts we need to have borrow and owned ways of taking it, and for dropping part, we must just track on creation + in drop how we got the object, in case it was borrowed, we should just ignore dropping.
I'm fine with having it just for EGL.
Comment on lines
+191
to
+212
| let display = unsafe { egl.GetCurrentDisplay() }; | ||
| let version = unsafe { egl.QueryString(display, egl::VERSION as EGLint) }; | ||
| if version.is_null() { | ||
| return Err(ErrorKind::BadDisplay.into()); | ||
| } | ||
| // Version string is "<major>.<minor> <vendor info>" | ||
| let version = unsafe { CStr::from_ptr(version) }.to_string_lossy(); | ||
| let (major, rest) = version.split_once('.').unwrap(); | ||
| let major: u8 = major.parse().unwrap(); | ||
| let minor = rest.split(' ').next().unwrap(); | ||
| let minor: u8 = minor.parse().unwrap(); | ||
| let version = Version::new(major, minor); | ||
|
|
||
| let display_extensions = get_extensions(egl, display); | ||
| let features = Self::extract_display_features(&display_extensions, version); | ||
| let inner = Arc::new(DisplayInner { | ||
| egl, | ||
| raw: EglDisplay::Ext(display), | ||
| _native_display: None, | ||
| version, | ||
| display_extensions, | ||
| features, |
Member
There was a problem hiding this comment.
This should follow display creation logic to some extent, I think.
| fn raw_context(&self) -> RawContext { | ||
| *self | ||
| } | ||
| } |
Member
There was a problem hiding this comment.
It was missing intentionally.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CHANGELOG.mdif knowledge of this change could be valuable to usersOpen questions: