Skip to content

Commit

Permalink
Add Missing Data to GlContainer
Browse files Browse the repository at this point in the history
Added missing surfman data when creating the GlContainer for `Instance`.
  • Loading branch information
zicklag committed Mar 2, 2020
1 parent c3ca278 commit 9e943dc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/backend/gl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<RwLock<surfman::Device>>,
Expand Down Expand Up @@ -111,7 +111,7 @@ impl GlContainer {
}

#[cfg(feature = "surfman")]
fn set_instance(
fn set_surfman_data(
&mut self,
device: Starc<RwLock<surfman::Device>>,
context: Starc<RwLock<surfman::Context>>,
Expand Down
3 changes: 3 additions & 0 deletions src/backend/gl/src/window/surfman.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@ impl hal::Instance<B> 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]
Expand Down

0 comments on commit 9e943dc

Please sign in to comment.