| 1 | #pragma once |
| 2 | |
| 3 | #include <nn/gfx/gfx_Types.h> |
| 4 | #include <container/seadPtrArray.h> |
| 5 | #include <heap/seadDisposer.h> |
| 6 | #include <hostio/seadHostIONode.h> |
| 7 | #include <math/seadMathCalcCommon.h> |
| 8 | #include <prim/seadTypedBitFlag.h> |
| 9 | #include <thread/seadCriticalSection.h> |
| 10 | #include "common/aglGPUCommon.hpp" |
| 11 | |
| 12 | namespace agl { |
| 13 | |
| 14 | namespace detail { |
| 15 | class MemoryPool; |
| 16 | class MemoryPoolHeap; |
| 17 | } // namespace detail |
| 18 | |
| 19 | class GPUMemBlockBase { |
| 20 | public: |
| 21 | GPUMemBlockBase(); |
| 22 | virtual ~GPUMemBlockBase(); |
| 23 | |
| 24 | void clear(); |
| 25 | void freeBuffer(); |
| 26 | void free(); |
| 27 | void allocBuffer_(u64, sead::Heap*, s32, MemoryAttribute); |
| 28 | bool tryAllocBuffer_(u64, sead::Heap*, s32, MemoryAttribute); |
| 29 | void setBuffer_(u64, void*, void*, MemoryAttribute); |
| 30 | void setVirtual_(u64, sead::Heap*, MemoryAttribute, GPUMemVoidAddr, s32); |
| 31 | void initializeGfxMemoryPool(nn::gfx::MemoryPool*) const; |
| 32 | void addList(GPUMemBlockBase*); |
| 33 | void setMemoryPool(void*, u64, detail::MemoryPool*); |
| 34 | void setMemoryPoolHeap(void*, u64, detail::MemoryPoolHeap*); |
| 35 | u64 getByteOffset() const; |
| 36 | u64 getMemoryPoolType() const; |
| 37 | |
| 38 | // TODO: the rest of the methods... |
| 39 | |
| 40 | private: |
| 41 | void* mMemoryBuffer; |
| 42 | u64 mMemoryBufferSize; |
| 43 | detail::MemoryPool* mpMemoryPool; |
| 44 | detail::MemoryPoolHeap* mMemoryPoolHeap; |
| 45 | uint8_t mFlags; |
| 46 | GPUMemBlockBase* mpTail; |
| 47 | }; |
| 48 | |
| 49 | static_assert(sizeof(GPUMemBlockBase) == 0x38); |
| 50 | |
| 51 | // TODO |
| 52 | template <typename T> |
| 53 | class GPUMemBlockT : public GPUMemBlockBase { |
| 54 | public: |
| 55 | ~GPUMemBlockT() override { ; } |
| 56 | }; |
| 57 | |
| 58 | // TODO |
| 59 | template <typename T> |
| 60 | class GPUMemBlock : public GPUMemBlockT<T> {}; |
| 61 | |
| 62 | } // namespace agl |
| 63 | |