[master] Allow glMap/UnmapBufferOES
bug: 65452704
Change-Id: I3256a57b9f24a7c8e631e01d5521d7bcf1142a27
diff --git a/system/GLESv2_enc/GL2Encoder.cpp b/system/GLESv2_enc/GL2Encoder.cpp
index 39e4cda..0e72478 100755
--- a/system/GLESv2_enc/GL2Encoder.cpp
+++ b/system/GLESv2_enc/GL2Encoder.cpp
@@ -195,6 +195,8 @@
OVERRIDEOES(glDeleteVertexArrays);
OVERRIDEOES(glBindVertexArray);
+ OVERRIDE_CUSTOM(glMapBufferOES);
+ OVERRIDE_CUSTOM(glUnmapBufferOES);
OVERRIDE_CUSTOM(glMapBufferRange);
OVERRIDE_CUSTOM(glUnmapBuffer);
OVERRIDE_CUSTOM(glFlushMappedBufferRange);
@@ -2579,6 +2581,27 @@
state->setVertexArrayObject(array);
}
+void* GL2Encoder::s_glMapBufferOES(void* self, GLenum target, GLenum access) {
+ GL2Encoder* ctx = (GL2Encoder*)self;
+
+ RET_AND_SET_ERROR_IF(!GLESv2Validation::bufferTarget(ctx, target), GL_INVALID_ENUM, NULL);
+
+ GLuint boundBuffer = ctx->m_state->getBuffer(target);
+
+ RET_AND_SET_ERROR_IF(boundBuffer == 0, GL_INVALID_OPERATION, NULL);
+
+ BufferData* buf = ctx->m_shared->getBufferData(boundBuffer);
+ RET_AND_SET_ERROR_IF(!buf, GL_INVALID_VALUE, NULL);
+
+ return ctx->glMapBufferRange(ctx, target, 0, buf->m_size, access);
+}
+
+GLboolean GL2Encoder::s_glUnmapBufferOES(void* self, GLenum target) {
+ GL2Encoder* ctx = (GL2Encoder*)self;
+
+ return ctx->glUnmapBuffer(ctx, target);
+}
+
void* GL2Encoder::s_glMapBufferRange(void* self, GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access) {
GL2Encoder* ctx = (GL2Encoder*)self;
GLClientState* state = ctx->m_state;