diff options
author | bohu <bohu@google.com> | 2014-11-17 22:45:41 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-11-17 22:45:41 +0000 |
commit | 6aedefacbd932dd340d0f7e96b6f6aff2aba4558 (patch) | |
tree | de29eb0494c285d5571034940bc055c0af8adc67 /opengl | |
parent | 363a70bcd4f1dbde18868a236e556edcd775ce3d (diff) | |
parent | 5fa17220c5f91d5ce2dc9737d6dc38edfe6d547d (diff) | |
download | android_device_generic_goldfish-6aedefacbd932dd340d0f7e96b6f6aff2aba4558.tar.gz android_device_generic_goldfish-6aedefacbd932dd340d0f7e96b6f6aff2aba4558.tar.bz2 android_device_generic_goldfish-6aedefacbd932dd340d0f7e96b6f6aff2aba4558.zip |
Merge "Unbind buffer when buffer is deleted"
Diffstat (limited to 'opengl')
-rw-r--r-- | opengl/shared/OpenglCodecCommon/GLClientState.h | 6 | ||||
-rw-r--r-- | opengl/system/GLESv2_enc/GL2Encoder.cpp | 3 |
2 files changed, 9 insertions, 0 deletions
diff --git a/opengl/shared/OpenglCodecCommon/GLClientState.h b/opengl/shared/OpenglCodecCommon/GLClientState.h index c86329b..09ee571 100644 --- a/opengl/shared/OpenglCodecCommon/GLClientState.h +++ b/opengl/shared/OpenglCodecCommon/GLClientState.h @@ -91,6 +91,12 @@ public: void setActiveTexture(int texUnit) {m_activeTexture = texUnit; }; int getActiveTexture() const { return m_activeTexture; } + void unBindBuffer(GLuint id) + { + if (m_currentArrayVbo == id) m_currentArrayVbo = 0; + else if (m_currentIndexVbo == id) m_currentIndexVbo = 0; + } + int bindBuffer(GLenum target, GLuint id) { int err = 0; diff --git a/opengl/system/GLESv2_enc/GL2Encoder.cpp b/opengl/system/GLESv2_enc/GL2Encoder.cpp index 9490571..20e4063 100644 --- a/opengl/system/GLESv2_enc/GL2Encoder.cpp +++ b/opengl/system/GLESv2_enc/GL2Encoder.cpp @@ -191,6 +191,7 @@ void GL2Encoder::s_glBindBuffer(void *self, GLenum target, GLuint id) void GL2Encoder::s_glBufferData(void * self, GLenum target, GLsizeiptr size, const GLvoid * data, GLenum usage) { GL2Encoder *ctx = (GL2Encoder *) self; + SET_ERROR_IF(!(target == GL_ARRAY_BUFFER || target == GL_ELEMENT_ARRAY_BUFFER), GL_INVALID_ENUM); GLuint bufferId = ctx->m_state->getBuffer(target); SET_ERROR_IF(bufferId==0, GL_INVALID_OPERATION); SET_ERROR_IF(size<0, GL_INVALID_VALUE); @@ -202,6 +203,7 @@ void GL2Encoder::s_glBufferData(void * self, GLenum target, GLsizeiptr size, con void GL2Encoder::s_glBufferSubData(void * self, GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid * data) { GL2Encoder *ctx = (GL2Encoder *) self; + SET_ERROR_IF(!(target == GL_ARRAY_BUFFER || target == GL_ELEMENT_ARRAY_BUFFER), GL_INVALID_ENUM); GLuint bufferId = ctx->m_state->getBuffer(target); SET_ERROR_IF(bufferId==0, GL_INVALID_OPERATION); @@ -217,6 +219,7 @@ void GL2Encoder::s_glDeleteBuffers(void * self, GLsizei n, const GLuint * buffer SET_ERROR_IF(n<0, GL_INVALID_VALUE); for (int i=0; i<n; i++) { ctx->m_shared->deleteBufferData(buffers[i]); + ctx->m_state->unBindBuffer(buffers[i]); ctx->m_glDeleteBuffers_enc(self,1,&buffers[i]); } } |