33#ifndef DVD_RESOURCE_CACHE_H_
34#define DVD_RESOURCE_CACHE_H_
51 [[nodiscard]]
static bool SetLoading(
size_t hash );
71 template <
typename T>
requires std::is_base_of_v<CachedResource, T>
74 template <
typename T>
requires std::is_base_of_v<CachedResource, T>
77 template <
typename T>
requires std::is_base_of_v<CachedResource, T>
81 template <
typename T>
requires std::is_base_of_v<CachedResource, T>
89 template <
typename T>
requires std::is_base_of_v<CachedResource, T>
92 template<
typename T>
requires std::is_base_of_v<Resource, T>
95 template<
typename T>
requires std::is_base_of_v<Resource, T>
98 template<
typename T>
requires std::is_base_of_v<Resource, T>
101 template<
typename T>
requires std::is_base_of_v<Resource, T>
112 template <
typename T>
requires std::is_base_of_v<CachedResource, T>
115 return ResourceCache::LoadResource<T>( descriptor, wasInCache, taskCounter );
118 template <
typename T>
requires std::is_base_of_v<CachedResource, T>
121 std::atomic_uint taskCounter = 0u;
125 template <
typename T>
requires std::is_base_of_v<CachedResource, T>
128 bool wasInCache =
false;
132 template <
typename T>
requires std::is_base_of_v<CachedResource, T>
135 bool wasInCache =
false;
136 std::atomic_uint taskCounter = 0u;
140 template <
typename T>
requires std::is_base_of_v<CachedResource, T>
143 return ResourceCache::RetrieveFromCache<T>( handle );
146 template <
typename T>
requires std::is_base_of_v<CachedResource, T>
149 ResourceCache::Destroy<T>(handle, immediate);
152 template <
typename T>
requires std::is_base_of_v<CachedResource, T>
static ResourcePtr< T > AllocateInternal(const ResourceDescriptor< T > &descriptor)
static Handle< T > RetrieveFromCache(Handle< T > handle)
static void Destroy(Handle< T > &handle, const bool immediate)
static vector< ResourcePoolBase * > s_resourcePools
static Handle< T > RetrieveOrAllocateHandle(size_t descriptorHash, bool &wasInCache)
static void OnFrameStart()
static T * Get(Handle< T > handle)
static void RegisterPool(ResourcePoolBase *pool)
static PlatformContext * s_context
static Handle< T > LoadResource(const ResourceDescriptor< T > &descriptor, bool &wasInCache, std::atomic_uint &taskCounter)
static ResourcePtr< T > Allocate(Handle< T > handle, const ResourceDescriptor< T > &descriptor, size_t descriptorHash)
static RenderAPI s_renderAPI
static void Init(RenderAPI renderAPI, PlatformContext &context)
static void PrintLeakedResources()
static void Build(ResourcePtr< T > ptr, const ResourceDescriptor< T > &descriptor)
static ResourcePtr< T > AllocateAndCommit(Handle< T > handle, const ResourceDescriptor< T > &descriptor)
const size_t _loadingHash
static eastl::set< size_t > s_loadingHashes
static SharedMutex s_hashLock
static bool SetLoadingFinished(size_t hash)
static bool SetLoading(size_t hash)
Handle console commands that start with a forward slash.
FORCE_INLINE void DestroyResource(Handle< T > &handle, const bool immediate=false)
std::shared_mutex SharedMutex
FORCE_INLINE Handle< T > GetResourceRef(const Handle< T > handle)
eastl::vector< Type > vector
FORCE_INLINE Handle< T > CreateResource(const ResourceDescriptor< T > &descriptor, bool &wasInCache, std::atomic_uint &taskCounter)
FORCE_INLINE T * Get(const Handle< T > handle)