finished gpu buffer creation
This commit is contained in:
parent
c6633a511a
commit
21120ac0ae
|
@ -82,6 +82,7 @@ void* GPU::GPUMemory::memoryCreateObj(u64 submit_id, HLE::Libs::Graphics::Graphi
|
||||||
if (heap_id < 0) {
|
if (heap_id < 0) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
auto& heap = m_heaps[heap_id];
|
||||||
|
|
||||||
ObjInfo objInfo = {};
|
ObjInfo objInfo = {};
|
||||||
|
|
||||||
|
@ -105,6 +106,25 @@ void* GPU::GPUMemory::memoryCreateObj(u64 submit_id, HLE::Libs::Graphics::Graphi
|
||||||
|
|
||||||
objInfo.gpu_object.obj = info.getCreateFunc()(ctx, objInfo.obj_params, virtual_addr, size, virtual_addr_num, &objInfo.mem);
|
objInfo.gpu_object.obj = info.getCreateFunc()(ctx, objInfo.obj_params, virtual_addr, size, virtual_addr_num, &objInfo.mem);
|
||||||
|
|
||||||
// TODO we need more ...
|
int index = static_cast<int>(heap.objects.size());
|
||||||
return nullptr;
|
|
||||||
|
HeapObject hobj{};
|
||||||
|
hobj.block = createHeapBlock(virtual_addr, size, virtual_addr_num, heap_id, index);
|
||||||
|
hobj.info = objInfo;
|
||||||
|
hobj.free = false;
|
||||||
|
heap.objects.push_back(hobj);
|
||||||
|
|
||||||
|
return objInfo.gpu_object.obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
GPU::HeapBlock GPU::GPUMemory::createHeapBlock(const u64* virtual_addr, const u64* size, int virtual_addr_num, int heap_id, int obj_id) {
|
||||||
|
auto& heap = m_heaps[heap_id];
|
||||||
|
|
||||||
|
GPU::HeapBlock heapBlock{};
|
||||||
|
heapBlock.virtual_addr_num = virtual_addr_num;
|
||||||
|
for (int vi = 0; vi < virtual_addr_num; vi++) {
|
||||||
|
heapBlock.virtual_addr[vi] = virtual_addr[vi];
|
||||||
|
heapBlock.size[vi] = size[vi];
|
||||||
|
}
|
||||||
|
return heapBlock;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,10 +11,7 @@ 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 };
|
||||||
|
|
||||||
struct MemoryHeap {
|
|
||||||
u64 allocated_virtual_addr = 0;
|
|
||||||
u64 allocated_size = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct GpuMemoryObject {
|
struct GpuMemoryObject {
|
||||||
MemoryObjectType objectType = MemoryObjectType::InvalidObj;
|
MemoryObjectType objectType = MemoryObjectType::InvalidObj;
|
||||||
|
@ -30,6 +27,23 @@ struct ObjInfo {
|
||||||
HLE::Libs::Graphics::VulkanMemory mem;
|
HLE::Libs::Graphics::VulkanMemory mem;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct HeapBlock {
|
||||||
|
u64 virtual_addr[3] = {};
|
||||||
|
u64 size[3] = {};
|
||||||
|
int virtual_addr_num = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct HeapObject {
|
||||||
|
HeapBlock block;
|
||||||
|
ObjInfo info;
|
||||||
|
bool free = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct MemoryHeap {
|
||||||
|
u64 allocated_virtual_addr = 0;
|
||||||
|
u64 allocated_size = 0;
|
||||||
|
std::vector<HeapObject> objects;
|
||||||
|
};
|
||||||
|
|
||||||
class GPUMemory {
|
class GPUMemory {
|
||||||
public:
|
public:
|
||||||
|
@ -40,6 +54,7 @@ class GPUMemory {
|
||||||
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,
|
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);
|
const u64* size, int virtual_addr_num, const GPUObject& info);
|
||||||
|
HeapBlock createHeapBlock(const u64* virtual_addr, const u64* size, int virtual_addr_num, int heap_id, int obj_id);
|
||||||
};
|
};
|
||||||
class GPUObject {
|
class GPUObject {
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Reference in New Issue