[Fix] (MG_State/BufferState, VertexArrayState): Correct IBO binding slot.

This commit is contained in:
BZLZHH
2025-08-03 18:56:50 +08:00
parent 972a4efed1
commit 3d18e702b0
13 changed files with 168 additions and 61 deletions
+18 -10
View File
@@ -3,17 +3,25 @@
namespace MobileGL::MG_Impl::GLImpl {
namespace BufferImpl {
bool ValidateBufferTarget(BufferTarget target) {
if (target != BufferTarget::Unknown)
return true;
if (target == BufferTarget::Unknown) {
using namespace MG_Util;
String bufferTargetStr = ConvertBufferTargetToString(target);
String glTargetStr = ConvertGLEnumToString(ConvertBufferTargetToGLEnum(target));
MG_State::pGLContext->RecordError(ErrorCode::InvalidEnum,
MakeShared<GenericErrorInfo>("MG_Impl/GLImpl/BufferImpl", "ValidateBufferTarget",
std::format("Target {} ({}) is not valid.",
bufferTargetStr, glTargetStr)));
return false;
}
if (target == BufferTarget::Index && MG_State::pGLContext->GetBoundVertexArray() == nullptr) {
MG_State::pGLContext->RecordError(ErrorCode::InvalidOperation,
MakeShared<GenericErrorInfo>("MG_Impl/GLImpl/BufferImpl", "ValidateBufferTarget",
"No vertex array object is bound."));
return false;
}
using namespace MG_Util;
String bufferTargetStr = ConvertBufferTargetToString(target);
String glTargetStr = ConvertGLEnumToString(ConvertBufferTargetToGLEnum(target));
MG_State::pGLContext->RecordError(ErrorCode::InvalidEnum,
MakeShared<GenericErrorInfo>("MG_Impl/GLImpl/BufferImpl", "ValidateBufferTarget",
std::format("Target {} ({}) is not valid.",
bufferTargetStr, glTargetStr)));
return false;
return true;
}
bool ValidateBufferName(Uint index) {