mirror of
https://github.com/gfx-rs/wgpu.git
synced 2025-02-16 17:02:32 +00:00
expose context and display from adapter and device for egl hal (#2860)
This commit is contained in:
parent
6467433ef7
commit
67221ed26c
@ -60,6 +60,7 @@ Bottom level categories:
|
||||
#### Hal
|
||||
|
||||
- Allow access to queue family index in Vulkan hal by @i509VCB in [#2859](https://github.com/gfx-rs/wgpu/pull/2859)
|
||||
- Allow access to the EGLDisplay and EGLContext pointer in Gles hal Adapter and Device by @i509VCB in [#2860](https://github.com/gfx-rs/wgpu/pull/2860)
|
||||
|
||||
### Documentation
|
||||
- Update present_mode docs as most of them don't automatically fall back to Fifo anymore. by @Elabajaba in [#2855](https://github.com/gfx-rs/wgpu/pull/2855)
|
||||
|
@ -282,6 +282,7 @@ fn gl_debug_message_callback(source: u32, gltype: u32, id: u32, severity: u32, m
|
||||
#[derive(Clone, Debug)]
|
||||
struct EglContext {
|
||||
instance: Arc<EglInstance>,
|
||||
version: (i32, i32),
|
||||
display: egl::Display,
|
||||
raw: egl::Context,
|
||||
pbuffer: Option<egl::Surface>,
|
||||
@ -315,7 +316,27 @@ impl AdapterContext {
|
||||
self.egl.is_some()
|
||||
}
|
||||
|
||||
#[cfg(feature = "renderdoc")]
|
||||
/// Returns the EGL instance.
|
||||
///
|
||||
/// This provides access to EGL functions and the ability to load GL and EGL extension functions.
|
||||
pub fn egl_instance(&self) -> Option<&EglInstance> {
|
||||
self.egl.as_ref().map(|egl| &*egl.instance)
|
||||
}
|
||||
|
||||
/// Returns the EGLDisplay corresponding to the adapter context.
|
||||
///
|
||||
/// Returns [`None`] if the adapter was externally created.
|
||||
pub fn raw_display(&self) -> Option<&egl::Display> {
|
||||
self.egl.as_ref().map(|egl| &egl.display)
|
||||
}
|
||||
|
||||
/// Returns the EGL version the adapter context was created with.
|
||||
///
|
||||
/// Returns [`None`] if the adapter was externally created.
|
||||
pub fn egl_version(&self) -> Option<(i32, i32)> {
|
||||
self.egl.as_ref().map(|egl| egl.version)
|
||||
}
|
||||
|
||||
pub fn raw_context(&self) -> *mut raw::c_void {
|
||||
match self.egl {
|
||||
Some(ref egl) => egl.raw.as_ptr(),
|
||||
@ -535,6 +556,7 @@ impl Inner {
|
||||
display,
|
||||
raw: context,
|
||||
pbuffer,
|
||||
version,
|
||||
},
|
||||
version,
|
||||
supports_native_window,
|
||||
@ -888,6 +910,17 @@ impl super::Adapter {
|
||||
egl: None,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn adapter_context(&self) -> &AdapterContext {
|
||||
&self.shared.context
|
||||
}
|
||||
}
|
||||
|
||||
impl super::Device {
|
||||
/// Returns the underlying EGL context.
|
||||
pub fn context(&self) -> &AdapterContext {
|
||||
&self.shared.context
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
Loading…
Reference in New Issue
Block a user