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:
@@ -310,8 +310,8 @@ std::optional<entt::entity> ViewportPanel::Draw(const EditorContext &ctx,
|
||||
// 占一行布局 → 滚动条出现/消失循环 → avail 抖动 → 渲染分辨率
|
||||
// 每帧重报(视口疯狂顶动);且默认字体无中文字形(显示 ?)
|
||||
if (playing) {
|
||||
// 运行态无 primary 相机实体 = 游戏画面黑屏(BuildFrame
|
||||
// 跳帧),提示补相机(Hierarchy 右键或 Add Component)
|
||||
// 运行态无 primary 相机实体:渲染回退编辑器视角(保持帧
|
||||
// 管线节拍),提示补相机
|
||||
ECS::TransformComponent *camT = nullptr;
|
||||
if (ViewCamera(ctx, camT) == nullptr) {
|
||||
const ImVec2 imgMin = ImGui::GetItemRectMin();
|
||||
@@ -319,8 +319,9 @@ std::optional<entt::entity> ViewportPanel::Draw(const EditorContext &ctx,
|
||||
ImVec2(imgMin.x + 8.0f,
|
||||
imgMin.y + size.y * 0.5f),
|
||||
IM_COL32(255, 120, 80, 230),
|
||||
"No primary camera entity - add a Camera "
|
||||
"component and check 'Primary'");
|
||||
"No primary camera entity - showing editor "
|
||||
"view. Add a Camera component and check "
|
||||
"'Primary'");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user