diff --git a/src/igl/Texture.cpp b/src/igl/Texture.cpp index 361080daa..c609bc63f 100644 --- a/src/igl/Texture.cpp +++ b/src/igl/Texture.cpp @@ -266,9 +266,9 @@ TextureFormatProperties TextureFormatProperties::fromTextureFormat(TextureFormat COLOR(A_UNorm8, 1, 1, 0) COLOR(L_UNorm8, 1, 1, 0) COLOR(R_UNorm8, 1, 1, 0) - COLOR(R_F16, 1, 2, 0) - COLOR(R_UInt16, 1, 2, Flags::Integer) - COLOR(R_UNorm16, 1, 2, 0) + COLOR(R_F16, 1, 2, Flags::HDR) + COLOR(R_UInt16, 1, 2, Flags::Integer | Flags::HDR) + COLOR(R_UNorm16, 1, 2, Flags::HDR) COLOR(B5G5R5A1_UNorm, 4, 2, 0) COLOR(B5G6R5_UNorm, 3, 2, 0) COLOR(ABGR_UNorm4, 4, 2, 0) @@ -283,19 +283,19 @@ TextureFormatProperties TextureFormatProperties::fromTextureFormat(TextureFormat COLOR(BGRA_UNorm8_Rev, 4, 4, 0) COLOR(RGBA_SRGB, 4, 4, Flags::sRGB) COLOR(BGRA_SRGB, 4, 4, Flags::sRGB) - COLOR(RG_F16, 2, 4, 0) - COLOR(RG_UInt16, 2, 4, Flags::Integer) - COLOR(RG_UNorm16, 2, 4, 0) - COLOR(RGB10_A2_UNorm_Rev, 4, 4, 0) - COLOR(RGB10_A2_Uint_Rev, 4, 4, Flags::Integer) - COLOR(BGR10_A2_Unorm, 4, 4, 0) - COLOR(R_F32, 1, 4, 0) - COLOR(RGB_F16, 3, 6, 0) - COLOR(RGBA_F16, 4, 8, 0) - COLOR(RG_F32, 2, 8, 0) - COLOR(RGB_F32, 3, 12, 0) - COLOR(RGBA_UInt32, 4, 16, Flags::Integer) - COLOR(RGBA_F32, 4, 16, 0) + COLOR(RG_F16, 2, 4, Flags::HDR) + COLOR(RG_UInt16, 2, 4, Flags::Integer | Flags::HDR) + COLOR(RG_UNorm16, 2, 4, Flags::HDR) + COLOR(RGB10_A2_UNorm_Rev, 4, 4, Flags::HDR) + COLOR(RGB10_A2_Uint_Rev, 4, 4, Flags::Integer | Flags::HDR) + COLOR(BGR10_A2_Unorm, 4, 4, Flags::HDR) + COLOR(R_F32, 1, 4, Flags::HDR) + COLOR(RGB_F16, 3, 6, Flags::HDR) + COLOR(RGBA_F16, 4, 8, Flags::HDR) + COLOR(RG_F32, 2, 8, Flags::HDR) + COLOR(RGB_F32, 3, 12, Flags::HDR) + COLOR(RGBA_UInt32, 4, 16, Flags::Integer | Flags::HDR) + COLOR(RGBA_F32, 4, 16, Flags::HDR) COMPRESSED(RGBA_ASTC_4x4, 4, 16, 4, 4, 1, 1, 1, 1, 0) COMPRESSED(SRGB8_A8_ASTC_4x4, 4, 16, 4, 4, 1, 1, 1, 1, Flags::sRGB) COMPRESSED(RGBA_ASTC_5x4, 4, 16, 5, 4, 1, 1, 1, 1, 0) diff --git a/src/igl/Texture.h b/src/igl/Texture.h index b8b76c49e..3085e0980 100644 --- a/src/igl/Texture.h +++ b/src/igl/Texture.h @@ -239,6 +239,7 @@ struct TextureFormatProperties { Compressed = 1 << 2, sRGB = 1 << 3, Integer = 1 << 4, + HDR = 1 << 5, // Color format with more than 8 bits per component }; const char* IGL_NONNULL name = "Invalid"; @@ -278,6 +279,12 @@ struct TextureFormatProperties { [[nodiscard]] bool isSRGB() const noexcept { return (flags & Flags::sRGB) != 0; } + /** + * @brief true for high precision color texture formats. + */ + [[nodiscard]] bool isHDR() const noexcept { + return (flags & Flags::HDR) != 0; + } [[nodiscard]] bool hasDepth() const noexcept { return (flags & Flags::Depth) != 0;