Refactor PD::Li Pools system, Upgrade PD::Pool and add better logging

- Add ResetFast to Pool using c++20 concept
- Add Put function to Pool
- Use Pool Index instead of pointers in Command
- Add accessor to Li Pools to prevent wrong command usage
- Add Command Formatter
- Use ResetFast for all Pools
- Add Reset func to Li::Vertex (for ResetFast)
- Add Pool Expandor and Put funcs to Lithium pools
- Add getters for GfxDriverBase to PD::Li Pools
This commit is contained in:
2026-03-21 13:35:16 +01:00
parent 3b0b103eb3
commit a86c13b9a3
16 changed files with 247 additions and 55 deletions
+5 -4
View File
@@ -3,6 +3,7 @@
#include <pd/core/mat.hpp>
#include <pd/drivers/interface.hpp>
#include <pd/lithium/command.hpp>
#include <pd/lithium/pools.hpp>
#include <pd/lithium/texture.hpp>
using PDBackendFlags = PD::u32;
@@ -105,12 +106,12 @@ class GfxDriverBase : public GfxDriver {
auto pIdx = pIdxPool.Allocate(c.IndexCount);
auto pVtx = pVtxPool.Allocate(c.VertexCount);
for (size_t i = 0; i < c.IndexCount; i++) {
pIdx[i] = CurrentVertex + c.FirstIndex[i];
pIdx[i] = CurrentVertex + Li::GetIndex(c.FirstIndex + i);
}
CurrentIndex += c.IndexCount;
CurrentVertex += c.VertexCount;
for (size_t i = 0; i < c.VertexCount; i++) {
pVtx[i] = c.FirstVertex[i];
pVtx[i] = Li::GetVertex(c.FirstVertex + i);
}
index++;
}
@@ -124,8 +125,8 @@ class GfxDriverBase : public GfxDriver {
size_t GetVertexPoolSize() const { return pVtxPool.size(); }
size_t GetIndexPoolSize() const { return pIdxPool.size(); }
void ResetPools() override {
pVtxPool.Reset();
pIdxPool.Reset();
pVtxPool.ResetFast();
pIdxPool.ResetFast();
}
private: