[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:
@@ -56,5 +56,9 @@ class GfxC3D : public GfxDriver {
|
|||||||
shaderProgram_s Shader;
|
shaderProgram_s Shader;
|
||||||
C3D_AttrInfo ShaderInfo;
|
C3D_AttrInfo ShaderInfo;
|
||||||
std::vector<u8> pRawShader;
|
std::vector<u8> pRawShader;
|
||||||
|
u32 pCountVertices = 0;
|
||||||
|
u32 pCountIndices = 0;
|
||||||
|
u32 pCountDrawCalls = 0;
|
||||||
|
u32 pDrawCommands = 0;
|
||||||
};
|
};
|
||||||
} // namespace PD
|
} // namespace PD
|
||||||
@@ -138,8 +138,14 @@ void GfxC3D::NewFrame() {
|
|||||||
CurrentVertex = 0;
|
CurrentVertex = 0;
|
||||||
FrameCounter++;
|
FrameCounter++;
|
||||||
/** Probably completly incorrect but just do it like that */
|
/** Probably completly incorrect but just do it like that */
|
||||||
VertexCounter = CurrentVertex;
|
VertexCounter = pCountVertices;
|
||||||
IndexCounter = CurrentIndex;
|
IndexCounter = pCountIndices;
|
||||||
|
DrawCalls = pCountDrawCalls;
|
||||||
|
DrawCommands = pDrawCommands;
|
||||||
|
pCountDrawCalls = 0;
|
||||||
|
pCountIndices = 0;
|
||||||
|
pCountVertices = 0;
|
||||||
|
pDrawCommands = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GfxC3D::BindTex(PD::Li::TexAddress addr) {
|
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) {
|
void GfxC3D::RenderDrawData(const PD::Li::CmdPool& Commands) {
|
||||||
|
pDrawCommands += Commands.Size();
|
||||||
shaderProgramUse(&Shader);
|
shaderProgramUse(&Shader);
|
||||||
C3D_SetAttrInfo(&ShaderInfo);
|
C3D_SetAttrInfo(&ShaderInfo);
|
||||||
C3D_Mtx proj;
|
C3D_Mtx proj;
|
||||||
@@ -169,6 +176,8 @@ void GfxC3D::RenderDrawData(const PD::Li::CmdPool& Commands) {
|
|||||||
Commands.GetCmd(index)->ScissorOn == ScissorEnabled &&
|
Commands.GetCmd(index)->ScissorOn == ScissorEnabled &&
|
||||||
Commands.GetCmd(index)->ScissorRect == ScissorRect) {
|
Commands.GetCmd(index)->ScissorRect == ScissorRect) {
|
||||||
auto c = Commands.GetCmd(index);
|
auto c = Commands.GetCmd(index);
|
||||||
|
pCountIndices += c->IndexBuffer.size();
|
||||||
|
pCountVertices += c->VertexBuffer.size();
|
||||||
for (size_t i = 0; i < c->IndexBuffer.size(); i++) {
|
for (size_t i = 0; i < c->IndexBuffer.size(); i++) {
|
||||||
IndexBuffer[CurrentIndex++] = CurrentVertex + c->IndexBuffer.at(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_DrawElements(GPU_TRIANGLES, CurrentIndex - StartIndex,
|
||||||
C3D_UNSIGNED_SHORT, IndexBuffer.data() + StartIndex);
|
C3D_UNSIGNED_SHORT, IndexBuffer.data() + StartIndex);
|
||||||
|
pCountDrawCalls++;
|
||||||
}
|
}
|
||||||
C3D_DepthTest(true, GPU_GREATER, GPU_WRITE_ALL);
|
C3D_DepthTest(true, GPU_GREATER, GPU_WRITE_ALL);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,5 +111,9 @@ class GfxDriver {
|
|||||||
u32 VertexCounter;
|
u32 VertexCounter;
|
||||||
// Optional Frame Counter
|
// Optional Frame Counter
|
||||||
u64 FrameCounter;
|
u64 FrameCounter;
|
||||||
|
// Draw calls counter
|
||||||
|
u32 DrawCalls;
|
||||||
|
// Command Counter
|
||||||
|
u32 DrawCommands;
|
||||||
};
|
};
|
||||||
} // namespace PD
|
} // namespace PD
|
||||||
@@ -124,6 +124,9 @@ class PD_API Menu {
|
|||||||
|
|
||||||
void Update();
|
void Update();
|
||||||
|
|
||||||
|
void SetSize(PD::fvec2 size) { pLayout->SetSize(size); }
|
||||||
|
void SetPosition(PD::fvec2 pos) { pLayout->SetPosition(pos); }
|
||||||
|
|
||||||
/** Data Section */
|
/** Data Section */
|
||||||
|
|
||||||
UI7MenuFlags Flags = 0;
|
UI7MenuFlags Flags = 0;
|
||||||
|
|||||||
@@ -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::Copy(DrawList::Ref list) { pPool.Copy(list->pPool); }
|
||||||
|
|
||||||
PD_API void DrawList::Optimize() {
|
PD_API void DrawList::Optimize() {
|
||||||
|
pPool.Sort();
|
||||||
/*std::sort(pDrawList.begin(), pDrawList.end(),
|
/*std::sort(pDrawList.begin(), pDrawList.end(),
|
||||||
[](const PD::Li::Command::Ref &a, const PD::Li::Command::Ref &b) {
|
[](const PD::Li::Command::Ref &a, const PD::Li::Command::Ref &b) {
|
||||||
if (a->Layer == b->Layer) { // Same layer
|
if (a->Layer == b->Layer) { // Same layer
|
||||||
|
|||||||
Reference in New Issue
Block a user