mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-05 16:43:52 +00:00
Remove leftover debug logging from render hot paths
Strip per-frame/periodic logging from CharacterRenderer (batch dump, instance count) and M2Renderer (frame timing profiler) to avoid unnecessary string formatting and I/O in render loops.
This commit is contained in:
parent
98fb6b47da
commit
e8c2344226
3 changed files with 0 additions and 56 deletions
|
|
@ -230,7 +230,6 @@ private:
|
||||||
VkContext* vkCtx_ = nullptr;
|
VkContext* vkCtx_ = nullptr;
|
||||||
VkRenderPass renderPassOverride_ = VK_NULL_HANDLE;
|
VkRenderPass renderPassOverride_ = VK_NULL_HANDLE;
|
||||||
pipeline::AssetManager* assetManager = nullptr;
|
pipeline::AssetManager* assetManager = nullptr;
|
||||||
int renderLogCounter_ = 0; // per-instance debug counter
|
|
||||||
|
|
||||||
// Vulkan pipelines (one per blend mode)
|
// Vulkan pipelines (one per blend mode)
|
||||||
VkPipeline opaquePipeline_ = VK_NULL_HANDLE;
|
VkPipeline opaquePipeline_ = VK_NULL_HANDLE;
|
||||||
|
|
|
||||||
|
|
@ -1621,13 +1621,6 @@ glm::mat4 CharacterRenderer::getBoneTransform(const pipeline::M2Bone& bone, floa
|
||||||
// --- Rendering ---
|
// --- Rendering ---
|
||||||
|
|
||||||
void CharacterRenderer::render(VkCommandBuffer cmd, VkDescriptorSet perFrameSet, const Camera& camera) {
|
void CharacterRenderer::render(VkCommandBuffer cmd, VkDescriptorSet perFrameSet, const Camera& camera) {
|
||||||
// Periodic instance count log (every ~10s at 30fps)
|
|
||||||
if (!renderPassOverride_) {
|
|
||||||
renderLogCounter_++;
|
|
||||||
if (renderLogCounter_ % 300 == 1) {
|
|
||||||
LOG_INFO("CharRenderer[WORLD]::render instances=", instances.size());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (instances.empty() || !opaquePipeline_) {
|
if (instances.empty() || !opaquePipeline_) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1837,34 +1830,6 @@ void CharacterRenderer::render(VkCommandBuffer cmd, VkDescriptorSet perFrameSet,
|
||||||
};
|
};
|
||||||
|
|
||||||
// One-time debug dump of rendered batches per model
|
// One-time debug dump of rendered batches per model
|
||||||
static std::unordered_set<uint32_t> dumpedModels;
|
|
||||||
if (dumpedModels.find(instance.modelId) == dumpedModels.end()) {
|
|
||||||
dumpedModels.insert(instance.modelId);
|
|
||||||
int bIdx = 0;
|
|
||||||
int rendered = 0, skipped = 0;
|
|
||||||
for (const auto& b : gpuModel.data.batches) {
|
|
||||||
bool filtered = applyGeosetFilter &&
|
|
||||||
(b.submeshId / 100 != 0) &&
|
|
||||||
instance.activeGeosets.find(b.submeshId) == instance.activeGeosets.end();
|
|
||||||
|
|
||||||
VkTexture* resolvedTex = resolveBatchTexture(instance, gpuModel, b);
|
|
||||||
std::string texInfo = resolvedTex ? "VkTex" : "null";
|
|
||||||
|
|
||||||
if (filtered) skipped++; else rendered++;
|
|
||||||
LOG_DEBUG("Batch ", bIdx, ": submesh=", b.submeshId,
|
|
||||||
" level=", b.submeshLevel,
|
|
||||||
" idxStart=", b.indexStart, " idxCount=", b.indexCount,
|
|
||||||
" tex=", texInfo,
|
|
||||||
filtered ? " [SKIP]" : " [RENDER]");
|
|
||||||
bIdx++;
|
|
||||||
}
|
|
||||||
LOG_DEBUG("Batch summary: ", rendered, " rendered, ", skipped, " skipped, ",
|
|
||||||
gpuModel.textureIds.size(), " textures loaded, ",
|
|
||||||
gpuModel.data.textureLookup.size(), " in lookup table");
|
|
||||||
for (size_t t = 0; t < gpuModel.data.textures.size(); t++) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Draw batches (submeshes) with per-batch textures
|
// Draw batches (submeshes) with per-batch textures
|
||||||
for (const auto& batch : gpuModel.data.batches) {
|
for (const auto& batch : gpuModel.data.batches) {
|
||||||
if (applyGeosetFilter) {
|
if (applyGeosetFilter) {
|
||||||
|
|
|
||||||
|
|
@ -2012,8 +2012,6 @@ void M2Renderer::render(VkCommandBuffer cmd, VkDescriptorSet perFrameSet, const
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto renderStartTime = std::chrono::high_resolution_clock::now();
|
|
||||||
|
|
||||||
// Debug: log once when we start rendering
|
// Debug: log once when we start rendering
|
||||||
static bool loggedOnce = false;
|
static bool loggedOnce = false;
|
||||||
if (!loggedOnce) {
|
if (!loggedOnce) {
|
||||||
|
|
@ -2091,16 +2089,11 @@ void M2Renderer::render(VkCommandBuffer cmd, VkDescriptorSet perFrameSet, const
|
||||||
std::stable_sort(sortedVisible_.begin(), sortedVisible_.end(),
|
std::stable_sort(sortedVisible_.begin(), sortedVisible_.end(),
|
||||||
[](const VisibleEntry& a, const VisibleEntry& b) { return a.modelId < b.modelId; });
|
[](const VisibleEntry& a, const VisibleEntry& b) { return a.modelId < b.modelId; });
|
||||||
|
|
||||||
auto cullingSortTime = std::chrono::high_resolution_clock::now();
|
|
||||||
double cullingSortMs = std::chrono::duration<double, std::milli>(cullingSortTime - renderStartTime).count();
|
|
||||||
|
|
||||||
uint32_t currentModelId = UINT32_MAX;
|
uint32_t currentModelId = UINT32_MAX;
|
||||||
const M2ModelGPU* currentModel = nullptr;
|
const M2ModelGPU* currentModel = nullptr;
|
||||||
|
|
||||||
// State tracking
|
// State tracking
|
||||||
VkPipeline currentPipeline = VK_NULL_HANDLE;
|
VkPipeline currentPipeline = VK_NULL_HANDLE;
|
||||||
uint32_t boneMatrixUploads = 0;
|
|
||||||
uint32_t totalBatchesDrawn = 0;
|
|
||||||
uint32_t frameIndex = vkCtx_->getCurrentFrame();
|
uint32_t frameIndex = vkCtx_->getCurrentFrame();
|
||||||
|
|
||||||
// Push constants struct matching m2.vert.glsl push_constant block
|
// Push constants struct matching m2.vert.glsl push_constant block
|
||||||
|
|
@ -2190,7 +2183,6 @@ void M2Renderer::render(VkCommandBuffer cmd, VkDescriptorSet perFrameSet, const
|
||||||
int numBones = std::min(static_cast<int>(instance.boneMatrices.size()), 128);
|
int numBones = std::min(static_cast<int>(instance.boneMatrices.size()), 128);
|
||||||
memcpy(instance.boneMapped[frameIndex], instance.boneMatrices.data(),
|
memcpy(instance.boneMapped[frameIndex], instance.boneMatrices.data(),
|
||||||
numBones * sizeof(glm::mat4));
|
numBones * sizeof(glm::mat4));
|
||||||
boneMatrixUploads++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bind bone descriptor set (set 2)
|
// Bind bone descriptor set (set 2)
|
||||||
|
|
@ -2387,7 +2379,6 @@ void M2Renderer::render(VkCommandBuffer cmd, VkDescriptorSet perFrameSet, const
|
||||||
vkCmdPushConstants(cmd, pipelineLayout_, VK_SHADER_STAGE_VERTEX_BIT, 0, sizeof(pc), &pc);
|
vkCmdPushConstants(cmd, pipelineLayout_, VK_SHADER_STAGE_VERTEX_BIT, 0, sizeof(pc), &pc);
|
||||||
|
|
||||||
vkCmdDrawIndexed(cmd, batch.indexCount, 1, batch.indexStart, 0, 0);
|
vkCmdDrawIndexed(cmd, batch.indexCount, 1, batch.indexStart, 0, 0);
|
||||||
totalBatchesDrawn++;
|
|
||||||
lastDrawCallCount++;
|
lastDrawCallCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2446,17 +2437,6 @@ void M2Renderer::render(VkCommandBuffer cmd, VkDescriptorSet perFrameSet, const
|
||||||
vkCmdDraw(cmd, static_cast<uint32_t>(uploadCount), 1, 0, 0);
|
vkCmdDraw(cmd, static_cast<uint32_t>(uploadCount), 1, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto renderEndTime = std::chrono::high_resolution_clock::now();
|
|
||||||
double totalMs = std::chrono::duration<double, std::milli>(renderEndTime - renderStartTime).count();
|
|
||||||
double drawLoopMs = std::chrono::duration<double, std::milli>(renderEndTime - cullingSortTime).count();
|
|
||||||
|
|
||||||
static int frameCounter = 0;
|
|
||||||
if (++frameCounter >= 120) {
|
|
||||||
frameCounter = 0;
|
|
||||||
LOG_DEBUG("M2 Render: ", totalMs, " ms (culling/sort: ", cullingSortMs,
|
|
||||||
" ms, draw: ", drawLoopMs, " ms) | ", sortedVisible_.size(), " visible | ",
|
|
||||||
totalBatchesDrawn, " batches | ", boneMatrixUploads, " bone uploads");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool M2Renderer::initializeShadow(VkRenderPass shadowRenderPass) {
|
bool M2Renderer::initializeShadow(VkRenderPass shadowRenderPass) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue