bugfix: debug mask
This commit is contained in:
@@ -66,7 +66,7 @@ $ ./build/ouros
|
||||
```
|
||||
For control on debugging:
|
||||
```bash
|
||||
$ ./build/ouros --debug 0b00111111
|
||||
$ ./build/ouros --debug=0b00111111
|
||||
```
|
||||
where each bit in the mask corresponds to a debug level, in order: unused, unused, fatal, trace, error, warning, notice, and info. `0b1111111` enables all debug messages.
|
||||
|
||||
|
||||
@@ -34,8 +34,7 @@ void Engine::exec() {
|
||||
};
|
||||
|
||||
VkInstance instance;
|
||||
VkResult result = vkCreateInstance(&instanceCI, nullptr, &instance);
|
||||
if(result == VK_SUCCESS) {
|
||||
if(vkCreateInstance(&instanceCI, nullptr, &instance) == VK_SUCCESS) {
|
||||
utils::debugPrint(__FUNCTION__, __LINE__, "Vulkan instance successfully created.", utils::DebugLevel::Info);
|
||||
} else {
|
||||
utils::debugPrint(__FUNCTION__, __LINE__, "Error creating Vulkan instance", utils::DebugLevel::Error);
|
||||
|
||||
@@ -16,6 +16,7 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
// might get rid of this
|
||||
void init();
|
||||
|
||||
// TODO: smart pointers probably would be smart
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace utils {
|
||||
|
||||
static void debugPrint(const char* function, int line, std::string message, size_t debugLevel) {
|
||||
|
||||
if(!(debugMask >> debugLevel)) return; // then ignore this debug level
|
||||
if(!((debugMask >> debugLevel) & 1)) return; // then ignore this debug level
|
||||
|
||||
std::cout << "[ " << std::left << std::setw(16) << function << ": " << std::right << std::setw(4) << line << ", " << std::left << std::setw(8) << debugTypeStrings[debugLevel] << " ] " << message << std::endl;
|
||||
// TODO: add timestamps
|
||||
@@ -53,6 +53,7 @@ namespace utils {
|
||||
std::cout << "Unsupported debug key." << std::endl;
|
||||
}
|
||||
debugMask = static_cast<uint8_t>(std::stoul(value, nullptr, 2)); // interpret a string as a uint
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user