diff --git a/PCSX2_suite.sln b/PCSX2_suite.sln index 6bad0b28f4..c6547bcfa9 100644 --- a/PCSX2_suite.sln +++ b/PCSX2_suite.sln @@ -25,6 +25,7 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pcsx2", "pcsx2\windows\VCprojects\pcsx2.vcxproj", "{1CEFD830-2B76-4596-A4EE-BCD7280A60BD}" ProjectSection(ProjectDependencies) = postProject {12728250-16EC-4DC6-94D7-E21DD88947F8} = {12728250-16EC-4DC6-94D7-E21DD88947F8} + {D6973076-9317-4EF2-A0B8-B7A18AC0713E} = {D6973076-9317-4EF2-A0B8-B7A18AC0713E} {27F17499-A372-4408-8AFA-4F9F4584FBD3} = {27F17499-A372-4408-8AFA-4F9F4584FBD3} {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B} = {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B} EndProjectSection diff --git a/pcsx2/GS/GS.cpp b/pcsx2/GS/GS.cpp index bb486d6879..f8d97e6cc2 100644 --- a/pcsx2/GS/GS.cpp +++ b/pcsx2/GS/GS.cpp @@ -870,447 +870,6 @@ void GSsetExclusive(int enabled) } } -#ifdef _WIN32 - -#include -#include - -class Console -{ - HANDLE m_console; - std::string m_title; - -public: - Console::Console(LPCSTR title, bool open) - : m_console(NULL) - , m_title(title) - { - if (open) - Open(); - } - - Console::~Console() - { - Close(); - } - - void Console::Open() - { - if (m_console == NULL) - { - CONSOLE_SCREEN_BUFFER_INFO csbiInfo; - - AllocConsole(); - - std::wstring tmp = std::wstring(m_title.begin(), m_title.end()); - SetConsoleTitle(tmp.c_str()); - - m_console = GetStdHandle(STD_OUTPUT_HANDLE); - - COORD size; - - size.X = 100; - size.Y = 300; - - SetConsoleScreenBufferSize(m_console, size); - - GetConsoleScreenBufferInfo(m_console, &csbiInfo); - - SMALL_RECT rect; - - rect = csbiInfo.srWindow; - rect.Right = rect.Left + 99; - rect.Bottom = rect.Top + 64; - - SetConsoleWindowInfo(m_console, TRUE, &rect); - - freopen("CONOUT$", "w", stdout); - freopen("CONOUT$", "w", stderr); - - setvbuf(stdout, nullptr, _IONBF, 0); - setvbuf(stderr, nullptr, _IONBF, 0); - } - } - - void Console::Close() - { - if (m_console != NULL) - { - FreeConsole(); - - m_console = NULL; - } - } -}; - -// lpszCmdLine: -// First parameter is the renderer. -// Second parameter is the gs file to load and run. - -void GSReplay(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow) -{ - GSRendererType renderer = GSRendererType::Undefined; - - { - char* start = lpszCmdLine; - char* end = NULL; - long n = strtol(lpszCmdLine, &end, 10); - if (end > start) - { - renderer = static_cast(n); - lpszCmdLine = end; - } - } - - while (*lpszCmdLine == ' ') - lpszCmdLine++; - - ::SetPriorityClass(::GetCurrentProcess(), HIGH_PRIORITY_CLASS); - - Console console{"GS", true}; - - const std::string f{lpszCmdLine}; - const bool is_xz = f.size() >= 4 && f.compare(f.size() - 3, 3, ".xz") == 0; - - auto file = is_xz ? std::unique_ptr{std::make_unique(lpszCmdLine, nullptr)} : std::unique_ptr{std::make_unique(lpszCmdLine, nullptr)}; - - GSinit(); - - std::array regs; - GSsetBaseMem(regs.data()); - - s_vsync = theApp.GetConfigI("vsync"); - - HWND hWnd = nullptr; - - _GSopen((void**)&hWnd, "", renderer); - - uint32 crc; - file->Read(&crc, 4); - GSsetGameCRC(crc, 0); - - { - GSFreezeData fd; - file->Read(&fd.size, 4); - std::vector freeze_data(fd.size); - fd.data = freeze_data.data(); - file->Read(fd.data, fd.size); - GSfreeze(FREEZE_LOAD, &fd); - } - - file->Read(regs.data(), 0x2000); - - GSvsync(1); - - struct Packet - { - uint8 type, param; - uint32 size, addr; - std::vector buff; - }; - - auto read_packet = [&file](uint8 type) { - Packet p; - p.type = type; - - switch (p.type) - { - case 0: - file->Read(&p.param, 1); - file->Read(&p.size, 4); - switch (p.param) - { - case 0: - p.buff.resize(0x4000); - p.addr = 0x4000 - p.size; - file->Read(&p.buff[p.addr], p.size); - break; - case 1: - case 2: - case 3: - p.buff.resize(p.size); - file->Read(p.buff.data(), p.size); - break; - } - break; - case 1: - file->Read(&p.param, 1); - break; - case 2: - file->Read(&p.size, 4); - break; - case 3: - p.buff.resize(0x2000); - file->Read(p.buff.data(), 0x2000); - break; - } - - return p; - }; - - std::list packets; - uint8 type; - while (file->Read(&type, 1)) - packets.push_back(read_packet(type)); - - Sleep(100); - - std::vector buff; - while (IsWindowVisible(hWnd)) - { - for (auto& p : packets) - { - switch (p.type) - { - case 0: - switch (p.param) - { - case 0: - GSgifTransfer1(p.buff.data(), p.addr); - break; - case 1: - GSgifTransfer2(p.buff.data(), p.size / 16); - break; - case 2: - GSgifTransfer3(p.buff.data(), p.size / 16); - break; - case 3: - GSgifTransfer(p.buff.data(), p.size / 16); - break; - } - break; - case 1: - GSvsync(p.param); - break; - case 2: - if (buff.size() < p.size) - buff.resize(p.size); - GSreadFIFO2(p.buff.data(), p.size / 16); - break; - case 3: - memcpy(regs.data(), p.buff.data(), 0x2000); - break; - } - } - } - - Sleep(100); - - GSclose(); - GSshutdown(); -} - -void GSBenchmark(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow) -{ - ::SetPriorityClass(::GetCurrentProcess(), HIGH_PRIORITY_CLASS); - - Console console("GS", true); - - if (1) - { - GSLocalMemory* mem = new GSLocalMemory(); - - static struct - { - int psm; - const char* name; - } s_format[] = - { - {PSM_PSMCT32, "32"}, - {PSM_PSMCT24, "24"}, - {PSM_PSMCT16, "16"}, - {PSM_PSMCT16S, "16S"}, - {PSM_PSMT8, "8"}, - {PSM_PSMT4, "4"}, - {PSM_PSMT8H, "8H"}, - {PSM_PSMT4HL, "4HL"}, - {PSM_PSMT4HH, "4HH"}, - {PSM_PSMZ32, "32Z"}, - {PSM_PSMZ24, "24Z"}, - {PSM_PSMZ16, "16Z"}, - {PSM_PSMZ16S, "16ZS"}, - }; - - uint8* ptr = (uint8*)_aligned_malloc(1024 * 1024 * 4, 32); - - for (int i = 0; i < 1024 * 1024 * 4; i++) - ptr[i] = (uint8)i; - - // - - for (int tbw = 5; tbw <= 10; tbw++) - { - int n = 256 << ((10 - tbw) * 2); - - int w = 1 << tbw; - int h = 1 << tbw; - - printf("%d x %d\n\n", w, h); - - for (size_t i = 0; i < countof(s_format); i++) - { - const GSLocalMemory::psm_t& psm = GSLocalMemory::m_psm[s_format[i].psm]; - - GSLocalMemory::writeImage wi = psm.wi; - GSLocalMemory::readImage ri = psm.ri; - GSLocalMemory::readTexture rtx = psm.rtx; - GSLocalMemory::readTexture rtxP = psm.rtxP; - - GIFRegBITBLTBUF BITBLTBUF; - - BITBLTBUF.SBP = 0; - BITBLTBUF.SBW = w / 64; - BITBLTBUF.SPSM = s_format[i].psm; - BITBLTBUF.DBP = 0; - BITBLTBUF.DBW = w / 64; - BITBLTBUF.DPSM = s_format[i].psm; - - GIFRegTRXPOS TRXPOS; - - TRXPOS.SSAX = 0; - TRXPOS.SSAY = 0; - TRXPOS.DSAX = 0; - TRXPOS.DSAY = 0; - - GIFRegTRXREG TRXREG; - - TRXREG.RRW = w; - TRXREG.RRH = h; - - GSVector4i r(0, 0, w, h); - - GIFRegTEX0 TEX0; - - TEX0.TBP0 = 0; - TEX0.TBW = w / 64; - - GIFRegTEXA TEXA; - - TEXA.TA0 = 0; - TEXA.TA1 = 0x80; - TEXA.AEM = 0; - - int trlen = w * h * psm.trbpp / 8; - int len = w * h * psm.bpp / 8; - - clock_t start, end; - - printf("[%4s] ", s_format[i].name); - - start = clock(); - - for (int j = 0; j < n; j++) - { - int x = 0; - int y = 0; - - (mem->*wi)(x, y, ptr, trlen, BITBLTBUF, TRXPOS, TRXREG); - } - - end = clock(); - - printf("%6d %6d | ", (int)((float)trlen * n / (end - start) / 1000), (int)((float)(w * h) * n / (end - start) / 1000)); - - start = clock(); - - for (int j = 0; j < n; j++) - { - int x = 0; - int y = 0; - - (mem->*ri)(x, y, ptr, trlen, BITBLTBUF, TRXPOS, TRXREG); - } - - end = clock(); - - printf("%6d %6d | ", (int)((float)trlen * n / (end - start) / 1000), (int)((float)(w * h) * n / (end - start) / 1000)); - - const GSOffset* off = mem->GetOffset(TEX0.TBP0, TEX0.TBW, TEX0.PSM); - - start = clock(); - - for (int j = 0; j < n; j++) - { - (mem->*rtx)(off, r, ptr, w * 4, TEXA); - } - - end = clock(); - - printf("%6d %6d ", (int)((float)len * n / (end - start) / 1000), (int)((float)(w * h) * n / (end - start) / 1000)); - - if (psm.pal > 0) - { - start = clock(); - - for (int j = 0; j < n; j++) - { - (mem->*rtxP)(off, r, ptr, w, TEXA); - } - - end = clock(); - - printf("| %6d %6d ", (int)((float)len * n / (end - start) / 1000), (int)((float)(w * h) * n / (end - start) / 1000)); - } - - printf("\n"); - } - - printf("\n"); - } - - _aligned_free(ptr); - - delete mem; - } - - // - - if (0) - { - GSLocalMemory* mem = new GSLocalMemory(); - - uint8* ptr = (uint8*)_aligned_malloc(1024 * 1024 * 4, 32); - - for (int i = 0; i < 1024 * 1024 * 4; i++) - ptr[i] = (uint8)i; - - const GSLocalMemory::psm_t& psm = GSLocalMemory::m_psm[PSM_PSMCT32]; - - GSLocalMemory::writeImage wi = psm.wi; - - GIFRegBITBLTBUF BITBLTBUF; - - BITBLTBUF.DBP = 0; - BITBLTBUF.DBW = 32; - BITBLTBUF.DPSM = PSM_PSMCT32; - - GIFRegTRXPOS TRXPOS; - - TRXPOS.DSAX = 0; - TRXPOS.DSAY = 1; - - GIFRegTRXREG TRXREG; - - TRXREG.RRW = 256; - TRXREG.RRH = 256; - - int trlen = 256 * 256 * psm.trbpp / 8; - - int x = 0; - int y = 0; - - (mem->*wi)(x, y, ptr, trlen, BITBLTBUF, TRXPOS, TRXREG); - - delete mem; - } - - // - - PostQuitMessage(0); -} - -#endif - #if defined(__unix__) || defined(__APPLE__) inline unsigned long timeGetTime() diff --git a/pcsx2/GS/GS.rc b/pcsx2/GS/GS.rc index 8f877796b6..d1117440ad 100644 --- a/pcsx2/GS/GS.rc +++ b/pcsx2/GS/GS.rc @@ -8,9 +8,6 @@ // // Generated from the TEXTINCLUDE 2 resource. // -#ifndef APSTUDIO_INVOKED -#include "targetver.h" -#endif #define APSTUDIO_HIDDEN_SYMBOLS #include "windows.h" #undef APSTUDIO_HIDDEN_SYMBOLS diff --git a/pcsx2/GS/GSUtil.cpp b/pcsx2/GS/GSUtil.cpp index 682bffd87d..9ed0a2da13 100644 --- a/pcsx2/GS/GSUtil.cpp +++ b/pcsx2/GS/GSUtil.cpp @@ -29,62 +29,6 @@ Xbyak::util::Cpu g_cpu; -const char* GSUtil::GetLibName() -{ - // The following ifdef mess is courtesy of "static string str;" - // being optimised by GCC to be unusable by older CPUs. Enjoy! - static char name[255]; - -#if _M_SSE < 0x501 - const char* sw_sse = g_cpu.has(Xbyak::util::Cpu::tAVX) ? "AVX" : - g_cpu.has(Xbyak::util::Cpu::tSSE41) ? "SSE41" : - g_cpu.has(Xbyak::util::Cpu::tSSSE3) ? "SSSE3" : "SSE2"; -#endif - - snprintf(name, sizeof(name), "GS " - -#ifdef _WIN32 - "%lld " -#endif -#ifdef _M_AMD64 - "64-bit " -#endif -#ifdef __INTEL_COMPILER - "(Intel C++ %d.%02d %s/%s)", -#elif _MSC_VER - "(MSVC %d.%02d %s/%s)", -#elif __clang__ - "(clang %d.%d.%d %s/%s)", -#elif __GNUC__ - "(GCC %d.%d.%d %s/%s)", -#else - "(%s/%s)", -#endif -#ifdef _WIN32 - SVN_REV, -#endif -#ifdef __INTEL_COMPILER - __INTEL_COMPILER / 100, __INTEL_COMPILER % 100, -#elif _MSC_VER - _MSC_VER / 100, _MSC_VER % 100, -#elif __clang__ - __clang_major__, __clang_minor__, __clang_patchlevel__, -#elif __GNUC__ - __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__, -#endif - -#if _M_SSE >= 0x501 - "AVX2", "AVX2" -#elif _M_SSE >= 0x500 - "AVX", sw_sse -#elif _M_SSE >= 0x401 - "SSE4.1", sw_sse -#endif - ); - - return name; -} - static class GSUtilMaps { public: diff --git a/pcsx2/GS/GSUtil.h b/pcsx2/GS/GSUtil.h index ea60fca867..64f65d4bb6 100644 --- a/pcsx2/GS/GSUtil.h +++ b/pcsx2/GS/GSUtil.h @@ -22,8 +22,6 @@ class GSUtil public: static void Init(); - static const char* GetLibName(); - static GS_PRIM_CLASS GetPrimClass(uint32 prim); static int GetVertexCount(uint32 prim); static int GetClassVertexCount(uint32 primclass); diff --git a/pcsx2/GS/Renderers/Common/GSOsdManager.cpp b/pcsx2/GS/Renderers/Common/GSOsdManager.cpp index 24a2429fa8..5b0134a34e 100644 --- a/pcsx2/GS/Renderers/Common/GSOsdManager.cpp +++ b/pcsx2/GS/Renderers/Common/GSOsdManager.cpp @@ -17,7 +17,7 @@ #include "GS/GS.h" #include "GSOsdManager.h" #ifdef _WIN32 -#include "resource.h" +#include "GS/resource.h" #endif void GSOsdManager::LoadFont() diff --git a/pcsx2/GS/Renderers/DX11/GSDevice11.cpp b/pcsx2/GS/Renderers/DX11/GSDevice11.cpp index 6af5be4a7c..b082355f32 100644 --- a/pcsx2/GS/Renderers/DX11/GSDevice11.cpp +++ b/pcsx2/GS/Renderers/DX11/GSDevice11.cpp @@ -16,8 +16,8 @@ #include "PrecompiledHeader.h" #include "GS.h" #include "GSDevice11.h" -#include "GSUtil.h" -#include "resource.h" +#include "GS/GSUtil.h" +#include "GS/resource.h" #include #include diff --git a/pcsx2/GS/Renderers/DX11/GSDevice11.h b/pcsx2/GS/Renderers/DX11/GSDevice11.h index eeccee0bf0..005fc439f5 100644 --- a/pcsx2/GS/Renderers/DX11/GSDevice11.h +++ b/pcsx2/GS/Renderers/DX11/GSDevice11.h @@ -16,8 +16,8 @@ #pragma once #include "GSTexture11.h" -#include "GSVector.h" -#include "Renderers/Common/GSDevice.h" +#include "GS/GSVector.h" +#include "GS/Renderers/Common/GSDevice.h" struct GSVertexShader11 { diff --git a/pcsx2/GS/Renderers/DX11/GSRendererDX11.h b/pcsx2/GS/Renderers/DX11/GSRendererDX11.h index e02ac00295..6e8cf0cd1f 100644 --- a/pcsx2/GS/Renderers/DX11/GSRendererDX11.h +++ b/pcsx2/GS/Renderers/DX11/GSRendererDX11.h @@ -15,9 +15,9 @@ #pragma once -#include "Renderers/HW/GSRendererHW.h" +#include "GS/Renderers/HW/GSRendererHW.h" #include "GSTextureCache11.h" -#include "Renderers/HW/GSVertexHW.h" +#include "GS/Renderers/HW/GSVertexHW.h" class GSRendererDX11 final : public GSRendererHW { diff --git a/pcsx2/GS/Renderers/DX11/GSTexture11.cpp b/pcsx2/GS/Renderers/DX11/GSTexture11.cpp index 2ba2212fa5..e0a0dec86a 100644 --- a/pcsx2/GS/Renderers/DX11/GSTexture11.cpp +++ b/pcsx2/GS/Renderers/DX11/GSTexture11.cpp @@ -15,7 +15,7 @@ #include "PrecompiledHeader.h" #include "GSTexture11.h" -#include "GSPng.h" +#include "GS/GSPng.h" GSTexture11::GSTexture11(ID3D11Texture2D* texture) : m_texture(texture), m_layer(0) diff --git a/pcsx2/GS/Renderers/DX11/GSTexture11.h b/pcsx2/GS/Renderers/DX11/GSTexture11.h index 59a569e5ee..649e0278d3 100644 --- a/pcsx2/GS/Renderers/DX11/GSTexture11.h +++ b/pcsx2/GS/Renderers/DX11/GSTexture11.h @@ -15,7 +15,8 @@ #pragma once -#include "Renderers/Common/GSTexture.h" +#include "GS.h" +#include "GS/Renderers/Common/GSTexture.h" class GSTexture11 : public GSTexture { diff --git a/pcsx2/GS/Renderers/DX11/GSTextureCache11.h b/pcsx2/GS/Renderers/DX11/GSTextureCache11.h index d52f2f1e34..e056aded13 100644 --- a/pcsx2/GS/Renderers/DX11/GSTextureCache11.h +++ b/pcsx2/GS/Renderers/DX11/GSTextureCache11.h @@ -15,7 +15,7 @@ #pragma once -#include "Renderers/HW/GSTextureCache.h" +#include "GS/Renderers/HW/GSTextureCache.h" #include "GSDevice11.h" class GSTextureCache11 : public GSTextureCache diff --git a/pcsx2/GS/Renderers/DX11/GSTextureFX11.cpp b/pcsx2/GS/Renderers/DX11/GSTextureFX11.cpp index f0848a3546..746c959b91 100644 --- a/pcsx2/GS/Renderers/DX11/GSTextureFX11.cpp +++ b/pcsx2/GS/Renderers/DX11/GSTextureFX11.cpp @@ -15,8 +15,8 @@ #include "PrecompiledHeader.h" #include "GSDevice11.h" -#include "resource.h" -#include "GSTables.h" +#include "GS/resource.h" +#include "GS/GSTables.h" bool GSDevice11::CreateTextureFX() { diff --git a/pcsx2/GS/Window/GSCaptureDlg.h b/pcsx2/GS/Window/GSCaptureDlg.h index 3387cd2147..d080112c75 100644 --- a/pcsx2/GS/Window/GSCaptureDlg.h +++ b/pcsx2/GS/Window/GSCaptureDlg.h @@ -16,7 +16,7 @@ #pragma once #include "GSDialog.h" -#include "resource.h" +#include "GS/resource.h" #include class GSCaptureDlg : public GSDialog diff --git a/pcsx2/GS/Window/GSDialog.cpp b/pcsx2/GS/Window/GSDialog.cpp index aa22699348..a715878fdb 100644 --- a/pcsx2/GS/Window/GSDialog.cpp +++ b/pcsx2/GS/Window/GSDialog.cpp @@ -18,7 +18,7 @@ #include #include "GS.h" #include "GSDialog.h" -#include "GSVector.h" +#include "GS/GSVector.h" GSDialog::GSDialog(UINT id) : m_id(id) diff --git a/pcsx2/GS/Window/GSSetting.cpp b/pcsx2/GS/Window/GSSetting.cpp index 71f356081a..f11279639b 100644 --- a/pcsx2/GS/Window/GSSetting.cpp +++ b/pcsx2/GS/Window/GSSetting.cpp @@ -16,7 +16,7 @@ #include "PrecompiledHeader.h" #include "GSSetting.h" #ifdef _WIN32 -#include "resource.h" +#include "GS/resource.h" #endif #ifdef _WIN32 diff --git a/pcsx2/GS/Window/GSSettingsDlg.cpp b/pcsx2/GS/Window/GSSettingsDlg.cpp index 34fe0ba0ad..c2001be372 100644 --- a/pcsx2/GS/Window/GSSettingsDlg.cpp +++ b/pcsx2/GS/Window/GSSettingsDlg.cpp @@ -16,9 +16,9 @@ #include "PrecompiledHeader.h" #include "GS.h" #include "GSSettingsDlg.h" -#include "GSUtil.h" -#include "Renderers/DX11/GSDevice11.h" -#include "resource.h" +#include "GS/GSUtil.h" +#include "GS/Renderers/DX11/GSDevice11.h" +#include "GS/resource.h" #include "GSSetting.h" #include diff --git a/pcsx2/windows/VCprojects/pcsx2.vcxproj b/pcsx2/windows/VCprojects/pcsx2.vcxproj index 364f71e32c..3221ef614c 100644 --- a/pcsx2/windows/VCprojects/pcsx2.vcxproj +++ b/pcsx2/windows/VCprojects/pcsx2.vcxproj @@ -57,7 +57,7 @@ - $(ProjectRootDir)/gui;$(SolutionDir)3rdparty\xbyak;$(SolutionDir)3rdparty\freetype\include;$(SolutionDir)3rdparty\xz\xz\src\liblzma\api;$(SolutionDir)3rdparty/baseclasses/;%(AdditionalIncludeDirectories) + $(ProjectRootDir)/gui;$(SolutionDir)3rdparty\xbyak;$(SolutionDir)3rdparty\freetype\include;$(SolutionDir)3rdparty\xz\xz\src\liblzma\api;$(SolutionDir)3rdparty/baseclasses/;$(SolutionDir)3rdparty/zlib/;$(SolutionDir)3rdparty/libpng/;%(AdditionalIncludeDirectories) Async Use PrecompiledHeader.h