Logging more fleshed out and validated the state machine
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
|
||||
using namespace inferno;
|
||||
|
||||
@@ -28,9 +29,7 @@ public:
|
||||
int ic) override
|
||||
{
|
||||
mState = EModuleState::Build;
|
||||
|
||||
std::cout << "INFERNO HART CPU RECIEVED " << vc / 3 << " VERTICIES AND " << ic / 3 << " INDICIES" << std::endl;
|
||||
|
||||
spdlog::info("[hartcpu] Recieved {} verticies and {} indicies", vc / 3, ic / 3);
|
||||
mState = EModuleState::Ready;
|
||||
}
|
||||
|
||||
@@ -47,6 +46,7 @@ public:
|
||||
mState = EModuleState::Ready;
|
||||
continue;
|
||||
}
|
||||
std::this_thread::sleep_for(std::chrono::microseconds(10));
|
||||
mState = EModuleState::Trace;
|
||||
|
||||
mToTrace.pop();
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
#include <string>
|
||||
#include <mutex>
|
||||
#include <atomic>
|
||||
@@ -12,6 +14,12 @@
|
||||
* *
|
||||
* Inferno will first initialise the module and then wait for the Ready state. *
|
||||
* *
|
||||
* The possible states a module can be in are: *
|
||||
* - Bad (Not ready) *
|
||||
* - Ready (Ready for a command or a scene) *
|
||||
* - Build (Scene is submitted and being processed) *
|
||||
* - Trace (Tracing!) *
|
||||
* *
|
||||
* Once the HHM dispatches a new scene to the module, it will wait until *
|
||||
* the state is Done to dispatch work during scene building the modules *
|
||||
* state must be Build. *
|
||||
@@ -53,7 +61,7 @@ struct ModuleCredit
|
||||
enum class EModuleState : uint8_t
|
||||
{
|
||||
Bad, // Not ready!
|
||||
Ready, // Ready for initial command or scene
|
||||
Ready, // Ready for command or scene
|
||||
Build, // Scene is passed, optimisation is taking place
|
||||
Trace, // Tracing!
|
||||
};
|
||||
@@ -82,6 +90,7 @@ public:
|
||||
std::lock_guard<std::mutex> lock(_mData);
|
||||
for (const auto& e: queue)
|
||||
mToTrace.push(e);
|
||||
spdlog::info("[hartmodule] New trace queue");
|
||||
}
|
||||
|
||||
inline void pushtoQueue(Ray* ray)
|
||||
|
||||
@@ -53,7 +53,7 @@ std::vector<HARTModuleDirectory::discoveryEntry> HARTModuleDirectory::discoverMo
|
||||
|
||||
HARTModuleDirectory::discoveryEntry HARTModuleDirectory::registerModule(std::filesystem::path file)
|
||||
{
|
||||
spdlog::debug("Registering module at {}", file.c_str());
|
||||
spdlog::info("Registering module at {}", file.c_str());
|
||||
|
||||
discoveryEntry entry;
|
||||
entry.Location = file;
|
||||
@@ -103,7 +103,7 @@ HARTModuleDirectory::discoveryEntry HARTModuleDirectory::registerModule(std::fil
|
||||
|
||||
entry.Credit = (ModuleCredit*)credit();
|
||||
|
||||
spdlog::info("Module {0} v{2}.{3}.{4} by {5}", entry.Credit->ModuleName,
|
||||
spdlog::info("Module {0} v{1}.{2}.{3} by {4}", entry.Credit->ModuleName,
|
||||
entry.Credit->VersionMajor,
|
||||
entry.Credit->VersionMinor,
|
||||
entry.Credit->VersionBuild,
|
||||
|
||||
@@ -41,7 +41,7 @@ void HHM::newScene(Scene* scene)
|
||||
// as it is now, submitTris assumes it's getting the whole scene
|
||||
// which would involve a lot of mesh copying (avoid!) if i were to chain them
|
||||
for (auto* mesh : meshs) {
|
||||
spdlog::debug("MESH BEING SUBMITTED TO MODULE");
|
||||
spdlog::debug("Mesh for module ready...");
|
||||
void* verticies; void* normals; void* indicies;
|
||||
int vertexCount = mesh->getVerticies(verticies, normals);
|
||||
int indexCount = mesh->getIndicies(indicies);
|
||||
|
||||
@@ -93,12 +93,14 @@ void RayRenderer::draw()
|
||||
bool frameStatus = false;
|
||||
while (!frameStatus)
|
||||
{
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
|
||||
switch(mIface->getModuleState())
|
||||
{
|
||||
case EModuleState::Bad:
|
||||
spdlog::error("MODULE STATE BAD");
|
||||
case EModuleState::Build:
|
||||
case EModuleState::Trace:
|
||||
spdlog::debug("MODULE BUSY..");
|
||||
break;
|
||||
case EModuleState::Ready:
|
||||
frameStatus = true;
|
||||
@@ -106,7 +108,7 @@ void RayRenderer::draw()
|
||||
}
|
||||
}
|
||||
|
||||
spdlog::debug("Sample complete");
|
||||
spdlog::info("Sample complete");
|
||||
|
||||
for (auto* ray : startRays)
|
||||
{
|
||||
|
||||
@@ -71,7 +71,7 @@ void Mesh::ready()
|
||||
|
||||
glBindVertexArray(0);
|
||||
|
||||
spdlog::debug("PREVIEW MESH READY");
|
||||
spdlog::debug("Mesh for preview ready...");
|
||||
}
|
||||
|
||||
int Mesh::getVerticies(void* v, void* n)
|
||||
|
||||
Reference in New Issue
Block a user