From fa3e00e2c4027d3a3cf4d1f903b1f28d4fa8c486 Mon Sep 17 00:00:00 2001 From: clayjohn Date: Tue, 11 Jun 2024 12:46:56 -0700 Subject: [PATCH] Ensure Motion Vectors are enabled by particles and skeletons when using the Motion Vector debug draw option --- servers/rendering/renderer_viewport.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/servers/rendering/renderer_viewport.cpp b/servers/rendering/renderer_viewport.cpp index 884f8adb8c4..80c1f67d8a6 100644 --- a/servers/rendering/renderer_viewport.cpp +++ b/servers/rendering/renderer_viewport.cpp @@ -971,7 +971,7 @@ void RendererViewport::_viewport_set_size(Viewport *p_viewport, int p_width, int } bool RendererViewport::_viewport_requires_motion_vectors(Viewport *p_viewport) { - return p_viewport->use_taa || p_viewport->scaling_3d_mode == RenderingServer::VIEWPORT_SCALING_3D_MODE_FSR2; + return p_viewport->use_taa || p_viewport->scaling_3d_mode == RenderingServer::VIEWPORT_SCALING_3D_MODE_FSR2 || p_viewport->debug_draw == RenderingServer::VIEWPORT_DEBUG_DRAW_MOTION_VECTORS; } void RendererViewport::viewport_set_active(RID p_viewport, bool p_active) { @@ -1370,7 +1370,13 @@ void RendererViewport::viewport_set_debug_draw(RID p_viewport, RS::ViewportDebug Viewport *viewport = viewport_owner.get_or_null(p_viewport); ERR_FAIL_NULL(viewport); + bool motion_vectors_before = _viewport_requires_motion_vectors(viewport); viewport->debug_draw = p_draw; + + bool motion_vectors_after = _viewport_requires_motion_vectors(viewport); + if (motion_vectors_before != motion_vectors_after) { + num_viewports_with_motion_vectors += motion_vectors_after ? 1 : -1; + } } void RendererViewport::viewport_set_measure_render_time(RID p_viewport, bool p_enable) {