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

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

Issue 2120163002: Enable blend optimizations with instanced draws (Closed) Base URL: https://skia.googlesource.com/skia.git@upload_ingorecov
Patch Set: fixes for perf regressions Created 4 years, 5 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 | « include/private/GrInstancedPipelineInfo.h ('k') | src/gpu/GrDrawContextPriv.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 "GrBatchTest.h" 8 #include "GrBatchTest.h"
9 #include "GrColor.h" 9 #include "GrColor.h"
10 #include "GrDrawContext.h" 10 #include "GrDrawContext.h"
11 #include "GrDrawContextPriv.h" 11 #include "GrDrawContextPriv.h"
12 #include "GrDrawingManager.h" 12 #include "GrDrawingManager.h"
13 #include "GrOvalRenderer.h" 13 #include "GrOvalRenderer.h"
14 #include "GrPathRenderer.h" 14 #include "GrPathRenderer.h"
15 #include "GrRenderTarget.h" 15 #include "GrRenderTarget.h"
16 #include "GrRenderTargetPriv.h" 16 #include "GrRenderTargetPriv.h"
17 #include "GrResourceProvider.h" 17 #include "GrResourceProvider.h"
18 #include "SkSurfacePriv.h" 18 #include "SkSurfacePriv.h"
19 19
20 #include "batches/GrBatch.h" 20 #include "batches/GrBatch.h"
21 #include "batches/GrDrawAtlasBatch.h" 21 #include "batches/GrDrawAtlasBatch.h"
22 #include "batches/GrDrawVerticesBatch.h" 22 #include "batches/GrDrawVerticesBatch.h"
23 #include "batches/GrRectBatchFactory.h" 23 #include "batches/GrRectBatchFactory.h"
24 #include "batches/GrNinePatch.h" // TODO Factory 24 #include "batches/GrNinePatch.h" // TODO Factory
25 25
26 #include "effects/GrRRectEffect.h" 26 #include "effects/GrRRectEffect.h"
27 27
28 #include "instanced/InstancedRendering.h"
29
28 #include "text/GrAtlasTextContext.h" 30 #include "text/GrAtlasTextContext.h"
29 #include "text/GrStencilAndCoverTextContext.h" 31 #include "text/GrStencilAndCoverTextContext.h"
30 32
31 #include "../private/GrAuditTrail.h" 33 #include "../private/GrAuditTrail.h"
32 34
33 #define ASSERT_OWNED_RESOURCE(R) SkASSERT(!(R) || (R)->getContext() == fDrawingM anager->getContext()) 35 #define ASSERT_OWNED_RESOURCE(R) SkASSERT(!(R) || (R)->getContext() == fDrawingM anager->getContext())
34 #define ASSERT_SINGLE_OWNER \ 36 #define ASSERT_SINGLE_OWNER \
35 SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(fSingleOwner);) 37 SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(fSingleOwner);)
36 #define ASSERT_SINGLE_OWNER_PRIV \ 38 #define ASSERT_SINGLE_OWNER_PRIV \
37 SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(fDrawContext->fSing leOwner);) 39 SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(fDrawContext->fSing leOwner);)
38 #define RETURN_IF_ABANDONED if (fDrawingManager->wasAbandoned()) { return ; } 40 #define RETURN_IF_ABANDONED if (fDrawingManager->wasAbandoned()) { return ; }
39 #define RETURN_IF_ABANDONED_PRIV if (fDrawContext->fDrawingManager->wasAbandon ed()) { return; } 41 #define RETURN_IF_ABANDONED_PRIV if (fDrawContext->fDrawingManager->wasAbandon ed()) { return; }
40 #define RETURN_FALSE_IF_ABANDONED if (fDrawingManager->wasAbandoned()) { return false; } 42 #define RETURN_FALSE_IF_ABANDONED if (fDrawingManager->wasAbandoned()) { return false; }
41 #define RETURN_FALSE_IF_ABANDONED_PRIV if (fDrawContext->fDrawingManager->wasAb andoned()) { return false; } 43 #define RETURN_FALSE_IF_ABANDONED_PRIV if (fDrawContext->fDrawingManager->wasAb andoned()) { return false; }
42 #define RETURN_NULL_IF_ABANDONED if (fDrawingManager->wasAbandoned()) { return nullptr; } 44 #define RETURN_NULL_IF_ABANDONED if (fDrawingManager->wasAbandoned()) { return nullptr; }
43 45
46 using gr_instanced::InstancedRendering;
47
44 class AutoCheckFlush { 48 class AutoCheckFlush {
45 public: 49 public:
46 AutoCheckFlush(GrDrawingManager* drawingManager) : fDrawingManager(drawingMa nager) { 50 AutoCheckFlush(GrDrawingManager* drawingManager) : fDrawingManager(drawingMa nager) {
47 SkASSERT(fDrawingManager); 51 SkASSERT(fDrawingManager);
48 } 52 }
49 ~AutoCheckFlush() { fDrawingManager->getContext()->flushIfNecessary(); } 53 ~AutoCheckFlush() { fDrawingManager->getContext()->flushIfNecessary(); }
50 54
51 private: 55 private:
52 GrDrawingManager* fDrawingManager; 56 GrDrawingManager* fDrawingManager;
53 }; 57 };
54 58
55 bool GrDrawContext::wasAbandoned() const { 59 bool GrDrawContext::wasAbandoned() const {
56 return fDrawingManager->wasAbandoned(); 60 return fDrawingManager->wasAbandoned();
57 } 61 }
58 62
59 // In MDB mode the reffing of the 'getLastDrawTarget' call's result allows in-pr ogress 63 // In MDB mode the reffing of the 'getLastDrawTarget' call's result allows in-pr ogress
60 // drawTargets to be picked up and added to by drawContexts lower in the call 64 // drawTargets to be picked up and added to by drawContexts lower in the call
61 // stack. When this occurs with a closed drawTarget, a new one will be allocated 65 // stack. When this occurs with a closed drawTarget, a new one will be allocated
62 // when the drawContext attempts to use it (via getDrawTarget). 66 // when the drawContext attempts to use it (via getDrawTarget).
63 GrDrawContext::GrDrawContext(GrContext* context, 67 GrDrawContext::GrDrawContext(GrContext* context,
64 GrDrawingManager* drawingMgr, 68 GrDrawingManager* drawingMgr,
65 sk_sp<GrRenderTarget> rt, 69 sk_sp<GrRenderTarget> rt,
66 const SkSurfaceProps* surfaceProps, 70 const SkSurfaceProps* surfaceProps,
67 GrAuditTrail* auditTrail, 71 GrAuditTrail* auditTrail,
68 GrSingleOwner* singleOwner) 72 GrSingleOwner* singleOwner)
69 : fDrawingManager(drawingMgr) 73 : fDrawingManager(drawingMgr)
70 , fRenderTarget(std::move(rt)) 74 , fRenderTarget(std::move(rt))
71 , fDrawTarget(SkSafeRef(fRenderTarget->getLastDrawTarget())) 75 , fDrawTarget(SkSafeRef(fRenderTarget->getLastDrawTarget()))
72 , fContext(context) 76 , fContext(context)
77 , fInstancedPipelineInfo(fRenderTarget.get())
73 , fSurfaceProps(SkSurfacePropsCopyOrDefault(surfaceProps)) 78 , fSurfaceProps(SkSurfacePropsCopyOrDefault(surfaceProps))
74 , fAuditTrail(auditTrail) 79 , fAuditTrail(auditTrail)
75 #ifdef SK_DEBUG 80 #ifdef SK_DEBUG
76 , fSingleOwner(singleOwner) 81 , fSingleOwner(singleOwner)
77 #endif 82 #endif
78 { 83 {
79 SkDEBUGCODE(this->validate();) 84 SkDEBUGCODE(this->validate();)
80 } 85 }
81 86
82 #ifdef SK_DEBUG 87 #ifdef SK_DEBUG
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 *useHWAA = rt->isUnifiedMultisampled(); 271 *useHWAA = rt->isUnifiedMultisampled();
267 } 272 }
268 return !rt->isUnifiedMultisampled(); 273 return !rt->isUnifiedMultisampled();
269 } 274 }
270 } 275 }
271 276
272 GrDrawBatch* GrDrawContext::getFillRectBatch(const GrPaint& paint, 277 GrDrawBatch* GrDrawContext::getFillRectBatch(const GrPaint& paint,
273 const SkMatrix& viewMatrix, 278 const SkMatrix& viewMatrix,
274 const SkRect& rect, 279 const SkRect& rect,
275 bool* useHWAA) { 280 bool* useHWAA) {
281 if (InstancedRendering* ir = this->getDrawTarget()->instancedRendering()) {
282 if (GrDrawBatch* batch = ir->recordRect(rect, viewMatrix, paint.getColor (),
283 paint.isAntiAlias(), fInstancedP ipelineInfo,
284 useHWAA)) {
285 return batch;
286 }
287 }
276 288
277 GrDrawBatch* batch = nullptr;
278 if (should_apply_coverage_aa(paint, fRenderTarget.get(), useHWAA)) { 289 if (should_apply_coverage_aa(paint, fRenderTarget.get(), useHWAA)) {
279 // The fill path can handle rotation but not skew. 290 // The fill path can handle rotation but not skew.
280 if (view_matrix_ok_for_aa_fill_rect(viewMatrix)) { 291 if (view_matrix_ok_for_aa_fill_rect(viewMatrix)) {
281 SkRect devBoundRect; 292 SkRect devBoundRect;
282 viewMatrix.mapRect(&devBoundRect, rect); 293 viewMatrix.mapRect(&devBoundRect, rect);
283 batch = GrRectBatchFactory::CreateAAFill(paint.getColor(), viewMatri x, 294 return GrRectBatchFactory::CreateAAFill(paint.getColor(), viewMatrix ,
284 rect, devBoundRect); 295 rect, devBoundRect);
285 } 296 }
286 } else { 297 } else {
287 // filled BW rect 298 // filled BW rect
288 batch = GrRectBatchFactory::CreateNonAAFill(paint.getColor(), viewMatrix , rect, 299 return GrRectBatchFactory::CreateNonAAFill(paint.getColor(), viewMatrix, rect,
289 nullptr, nullptr); 300 nullptr, nullptr);
290 } 301 }
291 302
292 return batch; 303 return nullptr;
293 } 304 }
294 305
295 void GrDrawContext::drawRect(const GrClip& clip, 306 void GrDrawContext::drawRect(const GrClip& clip,
296 const GrPaint& paint, 307 const GrPaint& paint,
297 const SkMatrix& viewMatrix, 308 const SkMatrix& viewMatrix,
298 const SkRect& rect, 309 const SkRect& rect,
299 const GrStyle* style) { 310 const GrStyle* style) {
300 if (!style) { 311 if (!style) {
301 style = &GrStyle::SimpleFill(); 312 style = &GrStyle::SimpleFill();
302 } 313 }
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 const GrPaint& paint, 483 const GrPaint& paint,
473 const SkMatrix& viewMatrix, 484 const SkMatrix& viewMatrix,
474 const SkRect& rectToDraw, 485 const SkRect& rectToDraw,
475 const SkRect& localRect) { 486 const SkRect& localRect) {
476 ASSERT_SINGLE_OWNER 487 ASSERT_SINGLE_OWNER
477 RETURN_IF_ABANDONED 488 RETURN_IF_ABANDONED
478 SkDEBUGCODE(this->validate();) 489 SkDEBUGCODE(this->validate();)
479 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::fillRectToRect"); 490 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::fillRectToRect");
480 491
481 AutoCheckFlush acf(fDrawingManager); 492 AutoCheckFlush acf(fDrawingManager);
493 SkAutoTUnref<GrDrawBatch> batch;
494 bool useHWAA;
482 495
483 bool useHWAA; 496 if (InstancedRendering* ir = this->getDrawTarget()->instancedRendering()) {
484 SkAutoTUnref<GrDrawBatch> batch; 497 batch.reset(ir->recordRect(rectToDraw, viewMatrix, paint.getColor(), loc alRect,
498 paint.isAntiAlias(), fInstancedPipelineInfo, &useHWAA));
499 if (batch) {
500 GrPipelineBuilder pipelineBuilder(paint, useHWAA);
501 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch) ;
502 return;
503 }
504 }
505
485 if (should_apply_coverage_aa(paint, fRenderTarget.get(), &useHWAA) && 506 if (should_apply_coverage_aa(paint, fRenderTarget.get(), &useHWAA) &&
486 view_matrix_ok_for_aa_fill_rect(viewMatrix)) { 507 view_matrix_ok_for_aa_fill_rect(viewMatrix)) {
487 batch.reset(GrAAFillRectBatch::CreateWithLocalRect(paint.getColor(), vie wMatrix, rectToDraw, 508 batch.reset(GrAAFillRectBatch::CreateWithLocalRect(paint.getColor(), vie wMatrix, rectToDraw,
488 localRect)); 509 localRect));
489 } else { 510 } else {
490 batch.reset(GrRectBatchFactory::CreateNonAAFill(paint.getColor(), viewMa trix, rectToDraw, 511 batch.reset(GrRectBatchFactory::CreateNonAAFill(paint.getColor(), viewMa trix, rectToDraw,
491 &localRect, nullptr)); 512 &localRect, nullptr));
492 } 513 }
493 514
494 if (batch) { 515 if (batch) {
495 GrPipelineBuilder pipelineBuilder(paint, useHWAA); 516 GrPipelineBuilder pipelineBuilder(paint, useHWAA);
496 this->drawBatch(pipelineBuilder, clip, batch); 517 this->drawBatch(pipelineBuilder, clip, batch);
497 } 518 }
498 } 519 }
499 520
500 void GrDrawContext::fillRectWithLocalMatrix(const GrClip& clip, 521 void GrDrawContext::fillRectWithLocalMatrix(const GrClip& clip,
501 const GrPaint& paint, 522 const GrPaint& paint,
502 const SkMatrix& viewMatrix, 523 const SkMatrix& viewMatrix,
503 const SkRect& rectToDraw, 524 const SkRect& rectToDraw,
504 const SkMatrix& localMatrix) { 525 const SkMatrix& localMatrix) {
505 ASSERT_SINGLE_OWNER 526 ASSERT_SINGLE_OWNER
506 RETURN_IF_ABANDONED 527 RETURN_IF_ABANDONED
507 SkDEBUGCODE(this->validate();) 528 SkDEBUGCODE(this->validate();)
508 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::fillRectWithLocalMatr ix"); 529 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::fillRectWithLocalMatr ix");
509 530
510 AutoCheckFlush acf(fDrawingManager); 531 AutoCheckFlush acf(fDrawingManager);
532 SkAutoTUnref<GrDrawBatch> batch;
533 bool useHWAA;
511 534
512 bool useHWAA; 535 if (InstancedRendering* ir = this->getDrawTarget()->instancedRendering()) {
513 SkAutoTUnref<GrDrawBatch> batch; 536 batch.reset(ir->recordRect(rectToDraw, viewMatrix, paint.getColor(), loc alMatrix,
537 paint.isAntiAlias(), fInstancedPipelineInfo, &useHWAA));
538 if (batch) {
539 GrPipelineBuilder pipelineBuilder(paint, useHWAA);
540 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch) ;
541 return;
542 }
543 }
544
514 if (should_apply_coverage_aa(paint, fRenderTarget.get(), &useHWAA) && 545 if (should_apply_coverage_aa(paint, fRenderTarget.get(), &useHWAA) &&
515 view_matrix_ok_for_aa_fill_rect(viewMatrix)) { 546 view_matrix_ok_for_aa_fill_rect(viewMatrix)) {
516 batch.reset(GrAAFillRectBatch::Create(paint.getColor(), viewMatrix, loca lMatrix, 547 batch.reset(GrAAFillRectBatch::Create(paint.getColor(), viewMatrix, loca lMatrix,
517 rectToDraw)); 548 rectToDraw));
518 } else { 549 } else {
519 batch.reset(GrRectBatchFactory::CreateNonAAFill(paint.getColor(), viewMa trix, rectToDraw, 550 batch.reset(GrRectBatchFactory::CreateNonAAFill(paint.getColor(), viewMa trix, rectToDraw,
520 nullptr, &localMatrix)); 551 nullptr, &localMatrix));
521 } 552 }
522 553
523 GrPipelineBuilder pipelineBuilder(paint, useHWAA); 554 GrPipelineBuilder pipelineBuilder(paint, useHWAA);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 ASSERT_SINGLE_OWNER 631 ASSERT_SINGLE_OWNER
601 RETURN_IF_ABANDONED 632 RETURN_IF_ABANDONED
602 SkDEBUGCODE(this->validate();) 633 SkDEBUGCODE(this->validate();)
603 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawRRect"); 634 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawRRect");
604 635
605 if (rrect.isEmpty()) { 636 if (rrect.isEmpty()) {
606 return; 637 return;
607 } 638 }
608 639
609 SkASSERT(!style.pathEffect()); // this should've been devolved to a path in SkGpuDevice 640 SkASSERT(!style.pathEffect()); // this should've been devolved to a path in SkGpuDevice
641
642 AutoCheckFlush acf(fDrawingManager);
610 const SkStrokeRec stroke = style.strokeRec(); 643 const SkStrokeRec stroke = style.strokeRec();
611 AutoCheckFlush acf(fDrawingManager); 644 bool useHWAA;
612 645
613 bool useHWAA; 646 if (this->getDrawTarget()->instancedRendering() && stroke.isFillStyle()) {
647 InstancedRendering* ir = this->getDrawTarget()->instancedRendering();
648 SkAutoTUnref<GrDrawBatch> batch(ir->recordRRect(rrect, viewMatrix, paint .getColor(),
649 paint.isAntiAlias(), fIn stancedPipelineInfo,
650 &useHWAA));
651 if (batch) {
652 GrPipelineBuilder pipelineBuilder(paint, useHWAA);
653 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch) ;
654 return;
655 }
656 }
657
614 if (should_apply_coverage_aa(paint, fRenderTarget.get(), &useHWAA)) { 658 if (should_apply_coverage_aa(paint, fRenderTarget.get(), &useHWAA)) {
615 GrShaderCaps* shaderCaps = fContext->caps()->shaderCaps(); 659 GrShaderCaps* shaderCaps = fContext->caps()->shaderCaps();
616
617 SkAutoTUnref<GrDrawBatch> batch(GrOvalRenderer::CreateRRectBatch(paint.g etColor(), 660 SkAutoTUnref<GrDrawBatch> batch(GrOvalRenderer::CreateRRectBatch(paint.g etColor(),
618 viewMat rix, 661 viewMat rix,
619 rrect, 662 rrect,
620 stroke, 663 stroke,
621 shaderC aps)); 664 shaderC aps));
622 if (batch) { 665 if (batch) {
623 GrPipelineBuilder pipelineBuilder(paint, useHWAA); 666 GrPipelineBuilder pipelineBuilder(paint, useHWAA);
624 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch) ; 667 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch) ;
625 return; 668 return;
626 } 669 }
627 } 670 }
628 671
629 SkPath path; 672 SkPath path;
630 path.setIsVolatile(true); 673 path.setIsVolatile(true);
631 path.addRRect(rrect); 674 path.addRRect(rrect);
632 this->internalDrawPath(clip, paint, viewMatrix, path, style); 675 this->internalDrawPath(clip, paint, viewMatrix, path, style);
633 } 676 }
634 677
635 bool GrDrawContext::drawFilledDRRect(const GrClip& clip, 678 bool GrDrawContext::drawFilledDRRect(const GrClip& clip,
636 const GrPaint& paintIn, 679 const GrPaint& paintIn,
637 const SkMatrix& viewMatrix, 680 const SkMatrix& viewMatrix,
638 const SkRRect& origOuter, 681 const SkRRect& origOuter,
639 const SkRRect& origInner) { 682 const SkRRect& origInner) {
640 SkASSERT(!origInner.isEmpty()); 683 SkASSERT(!origInner.isEmpty());
641 SkASSERT(!origOuter.isEmpty()); 684 SkASSERT(!origOuter.isEmpty());
642 685
686 if (InstancedRendering* ir = this->getDrawTarget()->instancedRendering()) {
687 bool useHWAA;
688 SkAutoTUnref<GrDrawBatch> batch(ir->recordDRRect(origOuter, origInner, v iewMatrix,
689 paintIn.getColor(), pai ntIn.isAntiAlias(),
690 fInstancedPipelineInfo, &useHWAA));
691 if (batch) {
692 GrPipelineBuilder pipelineBuilder(paintIn, useHWAA);
693 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch) ;
694 return true;
695 }
696 }
697
643 bool applyAA = paintIn.isAntiAlias() && !fRenderTarget->isUnifiedMultisample d(); 698 bool applyAA = paintIn.isAntiAlias() && !fRenderTarget->isUnifiedMultisample d();
644 699
645 GrPrimitiveEdgeType innerEdgeType = applyAA ? kInverseFillAA_GrProcessorEdge Type : 700 GrPrimitiveEdgeType innerEdgeType = applyAA ? kInverseFillAA_GrProcessorEdge Type :
646 kInverseFillBW_GrProcessorEdge Type; 701 kInverseFillBW_GrProcessorEdge Type;
647 GrPrimitiveEdgeType outerEdgeType = applyAA ? kFillAA_GrProcessorEdgeType : 702 GrPrimitiveEdgeType outerEdgeType = applyAA ? kFillAA_GrProcessorEdgeType :
648 kFillBW_GrProcessorEdgeType; 703 kFillBW_GrProcessorEdgeType;
649 704
650 SkTCopyOnFirstWrite<SkRRect> inner(origInner), outer(origOuter); 705 SkTCopyOnFirstWrite<SkRRect> inner(origInner), outer(origOuter);
651 SkMatrix inverseVM; 706 SkMatrix inverseVM;
652 if (!viewMatrix.isIdentity()) { 707 if (!viewMatrix.isIdentity()) {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 786
732 if (oval.isEmpty()) { 787 if (oval.isEmpty()) {
733 return; 788 return;
734 } 789 }
735 790
736 SkASSERT(!style.pathEffect()); // this should've been devolved to a path in SkGpuDevice 791 SkASSERT(!style.pathEffect()); // this should've been devolved to a path in SkGpuDevice
737 792
738 AutoCheckFlush acf(fDrawingManager); 793 AutoCheckFlush acf(fDrawingManager);
739 const SkStrokeRec& stroke = style.strokeRec(); 794 const SkStrokeRec& stroke = style.strokeRec();
740 bool useHWAA; 795 bool useHWAA;
796
797 if (this->getDrawTarget()->instancedRendering() && stroke.isFillStyle()) {
798 InstancedRendering* ir = this->getDrawTarget()->instancedRendering();
799 SkAutoTUnref<GrDrawBatch> batch(ir->recordOval(oval, viewMatrix, paint.g etColor(),
800 paint.isAntiAlias(), fIns tancedPipelineInfo,
801 &useHWAA));
802 if (batch) {
803 GrPipelineBuilder pipelineBuilder(paint, useHWAA);
804 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch) ;
805 return;
806 }
807 }
808
741 if (should_apply_coverage_aa(paint, fRenderTarget.get(), &useHWAA)) { 809 if (should_apply_coverage_aa(paint, fRenderTarget.get(), &useHWAA)) {
742 GrShaderCaps* shaderCaps = fContext->caps()->shaderCaps(); 810 GrShaderCaps* shaderCaps = fContext->caps()->shaderCaps();
743 SkAutoTUnref<GrDrawBatch> batch(GrOvalRenderer::CreateOvalBatch(paint.ge tColor(), 811 SkAutoTUnref<GrDrawBatch> batch(GrOvalRenderer::CreateOvalBatch(paint.ge tColor(),
744 viewMatr ix, 812 viewMatr ix,
745 oval, 813 oval,
746 stroke, 814 stroke,
747 shaderCa ps)); 815 shaderCa ps));
748 if (batch) { 816 if (batch) {
749 GrPipelineBuilder pipelineBuilder(paint, useHWAA); 817 GrPipelineBuilder pipelineBuilder(paint, useHWAA);
750 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch) ; 818 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch) ;
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
1029 1097
1030 void GrDrawContext::drawBatch(const GrPipelineBuilder& pipelineBuilder, const Gr Clip& clip, 1098 void GrDrawContext::drawBatch(const GrPipelineBuilder& pipelineBuilder, const Gr Clip& clip,
1031 GrDrawBatch* batch) { 1099 GrDrawBatch* batch) {
1032 ASSERT_SINGLE_OWNER 1100 ASSERT_SINGLE_OWNER
1033 RETURN_IF_ABANDONED 1101 RETURN_IF_ABANDONED
1034 SkDEBUGCODE(this->validate();) 1102 SkDEBUGCODE(this->validate();)
1035 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawBatch"); 1103 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawBatch");
1036 1104
1037 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch); 1105 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch);
1038 } 1106 }
OLDNEW
« no previous file with comments | « include/private/GrInstancedPipelineInfo.h ('k') | src/gpu/GrDrawContextPriv.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698