Remove (almost) all references to pRenderer (#651)

Remove all references to pRenderer, except from the DebugDraw and LyShine Gems that are still being updated.
This commit is contained in:
bosnichd
2021-05-10 10:05:15 -06:00
committed by GitHub
parent 4a2e6a77b5
commit 440c40e490
191 changed files with 118 additions and 23548 deletions
+1 -129
View File
@@ -127,7 +127,6 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
#include <IProcess.h>
#include <INotificationNetwork.h>
#include <ISoftCodeMgr.h>
#include "VisRegTest.h"
#include <LyShine/ILyShine.h>
#include <LoadScreenBus.h>
@@ -135,8 +134,6 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
#include <AzFramework/Archive/Archive.h>
#include "XConsole.h"
#include "Log.h"
#include "CrySizerStats.h"
#include "CrySizerImpl.h"
#include "NotificationNetwork.h"
#include "ProfileLog.h"
@@ -153,7 +150,6 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
#include "ServerThrottle.h"
#include "ResourceManager.h"
#include "HMDBus.h"
#include "OverloadSceneManager/OverloadSceneManager.h"
#include <IThreadManager.h>
#include "IZLibCompressor.h"
@@ -318,11 +314,6 @@ CSystem::CSystem(SharedEnvironmentInstance* pSharedEnvironment)
m_pSystemEventDispatcher->RegisterListener(this);
}
#ifdef WIN32
m_hInst = NULL;
m_hWnd = NULL;
#endif
//////////////////////////////////////////////////////////////////////////
// Clear environment.
//////////////////////////////////////////////////////////////////////////
@@ -357,7 +348,6 @@ CSystem::CSystem(SharedEnvironmentInstance* pSharedEnvironment)
m_pIFont = NULL;
m_pIFontUi = NULL;
m_pVisRegTest = NULL;
m_rWidth = NULL;
m_rHeight = NULL;
m_rWidthAndHeightAsFractionOfScreenSize = NULL;
@@ -368,7 +358,6 @@ CSystem::CSystem(SharedEnvironmentInstance* pSharedEnvironment)
m_cvSSInfo = NULL;
m_rStencilBits = NULL;
m_rFullscreen = NULL;
m_rDriver = NULL;
m_sysNoUpdate = NULL;
m_pMemoryManager = NULL;
m_pProcess = NULL;
@@ -413,7 +402,6 @@ CSystem::CSystem(SharedEnvironmentInstance* pSharedEnvironment)
m_pCpu = NULL;
m_bInitializedSuccessfully = false;
m_bShaderCacheGenMode = false;
m_bRelaunch = false;
m_iLoadingMode = 0;
m_bTestMode = false;
@@ -430,9 +418,6 @@ CSystem::CSystem(SharedEnvironmentInstance* pSharedEnvironment)
m_expectingMapCommand = false;
#endif
// no mem stats at the moment
m_pMemStats = NULL;
m_pSizer = NULL;
m_pCVarQuit = NULL;
m_bForceNonDevMode = false;
@@ -468,9 +453,6 @@ CSystem::CSystem(SharedEnvironmentInstance* pSharedEnvironment)
InitThreadSystem();
m_pMiniGUI = NULL;
m_pPerfHUD = NULL;
g_pPakHeap = new CMTSafeHeap;
if (!AZ::AllocatorInstance<AZ::OSAllocator>::IsReady())
@@ -516,7 +498,6 @@ CSystem::~CSystem()
CRY_ASSERT(m_windowMessageHandlers.empty() && "There exists a dangling window message handler somewhere");
SAFE_DELETE(m_pVisRegTest);
SAFE_DELETE(m_pXMLUtils);
SAFE_DELETE(m_pArchiveHost);
SAFE_DELETE(m_pThreadTaskManager);
@@ -704,13 +685,6 @@ void CSystem::ShutDown()
SAFE_RELEASE(m_pViewSystem);
SAFE_RELEASE(m_pLevelSystem);
//Can't kill renderer before we delete CryFont, 3DEngine, etc
if (GetIRenderer())
{
GetIRenderer()->ShutDown();
SAFE_RELEASE(m_env.pRenderer);
}
if (m_env.pLog)
{
m_env.pLog->UnregisterConsoleVariables();
@@ -731,7 +705,6 @@ void CSystem::ShutDown()
SAFE_RELEASE(m_cvSSInfo);
SAFE_RELEASE(m_rStencilBits);
SAFE_RELEASE(m_rFullscreen);
SAFE_RELEASE(m_rDriver);
SAFE_RELEASE(m_sysWarnings);
SAFE_RELEASE(m_sysKeyboard);
@@ -751,13 +724,9 @@ void CSystem::ShutDown()
SAFE_RELEASE(m_pNotificationNetwork);
SAFE_DELETE(m_env.pSoftCodeMgr);
SAFE_DELETE(m_pMemStats);
SAFE_DELETE(m_pSizer);
SAFE_DELETE(m_pDefaultValidator);
m_pValidator = nullptr;
SAFE_DELETE(m_env.pOverloadSceneManager);
SAFE_DELETE(m_pLocalizationManager);
//DebugStats(false, false);//true);
@@ -816,11 +785,6 @@ void CSystem::Quit()
m_pUserCallback->OnQuit();
}
if (GetIRenderer())
{
GetIRenderer()->RestoreGamma();
}
gEnv->pLog->FlushAndClose();
// Latest possible place to flush any pending messages to disk before the forceful termination.
@@ -1229,8 +1193,6 @@ bool CSystem::UpdatePreTickBus(int updateFlags, int nPauseMode)
}
#endif //EXCLUDE_UPDATE_ON_CONSOLE
gEnv->pOverloadSceneManager->Update();
#ifdef WIN32
// enable/disable SSE fp exceptions (#nan and /0)
// need to do it each frame since sometimes they are being reset
@@ -1242,12 +1204,6 @@ bool CSystem::UpdatePreTickBus(int updateFlags, int nPauseMode)
m_nUpdateCounter++;
#ifndef EXCLUDE_UPDATE_ON_CONSOLE
if (!m_sDelayedScreeenshot.empty())
{
gEnv->pRenderer->ScreenShot(m_sDelayedScreeenshot.c_str());
m_sDelayedScreeenshot.clear();
}
// Check if game needs to be sleeping when not active.
SleepIfInactive();
@@ -1278,27 +1234,6 @@ bool CSystem::UpdatePreTickBus(int updateFlags, int nPauseMode)
#ifdef USE_REMOTE_CONSOLE
GetIRemoteConsole()->Update();
#endif
if (!gEnv->IsEditor() && gEnv->pRenderer)
{
// If the dimensions of the render target change,
// or are different from the camera defaults,
// we need to update the camera frustum.
CCamera& viewCamera = GetViewCamera();
const int renderTargetWidth = m_rWidth->GetIVal();
const int renderTargetHeight = m_rHeight->GetIVal();
if (renderTargetWidth != viewCamera.GetViewSurfaceX() ||
renderTargetHeight != viewCamera.GetViewSurfaceZ())
{
viewCamera.SetFrustum(renderTargetWidth,
renderTargetHeight,
viewCamera.GetFov(),
viewCamera.GetNearPlane(),
viewCamera.GetFarPlane(),
gEnv->pRenderer->GetPixelAspectRatio());
}
}
if (nPauseMode != 0)
{
m_bPaused = true;
@@ -1346,53 +1281,6 @@ bool CSystem::UpdatePreTickBus(int updateFlags, int nPauseMode)
m_pStreamEngine->Update();
}
if (g_cvars.az_streaming_stats)
{
SDrawTextInfo ti;
ti.flags = eDrawText_FixedSize | eDrawText_2D | eDrawText_Monospace;
ti.xscale = ti.yscale = 1.2f;
const int viewportHeight = GetViewCamera().GetViewSurfaceZ();
#if defined(AZ_RESTRICTED_PLATFORM)
#define AZ_RESTRICTED_SECTION SYSTEM_CPP_SECTION_8
#include AZ_RESTRICTED_FILE(System_cpp)
#else
float y = static_cast<float>(viewportHeight) - 85.0f;
#endif
AZStd::vector<AZ::IO::Statistic> stats;
AZ::Interface<AZ::IO::IStreamer>::Get()->CollectStatistics(stats);
for (AZ::IO::Statistic& stat : stats)
{
switch (stat.GetType())
{
case AZ::IO::Statistic::Type::FloatingPoint:
gEnv->pRenderer->DrawTextQueued(Vec3(10, y, 1.0f), ti,
AZStd::string::format("%s/%s: %.3f", stat.GetOwner().data(), stat.GetName().data(), stat.GetFloatValue()).c_str());
break;
case AZ::IO::Statistic::Type::Integer:
gEnv->pRenderer->DrawTextQueued(Vec3(10, y, 1.0f), ti,
AZStd::string::format("%s/%s: %lli", stat.GetOwner().data(), stat.GetName().data(), stat.GetIntegerValue()).c_str());
break;
case AZ::IO::Statistic::Type::Percentage:
gEnv->pRenderer->DrawTextQueued(Vec3(10, y, 1.0f), ti,
AZStd::string::format("%s/%s: %.2f (percent)", stat.GetOwner().data(), stat.GetName().data(), stat.GetPercentage()).c_str());
break;
default:
gEnv->pRenderer->DrawTextQueued(Vec3(10, y, 1.0f), ti, AZStd::string::format("Unsupported stat type: %i", static_cast<int>(stat.GetType())).c_str());
break;
}
y -= 12.0f;
if (y < 0.0f)
{
//Exit the loop because there's no purpose on rendering text outside of the visible area.
break;
}
}
}
#ifndef EXCLUDE_UPDATE_ON_CONSOLE
if (m_bIgnoreUpdates)
{
@@ -1476,12 +1364,6 @@ bool CSystem::UpdatePreTickBus(int updateFlags, int nPauseMode)
m_pServerThrottle->Update();
}
//////////////////////////////////////////////////////////////////////////
if (m_env.pRenderer && m_env.pRenderer->GetIStereoRenderer()->IsRenderingToHMD())
{
EBUS_EVENT(AZ::VR::HMDDeviceRequestBus, UpdateInternalState);
}
//////////////////////////////////////////////////////////////////////
//update console system
if (m_env.pConsole)
@@ -1527,6 +1409,7 @@ bool CSystem::UpdatePreTickBus(int updateFlags, int nPauseMode)
//////////////////////////////////////////////////////////////////////////
// Update Threads Task Manager.
//////////////////////////////////////////////////////////////////////////
if (m_pThreadTaskManager)
{
FRAME_PROFILER("SysUpdate:ThreadTaskManager", this, PROFILE_SYSTEM);
m_pThreadTaskManager->OnUpdate();
@@ -2000,12 +1883,6 @@ void CSystem::Relaunch(bool bRelaunch)
SaveConfiguration();
}
//////////////////////////////////////////////////////////////////////////
ICrySizer* CSystem::CreateSizer()
{
return new CrySizerImpl;
}
//////////////////////////////////////////////////////////////////////////
uint32 CSystem::GetUsedMemory()
{
@@ -2113,11 +1990,6 @@ void CSystem::ExecuteCommandLine(bool deferred)
//gEnv->pConsole->ExecuteString("sys_RestoreSpec test*"); // to get useful debugging information about current spec settings to the log file
}
void CSystem::DumpMemoryCoverage()
{
m_MemoryFragmentationProfiler.DumpMemoryCoverage();
}
ITextModeConsole* CSystem::GetITextModeConsole()
{
if (m_bDedicatedServer)