[pd-drivers]: Ad more debug values

[pd-3ds]: Use new debug values
[pd-lithium]: Add functionality to DrawList::Optimize
[pd-ui7]: Add setters for Menu pos ans size
This commit is contained in:
2026-03-12 20:18:27 +01:00
parent 02d2200edd
commit 1b47ed843f
5 changed files with 24 additions and 2 deletions

View File

@@ -56,5 +56,9 @@ class GfxC3D : public GfxDriver {
shaderProgram_s Shader;
C3D_AttrInfo ShaderInfo;
std::vector<u8> pRawShader;
u32 pCountVertices = 0;
u32 pCountIndices = 0;
u32 pCountDrawCalls = 0;
u32 pDrawCommands = 0;
};
} // namespace PD

View File

@@ -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);
}

View File

@@ -111,5 +111,9 @@ class GfxDriver {
u32 VertexCounter;
// Optional Frame Counter
u64 FrameCounter;
// Draw calls counter
u32 DrawCalls;
// Command Counter
u32 DrawCommands;
};
} // namespace PD

View File

@@ -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;

View File

@@ -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