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