OverviewFilesCommitsIssuesDocsReleasesPeers

nvidia-rtx-godot commits / d267b4a

Guard the TLAS set with uniform_set_is_valid, not is_valid
The guard added in the previous commit used rt_uniform_set.is_valid(), which only tests that the RID is non-zero. raytracing_list_bind_uniform_set fails on an OWNER lookup instead: UniformSet *uniform_set = uniform_set_owner.get_or_null(p_uniform_set); ERR_FAIL_NULL(uniform_set); so a stale RID -- one freed or externally invalidated since it was recorded -- sails through is_valid() and gets bound anyway. Observed in a PT run: the guard was compiled in and never fired, yet ERROR: Parameter "uniform_set" is null. ERROR: Uniforms were never supplied for set (0) ... still appeared twice, i.e. the trace dispatched with no set 0 bound. uniform_set_is_valid() is the test that catches it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
d267b4af5f603f414165a02dbfb00537fa4b0339
by plankatron <fleeky@gmail.com> · 2026-07-29T14:15:54.000Z

Changed files (1) +6 -2

servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp +6 -2
……@@ -2537,8 +2537,12 @@ void RenderForwardClustered::_render_scene(RenderDataRD *p_render_data, const Co
25372537 // than merely defensive -- but if this fires on a frame that SHOULD have
25382538 // geometry, the trace is being skipped and the real question is why the
25392539 // TLAS had no instances.
2540 if (!rt_uniform_set.is_valid()) {
2541 ERR_PRINT_ONCE("Raytracing: no TLAS uniform set for this frame - skipping the trace.");
2540 // uniform_set_is_valid(), NOT is_valid(): the bind fails on an owner lookup
2541 // (uniform_set_owner.get_or_null -> ERR_FAIL_NULL), so a stale RID that was
2542 // freed or externally invalidated is still "valid" to is_valid() and gets
2543 // bound anyway. That is the failure this guard exists to catch.
2544 if (!RD::get_singleton()->uniform_set_is_valid(rt_uniform_set)) {
2545 ERR_PRINT_ONCE("Raytracing: no usable TLAS uniform set for this frame - skipping the trace.");
25422546 RD::get_singleton()->draw_command_end_label();
25432547 return;
25442548 }