diff --git a/egui_glium/src/painter.rs b/egui_glium/src/painter.rs index e5dc378d17c..e190171a5a4 100644 --- a/egui_glium/src/painter.rs +++ b/egui_glium/src/painter.rs @@ -25,8 +25,8 @@ pub struct Painter { /// Index is the same as in [`egui::TextureId::User`]. user_textures: HashMap>, - // TODO: 128-bit texture space? - next_native_tex_id: u64, + #[cfg(feature = "epi")] + next_native_tex_id: u64, // TODO: 128-bit texture space? } impl Painter { @@ -57,6 +57,7 @@ impl Painter { egui_texture: None, egui_texture_version: None, user_textures: Default::default(), + #[cfg(feature = "epi")] next_native_tex_id: 1 << 32, } } @@ -222,6 +223,7 @@ impl Painter { // ------------------------------------------------------------------------ + #[cfg(feature = "epi")] pub fn set_texture( &mut self, facade: &dyn glium::backend::Facade, diff --git a/egui_glow/src/misc_util.rs b/egui_glow/src/misc_util.rs index 6d527ed6105..0ce12000bee 100644 --- a/egui_glow/src/misc_util.rs +++ b/egui_glow/src/misc_util.rs @@ -1,8 +1,6 @@ #![allow(unsafe_code)] use glow::HasContext; use std::option::Option::Some; -#[cfg(target_arch = "wasm32")] -use wasm_bindgen::JsValue; pub(crate) fn srgbtexture2d( gl: &glow::Context, diff --git a/egui_glow/src/painter.rs b/egui_glow/src/painter.rs index 0c848094cef..1a45281d441 100644 --- a/egui_glow/src/painter.rs +++ b/egui_glow/src/painter.rs @@ -41,8 +41,10 @@ pub struct Painter { /// Index is the same as in [`egui::TextureId::User`]. user_textures: HashMap, - // TODO: 128-bit texture space? - next_native_tex_id: u64, + + #[cfg(feature = "epi")] + next_native_tex_id: u64, // TODO: 128-bit texture space? + /// Stores outdated OpenGL textures that are yet to be deleted textures_to_destroy: Vec, @@ -192,6 +194,7 @@ impl Painter { vertex_buffer, element_array_buffer, user_textures: Default::default(), + #[cfg(feature = "epi")] next_native_tex_id: 1 << 32, textures_to_destroy: Vec::new(), destroyed: false, @@ -386,6 +389,7 @@ impl Painter { // ------------------------------------------------------------------------ + #[cfg(feature = "epi")] pub fn set_texture(&mut self, gl: &glow::Context, tex_id: u64, image: &epi::Image) { self.assert_not_destroyed(); diff --git a/egui_web/src/webgl1.rs b/egui_web/src/webgl1.rs index db7751fc2db..39cba041edb 100644 --- a/egui_web/src/webgl1.rs +++ b/egui_web/src/webgl1.rs @@ -34,8 +34,7 @@ pub struct WebGlPainter { /// Index is the same as in [`egui::TextureId::User`]. user_textures: HashMap, - // TODO: 128-bit texture space? - next_native_tex_id: u64, + next_native_tex_id: u64, // TODO: 128-bit texture space? } impl WebGlPainter { diff --git a/egui_web/src/webgl2.rs b/egui_web/src/webgl2.rs index e774f984973..207bc833e42 100644 --- a/egui_web/src/webgl2.rs +++ b/egui_web/src/webgl2.rs @@ -34,8 +34,7 @@ pub struct WebGl2Painter { /// Index is the same as in [`egui::TextureId::User`]. user_textures: HashMap, - // TODO: 128-bit texture space? - next_native_tex_id: u64, + next_native_tex_id: u64, // TODO: 128-bit texture space? } impl WebGl2Painter { diff --git a/epi/src/lib.rs b/epi/src/lib.rs index 3dbcd86f903..436041b0ff1 100644 --- a/epi/src/lib.rs +++ b/epi/src/lib.rs @@ -419,11 +419,10 @@ pub trait NativeTexture { /// The native texture type. type Texture; - /// Bind native texture to egui texture + /// Bind native texture to an egui texture id. fn register_native_texture(&mut self, native: Self::Texture) -> egui::TextureId; - /// Change id's actual pointing texture - /// only for user texture + /// Change what texture the given id refers to. fn replace_native_texture(&mut self, id: egui::TextureId, replacing: Self::Texture); }