Skip to content

Asynchronous Loading

Narta Xaymar Dirks edited this page Oct 27, 2026 · 5 revisions

Asynchronous loading

The originals decode every picture before LoadTexture or LoadImage return. BlitzLLVM can instead read the file, return a handle at once and decode on worker threads, so that the program can do other setup in the meantime. It is off by default, so a program behaves as in the original unless it turns it on with AsyncLoading or the environment variable BLITZ_ASYNC_LOAD=1.

Everything that needs the picture waits for it by itself, so a program does not have to change: drawing, TextureWidth, ImageWidth, ReadPixel and the rest. TextureReady and ImageReady only ask, for programs that want to show a loading screen or to measure.

A missing file or a file that is no picture still gives 0 from the load command, because the file is read and its header checked right away. The file is read when the command is called, so it can be deleted or replaced afterwards. What cannot be known until decoding is whether the picture is complete: a file with a valid header that cannot be decoded raises an error the first time the picture is used. Cube maps (flag 128) and sheets of frames are loaded without threads.

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally