slint-ui/slint · error

internal error: missing implementation for…

Error message

internal error: missing implementation for BorrowedOpenGLTextureOrigin

What it means

The FemtoVG renderer only knows how to import a borrowed native OpenGL texture with `TopLeft` or `BottomLeft` origin. Any other `BorrowedOpenGLTextureOrigin` value (the enum has more variants) reaches the wildcard arm and panics. This is an internal completeness check in the renderer.

Solutions

  1. Pass only BorrowedOpenGLTextureOrigin::TopLeft or BottomLeft to the FemtoVG renderer
  2. Map your texture's actual origin to one of the supported values (apply flips yourself before import)
  3. Extend images.rs to translate the remaining origin variants into femtovg::ImageFlags

Example fix

// before
let img = BorrowedOpenGlTexture::new(texture_id, size, BorrowedOpenGLTextureOrigin::BottomRight);
// after
let img = BorrowedOpenGlTexture::new(texture_id, size, BorrowedOpenGLTextureOrigin::TopLeft);
Defensive patterns

Strategy: validation

Validate before calling

fn is_supported(origin: BorrowedOpenGLTextureOrigin) -> bool {
    matches!(origin, BorrowedOpenGLTextureOrigin::TopLeft | BorrowedOpenGLTextureOrigin::BottomLeft)
}

Type guard

fn supported_origin(o: BorrowedOpenGLTextureOrigin) -> Option<BorrowedOpenGLTextureOrigin> {
    matches!(o, TopLeft | BottomLeft).then_some(o)
}

Prevention

When it happens

Trigger: Calling the public `new_from_image` / borrowed-OpenGL-texture image import API (e.g. `BorrowedOpenGLTexture`/`BorrowedOpenGlTexture` from the Rust API) with a texture origin variant other than TopLeft or BottomLeft, such as `BottomRight` or `TopRight`.

Common situations: Porting code from another renderer (e.g. Skia) that supports more origins; supplying a flipped/rotated texture origin enum value directly to the FEMtoVG backend.

Related errors


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

Appendix: source

Thrown at internal/renderers/femtovg/images.rs:174

                    };
                    canvas.borrow_mut().create_image(&html_image.dom_element, image_flags).unwrap()
                } else {
                    return None;
                }
            }
            #[cfg(not(target_arch = "wasm32"))]
            ImageInner::BorrowedOpenGLTexture(BorrowedOpenGLTexture {
                texture_id,
                size,
                origin,
                ..
            }) => {
                let image_flags = match origin {
                    i_slint_core::graphics::BorrowedOpenGLTextureOrigin::TopLeft => image_flags,
                    i_slint_core::graphics::BorrowedOpenGLTextureOrigin::BottomLeft => {
                        image_flags | femtovg::ImageFlags::FLIP_Y
                    }
                    _ => unimplemented!(
                        "internal error: missing implementation for BorrowedOpenGLTextureOrigin"
                    ),
                };
                canvas
                    .borrow_mut()
                    .create_image_from_native_texture(
                        <R as TextureImporter>::convert_opengl_texture(*texture_id),
                        femtovg::ImageInfo::new(
                            image_flags,
                            size.width as _,
                            size.height as _,
                            femtovg::PixelFormat::Rgba8,
                        ),
                    )
                    .unwrap()
            }
            #[cfg(feature = "unstable-wgpu-30")]
            ImageInner::WGPUTexture(i_slint_core::graphics::WGPUTexture::WGPU30Texture(

View on GitHub (pinned to 3a7e700487)