Add support for vertex data rendered from CPU arrays.
Review URL: https://codereview.appspot.com/7380044
git-svn-id: http://skia.googlecode.com/svn/trunk@7807 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/gl/GrGLBufferImpl.h b/src/gpu/gl/GrGLBufferImpl.h
index 7b44f14..1fd8ce0 100644
--- a/src/gpu/gl/GrGLBufferImpl.h
+++ b/src/gpu/gl/GrGLBufferImpl.h
@@ -21,7 +21,7 @@
public:
struct Desc {
bool fIsWrapped;
- GrGLuint fID;
+ GrGLuint fID; // set to 0 to indicate buffer is CPU-backed and not a VBO.
size_t fSizeInBytes;
bool fDynamic;
};
@@ -36,7 +36,7 @@
void release(GrGpuGL* gpu);
GrGLuint bufferID() const { return fDesc.fID; }
- size_t baseOffset() const { return 0; }
+ size_t baseOffset() const { return reinterpret_cast<size_t>(fCPUData); }
void bind(GrGpuGL* gpu) const;
@@ -47,8 +47,11 @@
bool updateData(GrGpuGL* gpu, const void* src, size_t srcSizeInBytes);
private:
+ void validate() const;
+
Desc fDesc;
GrGLenum fBufferType; // GL_ARRAY_BUFFER or GL_ELEMENT_ARRAY_BUFFER
+ void* fCPUData;
void* fLockPtr;
typedef GrNoncopyable INHERITED;