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

Side by Side Diff: src/gpu/batches/GrDrawAtlasBatch.cpp

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: nit 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
« no previous file with comments | « src/gpu/batches/GrDefaultPathRenderer.cpp ('k') | src/gpu/batches/GrDrawPathBatch.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 2015 Google Inc. 2 * Copyright 2015 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 #include "GrDrawAtlasBatch.h" 8 #include "GrDrawAtlasBatch.h"
9 #include "GrBatchFlushState.h" 9 #include "GrBatchFlushState.h"
10 #include "GrBatchTest.h" 10 #include "GrBatchTest.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 return GrDefaultGeoProcFactory::Create(gpColor, coverage, localCoords, viewM atrix); 51 return GrDefaultGeoProcFactory::Create(gpColor, coverage, localCoords, viewM atrix);
52 } 52 }
53 53
54 void GrDrawAtlasBatch::onPrepareDraws(Target* target) const { 54 void GrDrawAtlasBatch::onPrepareDraws(Target* target) const {
55 // Setup geometry processor 55 // Setup geometry processor
56 SkAutoTUnref<const GrGeometryProcessor> gp(set_vertex_attributes(this->hasCo lors(), 56 SkAutoTUnref<const GrGeometryProcessor> gp(set_vertex_attributes(this->hasCo lors(),
57 this->color (), 57 this->color (),
58 this->viewM atrix(), 58 this->viewM atrix(),
59 this->cover ageIgnored())); 59 this->cover ageIgnored()));
60 60
61 target->initDraw(gp, this->pipeline()); 61 target->initDraw(gp);
62 62
63 int instanceCount = fGeoData.count(); 63 int instanceCount = fGeoData.count();
64 size_t vertexStride = gp->getVertexStride(); 64 size_t vertexStride = gp->getVertexStride();
65 SkASSERT(vertexStride == sizeof(SkPoint) + sizeof(SkPoint) 65 SkASSERT(vertexStride == sizeof(SkPoint) + sizeof(SkPoint)
66 + (this->hasColors() ? sizeof(GrColor) : 0)); 66 + (this->hasColors() ? sizeof(GrColor) : 0));
67 67
68 QuadHelper helper; 68 QuadHelper helper;
69 int numQuads = this->quadCount(); 69 int numQuads = this->quadCount();
70 void* verts = helper.init(target, vertexStride, numQuads); 70 void* verts = helper.init(target, vertexStride, numQuads);
71 if (!verts) { 71 if (!verts) {
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 258
259 SkMatrix viewMatrix = GrTest::TestMatrix(random); 259 SkMatrix viewMatrix = GrTest::TestMatrix(random);
260 260
261 GrDrawAtlasBatch::Geometry geometry; 261 GrDrawAtlasBatch::Geometry geometry;
262 geometry.fColor = GrRandomColor(random); 262 geometry.fColor = GrRandomColor(random);
263 return GrDrawAtlasBatch::Create(geometry, viewMatrix, spriteCount, xforms.be gin(), 263 return GrDrawAtlasBatch::Create(geometry, viewMatrix, spriteCount, xforms.be gin(),
264 texRects.begin(), hasColors ? colors.begin() : nullptr); 264 texRects.begin(), hasColors ? colors.begin() : nullptr);
265 } 265 }
266 266
267 #endif 267 #endif
OLDNEW
« no previous file with comments | « src/gpu/batches/GrDefaultPathRenderer.cpp ('k') | src/gpu/batches/GrDrawPathBatch.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698