aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl/GrGLVertexArray.h
diff options
context:
space:
mode:
authorGravatar cdalton <cdalton@nvidia.com>2016-04-07 18:13:29 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-04-07 18:13:29 -0700
commite2e71c2df4e72e897bbe745752be0444aee5c29f (patch)
tree60591705d9f4f99246c156b8a4f98d28ce376af6 /src/gpu/gl/GrGLVertexArray.h
parent8dea4e41a11fd526fa533396173f72af0f9042d7 (diff)
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 Review URL: https://codereview.chromium.org/1854283004
Diffstat (limited to 'src/gpu/gl/GrGLVertexArray.h')
-rw-r--r--src/gpu/gl/GrGLVertexArray.h29
1 files changed, 6 insertions, 23 deletions
diff --git a/src/gpu/gl/GrGLVertexArray.h b/src/gpu/gl/GrGLVertexArray.h
index 4a99d59058..6b865bd621 100644
--- a/src/gpu/gl/GrGLVertexArray.h
+++ b/src/gpu/gl/GrGLVertexArray.h
@@ -13,6 +13,7 @@
#include "gl/GrGLTypes.h"
#include "SkTArray.h"
+class GrGLBuffer;
class GrGLGpu;
/**
@@ -39,7 +40,7 @@ public:
*/
void set(GrGLGpu*,
int attribIndex,
- GrGLuint vertexBufferID,
+ const GrGLBuffer* vertexBuffer,
GrVertexAttribType type,
GrGLsizei stride,
GrGLvoid* offset);
@@ -57,16 +58,6 @@ 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.
*/
@@ -79,13 +70,12 @@ private:
struct AttribArrayState {
void invalidate() {
fEnableIsValid = false;
- fAttribPointerIsValid = false;
+ fVertexBufferUniqueID = SK_InvalidUniqueID;
}
bool fEnableIsValid;
- bool fAttribPointerIsValid;
bool fEnabled;
- GrGLuint fVertexBufferID;
+ uint32_t fVertexBufferUniqueID;
GrVertexAttribType fType;
GrGLsizei fStride;
GrGLvoid* fOffset;
@@ -113,13 +103,7 @@ public:
* This is a version of the above function that also binds an index buffer to the vertex
* array object.
*/
- GrGLAttribArrayState* bindWithIndexBuffer(GrGLGpu* gpu, GrGLuint indexBufferID);
-
- void notifyIndexBufferDelete(GrGLuint bufferID);
-
- void notifyVertexBufferDelete(GrGLuint id) {
- fAttribArrays.notifyVertexBufferDelete(id);
- }
+ GrGLAttribArrayState* bindWithIndexBuffer(GrGLGpu* gpu, const GrGLBuffer* indexBuffer);
GrGLuint arrayID() const { return fID; }
@@ -128,8 +112,7 @@ public:
private:
GrGLuint fID;
GrGLAttribArrayState fAttribArrays;
- GrGLuint fIndexBufferID;
- bool fIndexBufferIDIsValid;
+ uint32_t fIndexBufferUniqueID;
};
#endif