mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-11 21:58:31 +09:00
[Fix] (MG_State/Buffer): Prevent crashing when buffer obj is not created but is going to be deleted.
This commit is contained in:
@@ -250,13 +250,15 @@ bool BufferState::ValidateGeneratedName(GLuint buffer) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void BufferState::Delete(GLuint buffer) {
|
void BufferState::Delete(GLuint buffer) {
|
||||||
bufferObjects_[buffer].reset();
|
MG_Util::Debug::LogD("MG_State: Buffer: Delete buffer %u", buffer);
|
||||||
|
if (bufferObjects_.size() > buffer)
|
||||||
|
bufferObjects_[buffer].reset();
|
||||||
indexGenerator_.Delete(buffer);
|
indexGenerator_.Delete(buffer);
|
||||||
|
|
||||||
for (auto& [target, id] : currentBindings_) {
|
for (auto& [target, id] : currentBindings_) {
|
||||||
if (id == buffer) id = 0;
|
if (id == buffer) id = 0;
|
||||||
}
|
}
|
||||||
MG_Util::Debug::LogD("MG_State: Buffer: Delete buffer %u", buffer);
|
MG_Util::Debug::LogD("MG_State: Buffer: Delete buffer %u successfully", buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
GLenum BufferState::DeleteN(GLsizei n, const GLuint* buffers) {
|
GLenum BufferState::DeleteN(GLsizei n, const GLuint* buffers) {
|
||||||
|
|||||||
Reference in New Issue
Block a user