1#pragma once
2
3#include "common/aglGPUMemBlock.h"
4#include "detail/aglMemoryPoolHeap.h"
5
6namespace sead {
7class Heap;
8}
9
10namespace agl {
11class GPUMemAddrBase {
12public:
13 GPUMemAddrBase() {}
14 GPUMemAddrBase(const GPUMemAddrBase& other, int alignmentOffset)
15 : mMemoryPool(other.mMemoryPool), mAlignmentAddr(other.mAlignmentAddr + alignmentOffset),
16 mMemoryBlock(other.mMemoryBlock) {}
17 GPUMemAddrBase(const GPUMemBlockBase& memBlock, u64 offset);
18
19 u32 verify_() const;
20 void deleteGPUMemBlock() const;
21 void invalidate();
22 u32 getAlignmentAddress() const;
23 void setByteOffsetByPtr(void* ptr);
24 void roundUp(int addr);
25 void flushCPUCache(u64);
26 void invalidateCPUCache(u64);
27
28 bool isValid() const { return mMemoryPool != nullptr; }
29
30private:
31 detail::MemoryPool* mMemoryPool = nullptr;
32 int mAlignmentAddr = 0;
33 GPUMemBlockBase* mMemoryBlock = nullptr;
34};
35
36template <typename T>
37class GPUMemAddr : public GPUMemAddrBase {};
38} // namespace agl
39