| 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 "GrGLGpu.h" | 9 #include "GrGLGpu.h" |
| 10 | 10 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 if (0 == fID) { | 110 if (0 == fID) { |
| 111 return nullptr; | 111 return nullptr; |
| 112 } | 112 } |
| 113 gpu->bindVertexArray(fID); | 113 gpu->bindVertexArray(fID); |
| 114 return &fAttribArrays; | 114 return &fAttribArrays; |
| 115 } | 115 } |
| 116 | 116 |
| 117 GrGLAttribArrayState* GrGLVertexArray::bindWithIndexBuffer(GrGLGpu* gpu, GrGLuin
t ibufferID) { | 117 GrGLAttribArrayState* GrGLVertexArray::bindWithIndexBuffer(GrGLGpu* gpu, GrGLuin
t ibufferID) { |
| 118 GrGLAttribArrayState* state = this->bind(gpu); | 118 GrGLAttribArrayState* state = this->bind(gpu); |
| 119 if (state) { | 119 if (state) { |
| 120 if (!fIndexBufferIDIsValid || ibufferID != fIndexBufferID) { | 120 if (!fIndexBufferIDIsValid || ibufferID != fIndexBufferID) { |
| 121 GR_GL_CALL(gpu->glInterface(), BindBuffer(GR_GL_ELEMENT_ARRAY_BUFFER
, ibufferID)); | 121 GR_GL_CALL(gpu->glInterface(), BindBuffer(GR_GL_ELEMENT_ARRAY_BUFFER
, ibufferID)); |
| 122 fIndexBufferIDIsValid = true; | 122 fIndexBufferIDIsValid = true; |
| 123 fIndexBufferID = ibufferID; | 123 fIndexBufferID = ibufferID; |
| 124 } | 124 } |
| 125 } | 125 } |
| 126 return state; | 126 return state; |
| 127 } | 127 } |
| 128 | 128 |
| 129 void GrGLVertexArray::notifyIndexBufferDelete(GrGLuint bufferID) { | 129 void GrGLVertexArray::notifyIndexBufferDelete(GrGLuint bufferID) { |
| 130 if (fIndexBufferIDIsValid && bufferID == fIndexBufferID) { | 130 if (fIndexBufferIDIsValid && bufferID == fIndexBufferID) { |
| 131 fIndexBufferID = 0; | 131 fIndexBufferID = 0; |
| 132 } | 132 } |
| 133 } | 133 } |
| 134 | 134 |
| 135 void GrGLVertexArray::invalidateCachedState() { | 135 void GrGLVertexArray::invalidateCachedState() { |
| 136 fAttribArrays.invalidate(); | 136 fAttribArrays.invalidate(); |
| 137 fIndexBufferIDIsValid = false; | 137 fIndexBufferIDIsValid = false; |
| 138 } | 138 } |
| OLD | NEW |