more APIs

This commit is contained in:
InoriRus
2022-06-07 16:19:01 +10:00
parent 877560b7f6
commit 16baf5cc18
26 changed files with 1862 additions and 108 deletions
+16
View File
@@ -18,6 +18,7 @@
#include "Emulator/Kernel/Pthread.h"
#include "Emulator/Libs/Errno.h"
#include "Emulator/Libs/Libs.h"
#include "Emulator/Loader/VirtualMemory.h"
#include <atomic>
@@ -651,6 +652,21 @@ int KYTY_SYSV_ABI GraphicsIsUserPaEnabled()
return 0;
}
void* KYTY_SYSV_ABI GraphicsGetTheTessellationFactorRingBufferBaseAddress()
{
PRINT_NAME();
auto addr = Loader::VirtualMemory::AllocAligned(0, 0x20000, Loader::VirtualMemory::Mode::ReadWrite, 256);
Loader::VirtualMemory::Free(addr);
bool again = Loader::VirtualMemory::AllocFixed(addr, 0x20000, Loader::VirtualMemory::Mode::ReadWrite);
EXIT_NOT_IMPLEMENTED(!again);
Loader::VirtualMemory::Free(addr);
printf("\t addr = %016" PRIx64 "\n", addr);
return reinterpret_cast<void*>(addr);
}
int KYTY_SYSV_ABI GraphicsRegisterOwner(uint32_t* owner_handle, const char* name)
{
PRINT_NAME();
+29 -18
View File
@@ -54,6 +54,8 @@ public:
void BufferFlush();
void BufferWait();
void RunLock() { m_run_mutex.Lock(); }
void RunUnlock() { m_run_mutex.Unlock(); }
void Lock() { m_mutex.Lock(); }
void Unlock() { m_mutex.Unlock(); }
@@ -130,6 +132,7 @@ private:
uint32_t m_num_instances = 1;
Core::Mutex m_mutex;
Core::Mutex m_run_mutex;
CommandBuffer* m_buffer[VK_BUFFERS_NUM] = {};
int m_current_buffer = -1;
@@ -340,10 +343,10 @@ uint32_t Gpu::MapComputeQueue(uint32_t pipe_id, uint32_t queue_id, uint32_t* rin
EXIT_NOT_IMPLEMENTED(v >= 64);
for (int i = 0; i < 8; i++)
{
EXIT_NOT_IMPLEMENTED(m_compute_ring[pipe_id * 8 + i] != nullptr && m_compute_ring[pipe_id * 8 + i]->IsActive());
}
// for (int i = 0; i < 8; i++)
// {
// EXIT_NOT_IMPLEMENTED(m_compute_ring[pipe_id * 8 + i] != nullptr && m_compute_ring[pipe_id * 8 + i]->IsActive());
// }
auto* ring = GetRing(v + 1);
@@ -761,17 +764,21 @@ void GraphicsRing::ThreadBatchRun(void* data)
{
CmdBatch buf = ring->GetCmdBatch();
cp->BufferInit();
cp->ResetDeCe();
cp->SetFlip(buf.flip);
cp->SetSumbitId(++seq);
cp->RunLock();
{
cp->BufferInit();
cp->ResetDeCe();
cp->SetFlip(buf.flip);
cp->SetSumbitId(++seq);
ring->m_job1.Execute([cp, buf](void* /*unused*/) { cp->Run(buf.draw_buffer.data, buf.draw_buffer.num_dw); });
ring->m_job2.Execute([cp, buf](void* /*unused*/) { cp->Run(buf.const_buffer.data, buf.const_buffer.num_dw); });
ring->m_job1.Wait();
ring->m_job2.Wait();
ring->m_job1.Execute([cp, buf](void* /*unused*/) { cp->Run(buf.draw_buffer.data, buf.draw_buffer.num_dw); });
ring->m_job2.Execute([cp, buf](void* /*unused*/) { cp->Run(buf.const_buffer.data, buf.const_buffer.num_dw); });
ring->m_job1.Wait();
ring->m_job2.Wait();
cp->BufferFlush();
cp->BufferFlush();
}
cp->RunUnlock();
}
}
@@ -822,14 +829,18 @@ void ComputeRing::ThreadRun(void* data)
ring->m_mutex.Unlock();
cp->BufferInit();
cp->ResetDeCe();
cp->RunLock();
{
cp->BufferInit();
cp->ResetDeCe();
GraphicsDbgDumpDcb("cc", num_dw, buffer);
GraphicsDbgDumpDcb("cc", num_dw, buffer);
cp->Run(buffer, num_dw);
cp->Run(buffer, num_dw);
cp->BufferFlush();
cp->BufferFlush();
}
cp->RunUnlock();
ring->m_mutex.Lock();
+5 -5
View File
@@ -16,7 +16,7 @@
#include "Emulator/Graphics/Image.h"
#include "Emulator/Graphics/Utils.h"
#include "Emulator/Graphics/VideoOut.h"
#include "Emulator/Loader/Param.h"
#include "Emulator/Loader/SystemContent.h"
#include "Emulator/Loader/VirtualMemory.h"
#include "Emulator/Profiler.h"
@@ -2170,7 +2170,7 @@ void WindowUpdateIcon()
{
EXIT_IF(g_window_ctx == nullptr);
static Image* icon = Loader::ParamSfoGetIcon();
static Image* icon = Loader::SystemContentGetIcon();
if (icon != nullptr)
{
@@ -2186,9 +2186,9 @@ void WindowUpdateTitle()
static char title[128];
static char title_id[12];
static char app_ver[8];
static bool has_title = Loader::ParamSfoGetString("TITLE", title, sizeof(title));
static bool has_title_id = Loader::ParamSfoGetString("TITLE_ID", title_id, sizeof(title_id));
static bool has_app_ver = Loader::ParamSfoGetString("APP_VER", app_ver, sizeof(app_ver));
static bool has_title = Loader::SystemContentParamSfoGetString("TITLE", title, sizeof(title));
static bool has_title_id = Loader::SystemContentParamSfoGetString("TITLE_ID", title_id, sizeof(title_id));
static bool has_app_ver = Loader::SystemContentParamSfoGetString("APP_VER", app_ver, sizeof(app_ver));
auto fps = String::FromPrintf("%s%s%s%s%s%s[%s] [%s], frame: %d, fps: %f", (has_title ? title : ""), (has_title ? ", " : ""),
(has_title_id ? title_id : ""), (has_title_id ? ", " : ""), (has_app_ver ? app_ver : ""),