mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-08-20 09:57:10 +00:00
feat/tracy: basic tracy implementation
This commit is contained in:
parent
9c0dfd60d5
commit
4cdc29bbf4
|
|
@ -89,6 +89,12 @@ pip install meson ninja
|
||||||
|
|
||||||
Or follow the [Meson quickstart guide](https://mesonbuild.com/Quick-guide.html).
|
Or follow the [Meson quickstart guide](https://mesonbuild.com/Quick-guide.html).
|
||||||
|
|
||||||
|
### Tracy profiler
|
||||||
|
|
||||||
|
This project can be built with Tracy profiling support. Tracy is available as a meson subproject (bundled in `subprojects/tracy`) and many distributions provide the Tracy tooling; on Arch/Manjaro you can get the latest build from the AUR as `tracy-git`.
|
||||||
|
|
||||||
|
Tracy can be directly enabled if you enable the tracy meson option before compiling.
|
||||||
|
|
||||||
#### Docker (alternative)
|
#### Docker (alternative)
|
||||||
|
|
||||||
If you don't want to install dependencies, use the included devcontainer. Open the project in VS Code with the [Dev Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) extension, or build manually:
|
If you don't want to install dependencies, use the included devcontainer. Open the project in VS Code with the [Dev Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) extension, or build manually:
|
||||||
|
|
|
||||||
14
meson.build
14
meson.build
|
|
@ -79,6 +79,20 @@ stb_dep = declare_dependency(include_directories: stb)
|
||||||
|
|
||||||
miniaudio_dep = dependency('miniaudio')
|
miniaudio_dep = dependency('miniaudio')
|
||||||
|
|
||||||
|
tracy_opt = get_option('tracy')
|
||||||
|
|
||||||
|
if not tracy_opt.disabled()
|
||||||
|
tracy_proj = subproject('tracy', required: tracy_opt, default_options: ['tracy_enable=true'])
|
||||||
|
if tracy_proj.found()
|
||||||
|
tracy_client_dep = tracy_proj.get_variable('tracy_dep')
|
||||||
|
add_project_arguments('-DTRACY_ENABLE', language: ['cpp', 'c'])
|
||||||
|
else
|
||||||
|
tracy_client_dep = dependency('', required: false)
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
tracy_client_dep = dependency('', required: false)
|
||||||
|
endif
|
||||||
|
|
||||||
subdir('targets/util')
|
subdir('targets/util')
|
||||||
subdir('targets/java')
|
subdir('targets/java')
|
||||||
subdir('targets/nbt')
|
subdir('targets/nbt')
|
||||||
|
|
|
||||||
|
|
@ -40,3 +40,10 @@ option(
|
||||||
value: 'frustum',
|
value: 'frustum',
|
||||||
description: 'Occlusion culling mode. Off disables ALL CULLING (debug only!), Frustum disables offscreen rendering (default), BFS is experimental connectivity culling, hardware uses GPU queries.',
|
description: 'Occlusion culling mode. Off disables ALL CULLING (debug only!), Frustum disables offscreen rendering (default), BFS is experimental connectivity culling, hardware uses GPU queries.',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
option(
|
||||||
|
'tracy',
|
||||||
|
type: 'feature',
|
||||||
|
value: 'auto',
|
||||||
|
description: 'Enable Tracy profiler'
|
||||||
|
)
|
||||||
|
|
|
||||||
|
|
@ -92,6 +92,13 @@
|
||||||
#include "minecraft/server/PlayerList.h"
|
#include "minecraft/server/PlayerList.h"
|
||||||
#include "minecraft/server/level/ServerPlayer.h"
|
#include "minecraft/server/level/ServerPlayer.h"
|
||||||
|
|
||||||
|
#ifdef TRACY_ENABLE
|
||||||
|
#include <tracy/Tracy.hpp>
|
||||||
|
#else
|
||||||
|
#define ZoneScoped
|
||||||
|
#define ZoneScopedN(name)
|
||||||
|
#endif
|
||||||
|
|
||||||
class BeaconTileEntity;
|
class BeaconTileEntity;
|
||||||
class BrewingStandTileEntity;
|
class BrewingStandTileEntity;
|
||||||
class DispenserTileEntity;
|
class DispenserTileEntity;
|
||||||
|
|
@ -2202,6 +2209,7 @@ void Game::SetActionConfirmed(void* param) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Game::HandleXuiActions(void) {
|
void Game::HandleXuiActions(void) {
|
||||||
|
ZoneScoped;
|
||||||
eXuiAction eAction;
|
eXuiAction eAction;
|
||||||
eTMSAction eTMS;
|
eTMSAction eTMS;
|
||||||
void* param;
|
void* param;
|
||||||
|
|
@ -4394,6 +4402,7 @@ void Game::InitTime() {
|
||||||
// Desc: Updates the elapsed time since our last frame.
|
// Desc: Updates the elapsed time since our last frame.
|
||||||
//-------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------
|
||||||
void Game::UpdateTime() {
|
void Game::UpdateTime() {
|
||||||
|
ZoneScoped;
|
||||||
auto qwNewTime = time_util::clock::now();
|
auto qwNewTime = time_util::clock::now();
|
||||||
auto qwDeltaTime = qwNewTime - m_Time.qwTime;
|
auto qwDeltaTime = qwNewTime - m_Time.qwTime;
|
||||||
|
|
||||||
|
|
@ -5557,6 +5566,7 @@ void Game::unlockSaveNotification() {
|
||||||
}
|
}
|
||||||
|
|
||||||
int Game::RemoteSaveThreadProc(void* lpParameter) {
|
int Game::RemoteSaveThreadProc(void* lpParameter) {
|
||||||
|
ZoneScoped;
|
||||||
// The game should be stopped while we are doing this, but the connections
|
// The game should be stopped while we are doing this, but the connections
|
||||||
// ticks may try to create some AABB's or Vec3's
|
// ticks may try to create some AABB's or Vec3's
|
||||||
Compression::UseDefaultThreadStorage();
|
Compression::UseDefaultThreadStorage();
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,7 @@ client_dependencies = [
|
||||||
miniaudio_dep,
|
miniaudio_dep,
|
||||||
stb_dep,
|
stb_dep,
|
||||||
util_dep,
|
util_dep,
|
||||||
|
tracy_client_dep,
|
||||||
]
|
]
|
||||||
|
|
||||||
if get_option('ui_backend') == 'shiggy'
|
if get_option('ui_backend') == 'shiggy'
|
||||||
|
|
@ -71,7 +72,10 @@ platform_services_src = files('../platform/PlatformServices.cpp')
|
||||||
|
|
||||||
client = executable(
|
client = executable(
|
||||||
'Minecraft.Client',
|
'Minecraft.Client',
|
||||||
client_sources + platform_sources + platform_services_src + localisation[1],
|
client_sources
|
||||||
|
+ platform_sources
|
||||||
|
+ platform_services_src
|
||||||
|
+ localisation[1],
|
||||||
include_directories: include_directories('include', '..'),
|
include_directories: include_directories('include', '..'),
|
||||||
dependencies: client_dependencies,
|
dependencies: client_dependencies,
|
||||||
cpp_args: global_cpp_args
|
cpp_args: global_cpp_args
|
||||||
|
|
|
||||||
|
|
@ -131,6 +131,13 @@
|
||||||
#include "minecraft/world/level/chunk/SparseDataStorage.h"
|
#include "minecraft/world/level/chunk/SparseDataStorage.h"
|
||||||
#include "minecraft/world/level/chunk/SparseLightStorage.h"
|
#include "minecraft/world/level/chunk/SparseLightStorage.h"
|
||||||
|
|
||||||
|
#ifdef TRACY_ENABLE
|
||||||
|
#include <tracy/Tracy.hpp>
|
||||||
|
#else
|
||||||
|
#define ZoneScoped
|
||||||
|
#define ZoneScopedN(name)
|
||||||
|
#endif
|
||||||
|
|
||||||
class ChunkSource;
|
class ChunkSource;
|
||||||
|
|
||||||
// #define DISABLE_SPU_CODE
|
// #define DISABLE_SPU_CODE
|
||||||
|
|
@ -1019,6 +1026,7 @@ void Minecraft::createPrimaryLocalPlayer(int iPad) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Minecraft::run_middle() {
|
void Minecraft::run_middle() {
|
||||||
|
ZoneScoped;
|
||||||
static int64_t lastTime = 0;
|
static int64_t lastTime = 0;
|
||||||
static bool bFirstTimeIntoGame = true;
|
static bool bFirstTimeIntoGame = true;
|
||||||
static bool bAutosaveTimerSet = false;
|
static bool bAutosaveTimerSet = false;
|
||||||
|
|
@ -1166,6 +1174,7 @@ void Minecraft::run_middle() {
|
||||||
// 4J-PB - Once we're in the level, check if the players have
|
// 4J-PB - Once we're in the level, check if the players have
|
||||||
// the level in their banned list and ask if they want to play
|
// the level in their banned list and ask if they want to play
|
||||||
// it
|
// it
|
||||||
|
ZoneScopedN("Render Viewports");
|
||||||
for (int i = 0; i < XUSER_MAX_COUNT; i++) {
|
for (int i = 0; i < XUSER_MAX_COUNT; i++) {
|
||||||
if (localplayers[i] && (app.GetBanListCheck(i) == false) &&
|
if (localplayers[i] && (app.GetBanListCheck(i) == false) &&
|
||||||
!Minecraft::GetInstance()->isTutorial() &&
|
!Minecraft::GetInstance()->isTutorial() &&
|
||||||
|
|
@ -1813,6 +1822,7 @@ void Minecraft::run_middle() {
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
} // lock_guard scope
|
} // lock_guard scope
|
||||||
|
FrameMark;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Minecraft::run_end() { destroy(); }
|
void Minecraft::run_end() { destroy(); }
|
||||||
|
|
@ -1990,6 +2000,7 @@ void Minecraft::verify() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Minecraft::levelTickUpdateFunc(void* pParam) {
|
void Minecraft::levelTickUpdateFunc(void* pParam) {
|
||||||
|
ZoneScoped;
|
||||||
Level* pLevel = (Level*)pParam;
|
Level* pLevel = (Level*)pParam;
|
||||||
pLevel->tick();
|
pLevel->tick();
|
||||||
}
|
}
|
||||||
|
|
@ -2003,6 +2014,7 @@ void Minecraft::levelTickThreadInitFunc() {
|
||||||
// textures are to be updated - this will be true for the last time this tick
|
// textures are to be updated - this will be true for the last time this tick
|
||||||
// runs with bFirst true
|
// runs with bFirst true
|
||||||
void Minecraft::tick(bool bFirst, bool bUpdateTextures) {
|
void Minecraft::tick(bool bFirst, bool bUpdateTextures) {
|
||||||
|
ZoneScoped;
|
||||||
int iPad = player->GetXboxPad();
|
int iPad = player->GetXboxPad();
|
||||||
// OutputDebugString("Minecraft::tick\n");
|
// OutputDebugString("Minecraft::tick\n");
|
||||||
|
|
||||||
|
|
@ -4517,6 +4529,7 @@ int Minecraft::InGame_SignInReturned(void* pParam, bool bContinue, int iPad) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Minecraft::tickAllConnections() {
|
void Minecraft::tickAllConnections() {
|
||||||
|
ZoneScoped;
|
||||||
int oldIdx = getLocalPlayerIdx();
|
int oldIdx = getLocalPlayerIdx();
|
||||||
for (unsigned int i = 0; i < XUSER_MAX_COUNT; i++) {
|
for (unsigned int i = 0; i < XUSER_MAX_COUNT; i++) {
|
||||||
std::shared_ptr<MultiplayerLocalPlayer> mplp = localplayers[i];
|
std::shared_ptr<MultiplayerLocalPlayer> mplp = localplayers[i];
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,7 @@ lib_minecraft = static_library('minecraft',
|
||||||
assets_localisation_dep,
|
assets_localisation_dep,
|
||||||
platform_dep,
|
platform_dep,
|
||||||
util_dep,
|
util_dep,
|
||||||
|
tracy_client_dep,
|
||||||
dependency('zlib'),
|
dependency('zlib'),
|
||||||
],
|
],
|
||||||
include_directories : include_directories('..'),
|
include_directories : include_directories('..'),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue