Fix PIE deadlock when playing a scene without a primary camera

BuildFrame returned false (skip frame) when the game view had no
primary camera, skipping the WaitFence/ResetFence/submit chain - the
frame-slot fence never got signaled, so the next WaitFence on that
slot blocked forever. Reproduced instantly by playing an empty scene
with embedded PIE; latent in manual fullscreen preview too.

Game view now falls back to the editor camera instead of skipping the
frame, keeping the per-slot fence cadence intact. Viewport warning
text updated to mention the editor-view fallback.
This commit is contained in:
2026-10-05 11:21:50 +08:00
parent 1a278d5945
commit c083ee5cb7
2 changed files with 18 additions and 12 deletions
+13 -8
View File
@@ -278,16 +278,21 @@ namespace Engine
if (m_DisplayMode == kDisplayViewport && !m_GameView) {
camTransform = &m_EditorCamera.GetTransform();
camera = &m_EditorCamera.GetController();
} else if (auto* cameraComp = scene.GetPrimaryCamera(&camTransform)) {
camera = &cameraComp->camera;
}
if (!camera || !camTransform) {
// 游戏形态无 primary 相机:本帧跳过(安全网)
return false; // 拾取请求未消费,留待下一帧重试
} else {
if (auto* cameraComp = scene.GetPrimaryCamera(&camTransform)) {
camera = &cameraComp->camera;
}
if (!camera || !camTransform) {
// 游戏形态无 primary 相机:回退编辑器相机渲染(视口有
// 橙色提示引导补相机)。绝不能跳帧——跳过 submit 会漏
// 掉本槽位 fence 的 signal,下一轮该槽位 WaitFence 永
// 久阻塞 = 整个渲染死锁(空场景 Play 卡死的根因)
camTransform = &m_EditorCamera.GetTransform();
camera = &m_EditorCamera.GetController();
}
}
// 拾取请求落帧(一次性消费:本帧 HitProxy 渲染 + 像素拷贝)。
// 放在相机校验之后:跳帧时请求保留,不丢点击
// 拾取请求落帧(一次性消费:本帧 HitProxy 渲染 + 像素拷贝)
m_Frame.pickRequest = m_PendingPick;
m_PendingPick.active = false;
// 选中实体落帧(持续状态,不做一次性清除)。