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

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

Issue 1323823003: Remove GrGpuTraceMarker hooks until we rethink the design (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: compiler warning Created 5 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/GrGpu.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 /* 2 /*
3 * Copyright 2010 Google Inc. 3 * Copyright 2010 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "GrDrawTarget.h" 9 #include "GrDrawTarget.h"
10 10
(...skipping 18 matching lines...) Expand all
29 #include "batches/GrStencilPathBatch.h" 29 #include "batches/GrStencilPathBatch.h"
30 30
31 #include "SkStrokeRec.h" 31 #include "SkStrokeRec.h"
32 32
33 //////////////////////////////////////////////////////////////////////////////// 33 ////////////////////////////////////////////////////////////////////////////////
34 34
35 GrDrawTarget::GrDrawTarget(GrGpu* gpu, GrResourceProvider* resourceProvider) 35 GrDrawTarget::GrDrawTarget(GrGpu* gpu, GrResourceProvider* resourceProvider)
36 : fGpu(SkRef(gpu)) 36 : fGpu(SkRef(gpu))
37 , fCaps(SkRef(gpu->caps())) 37 , fCaps(SkRef(gpu->caps()))
38 , fResourceProvider(resourceProvider) 38 , fResourceProvider(resourceProvider)
39 , fGpuTraceMarkerCount(0)
40 , fFlushing(false) { 39 , fFlushing(false) {
41 } 40 }
42 41
43 GrDrawTarget::~GrDrawTarget() { 42 GrDrawTarget::~GrDrawTarget() {
44 fGpu->unref(); 43 fGpu->unref();
45 fCaps->unref(); 44 fCaps->unref();
46 } 45 }
47 46
48 //////////////////////////////////////////////////////////////////////////////// 47 ////////////////////////////////////////////////////////////////////////////////
49 48
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 dstTexture->setOffset(copyRect.fLeft, copyRect.fTop); 112 dstTexture->setOffset(copyRect.fLeft, copyRect.fTop);
114 return true; 113 return true;
115 } 114 }
116 115
117 void GrDrawTarget::flush() { 116 void GrDrawTarget::flush() {
118 if (fFlushing) { 117 if (fFlushing) {
119 return; 118 return;
120 } 119 }
121 fFlushing = true; 120 fFlushing = true;
122 121
123 this->getGpu()->saveActiveTraceMarkers();
124
125 this->onFlush(); 122 this->onFlush();
126 123
127 this->getGpu()->restoreActiveTraceMarkers();
128
129 fFlushing = false; 124 fFlushing = false;
130 this->reset(); 125 this->reset();
131 } 126 }
132 127
133 void GrDrawTarget::drawBatch(const GrPipelineBuilder& pipelineBuilder, GrDrawBat ch* batch) { 128 void GrDrawTarget::drawBatch(const GrPipelineBuilder& pipelineBuilder, GrDrawBat ch* batch) {
134 // Setup clip 129 // Setup clip
135 GrScissorState scissorState; 130 GrScissorState scissorState;
136 GrPipelineBuilder::AutoRestoreFragmentProcessorState arfps; 131 GrPipelineBuilder::AutoRestoreFragmentProcessorState arfps;
137 GrPipelineBuilder::AutoRestoreStencil ars; 132 GrPipelineBuilder::AutoRestoreStencil ars;
138 if (!this->setupClip(pipelineBuilder, &arfps, &ars, &scissorState, &batch->b ounds())) { 133 if (!this->setupClip(pipelineBuilder, &arfps, &ars, &scissorState, &batch->b ounds())) {
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 } 382 }
388 383
389 void GrDrawTarget::discard(GrRenderTarget* renderTarget) { 384 void GrDrawTarget::discard(GrRenderTarget* renderTarget) {
390 if (this->caps()->discardRenderTargetSupport()) { 385 if (this->caps()->discardRenderTargetSupport()) {
391 GrBatch* batch = new GrDiscardBatch(renderTarget); 386 GrBatch* batch = new GrDiscardBatch(renderTarget);
392 this->onDrawBatch(batch); 387 this->onDrawBatch(batch);
393 batch->unref(); 388 batch->unref();
394 } 389 }
395 } 390 }
396 391
397 typedef GrTraceMarkerSet::Iter TMIter;
398 void GrDrawTarget::saveActiveTraceMarkers() {
399 if (this->caps()->gpuTracingSupport()) {
400 SkASSERT(0 == fStoredTraceMarkers.count());
401 fStoredTraceMarkers.addSet(fActiveTraceMarkers);
402 for (TMIter iter = fStoredTraceMarkers.begin(); iter != fStoredTraceMark ers.end(); ++iter) {
403 this->removeGpuTraceMarker(&(*iter));
404 }
405 }
406 }
407
408 void GrDrawTarget::restoreActiveTraceMarkers() {
409 if (this->caps()->gpuTracingSupport()) {
410 SkASSERT(0 == fActiveTraceMarkers.count());
411 for (TMIter iter = fStoredTraceMarkers.begin(); iter != fStoredTraceMark ers.end(); ++iter) {
412 this->addGpuTraceMarker(&(*iter));
413 }
414 for (TMIter iter = fActiveTraceMarkers.begin(); iter != fActiveTraceMark ers.end(); ++iter) {
415 this->fStoredTraceMarkers.remove(*iter);
416 }
417 }
418 }
419
420 void GrDrawTarget::addGpuTraceMarker(const GrGpuTraceMarker* marker) {
421 if (this->caps()->gpuTracingSupport()) {
422 SkASSERT(fGpuTraceMarkerCount >= 0);
423 this->fActiveTraceMarkers.add(*marker);
424 ++fGpuTraceMarkerCount;
425 }
426 }
427
428 void GrDrawTarget::removeGpuTraceMarker(const GrGpuTraceMarker* marker) {
429 if (this->caps()->gpuTracingSupport()) {
430 SkASSERT(fGpuTraceMarkerCount >= 1);
431 this->fActiveTraceMarkers.remove(*marker);
432 --fGpuTraceMarkerCount;
433 }
434 }
435
436 //////////////////////////////////////////////////////////////////////////////// 392 ////////////////////////////////////////////////////////////////////////////////
437 393
438 void GrDrawTarget::copySurface(GrSurface* dst, 394 void GrDrawTarget::copySurface(GrSurface* dst,
439 GrSurface* src, 395 GrSurface* src,
440 const SkIRect& srcRect, 396 const SkIRect& srcRect,
441 const SkIPoint& dstPoint) { 397 const SkIPoint& dstPoint) {
442 GrBatch* batch = GrCopySurfaceBatch::Create(dst, src, srcRect, dstPoint); 398 GrBatch* batch = GrCopySurfaceBatch::Create(dst, src, srcRect, dstPoint);
443 if (batch) { 399 if (batch) {
444 this->onDrawBatch(batch); 400 this->onDrawBatch(batch);
445 batch->unref(); 401 batch->unref();
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 // The clip mask manager can rebuild all its clip masks so just 460 // The clip mask manager can rebuild all its clip masks so just
505 // get rid of them all. 461 // get rid of them all.
506 fClipMaskManager->purgeResources(); 462 fClipMaskManager->purgeResources();
507 }; 463 };
508 464
509 void GrClipTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend erTarget* rt) { 465 void GrClipTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend erTarget* rt) {
510 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt); 466 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt);
511 this->onDrawBatch(batch); 467 this->onDrawBatch(batch);
512 batch->unref(); 468 batch->unref();
513 } 469 }
OLDNEW
« no previous file with comments | « src/gpu/GrDrawTarget.h ('k') | src/gpu/GrGpu.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698