Dali 3D User Interface Engine
Classes | Typedefs | Enumerations | Functions | Variables
Dali::TizenPlatform::anonymous_namespace{loader-ktx.cpp} Namespace Reference

Classes

struct  KtxFileHeader
 

Typedefs

typedef uint8_t Byte
 

Enumerations

enum  KtxInternalFormat {
  KTX_NOTEXIST = 0, KTX_ETC1_RGB8_OES = 0x8D64, KTX_COMPRESSED_RGB_PVRTC_4BPPV1_IMG = 0x8C00, KTX_COMPRESSED_R11_EAC = 0x9270,
  KTX_COMPRESSED_SIGNED_R11_EAC = 0x9271, KTX_COMPRESSED_RG11_EAC = 0x9272, KTX_COMPRESSED_SIGNED_RG11_EAC = 0x9273, KTX_COMPRESSED_RGB8_ETC2 = 0x9274,
  KTX_COMPRESSED_SRGB8_ETC2 = 0x9275, KTX_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 0x9276, KTX_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 0x9277, KTX_COMPRESSED_RGBA8_ETC2_EAC = 0x9278,
  KTX_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC = 0x9279, KTX_COMPRESSED_RGBA_ASTC_4x4_KHR = 0x93B0, KTX_COMPRESSED_RGBA_ASTC_5x4_KHR = 0x93B1, KTX_COMPRESSED_RGBA_ASTC_5x5_KHR = 0x93B2,
  KTX_COMPRESSED_RGBA_ASTC_6x5_KHR = 0x93B3, KTX_COMPRESSED_RGBA_ASTC_6x6_KHR = 0x93B4, KTX_COMPRESSED_RGBA_ASTC_8x5_KHR = 0x93B5, KTX_COMPRESSED_RGBA_ASTC_8x6_KHR = 0x93B6,
  KTX_COMPRESSED_RGBA_ASTC_8x8_KHR = 0x93B7, KTX_COMPRESSED_RGBA_ASTC_10x5_KHR = 0x93B8, KTX_COMPRESSED_RGBA_ASTC_10x6_KHR = 0x93B9, KTX_COMPRESSED_RGBA_ASTC_10x8_KHR = 0x93BA,
  KTX_COMPRESSED_RGBA_ASTC_10x10_KHR = 0x93BB, KTX_COMPRESSED_RGBA_ASTC_12x10_KHR = 0x93BC, KTX_COMPRESSED_RGBA_ASTC_12x12_KHR = 0x93BD, KTX_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR = 0x93D0,
  KTX_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR = 0x93D1, KTX_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR = 0x93D2, KTX_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR = 0x93D3, KTX_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR = 0x93D4,
  KTX_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR = 0x93D5, KTX_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR = 0x93D6, KTX_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR = 0x93D7, KTX_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR = 0x93D8,
  KTX_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR = 0x93D9, KTX_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR = 0x93DA, KTX_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR = 0x93DB, KTX_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR = 0x93DC,
  KTX_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR = 0x93DD, KTX_SENTINEL = ~0u
}
 The formats we support inside a KTX file container. More...
 

Functions

struct
Dali::TizenPlatform::anonymous_namespace{loader-ktx.cpp}::KtxFileHeader 
__attribute__ ((__packed__))
 
template<typename T >
bool ReadHeader (FILE *fp, T &header)
 Template function to read from the file directly into our structure. More...
 
template<int BYTES_IN_SIGNATURE>
bool CheckFileIdentifier (const Byte *const signature)
 Check whether the array passed in is the right size and matches the magic values defined to be at the start of a KTX file by the specification. More...
 
bool ValidInternalFormat (const unsigned format)
 
bool ConvertPixelFormat (const uint32_t ktxPixelFormat, Dali::Pixel::Format &format)
 
bool LoadKtxHeader (FILE *const fp, unsigned int &width, unsigned int &height, KtxFileHeader &fileHeader)
 

Variables

const unsigned MAX_TEXTURE_DIMENSION = 4096
 Max width or height of an image. More...
 
const unsigned MAX_IMAGE_DATA_SIZE = MAX_TEXTURE_DIMENSION * MAX_TEXTURE_DIMENSION
 Max bytes of image data allowed. More...
 
const unsigned MAX_BYTES_OF_KEYVALUE_DATA = 65536U
 We don't read any of this but limit it to a resonable amount in order to be friendly to files from random tools. More...
 
const Byte FileIdentifier []
 
const unsigned KtxInternalFormats []
 

Typedef Documentation

typedef uint8_t Dali::TizenPlatform::anonymous_namespace{loader-ktx.cpp}::Byte

Definition at line 50 of file loader-ktx.cpp.

Enumeration Type Documentation

enum Dali::TizenPlatform::anonymous_namespace{loader-ktx.cpp}::KtxInternalFormat

The formats we support inside a KTX file container.

Currently only compressed formats are allowed as we'd rather use a PNG or JPEG with their own compression for the general cases.

Enumerator
KTX_NOTEXIST 
KTX_ETC1_RGB8_OES 
KTX_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 
KTX_COMPRESSED_R11_EAC 
KTX_COMPRESSED_SIGNED_R11_EAC 
KTX_COMPRESSED_RG11_EAC 
KTX_COMPRESSED_SIGNED_RG11_EAC 
KTX_COMPRESSED_RGB8_ETC2 
KTX_COMPRESSED_SRGB8_ETC2 
KTX_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 
KTX_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 
KTX_COMPRESSED_RGBA8_ETC2_EAC 
KTX_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC 
KTX_COMPRESSED_RGBA_ASTC_4x4_KHR 
KTX_COMPRESSED_RGBA_ASTC_5x4_KHR 
KTX_COMPRESSED_RGBA_ASTC_5x5_KHR 
KTX_COMPRESSED_RGBA_ASTC_6x5_KHR 
KTX_COMPRESSED_RGBA_ASTC_6x6_KHR 
KTX_COMPRESSED_RGBA_ASTC_8x5_KHR 
KTX_COMPRESSED_RGBA_ASTC_8x6_KHR 
KTX_COMPRESSED_RGBA_ASTC_8x8_KHR 
KTX_COMPRESSED_RGBA_ASTC_10x5_KHR 
KTX_COMPRESSED_RGBA_ASTC_10x6_KHR 
KTX_COMPRESSED_RGBA_ASTC_10x8_KHR 
KTX_COMPRESSED_RGBA_ASTC_10x10_KHR 
KTX_COMPRESSED_RGBA_ASTC_12x10_KHR 
KTX_COMPRESSED_RGBA_ASTC_12x12_KHR 
KTX_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR 
KTX_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR 
KTX_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR 
KTX_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR 
KTX_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR 
KTX_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR 
KTX_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR 
KTX_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR 
KTX_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR 
KTX_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR 
KTX_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR 
KTX_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR 
KTX_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 
KTX_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 
KTX_SENTINEL 

Definition at line 61 of file loader-ktx.cpp.

Function Documentation

struct Dali::TizenPlatform::anonymous_namespace{loader-ktx.cpp}::KtxFileHeader Dali::TizenPlatform::anonymous_namespace{loader-ktx.cpp}::__attribute__ ( (__packed__)  )
template<int BYTES_IN_SIGNATURE>
bool Dali::TizenPlatform::anonymous_namespace{loader-ktx.cpp}::CheckFileIdentifier ( const Byte *const  signature)

Check whether the array passed in is the right size and matches the magic values defined to be at the start of a KTX file by the specification.

Definition at line 208 of file loader-ktx.cpp.

References DALI_COMPILE_TIME_ASSERT, Dali::TizenPlatform::anonymous_namespace{loader-astc.cpp}::FileIdentifier, and Dali::Toolkit::Text::min().

Referenced by LoadKtxHeader().

Here is the call graph for this function:

Here is the caller graph for this function:

bool Dali::TizenPlatform::anonymous_namespace{loader-ktx.cpp}::ConvertPixelFormat ( const uint32_t  ktxPixelFormat,
Dali::Pixel::Format format 
)
Returns
The Pixel::Format Dali enum corresponding to the KTX internal format passed in, or Pixel::INVALID_PIXEL_FORMAT if the format is not valid.

Definition at line 238 of file loader-ktx.cpp.

References Dali::Pixel::COMPRESSED_R11_EAC, Dali::Pixel::COMPRESSED_RG11_EAC, Dali::Pixel::COMPRESSED_RGB8_ETC1, Dali::Pixel::COMPRESSED_RGB8_ETC2, Dali::Pixel::COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, Dali::Pixel::COMPRESSED_RGB_PVRTC_4BPPV1, Dali::Pixel::COMPRESSED_RGBA8_ETC2_EAC, Dali::Pixel::COMPRESSED_RGBA_ASTC_10x10_KHR, Dali::Pixel::COMPRESSED_RGBA_ASTC_10x5_KHR, Dali::Pixel::COMPRESSED_RGBA_ASTC_10x6_KHR, Dali::Pixel::COMPRESSED_RGBA_ASTC_10x8_KHR, Dali::Pixel::COMPRESSED_RGBA_ASTC_12x10_KHR, Dali::Pixel::COMPRESSED_RGBA_ASTC_12x12_KHR, Dali::Pixel::COMPRESSED_RGBA_ASTC_4x4_KHR, Dali::Pixel::COMPRESSED_RGBA_ASTC_5x4_KHR, Dali::Pixel::COMPRESSED_RGBA_ASTC_5x5_KHR, Dali::Pixel::COMPRESSED_RGBA_ASTC_6x5_KHR, Dali::Pixel::COMPRESSED_RGBA_ASTC_6x6_KHR, Dali::Pixel::COMPRESSED_RGBA_ASTC_8x5_KHR, Dali::Pixel::COMPRESSED_RGBA_ASTC_8x6_KHR, Dali::Pixel::COMPRESSED_RGBA_ASTC_8x8_KHR, Dali::Pixel::COMPRESSED_SIGNED_R11_EAC, Dali::Pixel::COMPRESSED_SIGNED_RG11_EAC, Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR, Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR, Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR, Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR, Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR, Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR, Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR, Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR, Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR, Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR, Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR, Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR, Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR, Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR, Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, Dali::Pixel::COMPRESSED_SRGB8_ETC2, Dali::Pixel::COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, KTX_COMPRESSED_R11_EAC, KTX_COMPRESSED_RG11_EAC, KTX_COMPRESSED_RGB8_ETC2, KTX_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, KTX_COMPRESSED_RGB_PVRTC_4BPPV1_IMG, KTX_COMPRESSED_RGBA8_ETC2_EAC, KTX_COMPRESSED_RGBA_ASTC_10x10_KHR, KTX_COMPRESSED_RGBA_ASTC_10x5_KHR, KTX_COMPRESSED_RGBA_ASTC_10x6_KHR, KTX_COMPRESSED_RGBA_ASTC_10x8_KHR, KTX_COMPRESSED_RGBA_ASTC_12x10_KHR, KTX_COMPRESSED_RGBA_ASTC_12x12_KHR, KTX_COMPRESSED_RGBA_ASTC_4x4_KHR, KTX_COMPRESSED_RGBA_ASTC_5x4_KHR, KTX_COMPRESSED_RGBA_ASTC_5x5_KHR, KTX_COMPRESSED_RGBA_ASTC_6x5_KHR, KTX_COMPRESSED_RGBA_ASTC_6x6_KHR, KTX_COMPRESSED_RGBA_ASTC_8x5_KHR, KTX_COMPRESSED_RGBA_ASTC_8x6_KHR, KTX_COMPRESSED_RGBA_ASTC_8x8_KHR, KTX_COMPRESSED_SIGNED_R11_EAC, KTX_COMPRESSED_SIGNED_RG11_EAC, KTX_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR, KTX_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR, KTX_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR, KTX_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR, KTX_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR, KTX_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR, KTX_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR, KTX_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR, KTX_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR, KTX_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR, KTX_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR, KTX_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR, KTX_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR, KTX_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR, KTX_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, KTX_COMPRESSED_SRGB8_ETC2, KTX_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, and KTX_ETC1_RGB8_OES.

Referenced by Dali::TizenPlatform::LoadBitmapFromKtx().

Here is the caller graph for this function:

bool Dali::TizenPlatform::anonymous_namespace{loader-ktx.cpp}::LoadKtxHeader ( FILE *const  fp,
unsigned int &  width,
unsigned int &  height,
KtxFileHeader &  fileHeader 
)
template<typename T >
bool Dali::TizenPlatform::anonymous_namespace{loader-ktx.cpp}::ReadHeader ( FILE *  fp,
T &  header 
)
inline

Template function to read from the file directly into our structure.

Parameters
[in]fpThe file to read from
[out]headerThe structure we want to store our information in
Returns
true, if read successful, false otherwise

Definition at line 192 of file loader-ktx.cpp.

bool Dali::TizenPlatform::anonymous_namespace{loader-ktx.cpp}::ValidInternalFormat ( const unsigned  format)
Returns
True if the argument is a GLES compressed texture format that we support.

Definition at line 220 of file loader-ktx.cpp.

References DALI_LOG_ERROR, and KTX_SENTINEL.

Referenced by LoadKtxHeader().

Here is the caller graph for this function:

Variable Documentation

const Byte Dali::TizenPlatform::anonymous_namespace{loader-ktx.cpp}::FileIdentifier[]
Initial value:
= {
0xAB, 0x4B, 0x54, 0x58, 0x20, 0x31, 0x31, 0xBB, 0x0D, 0x0A, 0x1A, 0x0A
}

Definition at line 52 of file loader-ktx.cpp.

const unsigned Dali::TizenPlatform::anonymous_namespace{loader-ktx.cpp}::KtxInternalFormats[]

Definition at line 114 of file loader-ktx.cpp.

const unsigned Dali::TizenPlatform::anonymous_namespace{loader-ktx.cpp}::MAX_BYTES_OF_KEYVALUE_DATA = 65536U

We don't read any of this but limit it to a resonable amount in order to be friendly to files from random tools.

Definition at line 48 of file loader-ktx.cpp.

Referenced by LoadKtxHeader().

const unsigned Dali::TizenPlatform::anonymous_namespace{loader-ktx.cpp}::MAX_IMAGE_DATA_SIZE = MAX_TEXTURE_DIMENSION * MAX_TEXTURE_DIMENSION

Max bytes of image data allowed.

Not a precise number, just a sanity check.

Definition at line 45 of file loader-ktx.cpp.

const unsigned Dali::TizenPlatform::anonymous_namespace{loader-ktx.cpp}::MAX_TEXTURE_DIMENSION = 4096

Max width or height of an image.

Definition at line 43 of file loader-ktx.cpp.

Dali Docs Home
Read more about Dali