From 98f2a6c3bf8984c507124bf2d797280f5573ff86 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Wed, 6 May 2026 08:01:23 -0700 Subject: [PATCH] fix(gizmo): hide on NaN target instead of building NaN geometry MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit setTarget previously stored the position raw, then updateBuffers ran glm::normalize on axis offsets. NaN target → NaN normalized axes → NaN gizmo vertices → Vulkan validation drops the whole draw and the gizmo is invisible regardless of target value. Hide the gizmo upfront so the user sees no gizmo (which is the intent of the NaN handling) without leaking garbage into the vertex buffer. --- tools/editor/transform_gizmo.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/editor/transform_gizmo.cpp b/tools/editor/transform_gizmo.cpp index 31639190..ff8ed50c 100644 --- a/tools/editor/transform_gizmo.cpp +++ b/tools/editor/transform_gizmo.cpp @@ -31,6 +31,14 @@ void TransformGizmo::shutdown() { } void TransformGizmo::setTarget(const glm::vec3& position, float scale) { + // Hide the gizmo on a NaN target. updateBuffers calls glm::normalize on + // axis offsets — non-finite targetPos_ would propagate NaN into the + // gizmo geometry and Vulkan validation would drop the whole batch. + if (!std::isfinite(position.x) || !std::isfinite(position.y) || + !std::isfinite(position.z) || !std::isfinite(scale) || scale <= 0.0f) { + visible_ = false; + return; + } targetPos_ = position; targetScale_ = scale; visible_ = true;