@@ -81,6 +81,12 @@ enum class ImageFormat : int32_t {
8181 STRATA_BC7,
8282 STRATA_BC6H,
8383 // endregion
84+
85+ // region SourcePP Virtual Formats
86+ SOURCEPP_BGRA8888_HDR = 10000 ,
87+ SOURCEPP_RGBA16161616_HDR,
88+ SOURCEPP_CONSOLE_RGBA16161616_HDR,
89+ // endregion
8490};
8591
8692namespace ImageFormatDetails {
@@ -157,6 +163,9 @@ namespace ImageFormatDetails {
157163 case TFALL2_BC7:
158164 case STRATA_BC7:
159165 case STRATA_BC6H:
166+ case SOURCEPP_BGRA8888_HDR:
167+ case SOURCEPP_RGBA16161616_HDR:
168+ case SOURCEPP_CONSOLE_RGBA16161616_HDR:
160169 return -1 ;
161170 }
162171 return 0 ;
@@ -182,6 +191,9 @@ namespace ImageFormatDetails {
182191 return 8 ;
183192 case TFALL2_BC6H:
184193 case STRATA_BC6H:
194+ case SOURCEPP_BGRA8888_HDR:
195+ case SOURCEPP_RGBA16161616_HDR:
196+ case SOURCEPP_CONSOLE_RGBA16161616_HDR:
185197 return 16 ;
186198 default :
187199 break ;
@@ -262,6 +274,9 @@ namespace ImageFormatDetails {
262274 case TFALL2_BC7:
263275 case STRATA_BC7:
264276 case STRATA_BC6H:
277+ case SOURCEPP_BGRA8888_HDR:
278+ case SOURCEPP_RGBA16161616_HDR:
279+ case SOURCEPP_CONSOLE_RGBA16161616_HDR:
265280 return -1 ;
266281 }
267282 return 0 ;
@@ -287,6 +302,9 @@ namespace ImageFormatDetails {
287302 return 8 ;
288303 case TFALL2_BC6H:
289304 case STRATA_BC6H:
305+ case SOURCEPP_BGRA8888_HDR:
306+ case SOURCEPP_RGBA16161616_HDR:
307+ case SOURCEPP_CONSOLE_RGBA16161616_HDR:
290308 return 16 ;
291309 default :
292310 break ;
@@ -366,6 +384,9 @@ namespace ImageFormatDetails {
366384 case TFALL2_BC7:
367385 case STRATA_BC7:
368386 case STRATA_BC6H:
387+ case SOURCEPP_BGRA8888_HDR:
388+ case SOURCEPP_RGBA16161616_HDR:
389+ case SOURCEPP_CONSOLE_RGBA16161616_HDR:
369390 return -1 ;
370391 }
371392 return 0 ;
@@ -391,6 +412,9 @@ namespace ImageFormatDetails {
391412 return 8 ;
392413 case TFALL2_BC6H:
393414 case STRATA_BC6H:
415+ case SOURCEPP_BGRA8888_HDR:
416+ case SOURCEPP_RGBA16161616_HDR:
417+ case SOURCEPP_CONSOLE_RGBA16161616_HDR:
394418 return 16 ;
395419 default :
396420 break ;
@@ -470,6 +494,9 @@ namespace ImageFormatDetails {
470494 case TFALL2_BC7:
471495 case STRATA_BC7:
472496 case STRATA_BC6H:
497+ case SOURCEPP_BGRA8888_HDR:
498+ case SOURCEPP_RGBA16161616_HDR:
499+ case SOURCEPP_CONSOLE_RGBA16161616_HDR:
473500 return -1 ;
474501 }
475502 return 0 ;
@@ -497,6 +524,9 @@ namespace ImageFormatDetails {
497524 case ATI1N:
498525 case TFALL2_BC6H:
499526 case STRATA_BC6H:
527+ case SOURCEPP_BGRA8888_HDR:
528+ case SOURCEPP_RGBA16161616_HDR:
529+ case SOURCEPP_CONSOLE_RGBA16161616_HDR:
500530 return 0 ;
501531 default :
502532 break ;
@@ -520,6 +550,8 @@ namespace ImageFormatDetails {
520550 case RGBA16161616F:
521551 case RGBA16161616:
522552 case CONSOLE_RGBA16161616_LINEAR:
553+ case SOURCEPP_RGBA16161616_HDR:
554+ case SOURCEPP_CONSOLE_RGBA16161616_HDR:
523555 case RG3232F:
524556 return 64 ;
525557 case RGBA8888:
@@ -531,6 +563,7 @@ namespace ImageFormatDetails {
531563 case BGRA8888:
532564 case CONSOLE_BGRA8888_LINEAR:
533565 case CONSOLE_BGRA8888_LE:
566+ case SOURCEPP_BGRA8888_HDR:
534567 case BGRX8888:
535568 case CONSOLE_BGRX8888_LINEAR:
536569 case CONSOLE_BGRX8888_LE:
@@ -602,6 +635,9 @@ namespace ImageFormatDetails {
602635 case RGBA32323232F:
603636 case TFALL2_BC6H:
604637 case STRATA_BC6H:
638+ case SOURCEPP_BGRA8888_HDR:
639+ case SOURCEPP_RGBA16161616_HDR:
640+ case SOURCEPP_CONSOLE_RGBA16161616_HDR:
605641 return RGBA32323232F;
606642 case RGBA16161616:
607643 case CONSOLE_RGBA16161616_LINEAR:
@@ -676,14 +712,32 @@ namespace ImageFormatDetails {
676712}
677713
678714/* *
679- * Check if the given format is a compressed format (DXT1, DXT3, DXT5, ATI1N, ATI2N, BC7, BC6H).
715+ * Check if the given format is a compressed format (DXT1, DXT3, DXT5, ATI1N, ATI2N, BC7, BC6H, BGRA8888 HDR, RGBA16161616 HDR ).
680716 * @param format The format to check.
681717 * @return True if the given format is compressed.
682718 */
683719[[nodiscard]] constexpr bool compressed (ImageFormat format) {
684720 return red (format) == -1 ;
685721}
686722
723+ /* *
724+ * Check if the given format is a compressed HDR format (not counting BC6H).
725+ * @param format The format to check.
726+ * @return True if the format is a compressed HDR format..
727+ */
728+ [[nodiscard]] constexpr bool compressedHDR (ImageFormat format) {
729+ switch (format) {
730+ using enum ImageFormat;
731+ case SOURCEPP_BGRA8888_HDR:
732+ case SOURCEPP_RGBA16161616_HDR:
733+ case SOURCEPP_CONSOLE_RGBA16161616_HDR:
734+ return true ;
735+ default :
736+ break ;
737+ }
738+ return false ;
739+ }
740+
687741/* *
688742 * Check if the given format can store transparency.
689743 * @param format The format to check.
@@ -757,6 +811,42 @@ namespace ImageFormatDetails {
757811 case CONSOLE_RGBA16161616_LINEAR:
758812 case CONSOLE_BGRX8888_LE:
759813 case CONSOLE_BGRA8888_LE:
814+ case SOURCEPP_CONSOLE_RGBA16161616_HDR:
815+ return true ;
816+ default :
817+ break ;
818+ }
819+ return false ;
820+ }
821+
822+ /* *
823+ * Check if the given format is exclusively used by Titanfall 2.
824+ * @param format The format to check.
825+ * @return True if the format is exclusively used by Titanfall 2.
826+ */
827+ [[nodiscard]] constexpr bool tfall2 (ImageFormat format) {
828+ switch (format) {
829+ using enum ImageFormat;
830+ case TFALL2_BC6H:
831+ case TFALL2_BC7:
832+ return true ;
833+ default :
834+ break ;
835+ }
836+ return false ;
837+ }
838+
839+ /* *
840+ * Check if the given format is exclusively used by Strata Source.
841+ * @param format The format to check.
842+ * @return True if the format is exclusively used by Strata Source.
843+ */
844+ [[nodiscard]] constexpr bool strata (ImageFormat format) {
845+ switch (format) {
846+ using enum ImageFormat;
847+ case STRATA_R8:
848+ case STRATA_BC7:
849+ case STRATA_BC6H:
760850 return true ;
761851 default :
762852 break ;
@@ -869,7 +959,7 @@ namespace ImageFormatDetails {
869959 * @return The length in bytes of a texture containing the given format, width, height, and depth.
870960 */
871961[[nodiscard]] constexpr uint32_t getDataLength (ImageFormat format, uint16_t width, uint16_t height, uint16_t depth = 1 ) {
872- if (ImageFormatDetails::compressed (format)) {
962+ if (ImageFormatDetails::compressed (format) && ! ImageFormatDetails::compressedHDR (format) ) {
873963 return ((width + 3 ) / 4 ) * ((height + 3 ) / 4 ) * depth * bpp (format) * 2 ;
874964 }
875965 return width * height * depth * (bpp (format) / 8 );
0 commit comments