profiler, infodisplay, logging updates
This commit is contained in:
@@ -368,15 +368,30 @@ namespace wi
|
||||
infodisplay_str += "Graphics pipelines active: " + std::to_string(graphicsDevice->GetActivePipelineCount()) + "\n";
|
||||
}
|
||||
|
||||
wi::font::Params params = wi::font::Params(4, 4, infoDisplay.size, wi::font::WIFALIGN_LEFT, wi::font::WIFALIGN_TOP, wi::Color(255, 255, 255, 255), wi::Color(0, 0, 0, 255));
|
||||
params.cursor = wi::font::Draw(infodisplay_str, params, cmd);
|
||||
|
||||
// Write warnings below:
|
||||
params.color = wi::Color::Warning();
|
||||
#ifdef _DEBUG
|
||||
infodisplay_str += "Warning: This is a [DEBUG] build, performance will be slow!\n";
|
||||
params.cursor = wi::font::Draw("Warning: This is a [DEBUG] build, performance will be slow!\n", params, cmd);
|
||||
#endif
|
||||
if (graphicsDevice->IsDebugDevice())
|
||||
{
|
||||
infodisplay_str += "Warning: Graphics is in [debugdevice] mode, performance will be slow!\n";
|
||||
params.cursor = wi::font::Draw("Warning: Graphics is in [debugdevice] mode, performance will be slow!\n", params, cmd);
|
||||
}
|
||||
|
||||
// Write errors below:
|
||||
params.color = wi::Color::Error();
|
||||
if (wi::renderer::GetShaderMissingCount() > 0)
|
||||
{
|
||||
params.cursor = wi::font::Draw(std::to_string(wi::renderer::GetShaderMissingCount()) + " shaders missing! Check the backlog for more information!\n", params, cmd);
|
||||
}
|
||||
if (wi::renderer::GetShaderErrorCount() > 0)
|
||||
{
|
||||
params.cursor = wi::font::Draw(std::to_string(wi::renderer::GetShaderErrorCount()) + " shader compilation errors! Check the backlog for more information!\n", params, cmd);
|
||||
}
|
||||
|
||||
wi::font::Draw(infodisplay_str, wi::font::Params(4, 4, infoDisplay.size, wi::font::WIFALIGN_LEFT, wi::font::WIFALIGN_TOP, wi::Color(255, 255, 255, 255), wi::Color(0, 0, 0, 255)), cmd);
|
||||
|
||||
if (infoDisplay.colorgrading_helper)
|
||||
{
|
||||
|
||||
@@ -191,10 +191,10 @@ namespace wi::backlog
|
||||
switch (x.level)
|
||||
{
|
||||
case LogLevel::Warning:
|
||||
font_params.color = 0xFF66FFFF; // light yellow
|
||||
font_params.color = wi::Color::Warning();
|
||||
break;
|
||||
case LogLevel::Error:
|
||||
font_params.color = 0xFF6666FF; // light red
|
||||
font_params.color = wi::Color::Error();
|
||||
break;
|
||||
default:
|
||||
font_params.color = wi::Color::White();
|
||||
|
||||
@@ -68,6 +68,9 @@ namespace wi
|
||||
static constexpr Color Gray() { return Color(127, 127, 127, 255); }
|
||||
static constexpr Color Ghost() { return Color(127, 127, 127, 127); }
|
||||
static constexpr Color Booger() { return Color(127, 127, 127, 200); }
|
||||
|
||||
static constexpr Color Warning() { return 0xFF66FFFF; } // light yellow
|
||||
static constexpr Color Error() { return 0xFF6666FF; } // light red
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -660,7 +660,7 @@ namespace wi::helper
|
||||
|
||||
#endif // PLATFORM_UWP
|
||||
|
||||
wi::backlog::post("File not found: " + fileName);
|
||||
wi::backlog::post("File not found: " + fileName, wi::backlog::LogLevel::Warning);
|
||||
return false;
|
||||
}
|
||||
bool FileRead(const std::string& fileName, wi::vector<uint8_t>& data)
|
||||
|
||||
@@ -24,6 +24,7 @@ using namespace wi::graphics;
|
||||
namespace wi::profiler
|
||||
{
|
||||
bool ENABLED = false;
|
||||
bool ENABLED_REQUEST = false;
|
||||
bool initialized = false;
|
||||
std::mutex lock;
|
||||
range_id cpu_frame;
|
||||
@@ -58,6 +59,12 @@ namespace wi::profiler
|
||||
|
||||
void BeginFrame()
|
||||
{
|
||||
if (ENABLED_REQUEST != ENABLED)
|
||||
{
|
||||
ranges.clear();
|
||||
ENABLED = ENABLED_REQUEST;
|
||||
}
|
||||
|
||||
if (!ENABLED)
|
||||
return;
|
||||
|
||||
@@ -278,8 +285,7 @@ namespace wi::profiler
|
||||
|
||||
std::stringstream ss("");
|
||||
ss.precision(2);
|
||||
ss << "Frame Profiler Ranges:" << std::endl << "----------------------------" << std::endl;
|
||||
|
||||
ss << "Frame Profiler Ranges:\n----------------------------\n";
|
||||
|
||||
for (auto& x : ranges)
|
||||
{
|
||||
@@ -347,11 +353,9 @@ namespace wi::profiler
|
||||
|
||||
void SetEnabled(bool value)
|
||||
{
|
||||
if (value != ENABLED)
|
||||
{
|
||||
ranges.clear();
|
||||
ENABLED = value;
|
||||
}
|
||||
// Don't enable/disable the profiler immediately, only on the next frame
|
||||
// to avoid enabling inside a Begin/End by mistake
|
||||
ENABLED_REQUEST = value;
|
||||
}
|
||||
|
||||
bool IsEnabled()
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <atomic>
|
||||
|
||||
using namespace wi::primitive;
|
||||
using namespace wi::graphics;
|
||||
@@ -102,6 +103,8 @@ bool DDGI_ENABLED = false;
|
||||
bool DDGI_DEBUG_ENABLED = false;
|
||||
uint32_t DDGI_RAYCOUNT = 128u;
|
||||
float GI_BOOST = 1.0f;
|
||||
std::atomic<size_t> SHADER_ERRORS{ 0 };
|
||||
std::atomic<size_t> SHADER_MISSING{ 0 };
|
||||
|
||||
|
||||
struct VoxelizedSceneData
|
||||
@@ -626,6 +629,15 @@ size_t GetShaderDumpCount()
|
||||
}
|
||||
#endif // SHADERDUMP
|
||||
|
||||
size_t GetShaderErrorCount()
|
||||
{
|
||||
return SHADER_ERRORS.load();
|
||||
}
|
||||
size_t GetShaderMissingCount()
|
||||
{
|
||||
return SHADER_MISSING.load();
|
||||
}
|
||||
|
||||
bool LoadShader(
|
||||
ShaderStage stage,
|
||||
Shader& shader,
|
||||
@@ -658,7 +670,7 @@ bool LoadShader(
|
||||
}
|
||||
else
|
||||
{
|
||||
wi::backlog::post("shader dump doesn't contain shader: " + shaderbinaryfilename);
|
||||
wi::backlog::post("shader dump doesn't contain shader: " + shaderbinaryfilename, wi::backlog::LogLevel::Error);
|
||||
}
|
||||
#endif // SHADERDUMP_ENABLED
|
||||
}
|
||||
@@ -695,6 +707,7 @@ bool LoadShader(
|
||||
else
|
||||
{
|
||||
wi::backlog::post("shader compile FAILED: " + shaderbinaryfilename + "\n" + output.error_message, wi::backlog::LogLevel::Error);
|
||||
SHADER_ERRORS.fetch_add(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -705,6 +718,10 @@ bool LoadShader(
|
||||
{
|
||||
return device->CreateShader(stage, buffer.data(), buffer.size(), &shader);
|
||||
}
|
||||
else
|
||||
{
|
||||
SHADER_MISSING.fetch_add(1);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -2162,6 +2179,8 @@ void SetShaderSourcePath(const std::string& path)
|
||||
void ReloadShaders()
|
||||
{
|
||||
device->ClearPipelineStateCache();
|
||||
SHADER_ERRORS.store(0);
|
||||
SHADER_MISSING.store(0);
|
||||
|
||||
wi::eventhandler::FireEvent(wi::eventhandler::EVENT_RELOAD_SHADERS, 0);
|
||||
}
|
||||
|
||||
@@ -66,6 +66,8 @@ namespace wi::renderer
|
||||
// Returns how many shaders are embedded (if wiShaderDump.h is used)
|
||||
// wiShaderDump.h can be generated by OfflineShaderCompiler.exe using shaderdump argument
|
||||
size_t GetShaderDumpCount();
|
||||
size_t GetShaderErrorCount();
|
||||
size_t GetShaderMissingCount();
|
||||
|
||||
bool LoadShader(
|
||||
wi::graphics::ShaderStage stage,
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace wi::version
|
||||
// minor features, major updates, breaking compatibility changes
|
||||
const int minor = 60;
|
||||
// minor bug fixes, alterations, refactors, updates
|
||||
const int revision = 79;
|
||||
const int revision = 80;
|
||||
|
||||
const std::string version_string = std::to_string(major) + "." + std::to_string(minor) + "." + std::to_string(revision);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user