more abstract memoryCreateObj
This commit is contained in:
parent
627c0d1b61
commit
7570576aa2
|
@ -2,6 +2,12 @@
|
||||||
|
|
||||||
#include "Util/Singleton.h"
|
#include "Util/Singleton.h"
|
||||||
|
|
||||||
|
void* GPU::memoryCreateObj(u64 submit_id, HLE::Libs::Graphics::GraphicCtx* ctx, void* todo /*CommandBuffer?*/, u64 virtual_addr, u64 size, const GPUObject& info) {
|
||||||
|
auto* gpumemory = Singleton<GPUMemory>::Instance();
|
||||||
|
|
||||||
|
return gpumemory->memoryCreateObj(submit_id, ctx, nullptr, &virtual_addr, &size, 1, info);
|
||||||
|
}
|
||||||
|
|
||||||
void GPU::memorySetAllocArea(u64 virtual_addr, u64 size) {
|
void GPU::memorySetAllocArea(u64 virtual_addr, u64 size) {
|
||||||
auto* gpumemory = Singleton<GPUMemory>::Instance();
|
auto* gpumemory = Singleton<GPUMemory>::Instance();
|
||||||
|
|
||||||
|
@ -13,20 +19,6 @@ void GPU::memorySetAllocArea(u64 virtual_addr, u64 size) {
|
||||||
|
|
||||||
gpumemory->m_heaps.push_back(h);
|
gpumemory->m_heaps.push_back(h);
|
||||||
}
|
}
|
||||||
void* GPU::memoryCreateObj(u64 submit_id, HLE::Libs::Graphics::GraphicCtx* ctx, void* todo, u64 virtual_addr, u64 size, const GPUObject& info) {
|
|
||||||
auto* gpumemory = Singleton<GPUMemory>::Instance();
|
|
||||||
|
|
||||||
Lib::LockMutexGuard lock(gpumemory->m_mutex);
|
|
||||||
|
|
||||||
int heap_id = gpumemory->getHeapId(virtual_addr, size);
|
|
||||||
|
|
||||||
if (heap_id < 0)
|
|
||||||
{
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int GPU::GPUMemory::getHeapId(u64 virtual_addr, u64 size) {
|
int GPU::GPUMemory::getHeapId(u64 virtual_addr, u64 size) {
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
@ -40,3 +32,18 @@ int GPU::GPUMemory::getHeapId(u64 virtual_addr, u64 size) {
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void* GPU::GPUMemory::memoryCreateObj(u64 submit_id, HLE::Libs::Graphics::GraphicCtx* ctx, void* todo, const u64* virtual_addr, const u64* size,
|
||||||
|
int virtual_addr_num, const GPUObject& info) {
|
||||||
|
auto* gpumemory = Singleton<GPUMemory>::Instance();
|
||||||
|
|
||||||
|
Lib::LockMutexGuard lock(gpumemory->m_mutex);
|
||||||
|
|
||||||
|
int heap_id = gpumemory->getHeapId(virtual_addr[0], size[0]);
|
||||||
|
|
||||||
|
if (heap_id < 0) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
// TODO not finished!
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
|
@ -5,6 +5,9 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace GPU {
|
namespace GPU {
|
||||||
|
|
||||||
|
class GPUObject;
|
||||||
|
|
||||||
enum class MemoryMode : u32 { NoAccess = 0, Read = 1, Write = 2, ReadWrite = 3 };
|
enum class MemoryMode : u32 { NoAccess = 0, Read = 1, Write = 2, ReadWrite = 3 };
|
||||||
enum class MemoryObjectType : u64 { InvalidObj, VideoOutBufferObj };
|
enum class MemoryObjectType : u64 { InvalidObj, VideoOutBufferObj };
|
||||||
|
|
||||||
|
@ -20,6 +23,8 @@ class GPUMemory {
|
||||||
int getHeapId(u64 vaddr, u64 size);
|
int getHeapId(u64 vaddr, u64 size);
|
||||||
Lib::Mutex m_mutex;
|
Lib::Mutex m_mutex;
|
||||||
std::vector<MemoryHeap> m_heaps;
|
std::vector<MemoryHeap> m_heaps;
|
||||||
|
void* memoryCreateObj(u64 submit_id, HLE::Libs::Graphics::GraphicCtx* ctx, /*CommandBuffer* buffer*/ void* todo, const u64* virtual_addr,
|
||||||
|
const u64* size, int virtual_addr_num, const GPUObject& info);
|
||||||
};
|
};
|
||||||
class GPUObject {
|
class GPUObject {
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Reference in New Issue