[Fix] (MG_Impl/GLImpl): report incomplete framebuffer attachments [skip ci]

This commit is contained in:
2026-07-02 18:29:26 +08:00
parent c3a830e9e6
commit 37255523b1
@@ -64,6 +64,15 @@ namespace MobileGL::MG_Impl::GLImpl {
HasCompleteRenderbufferAttachment(framebufferObject); HasCompleteRenderbufferAttachment(framebufferObject);
} }
Bool HasDefinedAttachment(const MG_State::GLState::FramebufferObject& framebufferObject) {
for (const auto& attachment : framebufferObject.GetAllAttachmentObjects()) {
if (attachment.IsValid() && !attachment.IsEmpty()) {
return true;
}
}
return false;
}
void RecordUnsupportedFramebufferTextureAttachmentError(const char* functionName, const char* detail) { void RecordUnsupportedFramebufferTextureAttachmentError(const char* functionName, const char* detail) {
MG_State::pGLContext->RecordError( MG_State::pGLContext->RecordError(
ErrorCode::InvalidOperation, ErrorCode::InvalidOperation,
@@ -1199,7 +1208,9 @@ namespace MobileGL::MG_Impl::GLImpl {
// additional GL_FRAMEBUFFER_UNSUPPORTED cases, GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE, // additional GL_FRAMEBUFFER_UNSUPPORTED cases, GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE,
// GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS // GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS
if (!framebufferObject->CheckCompleteness()) { if (!framebufferObject->CheckCompleteness()) {
return GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT; return HasDefinedAttachment(*framebufferObject) ?
GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT :
GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT;
} }
if (IsActiveBackendDirectVulkan() && if (IsActiveBackendDirectVulkan() &&
IsUnsupportedFramebufferForDirectVulkan(*framebufferObject)) { IsUnsupportedFramebufferForDirectVulkan(*framebufferObject)) {
@@ -1222,7 +1233,9 @@ namespace MobileGL::MG_Impl::GLImpl {
if (!framebufferObject) return GL_FRAMEBUFFER_UNDEFINED; if (!framebufferObject) return GL_FRAMEBUFFER_UNDEFINED;
if (!framebufferObject->CheckCompleteness()) { if (!framebufferObject->CheckCompleteness()) {
return GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT; return HasDefinedAttachment(*framebufferObject) ?
GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT :
GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT;
} }
if (IsActiveBackendDirectVulkan() && if (IsActiveBackendDirectVulkan() &&
IsUnsupportedFramebufferForDirectVulkan(*framebufferObject)) { IsUnsupportedFramebufferForDirectVulkan(*framebufferObject)) {