DdsReader
- Namespace: Turian.Engine.Core
- Source File: DdsReader.cs
Reads DirectDraw Surface files into the block data a Vulkan upload wants. Only the block-compressed families the engine can sample are recognised; nothing is decompressed, so a BC3 file costs one header parse and a set of slices over the caller's buffer.
Fields
Magic (uint) = 0x20534444: File magic, the ASCII bytes DDS .
Public Methods
IsDds
public static bool IsDds(ReadOnlySpan<byte> data)
Reports whether data starts with the DDS magic.
Parameters:
data(ReadOnlySpan): Bytes to sniff; may be shorter than a full header.
Returns: bool
Read
public static DdsImage Read(ReadOnlyMemory<byte> data, bool isSrgb)
Parses data into its format, extent and mip levels.
Parameters:
data(ReadOnlyMemory): The whole DDS file. isSrgb(bool): Whether the data is sampled in sRGB space. Selects the sRGB variant for fourCC formats that have one; BC4 and BC5 store linear data and ignore it, and a DX10 header names its color space explicitly and wins.
Returns: DdsImage
- The parsed image, with one slice per mip level.