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

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

Issue 1806983002: Update how we send draws to gpu backend to reduce state setting. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 4 years, 9 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
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 GrGLGpu_DEFINED 8 #ifndef GrGLGpu_DEFINED
9 #define GrGLGpu_DEFINED 9 #define GrGLGpu_DEFINED
10 10
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 void notifyVertexArrayDelete(GrGLuint id) { 88 void notifyVertexArrayDelete(GrGLuint id) {
89 fHWGeometryState.notifyVertexArrayDelete(id); 89 fHWGeometryState.notifyVertexArrayDelete(id);
90 } 90 }
91 void notifyVertexBufferDelete(GrGLuint id) { 91 void notifyVertexBufferDelete(GrGLuint id) {
92 fHWGeometryState.notifyVertexBufferDelete(id); 92 fHWGeometryState.notifyVertexBufferDelete(id);
93 } 93 }
94 void notifyIndexBufferDelete(GrGLuint id) { 94 void notifyIndexBufferDelete(GrGLuint id) {
95 fHWGeometryState.notifyIndexBufferDelete(id); 95 fHWGeometryState.notifyIndexBufferDelete(id);
96 } 96 }
97 97
98 void buildProgramDesc(GrProgramDesc*,
99 const GrPrimitiveProcessor&,
100 const GrPipeline&) const override;
101
102 // id and type (GL_ARRAY_BUFFER, GL_ELEMENT_ARRAY_BUFFER, etc.) of buffer to bind 98 // id and type (GL_ARRAY_BUFFER, GL_ELEMENT_ARRAY_BUFFER, etc.) of buffer to bind
103 void bindBuffer(GrGLuint id, GrGLenum type); 99 void bindBuffer(GrGLuint id, GrGLenum type);
104 100
105 void releaseBuffer(GrGLuint id, GrGLenum type); 101 void releaseBuffer(GrGLuint id, GrGLenum type);
106 102
107 // sizes are in bytes 103 // sizes are in bytes
108 void* mapBuffer(GrGLuint id, GrGLenum type, GrGLBufferImpl::Usage usage, siz e_t currentSize, 104 void* mapBuffer(GrGLuint id, GrGLenum type, GrGLBufferImpl::Usage usage, siz e_t currentSize,
109 size_t requestedSize); 105 size_t requestedSize);
110 106
111 void unmapBuffer(GrGLuint id, GrGLenum type, void* mapPtr); 107 void unmapBuffer(GrGLuint id, GrGLenum type, void* mapPtr);
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 GrPixelConfig config, 205 GrPixelConfig config,
210 const SkTArray<GrMipLevel>& texels) override; 206 const SkTArray<GrMipLevel>& texels) override;
211 207
212 bool onTransferPixels(GrSurface*, 208 bool onTransferPixels(GrSurface*,
213 int left, int top, int width, int height, 209 int left, int top, int width, int height,
214 GrPixelConfig config, GrTransferBuffer* buffer, 210 GrPixelConfig config, GrTransferBuffer* buffer,
215 size_t offset, size_t rowBytes) override; 211 size_t offset, size_t rowBytes) override;
216 212
217 void onResolveRenderTarget(GrRenderTarget* target) override; 213 void onResolveRenderTarget(GrRenderTarget* target) override;
218 214
219 void onDraw(const DrawArgs&, const GrNonInstancedVertices&) override; 215 void onDraw(const GrPipeline&,
216 const GrPrimitiveProcessor&,
217 GrPrimitiveType primitiveType,
218 const GrVertices*,
219 int drawCount) override;
220 220
221 bool onCopySurface(GrSurface* dst, 221 bool onCopySurface(GrSurface* dst,
222 GrSurface* src, 222 GrSurface* src,
223 const SkIRect& srcRect, 223 const SkIRect& srcRect,
224 const SkIPoint& dstPoint) override; 224 const SkIPoint& dstPoint) override;
225 225
226 void onGetMultisampleSpecs(GrRenderTarget*, 226 void onGetMultisampleSpecs(GrRenderTarget*,
227 const GrStencilSettings&, 227 const GrStencilSettings&,
228 int* effectiveSampleCnt, 228 int* effectiveSampleCnt,
229 SkAutoTDeleteArray<SkPoint>* sampleLocations) ove rride; 229 SkAutoTDeleteArray<SkPoint>* sampleLocations) ove rride;
230 230
231 // binds texture unit in GL 231 // binds texture unit in GL
232 void setTextureUnit(int unitIdx); 232 void setTextureUnit(int unitIdx);
233 233
234 // Flushes state from GrPipeline to GL. Returns false if the state couldn't be set. 234 // Flushes state from GrPipeline to GL. Returns false if the state couldn't be set.
235 bool flushGLState(const DrawArgs&); 235 bool flushGLState(const GrPipeline& pipeline, const GrPrimitiveProcessor& pr imProc);
236 236
237 // Sets up vertex attribute pointers and strides. On return indexOffsetInByt es gives the offset 237 // Sets up vertex attribute pointers and strides. On return indexOffsetInByt es gives the offset
238 // an into the index buffer. It does not account for vertices.startIndex() b ut rather the start 238 // an into the index buffer. It does not account for vertices.startIndex() b ut rather the start
239 // index is relative to the returned offset. 239 // index is relative to the returned offset.
240 void setupGeometry(const GrPrimitiveProcessor&, 240 void setupGeometry(const GrPrimitiveProcessor&,
241 const GrNonInstancedVertices& vertices, 241 const GrNonInstancedVertices& vertices,
242 size_t* indexOffsetInBytes); 242 size_t* indexOffsetInBytes);
243 243
244 void flushBlend(const GrXferProcessor::BlendInfo& blendInfo, const GrSwizzle &); 244 void flushBlend(const GrXferProcessor::BlendInfo& blendInfo, const GrSwizzle &);
245 245
246 bool hasExtension(const char* ext) const { return fGLContext->hasExtension(e xt); } 246 bool hasExtension(const char* ext) const { return fGLContext->hasExtension(e xt); }
247 247
248 void copySurfaceAsDraw(GrSurface* dst, 248 void copySurfaceAsDraw(GrSurface* dst,
249 GrSurface* src, 249 GrSurface* src,
250 const SkIRect& srcRect, 250 const SkIRect& srcRect,
251 const SkIPoint& dstPoint); 251 const SkIPoint& dstPoint);
252 void copySurfaceAsCopyTexSubImage(GrSurface* dst, 252 void copySurfaceAsCopyTexSubImage(GrSurface* dst,
253 GrSurface* src, 253 GrSurface* src,
254 const SkIRect& srcRect, 254 const SkIRect& srcRect,
255 const SkIPoint& dstPoint); 255 const SkIPoint& dstPoint);
256 bool copySurfaceAsBlitFramebuffer(GrSurface* dst, 256 bool copySurfaceAsBlitFramebuffer(GrSurface* dst,
257 GrSurface* src, 257 GrSurface* src,
258 const SkIRect& srcRect, 258 const SkIRect& srcRect,
259 const SkIPoint& dstPoint); 259 const SkIPoint& dstPoint);
260 260
261 void stampRectUsingProgram(GrGLuint program, const SkRect& bounds, GrGLint p osXformUniform, 261 void stampRectUsingProgram(GrGLuint program, const SkRect& bounds, GrGLint p osXformUniform,
262 GrGLuint arrayBuffer); 262 GrGLuint arrayBuffer);
263 263
264 void setupPixelLocalStorage(const DrawArgs& args); 264 void setupPixelLocalStorage(const GrPipeline&, const GrPrimitiveProcessor&);
265 265
266 static bool BlendCoeffReferencesConstant(GrBlendCoeff coeff); 266 static bool BlendCoeffReferencesConstant(GrBlendCoeff coeff);
267 267
268 class ProgramCache : public ::SkNoncopyable { 268 class ProgramCache : public ::SkNoncopyable {
269 public: 269 public:
270 ProgramCache(GrGLGpu* gpu); 270 ProgramCache(GrGLGpu* gpu);
271 ~ProgramCache(); 271 ~ProgramCache();
272 272
273 void reset(); 273 void reset();
274 void abandon(); 274 void abandon();
275 GrGLProgram* refProgram(const DrawArgs&); 275 GrGLProgram* refProgram(const GrGLGpu* gpu, const GrPipeline&, const GrP rimitiveProcessor&);
276 276
277 private: 277 private:
278 enum { 278 enum {
279 // We may actually have kMaxEntries+1 shaders in the GL context beca use we create a new 279 // We may actually have kMaxEntries+1 shaders in the GL context beca use we create a new
280 // shader before evicting from the cache. 280 // shader before evicting from the cache.
281 kMaxEntries = 128, 281 kMaxEntries = 128,
282 kHashBits = 6, 282 kHashBits = 6,
283 }; 283 };
284 284
285 struct Entry; 285 struct Entry;
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 } fPLSSetupProgram; 618 } fPLSSetupProgram;
619 619
620 bool fHWPLSEnabled; 620 bool fHWPLSEnabled;
621 bool fPLSHasBeenUsed; 621 bool fPLSHasBeenUsed;
622 622
623 typedef GrGpu INHERITED; 623 typedef GrGpu INHERITED;
624 friend class GrGLPathRendering; // For accessing setTextureUnit. 624 friend class GrGLPathRendering; // For accessing setTextureUnit.
625 }; 625 };
626 626
627 #endif 627 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698