Remove I3DEngine CryCommon Interface (#567)
Delete: - I3DEngine - Missions - Time of day - GameEffectsSystem Gem - ImageProcessing Gem - SVOGI Gem - Various other things that don't do anything now that the legacy renderer has been removed.
This commit is contained in:
@@ -102,7 +102,6 @@ inline int RoundToClosestMB(size_t memSize)
|
||||
#include <IRenderer.h>
|
||||
#include <CryFile.h>
|
||||
#include <ISystem.h>
|
||||
#include <I3DEngine.h>
|
||||
#include <ITimer.h>
|
||||
#include <IPhysics.h>
|
||||
#include <IXml.h>
|
||||
@@ -127,7 +126,6 @@ namespace AZ::IO
|
||||
struct IArchive;
|
||||
}
|
||||
struct ICryFont;
|
||||
struct I3DEngine;
|
||||
struct IMovieSystem;
|
||||
struct IAudioSystem;
|
||||
struct IPhysicalWorld;
|
||||
|
||||
@@ -193,10 +193,6 @@ static void UnloadMap([[maybe_unused]] IConsoleCmdArgs* args)
|
||||
if (gEnv->pSystem && gEnv->pSystem->GetILevelSystem() && !gEnv->IsEditor())
|
||||
{
|
||||
gEnv->pSystem->GetILevelSystem()->UnloadLevel();
|
||||
if (gEnv->p3DEngine)
|
||||
{
|
||||
gEnv->p3DEngine->LoadEmptyLevel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -674,18 +670,6 @@ ILevel* CLevelSystem::LoadLevelInternal(const char* _levelName)
|
||||
pSpamDelay->Set(0.0f);
|
||||
}
|
||||
|
||||
if (gEnv->p3DEngine)
|
||||
{
|
||||
bool is3DEngineLoaded = gEnv->IsEditor() ? gEnv->p3DEngine->InitLevelForEditor(pLevelInfo->GetPath(), pLevelInfo->m_defaultGameTypeName.c_str())
|
||||
: gEnv->p3DEngine->LoadLevel(pLevelInfo->GetPath(), pLevelInfo->m_defaultGameTypeName.c_str());
|
||||
if (!is3DEngineLoaded)
|
||||
{
|
||||
OnLoadingError(levelName, "3DEngine failed to handle loading the level");
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Parse level specific config data.
|
||||
AZStd::string const sLevelNameOnly(PathUtil::GetFileName(levelName));
|
||||
|
||||
@@ -760,14 +744,6 @@ ILevel* CLevelSystem::LoadLevelInternal(const char* _levelName)
|
||||
|
||||
gEnv->pSystem->SetSystemGlobalState(ESYSTEM_GLOBAL_STATE_LEVEL_LOAD_START_PRECACHE);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Notify 3D engine that loading finished
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
if (gEnv->p3DEngine)
|
||||
{
|
||||
gEnv->p3DEngine->PostLoadLevel();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
gEnv->pConsole->SetScrollMax(600 / 2);
|
||||
@@ -991,18 +967,6 @@ void CLevelSystem::UnloadLevel()
|
||||
|
||||
CTimeValue tBegin = gEnv->pTimer->GetAsyncTime();
|
||||
|
||||
I3DEngine* p3DEngine = gEnv->p3DEngine;
|
||||
if (p3DEngine)
|
||||
{
|
||||
IDeferredPhysicsEventManager* pPhysEventManager = p3DEngine->GetDeferredPhysicsEventManager();
|
||||
if (pPhysEventManager)
|
||||
{
|
||||
// clear deferred physics queues before renderer, since we could have jobs running
|
||||
// which access a rendermesh
|
||||
pPhysEventManager->ClearDeferredEvents();
|
||||
}
|
||||
}
|
||||
|
||||
//AM: Flush render thread (Flush is not exposed - using EndFrame())
|
||||
//We are about to delete resources that could be in use
|
||||
if (gEnv->pRenderer)
|
||||
@@ -1076,25 +1040,10 @@ void CLevelSystem::UnloadLevel()
|
||||
|
||||
SAFE_RELEASE(m_pCurrentLevel);
|
||||
|
||||
/*
|
||||
Force Lua garbage collection before p3DEngine->UnloadLevel() and pRenderer->FreeResources(flags) are called.
|
||||
p3DEngine->UnloadLevel() will destroy particle emitters even if they're still referenced by Lua objects that are yet to be collected.
|
||||
(as per comment in 3dEngineLoad.cpp (line 501) - "Force to clean all particles that are left, even if still referenced.").
|
||||
Then, during the next GC cycle, Lua finally cleans up, the particle emitter smart pointers will be pointing to invalid memory).
|
||||
Normally the GC step is triggered at the end of this method (by the ESYSTEM_EVENT_LEVEL_POST_UNLOAD event), which is too late
|
||||
(after the render resources have been purged).
|
||||
This extra GC step takes a few ms more level unload time, which is a small price for fixing nasty crashes.
|
||||
If, however, we wanted to claim it back, we could potentially get rid of the GC step that is triggered by ESYSTEM_EVENT_LEVEL_POST_UNLOAD to break even.
|
||||
*/
|
||||
|
||||
// Force Lua garbage collection (may no longer be needed now the legacy renderer has been removed).
|
||||
// Normally the GC step is triggered at the end of this method (by the ESYSTEM_EVENT_LEVEL_POST_UNLOAD event).
|
||||
EBUS_EVENT(AZ::ScriptSystemRequestBus, GarbageCollect);
|
||||
|
||||
// Delete engine resources
|
||||
if (p3DEngine)
|
||||
{
|
||||
p3DEngine->UnloadLevel();
|
||||
|
||||
}
|
||||
// Force to clean render resources left after deleting all objects and materials.
|
||||
IRenderer* pRenderer = gEnv->pRenderer;
|
||||
if (pRenderer)
|
||||
|
||||
@@ -55,10 +55,6 @@ namespace LegacyLevelSystem
|
||||
if (gEnv->pSystem && gEnv->pSystem->GetILevelSystem() && !gEnv->IsEditor())
|
||||
{
|
||||
gEnv->pSystem->GetILevelSystem()->UnloadLevel();
|
||||
if (gEnv->p3DEngine)
|
||||
{
|
||||
gEnv->p3DEngine->LoadEmptyLevel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -262,22 +258,6 @@ namespace LegacyLevelSystem
|
||||
pSpamDelay->Set(0.0f);
|
||||
}
|
||||
|
||||
if (gEnv->p3DEngine)
|
||||
{
|
||||
AZ::IO::PathView levelPath(levelName);
|
||||
AZStd::string parentPath(levelPath.ParentPath().Native());
|
||||
|
||||
static constexpr const char* defaultGameTypeName = "Mission0";
|
||||
bool is3DEngineLoaded = gEnv->IsEditor() ? gEnv->p3DEngine->InitLevelForEditor(parentPath.c_str(), defaultGameTypeName)
|
||||
: gEnv->p3DEngine->LoadLevel(parentPath.c_str(), defaultGameTypeName);
|
||||
if (!is3DEngineLoaded)
|
||||
{
|
||||
OnLoadingError(levelName, "3DEngine failed to handle loading the level");
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Parse level specific config data.
|
||||
AZStd::string const sLevelNameOnly(PathUtil::GetFileName(levelName));
|
||||
|
||||
@@ -340,14 +320,6 @@ namespace LegacyLevelSystem
|
||||
|
||||
gEnv->pSystem->SetSystemGlobalState(ESYSTEM_GLOBAL_STATE_LEVEL_LOAD_START_PRECACHE);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Notify 3D engine that loading finished
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
if (gEnv->p3DEngine)
|
||||
{
|
||||
gEnv->p3DEngine->PostLoadLevel();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
gEnv->pConsole->SetScrollMax(600 / 2);
|
||||
@@ -569,18 +541,6 @@ namespace LegacyLevelSystem
|
||||
|
||||
CTimeValue tBegin = gEnv->pTimer->GetAsyncTime();
|
||||
|
||||
I3DEngine* p3DEngine = gEnv->p3DEngine;
|
||||
if (p3DEngine)
|
||||
{
|
||||
IDeferredPhysicsEventManager* pPhysEventManager = p3DEngine->GetDeferredPhysicsEventManager();
|
||||
if (pPhysEventManager)
|
||||
{
|
||||
// clear deferred physics queues before renderer, since we could have jobs running
|
||||
// which access a rendermesh
|
||||
pPhysEventManager->ClearDeferredEvents();
|
||||
}
|
||||
}
|
||||
|
||||
// AM: Flush render thread (Flush is not exposed - using EndFrame())
|
||||
// We are about to delete resources that could be in use
|
||||
if (gEnv->pRenderer)
|
||||
@@ -644,25 +604,10 @@ namespace LegacyLevelSystem
|
||||
|
||||
GetISystem()->GetIResourceManager()->UnloadLevel();
|
||||
|
||||
/*
|
||||
Force Lua garbage collection before p3DEngine->UnloadLevel() and pRenderer->FreeResources(flags) are called.
|
||||
p3DEngine->UnloadLevel() will destroy particle emitters even if they're still referenced by Lua objects that are yet to be
|
||||
collected. (as per comment in 3dEngineLoad.cpp (line 501) - "Force to clean all particles that are left, even if still referenced.").
|
||||
Then, during the next GC cycle, Lua finally cleans up, the particle emitter smart pointers will be pointing to invalid memory).
|
||||
Normally the GC step is triggered at the end of this method (by the ESYSTEM_EVENT_LEVEL_POST_UNLOAD event), which is too late
|
||||
(after the render resources have been purged).
|
||||
This extra GC step takes a few ms more level unload time, which is a small price for fixing nasty crashes.
|
||||
If, however, we wanted to claim it back, we could potentially get rid of the GC step that is triggered by
|
||||
ESYSTEM_EVENT_LEVEL_POST_UNLOAD to break even.
|
||||
*/
|
||||
|
||||
// Force Lua garbage collection (may no longer be needed now the legacy renderer has been removed).
|
||||
// Normally the GC step is triggered at the end of this method (by the ESYSTEM_EVENT_LEVEL_POST_UNLOAD event).
|
||||
EBUS_EVENT(AZ::ScriptSystemRequestBus, GarbageCollect);
|
||||
|
||||
// Delete engine resources
|
||||
if (p3DEngine)
|
||||
{
|
||||
p3DEngine->UnloadLevel();
|
||||
}
|
||||
// Force to clean render resources left after deleting all objects and materials.
|
||||
IRenderer* pRenderer = gEnv->pRenderer;
|
||||
if (pRenderer)
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "MiniGUI/MiniMenu.h"
|
||||
#include "MiniGUI/MiniTable.h"
|
||||
#include <IConsole.h>
|
||||
#include <I3DEngine.h>
|
||||
#include <ITimer.h>
|
||||
#include "System.h"
|
||||
|
||||
@@ -853,21 +852,6 @@ void CPerfHUD::SaveStatsCallback([[maybe_unused]] void* data, [[maybe_unused]] b
|
||||
// RENDER CALLBACKS
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*
|
||||
void CPerfHUD::DisplayRenderInfoCallback(const Rect& rect)
|
||||
{
|
||||
IMiniGUIPtr pGUI;
|
||||
if (CryCreateClassInstanceForInterface( cryiidof<IMiniGUI>(),pGUI ))
|
||||
{
|
||||
//right aligned display
|
||||
float x = rect.right;
|
||||
float y = rect.top;
|
||||
float step = 13.f;
|
||||
|
||||
gEnv->p3DEngine->DisplayInfo(x, y, step, true);
|
||||
}
|
||||
}*/
|
||||
|
||||
void CPerfHUD::EnableWidget(ICryPerfHUDWidget::EWidgetID id, int mode)
|
||||
{
|
||||
const int nWidgets = m_widgets.size();
|
||||
@@ -1530,26 +1514,6 @@ void CRenderStatsWidget::Update()
|
||||
m_runtimeData.nFwdLights = 0;
|
||||
m_runtimeData.nFwdShadowLights = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
if (gEnv->p3DEngine)
|
||||
{
|
||||
I3DEngine::SObjectsStreamingStatus objStats;
|
||||
gEnv->p3DEngine->GetObjectsStreamingStatus(objStats);
|
||||
|
||||
float fMeshRequiredMB = (float)(objStats.nMemRequired) / (1024 * 1024);
|
||||
sprintf_s(entryBuffer, "Mesh Required: %.2f (%dMB)", fMeshRequiredMB, azlossy_cast<int>(objStats.nMeshPoolSize));
|
||||
if (fMeshRequiredMB < objStats.nMeshPoolSize)
|
||||
{
|
||||
m_pInfoBox->AddEntry(entryBuffer, CPerfHUD::COL_NORM, CPerfHUD::TEXT_SIZE_NORM);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pInfoBox->AddEntry(entryBuffer, CPerfHUD::COL_ERROR, CPerfHUD::TEXT_SIZE_NORM);
|
||||
CryPerfHUDWarning(1.f, "Too Many Geometry: %.2fMB", fMeshRequiredMB);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
if (gEnv->pRenderer)
|
||||
{
|
||||
@@ -1727,25 +1691,6 @@ CStreamingStatsWidget::CStreamingStatsWidget(IMiniCtrl* pParentMenu, ICryPerfHUD
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CStreamingStatsWidget::Update()
|
||||
{
|
||||
char entryBuffer[CMiniInfoBox::MAX_TEXT_LENGTH] = {0};
|
||||
|
||||
//Clear old entries
|
||||
m_pInfoBox->ClearEntries();
|
||||
|
||||
I3DEngine::SObjectsStreamingStatus objStats;
|
||||
gEnv->p3DEngine->GetObjectsStreamingStatus(objStats);
|
||||
|
||||
float fMeshRequiredMB = (float)(objStats.nMemRequired) / (1024 * 1024);
|
||||
sprintf_s(entryBuffer, "Mesh Required: %.2f (%dMB)", fMeshRequiredMB, objStats.nMeshPoolSize);
|
||||
if (fMeshRequiredMB < objStats.nMeshPoolSize)
|
||||
{
|
||||
m_pInfoBox->AddEntry(entryBuffer, CPerfHUD::COL_NORM, CPerfHUD::TEXT_SIZE_NORM);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pInfoBox->AddEntry(entryBuffer, CPerfHUD::COL_ERROR, CPerfHUD::TEXT_SIZE_NORM);
|
||||
CryPerfHUDWarning(1.f, "Too Many Geometry: %.2fMB", fMeshRequiredMB);
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,245 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
// Description : Visual helper for checking a local memory usage on maps
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_CRYSYSTEM_STATISTICS_LOCALMEMORYUSAGE_H
|
||||
#define CRYINCLUDE_CRYSYSTEM_STATISTICS_LOCALMEMORYUSAGE_H
|
||||
#pragma once
|
||||
|
||||
|
||||
#include "../CryCommon/Cry_Geo.h"
|
||||
#include "ILocalMemoryUsage.h"
|
||||
#include "TimeValue.h"
|
||||
|
||||
#define LOCALMEMORY_SECTOR_SIZE 32.f //Size of one sector
|
||||
#define LOCALMEMORY_SECTOR_NR_X 128 //4096 / LOCALMEMORY_SECTOR_SIZE Sector number of the world (x)
|
||||
#define LOCALMEMORY_SECTOR_NR_Y 128 //4096 / LOCALMEMORY_SECTOR_SIZE Sector number of the world (y)
|
||||
#define LOCALMEMORY_SECTOR_PER_PASS 128 //4096 / 32 Sector nr for one calculation pass. Now it is the whole world;
|
||||
|
||||
//Sector number must be = LOCALMEMORY_SECTOR_PER_PASS * n
|
||||
|
||||
#define LOCALMEMORY_COLOR_OK 0, 255, 0
|
||||
#define LOCALMEMORY_COLOR_WARNING 255, 255, 0
|
||||
#define LOCALMEMORY_COLOR_ERROR 255, 0, 0
|
||||
#define LOCALMEMORY_COLOR_TEXTURE 0, 0, 255
|
||||
#define LOCALMEMORY_COLOR_GEOMETRY 0, 0, 0
|
||||
#define LOCALMEMORY_COLOR_BLACK 0, 0, 0, 192
|
||||
#define LOCALMEMORY_FCOLOR_OK 0, 1, 0
|
||||
#define LOCALMEMORY_FCOLOR_WARNING 1, 1, 0
|
||||
#define LOCALMEMORY_FCOLOR_ERROR 1, 0, 0
|
||||
#define LOCALMEMORY_FCOLOR_OTHER 0, 0, 1
|
||||
|
||||
struct IMaterial;
|
||||
struct IStatObj;
|
||||
struct IRenderMesh;
|
||||
struct IRenderNode;
|
||||
struct CRenderChunk;
|
||||
class CCamera;
|
||||
|
||||
#include <VectorMap.h>
|
||||
|
||||
struct CLocalMemoryUsage
|
||||
: public ILocalMemoryUsage
|
||||
{
|
||||
private:
|
||||
|
||||
struct STextureInfo;
|
||||
struct SMaterialInfo;
|
||||
struct SStatObjInfo;
|
||||
|
||||
typedef std__hash_map<INT_PTR, STextureInfo > TTextureMap; // Type: hash map of textures
|
||||
typedef std__hash_map<INT_PTR, SMaterialInfo> TMaterialMap; // Type: hash map of materials
|
||||
typedef std__hash_map<INT_PTR, SStatObjInfo > TStatObjMap; // Type: hash map of stat objects
|
||||
|
||||
//*******************
|
||||
|
||||
struct SResource
|
||||
{
|
||||
CLocalMemoryUsage* m_pLocalMemoryUsage; // Inner pointer to the singleton (we can use gEnv->pLocalMemoryUsage with type cast instead this)
|
||||
|
||||
float m_arrMipFactor[LOCALMEMORY_SECTOR_PER_PASS * LOCALMEMORY_SECTOR_PER_PASS]; // Mipmap factor based on minimum distance of the resource from the sector (bounding box distance)
|
||||
bool m_arrRowDirty[LOCALMEMORY_SECTOR_PER_PASS]; // Dirty flag for m_arrMipFactor rows
|
||||
bool m_used;
|
||||
|
||||
static int m_arrMemoryUsage[LOCALMEMORY_SECTOR_PER_PASS]; // Memory usage of the resource in sectors (last row)
|
||||
static int m_arrPieces[LOCALMEMORY_SECTOR_PER_PASS]; // Pieces nr of the resource in sectors (last row)
|
||||
|
||||
virtual void StartChecking(); // Called every frame first
|
||||
void CheckOnAllSectorsP1(const AABB& bounding, float maxViewDist, float viewDistMultiplierForLOD, float mipFactor); // Calculates the minimum of sector bounding vs renderobject bounding distances
|
||||
|
||||
SResource();
|
||||
virtual void Init(CLocalMemoryUsage* pLocalMemoryUsage);
|
||||
//If we will needed a destructor, it must be virtual!
|
||||
};
|
||||
|
||||
//*******************
|
||||
|
||||
struct STextureInfo
|
||||
: public SResource
|
||||
{
|
||||
ITexture* m_pTexture; // Texture pointer
|
||||
//int m_size; // For later use - Used memory
|
||||
//int m_xSize; // For later use - Texture x size
|
||||
//int m_ySize; // For later use - Texture y size
|
||||
//int m_numMips; // For later use - Number of mip maps
|
||||
|
||||
void CheckOnAllSectorsP2(); // Calculate memory usage using distances
|
||||
|
||||
STextureInfo();
|
||||
~STextureInfo();
|
||||
};
|
||||
|
||||
//*******************
|
||||
|
||||
struct STextureInfoAndTilingFactor
|
||||
{
|
||||
STextureInfo* m_pTextureInfo;
|
||||
float m_tilingFactor;
|
||||
};
|
||||
|
||||
typedef std::vector<STextureInfoAndTilingFactor> TTextureVector; // Type: vector of textures
|
||||
|
||||
struct SMaterialInfo
|
||||
: public SResource
|
||||
{
|
||||
//_smart_ptr<IMaterial> m_pMaterial; // For later use
|
||||
TTextureVector m_textures; // Used textures
|
||||
|
||||
SMaterialInfo();
|
||||
|
||||
void AddTextureInfo(STextureInfoAndTilingFactor texture);// Add a new texture (unique)
|
||||
void CheckOnAllSectorsP2(); // Forward distance informations to textures
|
||||
};
|
||||
|
||||
//*******************
|
||||
|
||||
struct SStatObjInfo
|
||||
: public SResource
|
||||
{
|
||||
int m_streamableContentMemoryUsage; // Total streamable memory usage
|
||||
//IStatObj *m_pStatObj; //TODO kiszedni
|
||||
string m_filePath; // The original file name and path of the StatObj
|
||||
bool m_bSubObject; // Is the original StatObj a subobject?
|
||||
/*
|
||||
int m_lodNr; // For later use
|
||||
int m_vertices;
|
||||
int m_meshSize;
|
||||
int m_physProxySize;
|
||||
int m_physPrimitives;
|
||||
int m_indices;
|
||||
int m_indicesPerLod[MAX_LODS];
|
||||
*/
|
||||
|
||||
SStatObjInfo();
|
||||
void CheckOnAllSectorsP2(); // Calculate memory usage using distances
|
||||
};
|
||||
|
||||
//*******************
|
||||
|
||||
struct SSector
|
||||
{
|
||||
SSector();
|
||||
|
||||
void StartChecking(); // Called every frame first
|
||||
|
||||
int m_memoryUsage_Textures; // Sum of texture memory usage
|
||||
|
||||
int m_memoryUsage_Geometry; // Sum of geometry memory usage
|
||||
};
|
||||
|
||||
//*******************
|
||||
PREFAST_SUPPRESS_WARNING(6262);
|
||||
TTextureMap m_globalTextures; // Hash map of resources: textures
|
||||
PREFAST_SUPPRESS_WARNING(6262);
|
||||
TMaterialMap m_globalMaterials; // Hash map of resources: materials
|
||||
PREFAST_SUPPRESS_WARNING(6262);
|
||||
TStatObjMap m_globalStatObjs; // Hash map of resources: stat objects
|
||||
|
||||
ICVar* m_pStreamCgfPredicitionDistance; // Config: additional object distance for streaming
|
||||
ICVar* m_pDebugDraw; // Config: debug draw mode
|
||||
|
||||
int sys_LocalMemoryTextureLimit; // Config: texture limit for streaming
|
||||
int sys_LocalMemoryGeometryLimit; // Config: stat object geometry limit for streaming
|
||||
int sys_LocalMemoryTextureStreamingSpeedLimit; // Config: texture streaming speed limit (approx)
|
||||
int sys_LocalMemoryGeometryStreamingSpeedLimit; // Config: stat object geometry streaming speed limit (approx)
|
||||
|
||||
float sys_LocalMemoryWarningRatio; // Config: Warning ratio for streaming
|
||||
float sys_LocalMemoryOuterViewDistance; // Config: View distance for debug draw
|
||||
float sys_LocalMemoryInnerViewDistance; // Config: View distance for detailed debug draw
|
||||
|
||||
float sys_LocalMemoryObjectWidth; // Config: Width of the debug object
|
||||
float sys_LocalMemoryObjectHeight; // Config: Height of the debug object
|
||||
int sys_LocalMemoryObjectAlpha; // Config: Color alpha of the debug object
|
||||
|
||||
float sys_LocalMemoryStreamingSpeedObjectLength; // Config: Length of the streaming speed debug object
|
||||
float sys_LocalMemoryStreamingSpeedObjectWidth; // Config: Width of the streaming speed debug object
|
||||
|
||||
float sys_LocalMemoryDiagramWidth; // Config: Width of the diagram
|
||||
|
||||
float sys_LocalMemoryDiagramRadius; // Config: Radius of the diagram
|
||||
float sys_LocalMemoryDiagramDistance; // Config: Distance of the diagram from the main debug object
|
||||
float sys_LocalMemoryDiagramStreamingSpeedRadius; // Config: Radius of the streaming speed diagram
|
||||
float sys_LocalMemoryDiagramStreamingSpeedDistance; // Config: Distance of the streaming speed diagram from the streaming speed debug line
|
||||
int sys_LocalMemoryDiagramAlpha; // Config: Color alpha of the diagram
|
||||
|
||||
int sys_LocalMemoryDrawText; // Config: If != 0, it will draw the numeric values
|
||||
int sys_LocalMemoryLogText; // Config: If != 0, it will log the numeric values
|
||||
|
||||
int sys_LocalMemoryOptimalMSecPerSec; // Config: Optimal calculation time (MSec) per secundum
|
||||
int sys_LocalMemoryMaxMSecBetweenCalls; // Config: Maximal time difference (MSec) between calls
|
||||
|
||||
RectI m_actProcessedSectors; // Processed sectors (now it is the whole world)
|
||||
RectI m_actDrawedSectors; // Processed sectors (now it is the whole world)
|
||||
|
||||
Vec2i m_sectorNr; // Sector x and y number
|
||||
|
||||
float m_AverageUpdateTime; // Avarage Update() time (MSec)
|
||||
CTimeValue m_LastCallTime; // Last call time of Update()
|
||||
|
||||
SSector m_arrSectors[LOCALMEMORY_SECTOR_NR_X * LOCALMEMORY_SECTOR_NR_Y]; // Sectors
|
||||
|
||||
public:
|
||||
|
||||
CLocalMemoryUsage();
|
||||
~CLocalMemoryUsage();
|
||||
|
||||
virtual void OnRender(IRenderer* pRenderer, const CCamera* camera);
|
||||
virtual void OnUpdate();
|
||||
virtual void DeleteGlobalData(); // Deletes the m_globalXXX hash maps
|
||||
|
||||
private:
|
||||
void DeleteUnusedResources(); // Delete the non-used resources (especially StatObjs)
|
||||
void StartChecking(const RectI& actProcessedSectors); // Called every frame first
|
||||
void CollectGeometryP1(); // Calculates the minimum of sector bounding vs renderobject bounding distances
|
||||
|
||||
// Get / create StatObjInfo then run Pass1
|
||||
SStatObjInfo* CheckStatObjP1(IStatObj* pStatObj, IRenderNode* pRenderNode, AABB bounding, float maxViewDist, float scale);
|
||||
//void CollectStatObjInfo_Recursive( SStatObjInfo* statObjInfo, IStatObj *pStatObj );
|
||||
//void CollectGeometryInfo( SStatObjInfo* statObjInfo, IStatObj *pStatObj );
|
||||
|
||||
// Get / create MaterialInfo then run Pass1
|
||||
void CheckMaterialP1(_smart_ptr<IMaterial> pMaterial, AABB bounding, float maxViewDist, float scale, float mipFactor);
|
||||
void CheckChunkMaterialP1(_smart_ptr<IMaterial> pMaterial, AABB bounding, float maxViewDist, float scale, CRenderChunk* pRenderChunk);
|
||||
void CheckMeshMaterialP1(IRenderMesh* pRenderMesh, _smart_ptr<IMaterial> pMaterial, AABB bounding, float maxViewDist, float scale);
|
||||
void CheckStatObjMaterialP1(IStatObj* pStatObj, _smart_ptr<IMaterial> pMaterial, AABB bounding, float maxViewDist, float scale);
|
||||
// Collects textures used by the material
|
||||
void CollectMaterialInfo_Recursive(SMaterialInfo* materialInfo, _smart_ptr<IMaterial> pMaterial);
|
||||
|
||||
// Get / create TextureInfo
|
||||
STextureInfo* GetTextureInfo(ITexture* pTexture);
|
||||
};
|
||||
|
||||
#undef MAX_LODS
|
||||
#endif // CRYINCLUDE_CRYSYSTEM_STATISTICS_LOCALMEMORYUSAGE_H
|
||||
@@ -119,8 +119,6 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
#include AZ_RESTRICTED_FILE(System_cpp)
|
||||
#endif
|
||||
|
||||
|
||||
#include <I3DEngine.h>
|
||||
#include <IRenderer.h>
|
||||
#include <IMovieSystem.h>
|
||||
#include <ServiceNetwork.h>
|
||||
@@ -131,7 +129,6 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
#include <ISoftCodeMgr.h>
|
||||
#include "VisRegTest.h"
|
||||
#include <LyShine/ILyShine.h>
|
||||
#include <ITimeOfDay.h>
|
||||
|
||||
#include <LoadScreenBus.h>
|
||||
|
||||
@@ -154,7 +151,6 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
#include "Serialization/ArchiveHost.h"
|
||||
#include "SystemEventDispatcher.h"
|
||||
#include "ServerThrottle.h"
|
||||
#include "ILocalMemoryUsage.h"
|
||||
#include "ResourceManager.h"
|
||||
#include "HMDBus.h"
|
||||
#include "OverloadSceneManager/OverloadSceneManager.h"
|
||||
@@ -682,15 +678,6 @@ void CSystem::ShutDown()
|
||||
// Shutdown any running VR devices.
|
||||
EBUS_EVENT(AZ::VR::HMDInitRequestBus, Shutdown);
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Clear 3D Engine resources.
|
||||
if (m_env.p3DEngine)
|
||||
{
|
||||
m_env.p3DEngine->UnloadLevel();
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Shutdown resource manager.
|
||||
m_pResourceManager->Shutdown();
|
||||
|
||||
@@ -706,7 +693,6 @@ void CSystem::ShutDown()
|
||||
SAFE_DELETE(m_env.pServiceNetwork);
|
||||
SAFE_RELEASE(m_env.pLyShine);
|
||||
SAFE_RELEASE(m_env.pCryFont);
|
||||
SAFE_RELEASE(m_env.p3DEngine); // depends on EntitySystem
|
||||
if (m_env.pConsole)
|
||||
{
|
||||
((CXConsole*)m_env.pConsole)->FreeRenderResources();
|
||||
@@ -1231,8 +1217,6 @@ bool CSystem::UpdatePreTickBus(int updateFlags, int nPauseMode)
|
||||
return false;
|
||||
}
|
||||
|
||||
RenderBegin();
|
||||
|
||||
#ifndef EXCLUDE_UPDATE_ON_CONSOLE
|
||||
// do the dedicated sleep earlier than the frame profiler to avoid having it counted
|
||||
if (gEnv->IsDedicated())
|
||||
@@ -1295,11 +1279,6 @@ bool CSystem::UpdatePreTickBus(int updateFlags, int nPauseMode)
|
||||
GetIRemoteConsole()->Update();
|
||||
#endif
|
||||
|
||||
if (gEnv->pLocalMemoryUsage != NULL)
|
||||
{
|
||||
gEnv->pLocalMemoryUsage->OnUpdate();
|
||||
}
|
||||
|
||||
if (!gEnv->IsEditor() && gEnv->pRenderer)
|
||||
{
|
||||
// If the dimensions of the render target change,
|
||||
@@ -1490,11 +1469,6 @@ bool CSystem::UpdatePreTickBus(int updateFlags, int nPauseMode)
|
||||
//update time subsystem
|
||||
m_Time.UpdateOnFrameStart();
|
||||
|
||||
if (m_env.p3DEngine)
|
||||
{
|
||||
m_env.p3DEngine->OnFrameStart();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// update rate limiter for dedicated server
|
||||
if (m_pServerThrottle.get())
|
||||
@@ -1651,7 +1625,7 @@ bool CSystem::UpdatePreTickBus(int updateFlags, int nPauseMode)
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
bool CSystem::UpdatePostTickBus(int updateFlags, int nPauseMode)
|
||||
bool CSystem::UpdatePostTickBus(int updateFlags, int /*nPauseMode*/)
|
||||
{
|
||||
CTimeValue updateStart = gEnv->pTimer->GetAsyncTime();
|
||||
|
||||
@@ -1663,44 +1637,6 @@ bool CSystem::UpdatePostTickBus(int updateFlags, int nPauseMode)
|
||||
UpdateMovieSystem(updateFlags, fMovieFrameTime, false);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//update process (3D engine)
|
||||
if (!(updateFlags & ESYSUPDATE_EDITOR) && !m_bNoUpdate && m_env.p3DEngine)
|
||||
{
|
||||
FRAME_PROFILER("SysUpdate:Update3DEngine", this, PROFILE_SYSTEM);
|
||||
|
||||
if (ITimeOfDay* pTOD = m_env.p3DEngine->GetTimeOfDay())
|
||||
{
|
||||
pTOD->Tick();
|
||||
}
|
||||
|
||||
if (m_env.p3DEngine)
|
||||
{
|
||||
m_env.p3DEngine->Tick(); // clear per frame temp data
|
||||
}
|
||||
if (m_pProcess && (m_pProcess->GetFlags() & PROC_3DENGINE))
|
||||
{
|
||||
if ((nPauseMode != 1))
|
||||
{
|
||||
if (!IsEquivalent(m_ViewCamera.GetPosition(), Vec3(0, 0, 0), VEC_EPSILON))
|
||||
{
|
||||
if (m_env.p3DEngine)
|
||||
{
|
||||
// m_env.p3DEngine->SetCamera(m_ViewCamera);
|
||||
m_pProcess->Update();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_pProcess)
|
||||
{
|
||||
m_pProcess->Update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//update sound system part 2
|
||||
if (!g_cvars.sys_deferAudioUpdateOptim && !m_bNoUpdate)
|
||||
@@ -1748,41 +1684,8 @@ bool CSystem::UpdatePostTickBus(int updateFlags, int nPauseMode)
|
||||
gEnv->pCryPak->DisableRuntimeFileAccess(true);
|
||||
}
|
||||
|
||||
// If it's in editing mode (in editor) the render is done in RenderViewport so we skip rendering here.
|
||||
if (!gEnv->IsEditing() && gEnv->pRenderer && gEnv->p3DEngine)
|
||||
{
|
||||
if (GetIViewSystem())
|
||||
{
|
||||
GetIViewSystem()->Update(min(gEnv->pTimer->GetFrameTime(), 0.1f));
|
||||
}
|
||||
|
||||
// Begin occlusion job after setting the correct camera.
|
||||
gEnv->p3DEngine->PrepareOcclusion(GetViewCamera());
|
||||
|
||||
CrySystemNotificationBus::Broadcast(&CrySystemNotifications::OnPreRender);
|
||||
|
||||
// Also broadcast for anyone else that needs to draw global debug to do so now
|
||||
AzFramework::DebugDisplayEventBus::Broadcast(&AzFramework::DebugDisplayEvents::DrawGlobalDebugInfo);
|
||||
|
||||
Render();
|
||||
|
||||
gEnv->p3DEngine->EndOcclusion();
|
||||
|
||||
CrySystemNotificationBus::Broadcast(&CrySystemNotifications::OnPostRender);
|
||||
|
||||
RenderEnd();
|
||||
|
||||
gEnv->p3DEngine->SyncProcessStreamingUpdate();
|
||||
|
||||
if (NeedDoWorkDuringOcclusionChecks())
|
||||
{
|
||||
DoWorkDuringOcclusionChecks();
|
||||
}
|
||||
|
||||
// Sync the work that must be done in the main thread by the end of frame.
|
||||
gEnv->pRenderer->GetGenerateShadowRendItemJobExecutor()->WaitForCompletion();
|
||||
gEnv->pRenderer->GetGenerateRendItemJobExecutor()->WaitForCompletion();
|
||||
}
|
||||
// Also broadcast for anyone else that needs to draw global debug to do so now
|
||||
AzFramework::DebugDisplayEventBus::Broadcast(&AzFramework::DebugDisplayEvents::DrawGlobalDebugInfo);
|
||||
|
||||
return !IsQuitting();
|
||||
}
|
||||
|
||||
@@ -408,13 +408,6 @@ public:
|
||||
virtual void DoWorkDuringOcclusionChecks();
|
||||
virtual bool NeedDoWorkDuringOcclusionChecks() { return m_bNeedDoWorkDuringOcclusionChecks; }
|
||||
|
||||
//! Begin rendering frame.
|
||||
void RenderBegin();
|
||||
//! Render subsystems.
|
||||
void Render();
|
||||
//! End rendering frame and swap back buffer.
|
||||
void RenderEnd(bool bRenderStats = true, bool bMainWindow = true);
|
||||
|
||||
//Called when the renderer finishes rendering the scene
|
||||
void OnScene3DEnd() override;
|
||||
|
||||
@@ -429,11 +422,6 @@ public:
|
||||
//! Update screen and call some important tick functions during loading.
|
||||
void SynchronousLoadingTick(const char* pFunc, int line);
|
||||
|
||||
//! Renders the statistics; this is called from RenderEnd, but if the
|
||||
//! Host application (Editor) doesn't employ the Render cycle in ISystem,
|
||||
//! it may call this method to render the essential statistics
|
||||
void RenderStatistics() override;
|
||||
|
||||
uint32 GetUsedMemory();
|
||||
|
||||
virtual void DumpMemoryUsageStatistics(bool bUseKB);
|
||||
@@ -469,7 +457,6 @@ public:
|
||||
AZ::IO::IArchive* GetIPak() { return m_env.pCryPak; };
|
||||
IConsole* GetIConsole() { return m_env.pConsole; };
|
||||
IRemoteConsole* GetIRemoteConsole();
|
||||
I3DEngine* GetI3DEngine(){ return m_env.p3DEngine; }
|
||||
IMovieSystem* GetIMovieSystem() { return m_env.pMovieSystem; };
|
||||
IMemoryManager* GetIMemoryManager(){ return m_pMemoryManager; }
|
||||
IThreadManager* GetIThreadManager() override {return m_env.pThreadManager; }
|
||||
@@ -696,9 +683,6 @@ private:
|
||||
void CreateRendererVars(const SSystemInitParams& startupParams);
|
||||
void CreateSystemVars();
|
||||
void CreateAudioVars();
|
||||
void RenderStats();
|
||||
void RenderOverscanBorders();
|
||||
void RenderMemStats();
|
||||
|
||||
AZStd::unique_ptr<AZ::DynamicModuleHandle> LoadDLL(const char* dllName);
|
||||
|
||||
|
||||
@@ -86,7 +86,6 @@
|
||||
|
||||
#endif //WIN32
|
||||
|
||||
#include <I3DEngine.h>
|
||||
#include <IRenderer.h>
|
||||
#include <AzCore/IO/FileIO.h>
|
||||
#include <IMovieSystem.h>
|
||||
@@ -107,7 +106,6 @@
|
||||
#include "PhysRenderer.h"
|
||||
#include "LocalizedStringManager.h"
|
||||
#include "SystemEventDispatcher.h"
|
||||
#include "Statistics/LocalMemoryUsage.h"
|
||||
#include "ThreadConfigManager.h"
|
||||
#include "Validator.h"
|
||||
#include "ServerThrottle.h"
|
||||
@@ -768,11 +766,6 @@ static void LoadDetectedSpec(ICVar* pVar)
|
||||
|
||||
GetISystem()->SetConfigSpec(static_cast<ESystemConfigSpec>(spec), platform, false);
|
||||
|
||||
if (gEnv->p3DEngine)
|
||||
{
|
||||
gEnv->p3DEngine->GetMaterialManager()->RefreshMaterialRuntime();
|
||||
}
|
||||
|
||||
no_recursive = false;
|
||||
}
|
||||
|
||||
@@ -2788,12 +2781,6 @@ AZ_POP_DISABLE_WARNING
|
||||
m_env.pRenderer->TryFlush();
|
||||
}
|
||||
|
||||
#if !defined(RELEASE)
|
||||
m_env.pLocalMemoryUsage = new CLocalMemoryUsage();
|
||||
#else
|
||||
m_env.pLocalMemoryUsage = nullptr;
|
||||
#endif
|
||||
|
||||
if (g_cvars.sys_float_exceptions > 0)
|
||||
{
|
||||
if (g_cvars.sys_float_exceptions == 3 && gEnv->IsEditor()) // Turn off float exceptions in editor if sys_float_exceptions = 3
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
#include <IProcess.h>
|
||||
#include "Log.h"
|
||||
#include "XConsole.h"
|
||||
#include <I3DEngine.h>
|
||||
#include <CryLibrary.h>
|
||||
#include "PhysRenderer.h"
|
||||
#include <IMovieSystem.h>
|
||||
@@ -222,92 +221,6 @@ void CSystem::CreateRendererVars(const SSystemInitParams& startupParams)
|
||||
"Usage: r_OverscanBordersDrawDebugView [0=off/1=show]");
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CSystem::RenderBegin()
|
||||
{
|
||||
FUNCTION_PROFILER_FAST(GetISystem(), PROFILE_SYSTEM, g_bProfilerEnabled);
|
||||
|
||||
if (m_bIgnoreUpdates)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bool rndAvail = m_env.pRenderer != 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//start the rendering pipeline
|
||||
if (rndAvail)
|
||||
{
|
||||
m_env.pRenderer->BeginFrame();
|
||||
}
|
||||
|
||||
gEnv->nMainFrameID = (rndAvail) ? m_env.pRenderer->GetFrameID(false) : 0;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CSystem::RenderEnd([[maybe_unused]] bool bRenderStats, bool bMainWindow)
|
||||
{
|
||||
{
|
||||
FUNCTION_PROFILER_FAST(GetISystem(), PROFILE_SYSTEM, g_bProfilerEnabled);
|
||||
|
||||
if (m_bIgnoreUpdates)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_env.pRenderer)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (bMainWindow) // we don't do this in UI Editor window for example
|
||||
{
|
||||
#if !defined (_RELEASE)
|
||||
// Flush render data and swap buffers.
|
||||
m_env.pRenderer->RenderDebug(bRenderStats);
|
||||
#endif
|
||||
|
||||
#if defined(USE_PERFHUD)
|
||||
if (m_pPerfHUD)
|
||||
{
|
||||
m_pPerfHUD->Draw();
|
||||
}
|
||||
if (m_pMiniGUI)
|
||||
{
|
||||
m_pMiniGUI->Draw();
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!gEnv->pSystem->GetILevelSystem() || !gEnv->pSystem->GetILevelSystem()->IsLevelLoaded())
|
||||
{
|
||||
IConsole* console = GetIConsole();
|
||||
|
||||
//Same goes for the console. When no level is loaded, it's okay to render it outside of the renderer
|
||||
//so that users can load maps or change settings.
|
||||
if (console != nullptr)
|
||||
{
|
||||
console->Draw();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_env.pRenderer->ForceGC(); // XXX Rename this
|
||||
m_env.pRenderer->EndFrame();
|
||||
|
||||
|
||||
if (IConsole* pConsole = GetIConsole())
|
||||
{
|
||||
// if we have pending cvar calculation, execute it here
|
||||
// since we know cvars will be correct here after ->EndFrame().
|
||||
if (!pConsole->IsHashCalculated())
|
||||
{
|
||||
pConsole->CalcCheatVarHash();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CSystem::OnScene3DEnd()
|
||||
{
|
||||
//Render Console
|
||||
@@ -391,231 +304,3 @@ void CSystem::DisplayErrorMessage(const char* acMessage,
|
||||
#endif
|
||||
m_ErrorMessages.push_back(message);
|
||||
}
|
||||
|
||||
//! Renders the statistics; this is called from RenderEnd, but if the
|
||||
//! Host application (Editor) doesn't employ the Render cycle in ISystem,
|
||||
//! it may call this method to render the essential statistics
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CSystem::RenderStatistics()
|
||||
{
|
||||
RenderStats();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
void CSystem::Render()
|
||||
{
|
||||
if (m_bIgnoreUpdates)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//check what is the current process
|
||||
if (!m_pProcess)
|
||||
{
|
||||
return; //should never happen
|
||||
}
|
||||
//check if the game is in pause or
|
||||
//in menu mode
|
||||
//bool bPause=false;
|
||||
//if (m_pProcess->GetFlags() & PROC_MENU)
|
||||
// bPause=true;
|
||||
|
||||
FUNCTION_PROFILER_FAST(GetISystem(), PROFILE_SYSTEM, g_bProfilerEnabled);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//draw
|
||||
m_env.p3DEngine->PreWorldStreamUpdate(m_ViewCamera);
|
||||
|
||||
if (m_pProcess)
|
||||
{
|
||||
if (m_pProcess->GetFlags() & PROC_3DENGINE)
|
||||
{
|
||||
if (!gEnv->IsEditing()) // Editor calls it's own rendering update
|
||||
{
|
||||
if (m_env.p3DEngine && !m_env.IsFMVPlaying())
|
||||
{
|
||||
if (!IsEquivalent(m_ViewCamera.GetPosition(), Vec3(0, 0, 0), VEC_EPSILON) || // never pass undefined camera to p3DEngine->RenderWorld()
|
||||
gEnv->IsDedicated() || (gEnv->pRenderer && gEnv->pRenderer->IsPost3DRendererEnabled()))
|
||||
{
|
||||
GetIRenderer()->SetViewport(0, 0, GetIRenderer()->GetWidth(), GetIRenderer()->GetHeight());
|
||||
m_env.p3DEngine->RenderWorld(SHDF_ALLOW_WATER | SHDF_ALLOWPOSTPROCESS | SHDF_ALLOWHDR | SHDF_ZPASS | SHDF_ALLOW_AO, SRenderingPassInfo::CreateGeneralPassRenderingInfo(m_ViewCamera), __FUNCTION__);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gEnv->pRenderer)
|
||||
{
|
||||
// force rendering of black screen to be sure we don't only render the clear color (which is the fog color by default)
|
||||
gEnv->pRenderer->SetState(GS_BLSRC_SRCALPHA | GS_BLDST_ONEMINUSSRCALPHA | GS_NODEPTHTEST);
|
||||
gEnv->pRenderer->Draw2dImage(0, 0, 800, 600, -1, 0.0f, 0.0f, 1.0f, 1.0f, 0.f,
|
||||
0.0f, 0.0f, 0.0f, 1.0f, 0.f);
|
||||
}
|
||||
}
|
||||
}
|
||||
#if !defined(_RELEASE)
|
||||
if (m_pVisRegTest)
|
||||
{
|
||||
m_pVisRegTest->AfterRender();
|
||||
}
|
||||
#endif
|
||||
|
||||
if (m_env.pMovieSystem)
|
||||
{
|
||||
m_env.pMovieSystem->Render();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GetIRenderer()->SetViewport(0, 0, GetIRenderer()->GetWidth(), GetIRenderer()->GetHeight());
|
||||
m_pProcess->RenderWorld(SHDF_ALLOW_WATER | SHDF_ALLOWPOSTPROCESS | SHDF_ALLOWHDR | SHDF_ZPASS | SHDF_ALLOW_AO, SRenderingPassInfo::CreateGeneralPassRenderingInfo(m_ViewCamera), __FUNCTION__);
|
||||
}
|
||||
}
|
||||
|
||||
m_env.p3DEngine->WorldStreamUpdate();
|
||||
|
||||
gEnv->pRenderer->SwitchToNativeResolutionBackbuffer();
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CSystem::RenderStats()
|
||||
{
|
||||
#if defined(ENABLE_PROFILING_CODE)
|
||||
#ifndef _RELEASE
|
||||
// if we rendered an error message on screen during the last frame, then sleep now
|
||||
// to force hard stall for 3sec
|
||||
if (m_bHasRenderedErrorMessage && !gEnv->IsEditor() && !IsLoading())
|
||||
{
|
||||
// DO NOT REMOVE OR COMMENT THIS OUT!
|
||||
// If you hit this, then you most likely have invalid (synchronous) file accesses
|
||||
// which must be fixed in order to not stall the entire game.
|
||||
Sleep(3000);
|
||||
m_bHasRenderedErrorMessage = false;
|
||||
}
|
||||
#endif
|
||||
|
||||
// render info messages on screen
|
||||
float fTextPosX = 5.0f;
|
||||
float fTextPosY = -10;
|
||||
float fTextStepY = 13;
|
||||
|
||||
float fFrameTime = gEnv->pTimer->GetRealFrameTime();
|
||||
TErrorMessages::iterator itnext;
|
||||
for (TErrorMessages::iterator it = m_ErrorMessages.begin(); it != m_ErrorMessages.end(); it = itnext)
|
||||
{
|
||||
itnext = it;
|
||||
++itnext;
|
||||
SErrorMessage& message = *it;
|
||||
|
||||
SDrawTextInfo ti;
|
||||
ti.flags = eDrawText_FixedSize | eDrawText_2D | eDrawText_Monospace;
|
||||
memcpy(ti.color, message.m_Color, 4 * sizeof(float));
|
||||
ti.xscale = ti.yscale = 1.4f;
|
||||
m_env.pRenderer->DrawTextQueued(Vec3(fTextPosX, fTextPosY += fTextStepY, 1.0f), ti, message.m_Message.c_str());
|
||||
|
||||
if (!IsLoading())
|
||||
{
|
||||
message.m_fTimeToShow -= fFrameTime;
|
||||
}
|
||||
|
||||
if (message.m_HardFailure)
|
||||
{
|
||||
m_bHasRenderedErrorMessage = true;
|
||||
}
|
||||
|
||||
if (message.m_fTimeToShow < 0.0f)
|
||||
{
|
||||
m_ErrorMessages.erase(it);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!m_env.pConsole)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef _RELEASE
|
||||
if (m_rOverscanBordersDrawDebugView)
|
||||
{
|
||||
RenderOverscanBorders();
|
||||
}
|
||||
#endif
|
||||
|
||||
int iDisplayInfo = m_rDisplayInfo->GetIVal();
|
||||
if (iDisplayInfo == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Draw engine stats
|
||||
if (m_env.p3DEngine)
|
||||
{
|
||||
// Draw 3dengine stats and get last text cursor position
|
||||
float nTextPosX = 101 - 20, nTextPosY = -2, nTextStepY = 3;
|
||||
m_env.p3DEngine->DisplayInfo(nTextPosX, nTextPosY, nTextStepY, iDisplayInfo != 1);
|
||||
|
||||
// Dump Open 3D Engine CPU and GPU memory statistics to screen
|
||||
m_env.p3DEngine->DisplayMemoryStatistics();
|
||||
|
||||
#if defined(ENABLE_LW_PROFILERS)
|
||||
if (m_rDisplayInfo->GetIVal() == 2)
|
||||
{
|
||||
m_env.pRenderer->TextToScreen(nTextPosX, nTextPosY += nTextStepY, "SysMem %.1f mb",
|
||||
float(DumpMMStats(false)) / 1024.f);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
for (int i = 0; i < NUM_POOLS; ++i)
|
||||
{
|
||||
int used = (g_pPakHeap->m_iBigPoolUsed[i] ? (int)g_pPakHeap->m_iBigPoolSize[i] : 0);
|
||||
int size = (int)g_pPakHeap->m_iBigPoolSize[i];
|
||||
float fC1[4] = {1, 1, 0, 1};
|
||||
m_env.pRenderer->Draw2dLabel(10, 100.0f + i * 16, 2.1f, fC1, false, "BigPool %d: %d bytes of %d bytes used", i, used, size);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void CSystem::RenderOverscanBorders()
|
||||
{
|
||||
#ifndef _RELEASE
|
||||
|
||||
if (m_env.pRenderer && m_rOverscanBordersDrawDebugView)
|
||||
{
|
||||
int iOverscanBordersDrawDebugView = m_rOverscanBordersDrawDebugView->GetIVal();
|
||||
if (iOverscanBordersDrawDebugView)
|
||||
{
|
||||
const int texId = -1;
|
||||
const float uv = 0.0f;
|
||||
const float rot = 0.0f;
|
||||
const int whiteTextureId = m_env.pRenderer->GetWhiteTextureId();
|
||||
|
||||
const float r = 1.0f;
|
||||
const float g = 1.0f;
|
||||
const float b = 1.0f;
|
||||
const float a = 0.2f;
|
||||
|
||||
Vec2 overscanBorders = Vec2(0.0f, 0.0f);
|
||||
m_env.pRenderer->EF_Query(EFQ_OverscanBorders, overscanBorders);
|
||||
|
||||
const float overscanBorderWidth = overscanBorders.x * VIRTUAL_SCREEN_WIDTH;
|
||||
const float overscanBorderHeight = overscanBorders.y * VIRTUAL_SCREEN_HEIGHT;
|
||||
|
||||
const float xPos = overscanBorderWidth;
|
||||
const float yPos = overscanBorderHeight;
|
||||
const float width = VIRTUAL_SCREEN_WIDTH - (2.0f * overscanBorderWidth);
|
||||
const float height = VIRTUAL_SCREEN_HEIGHT - (2.0f * overscanBorderHeight);
|
||||
|
||||
m_env.pRenderer->SetState(GS_BLSRC_SRCALPHA | GS_BLDST_ONEMINUSSRCALPHA | GS_NODEPTHTEST);
|
||||
m_env.pRenderer->Draw2dImage(xPos, yPos,
|
||||
width, height,
|
||||
whiteTextureId,
|
||||
uv, uv, uv, uv,
|
||||
rot,
|
||||
r, g, b, a);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#include "System.h"
|
||||
#include <time.h>
|
||||
|
||||
#include <I3DEngine.h>
|
||||
#include <IRenderer.h>
|
||||
#include <IMovieSystem.h>
|
||||
#include <ILog.h>
|
||||
@@ -302,23 +301,6 @@ void CSystem::CollectMemStats (ICrySizer* pSizer, MemStatsPurposeEnum nPurpose,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (m_env.p3DEngine)
|
||||
{
|
||||
SIZER_COMPONENT_NAME(pSizer, "Cry3DEngine");
|
||||
{
|
||||
m_env.p3DEngine->GetMemoryUsage (pSizer);
|
||||
{
|
||||
SIZER_COMPONENT_NAME (pSizer, "$Allocations waste");
|
||||
const SmallModuleInfo* info = FindModuleInfo(stats, "Cry3DEngine.dll");
|
||||
if (info)
|
||||
{
|
||||
pSizer->AddObject(info, info->memInfo.allocated - info->memInfo.requested);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (m_env.pRenderer)
|
||||
{
|
||||
SIZER_COMPONENT_NAME(pSizer, "CryRenderer");
|
||||
|
||||
@@ -98,7 +98,7 @@ void CView::Update(float frameTime, bool isActive)
|
||||
|
||||
//see if the view have to use a custom near clipping plane
|
||||
const float nearPlane = (m_viewParams.nearplane >= CAMERA_MIN_NEAR) ? (m_viewParams.nearplane) : fNearZ;
|
||||
const float farPlane = (m_viewParams.farplane > 0.f) ? m_viewParams.farplane : gEnv->p3DEngine->GetMaxViewDistance();
|
||||
const float farPlane = (m_viewParams.farplane > 0.f) ? m_viewParams.farplane : DEFAULT_FAR;
|
||||
float fov = (m_viewParams.fov < 0.001f) ? DEFAULT_FOV : m_viewParams.fov;
|
||||
|
||||
// [VR] specific
|
||||
|
||||
@@ -533,11 +533,6 @@ void CViewSystem::BeginCutScene(IAnimSequence* pSeq, [[maybe_unused]] unsigned l
|
||||
{
|
||||
m_cutsceneCount++;
|
||||
|
||||
if (m_cutsceneCount == 1)
|
||||
{
|
||||
gEnv->p3DEngine->ResetPostEffects();
|
||||
}
|
||||
|
||||
VS_CALL_LISTENERS(OnBeginCutScene(pSeq, bResetFX));
|
||||
}
|
||||
|
||||
@@ -546,11 +541,6 @@ void CViewSystem::EndCutScene(IAnimSequence* pSeq, [[maybe_unused]] unsigned lon
|
||||
{
|
||||
m_cutsceneCount -= (m_cutsceneCount > 0);
|
||||
|
||||
if (m_cutsceneCount == 0)
|
||||
{
|
||||
gEnv->p3DEngine->ResetPostEffects();
|
||||
}
|
||||
|
||||
ClearCutsceneViews();
|
||||
|
||||
VS_CALL_LISTENERS(OnEndCutScene(pSeq));
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include "VisRegTest.h"
|
||||
|
||||
#include "ISystem.h"
|
||||
#include "I3DEngine.h"
|
||||
#include "IRenderer.h"
|
||||
#include "IConsole.h"
|
||||
#include "ITimer.h"
|
||||
|
||||
@@ -57,7 +57,6 @@ set(FILES
|
||||
UnixConsole.h
|
||||
SystemInit.h
|
||||
Serialization/MemoryReader.h
|
||||
Statistics/LocalMemoryUsage.h
|
||||
MemoryFragmentationProfiler.h
|
||||
XML/ReadWriteXMLSink.h
|
||||
Serialization/ArchiveHost.h
|
||||
@@ -151,7 +150,6 @@ set(FILES
|
||||
MiniGUI/MiniInfoBox.h
|
||||
MiniGUI/MiniMenu.h
|
||||
MiniGUI/MiniTable.h
|
||||
Statistics/LocalMemoryUsage.cpp
|
||||
ZLibCompressor.cpp
|
||||
ZLibCompressor.h
|
||||
SoftCode/SoftCodeMgr.cpp
|
||||
|
||||
Reference in New Issue
Block a user