| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "GrGLVertexArray.h" | 8 #include "GrGLVertexArray.h" |
| 9 #include "GrGpuGL.h" | 9 #include "GrGpuGL.h" |
| 10 | 10 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 GrGLAttribArrayState* GrGLVertexArray::bind() { | 93 GrGLAttribArrayState* GrGLVertexArray::bind() { |
| 94 if (0 == fID) { | 94 if (0 == fID) { |
| 95 return NULL; | 95 return NULL; |
| 96 } | 96 } |
| 97 GPUGL->bindVertexArray(fID); | 97 GPUGL->bindVertexArray(fID); |
| 98 return &fAttribArrays; | 98 return &fAttribArrays; |
| 99 } | 99 } |
| 100 | 100 |
| 101 GrGLAttribArrayState* GrGLVertexArray::bindWithIndexBuffer(const GrGLIndexBuffer
* buffer) { | 101 GrGLAttribArrayState* GrGLVertexArray::bindWithIndexBuffer(const GrGLIndexBuffer
* buffer) { |
| 102 GrGLAttribArrayState* state = this->bind(); | 102 GrGLAttribArrayState* state = this->bind(); |
| 103 if (NULL != state && NULL != buffer) { | 103 if (state && buffer) { |
| 104 GrGLuint bufferID = buffer->bufferID(); | 104 GrGLuint bufferID = buffer->bufferID(); |
| 105 if (!fIndexBufferIDIsValid || bufferID != fIndexBufferID) { | 105 if (!fIndexBufferIDIsValid || bufferID != fIndexBufferID) { |
| 106 GL_CALL(BindBuffer(GR_GL_ELEMENT_ARRAY_BUFFER, bufferID)); | 106 GL_CALL(BindBuffer(GR_GL_ELEMENT_ARRAY_BUFFER, bufferID)); |
| 107 fIndexBufferIDIsValid = true; | 107 fIndexBufferIDIsValid = true; |
| 108 fIndexBufferID = bufferID; | 108 fIndexBufferID = bufferID; |
| 109 } | 109 } |
| 110 } | 110 } |
| 111 return state; | 111 return state; |
| 112 } | 112 } |
| 113 | 113 |
| 114 void GrGLVertexArray::notifyIndexBufferDelete(GrGLuint bufferID) { | 114 void GrGLVertexArray::notifyIndexBufferDelete(GrGLuint bufferID) { |
| 115 if (fIndexBufferIDIsValid && bufferID == fIndexBufferID) { | 115 if (fIndexBufferIDIsValid && bufferID == fIndexBufferID) { |
| 116 fIndexBufferID = 0; | 116 fIndexBufferID = 0; |
| 117 } | 117 } |
| 118 } | 118 } |
| 119 | 119 |
| 120 void GrGLVertexArray::invalidateCachedState() { | 120 void GrGLVertexArray::invalidateCachedState() { |
| 121 fAttribArrays.invalidate(); | 121 fAttribArrays.invalidate(); |
| 122 fIndexBufferIDIsValid = false; | 122 fIndexBufferIDIsValid = false; |
| 123 } | 123 } |
| OLD | NEW |