VERY experimental Nintendo Switch 2 emulator
C++
Rename LCD to GPU.
Tony Wasserka1dfa3928242a
diff --git a/src/common/log.h b/src/common/log.hindex 8b39b03a17..d0da68aad7 100644--- a/src/common/log.h+++ b/src/common/log.h@@ -60,7 +60,7 @@ enum LOG_TYPE {NDMA,HLE,RENDER,- LCD,+ GPU,HW,TIME,NETPLAY,diff --git a/src/common/log_manager.cpp b/src/common/log_manager.cppindex 146472888d..b4a761c75f 100644--- a/src/common/log_manager.cpp+++ b/src/common/log_manager.cpp@@ -65,7 +65,7 @@ LogManager::LogManager()m_Log[LogTypes::WII_IPC_ES] = new LogContainer("WII_IPC_ES", "WII IPC ES");m_Log[LogTypes::WII_IPC_FILEIO] = new LogContainer("WII_IPC_FILEIO", "WII IPC FILEIO");m_Log[LogTypes::RENDER] = new LogContainer("RENDER", "RENDER");- m_Log[LogTypes::LCD] = new LogContainer("LCD", "LCD");+ m_Log[LogTypes::GPU] = new LogContainer("GPU", "GPU");m_Log[LogTypes::SVC] = new LogContainer("SVC", "Supervisor Call HLE");m_Log[LogTypes::NDMA] = new LogContainer("NDMA", "NDMA");m_Log[LogTypes::HLE] = new LogContainer("HLE", "High Level Emulation");diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txtindex 4086b415bf..1c1a2eeb39 100644--- a/src/core/CMakeLists.txt+++ b/src/core/CMakeLists.txt@@ -42,8 +42,8 @@ set(SRCS core.cpphle/service/hid.cpphle/service/service.cpphle/service/srv.cpp+ hw/gpu.cpphw/hw.cpp- hw/lcd.cpphw/ndma.cpp)set(HEADERS core.h@@ -88,8 +88,8 @@ set(HEADERS core.hhle/service/hid.hhle/service/service.hhle/service/srv.h+ hw/gpu.hhw/hw.h- hw/lcd.hhw/ndma.h)add_library(core STATIC ${SRCS} ${HEADERS})diff --git a/src/core/core.vcxproj b/src/core/core.vcxprojindex f271d336e0..8a3ad83ea2 100644--- a/src/core/core.vcxproj+++ b/src/core/core.vcxproj@@ -177,8 +177,8 @@<ClCompile Include="hle\service\service.cpp" /><ClCompile Include="hle\service\srv.cpp" /><ClCompile Include="hle\svc.cpp" />+ <ClCompile Include="hw\gpu.cpp" /><ClCompile Include="hw\hw.cpp" />- <ClCompile Include="hw\lcd.cpp" /><ClCompile Include="hw\ndma.cpp" /><ClCompile Include="loader.cpp" /><ClCompile Include="mem_map.cpp" />@@ -226,8 +226,8 @@<ClInclude Include="hle\service\service.h" /><ClInclude Include="hle\service\srv.h" /><ClInclude Include="hle\svc.h" />+ <ClInclude Include="hw\gpu.h" /><ClInclude Include="hw\hw.h" />- <ClInclude Include="hw\lcd.h" /><ClInclude Include="hw\ndma.h" /><ClInclude Include="loader.h" /><ClInclude Include="mem_map.h" />@@ -239,4 +239,4 @@<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /><ImportGroup Label="ExtensionTargets"></ImportGroup>-</Project>\ No newline at end of file+</Project>diff --git a/src/core/core.vcxproj.filters b/src/core/core.vcxproj.filtersindex b6c1d5b935..f7b342f98d 100644--- a/src/core/core.vcxproj.filters+++ b/src/core/core.vcxproj.filters@@ -102,7 +102,7 @@<ClCompile Include="hw\ndma.cpp"><Filter>hw</Filter></ClCompile>- <ClCompile Include="hw\lcd.cpp">+ <ClCompile Include="hw\gpu.cpp"><Filter>hw</Filter></ClCompile><ClCompile Include="arm\disassembler\load_symbol_map.cpp">@@ -244,7 +244,7 @@<ClInclude Include="hw\ndma.h"><Filter>hw</Filter></ClInclude>- <ClInclude Include="hw\lcd.h">+ <ClInclude Include="hw\gpu.h"><Filter>hw</Filter></ClInclude><ClInclude Include="arm\disassembler\load_symbol_map.h">@@ -299,4 +299,4 @@<ItemGroup><Text Include="CMakeLists.txt" /></ItemGroup>-</Project>\ No newline at end of file+</Project>diff --git a/src/core/hle/service/gsp.cpp b/src/core/hle/service/gsp.cppindex a42759053f..d51e6c66d8 100644--- a/src/core/hle/service/gsp.cpp+++ b/src/core/hle/service/gsp.cpp@@ -10,7 +10,7 @@#include "core/hle/hle.h"#include "core/hle/service/gsp.h"-#include "core/hw/lcd.h"+#include "core/hw/gpu.h"#include "video_core/gpu_debugger.h"@@ -69,8 +69,8 @@ enum {/// Read a GSP GPU hardware registervoid ReadHWRegs(Service::Interface* self) {- static const u32 framebuffer_1[] = {LCD::PADDR_VRAM_TOP_LEFT_FRAME1, LCD::PADDR_VRAM_TOP_RIGHT_FRAME1};- static const u32 framebuffer_2[] = {LCD::PADDR_VRAM_TOP_LEFT_FRAME2, LCD::PADDR_VRAM_TOP_RIGHT_FRAME2};+ static const u32 framebuffer_1[] = {GPU::PADDR_VRAM_TOP_LEFT_FRAME1, GPU::PADDR_VRAM_TOP_RIGHT_FRAME1};+ static const u32 framebuffer_2[] = {GPU::PADDR_VRAM_TOP_LEFT_FRAME2, GPU::PADDR_VRAM_TOP_RIGHT_FRAME2};u32* cmd_buff = Service::GetCommandBuffer();u32 reg_addr = cmd_buff[1];@@ -85,13 +85,13 @@ void ReadHWRegs(Service::Interface* self) {// Top framebuffer 1 addressescase REG_FRAMEBUFFER_1:- LCD::SetFramebufferLocation(LCD::FRAMEBUFFER_LOCATION_VRAM);+ GPU::SetFramebufferLocation(GPU::FRAMEBUFFER_LOCATION_VRAM);memcpy(dst, framebuffer_1, size);break;// Top framebuffer 2 addressescase REG_FRAMEBUFFER_2:- LCD::SetFramebufferLocation(LCD::FRAMEBUFFER_LOCATION_VRAM);+ GPU::SetFramebufferLocation(GPU::FRAMEBUFFER_LOCATION_VRAM);memcpy(dst, framebuffer_2, size);break;@@ -123,9 +123,9 @@ void TriggerCmdReqQueue(Service::Interface* self) {break;case GXCommandId::SET_COMMAND_LIST_LAST:- LCD::Write<u32>(LCD::CommandListAddress, cmd_buff[1] >> 3);- LCD::Write<u32>(LCD::CommandListSize, cmd_buff[2] >> 3);- LCD::Write<u32>(LCD::ProcessCommandList, 1); // TODO: Not sure if we are supposed to always write this+ GPU::Write<u32>(GPU::CommandListAddress, cmd_buff[1] >> 3);+ GPU::Write<u32>(GPU::CommandListSize, cmd_buff[2] >> 3);+ GPU::Write<u32>(GPU::ProcessCommandList, 1); // TODO: Not sure if we are supposed to always write thisbreak;case GXCommandId::SET_MEMORY_FILL:diff --git a/src/core/hw/lcd.cpp b/src/core/hw/gpu.cppsimilarity index 92%rename from src/core/hw/lcd.cpprename to src/core/hw/gpu.cppindex 61ee99c1fd..632e1aaaca 100644--- a/src/core/hw/lcd.cpp+++ b/src/core/hw/gpu.cpp@@ -8,12 +8,12 @@#include "core/core.h"#include "core/mem_map.h"#include "core/hle/kernel/thread.h"-#include "core/hw/lcd.h"+#include "core/hw/gpu.h"#include "video_core/video_core.h"-namespace LCD {+namespace GPU {Registers g_regs;@@ -61,7 +61,7 @@ const FramebufferLocation GetFramebufferLocation() {} else if ((g_regs.framebuffer_top_right_1 & ~Memory::FCRAM_MASK) == Memory::FCRAM_PADDR) {return FRAMEBUFFER_LOCATION_FCRAM;} else {- ERROR_LOG(LCD, "unknown framebuffer location!");+ ERROR_LOG(GPU, "unknown framebuffer location!");}return FRAMEBUFFER_LOCATION_UNKNOWN;}@@ -78,7 +78,7 @@ const u8* GetFramebufferPointer(const u32 address) {case FRAMEBUFFER_LOCATION_VRAM:return (const u8*)Memory::GetPointer(Memory::VirtualAddressFromPhysical_VRAM(address));default:- ERROR_LOG(LCD, "unknown framebuffer location");+ ERROR_LOG(GPU, "unknown framebuffer location");}return NULL;}@@ -123,7 +123,7 @@ inline void Read(T &var, const u32 addr) {break;default:- ERROR_LOG(LCD, "unknown Read%d @ 0x%08X", sizeof(var) * 8, addr);+ ERROR_LOG(GPU, "unknown Read%d @ 0x%08X", sizeof(var) * 8, addr);break;}}@@ -144,13 +144,13 @@ inline void Write(u32 addr, const T data) {if (g_regs.command_processing_enabled & 1){// u32* buffer = (u32*)Memory::GetPointer(g_regs.command_list_address << 3);- ERROR_LOG(LCD, "Beginning %x bytes of commands from address %x", g_regs.command_list_size, g_regs.command_list_address << 3);+ ERROR_LOG(GPU, "Beginning %x bytes of commands from address %x", g_regs.command_list_size, g_regs.command_list_address << 3);// TODO: Process command list!}break;default:- ERROR_LOG(LCD, "unknown Write%d 0x%08X @ 0x%08X", sizeof(data) * 8, data, addr);+ ERROR_LOG(GPU, "unknown Write%d 0x%08X @ 0x%08X", sizeof(data) * 8, data, addr);break;}}@@ -183,12 +183,12 @@ void Update() {void Init() {g_last_ticks = Core::g_app_core->GetTicks();SetFramebufferLocation(FRAMEBUFFER_LOCATION_FCRAM);- NOTICE_LOG(LCD, "initialized OK");+ NOTICE_LOG(GPU, "initialized OK");}/// Shutdown hardwarevoid Shutdown() {- NOTICE_LOG(LCD, "shutdown OK");+ NOTICE_LOG(GPU, "shutdown OK");}} // namespacediff --git a/src/core/hw/lcd.h b/src/core/hw/gpu.hsimilarity index 99%rename from src/core/hw/lcd.hrename to src/core/hw/gpu.hindex 2ae852d7c7..c81b1bb3f4 100644--- a/src/core/hw/lcd.h+++ b/src/core/hw/gpu.h@@ -6,7 +6,7 @@#include "common/common_types.h"-namespace LCD {+namespace GPU {struct Registers {u32 framebuffer_top_left_1;diff --git a/src/core/hw/hw.cpp b/src/core/hw/hw.cppindex 85669ae7f7..ed70486e61 100644--- a/src/core/hw/hw.cpp+++ b/src/core/hw/hw.cpp@@ -6,7 +6,7 @@#include "common/log.h"#include "core/hw/hw.h"-#include "core/hw/lcd.h"+#include "core/hw/gpu.h"#include "core/hw/ndma.h"namespace HW {@@ -34,7 +34,7 @@ enum {VADDR_CDMA = 0xFFFDA000, // CoreLink DMA-330? InfoVADDR_DSP_2 = 0x1ED03000,VADDR_HASH_2 = 0x1EE01000,- VADDR_LCD = 0x1EF00000,+ VADDR_GPU = 0x1EF00000,};template <typename T>@@ -46,8 +46,8 @@ inline void Read(T &var, const u32 addr) {// NDMA::Read(var, addr);// break;- case VADDR_LCD:- LCD::Read(var, addr);+ case VADDR_GPU:+ GPU::Read(var, addr);break;default:@@ -64,8 +64,8 @@ inline void Write(u32 addr, const T data) {// NDMA::Write(addr, data);// break;- case VADDR_LCD:- LCD::Write(addr, data);+ case VADDR_GPU:+ GPU::Write(addr, data);break;default:@@ -87,13 +87,13 @@ template void Write<u8>(u32 addr, const u8 data);/// Update hardwarevoid Update() {- LCD::Update();+ GPU::Update();NDMA::Update();}/// Initialize hardwarevoid Init() {- LCD::Init();+ GPU::Init();NDMA::Init();NOTICE_LOG(HW, "initialized OK");}diff --git a/src/core/hw/ndma.cpp b/src/core/hw/ndma.cppindex 52e459ebdd..f6aa72d161 100644--- a/src/core/hw/ndma.cpp+++ b/src/core/hw/ndma.cpp@@ -37,12 +37,12 @@ void Update() {/// Initialize hardwarevoid Init() {- NOTICE_LOG(LCD, "initialized OK");+ NOTICE_LOG(GPU, "initialized OK");}/// Shutdown hardwarevoid Shutdown() {- NOTICE_LOG(LCD, "shutdown OK");+ NOTICE_LOG(GPU, "shutdown OK");}} // namespacediff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cppindex bb5eb34aa4..70af47c597 100644--- a/src/video_core/renderer_opengl/renderer_opengl.cpp+++ b/src/video_core/renderer_opengl/renderer_opengl.cpp@@ -2,7 +2,7 @@// Licensed under GPLv2// Refer to the license.txt file included.-#include "core/hw/lcd.h"+#include "core/hw/gpu.h"#include "video_core/video_core.h"#include "video_core/renderer_opengl/renderer_opengl.h"@@ -77,8 +77,8 @@ void RendererOpenGL::FlipFramebuffer(const u8* in, u8* out) {*/void RendererOpenGL::RenderXFB(const common::Rect& src_rect, const common::Rect& dst_rect) {- FlipFramebuffer(LCD::GetFramebufferPointer(LCD::g_regs.framebuffer_top_left_1), m_xfb_top_flipped);- FlipFramebuffer(LCD::GetFramebufferPointer(LCD::g_regs.framebuffer_sub_left_1), m_xfb_bottom_flipped);+ FlipFramebuffer(GPU::GetFramebufferPointer(GPU::g_regs.framebuffer_top_left_1), m_xfb_top_flipped);+ FlipFramebuffer(GPU::GetFramebufferPointer(GPU::g_regs.framebuffer_sub_left_1), m_xfb_bottom_flipped);// Blit the top framebuffer// ------------------------