mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2024-12-29 11:06:07 +00:00
more abstract memoryCreateObj
This commit is contained in:
parent
627c0d1b61
commit
7570576aa2
|
@ -2,6 +2,12 @@
|
|||
|
||||
#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) {
|
||||
auto* gpumemory = Singleton<GPUMemory>::Instance();
|
||||
|
||||
|
@ -13,20 +19,6 @@ void GPU::memorySetAllocArea(u64 virtual_addr, u64 size) {
|
|||
|
||||
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 index = 0;
|
||||
|
@ -40,3 +32,18 @@ int GPU::GPUMemory::getHeapId(u64 virtual_addr, u64 size) {
|
|||
}
|
||||
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>
|
||||
|
||||
namespace GPU {
|
||||
|
||||
class GPUObject;
|
||||
|
||||
enum class MemoryMode : u32 { NoAccess = 0, Read = 1, Write = 2, ReadWrite = 3 };
|
||||
enum class MemoryObjectType : u64 { InvalidObj, VideoOutBufferObj };
|
||||
|
||||
|
@ -20,6 +23,8 @@ class GPUMemory {
|
|||
int getHeapId(u64 vaddr, u64 size);
|
||||
Lib::Mutex m_mutex;
|
||||
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 {
|
||||
public:
|
||||
|
|
Loading…
Reference in a new issue