From f1eb3b0d0db37eef5f4443cf282ac69c0a47246a Mon Sep 17 00:00:00 2001 From: Chaos02 Date: Fri, 17 Jul 2026 13:53:25 +0200 Subject: [PATCH] Guard against binding a graphics pipeline with no active render pass Rendering the GUI while no render pass is bound (window occluded, minimized, or the title bar being dragged) makes bindGraphicsPipeline build a PipelineState from a null render pass, which then NPEs in GraphicsPipeline.createGraphicsPipeline at state.renderPass.getId(). Skip the bind when nothing is bound. Without a render pass there is no valid target to record a draw into, so there is nothing useful to do here anyway. getHandle is only reached from bindGraphicsPipeline, and the eager compile in the GraphicsPipeline constructor is gated on builder.renderPass, so this covers the whole path to the NPE. --- src/main/java/net/vulkanmod/vulkan/Renderer.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/net/vulkanmod/vulkan/Renderer.java b/src/main/java/net/vulkanmod/vulkan/Renderer.java index 0edaa3460..b7684355c 100644 --- a/src/main/java/net/vulkanmod/vulkan/Renderer.java +++ b/src/main/java/net/vulkanmod/vulkan/Renderer.java @@ -632,6 +632,14 @@ public void addOnResizeCallback(Runnable runnable) { } public void bindGraphicsPipeline(GraphicsPipeline pipeline) { + // No active render pass, e.g. the GUI still renders while the window is + // occluded or the title bar is being dragged. Binding here would build a + // PipelineState with a null render pass and NPE in + // GraphicsPipeline.createGraphicsPipeline at state.renderPass.getId(). + // There is nothing to record into without a pass, so skip the bind. + if (boundRenderPass == null) + return; + VkCommandBuffer commandBuffer = currentCmdBuffer; PipelineState currentState = PipelineState.getCurrentPipelineState(boundRenderPass);