add flag to toggle tracy (disabled for now)
This commit is contained in:
@ -4,6 +4,7 @@
|
||||
#include <raylib.h>
|
||||
|
||||
// #define WEB // Disables multithreading
|
||||
// #define TRACY // Enable tracy profiling support
|
||||
|
||||
// Window
|
||||
constexpr int INITIAL_WIDTH = 800;
|
||||
|
||||
@ -9,7 +9,6 @@
|
||||
#include <raylib.h>
|
||||
#include <raymath.h>
|
||||
#include <thread>
|
||||
#include <tracy/Tracy.hpp>
|
||||
#include <variant>
|
||||
#include <vector>
|
||||
|
||||
@ -20,6 +19,10 @@
|
||||
#include <BS_thread_pool.hpp>
|
||||
#endif
|
||||
|
||||
#ifdef TRACY
|
||||
#include <tracy/Tracy.hpp>
|
||||
#endif
|
||||
|
||||
class Mass {
|
||||
public:
|
||||
Vector3 position;
|
||||
@ -116,10 +119,18 @@ class ThreadedPhysics {
|
||||
using Command = std::variant<AddMass, AddSpring, ClearGraph>;
|
||||
|
||||
struct PhysicsState {
|
||||
#ifdef TRACY
|
||||
TracyLockable(std::mutex, command_mtx);
|
||||
#else
|
||||
std::mutex command_mtx;
|
||||
#endif
|
||||
std::queue<Command> pending_commands;
|
||||
|
||||
#ifdef TRACY
|
||||
TracyLockable(std::mutex, data_mtx);
|
||||
#else
|
||||
std::mutex data_mtx;
|
||||
#endif
|
||||
std::condition_variable_any data_ready_cnd;
|
||||
std::condition_variable_any data_consumed_cnd;
|
||||
unsigned int ups = 0;
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
#ifndef __TRACY_HPP_
|
||||
#define __TRACY_HPP_
|
||||
|
||||
#ifdef TRACY
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
void *operator new(std::size_t count);
|
||||
@ -8,3 +10,5 @@ void operator delete(void *ptr) noexcept;
|
||||
void operator delete(void *ptr, std::size_t count) noexcept;
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user