Skip to content

Commit

Permalink
Add more tracy traces
Browse files Browse the repository at this point in the history
  • Loading branch information
Laguna1989 committed Nov 6, 2024
1 parent fd2f622 commit e6b8438
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 3 deletions.
5 changes: 3 additions & 2 deletions impl/jamtemplate/common/audio/audio/audio_impl.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#include "audio_impl.hpp"
#include <audio/sound/sound.hpp>
#include <random/random.hpp>
#include "fmod_errors.h"
#include <tracy/Tracy.hpp>
#include <fmod_errors.h>
#include <sstream>

namespace {
Expand All @@ -28,6 +29,7 @@ void jt::checkResult(FMOD_RESULT result)

jt::AudioImpl::AudioImpl()
{
ZoneScopedN("jt::AudioImpl::AudioImpl");
checkResult(FMOD::Studio::System::create(&m_studioSystem));
checkResult(m_studioSystem->initialize(128, getStudioInitFlags(), FMOD_INIT_NORMAL, nullptr));

Expand Down Expand Up @@ -102,7 +104,6 @@ void jt::AudioImpl::setGroupVolume(std::string const& groupPath, float newVolume

float jt::AudioImpl::getGroupVolume(std::string const& groupPath)
{

FMOD::Studio::Bus* bus { nullptr };
checkResult(m_studioSystem->getBus(groupPath.c_str(), &bus));
if (bus == nullptr) {
Expand Down
3 changes: 2 additions & 1 deletion impl/jamtemplate/common/game_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ void jt::GameBase::doUpdate(float const elapsed)
ZoneScopedN("jt::GameBase::doUpdate");
m_logger.verbose("update game", { "jt" });
m_stateManager.update(getPtr(), elapsed);

TracyPlot("GameObjects Alive", static_cast<std::int64_t>(getNumberOfAliveGameObjects()));
TracyPlot("GameObjects Created", static_cast<std::int64_t>(getNumberOfCreatedGameObjects()));
m_audio.update(elapsed);
gfx().update(elapsed);

Expand Down
2 changes: 2 additions & 0 deletions impl/jamtemplate/common/pathfinder/pathfinder.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "pathfinder.hpp"
#include <math_helper.hpp>
#include <tracy/Tracy.hpp>
#include <iostream>
#include <limits>
#include <stdexcept>
Expand Down Expand Up @@ -133,6 +134,7 @@ NodeT findNeighbourWithSmallestValue(NodeT const& current)

std::vector<NodeT> jt::pathfinder::calculatePath(NodeT const& start, NodeT const& end)
{
ZoneScopedN("jt::pathfinder::calculatePath");
if (start == end) {
return std::vector<NodeT> {};
}
Expand Down
2 changes: 2 additions & 0 deletions impl/jamtemplate/common/tilemap/tilemap_cache.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#include "tilemap_cache.hpp"
#include <tracy/Tracy.hpp>
#include <iostream>

std::shared_ptr<tson::Map> jt::TilemapCache::get(std::string const& fileName) const
{
ZoneScopedN("jt::TilemapCache::get");
if (!m_maps.contains(fileName)) {
tson::Tileson parser;

Expand Down
3 changes: 3 additions & 0 deletions impl/jamtemplate/sdl/texture_manager_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <sprite_functions.hpp>
#include <strutils.hpp>
#include <SDL_image.h>
#include <tracy/Tracy.hpp>
#include <array>
#include <iostream>
#include <limits>
Expand Down Expand Up @@ -239,6 +240,7 @@ TextureManagerImpl::TextureManagerImpl(std::shared_ptr<jt::RenderTargetLayer> re

std::shared_ptr<SDL_Texture> TextureManagerImpl::get(std::string const& str)
{
ZoneScopedNC("jt::TextureManagerImpl::get", tracy::Color::Crimson);
if (str.empty()) {
std::cout << "TextureManager get: string must not be empty" << std::endl;
throw std::invalid_argument { "TextureManager get: string must not be empty" };
Expand All @@ -251,6 +253,7 @@ std::shared_ptr<SDL_Texture> TextureManagerImpl::get(std::string const& str)

// check if texture is already stored in texture manager
if (containsTexture(str)) {
ZoneColor(tracy::Color::AntiqueWhite2);
return m_textures[str];
}

Expand Down
3 changes: 3 additions & 0 deletions impl/jamtemplate/sfml/texture_manager_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <color_lib.hpp>
#include <sprite_functions.hpp>
#include <strutils.hpp>
#include <tracy/Tracy.hpp>
#include <array>
#include <stdexcept>

Expand Down Expand Up @@ -150,12 +151,14 @@ jt::TextureManagerImpl::TextureManagerImpl(std::shared_ptr<jt::RenderTargetLayer

sf::Texture& jt::TextureManagerImpl::get(std::string const& str)
{
ZoneScopedNC("jt::TextureManagerImpl::get", tracy::Color::Crimson);
if (str.empty()) {
throw std::invalid_argument { "TextureManager get: string must not be empty" };
}

// check if texture is already stored in texture manager
if (containsTexture(str)) {
ZoneColor(tracy::Color::AntiqueWhite2);
return m_textures[str];
}

Expand Down

0 comments on commit e6b8438

Please sign in to comment.