fix a uninitialized memory access when no renderable are visible

This commit is contained in:
Mathias Agopian
2024-02-21 10:50:14 -08:00
parent b48b6136ba
commit fadd5eb953

View File

@@ -164,6 +164,11 @@ void RenderPass::appendCommands(FEngine& engine,
// trace the number of visible renderables
SYSTRACE_VALUE32("visibleRenderables", vr.size());
if (UTILS_UNLIKELY(vr.empty())) {
// no renderables, we still need the sentinel and the command buffer size should be
// exactly 1.
assert_invariant(commands.size() == 1);
Command* curr = commands.data();
curr->key = uint64_t(Pass::SENTINEL);
return;
}