aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl/GrGLVertexArray.cpp
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2015-05-13 09:56:37 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-05-13 09:56:37 -0700
commit8780bc65bd5a53a38ac4b0a53a5fb283e066ec40 (patch)
tree1b93b068a795e3a727f679a8721ace371c4e349c /src/gpu/gl/GrGLVertexArray.cpp
parent10b063cb91c52fd1f570ee63307fe7e68c1501f1 (diff)
Remove GrGLVertexArray from GrGpuResource hierarchy.
Diffstat (limited to 'src/gpu/gl/GrGLVertexArray.cpp')
-rw-r--r--src/gpu/gl/GrGLVertexArray.cpp35
1 files changed, 9 insertions, 26 deletions
diff --git a/src/gpu/gl/GrGLVertexArray.cpp b/src/gpu/gl/GrGLVertexArray.cpp
index bb409c6acd..e20dbb5fed 100644
--- a/src/gpu/gl/GrGLVertexArray.cpp
+++ b/src/gpu/gl/GrGLVertexArray.cpp
@@ -8,8 +8,6 @@
#include "GrGLVertexArray.h"
#include "GrGLGpu.h"
-#define GPUGL static_cast<GrGLGpu*>(this->getGpu())
-#define GL_CALL(X) GR_GL_CALL(GPUGL->glInterface(), X);
void GrGLAttribArrayState::set(const GrGLGpu* gpu,
int index,
@@ -68,42 +66,27 @@ void GrGLAttribArrayState::disableUnusedArrays(const GrGLGpu* gpu, uint64_t used
///////////////////////////////////////////////////////////////////////////////////////////////////
-GrGLVertexArray::GrGLVertexArray(GrGLGpu* gpu, GrGLint id, int attribCount)
- : INHERITED(gpu, kCached_LifeCycle)
- , fID(id)
+GrGLVertexArray::GrGLVertexArray(GrGLint id, int attribCount)
+ : fID(id)
, fAttribArrays(attribCount)
, fIndexBufferIDIsValid(false) {
- this->registerWithCache();
}
-void GrGLVertexArray::onAbandon() {
- fID = 0;
- INHERITED::onAbandon();
-}
-
-void GrGLVertexArray::onRelease() {
- if (0 != fID) {
- GL_CALL(DeleteVertexArrays(1, &fID));
- GPUGL->notifyVertexArrayDelete(fID);
- fID = 0;
- }
- INHERITED::onRelease();
-}
-
-GrGLAttribArrayState* GrGLVertexArray::bind() {
+GrGLAttribArrayState* GrGLVertexArray::bind(GrGLGpu* gpu) {
if (0 == fID) {
return NULL;
}
- GPUGL->bindVertexArray(fID);
+ gpu->bindVertexArray(fID);
return &fAttribArrays;
}
-GrGLAttribArrayState* GrGLVertexArray::bindWithIndexBuffer(const GrGLIndexBuffer* buffer) {
- GrGLAttribArrayState* state = this->bind();
+GrGLAttribArrayState* GrGLVertexArray::bindWithIndexBuffer(GrGLGpu* gpu,
+ const GrGLIndexBuffer* buffer) {
+ GrGLAttribArrayState* state = this->bind(gpu);
if (state && buffer) {
GrGLuint bufferID = buffer->bufferID();
- if (!fIndexBufferIDIsValid || bufferID != fIndexBufferID) {
- GL_CALL(BindBuffer(GR_GL_ELEMENT_ARRAY_BUFFER, bufferID));
+ if (!fIndexBufferIDIsValid || bufferID != fIndexBufferID) {
+ GR_GL_CALL(gpu->glInterface(), BindBuffer(GR_GL_ELEMENT_ARRAY_BUFFER, bufferID));
fIndexBufferIDIsValid = true;
fIndexBufferID = bufferID;
}