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

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

Issue 1137093002: Remove GrGLVertexArray from GrGpuResource hierarchy. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix nit Created 5 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
« no previous file with comments | « src/gpu/gl/GrGLGpu.cpp ('k') | src/gpu/gl/GrGLVertexArray.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 2013 Google Inc. 2 * Copyright 2013 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 GrGLVertexArray_DEFINED 8 #ifndef GrGLVertexArray_DEFINED
9 #define GrGLVertexArray_DEFINED 9 #define GrGLVertexArray_DEFINED
10 10
11 #include "GrGpuResource.h"
12 #include "GrTypesPriv.h" 11 #include "GrTypesPriv.h"
13 #include "gl/GrGLDefines.h" 12 #include "gl/GrGLDefines.h"
14 #include "gl/GrGLFunctions.h" 13 #include "gl/GrGLFunctions.h"
15
16 #include "SkTArray.h" 14 #include "SkTArray.h"
17 15
18 class GrGLVertexBuffer; 16 class GrGLVertexBuffer;
19 class GrGLIndexBuffer; 17 class GrGLIndexBuffer;
20 class GrGLGpu; 18 class GrGLGpu;
21 19
22 struct GrGLAttribLayout { 20 struct GrGLAttribLayout {
23 GrGLint fCount; 21 GrGLint fCount;
24 GrGLenum fType; 22 GrGLenum fType;
25 GrGLboolean fNormalized; 23 GrGLboolean fNormalized;
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 GrGLvoid* fOffset; 125 GrGLvoid* fOffset;
128 }; 126 };
129 127
130 SkSTArray<16, AttribArrayState, true> fAttribArrayStates; 128 SkSTArray<16, AttribArrayState, true> fAttribArrayStates;
131 }; 129 };
132 130
133 /** 131 /**
134 * This class represents an OpenGL vertex array object. It manages the lifetime of the vertex array 132 * This class represents an OpenGL vertex array object. It manages the lifetime of the vertex array
135 * and is used to track the state of the vertex array to avoid redundant GL call s. 133 * and is used to track the state of the vertex array to avoid redundant GL call s.
136 */ 134 */
137 class GrGLVertexArray : public GrGpuResource { 135 class GrGLVertexArray {
138 public: 136 public:
139 GrGLVertexArray(GrGLGpu* gpu, GrGLint id, int attribCount); 137 GrGLVertexArray(GrGLint id, int attribCount);
140 138
141 /** 139 /**
142 * Binds this vertex array. If the ID has been deleted or abandoned then NUL L is returned. 140 * Binds this vertex array. If the ID has been deleted or abandoned then NUL L is returned.
143 * Otherwise, the GrGLAttribArrayState that is tracking this vertex array's attrib bindings is 141 * Otherwise, the GrGLAttribArrayState that is tracking this vertex array's attrib bindings is
144 * returned. 142 * returned.
145 */ 143 */
146 GrGLAttribArrayState* bind(); 144 GrGLAttribArrayState* bind(GrGLGpu*);
147 145
148 /** 146 /**
149 * This is a version of the above function that also binds an index buffer t o the vertex 147 * This is a version of the above function that also binds an index buffer t o the vertex
150 * array object. 148 * array object.
151 */ 149 */
152 GrGLAttribArrayState* bindWithIndexBuffer(const GrGLIndexBuffer* indexBuffer ); 150 GrGLAttribArrayState* bindWithIndexBuffer(GrGLGpu* gpu, const GrGLIndexBuffe r*);
153 151
154 void notifyIndexBufferDelete(GrGLuint bufferID); 152 void notifyIndexBufferDelete(GrGLuint bufferID);
155 153
156 void notifyVertexBufferDelete(GrGLuint id) { 154 void notifyVertexBufferDelete(GrGLuint id) {
157 fAttribArrays.notifyVertexBufferDelete(id); 155 fAttribArrays.notifyVertexBufferDelete(id);
158 } 156 }
159 157
160 GrGLuint arrayID() const { return fID; } 158 GrGLuint arrayID() const { return fID; }
161 159
162 void invalidateCachedState(); 160 void invalidateCachedState();
163 161
164 protected:
165 size_t onGpuMemorySize() const override { return 0; }
166
167 void onAbandon() override;
168
169 void onRelease() override;
170
171 private: 162 private:
172 GrGLuint fID; 163 GrGLuint fID;
173 GrGLAttribArrayState fAttribArrays; 164 GrGLAttribArrayState fAttribArrays;
174 GrGLuint fIndexBufferID; 165 GrGLuint fIndexBufferID;
175 bool fIndexBufferIDIsValid; 166 bool fIndexBufferIDIsValid;
176
177 typedef GrGpuResource INHERITED;
178 }; 167 };
179 168
180 #endif 169 #endif
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLGpu.cpp ('k') | src/gpu/gl/GrGLVertexArray.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698