From 2a1bd12f5b648375e7e036f3a3781c545e435abf Mon Sep 17 00:00:00 2001 From: Kelsi Date: Mon, 23 Feb 2026 20:41:06 -0800 Subject: [PATCH] Fix game objects rendering with player textures MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When M2Renderer's descriptor pool was exhausted, batch.materialSet would be VK_NULL_HANDLE and the bind was skipped, but the draw call still executed using the previously bound descriptor set from CharacterRenderer — causing game objects to render with the player's skin/armor textures. Skip the entire batch instead. --- src/rendering/m2_renderer.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/rendering/m2_renderer.cpp b/src/rendering/m2_renderer.cpp index 2cbc1188..378a7b41 100644 --- a/src/rendering/m2_renderer.cpp +++ b/src/rendering/m2_renderer.cpp @@ -2381,11 +2381,11 @@ void M2Renderer::render(VkCommandBuffer cmd, VkDescriptorSet perFrameSet, const } } - // Bind material descriptor set (set 1) - if (batch.materialSet) { - vkCmdBindDescriptorSets(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, - pipelineLayout_, 1, 1, &batch.materialSet, 0, nullptr); - } + // Bind material descriptor set (set 1) — skip batch if missing + // to avoid inheriting a stale descriptor set from a prior renderer + if (!batch.materialSet) continue; + vkCmdBindDescriptorSets(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, + pipelineLayout_, 1, 1, &batch.materialSet, 0, nullptr); // Push constants M2PushConstants pc;