2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-08 15:04:56 +00:00

Using optick, linked from boo

This commit is contained in:
Henrique Gemignani Passos Lima
2021-04-03 19:48:39 +03:00
committed by Luke Street
parent e3896bdee9
commit d6f19d26e7
25 changed files with 65 additions and 13 deletions

View File

@@ -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_

View File

@@ -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;
}

View File

@@ -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

View File

@@ -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;

View File

@@ -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;

View File

@@ -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);
}

View File

@@ -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)