{"record":{"id":"3bbea7b4aa0f6b2b","repo":"slint-ui/slint","slug":"internal-error-allocating-temporary-texture-for-image-tiling","errorCode":null,"errorMessage":"internal error allocating temporary texture for image tiling","messagePattern":"internal error allocating temporary texture for image tiling","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/renderers/femtovg/itemrenderer.rs","lineNumber":1391,"sourceCode":"                    };\n                    let texture_size = euclid::size2(\n                        scale_w * fit.clip_rect.width() as f32,\n                        scale_h * fit.clip_rect.height() as f32,\n                    );\n\n                    let clipped_image = self\n                        .canvas\n                        .borrow_mut()\n                        .create_image_empty(\n                            texture_size.width as usize,\n                            texture_size.height as usize,\n                            femtovg::PixelFormat::Rgba8,\n                            femtovg::ImageFlags::PREMULTIPLIED\n                                | femtovg::ImageFlags::REPEAT_X\n                                | femtovg::ImageFlags::REPEAT_Y\n                                | scaling_flags,\n                        )\n                        .expect(\"internal error allocating temporary texture for image tiling\");\n\n                    let mut image_rect = femtovg::Path::new();\n                    image_rect.rect(0., 0., texture_size.width, texture_size.height);\n                    self.canvas.borrow_mut().save_with(|canvas| {\n                        canvas.reset();\n                        canvas.scale(1., -1.); // Image are rendered upside down\n                        canvas.translate(0., -scale_h * (fit.clip_rect.height() as f32));\n                        canvas.set_render_target(femtovg::RenderTarget::Image(clipped_image));\n                        canvas.global_composite_operation(femtovg::CompositeOperation::Copy);\n                        canvas.fill_path(\n                            &image_rect,\n                            &femtovg::Paint::image(\n                                image_id,\n                                -scale_w * fit.clip_rect.origin.x as f32,\n                                -scale_h * fit.clip_rect.origin.y as f32,\n                                buf_size.cast().width,\n                                buf_size.cast().height,\n                                0.,","sourceCodeStart":1373,"sourceCodeEnd":1409,"githubUrl":"https://github.com/slint-ui/slint/blob/3a7e700487dc74d404cad0726378053ab763d4e0/internal/renderers/femtovg/itemrenderer.rs#L1373-L1409","documentation":"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.","triggerScenarios":"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.","commonSituations":"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`.","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"],"exampleFix":"// before\nbackground: @image-url(\"huge-photo.png\"); // 12000px image, image-rendering: repeat\n// after\n// preprocess: downscale the image so a single tile <= 4096px\nbackground: @image-url(\"huge-photo-tiled.png\"); // e.g. 1024px tile","handlingStrategy":"fallback","validationCode":"// check image dimensions before using tiled rendering\nif img.width() > 4096 || img.height() > 4096 { downscale(&mut img, 4096); }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["renderer","femtovg","gpu","texture","panic"],"backgroundTag":"value-out-of-range","analyzedSha":"3a7e700487dc74d404cad0726378053ab763d4e0","analyzedAt":"2026-09-16T01:37:20.251Z","contentChangedAt":"2026-09-16T01:37:20.251Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}