[Fix] (MG_Util/Converters): Fix incorrect functions in MGToGL/FramebufferEnumConverter.cpp

This commit is contained in:
BZLZHH
2025-10-02 22:47:33 +08:00
parent 87f487c3aa
commit e2e7ee93db
@@ -2,36 +2,35 @@
namespace MobileGL { namespace MobileGL {
namespace MG_Util { namespace MG_Util {
FramebufferTarget ConvertGLEnumToFramebufferTarget(GLenum framebufferTarget) { GLenum ConvertFramebufferTargetToGLEnum(FramebufferTarget target) {
switch (framebufferTarget) { switch (target) {
case GL_FRAMEBUFFER: case FramebufferTarget::Draw:
case GL_DRAW_FRAMEBUFFER: return GL_DRAW_FRAMEBUFFER;
return FramebufferTarget::Draw; case FramebufferTarget::Read:
case GL_READ_FRAMEBUFFER: return GL_READ_FRAMEBUFFER;
return FramebufferTarget::Read;
case GL_UNKNOWN_MGL:
default: default:
return FramebufferTarget::Unknown; return GL_DRAW_FRAMEBUFFER;
} }
} }
FramebufferAttachmentType ConvertGLEnumToFramebufferAttachmentType(GLenum attachment) { GLenum ConvertFramebufferAttachmentTypeToGLEnum(FramebufferAttachmentType type) {
if (attachment >= GL_COLOR_ATTACHMENT0 && attachment <= GL_COLOR_ATTACHMENT31) { if (static_cast<Int>(type) >= static_cast<Int>(FramebufferAttachmentType::Color0) &&
return static_cast<FramebufferAttachmentType>(static_cast<SizeT>(FramebufferAttachmentType::Color0) + static_cast<Int>(type) <= static_cast<Int>(FramebufferAttachmentType::Color31)) {
(attachment - GL_COLOR_ATTACHMENT0)); return GL_COLOR_ATTACHMENT0 +
(static_cast<GLenum>(type) - static_cast<GLenum>(FramebufferAttachmentType::Color0));
} }
switch (attachment) { switch (type) {
case GL_DEPTH_ATTACHMENT: case FramebufferAttachmentType::Depth:
return FramebufferAttachmentType::Depth; return GL_DEPTH_ATTACHMENT;
case GL_STENCIL_ATTACHMENT: case FramebufferAttachmentType::Stencil:
return FramebufferAttachmentType::Stencil; return GL_STENCIL_ATTACHMENT;
case GL_DEPTH_STENCIL_ATTACHMENT: case FramebufferAttachmentType::DepthStencil:
return FramebufferAttachmentType::DepthStencil; return GL_DEPTH_STENCIL_ATTACHMENT;
case GL_UNKNOWN_MGL:
default: default:
return FramebufferAttachmentType::Unknown; return GL_COLOR_ATTACHMENT0;
} }
} }
} // namespace MG_Util } // namespace MG_Util
} // namespace MobileGL } // namespace MobileGL