Index: src/gpu/gl/GrGLVertexArray.h |
diff --git a/src/gpu/gl/GrGLVertexArray.h b/src/gpu/gl/GrGLVertexArray.h |
index 6b865bd62138d6a9c44d903fc4bb979fc7b28706..4a99d59058e2fc695bde13070ab6a29383bf3f2b 100644 |
--- a/src/gpu/gl/GrGLVertexArray.h |
+++ b/src/gpu/gl/GrGLVertexArray.h |
@@ -13,7 +13,6 @@ |
#include "gl/GrGLTypes.h" |
#include "SkTArray.h" |
-class GrGLBuffer; |
class GrGLGpu; |
/** |
@@ -40,7 +39,7 @@ |
*/ |
void set(GrGLGpu*, |
int attribIndex, |
- const GrGLBuffer* vertexBuffer, |
+ GrGLuint vertexBufferID, |
GrVertexAttribType type, |
GrGLsizei stride, |
GrGLvoid* offset); |
@@ -58,6 +57,16 @@ |
} |
} |
+ void notifyVertexBufferDelete(GrGLuint id) { |
+ int count = fAttribArrayStates.count(); |
+ for (int i = 0; i < count; ++i) { |
+ if (fAttribArrayStates[i].fAttribPointerIsValid && |
+ id == fAttribArrayStates[i].fVertexBufferID) { |
+ fAttribArrayStates[i].invalidate(); |
+ } |
+ } |
+ } |
+ |
/** |
* The number of attrib arrays that this object is configured to track. |
*/ |
@@ -70,12 +79,13 @@ |
struct AttribArrayState { |
void invalidate() { |
fEnableIsValid = false; |
- fVertexBufferUniqueID = SK_InvalidUniqueID; |
+ fAttribPointerIsValid = false; |
} |
bool fEnableIsValid; |
+ bool fAttribPointerIsValid; |
bool fEnabled; |
- uint32_t fVertexBufferUniqueID; |
+ GrGLuint fVertexBufferID; |
GrVertexAttribType fType; |
GrGLsizei fStride; |
GrGLvoid* fOffset; |
@@ -103,7 +113,13 @@ |
* This is a version of the above function that also binds an index buffer to the vertex |
* array object. |
*/ |
- GrGLAttribArrayState* bindWithIndexBuffer(GrGLGpu* gpu, const GrGLBuffer* indexBuffer); |
+ GrGLAttribArrayState* bindWithIndexBuffer(GrGLGpu* gpu, GrGLuint indexBufferID); |
+ |
+ void notifyIndexBufferDelete(GrGLuint bufferID); |
+ |
+ void notifyVertexBufferDelete(GrGLuint id) { |
+ fAttribArrays.notifyVertexBufferDelete(id); |
+ } |
GrGLuint arrayID() const { return fID; } |
@@ -112,7 +128,8 @@ |
private: |
GrGLuint fID; |
GrGLAttribArrayState fAttribArrays; |
- uint32_t fIndexBufferUniqueID; |
+ GrGLuint fIndexBufferID; |
+ bool fIndexBufferIDIsValid; |
}; |
#endif |