mirror of https://github.com/PCSX2/pcsx2.git
GS: Purge GSinit() and GSshutdown()
This commit is contained in:
parent
0384d9c29f
commit
5be4326626
|
@ -58,21 +58,6 @@ static GSRendererType GSCurrentRenderer;
|
||||||
|
|
||||||
static u64 s_next_manual_present_time;
|
static u64 s_next_manual_present_time;
|
||||||
|
|
||||||
void GSinit()
|
|
||||||
{
|
|
||||||
GSVertexSW::InitStatic();
|
|
||||||
|
|
||||||
GSUtil::Init();
|
|
||||||
}
|
|
||||||
|
|
||||||
void GSshutdown()
|
|
||||||
{
|
|
||||||
GSclose();
|
|
||||||
|
|
||||||
// ensure all screenshots have been saved
|
|
||||||
GSJoinSnapshotThreads();
|
|
||||||
}
|
|
||||||
|
|
||||||
GSRendererType GSGetCurrentRenderer()
|
GSRendererType GSGetCurrentRenderer()
|
||||||
{
|
{
|
||||||
return GSCurrentRenderer;
|
return GSCurrentRenderer;
|
||||||
|
@ -192,6 +177,8 @@ static bool OpenGSRenderer(GSRendererType renderer, u8* basemem)
|
||||||
// Must be done first, initialization routines in GSState use GSIsHardwareRenderer().
|
// Must be done first, initialization routines in GSState use GSIsHardwareRenderer().
|
||||||
GSCurrentRenderer = renderer;
|
GSCurrentRenderer = renderer;
|
||||||
|
|
||||||
|
GSVertexSW::InitStatic();
|
||||||
|
|
||||||
if (renderer == GSRendererType::Null)
|
if (renderer == GSRendererType::Null)
|
||||||
{
|
{
|
||||||
g_gs_renderer = std::make_unique<GSRendererNull>();
|
g_gs_renderer = std::make_unique<GSRendererNull>();
|
||||||
|
|
|
@ -56,8 +56,6 @@ s16 GSLookupGetSkipCountFunctionId(const std::string_view& name);
|
||||||
s16 GSLookupBeforeDrawFunctionId(const std::string_view& name);
|
s16 GSLookupBeforeDrawFunctionId(const std::string_view& name);
|
||||||
s16 GSLookupMoveHandlerFunctionId(const std::string_view& name);
|
s16 GSLookupMoveHandlerFunctionId(const std::string_view& name);
|
||||||
|
|
||||||
void GSinit();
|
|
||||||
void GSshutdown();
|
|
||||||
bool GSopen(const Pcsx2Config::GSOptions& config, GSRendererType renderer, u8* basemem);
|
bool GSopen(const Pcsx2Config::GSOptions& config, GSRendererType renderer, u8* basemem);
|
||||||
bool GSreopen(bool recreate_device, GSRendererType new_renderer, std::optional<const Pcsx2Config::GSOptions*> old_config);
|
bool GSreopen(bool recreate_device, GSRendererType new_renderer, std::optional<const Pcsx2Config::GSOptions*> old_config);
|
||||||
void GSreset(bool hardware_reset);
|
void GSreset(bool hardware_reset);
|
||||||
|
|
|
@ -22,18 +22,17 @@
|
||||||
#include <wil/com.h>
|
#include <wil/com.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static class GSUtilMaps
|
namespace {
|
||||||
|
struct GSUtilMaps
|
||||||
{
|
{
|
||||||
public:
|
u8 PrimClassField[8] = {};
|
||||||
u8 PrimClassField[8];
|
u8 VertexCountField[8] = {};
|
||||||
u8 VertexCountField[8];
|
u8 ClassVertexCountField[4] = {};
|
||||||
u8 ClassVertexCountField[4];
|
u32 CompatibleBitsField[64][2] = {};
|
||||||
u32 CompatibleBitsField[64][2];
|
u32 SharedBitsField[64][2] = {};
|
||||||
u32 SharedBitsField[64][2];
|
u32 SwizzleField[64][2] = {};
|
||||||
u32 SwizzleField[64][2];
|
|
||||||
|
|
||||||
// Defer init to avoid AVX2 illegal instructions
|
constexpr GSUtilMaps()
|
||||||
void Init()
|
|
||||||
{
|
{
|
||||||
PrimClassField[GS_POINTLIST] = GS_POINT_CLASS;
|
PrimClassField[GS_POINTLIST] = GS_POINT_CLASS;
|
||||||
PrimClassField[GS_LINELIST] = GS_LINE_CLASS;
|
PrimClassField[GS_LINELIST] = GS_LINE_CLASS;
|
||||||
|
@ -58,8 +57,6 @@ public:
|
||||||
ClassVertexCountField[GS_TRIANGLE_CLASS] = 3;
|
ClassVertexCountField[GS_TRIANGLE_CLASS] = 3;
|
||||||
ClassVertexCountField[GS_SPRITE_CLASS] = 2;
|
ClassVertexCountField[GS_SPRITE_CLASS] = 2;
|
||||||
|
|
||||||
memset(CompatibleBitsField, 0, sizeof(CompatibleBitsField));
|
|
||||||
|
|
||||||
for (int i = 0; i < 64; i++)
|
for (int i = 0; i < 64; i++)
|
||||||
{
|
{
|
||||||
CompatibleBitsField[i][i >> 5] |= 1U << (i & 0x1f);
|
CompatibleBitsField[i][i >> 5] |= 1U << (i & 0x1f);
|
||||||
|
@ -74,8 +71,6 @@ public:
|
||||||
CompatibleBitsField[PSMZ16][PSMZ16S >> 5] |= 1 << (PSMZ16S & 0x1f);
|
CompatibleBitsField[PSMZ16][PSMZ16S >> 5] |= 1 << (PSMZ16S & 0x1f);
|
||||||
CompatibleBitsField[PSMZ16S][PSMZ16 >> 5] |= 1 << (PSMZ16 & 0x1f);
|
CompatibleBitsField[PSMZ16S][PSMZ16 >> 5] |= 1 << (PSMZ16 & 0x1f);
|
||||||
|
|
||||||
memset(SwizzleField, 0, sizeof(SwizzleField));
|
|
||||||
|
|
||||||
for (int i = 0; i < 64; i++)
|
for (int i = 0; i < 64; i++)
|
||||||
{
|
{
|
||||||
SwizzleField[i][i >> 5] |= 1U << (i & 0x1f);
|
SwizzleField[i][i >> 5] |= 1U << (i & 0x1f);
|
||||||
|
@ -92,8 +87,6 @@ public:
|
||||||
SwizzleField[PSMZ32][PSMZ24 >> 5] |= 1 << (PSMZ24 & 0x1f);
|
SwizzleField[PSMZ32][PSMZ24 >> 5] |= 1 << (PSMZ24 & 0x1f);
|
||||||
SwizzleField[PSMZ24][PSMZ32 >> 5] |= 1 << (PSMZ32 & 0x1f);
|
SwizzleField[PSMZ24][PSMZ32 >> 5] |= 1 << (PSMZ32 & 0x1f);
|
||||||
|
|
||||||
memset(SharedBitsField, 0, sizeof(SharedBitsField));
|
|
||||||
|
|
||||||
SharedBitsField[PSMCT24][PSMT8H >> 5] |= 1 << (PSMT8H & 0x1f);
|
SharedBitsField[PSMCT24][PSMT8H >> 5] |= 1 << (PSMT8H & 0x1f);
|
||||||
SharedBitsField[PSMCT24][PSMT4HL >> 5] |= 1 << (PSMT4HL & 0x1f);
|
SharedBitsField[PSMCT24][PSMT4HL >> 5] |= 1 << (PSMT4HL & 0x1f);
|
||||||
SharedBitsField[PSMCT24][PSMT4HH >> 5] |= 1 << (PSMT4HH & 0x1f);
|
SharedBitsField[PSMCT24][PSMT4HH >> 5] |= 1 << (PSMT4HH & 0x1f);
|
||||||
|
@ -109,14 +102,11 @@ public:
|
||||||
SharedBitsField[PSMT4HH][PSMZ24 >> 5] |= 1 << (PSMZ24 & 0x1f);
|
SharedBitsField[PSMT4HH][PSMZ24 >> 5] |= 1 << (PSMZ24 & 0x1f);
|
||||||
SharedBitsField[PSMT4HH][PSMT4HL >> 5] |= 1 << (PSMT4HL & 0x1f);
|
SharedBitsField[PSMT4HH][PSMT4HL >> 5] |= 1 << (PSMT4HL & 0x1f);
|
||||||
}
|
}
|
||||||
|
};
|
||||||
} s_maps;
|
|
||||||
|
|
||||||
void GSUtil::Init()
|
|
||||||
{
|
|
||||||
s_maps.Init();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static constexpr const GSUtilMaps s_maps;
|
||||||
|
|
||||||
const char* GSUtil::GetATSTName(u32 atst)
|
const char* GSUtil::GetATSTName(u32 atst)
|
||||||
{
|
{
|
||||||
static constexpr const char* names[] = {
|
static constexpr const char* names[] = {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// SPDX-FileCopyrightText: 2002-2023 PCSX2 Dev Team
|
// SPDX-FileCopyrightText: 2002-2024 PCSX2 Dev Team
|
||||||
// SPDX-License-Identifier: LGPL-3.0+
|
// SPDX-License-Identifier: LGPL-3.0+
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
@ -9,8 +9,6 @@
|
||||||
class GSUtil
|
class GSUtil
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void Init();
|
|
||||||
|
|
||||||
static const char* GetATSTName(u32 atst);
|
static const char* GetATSTName(u32 atst);
|
||||||
static const char* GetAFAILName(u32 afail);
|
static const char* GetAFAILName(u32 afail);
|
||||||
|
|
||||||
|
|
|
@ -190,8 +190,6 @@ void MTGS::ThreadEntryPoint()
|
||||||
// we need to reset sem_event here, because MainLoop() kills it.
|
// we need to reset sem_event here, because MainLoop() kills it.
|
||||||
s_sem_event.Reset();
|
s_sem_event.Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
GSshutdown();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MTGS::ResetGS(bool hardware_reset)
|
void MTGS::ResetGS(bool hardware_reset)
|
||||||
|
|
|
@ -393,7 +393,6 @@ bool VMManager::Internal::CPUThreadInitialize()
|
||||||
|
|
||||||
InitializeCPUProviders();
|
InitializeCPUProviders();
|
||||||
|
|
||||||
GSinit();
|
|
||||||
USBinit();
|
USBinit();
|
||||||
|
|
||||||
// We want settings loaded so we choose the correct renderer for big picture mode.
|
// We want settings loaded so we choose the correct renderer for big picture mode.
|
||||||
|
@ -425,9 +424,9 @@ void VMManager::Internal::CPUThreadShutdown()
|
||||||
PerformanceMetrics::SetCPUThread(Threading::ThreadHandle());
|
PerformanceMetrics::SetCPUThread(Threading::ThreadHandle());
|
||||||
|
|
||||||
USBshutdown();
|
USBshutdown();
|
||||||
GSshutdown();
|
|
||||||
|
|
||||||
MTGS::ShutdownThread();
|
MTGS::ShutdownThread();
|
||||||
|
GSJoinSnapshotThreads();
|
||||||
|
|
||||||
ShutdownCPUProviders();
|
ShutdownCPUProviders();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue