Prevent mapped buffers from getting mapped again
It is an invalid operation to map an already mapped buffer.
Change-Id: Iba1c2389e5ef9c3114a2415279406ac7f08a0ed6
Reviewed-on: https://swiftshader-review.googlesource.com/13750
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/src/OpenGL/libGLESv2/libGLESv3.cpp b/src/OpenGL/libGLESv2/libGLESv3.cpp
index c4b1207..d268656 100644
--- a/src/OpenGL/libGLESv2/libGLESv3.cpp
+++ b/src/OpenGL/libGLESv2/libGLESv3.cpp
@@ -1590,6 +1590,12 @@
return error(GL_INVALID_OPERATION, nullptr);
}
+ if(buffer->isMapped())
+ {
+ // It is an invalid operation to map an already mapped buffer
+ return error(GL_INVALID_OPERATION, nullptr);
+ }
+
GLsizeiptr bufferSize = buffer->size();
if((offset < 0) || (length < 0) || ((offset + length) > bufferSize))
{