fix: Shadow pass 接入 GPUDriven batch,实例上限提至 16384

100 背包掉帧 + 警告刷屏的根因:
1. backpack.obj 有 44 个 mesh 部件,100 实体 × 44 = 4400 实例
   打爆 4096 上限 → 每帧截断 + 告警刷屏。上限提至 16384
  (1MB/slot),告警改一次性
2. Shadow pass 仍逐实体逐部件画(4400 draw,CPU 提交瓶颈)。
   改为与 Forward 共用同一批 batch:Set0 绑 ObjectBuffer,
   lightVP 一次 push,44 draw 完成。shadow.vert 经
   gl_InstanceIndex 从 SSBO 取模型矩阵

实测(100 背包):GPU 总耗时 ~5.7ms(Shadow 2.9 + Forward 2.6 +
后处理 0.1),0 警告,帧率受 mailbox 垂直同步 pacing 限制
This commit is contained in:
2026-09-22 20:06:43 +08:00
parent 7fca721a24
commit 6a3fcac072
3 changed files with 50 additions and 38 deletions
+1 -1
View File
@@ -140,7 +140,7 @@ namespace Engine {
// GPUDriven:当帧实例数据(Render 期收集,Forward pass 消费)
std::vector<InstanceBatch> m_InstanceBatches;
std::vector<glm::mat4> m_InstanceModels;
static constexpr u32 kMaxInstances = 4096;
static constexpr u32 kMaxInstances = 16384;
// 可选叠加层(不拥有;Application 持有)
ImGuiLayer* m_ImGuiLayer = nullptr;