Rendering statistics view (#3322)

Co-authored-by: Bart Louwers <bart@emeel.net>
This commit is contained in:
Adrian Cojocaru
2025-06-03 18:59:51 +03:00
committed by GitHub
parent 3c07cacc4d
commit 2a7249a3b0
81 changed files with 1271 additions and 128 deletions

View File

@@ -67,6 +67,12 @@ Context::~Context() noexcept {
if (--glslangRefCount == 0) {
glslang::FinalizeProcess();
}
#if !defined(NDEBUG)
Log::Debug(Event::General, "Rendering Stats:\n" + stats.toString("\n"));
#endif
assert(stats.isZero());
}
void Context::initFrameResources() {
@@ -134,10 +140,20 @@ void Context::destroyResources() {
frame.runDeletionQueue(*this);
}
globalUniformBuffers.freeDescriptorSets();
// all resources have unique handles
frameResources.clear();
globalUniformBuffers.freeDescriptorSets();
for (size_t i = 0; i < globalUniformBuffers.allocatedSize(); i++) {
globalUniformBuffers.set(i, nullptr);
}
dummyBuffer.reset();
dummyTexture2D.reset();
clipping.indexBuffer.reset();
clipping.vertexBuffer.reset();
}
void Context::enqueueDeletion(std::function<void(Context&)>&& function) {
@@ -355,6 +371,11 @@ UniqueShaderProgram Context::createProgram(shaders::BuiltIn shaderID,
return program;
}
void Context::performCleanup() {
stats.numDrawCalls = 0;
++stats.numFrames;
}
gfx::UniqueDrawableBuilder Context::createDrawableBuilder(std::string name) {
return std::make_unique<DrawableBuilder>(std::move(name));
}