From 0dfb1115d25ae6fab7d0a69e39017c0af7504c41 Mon Sep 17 00:00:00 2001 From: i509VCB Date: Sun, 10 Jul 2022 17:49:53 -0500 Subject: [PATCH] document Adapter::new_external in wgpu-hal (#2863) --- CHANGELOG.md | 4 ++++ wgpu-hal/src/gles/egl.rs | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e3806b3c2..1d5951b04d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -65,6 +65,10 @@ Bottom level categories: ### 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) +#### Hal + +- Document safety requirements for `Adapter::from_external` in gles hal by @i509VCB in [#2863](https://github.com/gfx-rs/wgpu/pull/2863) + ## wgpu-0.13.1 (2022-07-02) ### Bug Fixes diff --git a/wgpu-hal/src/gles/egl.rs b/wgpu-hal/src/gles/egl.rs index a10c944449..50b9929244 100644 --- a/wgpu-hal/src/gles/egl.rs +++ b/wgpu-hal/src/gles/egl.rs @@ -873,6 +873,13 @@ impl crate::Instance for Instance { } impl super::Adapter { + /// Creates a new external adapter using the specified loader function. + /// + /// # Safety + /// + /// - The underlying OpenGL ES context must be current. + /// - The underlying OpenGL ES context must be current when interfacing with any objects returned by + /// wgpu-hal from this adapter. pub unsafe fn new_external( fun: impl FnMut(&str) -> *const ffi::c_void, ) -> Option> {