Add debug getters (and somehow text is not rendering :/)

This commit is contained in:
2026-03-25 20:27:23 +01:00
parent eea0e9844f
commit a8fe58ef0f
4 changed files with 30 additions and 4 deletions
+14 -3
View File
@@ -42,6 +42,11 @@ class PD_API GfxDriver : public DriverInterface {
Li::Texture::Ptr GetWhiteTexture() { return &pWhite; }
PDBackendFlags GetFlags() { return Flags; }
size_t GetNumVertices() const { return CountVertices; }
size_t GetNumIndices() const { return CountIndices; }
size_t GetNumDrawcalls() const { return CountDrawcalls; }
size_t GetNumCommands() const { return CountCommands; }
protected:
virtual void SysDeinit() {}
virtual void SysInit() {}
@@ -58,6 +63,8 @@ class PD_API GfxDriver : public DriverInterface {
size_t CountIndices = 0;
size_t CurrentIndex = 0;
size_t CurrentVertex = 0;
size_t pCountDrawcalls = 0;
size_t pCountCommands = 0;
TextureID CurrentTex = 0;
Mat4 Projection;
ivec2 ViewPort;
@@ -91,7 +98,7 @@ class GfxDriverBase : public GfxDriver {
}
void Draw(const Pool<Li::Command>& commands) override {
CountCommands += commands.size();
pCountCommands += commands.size();
size_t index = 0;
while (index < commands.size()) {
CurrentTex = commands[index].Tex;
@@ -103,8 +110,6 @@ class GfxDriverBase : public GfxDriver {
(CurrentTex == commands[index].Tex ||
(CurrentTex == pWhite.GetID() && commands[index].Tex == 0))) {
const auto& c = commands[index];
CountVertices += c.VertexCount;
CountIndices += c.IndexCount;
auto pIdx = pIdxPool.Allocate(c.IndexCount);
auto pVtx = pVtxPool.Allocate(c.VertexCount);
for (size_t i = 0; i < c.IndexCount; i++) {
@@ -118,6 +123,7 @@ class GfxDriverBase : public GfxDriver {
index++;
}
Submit(CurrentIndex - startidx, startidx);
pCountDrawcalls++;
}
}
@@ -172,6 +178,11 @@ class PD_API Gfx {
static const char* GetDriverName() { return driver->GetName(); }
static size_t GetNumVertices() { return driver->GetNumVertices(); }
static size_t GetNumIndices() { return driver->GetNumIndices(); }
static size_t GetNumDrawcalls() { return driver->GetNumDrawcalls(); }
static size_t GetNumCommands() { return driver->GetNumCommands(); }
private:
static std::unique_ptr<GfxDriver> driver;
};