switch to yolo logger
This commit is contained in:
@@ -40,6 +40,6 @@ compile with `make -j[threads]`
|
||||
|
||||
- OpenGL, utilised with GLAD and GLFW
|
||||
- ImGui for lovely GUI
|
||||
- SPDLog for lovely logging
|
||||
- YOLO for lovely logging
|
||||
|
||||
## Acknowledgements
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
#include <condition_variable>
|
||||
#include <chrono>
|
||||
#include <numeric>
|
||||
|
||||
@@ -37,7 +38,7 @@ public:
|
||||
|
||||
mState = EModuleState::Build;
|
||||
mVert = (float*)vert; mNorm = (float*)norm; mVc = vc; mIndices = (uint32_t*)indices; mIc = ic;
|
||||
spdlog::info("[hartcpu] Recieved {} verticies ({}) and {} indicies ({})", vc / 3, vert, ic / 3, indices);
|
||||
yolo::info("[hartcpu] Recieved {} verticies ({}) and {} indicies ({})", vc / 3, vert, ic / 3, indices);
|
||||
|
||||
std::vector<uint32_t> indicesToProcess(ic / 3);
|
||||
for (uint32_t i = 0; i < ic / 3; ++i)
|
||||
@@ -47,7 +48,7 @@ public:
|
||||
|
||||
mKdTree = new KDTree(mVert, mIndices, indicesToProcess, 0, indicesToProcess.size() - 1, 10);
|
||||
mKdTree->printTree(mKdTree->getRoot(), 1);
|
||||
spdlog::info("[hartcpu] Accelerator ready..");
|
||||
yolo::info("[hartcpu] Accelerator ready..");
|
||||
|
||||
mState = EModuleState::Idle;
|
||||
}
|
||||
@@ -61,7 +62,7 @@ public:
|
||||
mState = EModuleState::Trace;
|
||||
_mSignalCv.notify_all();
|
||||
|
||||
spdlog::info("[hartcpu] Signal master to start");
|
||||
yolo::info("[hartcpu] Signal master to start");
|
||||
|
||||
{
|
||||
std::unique_lock<std::mutex> doneLock(_mDoneMut);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <spdlog/spdlog.h>
|
||||
#include <yolo/yolo.hpp>
|
||||
|
||||
#include <string>
|
||||
#include <mutex>
|
||||
@@ -93,7 +93,7 @@ public:
|
||||
std::lock_guard<std::mutex> lock(_mData);
|
||||
for (const auto& e: queue)
|
||||
mToTrace.push(e);
|
||||
spdlog::info("[hartmodule] New trace queue: {}", mToTrace.size());
|
||||
yolo::info("[hartmodule] New trace queue: {}", mToTrace.size());
|
||||
}
|
||||
|
||||
inline void pushtoQueue(Ray* ray)
|
||||
@@ -104,7 +104,7 @@ public:
|
||||
|
||||
inline void passContext(void* context, HART_HIT_CALLBACK callback)
|
||||
{
|
||||
spdlog::debug("[hartmodule] Recieved context");
|
||||
yolo::debug("[hartmodule] Recieved context");
|
||||
std::lock_guard<std::mutex> lock(_mData);
|
||||
mCtx = context;
|
||||
Hit = callback;
|
||||
|
||||
4
libhart/thirdparty/yolo/yolo.hpp
vendored
4
libhart/thirdparty/yolo/yolo.hpp
vendored
@@ -14,7 +14,7 @@ namespace detail {
|
||||
static std::vector<std::pair<std::string, std::string>> modules;
|
||||
|
||||
template<typename... Args>
|
||||
std::string format(const std::string& format, Args... args)
|
||||
inline std::string format(const std::string& format, Args... args)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
size_t start = 0; size_t pos;
|
||||
@@ -23,7 +23,7 @@ namespace detail {
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
std::string formatTime()
|
||||
inline std::string formatTime()
|
||||
{
|
||||
auto now = std::chrono::system_clock::now();
|
||||
std::time_t time = std::chrono::system_clock::to_time_t(now);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "inferno_hart.hpp"
|
||||
|
||||
#include <spdlog/spdlog.h>
|
||||
#include <yolo/yolo.hpp>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
@@ -53,7 +53,7 @@ std::vector<HARTModuleDirectory::discoveryEntry> HARTModuleDirectory::discoverMo
|
||||
|
||||
HARTModuleDirectory::discoveryEntry HARTModuleDirectory::registerModule(std::filesystem::path file)
|
||||
{
|
||||
spdlog::info("Registering module at {}", file.c_str());
|
||||
yolo::info("Registering module at {}", file.c_str());
|
||||
|
||||
discoveryEntry entry;
|
||||
entry.Location = file;
|
||||
@@ -62,7 +62,7 @@ HARTModuleDirectory::discoveryEntry HARTModuleDirectory::registerModule(std::fil
|
||||
entry.Handle = LoadLibraryA(file.c_str());
|
||||
if (entry.Handle == NULL)
|
||||
{
|
||||
spdlog::error("Cannot load module at {}.", file.c_str());
|
||||
yolo::error("Cannot load module at {}.", file.c_str());
|
||||
entry.Handle = NULL; entry.DidLink = false;
|
||||
return entry;
|
||||
}
|
||||
@@ -73,7 +73,7 @@ HARTModuleDirectory::discoveryEntry HARTModuleDirectory::registerModule(std::fil
|
||||
entry.Handle = dlopen(file.c_str(), RTLD_NOW | RTLD_LOCAL);
|
||||
if (entry.Handle == NULL)
|
||||
{
|
||||
spdlog::error("Cannot load module at ", dlerror());
|
||||
yolo::error("Cannot load module at ", dlerror());
|
||||
entry.Handle = NULL; entry.DidLink = false;
|
||||
return entry;
|
||||
}
|
||||
@@ -84,30 +84,30 @@ HARTModuleDirectory::discoveryEntry HARTModuleDirectory::registerModule(std::fil
|
||||
|
||||
if (credit == NULL)
|
||||
{
|
||||
spdlog::error("Cannot load module at {}... No credit...", file.c_str());
|
||||
yolo::error("Cannot load module at {}... No credit...", file.c_str());
|
||||
entry.Handle = NULL; entry.DidLink = false;
|
||||
return entry;
|
||||
}
|
||||
if (entry.InitCallback == NULL)
|
||||
{
|
||||
spdlog::error("Cannot load module at {}... No get...", file.c_str());
|
||||
yolo::error("Cannot load module at {}... No get...", file.c_str());
|
||||
entry.Handle = NULL; entry.DidLink = false;
|
||||
return entry;
|
||||
}
|
||||
if (entry.DestroyCallback == NULL)
|
||||
{
|
||||
spdlog::error("Cannot load module at {}... No destroy...", file.c_str());
|
||||
yolo::error("Cannot load module at {}... No destroy...", file.c_str());
|
||||
entry.Handle = NULL; entry.DidLink = false;
|
||||
return entry;
|
||||
}
|
||||
|
||||
entry.Credit = (ModuleCredit*)credit();
|
||||
|
||||
spdlog::info("Module {0} v{1}.{2}.{3} by {4}", entry.Credit->ModuleName,
|
||||
entry.Credit->VersionMajor,
|
||||
entry.Credit->VersionMinor,
|
||||
entry.Credit->VersionBuild,
|
||||
entry.Credit->AuthorName);
|
||||
yolo::info("Module {} v{}.{}.{} by {}", entry.Credit->ModuleName,
|
||||
entry.Credit->VersionMajor,
|
||||
entry.Credit->VersionMinor,
|
||||
entry.Credit->VersionBuild,
|
||||
entry.Credit->AuthorName);
|
||||
|
||||
entry.DidLink = true;
|
||||
mEntries[entry.Credit->ModuleName] = { entry, nullptr };
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <scene/scene.hpp>
|
||||
#include <scene/mesh.hpp>
|
||||
|
||||
#include <spdlog/spdlog.h>
|
||||
#include <yolo/yolo.hpp>
|
||||
|
||||
#include <vector>
|
||||
|
||||
@@ -46,7 +46,7 @@ void HHM::newScene(Scene* scene)
|
||||
void* verticies; void* normals; void* indicies;
|
||||
int vertexCount = mesh->getVerticies(&verticies, &normals);
|
||||
int indexCount = mesh->getIndicies(&indicies);
|
||||
spdlog::debug("Mesh for module ready... {} {}", verticies, normals);
|
||||
yolo::debug("Mesh for module ready... {} {}", verticies, normals);
|
||||
mod->submitTris(verticies, normals, vertexCount, indicies, indexCount);
|
||||
}
|
||||
}
|
||||
@@ -77,7 +77,7 @@ void HHM::startTrace(RayField sourceScatter)
|
||||
// TODO: Signal start
|
||||
HARTModule* mod = mDirectory.getActiveModule();
|
||||
mod->passContext((void*)this, &rayHitCallback);
|
||||
spdlog::debug("SubmitQueue {}", sourceScatter.size());
|
||||
yolo::debug("SubmitQueue {}", sourceScatter.size());
|
||||
mod->submitQueue(sourceScatter);
|
||||
mod->start();
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include "scene/material.hpp"
|
||||
#include "scene/mesh.hpp"
|
||||
|
||||
#include <spdlog/spdlog.h>
|
||||
#include <yolo/yolo.hpp>
|
||||
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
@@ -28,8 +28,7 @@ using namespace inferno;
|
||||
Inferno::Inferno()
|
||||
{
|
||||
// MOTD
|
||||
spdlog::set_level(spdlog::level::trace);
|
||||
spdlog::info("INFERNO HART v" INFERNO_VERSION);
|
||||
yolo::info("INFERNO HART v" INFERNO_VERSION);
|
||||
|
||||
// Create window
|
||||
mWin = &Window::GetInstance();
|
||||
@@ -72,7 +71,7 @@ void Inferno::uiPreset()
|
||||
ImGui::DockBuilderDockWindow("Render", dock_main_id);
|
||||
ImGui::DockBuilderFinish(dockspace_id);
|
||||
|
||||
spdlog::info("LAYOUT SET TO DEFAULT");
|
||||
yolo::info("LAYOUT SET TO DEFAULT");
|
||||
}
|
||||
|
||||
void Inferno::moveInput()
|
||||
@@ -320,7 +319,7 @@ int Inferno::run()
|
||||
case GL_INVALID_FRAMEBUFFER_OPERATION: error = "INVALID_FRAMEBUFFER_OPERATION"; break;
|
||||
default: error = std::to_string((uint32_t)err); break;
|
||||
}
|
||||
spdlog::error("[GL]: {0} {1}", err, error);
|
||||
yolo::error("[GL]: {} {}", err, error);
|
||||
}
|
||||
|
||||
mWin->render();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "inferno.hpp"
|
||||
#include "spdlog/spdlog.h"
|
||||
#include "yolo/yolo.hpp"
|
||||
|
||||
#include <exception>
|
||||
|
||||
@@ -11,7 +11,7 @@ int main(int argc, char** argv)
|
||||
}
|
||||
catch (std::exception e)
|
||||
{
|
||||
spdlog::error(e.what());
|
||||
yolo::error(e.what());
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
#include "hart_module.hpp"
|
||||
#include "renderer.hpp"
|
||||
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
#include <mutex>
|
||||
#include <chrono>
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "hart_module.hpp"
|
||||
#include "ray_source.hpp"
|
||||
|
||||
#include <spdlog/spdlog.h>
|
||||
#include <yolo/yolo.hpp>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
@@ -83,7 +83,7 @@ void RayRenderer::prepare()
|
||||
assert(mCurrentScene != nullptr);
|
||||
if (mCurrentScene->didUpdate())
|
||||
{
|
||||
spdlog::debug("New Scene!");
|
||||
yolo::debug("New Scene!");
|
||||
mIface->newScene(mCurrentScene);
|
||||
}
|
||||
}
|
||||
@@ -105,7 +105,7 @@ void RayRenderer::draw()
|
||||
// before we start we now want to check that it hasn't been force-stopped
|
||||
mIface->startTrace(startRays.Field);
|
||||
|
||||
spdlog::info("Sample complete");
|
||||
yolo::info("Sample complete");
|
||||
|
||||
for (auto* ray : startRays.Field)
|
||||
{
|
||||
@@ -120,7 +120,7 @@ void RayRenderer::computeHit(HitInfo* info)
|
||||
// TODO: Make sure signal is started
|
||||
if (!(*mCurrentRefTable).count(info->Caller->Reference))
|
||||
{
|
||||
spdlog::warn("Why is the ray not in the map?!");
|
||||
yolo::warn("Why is the ray not in the map?!");
|
||||
return;
|
||||
}
|
||||
glm::ivec2 pos = (*mCurrentRefTable)[info->Caller->Reference];
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "mesh.hpp"
|
||||
|
||||
#include <spdlog/spdlog.h>
|
||||
#include <yolo/yolo.hpp>
|
||||
|
||||
#include <scene/objloader.hpp>
|
||||
|
||||
@@ -71,14 +71,13 @@ void Mesh::ready()
|
||||
|
||||
glBindVertexArray(0);
|
||||
|
||||
spdlog::debug("Mesh for preview ready...");
|
||||
yolo::debug("Mesh for preview ready...");
|
||||
}
|
||||
|
||||
int Mesh::getVerticies(void** v, void** n)
|
||||
{
|
||||
*v = (void*)&mObjLoader->getPositions()[0];
|
||||
*n = (void*)&mObjLoader->getNormals()[0];
|
||||
// spdlog::debug("Mesh get {} {}", v, n);
|
||||
return mObjLoader->getVertCount();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Adapted from https://raw.githubusercontent.com/tamato/simple-obj-loader/master/objloader.cpp
|
||||
#include "objloader.hpp"
|
||||
|
||||
#include <spdlog/spdlog.h>
|
||||
#include <yolo/yolo.hpp>
|
||||
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
@@ -54,7 +54,7 @@ void ObjLoader::load(std::filesystem::path file)
|
||||
{
|
||||
if (!std::filesystem::exists(file))
|
||||
{
|
||||
spdlog::error("OBJ File does not exist at ", file.string());
|
||||
yolo::error("OBJ File does not exist at ", file.string());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ void ObjLoader::load(std::filesystem::path file)
|
||||
inf.open(file.c_str(), std::ios_base::in);
|
||||
if (!inf.is_open())
|
||||
{
|
||||
spdlog::error("Failed to open OBJ file ", file.string());
|
||||
yolo::error("Failed to open OBJ file ", file.string());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "gui/style.hpp"
|
||||
|
||||
#include "spdlog/spdlog.h"
|
||||
#include "yolo/yolo.hpp"
|
||||
|
||||
using namespace inferno;
|
||||
|
||||
@@ -188,5 +188,5 @@ void Window::glfwKeyCallback(GLFWwindow* window, int key, int scancode, int acti
|
||||
}
|
||||
|
||||
void Window::glfwErrorCallback(int error, const char* description) {
|
||||
spdlog::error("[GLFW {0}] {1}", error, description);
|
||||
yolo::error("[GLFW {}] {}", error, description);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user