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

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

Issue 1287973003: Check for xfer barriers in GrBatch, auto-issue barriers in GrGpu (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address comment Created 5 years, 4 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/GrAAFillRectBatch.h ('k') | src/gpu/batches/GrAAStrokeRectBatch.h » ('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 "GrAAFillRectBatch.h" 8 #include "GrAAFillRectBatch.h"
9 9
10 #include "GrBatch.h" 10 #include "GrBatch.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 const Geometry& args = fGeoData[i]; 123 const Geometry& args = fGeoData[i];
124 this->generateAAFillRectGeometry(vertices, 124 this->generateAAFillRectGeometry(vertices,
125 i * kVertsPerAAFillRect * vertexStr ide, 125 i * kVertsPerAAFillRect * vertexStr ide,
126 vertexStride, 126 vertexStride,
127 args.fColor, 127 args.fColor,
128 args.fViewMatrix, 128 args.fViewMatrix,
129 args.fRect, 129 args.fRect,
130 args.fDevRect, 130 args.fDevRect,
131 canTweakAlphaForCoverage); 131 canTweakAlphaForCoverage);
132 } 132 }
133
134 helper.issueDraw(batchTarget); 133 helper.issueDraw(batchTarget);
135 } 134 }
136 135
137 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } 136 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
138 137
139 private: 138 private:
140 AAFillRectBatch(GrColor color, const SkMatrix& viewMatrix, const SkRect& rec t, 139 AAFillRectBatch(GrColor color, const SkMatrix& viewMatrix, const SkRect& rec t,
141 const SkRect& devRect) { 140 const SkRect& devRect) {
142 this->initClassID<AAFillRectBatch>(); 141 this->initClassID<AAFillRectBatch>();
143 Geometry& geometry = fGeoData.push_back(); 142 Geometry& geometry = fGeoData.push_back();
(...skipping 25 matching lines...) Expand all
169 gAAFillRectIndexBufferKey); 168 gAAFillRectIndexBufferKey);
170 } 169 }
171 170
172 GrColor color() const { return fBatch.fColor; } 171 GrColor color() const { return fBatch.fColor; }
173 bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; } 172 bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; }
174 bool canTweakAlphaForCoverage() const { return fBatch.fCanTweakAlphaForCover age; } 173 bool canTweakAlphaForCoverage() const { return fBatch.fCanTweakAlphaForCover age; }
175 bool colorIgnored() const { return fBatch.fColorIgnored; } 174 bool colorIgnored() const { return fBatch.fColorIgnored; }
176 const SkMatrix& viewMatrix() const { return fGeoData[0].fViewMatrix; } 175 const SkMatrix& viewMatrix() const { return fGeoData[0].fViewMatrix; }
177 bool coverageIgnored() const { return fBatch.fCoverageIgnored; } 176 bool coverageIgnored() const { return fBatch.fCoverageIgnored; }
178 177
179 bool onCombineIfPossible(GrBatch* t) override { 178 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) {
180 if (!this->pipeline()->isEqual(*t->pipeline())) { 179 if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *t->pipel ine(), t->bounds(),
180 caps)) {
181 return false; 181 return false;
182 } 182 }
183 183
184 AAFillRectBatch* that = t->cast<AAFillRectBatch>(); 184 AAFillRectBatch* that = t->cast<AAFillRectBatch>();
185 185
186 SkASSERT(this->usesLocalCoords() == that->usesLocalCoords()); 186 SkASSERT(this->usesLocalCoords() == that->usesLocalCoords());
187 // We apply the viewmatrix to the rect points on the cpu. However, if t he pipeline uses 187 // We apply the viewmatrix to the rect points on the cpu. However, if t he pipeline uses
188 // local coords then we won't be able to batch. We could actually uploa d the viewmatrix 188 // local coords then we won't be able to batch. We could actually uploa d the viewmatrix
189 // using vertex attributes in these cases, but haven't investigated that 189 // using vertex attributes in these cases, but haven't investigated that
190 if (this->usesLocalCoords() && !this->viewMatrix().cheapEqualTo(that->vi ewMatrix())) { 190 if (this->usesLocalCoords() && !this->viewMatrix().cheapEqualTo(that->vi ewMatrix())) {
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 330
331 BATCH_TEST_DEFINE(AAFillRectBatch) { 331 BATCH_TEST_DEFINE(AAFillRectBatch) {
332 GrColor color = GrRandomColor(random); 332 GrColor color = GrRandomColor(random);
333 SkMatrix viewMatrix = GrTest::TestMatrix(random); 333 SkMatrix viewMatrix = GrTest::TestMatrix(random);
334 SkRect rect = GrTest::TestRect(random); 334 SkRect rect = GrTest::TestRect(random);
335 SkRect devRect = GrTest::TestRect(random); 335 SkRect devRect = GrTest::TestRect(random);
336 return AAFillRectBatch::Create(color, viewMatrix, rect, devRect); 336 return AAFillRectBatch::Create(color, viewMatrix, rect, devRect);
337 } 337 }
338 338
339 #endif 339 #endif
OLDNEW
« no previous file with comments | « src/gpu/batches/GrAAFillRectBatch.h ('k') | src/gpu/batches/GrAAStrokeRectBatch.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698