From 0a49f5cf74f7ef3346c355036606d631a67d2445 Mon Sep 17 00:00:00 2001 From: Steve Streeting Date: Mon, 4 Oct 2021 17:30:07 +0100 Subject: [PATCH] Storage & lookup for textures --- .../Public/StevesTextureRenderTargetPool.h | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/Source/StevesUEHelpers/Public/StevesTextureRenderTargetPool.h b/Source/StevesUEHelpers/Public/StevesTextureRenderTargetPool.h index bf7dd22..41ddbdd 100644 --- a/Source/StevesUEHelpers/Public/StevesTextureRenderTargetPool.h +++ b/Source/StevesUEHelpers/Public/StevesTextureRenderTargetPool.h @@ -42,6 +42,33 @@ protected: /// The name of the pool. It's possible to have more than one texture pool. FName PoolName; + struct FTextureKey + { + FIntPoint Size; + ETextureRenderTargetFormat Format; + + friend bool operator==(const FTextureKey& Lhs, const FTextureKey& RHS) + { + return Lhs.Size == RHS.Size + && Lhs.Format == RHS.Format; + } + + friend bool operator!=(const FTextureKey& Lhs, const FTextureKey& RHS) + { + return !(Lhs == RHS); + } + + friend uint32 GetTypeHash(const FTextureKey& Key) + { + return HashCombine(GetTypeHash(Key.Size), static_cast(Key.Format)); + } + + }; + + TMultiMap> UnreservedTextures; + TArray> ReservedTextures; + + friend struct FStevesTextureRenderTargetReservation; /// Release a reservation on a texture, allowing it back into the pool /// Protected because only FStevesTextureRenderTargetReservation will need to do this.