UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
ICompressionFormat.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreTypes.h"
10
11
12#define COMPRESSION_FORMAT_FEATURE_NAME "CompressionFormat"
13
15{
17
18 UE_DEPRECATED(5.5, "Switch to 64 bit version for memory sizes")
19 virtual bool Compress(void* CompressedBuffer, int32& CompressedSize, const void* UncompressedBuffer, int32 UncompressedSize, int32 CompressionData, ECompressionFlags Flags) { return false; };
20
21 // Default 64 bit implementation wraps legacy 32 bit implementation with size checks - will be removed when deprecated function is removed
22 virtual bool Compress(void* CompressedBuffer, int64& CompressedSize, const void* UncompressedBuffer, int64 UncompressedSize, uintptr_t CompressionData, ECompressionFlags Flags)
23 {
25 !IntFitsIn<int32>(CompressedSize) ||
27 {
28 return false;
29 }
31 return Compress(CompressedBuffer, (int32&)CompressedSize, UncompressedBuffer, (int32)UncompressedSize, (int32)CompressionData, Flags);
33 }
34
35 UE_DEPRECATED(5.5, "Switch to 64 bit version for memory sizes")
36 virtual bool Uncompress(void* UncompressedBuffer, int32& UncompressedSize, const void* CompressedBuffer, int32 CompressedSize, int32 CompressionData) {return false;};
37
38 // Default 64 bit implementation wraps legacy 32 bit implementation with size checks - will be removed when deprecated function is removed
39 virtual bool Uncompress(void* UncompressedBuffer, int64 UncompressedSize, const void* CompressedBuffer, int64 CompressedSize, uintptr_t CompressionData)
40 {
42 !IntFitsIn<int32>(CompressedSize) ||
44 {
45 return false;
46 }
48 return Uncompress(UncompressedBuffer, (int32&)UncompressedSize, CompressedBuffer, (int32)CompressedSize, (int32)CompressionData);
50 }
51
52 UE_DEPRECATED(5.5, "Switch to 64 bit version for memory sizes")
54
56 {
59 {
60 checkf(0, TEXT("%s::GetCompressedBufferSize can't handle 64 bits - format needs to upgrade to the new API."), *GetCompressionFormatName().ToString());
61 return false;
62 }
63
67 return true;
68 }
69
70 virtual uint32 GetVersion() = 0;
71 virtual FString GetDDCKeySuffix() = 0;
72
73 // Returns whether the compression format internally decides whether the decreased size is worth the CPU cost
74 // of decompressing it. If the format does this check it should report this by returning a compressed buffer
75 // larger than the decompressed buffer - this is usually automatic as the format would presumably then send the
76 // data uncompressed wrapped in the format's container, which would increase the size.
77 // See FCompression::CompressMemoryIfWorthDecompressing.
79};
#define checkf(expr, format,...)
Definition AssertionMacros.h:315
ECompressionFlags
Definition CompressionFlags.h:13
#define UE_DEPRECATED(Version, Message)
Definition CoreMiscDefines.h:302
#define TEXT(x)
Definition Platform.h:1272
FPlatformTypes::int64 int64
A 64-bit signed integer.
Definition Platform.h:1127
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define PRAGMA_ENABLE_DEPRECATION_WARNINGS
Definition GenericPlatformCompilerPreSetup.h:12
#define PRAGMA_DISABLE_DEPRECATION_WARNINGS
Definition GenericPlatformCompilerPreSetup.h:8
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition NameTypes.h:617
Definition IModularFeature.h:12
Definition ModuleInterface.h:14
Definition ICompressionFormat.h:15
virtual bool Uncompress(void *UncompressedBuffer, int32 &UncompressedSize, const void *CompressedBuffer, int32 CompressedSize, int32 CompressionData)
Definition ICompressionFormat.h:36
virtual bool Uncompress(void *UncompressedBuffer, int64 UncompressedSize, const void *CompressedBuffer, int64 CompressedSize, uintptr_t CompressionData)
Definition ICompressionFormat.h:39
virtual bool DoesOwnWorthDecompressingCheck()=0
virtual FString GetDDCKeySuffix()=0
virtual bool Compress(void *CompressedBuffer, int64 &CompressedSize, const void *UncompressedBuffer, int64 UncompressedSize, uintptr_t CompressionData, ECompressionFlags Flags)
Definition ICompressionFormat.h:22
virtual int32 GetCompressedBufferSize(int32 UncompressedSize, int32 CompressionData)
Definition ICompressionFormat.h:53
virtual bool GetCompressedBufferSize(int64 &OutBufferSize, int64 UncompressedSize, uintptr_t CompressionData)
Definition ICompressionFormat.h:55
virtual FName GetCompressionFormatName()=0
virtual uint32 GetVersion()=0