Navigation
API > API/Runtime > API/Runtime/ImageCore
Metadata structure for a DDS file, with access pointers for the raw texture data (i.e. unconverted from the DXGI format).
Can be used for loading or saving a dds file.
For saving, general structure is: { dds = FDDSFile::CreateEmpty2D copy data for each mip/array: for (mips) memcpy(dds->mips[idx].data, mip_data, mip_size);
Ar = IFileManager::Get().CreateFileWriter(filename);
dds->Serialize(Ar); delete dds;
Ar->Close() delete Ar; }
| Name | FDDSFile |
| Type | struct |
| Header File | /Engine/Source/Runtime/ImageCore/Public/DDSFile.h |
| Include Path | #include "DDSFile.h" |
Syntax
struct FDDSFile
Constants
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| CREATE_FLAG_CUBEMAP | uint32 | DDSFile.h | |
| CREATE_FLAG_NO_MIP_STORAGE_ALLOC | uint32 | DDSFile.h | |
| CREATE_FLAG_NONE | uint32 | Bit flags. | DDSFile.h |
| CREATE_FLAG_WAS_D3D9 | uint32 | DDSFile.h | |
| MAX_MIPS_SUPPORTED | uint32 | 20 mips means 512k x 512k pixels max, should be sufficient for now. | DDSFile.h |
Variables
Public
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| ArraySize | uint32 | Array size here uses the conventions as in the D3D runtime, which means an array of N cubemaps has an array size of 6N (one element per face). | DDSFile.h | |
| CreateFlags | uint32 | DDSFile.h | ||
| Depth | uint32 | DDSFile.h | ||
| Dimension | int32 | DDSFile.h | ||
| DXGIFormat | EDXGIFormat | DDSFile.h | ||
| Height | uint32 | DDSFile.h | ||
| MipCount | uint32 | DDSFile.h | ||
| MipRawData | TArray64< uint8 > | When we allocate the mips ourselves, we keep all storage together in a single allocation, namely this one, and the mips point into it. | DDSFile.h | |
| Mips | TArray< FDDSMip > | Mips are ordered starting from mip 0 (full-size texture) decreasing in size; for arrays, we store the full mip chain for one array element before advancing to the next array element, and have (ArraySize * MipCount) mips total. | DDSFile.h | |
| Width | uint32 | DDSFile.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void ConvertChannelOrder
(
EChannelOrder InTargetOrder |
For 8-bit UNorm formats, both RGBA and BGRA channel order variants exist and are popular. | DDSFile.h | |
void ConvertRGBXtoRGBA() |
Convert X alpha to A and fill 255 | DDSFile.h | |
void FillMip
(
const FImageView& FromImage, |
Fill DDS mip from Image Image must be of format DXGIFormatFromRawFormat | DDSFile.h | |
bool GetMipImage
(
const FImageView& ToImage, |
Blit pixels from DDS mip to Image return false if no pixel format conversion is supported ToImage is not allocated, must be pre-allocated and sized correctly | DDSFile.h | |
bool IsValidTexture2D() |
Check if this DDS is usable in Unreal Texture types: | DDSFile.h | |
bool IsValidTextureArray() |
DDSFile.h | ||
bool IsValidTextureCube() |
DDSFile.h | ||
bool IsValidTextureVolume() |
DDSFile.h | ||
EDDSError Validate() |
Sanity-check that all members make sense and return an error code. | DDSFile.h | |
EDDSError WriteDDS
(
TArray64< uint8 >& OutDDS, |
Write DDS-format data to memory. | DDSFile.h |
Static
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
static FDDSFile * CreateEmpty
(
int32 InDimension, |
Create an empty DDS structure (for writing DDS files typically) | DDSFile.h | |
static FDDSFile * CreateEmpty2D
(
uint32 InWidth, |
Convenience version of the above to create a basic 2D texture with mip chain. | DDSFile.h | |
static FDDSFile * CreateFromDDSInMemory
(
const uint8* InDDS, |
DDSFile.h | ||
static FDDSFile * CreateFromDDSInMemory
(
const uint8* InDDS, |
Used for loading from a DDS file image in memory. | DDSFile.h | |
static bool IsADDS
(
const uint8* InDDS, |
Is this buffer a DDS ? | DDSFile.h |