Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1588)

Side by Side Diff: src/gpu/gl/GrGLVertexBuffer.h

Issue 251013002: Split GrResource into GrCacheable/GrGpuObject (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/gpu/gl/GrGLVertexArray.cpp ('k') | src/gpu/gl/GrGLVertexBuffer.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef GrGLVertexBuffer_DEFINED 8 #ifndef GrGLVertexBuffer_DEFINED
9 #define GrGLVertexBuffer_DEFINED 9 #define GrGLVertexBuffer_DEFINED
10 10
11 #include "GrVertexBuffer.h" 11 #include "GrVertexBuffer.h"
12 #include "GrGLBufferImpl.h" 12 #include "GrGLBufferImpl.h"
13 #include "gl/GrGLInterface.h" 13 #include "gl/GrGLInterface.h"
14 14
15 class GrGpuGL; 15 class GrGpuGL;
16 16
17 class GrGLVertexBuffer : public GrVertexBuffer { 17 class GrGLVertexBuffer : public GrVertexBuffer {
18 18
19 public: 19 public:
20 typedef GrGLBufferImpl::Desc Desc; 20 typedef GrGLBufferImpl::Desc Desc;
21 21
22 GrGLVertexBuffer(GrGpuGL* gpu, const Desc& desc); 22 GrGLVertexBuffer(GrGpuGL* gpu, const Desc& desc);
23 virtual ~GrGLVertexBuffer() { this->release(); } 23 virtual ~GrGLVertexBuffer() { this->release(); }
24 24
25 GrGLuint bufferID() const { return fImpl.bufferID(); } 25 GrGLuint bufferID() const { return fImpl.bufferID(); }
26 size_t baseOffset() const { return fImpl.baseOffset(); } 26 size_t baseOffset() const { return fImpl.baseOffset(); }
27 27
28 void bind() const { 28 void bind() const {
29 if (this->isValid()) { 29 if (!this->wasDestroyed()) {
30 fImpl.bind(this->getGpuGL()); 30 fImpl.bind(this->getGpuGL());
31 } 31 }
32 } 32 }
33 33
34 // overrides of GrVertexBuffer 34 // overrides of GrVertexBuffer
35 virtual void* lock(); 35 virtual void* lock();
36 virtual void* lockPtr() const; 36 virtual void* lockPtr() const;
37 virtual void unlock(); 37 virtual void unlock();
38 virtual bool isLocked() const; 38 virtual bool isLocked() const;
39 virtual bool updateData(const void* src, size_t srcSizeInBytes); 39 virtual bool updateData(const void* src, size_t srcSizeInBytes);
40 40
41 protected: 41 protected:
42 // overrides of GrResource 42 // overrides of GrResource
43 virtual void onAbandon() SK_OVERRIDE; 43 virtual void onAbandon() SK_OVERRIDE;
44 virtual void onRelease() SK_OVERRIDE; 44 virtual void onRelease() SK_OVERRIDE;
45 45
46 private: 46 private:
47 GrGpuGL* getGpuGL() const { 47 GrGpuGL* getGpuGL() const {
48 SkASSERT(this->isValid()); 48 SkASSERT(!this->wasDestroyed());
49 return (GrGpuGL*)(this->getGpu()); 49 return (GrGpuGL*)(this->getGpu());
50 } 50 }
51 51
52 GrGLBufferImpl fImpl; 52 GrGLBufferImpl fImpl;
53 53
54 typedef GrVertexBuffer INHERITED; 54 typedef GrVertexBuffer INHERITED;
55 }; 55 };
56 56
57 #endif 57 #endif
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLVertexArray.cpp ('k') | src/gpu/gl/GrGLVertexBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698