From 0b7f906533c463b9594f3195fb4c2034a7be38ff Mon Sep 17 00:00:00 2001 From: Swung0x48 Date: Tue, 3 Mar 2026 09:43:25 +0800 Subject: [PATCH] [Fix] (MG_Backend/DirectVulkan): use proper scissor state to fix menu --- .../DirectVulkan/Renderer/VulkanRenderer.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/MobileGL/MG_Backend/DirectVulkan/Renderer/VulkanRenderer.cpp b/MobileGL/MG_Backend/DirectVulkan/Renderer/VulkanRenderer.cpp index 667e7513..5ab70d3e 100644 --- a/MobileGL/MG_Backend/DirectVulkan/Renderer/VulkanRenderer.cpp +++ b/MobileGL/MG_Backend/DirectVulkan/Renderer/VulkanRenderer.cpp @@ -547,9 +547,16 @@ namespace MobileGL::MG_Backend::DirectVulkan { viewport.maxDepth = 1.0f; vkCmdSetViewport(frame.commandBuffer, 0, 1, &viewport); + Bool scissorEnabled = MG_State::pGLContext->IsCapabilityEnabled(CapabilityInput::ScissorTest); VkRect2D scissor{}; - scissor.offset = {0, 0}; - scissor.extent = { (Uint)renderPassEntry.extent.x(), (Uint)renderPassEntry.extent.y() }; + if (scissorEnabled) { + const auto& scissorBox = MG_State::pGLContext->GetScissorBox(); + scissor.offset = { scissorBox[0], scissorBox[1] }; + scissor.extent = { (Uint)scissorBox[2], (Uint)scissorBox[3] }; + } else { + scissor.offset = {0, 0}; + scissor.extent = { (Uint)renderPassEntry.extent.x(), (Uint)renderPassEntry.extent.y() }; + } vkCmdSetScissor(frame.commandBuffer, 0, 1, &scissor); }