[Chore] (MG_Backend/DirectVulkan): get rid of unnecessary checks

This commit is contained in:
2026-03-04 16:19:35 +08:00
parent 09f96e5ba5
commit 139f3f978d
@@ -315,28 +315,26 @@ namespace MobileGL::MG_Backend::DirectVulkan {
clearValue.color = {0.0f, 0.0f, 0.0f, 1.0f}; clearValue.color = {0.0f, 0.0f, 0.0f, 1.0f};
clearValue.depthStencil = {1.0f, 0}; clearValue.depthStencil = {1.0f, 0};
} }
if (s_clearManager) { for (const auto& pending: renderPassEntry.pendingClearAttachments) {
for (const auto& pending: renderPassEntry.pendingClearAttachments) { if (!pending.texture || pending.attachmentIndex >= clearValues.size()) {
if (!pending.texture || pending.attachmentIndex >= clearValues.size()) { continue;
continue; }
} ClearAttachmentPayload clearPayload{};
ClearAttachmentPayload clearPayload{}; if (!s_clearManager->GetPendingClear(pending.texture, clearPayload)) {
if (!s_clearManager->GetPendingClear(pending.texture, clearPayload)) { continue;
continue; }
} if (clearPayload.attachmentType >= FramebufferAttachmentType::Color0 &&
if (clearPayload.attachmentType >= FramebufferAttachmentType::Color0 && clearPayload.attachmentType <= FramebufferAttachmentType::Color31) {
clearPayload.attachmentType <= FramebufferAttachmentType::Color31) { clearValues[pending.attachmentIndex].color = {
clearValues[pending.attachmentIndex].color = { clearPayload.color.x(),
clearPayload.color.x(), clearPayload.color.y(),
clearPayload.color.y(), clearPayload.color.z(),
clearPayload.color.z(), clearPayload.color.w()
clearPayload.color.w() };
}; } else if (clearPayload.attachmentType == FramebufferAttachmentType::Depth) {
} else if (clearPayload.attachmentType == FramebufferAttachmentType::Depth) { clearValues[pending.attachmentIndex].depthStencil.depth = clearPayload.depth;
clearValues[pending.attachmentIndex].depthStencil.depth = clearPayload.depth; } else if (clearPayload.attachmentType == FramebufferAttachmentType::Stencil) {
} else if (clearPayload.attachmentType == FramebufferAttachmentType::Stencil) { clearValues[pending.attachmentIndex].depthStencil.stencil = clearPayload.stencil;
clearValues[pending.attachmentIndex].depthStencil.stencil = clearPayload.stencil;
}
} }
} }
@@ -344,10 +342,8 @@ namespace MobileGL::MG_Backend::DirectVulkan {
renderPassBeginInfo.pClearValues = clearValues.data(); renderPassBeginInfo.pClearValues = clearValues.data();
vkCmdBeginRenderPass(commandBuffer, &renderPassBeginInfo, VK_SUBPASS_CONTENTS_INLINE); vkCmdBeginRenderPass(commandBuffer, &renderPassBeginInfo, VK_SUBPASS_CONTENTS_INLINE);
if (s_clearManager) { for (const auto& pending: renderPassEntry.pendingClearAttachments) {
for (const auto& pending: renderPassEntry.pendingClearAttachments) { s_clearManager->PopPendingClear(pending.texture);
s_clearManager->PopPendingClear(pending.texture);
}
} }
s_activeRenderPass = &renderPassEntry; s_activeRenderPass = &renderPassEntry;