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

Side by Side Diff: src/gpu/GrDrawTarget.cpp

Issue 2298003003: Don't purge resources for trivial GrContext flushes (Closed)
Patch Set: Fix speeling Created 4 years, 3 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/GrDrawTarget.h ('k') | src/gpu/GrDrawingManager.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 2010 Google Inc. 2 * Copyright 2010 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 "GrDrawTarget.h" 8 #include "GrDrawTarget.h"
9 9
10 #include "GrAppliedClip.h" 10 #include "GrAppliedClip.h"
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 if (fRecordedBatches[i].fBatch) { 214 if (fRecordedBatches[i].fBatch) {
215 fRecordedBatches[i].fBatch->prepare(flushState); 215 fRecordedBatches[i].fBatch->prepare(flushState);
216 } 216 }
217 } 217 }
218 218
219 if (fInstancedRendering) { 219 if (fInstancedRendering) {
220 fInstancedRendering->beginFlush(flushState->resourceProvider()); 220 fInstancedRendering->beginFlush(flushState->resourceProvider());
221 } 221 }
222 } 222 }
223 223
224 void GrDrawTarget::drawBatches(GrBatchFlushState* flushState) { 224 bool GrDrawTarget::drawBatches(GrBatchFlushState* flushState) {
225 if (0 == fRecordedBatches.count()) { 225 if (0 == fRecordedBatches.count()) {
226 return; 226 return false;
227 } 227 }
228 // Draw all the generated geometry. 228 // Draw all the generated geometry.
229 SkRandom random; 229 SkRandom random;
230 GrRenderTarget* currentRT = nullptr; 230 GrRenderTarget* currentRT = nullptr;
231 SkAutoTDelete<GrGpuCommandBuffer> commandBuffer; 231 SkAutoTDelete<GrGpuCommandBuffer> commandBuffer;
232 SkRect bounds = SkRect::MakeEmpty(); 232 SkRect bounds = SkRect::MakeEmpty();
233 for (int i = 0; i < fRecordedBatches.count(); ++i) { 233 for (int i = 0; i < fRecordedBatches.count(); ++i) {
234 if (!fRecordedBatches[i].fBatch) { 234 if (!fRecordedBatches[i].fBatch) {
235 continue; 235 continue;
236 } 236 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 SkIntToScalar(currentRT->width()), 279 SkIntToScalar(currentRT->width()),
280 SkIntToScalar(currentRT->height()))) { 280 SkIntToScalar(currentRT->height()))) {
281 SkIRect iBounds; 281 SkIRect iBounds;
282 bounds.roundOut(&iBounds); 282 bounds.roundOut(&iBounds);
283 commandBuffer->submit(iBounds); 283 commandBuffer->submit(iBounds);
284 } 284 }
285 flushState->setCommandBuffer(nullptr); 285 flushState->setCommandBuffer(nullptr);
286 } 286 }
287 287
288 fGpu->finishDrawTarget(); 288 fGpu->finishDrawTarget();
289 return true;
289 } 290 }
290 291
291 void GrDrawTarget::reset() { 292 void GrDrawTarget::reset() {
292 fLastFullClearBatch = nullptr; 293 fLastFullClearBatch = nullptr;
293 fRecordedBatches.reset(); 294 fRecordedBatches.reset();
294 if (fInstancedRendering) { 295 if (fInstancedRendering) {
295 fInstancedRendering->endFlush(); 296 fInstancedRendering->endFlush();
296 } 297 }
297 } 298 }
298 299
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 } 617 }
617 } 618 }
618 619
619 /////////////////////////////////////////////////////////////////////////////// 620 ///////////////////////////////////////////////////////////////////////////////
620 621
621 void GrDrawTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend erTarget* rt) { 622 void GrDrawTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend erTarget* rt) {
622 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt); 623 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt);
623 this->recordBatch(batch, batch->bounds()); 624 this->recordBatch(batch, batch->bounds());
624 batch->unref(); 625 batch->unref();
625 } 626 }
OLDNEW
« no previous file with comments | « src/gpu/GrDrawTarget.h ('k') | src/gpu/GrDrawingManager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698