1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-30 05:10:03 -04:00

Change Arc<glow::Context> to Rc<glow::Context> (#3598)

This is required for Rust 1.72 (for unknown reasons; see
https://github.com/emilk/egui/pull/3595), but also for updating to glow
0.13, where the `glow::Context` is not longer `Sync+Send`
This commit is contained in:
Emil Ernerfeldt
2023-11-21 17:13:46 +01:00
committed by GitHub
parent e823491240
commit 7abf8afd16
7 changed files with 13 additions and 13 deletions

View File

@@ -64,7 +64,7 @@ pub struct CreationContext<'s> {
///
/// Only available when compiling with the `glow` feature and using [`Renderer::Glow`].
#[cfg(feature = "glow")]
pub gl: Option<std::sync::Arc<glow::Context>>,
pub gl: Option<std::rc::Rc<glow::Context>>,
/// The underlying WGPU render state.
///
@@ -602,7 +602,7 @@ pub struct Frame {
/// A reference to the underlying [`glow`] (OpenGL) context.
#[cfg(feature = "glow")]
pub(crate) gl: Option<std::sync::Arc<glow::Context>>,
pub(crate) gl: Option<std::rc::Rc<glow::Context>>,
/// Can be used to manage GPU resources for custom rendering with WGPU using [`egui::PaintCallback`]s.
#[cfg(feature = "wgpu")]
@@ -674,7 +674,7 @@ impl Frame {
/// To get a [`glow`] context you need to compile with the `glow` feature flag,
/// and run eframe using [`Renderer::Glow`].
#[cfg(feature = "glow")]
pub fn gl(&self) -> Option<&std::sync::Arc<glow::Context>> {
pub fn gl(&self) -> Option<&std::rc::Rc<glow::Context>> {
self.gl.as_ref()
}

View File

@@ -143,7 +143,7 @@ impl EpiIntegration {
native_options: &crate::NativeOptions,
storage: Option<Box<dyn epi::Storage>>,
is_desktop: bool,
#[cfg(feature = "glow")] gl: Option<std::sync::Arc<glow::Context>>,
#[cfg(feature = "glow")] gl: Option<std::rc::Rc<glow::Context>>,
#[cfg(feature = "wgpu")] wgpu_render_state: Option<egui_wgpu::RenderState>,
) -> Self {
let egui_ctx = egui::Context::default();

View File

@@ -163,7 +163,7 @@ impl GlowWinitApp {
let gl = unsafe {
crate::profile_scope!("glow::Context::from_loader_function");
Arc::new(glow::Context::from_loader_function(|s| {
Rc::new(glow::Context::from_loader_function(|s| {
let s = std::ffi::CString::new(s)
.expect("failed to construct C string from string for gl proc address");

View File

@@ -15,7 +15,7 @@ pub(crate) struct WebPainterGlow {
}
impl WebPainterGlow {
pub fn gl(&self) -> &std::sync::Arc<glow::Context> {
pub fn gl(&self) -> &std::rc::Rc<glow::Context> {
self.painter.gl()
}
@@ -24,7 +24,7 @@ impl WebPainterGlow {
let (gl, shader_prefix) =
init_glow_context_from_canvas(&canvas, options.webgl_context_option)?;
let gl = std::sync::Arc::new(gl);
let gl = std::rc::Rc::new(gl);
let painter = egui_glow::Painter::new(gl, shader_prefix, None)
.map_err(|err| format!("Error starting glow painter: {err}"))?;