9#include <QtCore/qiodevice.h>
15#include <QOpenGLTexture>
22#define KTX_IDENTIFIER_LENGTH 12
23static const char ktxIdentifier[
KTX_IDENTIFIER_LENGTH] = {
'\xAB',
'K',
'T',
'X',
' ',
'1',
'1',
'\xBB',
'\r',
'\n',
'\x1A',
'\n' };
78 return value + (rounding - 1) - ((
value + (rounding - 1)) % rounding);
98 qCDebug(lcQtGuiTextureIO,
"Invalid KTX file %s",
logName().constData());
103 if (!checkHeader(*
header)) {
104 qCDebug(lcQtGuiTextureIO,
"Unsupported KTX file format in %s",
logName().constData());
125 constexpr int MAX_ITERATIONS = 32;
144 qCDebug(lcQtGuiTextureIO,
"Invalid values in header of KTX file %s",
logName().constData());
151 qDebug() <<
"KTX file handler read" << texData;
163 QMetaEnum tfme = QMetaEnum::fromType<QOpenGLTexture::TextureFormat>();
164 QMetaEnum ptme = QMetaEnum::fromType<QOpenGLTexture::PixelType>();
187 return is2D && (
isCubeMap || isCompressedImage);
195 const quint32 keyAndValueByteSize =
211 const size_t keySize =
key.
size() + 1;
213 keyAndValueByteSize - keySize);
224 return inverseEndian ? qbswap<quint32>(
val) :
val;
qsizetype size() const noexcept
Returns the number of bytes in this byte array.
const char * constData() const noexcept
Returns a pointer to the const data stored in the byte array.
static QByteArray fromRawData(const char *data, qsizetype size)
Constructs a QByteArray that uses the first size bytes of the data array.
QByteArray readAll()
Reads all remaining data from the device, and returns it as a byte array.
static bool canRead(const QByteArray &suffix, const QByteArray &block)
QTextureFileData read() override
static QString fromUtf8(QByteArrayView utf8)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QString left(qsizetype n) const
Returns a substring that contains the n leftmost characters of the string.
static QString static QString qsizetype indexOf(QChar c, qsizetype from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
QByteArray toUtf8() const &
void setKeyValueMetadata(const QMap< QByteArray, QByteArray > &keyValues)
void setDataLength(int length, int level=0, int face=0)
void setSize(const QSize &size)
void setGLInternalFormat(quint32 format)
void setGLFormat(quint32 format)
void setDataOffset(int offset, int level=0, int face=0)
void setData(const QByteArray &data)
void setLogName(const QByteArray &name)
void setGLBaseInternalFormat(quint32 format)
void setNumLevels(int num)
void setNumFaces(int num)
QIODevice * device() const
QByteArray logName() const
Combined button and popup list for selecting options.
int qstrncmp(const char *str1, const char *str2, size_t len)
static QString header(const QString &name)
static bool isCubeMap(const DDSHeader &dds)
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
static const quint32 platformEndianIdentifier
constexpr quint32 withPadding(quint32 value, quint32 rounding)
#define KTX_IDENTIFIER_LENGTH
static const char ktxIdentifier[KTX_IDENTIFIER_LENGTH]
static const quint32 qktxh_headerSize
static const quint32 inversePlatformEndianIdentifier
#define qCDebug(category,...)
constexpr const T & qMin(const T &a, const T &b)
GLenum GLuint GLint level
GLenum GLuint GLenum GLsizei const GLchar * buf
GLenum GLuint GLintptr offset
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei imageSize
unsigned long long quint64
QT_BEGIN_NAMESPACE typedef uchar * output
quint32 keyAndValueByteSize