diff --git a/backends/3ds/include/pd-3ds/bknd-gfx.hpp b/backends/3ds/include/pd-3ds/bknd-gfx.hpp index a5b514b..bfd2277 100755 --- a/backends/3ds/include/pd-3ds/bknd-gfx.hpp +++ b/backends/3ds/include/pd-3ds/bknd-gfx.hpp @@ -56,5 +56,9 @@ class GfxC3D : public GfxDriver { shaderProgram_s Shader; C3D_AttrInfo ShaderInfo; std::vector pRawShader; + u32 pCountVertices = 0; + u32 pCountIndices = 0; + u32 pCountDrawCalls = 0; + u32 pDrawCommands = 0; }; } // namespace PD \ No newline at end of file diff --git a/backends/3ds/source/bknd-gfx.cpp b/backends/3ds/source/bknd-gfx.cpp index b109608..1b611ef 100755 --- a/backends/3ds/source/bknd-gfx.cpp +++ b/backends/3ds/source/bknd-gfx.cpp @@ -138,8 +138,14 @@ void GfxC3D::NewFrame() { CurrentVertex = 0; FrameCounter++; /** Probably completly incorrect but just do it like that */ - VertexCounter = CurrentVertex; - IndexCounter = CurrentIndex; + VertexCounter = pCountVertices; + IndexCounter = pCountIndices; + DrawCalls = pCountDrawCalls; + DrawCommands = pDrawCommands; + pCountDrawCalls = 0; + pCountIndices = 0; + pCountVertices = 0; + pDrawCommands = 0; } void GfxC3D::BindTex(PD::Li::TexAddress addr) { @@ -147,6 +153,7 @@ void GfxC3D::BindTex(PD::Li::TexAddress addr) { } void GfxC3D::RenderDrawData(const PD::Li::CmdPool& Commands) { + pDrawCommands += Commands.Size(); shaderProgramUse(&Shader); C3D_SetAttrInfo(&ShaderInfo); C3D_Mtx proj; @@ -169,6 +176,8 @@ void GfxC3D::RenderDrawData(const PD::Li::CmdPool& Commands) { Commands.GetCmd(index)->ScissorOn == ScissorEnabled && Commands.GetCmd(index)->ScissorRect == ScissorRect) { auto c = Commands.GetCmd(index); + pCountIndices += c->IndexBuffer.size(); + pCountVertices += c->VertexBuffer.size(); for (size_t i = 0; i < c->IndexBuffer.size(); i++) { IndexBuffer[CurrentIndex++] = CurrentVertex + c->IndexBuffer.at(i); } @@ -196,6 +205,7 @@ void GfxC3D::RenderDrawData(const PD::Li::CmdPool& Commands) { C3D_DrawElements(GPU_TRIANGLES, CurrentIndex - StartIndex, C3D_UNSIGNED_SHORT, IndexBuffer.data() + StartIndex); + pCountDrawCalls++; } C3D_DepthTest(true, GPU_GREATER, GPU_WRITE_ALL); } diff --git a/include/pd/drivers/gfx.hpp b/include/pd/drivers/gfx.hpp index af99acf..098a559 100755 --- a/include/pd/drivers/gfx.hpp +++ b/include/pd/drivers/gfx.hpp @@ -111,5 +111,9 @@ class GfxDriver { u32 VertexCounter; // Optional Frame Counter u64 FrameCounter; + // Draw calls counter + u32 DrawCalls; + // Command Counter + u32 DrawCommands; }; } // namespace PD \ No newline at end of file diff --git a/include/pd/ui7/menu.hpp b/include/pd/ui7/menu.hpp index 50324e4..ec163ab 100644 --- a/include/pd/ui7/menu.hpp +++ b/include/pd/ui7/menu.hpp @@ -124,6 +124,9 @@ class PD_API Menu { void Update(); + void SetSize(PD::fvec2 size) { pLayout->SetSize(size); } + void SetPosition(PD::fvec2 pos) { pLayout->SetPosition(pos); } + /** Data Section */ UI7MenuFlags Flags = 0; diff --git a/source/lithium/drawlist.cpp b/source/lithium/drawlist.cpp index bff1a9b..7de7060 100644 --- a/source/lithium/drawlist.cpp +++ b/source/lithium/drawlist.cpp @@ -71,6 +71,7 @@ PD_API void DrawList::Merge(DrawList::Ref list) { PD_API void DrawList::Copy(DrawList::Ref list) { pPool.Copy(list->pPool); } PD_API void DrawList::Optimize() { + pPool.Sort(); /*std::sort(pDrawList.begin(), pDrawList.end(), [](const PD::Li::Command::Ref &a, const PD::Li::Command::Ref &b) { if (a->Layer == b->Layer) { // Same layer