mirror of https://github.com/AxioDL/metaforce.git
Using optick, linked from boo
This commit is contained in:
parent
e3896bdee9
commit
d6f19d26e7
|
@ -73,6 +73,7 @@ bool ProjectManager::newProject(hecl::SystemStringView path) {
|
|||
}
|
||||
|
||||
bool ProjectManager::openProject(hecl::SystemStringView path) {
|
||||
OPTICK_EVENT();
|
||||
hecl::SystemString subPath;
|
||||
hecl::ProjectRootPath projPath = hecl::SearchForProject(path, subPath);
|
||||
if (!projPath) {
|
||||
|
@ -166,6 +167,7 @@ bool ProjectManager::saveProject() {
|
|||
}
|
||||
|
||||
void ProjectManager::mainUpdate() {
|
||||
OPTICK_EVENT();
|
||||
if (m_precooking) {
|
||||
if (!m_factoryMP1.IsBusy())
|
||||
m_precooking = false;
|
||||
|
|
|
@ -172,6 +172,7 @@ public:
|
|||
}
|
||||
|
||||
void think() override {
|
||||
OPTICK_EVENT();
|
||||
if (m_spaceTree)
|
||||
m_spaceTree->think();
|
||||
}
|
||||
|
|
|
@ -50,6 +50,7 @@ void SplashScreen::think() {
|
|||
m_fileBrowser.m_view.reset();
|
||||
return;
|
||||
}
|
||||
OPTICK_EVENT();
|
||||
|
||||
ModalWindow::think();
|
||||
if (m_fileBrowser.m_view)
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "hecl/Pipeline.hpp"
|
||||
#include "version.h"
|
||||
#include <cstdio>
|
||||
#include "optick.h"
|
||||
|
||||
using YAMLNode = athena::io::YAMLNode;
|
||||
|
||||
|
@ -54,6 +55,7 @@ void ViewManager::TestGameView::draw(boo::IGraphicsCommandQueue* gfxQ) {
|
|||
}
|
||||
|
||||
void ViewManager::TestGameView::think() {
|
||||
OPTICK_EVENT();
|
||||
if (!m_debugText) {
|
||||
m_debugText.reset(new specter::MultiLineTextView(m_vm.m_viewResources, *this, m_vm.m_viewResources.m_monoFont18));
|
||||
boo::SWindowRect sub = subRect();
|
||||
|
@ -356,6 +358,7 @@ bool ViewManager::proc() {
|
|||
return false;
|
||||
|
||||
if (m_updatePf) {
|
||||
OPTICK_EVENT("m_updatePf");
|
||||
m_viewResources.resetPixelFactor(m_reqPf);
|
||||
specter::RootView* root = SetupRootView();
|
||||
if (m_rootSpace)
|
||||
|
@ -368,8 +371,14 @@ bool ViewManager::proc() {
|
|||
m_updatePf = false;
|
||||
}
|
||||
|
||||
m_rootView->dispatchEvents();
|
||||
m_rootView->internalThink();
|
||||
{
|
||||
OPTICK_EVENT("m_rootView->DispatchEvents");
|
||||
m_rootView->dispatchEvents();
|
||||
}
|
||||
{
|
||||
OPTICK_EVENT("m_rootView->internalThink");
|
||||
m_rootView->internalThink();
|
||||
}
|
||||
if (m_rootSpace)
|
||||
m_rootSpace->think();
|
||||
if (m_splash)
|
||||
|
@ -391,19 +400,24 @@ bool ViewManager::proc() {
|
|||
if (m_testGameView)
|
||||
m_testGameView->think();
|
||||
|
||||
if (g_Renderer)
|
||||
g_Renderer->BeginScene();
|
||||
m_rootView->draw(gfxQ);
|
||||
if (g_Renderer)
|
||||
g_Renderer->EndScene();
|
||||
gfxQ->execute();
|
||||
{
|
||||
OPTICK_EVENT("Draw");
|
||||
if (g_Renderer)
|
||||
g_Renderer->BeginScene();
|
||||
m_rootView->draw(gfxQ);
|
||||
if (g_Renderer)
|
||||
g_Renderer->EndScene();
|
||||
gfxQ->execute();
|
||||
}
|
||||
if (g_ResFactory)
|
||||
g_ResFactory->AsyncIdle();
|
||||
#ifndef URDE_MSAN
|
||||
m_voiceEngine->pumpAndMixVoices();
|
||||
#endif
|
||||
if (!m_skipWait || !hecl::com_developer->toBoolean())
|
||||
if (!m_skipWait || !hecl::com_developer->toBoolean()) {
|
||||
OPTICK_EVENT("waitForRetrace");
|
||||
m_mainWindow->waitForRetrace();
|
||||
}
|
||||
CBooModel::ClearModelUniformCounters();
|
||||
CGraphics::TickRenderTimings();
|
||||
++logvisor::FrameIndex;
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "hecl/Console.hpp"
|
||||
#include "fmt/chrono.h"
|
||||
#include "version.h"
|
||||
#include "optick.h"
|
||||
|
||||
static logvisor::Module AthenaLog("Athena");
|
||||
static void AthenaExc(athena::error::Level level, const char* file, const char*, int line, fmt::string_view fmt,
|
||||
|
@ -71,6 +72,7 @@ struct Application : boo::IApplicationCallback {
|
|||
initialize(app);
|
||||
m_viewManager->init(app);
|
||||
while (m_running.load()) {
|
||||
OPTICK_FRAME("MainThread");
|
||||
if (!m_viewManager->proc())
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -78,6 +78,7 @@ CMapArea::CMapArea(CInputStream& in, u32 size)
|
|||
}
|
||||
|
||||
void CMapArea::PostConstruct() {
|
||||
OPTICK_EVENT();
|
||||
x38_moStart = x44_buf.get();
|
||||
x3c_vertexStart = x38_moStart + (x28_mappableObjCount * 0x50);
|
||||
x40_surfaceStart = x3c_vertexStart + (x2c_vertexCount * 12);
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include <array>
|
||||
#include <cctype>
|
||||
#include <iterator>
|
||||
#include "optick.h"
|
||||
|
||||
#include "Runtime/CStopwatch.hpp"
|
||||
#include "Runtime/IObj.hpp"
|
||||
|
@ -35,6 +36,7 @@ bool CFactoryMgr::CanMakeMemory(const urde::SObjectTag& tag) const {
|
|||
CFactoryFnReturn CFactoryMgr::MakeObjectFromMemory(const SObjectTag& tag, std::unique_ptr<u8[]>&& buf, int size,
|
||||
bool compressed, const CVParamTransfer& paramXfer,
|
||||
CObjectReference* selfRef) {
|
||||
OPTICK_EVENT();
|
||||
std::unique_ptr<u8[]> localBuf = std::move(buf);
|
||||
|
||||
const auto memFactoryIter = m_memFactories.find(tag.type);
|
||||
|
|
|
@ -133,7 +133,7 @@ endfunction()
|
|||
|
||||
set(RUNTIME_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
|
||||
set(RUNTIME_LIBRARIES ${HECL_APPLICATION_REPS_TARGETS_LIST} RetroDataSpec AssetNameMapNull NESEmulator
|
||||
libjpeg-turbo jbus kabufuda discord-rpc logvisor)
|
||||
libjpeg-turbo jbus kabufuda discord-rpc logvisor OptickCore)
|
||||
|
||||
if(MSVC)
|
||||
# WTF MS???? LINK.EXE is unable to address static libraries larger than 4GB.
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include "Runtime/CSimplePool.hpp"
|
||||
#include "Runtime/CStopwatch.hpp"
|
||||
#include "optick.h"
|
||||
|
||||
namespace urde {
|
||||
static logvisor::Module Log("CResFactory");
|
||||
|
@ -33,6 +34,7 @@ CFactoryFnReturn CResFactory::BuildSync(const SObjectTag& tag, const CVParamTran
|
|||
}
|
||||
|
||||
bool CResFactory::PumpResource(SLoadingData& data) {
|
||||
OPTICK_EVENT();
|
||||
if (data.x8_dvdReq && data.x8_dvdReq->IsComplete()) {
|
||||
data.x8_dvdReq.reset();
|
||||
*data.xc_targetPtr =
|
||||
|
@ -74,6 +76,7 @@ void CResFactory::BuildAsync(const SObjectTag& tag, const CVParamTransfer& xfer,
|
|||
}
|
||||
|
||||
void CResFactory::AsyncIdle() {
|
||||
OPTICK_EVENT();
|
||||
if (m_loadList.empty())
|
||||
return;
|
||||
auto startTime = std::chrono::steady_clock::now();
|
||||
|
|
|
@ -780,6 +780,7 @@ void CStateManager::DrawWorld() {
|
|||
g_Renderer->SetThermalColdScale(xf28_thermColdScale2 + xf24_thermColdScale1);
|
||||
|
||||
for (int i = areaCount - 1; i >= 0; --i) {
|
||||
OPTICK_EVENT("CStateManager::DrawWorld DrawArea");
|
||||
const CGameArea& area = *areaArr[i];
|
||||
SetupFogForArea(area);
|
||||
g_Renderer->EnablePVS(pvsArr[i], area.x4_selfIdx);
|
||||
|
@ -1472,6 +1473,7 @@ void CStateManager::LoadScriptObjects(TAreaId aid, CInputStream& in, std::vector
|
|||
|
||||
std::pair<TEditorId, TUniqueId> CStateManager::LoadScriptObject(TAreaId aid, EScriptObjectType type, u32 length,
|
||||
CInputStream& in) {
|
||||
OPTICK_EVENT();
|
||||
const TEditorId id = in.readUint32Big();
|
||||
const u32 connCount = in.readUint32Big();
|
||||
length -= 8;
|
||||
|
|
|
@ -553,6 +553,7 @@ void CAnimData::Render(CSkinnedModel& model, const CModelFlags& drawFlags,
|
|||
|
||||
void CAnimData::SetupRender(CSkinnedModel& model, const CModelFlags& drawFlags,
|
||||
const std::optional<CVertexMorphEffect>& morphEffect, const float* morphMagnitudes) {
|
||||
OPTICK_EVENT();
|
||||
if (!x220_30_poseBuilt) {
|
||||
x2fc_poseBuilder.BuildNoScale(x224_pose);
|
||||
x220_30_poseBuilt = true;
|
||||
|
@ -560,7 +561,9 @@ void CAnimData::SetupRender(CSkinnedModel& model, const CModelFlags& drawFlags,
|
|||
PoseSkinnedModel(model, x224_pose, drawFlags, morphEffect, morphMagnitudes);
|
||||
}
|
||||
|
||||
void CAnimData::DrawSkinnedModel(CSkinnedModel& model, const CModelFlags& flags) { model.Draw(flags); }
|
||||
void CAnimData::DrawSkinnedModel(CSkinnedModel& model, const CModelFlags& flags) {
|
||||
model.Draw(flags);
|
||||
}
|
||||
|
||||
void CAnimData::PreRender() {
|
||||
if (!x220_31_poseCached) {
|
||||
|
|
|
@ -25,6 +25,7 @@ CSkinRules::CSkinRules(CInputStream& in) {
|
|||
|
||||
void CSkinRules::TransformVerticesCPU(std::vector<std::pair<zeus::CVector3f, zeus::CVector3f>>& vnOut,
|
||||
const CPoseAsTransforms& pose, const CModel& model) const {
|
||||
OPTICK_EVENT();
|
||||
vnOut.resize(m_poolToSkinIdx.size());
|
||||
for (size_t i = 0; i < m_poolToSkinIdx.size(); ++i) {
|
||||
const CVirtualBone& vb = m_virtualBones[m_poolToSkinIdx[i]];
|
||||
|
|
|
@ -223,6 +223,7 @@ CBooRenderer::CAreaListItem::CAreaListItem(const std::vector<CMetroidModelInstan
|
|||
CBooRenderer::CAreaListItem::~CAreaListItem() = default;
|
||||
|
||||
void CBooRenderer::ActivateLightsForModel(CAreaListItem* item, CBooModel& model) {
|
||||
OPTICK_EVENT();
|
||||
constexpr size_t lightCount = 4;
|
||||
std::vector<CLight> thisLights;
|
||||
thisLights.reserve(lightCount);
|
||||
|
@ -767,6 +768,7 @@ void CBooRenderer::DisablePVS() { xc8_pvs = std::nullopt; }
|
|||
|
||||
void CBooRenderer::UpdateAreaUniforms(int areaIdx, EWorldShadowMode shadowMode, bool activateLights, int cubeFace,
|
||||
const CModelFlags* ballShadowFlags) {
|
||||
OPTICK_EVENT();
|
||||
SetupRendererStates();
|
||||
|
||||
CModelFlags flags;
|
||||
|
@ -1067,6 +1069,7 @@ void CBooRenderer::SetViewport(int left, int bottom, int width, int height) {
|
|||
void CBooRenderer::SetDebugOption(EDebugOption, int) {}
|
||||
|
||||
void CBooRenderer::BeginScene() {
|
||||
OPTICK_EVENT();
|
||||
CGraphics::SetViewport(0, 0, g_Viewport.x8_width, g_Viewport.xc_height);
|
||||
CGraphics::SetPerspective(75.f, CGraphics::g_ProjAspect, 1.f, 4096.f);
|
||||
CGraphics::SetModelMatrix(zeus::CTransform());
|
||||
|
@ -1088,6 +1091,7 @@ void CBooRenderer::BeginScene() {
|
|||
}
|
||||
|
||||
void CBooRenderer::EndScene() {
|
||||
OPTICK_EVENT();
|
||||
CGraphics::EndScene();
|
||||
if (x2dc_reflectionAge >= 2) {
|
||||
// Delete reflection tex x14c_
|
||||
|
|
|
@ -445,6 +445,7 @@ float CGraphics::GetSecondsMod900() {
|
|||
}
|
||||
|
||||
void CGraphics::TickRenderTimings() {
|
||||
OPTICK_EVENT();
|
||||
g_RenderTimings = (g_RenderTimings + 1) % u32(900 * 60);
|
||||
g_DefaultSeconds = g_RenderTimings / 60.f;
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include <array>
|
||||
#include <vector>
|
||||
#include <chrono>
|
||||
#include "optick.h"
|
||||
|
||||
#include "Runtime/RetroTypes.hpp"
|
||||
|
||||
|
@ -438,7 +439,7 @@ public:
|
|||
};
|
||||
#define SCOPED_GRAPHICS_DEBUG_GROUP(...) GraphicsDebugGroup _GfxDbg_(__VA_ARGS__);
|
||||
#else
|
||||
#define SCOPED_GRAPHICS_DEBUG_GROUP(...)
|
||||
#define SCOPED_GRAPHICS_DEBUG_GROUP(name, ...) OPTICK_EVENT_DYNAMIC(name)
|
||||
#endif
|
||||
|
||||
} // namespace urde
|
||||
|
|
|
@ -23,6 +23,7 @@ hecl::UniformBufferPool<CLineRenderer::SDrawUniform> CLineRenderer::s_uniformPoo
|
|||
CLineRenderer::CLineRenderer(boo::IGraphicsDataFactory::Context& ctx, EPrimitiveMode mode, u32 maxVerts,
|
||||
const boo::ObjToken<boo::ITexture>& texture, bool additive, bool zTest, bool zGEqual)
|
||||
: m_mode(mode), m_maxVerts(maxVerts) {
|
||||
OPTICK_EVENT();
|
||||
if (maxVerts < 2) {
|
||||
LineRendererLog.report(logvisor::Fatal, FMT_STRING(_SYS_STR("maxVerts < 2, maxVerts = {}")), maxVerts);
|
||||
return;
|
||||
|
@ -54,6 +55,7 @@ CLineRenderer::CLineRenderer(boo::IGraphicsDataFactory::Context& ctx, EPrimitive
|
|||
CLineRenderer::CLineRenderer(EPrimitiveMode mode, u32 maxVerts, const boo::ObjToken<boo::ITexture>& texture,
|
||||
bool additive, bool zTest, bool zGEqual)
|
||||
: m_mode(mode), m_maxVerts(maxVerts) {
|
||||
OPTICK_EVENT();
|
||||
if (maxVerts < 2) {
|
||||
LineRendererLog.report(logvisor::Fatal, FMT_STRING(_SYS_STR("maxVerts < 2, maxVerts = {}")), maxVerts);
|
||||
return;
|
||||
|
|
|
@ -51,6 +51,7 @@ void CBooModel::Shutdown() {
|
|||
}
|
||||
|
||||
void CBooModel::ClearModelUniformCounters() {
|
||||
OPTICK_EVENT();
|
||||
for (CBooModel* model = g_FirstModel; model; model = model->m_next)
|
||||
model->ClearUniformCounter();
|
||||
}
|
||||
|
@ -244,6 +245,7 @@ GeometryUniformLayout::GeometryUniformLayout(const CModel* model, const Material
|
|||
}
|
||||
|
||||
CBooModel::ModelInstance* CBooModel::PushNewModelInstance(int sharedLayoutBuf, boo::IGraphicsDataFactory::Context* ctx) {
|
||||
OPTICK_EVENT();
|
||||
if (!x40_24_texturesLoaded && !g_DummyTextures) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -981,6 +983,7 @@ boo::ObjToken<boo::IGraphicsBufferD> GeometryUniformLayout::GetSharedBuffer(int
|
|||
boo::ObjToken<boo::IGraphicsBufferD> CBooModel::UpdateUniformData(const CModelFlags& flags, const CSkinRules* cskr,
|
||||
const CPoseAsTransforms* pose, int sharedLayoutBuf,
|
||||
boo::IGraphicsDataFactory::Context* ctx) {
|
||||
OPTICK_EVENT();
|
||||
if (!g_DummyTextures && !TryLockTextures())
|
||||
return {};
|
||||
|
||||
|
@ -1154,6 +1157,7 @@ std::unique_ptr<CBooModel> CModel::MakeNewInstance(int shaderIdx, int subInsts,
|
|||
}
|
||||
|
||||
CModelShaders::ShaderPipelines SShader::BuildShader(const hecl::HMDLMeta& meta, const MaterialSet::Material& mat) {
|
||||
OPTICK_EVENT();
|
||||
hecl::Backend::ReflectionType reflectionType;
|
||||
if (mat.flags.samusReflectionIndirectTexture())
|
||||
reflectionType = hecl::Backend::ReflectionType::Indirect;
|
||||
|
|
|
@ -53,6 +53,7 @@ void CSkinnedModel::Calculate(const CPoseAsTransforms& pose, const CModelFlags&
|
|||
}
|
||||
|
||||
void CSkinnedModel::Draw(const CModelFlags& drawFlags) const {
|
||||
OPTICK_EVENT();
|
||||
if (m_modelInst->TryLockTextures())
|
||||
m_modelInst->DrawSurfaces(drawFlags);
|
||||
}
|
||||
|
|
|
@ -90,6 +90,7 @@ u16 CFluidPlaneShader::Cache::MakeCacheKey(const SFluidPlaneDoorShaderInfo& info
|
|||
template <>
|
||||
CFluidPlaneShader::ShaderPair
|
||||
CFluidPlaneShader::Cache::GetOrBuildShader<SFluidPlaneShaderInfo>(const SFluidPlaneShaderInfo& info) {
|
||||
OPTICK_EVENT();
|
||||
u16 key = MakeCacheKey(info);
|
||||
auto& slot = CacheSlot(info, key);
|
||||
if (slot.m_regular)
|
||||
|
@ -104,6 +105,7 @@ CFluidPlaneShader::Cache::GetOrBuildShader<SFluidPlaneShaderInfo>(const SFluidPl
|
|||
template <>
|
||||
CFluidPlaneShader::ShaderPair
|
||||
CFluidPlaneShader::Cache::GetOrBuildShader<SFluidPlaneDoorShaderInfo>(const SFluidPlaneDoorShaderInfo& info) {
|
||||
OPTICK_EVENT();
|
||||
u16 key = MakeCacheKey(info);
|
||||
auto& slot = CacheSlot(info, key);
|
||||
if (slot.m_regular)
|
||||
|
|
|
@ -93,6 +93,7 @@ void CDecalManager::Update(float dt, CStateManager& mgr) {
|
|||
|
||||
void CDecalManager::AddDecal(const TToken<CDecalDescription>& decal, const zeus::CTransform& xf, bool notIce,
|
||||
CStateManager& mgr) {
|
||||
OPTICK_EVENT();
|
||||
if (m_LastDecalCreatedIndex != -1 && m_DeltaTimeSinceLastDecalCreation < 0.75f &&
|
||||
m_LastDecalCreatedAssetId == decal.GetObjectTag()->id) {
|
||||
SDecal& existingDecal = m_DecalPool[m_LastDecalCreatedIndex];
|
||||
|
|
|
@ -586,6 +586,7 @@ void CElementGen::UpdatePSTranslationAndOrientation() {
|
|||
}
|
||||
|
||||
std::unique_ptr<CParticleGen> CElementGen::ConstructChildParticleSystem(const TToken<CGenDescription>& desc) const {
|
||||
OPTICK_EVENT();
|
||||
auto ret = std::make_unique<CElementGen>(desc, EModelOrientationType::Normal,
|
||||
x26d_27_enableOPTS ? EOptionalSystemFlags::Two : EOptionalSystemFlags::One);
|
||||
ret->x26d_26_modelsUseLights = x26d_26_modelsUseLights;
|
||||
|
|
|
@ -176,6 +176,7 @@ constexpr std::array<s32, 2> CGunWeapon::skShootAnim{4, 3};
|
|||
|
||||
void CGunWeapon::Fire(bool underwater, float dt, EChargeState chargeState, const zeus::CTransform& xf,
|
||||
CStateManager& mgr, TUniqueId homingTarget, float chargeFactor1, float chargeFactor2) {
|
||||
OPTICK_EVENT();
|
||||
CDamageInfo dInfo = GetDamageInfo(mgr, chargeState, chargeFactor1);
|
||||
zeus::CVector3f scale(chargeState == EChargeState::Normal ? 1.f : chargeFactor2);
|
||||
bool partialCharge = chargeState == EChargeState::Normal ? false : !zeus::close_enough(chargeFactor1, 1.f);
|
||||
|
|
|
@ -312,6 +312,7 @@ void CFluidPlane::RenderStripWithRipples(float curY, const Heights& heights, con
|
|||
void CFluidPlane::RenderPatch(const CFluidPlaneRender::SPatchInfo& info, const Heights& heights, const Flags& flags,
|
||||
bool noRipples, bool flagIs1, std::vector<CFluidPlaneShader::Vertex>& vOut,
|
||||
std::vector<CFluidPlaneShader::PatchVertex>& pvOut) {
|
||||
OPTICK_EVENT();
|
||||
if (noRipples) {
|
||||
m_shader->bindRegular();
|
||||
|
||||
|
|
|
@ -129,6 +129,7 @@ CFluidPlaneShader::RenderSetupInfo CFluidPlaneCPU::RenderSetup(const CStateManag
|
|||
const zeus::CTransform& xf,
|
||||
const zeus::CTransform& areaXf, const zeus::CAABox& aabb,
|
||||
const CScriptWater* water) {
|
||||
OPTICK_EVENT();
|
||||
CFluidPlaneShader::RenderSetupInfo out;
|
||||
|
||||
const float uvT = mgr.GetFluidPlaneManager()->GetUVT();
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 6335cb09fe5046984e8baa9b5a65de837037e70c
|
||||
Subproject commit cd25ff4abfeb8c32256447f97a1a829bdbaf262c
|
Loading…
Reference in New Issue