Remove shader warmup

This commit is contained in:
Luke Street 2022-02-23 03:19:46 -05:00
parent 79c4368f15
commit c3c9f9d601
8 changed files with 0 additions and 121 deletions

View File

@ -261,7 +261,6 @@ private:
std::unique_ptr<boo::IAudioVoiceEngine> m_voiceEngine;
Limiter m_limiter{};
bool m_noShaderWarmup = false;
bool m_firstFrame = true;
bool m_fullscreenToggleRequested = false;
@ -290,8 +289,6 @@ public:
auto arg = static_cast<std::string>(str);
if (m_deferredProject.empty() && !arg.starts_with('-') && !arg.starts_with('+'))
m_deferredProject = arg;
if (arg == "--no-shader-warmup")
m_noShaderWarmup = true;
else if (arg == "--no-sound")
m_voiceEngine->setVolume(0.f);
}
@ -368,9 +365,6 @@ public:
if (!g_mainMP1 && m_projectInitialized) {
g_mainMP1.emplace(nullptr, nullptr);
g_mainMP1->Init(m_fileMgr, &m_cvarManager, m_voiceEngine.get(), *m_amuseAllocWrapper);
if (!m_noShaderWarmup) {
g_mainMP1->WarmupShaders();
}
}
float dt = 1 / 60.f;

View File

@ -304,9 +304,6 @@ public:
// void ApplyVerticesCPU(const boo::ObjToken<boo::IGraphicsBufferD>& vertBuf,
// const std::vector<std::pair<zeus::CVector3f, zeus::CVector3f>>& vn) const;
// void RestoreVerticesCPU(const boo::ObjToken<boo::IGraphicsBufferD>& vertBuf) const;
void _WarmupShaders();
static void WarmupShaders(const SObjectTag& cmdlTag);
};
CFactoryFnReturn FPCModelFactory(const metaforce::SObjectTag& tag, std::unique_ptr<u8[]>&& in, u32 len,

View File

@ -1313,34 +1313,6 @@ zeus::CVector3f CModel::GetPoolNormal(size_t idx) const {
// vertBuf->unmap();
//}
void CModel::_WarmupShaders() {
// CBooModel::SetDummyTextures(true);
// CBooModel::EnableShadowMaps(g_Renderer->x220_sphereRamp.get(), zeus::CTransform());
// CGraphics::CProjectionState backupProj = CGraphics::GetProjectionState();
// zeus::CTransform backupViewPoint = CGraphics::g_ViewMatrix;
// zeus::CTransform backupModel = CGraphics::g_GXModelMatrix;
// CGraphics::SetModelMatrix(zeus::CTransform::Translate(-m_aabb.center()));
// CGraphics::SetViewPointMatrix(zeus::CTransform::Translate(0.f, -2048.f, 0.f));
// CGraphics::SetOrtho(-2048.f, 2048.f, 2048.f, -2048.f, 0.f, 4096.f);
// CModelFlags defaultFlags;
// for (SShader& shader : x18_matSets) {
// GetInstance().RemapMaterialData(shader);
// GetInstance().UpdateUniformData(defaultFlags, nullptr, nullptr);
// GetInstance().WarmupDrawSurfaces();
// }
// CGraphics::SetProjectionState(backupProj);
// CGraphics::SetViewPointMatrix(backupViewPoint);
// CGraphics::SetModelMatrix(backupModel);
// CBooModel::DisableShadowMaps();
// CBooModel::SetDummyTextures(false);
}
void CModel::WarmupShaders(const SObjectTag& cmdlTag) {
TToken<CModel> model = g_SimplePool->GetObj(cmdlTag);
CModel* modelObj = model.GetObj();
modelObj->_WarmupShaders();
}
CFactoryFnReturn FPCModelFactory(const metaforce::SObjectTag& tag, std::unique_ptr<u8[]>&& in, u32 len,
const metaforce::CVParamTransfer& vparms, CObjectReference* selfRef) {
CSimplePool* sp = vparms.GetOwnedObj<CSimplePool*>();

View File

@ -45,7 +45,6 @@ public:
virtual EClientFlowStates GetFlowState() const = 0;
virtual void SetFlowState(EClientFlowStates) = 0;
virtual size_t GetExpectedIdSize() const = 0;
virtual void WarmupShaders() = 0;
virtual EGame GetGame() const = 0;
virtual ERegion GetRegion() const = 0;
virtual bool IsPAL() const = 0;

View File

@ -582,7 +582,6 @@ void CMain::Init(const FileStoreManager& storeMgr, CVarManager* cvarMgr, boo::IA
amuse::IBackendVoiceAllocator& backend) {
InitializeDiscord();
m_cvarMgr = cvarMgr;
m_cvarCommons = std::make_unique<CVarCommons>(*m_cvarMgr);
{
const auto discInfo = CDvdFile::DiscInfo();
@ -723,46 +722,8 @@ void CMain::Init(const FileStoreManager& storeMgr, CVarManager* cvarMgr, boo::IA
// g_TweakManager->ReadFromMemoryCard("AudioTweaks");
}
static logvisor::Module WarmupLog("ShaderWarmup");
void CMain::WarmupShaders() {
if (!m_warmupTags.empty())
return;
m_needsWarmupClear = true;
size_t modelCount = 0;
g_ResFactory->EnumerateResources([&](const SObjectTag& tag) {
if (tag.type == FOURCC('CMDL') || tag.type == FOURCC('MREA')) {
++modelCount;
}
return true;
});
m_warmupTags.reserve(modelCount);
std::unordered_set<SObjectTag> addedTags;
addedTags.reserve(modelCount);
g_ResFactory->EnumerateResources([&](const SObjectTag& tag) {
if (tag.type == FOURCC('CMDL') || tag.type == FOURCC('MREA')) {
if (addedTags.find(tag) != addedTags.end()) {
return true;
}
addedTags.insert(tag);
m_warmupTags.push_back(tag);
}
return true;
});
m_warmupIt = m_warmupTags.begin();
WarmupLog.report(logvisor::Info, FMT_STRING("Began warmup of {} objects"), m_warmupTags.size());
}
bool CMain::Proc(float dt) {
CRandom16::ResetNumNextCalls();
// Warmup cycle overrides update
if (m_warmupTags.size())
return false;
if (!m_loadedPersistentResources) {
x128_globalObjects->m_gameResFactory->LoadPersistentResources(*g_SimplePool);
m_loadedPersistentResources = true;
@ -794,37 +755,7 @@ bool CMain::Proc(float dt) {
}
void CMain::Draw() {
// Warmup cycle overrides draw
if (m_warmupTags.size()) {
if (m_needsWarmupClear) {
// CGraphics::g_BooMainCommandQueue->clearTarget(true, true);
m_needsWarmupClear = false;
}
auto startTime = std::chrono::steady_clock::now();
while (m_warmupIt != m_warmupTags.end()) {
WarmupLog.report(logvisor::Info, FMT_STRING("[{} / {}] Warming {}"), int(m_warmupIt - m_warmupTags.begin() + 1),
int(m_warmupTags.size()), *m_warmupIt);
if (m_warmupIt->type == FOURCC('CMDL'))
CModel::WarmupShaders(*m_warmupIt);
else if (m_warmupIt->type == FOURCC('MREA'))
CGameArea::WarmupShaders(*m_warmupIt);
++m_warmupIt;
// Approximately 3/4 frame of warmups
auto curTime = std::chrono::steady_clock::now();
if (std::chrono::duration_cast<std::chrono::milliseconds>(curTime - startTime).count() > 12)
break;
}
if (m_warmupIt == m_warmupTags.end()) {
m_warmupTags = std::vector<SObjectTag>();
WarmupLog.report(logvisor::Info, FMT_STRING("Finished warmup"));
}
return;
}
x164_archSupport->Draw();
// m_console->draw(CGraphics::g_BooMainCommandQueue);
}
void CMain::ShutdownSubsystems() {
@ -839,7 +770,6 @@ void CMain::ShutdownSubsystems() {
}
void CMain::Shutdown() {
// m_console->unregisterCommand("Give");
x128_globalObjects->m_gameResFactory->UnloadPersistentResources();
x164_archSupport.reset();
ShutdownSubsystems();

View File

@ -215,14 +215,7 @@ private:
bool x161_24_gameFrameDrawn : 1 = false;
std::unique_ptr<CGameArchitectureSupport> x164_archSupport;
// boo::IWindow* m_mainWindow = nullptr;
CVarManager* m_cvarMgr = nullptr;
std::unique_ptr<CVarCommons> m_cvarCommons;
// std::unique_ptr<Console> m_console;
// Warmup state
std::vector<SObjectTag> m_warmupTags;
std::vector<SObjectTag>::iterator m_warmupIt;
bool m_needsWarmupClear = false;
bool m_loadedPersistentResources = false;
bool m_doQuit = false;
bool m_paused = false;
@ -254,7 +247,6 @@ public:
// backend);
void Init(const FileStoreManager& storeMgr, CVarManager* cvarManager, boo::IAudioVoiceEngine* voiceEngine,
amuse::IBackendVoiceAllocator& backend) override;
void WarmupShaders() override;
bool Proc(float dt) override;
void Draw() override;
void Shutdown() override;

View File

@ -1197,10 +1197,6 @@ void CGameArea::SetAreaAttributes(const CScriptAreaAttributes* areaAttributes) {
bool CGameArea::CAreaObjectList::IsQualified(const CEntity& ent) const {
return (ent.GetAreaIdAlways() == x200c_areaIdx);
}
void CGameArea::WarmupShaders(const SObjectTag& mreaTag) {
// Calling this version of the constructor performs warmup implicitly
[[maybe_unused]] CGameArea area(mreaTag.id);
}
void CGameArea::DebugDraw() {
if (!m_debugSphereRes) {

View File

@ -364,7 +364,6 @@ public:
CGameArea* GetNext() const { return x130_next; }
static void WarmupShaders(const SObjectTag& mreaTag);
void DebugDraw();
void DebugDrawLight(const CLight& light);
};