[Feat] (MG_Impl/Framebuffer): implement glDrawBuffer

This commit is contained in:
2026-01-04 23:21:19 +08:00
parent 52d98ee7c3
commit 2657edc003
2 changed files with 16 additions and 2 deletions
@@ -234,7 +234,7 @@ namespace MobileGL {
MG_State::pGLContext->RecordError(
ErrorCode::InvalidEnum,
MakeShared<GenericErrorInfo>("MG_Impl/GLImpl", __func__,
std::format("bufs[{}] = %s is not an accepted value.", i,
std::format("bufs[{}] = {} is not an accepted value.", i,
MG_Util::ConvertGLEnumToString(bufs[i]))));
return;
}
@@ -294,6 +294,15 @@ namespace MobileGL {
}
}
void DrawBuffer_State(GLenum buf) {
if (buf == GL_NONE) {
DrawBuffers_State(0, nullptr);
} else {
static GLenum bufs[] = {buf};
DrawBuffers_State(1, bufs);
}
}
void DeleteRenderbuffers_State(GLsizei n, const GLuint* renderbuffers) {
if (n < 0) {
MG_State::pGLContext->RecordError(
@@ -449,7 +458,7 @@ namespace MobileGL {
ErrorCode::InvalidEnum,
MakeShared<GenericErrorInfo>(
"MG_Impl/GLImpl", "GetRenderbufferParameteriv_State",
std::format("pname %s is not an accepted value.", MG_Util::ConvertGLEnumToString(pname))));
std::format("pname {} is not an accepted value.", MG_Util::ConvertGLEnumToString(pname))));
return;
}
}
@@ -557,6 +566,10 @@ namespace MobileGL {
FramebufferRenderbuffer_State(target, attachment, renderbuffertarget, renderbuffer);
}
void DrawBuffer(GLenum buf) {
DrawBuffer_State(buf);
}
void DrawBuffers(GLsizei n, const GLenum* bufs) {
DrawBuffers_State(n, bufs);
}