PNG files
Generated from engine/render/png_file.h at f525bc6. The text under each declaration is the header's own comment, word for word. About the reference says how these pages are made.
Audience: renderer writer.
#include "engine/render/png_file.h" · namespace labrador
read_png_file
Section titled “read_png_file”Reads the .png at path as one level of r8g8b8a8_unorm, premultiplied.
A PNG is the picture a paint program saves, so a game can draw one with no converter in between. Whatever the file stores - palette, grey, 16 bits a channel, with or without alpha - comes out as 8-bit RGBA, and each colour channel is multiplied by its alpha, rounded to the nearest whole value, because every draw blends premultiplied (renderer.h). A file's gamma and colour-profile chunks are not applied.
WHAT IT COSTS AGAINST A .dds. Four bytes a pixel on the device, where bc3_unorm takes one, no mip chain, and the decode at every load and device restore. A texture that is large or many stays a block-compressed .dds, which load_texture_asset reads by the same name.
Throws std::out_of_range naming the path if there is no file there, and std::runtime_error naming the path and the decoder's reason if there is one and it is not a PNG it can decode (T6). A header giving either side above max_texture_dimension (texture_data.h) is refused the same way, before any pixel is decoded.
decode_png
Section titled “decode_png” const std::string& context);The same for PNG bytes already in memory; context names them in a throw, as the path does above.
Related types
Section titled “Related types”Named in the public declarations above: TextureData.
In the samples and tests
Section titled “In the samples and tests”The files that include this header directly. A file can also reach it through another header.
tests/render/png_file_tests.cpp
Explained in
Section titled “Explained in”No guide or concept page links to this header yet.
Documentation for Labrador v0.4.0. Built from Labrador f525bc6 of 2026-11-17.