81 static constexpr quint8 DepthTextureFlag = 1u << 6;
82 static constexpr quint8 CompressedTextureFlag = 1u << 7;
84 enum Format : quint8 {
128 Depth16 = DepthTextureFlag + 1,
134 RGBA_DXT1 = CompressedTextureFlag + 1,
144 RGB8_PunchThrough_Alpha1_ETC2,
145 SRGB8_PunchThrough_Alpha1_ETC2,
147 SRGB8_Alpha8_ETC2_EAC,
162 SRGB8_Alpha8_ASTC_4x4,
163 SRGB8_Alpha8_ASTC_5x4,
164 SRGB8_Alpha8_ASTC_5x5,
165 SRGB8_Alpha8_ASTC_6x5,
166 SRGB8_Alpha8_ASTC_6x6,
167 SRGB8_Alpha8_ASTC_8x5,
168 SRGB8_Alpha8_ASTC_8x6,
169 SRGB8_Alpha8_ASTC_8x8,
170 SRGB8_Alpha8_ASTC_10x5,
171 SRGB8_Alpha8_ASTC_10x6,
172 SRGB8_Alpha8_ASTC_10x8,
173 SRGB8_Alpha8_ASTC_10x10,
174 SRGB8_Alpha8_ASTC_12x10,
175 SRGB8_Alpha8_ASTC_12x12,
186 constexpr QSSGRenderTextureFormat(Format f) : format(f) {}
188 [[nodiscard]]
constexpr bool isCompressedTextureFormat()
const noexcept
190 return (format & CompressedTextureFlag);
193 [[nodiscard]]
constexpr bool isUncompressedTextureFormat()
const noexcept
195 return !isCompressedTextureFormat();
198 [[nodiscard]]
bool isDepthTextureFormat()
const noexcept
200 return (format & DepthTextureFlag);
203 [[nodiscard]]
const char *toString()
const;
205 [[nodiscard]] qint32 getSizeofFormat()
const noexcept;
207 [[nodiscard]] qint32 getNumberOfComponent()
const noexcept;
209 void decodeToFloat(
void *inPtr, qint32 byteOfs,
float *outPtr)
const;
210 void encodeToPixel(
float *inPtr,
void *outPtr, qint32 byteOfs)
const;
212 bool operator==(
const QSSGRenderTextureFormat &other)
const {
return format == other.format; }
213 bool operator!=(
const QSSGRenderTextureFormat &other)
const {
return format != other.format; }
372 QSSGBaseTypeHelpers() =
default;
375 static const char *toString(QSSGRenderTextureCubeFace value);
376 static const char *toString(QSSGRenderTextureTypeValue value);
377 static const char *toString(QSSGDepthDrawMode value);
378 static const char *toString(QSSGRenderWinding value);
379 static const char *toString(QSSGCullFaceMode value);
380 static const char *toString(QSSGRenderComponentType value);
381 static const char *toString(QSSGRenderTextureFormat::Format value);
382 static const char *toString(QSSGRenderTextureCoordOp value);
383 static const char *toString(QSSGRenderTextureFilterOp value);
384 static QByteArray toString(QSSGRenderSamplerType value);
386 static const char *displayName(QSSGRenderTextureCubeFace face);
388 static size_t getSizeOfType(QSSGRenderComponentType type);
391 static constexpr QSSGRenderTextureCubeFace next(QSSGRenderTextureCubeFace face)
392 {
return (face == QSSGRenderTextureCubeFaces[5]) ? QSSGRenderTextureCubeFaces[0] : QSSGRenderTextureCubeFace(quint8(face) + 1); }
393 static constexpr QSSGRenderTextureCubeFace prev(QSSGRenderTextureCubeFace face)
394 {
return (face == QSSGRenderTextureCubeFaces[0]) ? QSSGRenderTextureCubeFaces[5] : QSSGRenderTextureCubeFace(quint8(face) - 1); }
396 static constexpr QSSGRenderTextureCubeFaceT indexOfCubeFace(QSSGRenderTextureCubeFace face)
noexcept {
return QSSGRenderTextureCubeFaceT(face) & 0xf; }