From 9e943dc90cc643bd9a3f83db939e4e5669939786 Mon Sep 17 00:00:00 2001 From: Zicklag Date: Sun, 1 Mar 2020 20:12:15 -0600 Subject: [PATCH] Add Missing Data to GlContainer Added missing surfman data when creating the GlContainer for `Instance`. --- src/backend/gl/src/lib.rs | 4 ++-- src/backend/gl/src/window/surfman.rs | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/backend/gl/src/lib.rs b/src/backend/gl/src/lib.rs index e23061b69ed..fe46336c5e5 100644 --- a/src/backend/gl/src/lib.rs +++ b/src/backend/gl/src/lib.rs @@ -76,7 +76,7 @@ type ColorSlot = u8; pub(crate) struct GlContainer { context: GlContext, - /// In order to set the current context we must have access to the instance + /// In order to set the current context we must have access the surfman device and context #[cfg(feature = "surfman")] surfman_data: Option<( Starc>, @@ -111,7 +111,7 @@ impl GlContainer { } #[cfg(feature = "surfman")] - fn set_instance( + fn set_surfman_data( &mut self, device: Starc>, context: Starc>, diff --git a/src/backend/gl/src/window/surfman.rs b/src/backend/gl/src/window/surfman.rs index c6185ee0253..23cd66ff4f0 100644 --- a/src/backend/gl/src/window/surfman.rs +++ b/src/backend/gl/src/window/surfman.rs @@ -174,6 +174,9 @@ impl hal::Instance for Instance { .get_proc_address(&self.context, symbol_name) as *const _ }); + // Add extra surfman data so that the GlContainer make the context current when it needs to + gl.set_surfman_data(self.device.clone(), self.context.clone()); + // Create physical device let adapter = PhysicalDevice::new_adapter((), gl); vec![adapter]