Skip to content

AsyncLoading

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

AsyncLoading 〔BlitzLLVM〕

AsyncLoading enabled:Int32
Parameter Type Default Description
enabled Int32 required True to load on other threads, False to wait for every picture.

Description

〔BlitzLLVM〕 This command does not exist in the original Blitz products. BlitzLLVM adds it.

Turns loading of pictures on other threads on or off. It is off at first, and the environment variable BLITZ_ASYNC_LOAD=1 turns it on for a program without changing it. With it on, LoadTexture and LoadImage read the file at once and return a handle, and the decoding of the picture goes on while the program does other things. Finished pictures are put on the graphics card a little at a time while frames are shown with Flip, so a loading screen that flips does not stall at the end. Whatever else needs a picture waits for it: drawing, TextureWidth, ImageWidth, ReadPixel and every other command that uses it. TextureReady and ImageReady tell whether it is done without waiting. A program that loads many pictures and does other setup in between gets faster, and one that uses each picture right after loading it gains only what decoding several at once brings.

LoadTexture and LoadImage still give 0 for a file that is missing or is no picture. A file that is a picture by its header but cannot be decoded (a cut off download, for example) cannot give 0 any more: the program stops with an error the first time it uses it, instead of at the load. Cube maps and sheets of frames are loaded as before. Changing the setting does not change pictures that are loading already.

This is a BlitzLLVM extension: the originals load every picture before the command returns.

Differences

  • With asynchronous loading on, a picture with a valid header that cannot be decoded raises its error when it is first used and not as a 0 from the load.

Related Commands

AutoMidHandle, CopyImage

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally