CommonLibSSE NG
Loading...
Searching...
No Matches
GFxResourceWeakLib.h
Go to the documentation of this file.
1#pragma once
2
3#include "RE/G/GAtomic.h"
6#include "RE/G/GHashSet.h"
7
8namespace RE
9{
11 {
12 public:
14
16 {
17 enum class NodeType
18 {
21 };
22
24
25 union
26 {
29 };
30
31 bool operator==(const GFxResourceKey& a_src) const
32 {
33 assert(resource);
35 return resource->GetKey() == a_src;
36 }
37 return resolver->GetKey() == a_src;
38 }
39
40 bool operator!=(const GFxResourceKey& a_src) const
41 {
42 return !operator==(a_src);
43 }
44
45 struct HashOp
46 {
47 UPInt operator()(const ResourceNode& a_node) const
48 {
49 assert(a_node.resource);
50 GFxResourceKey key =
51 (a_node.type == NodeType::kResource) ? a_node.resource->GetKey() : a_node.resolver->GetKey();
52 return operator()(key);
53 }
54
55 UPInt operator()(const GFxResourceKey& a_key) const
56 {
57 return GFxResourceKey::HashOp()(a_key);
58 }
59 };
60 };
61
62 // override (GFxResourceLibBase)
63 void RemoveResourceOnRelease(GFxResource* a_res) override; // 01
64 void PinResource(GFxResource* a_res) override; // 02
65 void UnpinResource(GFxResource* a_res) override; // 03
66
67 // members
72 };
73 static_assert(sizeof(GFxResourceWeakLib) == 0x50);
74}
Definition GFxResource.h:15
virtual GFxResourceKey GetKey()
Definition GFxResourceKey.h:34
Definition GFxResourceKey.h:6
Definition GFxResourceLib.h:19
const GFxResourceKey & GetKey() const
Definition GFxResourceLib.h:28
Definition GFxResourceLibBase.h:11
Definition GFxResourceLib.h:16
Definition GFxResourceWeakLib.h:11
GPtr< GMemoryHeap > imageHeap
Definition GFxResourceWeakLib.h:71
void RemoveResourceOnRelease(GFxResource *a_res) override
void PinResource(GFxResource *a_res) override
GHashSet< ResourceNode, ResourceNode::HashOp > resources
Definition GFxResourceWeakLib.h:70
GFxResourceLib * strongLib
Definition GFxResourceWeakLib.h:68
void UnpinResource(GFxResource *a_res) override
GLock resourceLock
Definition GFxResourceWeakLib.h:69
Definition GHashSet.h:18
Definition GAtomic.h:6
Definition GPtr.h:7
Definition AbsorbEffect.h:6
std::size_t UPInt
Definition SFTypes.h:5
Definition GFxResourceWeakLib.h:46
UPInt operator()(const GFxResourceKey &a_key) const
Definition GFxResourceWeakLib.h:55
UPInt operator()(const ResourceNode &a_node) const
Definition GFxResourceWeakLib.h:47
Definition GFxResourceWeakLib.h:16
GFxResource * resource
Definition GFxResourceWeakLib.h:28
ResourceSlot * resolver
Definition GFxResourceWeakLib.h:27
bool operator!=(const GFxResourceKey &a_src) const
Definition GFxResourceWeakLib.h:40
NodeType type
Definition GFxResourceWeakLib.h:23
NodeType
Definition GFxResourceWeakLib.h:18
bool operator==(const GFxResourceKey &a_src) const
Definition GFxResourceWeakLib.h:31