lullaby/tools/texture_pipeline/encode_ktx.cc
// Pixel data type size for endian swapping
// Can be inferred from GlType
// e.g. GL_RGBA8 uses bytes so type size is 1
// e.g. GLRGBA32F uses 32 bit floats so type size is 4
// https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/#2.4
Pixel data type size for endian swapping
Can be inferred from GlType
e.g. GL_RGBA8 uses bytes so type size is 1
e.g.
Pixel data type size for endian swapping Can be inferred from GlType e . g . GL_RGBA8 uses bytes so type size is 1 e . g .
uint32_t KtxUncompressedImage::GlTypeSize() const {
  switch (image_data_.GetFormat()) {
    case ImageData::kAlpha:
    case ImageData::kLuminance:
      return 1;
    case ImageData::kLuminanceAlpha:
    case ImageData::kRgba4444:
    case ImageData::kRgb565:
    case ImageData::kRgba5551:
      return 2;
    case ImageData::kRgb888:
    case ImageData::kRgba8888:
      return 1;
    default:
      LOG(ERROR) << "Unknown Gl type size for " << image_data_.GetFormat();
      return 1;
  }
}
uint32_t KtxUncompressedImage :: GlTypeSize ( ) const { switch ( image_data_ . GetFormat ( ) ) { case ImageData :: kAlpha : case ImageData :: kLuminance : return 1 ; case ImageData :: kLuminanceAlpha : case ImageData :: kRgba4444 : case ImageData :: kRgb565 : case ImageData :: kRgba5551 : return 2 ; case ImageData :: kRgb888 : case ImageData :: kRgba8888 : return 1 ; default : LOG ( ERROR ) << " " << image_data_ . GetFormat ( ) ; return 1 ; } }
Pixel data type size for endian swapping
Can be inferred from GlType
e.g.
Pixel data type size for endian swapping Can be inferred from GlType e . g .
// TODO to make more robust?