slint-ui/slint · error

internal error: missing implementation for…

Error message

internal error: missing implementation for BorrowedOpenGLTextureOrigin

What it means

The Skia OpenGL surface's `import_opengl_texture` maps `BorrowedOpenGLTextureOrigin` to `skia_safe::gpu::SurfaceOrigin` and only implements TopLeft and BottomLeft; other variants hit the wildcard `unimplemented!` panic. An internal completeness guard in the Skia backend.

Solutions

  1. Use only BorrowedOpenGLTextureOrigin::TopLeft or BottomLeft with this API
  2. Pre-transform (flip) the texture and declare TopLeft/BottomLeft accordingly
  3. Extend opengl_surface.rs to map remaining origin variants to Skia equivalents

Example fix

// before
renderer.import_opengl_texture(win, BorrowedOpenGlTexture::new(tex, size, BorrowedOpenGLTextureOrigin::BottomRight))
// after
renderer.import_opengl_texture(win, BorrowedOpenGlTexture::new(tex, size, BorrowedOpenGLTextureOrigin::BottomLeft))
Defensive patterns

Strategy: validation

Validate before calling

let origin_ok = matches!(origin,
    BorrowedOpenGLTextureOrigin::TopLeft | BorrowedOpenGLTextureOrigin::BottomLeft);

Prevention

When it happens

Trigger: Importing an external OpenGL texture into a Slint Skia-rendered window with an origin variant other than TopLeft or BottomLeft (e.g. BottomRight, TopRight).

Common situations: Passing texture origin values taken from another engine's conventions directly into the Skia backend's texture import API.

Related errors


AI-assisted analysis of slint-ui/slint@3a7e700487 (2026-09-16). Data as JSON: /api/errors/395a8ba07dfdf9e2. Report an issue: GitHub.

Appendix: source

Thrown at internal/renderers/skia/opengl_surface.rs:206

            );
            texture_info.format = glow::RGBA8;
            let backend_texture = skia_safe::gpu::backend_textures::make_gl(
                (size.width as _, size.height as _),
                skia_safe::gpu::Mipmapped::No,
                texture_info,
                "Borrowed GL texture",
            );
            skia_safe::image::Image::from_texture(
                canvas.recording_context().as_mut().unwrap(),
                &backend_texture,
                match origin {
                    i_slint_core::graphics::BorrowedOpenGLTextureOrigin::TopLeft => {
                        skia_safe::gpu::SurfaceOrigin::TopLeft
                    }
                    i_slint_core::graphics::BorrowedOpenGLTextureOrigin::BottomLeft => {
                        skia_safe::gpu::SurfaceOrigin::BottomLeft
                    }
                    _ => unimplemented!(
                        "internal error: missing implementation for BorrowedOpenGLTextureOrigin"
                    ),
                },
                skia_safe::ColorType::RGBA8888,
                skia_safe::AlphaType::Unpremul,
                crate::sampled_texture_color_space(crate::TextureEncoding::Unorm),
            )
        }
    }
}

impl OpenGLSurface {
    pub fn new_with_config(
        window_handle: Arc<dyn raw_window_handle::HasWindowHandle>,
        display_handle: Arc<dyn raw_window_handle::HasDisplayHandle>,
        size: PhysicalWindowSize,
        requested_opengl_version: Option<RequestedOpenGLVersion>,
        config_builder: glutin::config::ConfigTemplateBuilder,

View on GitHub (pinned to 3a7e700487)