aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl/GrGLVertexArray.h
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@google.com>2016-04-06 18:24:34 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-04-06 18:24:34 -0700
commit044d3c185876f9960f07b88f068cf08d78311e33 (patch)
tree94deb4d2c100f848df9abf863470de1af0d3e0f2 /src/gpu/gl/GrGLVertexArray.h
parent6e077e140a6b603192e2395ba0adac7b670b3f03 (diff)
Revert of Track GL buffer state based on unique resource ID (patchset #6 id:100001 of https://codereview.chromium.org/1854283004/ )
Reason for revert: Chrome roll's broken, seems to be missing fTarget: https://codereview.chromium.org/1861473005 Original issue's description: > Track GL buffer state based on unique resource ID > > Reworks GrGLGpu to track GL buffer state based on the unique > GrGpuResource ID. This eliminates the need to notify the gpu object > whenever a buffer is deleted. > > This change also allows us to remove the type specifier from GrBuffer. > At this point a buffer is just a chunk of memory, and the type > given at creation time is just a suggestion to the GL backend about > which target to bind to for updates. > > BUG=skia: > GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1854283004 > > Committed: https://skia.googlesource.com/skia/+/deacc97bc63513b5eacaf21f858727f6e8b98ce5 TBR=bsalomon@google.com,jvanverth@google.com,cdalton@nvidia.com # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review URL: https://codereview.chromium.org/1870553002
Diffstat (limited to 'src/gpu/gl/GrGLVertexArray.h')
-rw-r--r--src/gpu/gl/GrGLVertexArray.h29
1 files changed, 23 insertions, 6 deletions
diff --git a/src/gpu/gl/GrGLVertexArray.h b/src/gpu/gl/GrGLVertexArray.h
index 6b865bd621..4a99d59058 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 @@ public:
*/
void set(GrGLGpu*,
int attribIndex,
- const GrGLBuffer* vertexBuffer,
+ GrGLuint vertexBufferID,
GrVertexAttribType type,
GrGLsizei stride,
GrGLvoid* offset);
@@ -58,6 +57,16 @@ public:
}
}
+ 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 @@ private:
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 @@ public:
* 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 @@ public:
private:
GrGLuint fID;
GrGLAttribArrayState fAttribArrays;
- uint32_t fIndexBufferUniqueID;
+ GrGLuint fIndexBufferID;
+ bool fIndexBufferIDIsValid;
};
#endif