mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-07 19:58:32 +09:00
[Fix] (MG_Impl/VertexArray|Buffer): Fix incorrect name zero operations.
This commit is contained in:
@@ -24,7 +24,7 @@ namespace MobileGL {
|
||||
for (SizeT i = 0; i < static_cast<SizeT>(n); ++i) {
|
||||
Uint bufferName = buffers[i];
|
||||
if (bufferName == 0) continue;
|
||||
if (!BufferImpl::ValidateBufferName(bufferName)) continue;
|
||||
if (!BufferImpl::ValidateBufferName(bufferName, true)) continue;
|
||||
MG_State::pGLContext->MarkBufferObjectForDeletion(bufferName);
|
||||
}
|
||||
}
|
||||
@@ -410,7 +410,7 @@ namespace MobileGL {
|
||||
}
|
||||
|
||||
void BindBuffer_State(GLenum target, GLuint buffer) {
|
||||
if (buffer != 0 && !BufferImpl::ValidateBufferName(buffer)) return;
|
||||
if (!BufferImpl::ValidateBufferName(buffer, true)) return;
|
||||
BufferTarget bufferTarget = MG_Util::ConvertGLEnumToBufferTarget(target);
|
||||
if (!BufferImpl::ValidateBufferTarget(bufferTarget)) return;
|
||||
|
||||
|
||||
@@ -31,7 +31,16 @@ namespace MobileGL::MG_Impl::GLImpl {
|
||||
return true;
|
||||
}
|
||||
|
||||
Bool ValidateBufferName(Uint index) {
|
||||
Bool ValidateBufferName(Uint index, Bool allowZero) {
|
||||
if (index == 0) {
|
||||
if (allowZero) return true;
|
||||
|
||||
MG_State::pGLContext->RecordError(ErrorCode::InvalidValue,
|
||||
MakeShared<GenericErrorInfo>("MG_Impl/GLImpl/BufferImpl",
|
||||
"ValidateBufferName",
|
||||
"Buffer name 0 is not valid."));
|
||||
return false;
|
||||
}
|
||||
Bool isValid = MG_State::pGLContext->ValidateBufferName(index);
|
||||
if (isValid) return true;
|
||||
MG_State::pGLContext->RecordError(
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
namespace MobileGL::MG_Impl::GLImpl {
|
||||
namespace BufferImpl {
|
||||
Bool ValidateBufferTarget(BufferTarget target);
|
||||
Bool ValidateBufferName(Uint index);
|
||||
Bool ValidateBufferName(Uint index, Bool allowZero = false);
|
||||
Bool ValidateBufferUsage(BufferUsage usage);
|
||||
Bool ValidateBufferMappingAccess(Flags<BufferMappingAccessBit> accessBits);
|
||||
} // namespace BufferImpl
|
||||
|
||||
@@ -107,7 +107,7 @@ namespace MobileGL {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!VertexArrayImpl::ValidateVertexArrayName(array)) return;
|
||||
if (!VertexArrayImpl::ValidateVertexArrayName(array, true)) return;
|
||||
|
||||
if (!MG_State::pGLContext->ValidateVertexArrayObject(array)) {
|
||||
MG_State::pGLContext->CreateVertexArrayObject(array);
|
||||
@@ -128,7 +128,7 @@ namespace MobileGL {
|
||||
GLuint vao = arrays[i];
|
||||
if (vao == 0) continue;
|
||||
|
||||
if (!VertexArrayImpl::ValidateVertexArrayName(vao)) continue;
|
||||
if (!VertexArrayImpl::ValidateVertexArrayName(vao, true)) continue;
|
||||
|
||||
if (MG_State::pGLContext->GetBoundVertexArray() &&
|
||||
MG_State::pGLContext->GetBoundVertexArray() == MG_State::pGLContext->GetVertexArrayObject(vao)) {
|
||||
|
||||
@@ -7,8 +7,10 @@
|
||||
namespace MobileGL::MG_Impl::GLImpl {
|
||||
namespace VertexArrayImpl {
|
||||
|
||||
Bool ValidateVertexArrayName(Uint index) {
|
||||
Bool ValidateVertexArrayName(Uint index, Bool allowZero) {
|
||||
if (index == 0) {
|
||||
if (allowZero) return true;
|
||||
|
||||
MG_State::pGLContext->RecordError(
|
||||
ErrorCode::InvalidValue, MakeShared<GenericErrorInfo>("MG_Impl/GLImpl", "ValidateVertexArrayName",
|
||||
"Vertex array name 0 is not supported."));
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
namespace MobileGL::MG_Impl::GLImpl {
|
||||
namespace VertexArrayImpl {
|
||||
Bool ValidateVertexArrayName(Uint index);
|
||||
Bool ValidateVertexArrayName(Uint index, Bool allowZero = false);
|
||||
Bool ValidateVertexArrayObject(Uint index);
|
||||
Bool ValidateVertexAttributeIndex(Uint index);
|
||||
Bool ValidateVertexAttribPointerParams(Uint index, SizeT size, DataType type, Int stride);
|
||||
|
||||
Reference in New Issue
Block a user