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

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

Issue 184443003: Add Gpu Tracing to Ganesh (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Added files Created 6 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 /* 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 9
10 10
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 } 82 }
83 83
84 //////////////////////////////////////////////////////////////////////////////// 84 ////////////////////////////////////////////////////////////////////////////////
85 85
86 #define DEBUG_INVAL_BUFFER 0xdeadcafe 86 #define DEBUG_INVAL_BUFFER 0xdeadcafe
87 #define DEBUG_INVAL_START_IDX -1 87 #define DEBUG_INVAL_START_IDX -1
88 88
89 GrDrawTarget::GrDrawTarget(GrContext* context) 89 GrDrawTarget::GrDrawTarget(GrContext* context)
90 : fClip(NULL) 90 : fClip(NULL)
91 , fContext(context) 91 , fContext(context)
92 , fPushGpuTraceCount(0) { 92 , fGpuTraceMarkerCount(0) {
93 SkASSERT(NULL != context); 93 SkASSERT(NULL != context);
94 94
95 fDrawState = &fDefaultDrawState; 95 fDrawState = &fDefaultDrawState;
96 // We assume that fDrawState always owns a ref to the object it points at. 96 // We assume that fDrawState always owns a ref to the object it points at.
97 fDefaultDrawState.ref(); 97 fDefaultDrawState.ref();
98 GeometrySrcState& geoSrc = fGeoSrcStateStack.push_back(); 98 GeometrySrcState& geoSrc = fGeoSrcStateStack.push_back();
99 #ifdef SK_DEBUG 99 #ifdef SK_DEBUG
100 geoSrc.fVertexCount = DEBUG_INVAL_START_IDX; 100 geoSrc.fVertexCount = DEBUG_INVAL_START_IDX;
101 geoSrc.fVertexBuffer = (GrVertexBuffer*)DEBUG_INVAL_BUFFER; 101 geoSrc.fVertexBuffer = (GrVertexBuffer*)DEBUG_INVAL_BUFFER;
102 geoSrc.fIndexCount = DEBUG_INVAL_START_IDX; 102 geoSrc.fIndexCount = DEBUG_INVAL_START_IDX;
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 viewM.mapRect(&devBounds); 541 viewM.mapRect(&devBounds);
542 542
543 GrDeviceCoordTexture dstCopy; 543 GrDeviceCoordTexture dstCopy;
544 if (!this->setupDstReadIfNecessary(&dstCopy, &devBounds)) { 544 if (!this->setupDstReadIfNecessary(&dstCopy, &devBounds)) {
545 return; 545 return;
546 } 546 }
547 547
548 this->onDrawPath(path, fill, dstCopy.texture() ? &dstCopy : NULL); 548 this->onDrawPath(path, fill, dstCopy.texture() ? &dstCopy : NULL);
549 } 549 }
550 550
551 void GrDrawTarget::instantGpuTraceEvent(const char* marker) { 551 bool GrDrawTarget::isGpuTracingEnabled() const {
552 return this->getContext()->isGpuTracingEnabled();
553 }
554
555 void GrDrawTarget::addGpuTraceMarker(GrGpuTraceMarker* marker) {
552 if (this->caps()->gpuTracingSupport()) { 556 if (this->caps()->gpuTracingSupport()) {
553 this->onInstantGpuTraceEvent(marker); 557 SkASSERT(fGpuTraceMarkerCount >= 0);
558 this->fActiveTraceMarkers.add(*marker);
559 this->didAddGpuTraceMarker();
560 ++fGpuTraceMarkerCount;
554 } 561 }
555 } 562 }
556 563
557 void GrDrawTarget::pushGpuTraceEvent(const char* marker) { 564 void GrDrawTarget::removeGpuTraceMarker(GrGpuTraceMarker* marker) {
558 SkASSERT(fPushGpuTraceCount >= 0);
559 if (this->caps()->gpuTracingSupport()) { 565 if (this->caps()->gpuTracingSupport()) {
560 this->onPushGpuTraceEvent(marker); 566 SkASSERT(fGpuTraceMarkerCount >= 1);
561 ++fPushGpuTraceCount; 567 this->fActiveTraceMarkers.remove(*marker);
568 this->didRemoveGpuTraceMarker();
569 --fGpuTraceMarkerCount;
562 } 570 }
563 } 571 }
564 572
565 void GrDrawTarget::popGpuTraceEvent() {
566 SkASSERT(fPushGpuTraceCount >= 1);
567 if (this->caps()->gpuTracingSupport()) {
568 this->onPopGpuTraceEvent();
569 --fPushGpuTraceCount;
570 }
571 }
572
573 //////////////////////////////////////////////////////////////////////////////// 573 ////////////////////////////////////////////////////////////////////////////////
574 574
575 bool GrDrawTarget::willUseHWAALines() const { 575 bool GrDrawTarget::willUseHWAALines() const {
576 // There is a conflict between using smooth lines and our use of premultipli ed alpha. Smooth 576 // There is a conflict between using smooth lines and our use of premultipli ed alpha. Smooth
577 // lines tweak the incoming alpha value but not in a premul-alpha way. So we only use them when 577 // lines tweak the incoming alpha value but not in a premul-alpha way. So we only use them when
578 // our alpha is 0xff and tweaking the color for partial coverage is OK 578 // our alpha is 0xff and tweaking the color for partial coverage is OK
579 if (!this->caps()->hwAALineSupport() || 579 if (!this->caps()->hwAALineSupport() ||
580 !this->getDrawState().isHWAntialiasState()) { 580 !this->getDrawState().isHWAntialiasState()) {
581 return false; 581 return false;
582 } 582 }
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
1072 for (size_t i = 0; i < SK_ARRAY_COUNT(kConfigNames); ++i) { 1072 for (size_t i = 0; i < SK_ARRAY_COUNT(kConfigNames); ++i) {
1073 if (i != kUnknown_GrPixelConfig) { 1073 if (i != kUnknown_GrPixelConfig) {
1074 r.appendf("%s is renderable: %s, with MSAA: %s\n", 1074 r.appendf("%s is renderable: %s, with MSAA: %s\n",
1075 kConfigNames[i], 1075 kConfigNames[i],
1076 gNY[fConfigRenderSupport[i][0]], 1076 gNY[fConfigRenderSupport[i][0]],
1077 gNY[fConfigRenderSupport[i][1]]); 1077 gNY[fConfigRenderSupport[i][1]]);
1078 } 1078 }
1079 } 1079 }
1080 return r; 1080 return r;
1081 } 1081 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698