more work on creating videoOutBuffer object

This commit is contained in:
georgemoralis 2023-09-26 18:56:08 +03:00
parent 1a5dd6cdfe
commit b14e50904b
4 changed files with 42 additions and 8 deletions

View File

@ -50,20 +50,28 @@ void* GPU::GPUMemory::memoryCreateObj(u64 submit_id, HLE::Libs::Graphics::Graphi
return nullptr; return nullptr;
} }
ObjInfo obj = {}; ObjInfo objInfo = {};
// copy parameters from info to obj // copy parameters from info to obj
for (int i = 0; i < 8; i++) { for (int i = 0; i < 8; i++) {
obj.obj_params[i] = info.obj_params[i]; objInfo.obj_params[i] = info.obj_params[i];
} }
u64 hash[3] = {}; // assuming virtual_addr_num shouldn't be more that 3
objInfo.gpu_object.objectType = info.objectType;
objInfo.gpu_object.obj = nullptr;
for (int h = 0; h < virtual_addr_num; h++) { for (int h = 0; h < virtual_addr_num; h++) {
if (info.hasHash) { if (info.check_hash) {
hash[h] = GPU::calculate_hash(reinterpret_cast<const u08*>(virtual_addr[h]), size[h]); objInfo.hash[h] = GPU::calculate_hash(reinterpret_cast<const u08*>(virtual_addr[h]), size[h]);
} else { } else {
hash[h] = 0; objInfo.hash[h] = 0;
} }
} }
objInfo.submit_id = submit_id;
objInfo.check_hash = info.check_hash;
objInfo.gpu_object.obj = info.getCreateFunc()(ctx, objInfo.obj_params, virtual_addr, size, virtual_addr_num, &objInfo.mem);
// TODO we need more ...
return nullptr; return nullptr;
} }

View File

@ -16,9 +16,21 @@ struct MemoryHeap {
u64 allocated_size = 0; u64 allocated_size = 0;
}; };
struct GpuMemoryObject {
MemoryObjectType objectType = MemoryObjectType::InvalidObj;
void* obj = nullptr;
};
struct ObjInfo { struct ObjInfo {
u64 obj_params[8] = {}; u64 obj_params[8] = {};
GpuMemoryObject gpu_object;
u64 hash[3] = {};
u64 submit_id = 0;
bool check_hash = false;
HLE::Libs::Graphics::VulkanMemory mem;
}; };
class GPUMemory { class GPUMemory {
public: public:
GPUMemory() {} GPUMemory() {}
@ -34,10 +46,14 @@ class GPUObject {
GPUObject() = default; GPUObject() = default;
virtual ~GPUObject() = default; virtual ~GPUObject() = default;
u64 obj_params[8] = {}; u64 obj_params[8] = {};
bool hasHash = false; bool check_hash = false;
bool isReadOnly = false; bool isReadOnly = false;
MemoryObjectType objectType = MemoryObjectType::InvalidObj; MemoryObjectType objectType = MemoryObjectType::InvalidObj;
using create_func_t = void* (*)(HLE::Libs::Graphics::GraphicCtx* ctx, const u64* params, const u64* vaddr, const u64* size, int vaddr_num,
HLE::Libs::Graphics::VulkanMemory* mem);
virtual create_func_t getCreateFunc() const = 0;
}; };
void memorySetAllocArea(u64 virtual_addr, u64 size); void memorySetAllocArea(u64 virtual_addr, u64 size);

View File

@ -0,0 +1,8 @@
#include "video_out_buffer.h"
static void* create_func(HLE::Libs::Graphics::GraphicCtx* ctx, const u64* params, const u64* vaddr, const u64* size, int vaddr_num,
HLE::Libs::Graphics::VulkanMemory* mem) {
return nullptr;//TODO
}
GPU::GPUObject::create_func_t GPU::VideoOutBufferObj::getCreateFunc() const { return create_func; }

View File

@ -28,8 +28,10 @@ class VideoOutBufferObj : public GPUObject {
obj_params[IS_TILE_PARAM] = is_tiled ? 1 : 0; obj_params[IS_TILE_PARAM] = is_tiled ? 1 : 0;
obj_params[IS_NEO_PARAM] = is_neo ? 1 : 0; obj_params[IS_NEO_PARAM] = is_neo ? 1 : 0;
obj_params[PITCH_PARAM] = pitch; obj_params[PITCH_PARAM] = pitch;
hasHash = true; check_hash = true;
objectType = GPU::MemoryObjectType::VideoOutBufferObj; objectType = GPU::MemoryObjectType::VideoOutBufferObj;
} }
create_func_t getCreateFunc() const override;
}; };
} // namespace GPU } // namespace GPU