66 static constexpr quint8 DepthTextureFlag = 1u << 6;
67 static constexpr quint8 CompressedTextureFlag = 1u << 7;
69 enum Format : quint8 {
113 Depth16 = DepthTextureFlag + 1,
119 RGBA_DXT1 = CompressedTextureFlag + 1,
129 RGB8_PunchThrough_Alpha1_ETC2,
130 SRGB8_PunchThrough_Alpha1_ETC2,
132 SRGB8_Alpha8_ETC2_EAC,
147 SRGB8_Alpha8_ASTC_4x4,
148 SRGB8_Alpha8_ASTC_5x4,
149 SRGB8_Alpha8_ASTC_5x5,
150 SRGB8_Alpha8_ASTC_6x5,
151 SRGB8_Alpha8_ASTC_6x6,
152 SRGB8_Alpha8_ASTC_8x5,
153 SRGB8_Alpha8_ASTC_8x6,
154 SRGB8_Alpha8_ASTC_8x8,
155 SRGB8_Alpha8_ASTC_10x5,
156 SRGB8_Alpha8_ASTC_10x6,
157 SRGB8_Alpha8_ASTC_10x8,
158 SRGB8_Alpha8_ASTC_10x10,
159 SRGB8_Alpha8_ASTC_12x10,
160 SRGB8_Alpha8_ASTC_12x12,
171 constexpr QSSGRenderTextureFormat(Format f) : format(f) {}
173 [[nodiscard]]
constexpr bool isCompressedTextureFormat()
const noexcept
175 return (format & CompressedTextureFlag);
178 [[nodiscard]]
constexpr bool isUncompressedTextureFormat()
const noexcept
180 return !isCompressedTextureFormat();
183 [[nodiscard]]
bool isDepthTextureFormat()
const noexcept
185 return (format & DepthTextureFlag);
188 [[nodiscard]]
const char *toString()
const;
190 [[nodiscard]] qint32 getSizeofFormat()
const noexcept;
192 [[nodiscard]] qint32 getNumberOfComponent()
const noexcept;
194 void decodeToFloat(
void *inPtr, qint32 byteOfs,
float *outPtr)
const;
195 void encodeToPixel(
float *inPtr,
void *outPtr, qint32 byteOfs)
const;
197 bool operator==(
const QSSGRenderTextureFormat &other)
const {
return format == other.format; }
198 bool operator!=(
const QSSGRenderTextureFormat &other)
const {
return format != other.format; }
357 QSSGBaseTypeHelpers() =
default;
360 static const char *toString(QSSGRenderTextureCubeFace value);
361 static const char *toString(QSSGRenderTextureTypeValue value);
362 static const char *toString(QSSGDepthDrawMode value);
363 static const char *toString(QSSGRenderWinding value);
364 static const char *toString(QSSGCullFaceMode value);
365 static const char *toString(QSSGRenderComponentType value);
366 static const char *toString(QSSGRenderTextureFormat::Format value);
367 static const char *toString(QSSGRenderTextureCoordOp value);
368 static const char *toString(QSSGRenderTextureFilterOp value);
370 static const char *displayName(QSSGRenderTextureCubeFace face);
372 static size_t getSizeOfType(QSSGRenderComponentType type);
375 static constexpr QSSGRenderTextureCubeFace next(QSSGRenderTextureCubeFace face)
376 {
return (face == QSSGRenderTextureCubeFaces[5]) ? QSSGRenderTextureCubeFaces[0] : QSSGRenderTextureCubeFace(quint8(face) + 1); }
377 static constexpr QSSGRenderTextureCubeFace prev(QSSGRenderTextureCubeFace face)
378 {
return (face == QSSGRenderTextureCubeFaces[0]) ? QSSGRenderTextureCubeFaces[5] : QSSGRenderTextureCubeFace(quint8(face) - 1); }
380 static constexpr QSSGRenderTextureCubeFaceT indexOfCubeFace(QSSGRenderTextureCubeFace face)
noexcept {
return QSSGRenderTextureCubeFaceT(face) & 0xf; }