Fix the stats

This commit is contained in:
Henrik Rydgård 2023-03-15 10:19:00 +01:00
parent 089b63c22f
commit 87a16b0386
5 changed files with 15 additions and 6 deletions

View File

@ -397,6 +397,16 @@ void VulkanPushPool::NextBlock(VkDeviceSize allocationSize) {
DEBUG_LOG(G3D, "%s: Created new block of size %s in %0.2f ms", name_, NiceSizeFormat(newBlockSize).c_str(), 1000.0 * (time_now_d() - start));
}
size_t VulkanPushPool::GetUsedThisFrame() const {
size_t used = 0;
for (auto &block : blocks_) {
if (block.frameIndex == vulkan_->GetCurFrame()) {
used += block.used;
}
}
return used;
}
void VulkanPushPool::GetDebugString(char *buffer, size_t bufSize) const {
size_t used = 0;
size_t capacity = 0;

View File

@ -148,6 +148,8 @@ public:
return bindOffset;
}
size_t GetUsedThisFrame() const;
private:
void NextBlock(VkDeviceSize allocationSize);

View File

@ -354,9 +354,8 @@ void DrawEngineVulkan::BeginFrame() {
void DrawEngineVulkan::EndFrame() {
FrameData *frame = &GetCurFrame();
stats_.pushUBOSpaceUsed = 0; // (int)pushUBO->GetOffset();
stats_.pushVertexSpaceUsed = 0; // (int)frame->pushVertex->GetOffset();
stats_.pushIndexSpaceUsed = 0; // (int)frame->pushIndex->GetOffset();
stats_.pushVertexSpaceUsed = (int)pushVertex_->GetUsedThisFrame();
stats_.pushIndexSpaceUsed = (int)pushIndex_->GetUsedThisFrame();
vertexCache_->End();
}

View File

@ -59,7 +59,6 @@ class VulkanPushPool;
struct VulkanPipeline;
struct DrawEngineVulkanStats {
int pushUBOSpaceUsed;
int pushVertexSpaceUsed;
int pushIndexSpaceUsed;
};

View File

@ -455,12 +455,11 @@ void GPU_Vulkan::GetStats(char *buffer, size_t bufsize) {
textureCacheVulkan_->GetStats(texStats, sizeof(texStats));
snprintf(buffer, bufsize,
"Vertex, Fragment, Pipelines loaded: %i, %i, %i\n"
"Pushbuffer space used: UBO %d, Vtx %d, Idx %d\n"
"Pushbuffer space used: Vtx %d, Idx %d\n"
"%s\n",
shaderManagerVulkan_->GetNumVertexShaders(),
shaderManagerVulkan_->GetNumFragmentShaders(),
pipelineManager_->GetNumPipelines(),
drawStats.pushUBOSpaceUsed,
drawStats.pushVertexSpaceUsed,
drawStats.pushIndexSpaceUsed,
texStats