[Chore] (MG_Test/Backend/DirectVulkan/TestExec): get rid of necessary check

This commit is contained in:
2026-02-24 12:10:44 +08:00
parent e57dd3529e
commit 2502d32a2e
@@ -429,10 +429,7 @@ namespace MobileGL::MG_Backend::DirectVulkan {
return; return;
} }
const auto drawFbo = const auto drawFbo = MG_State::pGLContext->GetFramebufferBindingSlot(FramebufferTarget::Draw).GetBoundObject();
MG_State::pGLContext
? MG_State::pGLContext->GetFramebufferBindingSlot(FramebufferTarget::Draw).GetBoundObject()
: nullptr;
const auto defaultFboInfo = MG_Impl::GLImpl::FramebufferImpl::pDefaultFramebufferInfo; const auto defaultFboInfo = MG_Impl::GLImpl::FramebufferImpl::pDefaultFramebufferInfo;
const auto defaultFbo = defaultFboInfo ? defaultFboInfo->defaultFBO : nullptr; const auto defaultFbo = defaultFboInfo ? defaultFboInfo->defaultFBO : nullptr;
const Bool drawTargetsDefault = (drawFbo == defaultFbo) || (drawFbo == nullptr && defaultFbo != nullptr); const Bool drawTargetsDefault = (drawFbo == defaultFbo) || (drawFbo == nullptr && defaultFbo != nullptr);
@@ -1273,7 +1270,7 @@ namespace MobileGL::MG_Backend::DirectVulkan {
} }
m_renderPassManager->EndRenderPass(commandBuffer); m_renderPassManager->EndRenderPass(commandBuffer);
} else if (MG_State::pGLContext) { } else {
const auto targetFbo = MG_State::pGLContext->GetFramebufferObject(targetFboExternalIndex); const auto targetFbo = MG_State::pGLContext->GetFramebufferObject(targetFboExternalIndex);
VkRenderPass offscreenRenderPass = VK_NULL_HANDLE; VkRenderPass offscreenRenderPass = VK_NULL_HANDLE;
VkFramebuffer offscreenFramebuffer = VK_NULL_HANDLE; VkFramebuffer offscreenFramebuffer = VK_NULL_HANDLE;
@@ -1387,10 +1384,6 @@ namespace MobileGL::MG_Backend::DirectVulkan {
srcImage = m_swapchainObject.GetImage(m_imageIndexAcquired); srcImage = m_swapchainObject.GetImage(m_imageIndexAcquired);
srcExtent = m_swapchainObject.GetExtent(); srcExtent = m_swapchainObject.GetExtent();
} else { } else {
if (!MG_State::pGLContext) {
MGLOG_W("BlitFramebuffer skipped: GL context unavailable for read FBO");
return false;
}
const auto readFbo = MG_State::pGLContext->GetFramebufferObject(readFboExternalIndex); const auto readFbo = MG_State::pGLContext->GetFramebufferObject(readFboExternalIndex);
if (!readFbo) { if (!readFbo) {
MGLOG_W("BlitFramebuffer skipped: read FBO %u not found", readFboExternalIndex); MGLOG_W("BlitFramebuffer skipped: read FBO %u not found", readFboExternalIndex);
@@ -1410,10 +1403,6 @@ namespace MobileGL::MG_Backend::DirectVulkan {
dstImage = m_swapchainObject.GetImage(m_imageIndexAcquired); dstImage = m_swapchainObject.GetImage(m_imageIndexAcquired);
dstExtent = m_swapchainObject.GetExtent(); dstExtent = m_swapchainObject.GetExtent();
} else { } else {
if (!MG_State::pGLContext) {
MGLOG_W("BlitFramebuffer skipped: GL context unavailable for draw FBO");
return false;
}
const auto drawFbo = MG_State::pGLContext->GetFramebufferObject(drawFboExternalIndex); const auto drawFbo = MG_State::pGLContext->GetFramebufferObject(drawFboExternalIndex);
if (!drawFbo) { if (!drawFbo) {
MGLOG_W("BlitFramebuffer skipped: draw FBO %u not found", drawFboExternalIndex); MGLOG_W("BlitFramebuffer skipped: draw FBO %u not found", drawFboExternalIndex);
@@ -1557,19 +1546,15 @@ namespace MobileGL::MG_Backend::DirectVulkan {
srcDepthFormat = m_depthStencilFormat; srcDepthFormat = m_depthStencilFormat;
} }
} else { } else {
if (!MG_State::pGLContext) { const auto readFbo = MG_State::pGLContext->GetFramebufferObject(readFboExternalIndex);
MGLOG_W("BlitFramebuffer: GL context unavailable for read depth/stencil FBO"); if (!readFbo) {
} else { MGLOG_W("BlitFramebuffer: read FBO %u not found", readFboExternalIndex);
const auto readFbo = MG_State::pGLContext->GetFramebufferObject(readFboExternalIndex); } else if (!m_framebufferManager->EnsureOffscreenColorTarget(readFboExternalIndex, *readFbo)) {
if (!readFbo) { MGLOG_W("BlitFramebuffer: failed to materialize read FBO %u for depth/stencil",
MGLOG_W("BlitFramebuffer: read FBO %u not found", readFboExternalIndex); readFboExternalIndex);
} else if (!m_framebufferManager->EnsureOffscreenColorTarget(readFboExternalIndex, *readFbo)) { } else if (!m_framebufferManager->GetOffscreenDepthStencilImage(readFboExternalIndex, srcDepthImage,
MGLOG_W("BlitFramebuffer: failed to materialize read FBO %u for depth/stencil", srcDepthExtent, srcDepthFormat)) {
readFboExternalIndex); MGLOG_W("BlitFramebuffer: read FBO %u has no depth/stencil image", readFboExternalIndex);
} else if (!m_framebufferManager->GetOffscreenDepthStencilImage(readFboExternalIndex, srcDepthImage,
srcDepthExtent, srcDepthFormat)) {
MGLOG_W("BlitFramebuffer: read FBO %u has no depth/stencil image", readFboExternalIndex);
}
} }
} }
@@ -1852,9 +1837,7 @@ namespace MobileGL::MG_Backend::DirectVulkan {
} }
MOBILEGL_ASSERT(m_framebufferManager != nullptr, "Present: framebuffer manager is null"); MOBILEGL_ASSERT(m_framebufferManager != nullptr, "Present: framebuffer manager is null");
if (!MG_State::pGLContext) {
return false;
}
const auto pendingFbo = MG_State::pGLContext->GetFramebufferObject(targetFboExternalIndex); const auto pendingFbo = MG_State::pGLContext->GetFramebufferObject(targetFboExternalIndex);
if (!pendingFbo) { if (!pendingFbo) {
return false; return false;