slint-ui/slint · error
internal error allocating temporary texture for image tiling
Error message
internal error allocating temporary texture for image tiling
What it means
The FemtoVG renderer panics when it cannot allocate an offscreen canvas texture used for tiled (`REPEAT_X | REPEAT_Y`) image drawing. `Canvas::new_image` failed — usually because the requested `texture_size` exceeds GPU limits (max texture size) or the driver/context is out of memory. The message says 'internal error' because the renderer assumes the tile texture always fits.
Solutions
- Shrink or downscale the source image so one tile fits within the GPU max texture size
- Change the image's `image-rendering` from tiling/repeat to a non-tiled rendering mode
- Check GPU/driver limits (`glGetString(GL_MAX_TEXTURE_SIZE)`) and reduce the Slint canvas resolution
- Update Slint — newer versions may fall back to clamping instead of panicking
Example fix
// before
background: @image-url("huge-photo.png"); // 12000px image, image-rendering: repeat
// after
// preprocess: downscale the image so a single tile <= 4096px
background: @image-url("huge-photo-tiled.png"); // e.g. 1024px tile Defensive patterns
Strategy: fallback
Validate before calling
// check image dimensions before using tiled rendering
if img.width() > 4096 || img.height() > 4096 { downscale(&mut img, 4096); } Prevention
- Pre-scale tiled images below the GPU max texture size (query GL_MAX_TEXTURE_SIZE)
- Avoid `image-rendering: repeat` for very large images; pre-tile the texture yourself
- Test on embedded/GL drivers with low texture limits
When it happens
Trigger: Drawing an image with `image-rendering` tiling (repeating backgrounds) where `texture_size.width`/`height` exceeds the GPU's `MAX_TEXTURE_SIZE` (commonly 4096/8192/16384), or when GPU memory is exhausted. Reached via `draw_image` → `draw_image_impl` when the image is used as a repeating pattern.
Common situations: Embedded/OpenGL contexts with small max texture sizes rendering a large image set to tile; headless/software GL drivers with low limits; users with very large wallpaper/background images set to `repeat`.
Understand the failure class
Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.
Related errors
- Cannot proceed without WebGL - aborting
- a setter belongs to a field
- an identifier
- attempt to multiply with overflow
- binding was of the wrong type
AI-assisted analysis of slint-ui/slint@3a7e700487 (2026-09-16).
Data as JSON: /api/errors/3bbea7b4aa0f6b2b.
Report an issue: GitHub.
Appendix: source
Thrown at internal/renderers/femtovg/itemrenderer.rs:1391
};
let texture_size = euclid::size2(
scale_w * fit.clip_rect.width() as f32,
scale_h * fit.clip_rect.height() as f32,
);
let clipped_image = self
.canvas
.borrow_mut()
.create_image_empty(
texture_size.width as usize,
texture_size.height as usize,
femtovg::PixelFormat::Rgba8,
femtovg::ImageFlags::PREMULTIPLIED
| femtovg::ImageFlags::REPEAT_X
| femtovg::ImageFlags::REPEAT_Y
| scaling_flags,
)
.expect("internal error allocating temporary texture for image tiling");
let mut image_rect = femtovg::Path::new();
image_rect.rect(0., 0., texture_size.width, texture_size.height);
self.canvas.borrow_mut().save_with(|canvas| {
canvas.reset();
canvas.scale(1., -1.); // Image are rendered upside down
canvas.translate(0., -scale_h * (fit.clip_rect.height() as f32));
canvas.set_render_target(femtovg::RenderTarget::Image(clipped_image));
canvas.global_composite_operation(femtovg::CompositeOperation::Copy);
canvas.fill_path(
&image_rect,
&femtovg::Paint::image(
image_id,
-scale_w * fit.clip_rect.origin.x as f32,
-scale_h * fit.clip_rect.origin.y as f32,
buf_size.cast().width,
buf_size.cast().height,
0.,View on GitHub (pinned to 3a7e700487)