Home | History | Annotate | Download | only in gl
      1 /*
      2  * Copyright 2011 Google Inc.
      3  *
      4  * Use of this source code is governed by a BSD-style license that can be
      5  * found in the LICENSE file.
      6  */
      7 
      8 #ifndef GrGLVertexBuffer_DEFINED
      9 #define GrGLVertexBuffer_DEFINED
     10 
     11 #include "GrVertexBuffer.h"
     12 #include "GrGLBufferImpl.h"
     13 #include "gl/GrGLInterface.h"
     14 
     15 class GrGLGpu;
     16 
     17 class GrGLVertexBuffer : public GrVertexBuffer {
     18 
     19 public:
     20     typedef GrGLBufferImpl::Desc Desc;
     21 
     22     GrGLVertexBuffer(GrGLGpu* gpu, const Desc& desc);
     23 
     24     GrGLuint bufferID() const { return fImpl.bufferID(); }
     25     size_t baseOffset() const { return fImpl.baseOffset(); }
     26 
     27 protected:
     28     void onAbandon() override;
     29     void onRelease() override;
     30     void setMemoryBacking(SkTraceMemoryDump* traceMemoryDump,
     31                           const SkString& dumpName) const override;
     32 
     33 private:
     34     void* onMap() override;
     35     void onUnmap() override;
     36     bool onUpdateData(const void* src, size_t srcSizeInBytes) override;
     37 
     38     GrGLGpu* getGpuGL() const {
     39         SkASSERT(!this->wasDestroyed());
     40         return (GrGLGpu*)(this->getGpu());
     41     }
     42 
     43     GrGLBufferImpl fImpl;
     44 
     45     typedef GrVertexBuffer INHERITED;
     46 };
     47 
     48 #endif
     49