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

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

Issue 1541903002: added support for PLS path rendering (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix for ASAN failure Created 4 years, 10 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/effects/SkPixelXorXfermode.cpp ('k') | src/gpu/GrGeometryProcessor.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
11 #include "GrAuditTrail.h" 11 #include "GrAuditTrail.h"
12 #include "GrCaps.h" 12 #include "GrCaps.h"
13 #include "GrGpu.h" 13 #include "GrGpu.h"
14 #include "GrPath.h" 14 #include "GrPath.h"
15 #include "GrPipeline.h" 15 #include "GrPipeline.h"
16 #include "GrMemoryPool.h" 16 #include "GrMemoryPool.h"
17 #include "GrRenderTarget.h" 17 #include "GrRenderTarget.h"
18 #include "GrResourceProvider.h" 18 #include "GrResourceProvider.h"
19 #include "GrRenderTargetPriv.h" 19 #include "GrRenderTargetPriv.h"
20 #include "GrSurfacePriv.h" 20 #include "GrSurfacePriv.h"
21 #include "GrTexture.h" 21 #include "GrTexture.h"
22 #include "GrVertexBuffer.h" 22 #include "GrVertexBuffer.h"
23 #include "gl/GrGLRenderTarget.h"
23 24
24 #include "SkStrokeRec.h" 25 #include "SkStrokeRec.h"
25 26
26 #include "batches/GrClearBatch.h" 27 #include "batches/GrClearBatch.h"
27 #include "batches/GrCopySurfaceBatch.h" 28 #include "batches/GrCopySurfaceBatch.h"
28 #include "batches/GrDiscardBatch.h" 29 #include "batches/GrDiscardBatch.h"
29 #include "batches/GrDrawBatch.h" 30 #include "batches/GrDrawBatch.h"
30 #include "batches/GrDrawPathBatch.h" 31 #include "batches/GrDrawPathBatch.h"
31 #include "batches/GrRectBatchFactory.h" 32 #include "batches/GrRectBatchFactory.h"
32 #include "batches/GrStencilPathBatch.h" 33 #include "batches/GrStencilPathBatch.h"
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 SkIRect ibounds; 206 SkIRect ibounds;
206 bounds.roundOut(&ibounds); 207 bounds.roundOut(&ibounds);
207 // In multi-draw buffer all the batches use the same render target a nd we won't need to 208 // In multi-draw buffer all the batches use the same render target a nd we won't need to
208 // get the batchs bounds. 209 // get the batchs bounds.
209 if (GrRenderTarget* rt = fBatches[i]->renderTarget()) { 210 if (GrRenderTarget* rt = fBatches[i]->renderTarget()) {
210 fGpu->drawDebugWireRect(rt, ibounds, 0xFF000000 | random.nextU() ); 211 fGpu->drawDebugWireRect(rt, ibounds, 0xFF000000 | random.nextU() );
211 } 212 }
212 } 213 }
213 fBatches[i]->draw(flushState); 214 fBatches[i]->draw(flushState);
214 } 215 }
216
217 fGpu->performFlushWorkaround();
215 } 218 }
216 219
217 void GrDrawTarget::reset() { 220 void GrDrawTarget::reset() {
218 fBatches.reset(); 221 fBatches.reset();
219 } 222 }
220 223
221 void GrDrawTarget::drawBatch(const GrPipelineBuilder& pipelineBuilder, GrDrawBat ch* batch) { 224 void GrDrawTarget::drawBatch(const GrPipelineBuilder& pipelineBuilder, GrDrawBat ch* batch) {
222 // Setup clip 225 // Setup clip
223 GrPipelineBuilder::AutoRestoreStencil ars; 226 GrPipelineBuilder::AutoRestoreStencil ars;
224 GrAppliedClip clip; 227 GrAppliedClip clip;
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 /////////////////////////////////////////////////////////////////////////////// 483 ///////////////////////////////////////////////////////////////////////////////
481 484
482 bool GrDrawTarget::installPipelineInDrawBatch(const GrPipelineBuilder* pipelineB uilder, 485 bool GrDrawTarget::installPipelineInDrawBatch(const GrPipelineBuilder* pipelineB uilder,
483 const GrScissorState* scissor, 486 const GrScissorState* scissor,
484 GrDrawBatch* batch) { 487 GrDrawBatch* batch) {
485 GrPipeline::CreateArgs args; 488 GrPipeline::CreateArgs args;
486 args.fPipelineBuilder = pipelineBuilder; 489 args.fPipelineBuilder = pipelineBuilder;
487 args.fCaps = this->caps(); 490 args.fCaps = this->caps();
488 args.fScissor = scissor; 491 args.fScissor = scissor;
489 batch->getPipelineOptimizations(&args.fOpts); 492 batch->getPipelineOptimizations(&args.fOpts);
493 GrScissorState finalScissor;
494 if (args.fOpts.fOverrides.fUsePLSDstRead) {
495 GrRenderTarget* rt = pipelineBuilder->getRenderTarget();
496 GrGLIRect viewport;
497 viewport.fLeft = 0;
498 viewport.fBottom = 0;
499 viewport.fWidth = rt->width();
500 viewport.fHeight = rt->height();
501 SkIRect ibounds;
502 ibounds.fLeft = SkTPin(SkScalarFloorToInt(batch->bounds().fLeft), viewpo rt.fLeft,
503 viewport.fWidth);
504 ibounds.fTop = SkTPin(SkScalarFloorToInt(batch->bounds().fTop), viewport .fBottom,
505 viewport.fHeight);
506 ibounds.fRight = SkTPin(SkScalarCeilToInt(batch->bounds().fRight), viewp ort.fLeft,
507 viewport.fWidth);
508 ibounds.fBottom = SkTPin(SkScalarCeilToInt(batch->bounds().fBottom), vie wport.fBottom,
509 viewport.fHeight);
510 if (scissor != nullptr && scissor->enabled()) {
511 if (!ibounds.intersect(scissor->rect())) {
512 ibounds = scissor->rect();
513 }
514 }
515 finalScissor.set(ibounds);
516 args.fScissor = &finalScissor;
517 }
490 args.fOpts.fColorPOI.completeCalculations(pipelineBuilder->fColorFragmentPro cessors.begin(), 518 args.fOpts.fColorPOI.completeCalculations(pipelineBuilder->fColorFragmentPro cessors.begin(),
491 pipelineBuilder->numColorFragmentP rocessors()); 519 pipelineBuilder->numColorFragmentP rocessors());
492 args.fOpts.fCoveragePOI.completeCalculations( 520 args.fOpts.fCoveragePOI.completeCalculations(
493 pipelineBuilder->fCoverageFragmen tProcessors.begin(), 521 pipelineBuilder->fCoverageFragmen tProcessors.begin(),
494 pipelineBuilder->numCoverageFragm entProcessors()); 522 pipelineBuilder->numCoverageFragm entProcessors());
495 if (!this->setupDstReadIfNecessary(*pipelineBuilder, args.fOpts, &args.fDstT exture, 523 if (!this->setupDstReadIfNecessary(*pipelineBuilder, args.fOpts, &args.fDstT exture,
496 batch->bounds())) { 524 batch->bounds())) {
497 return false; 525 return false;
498 } 526 }
499 527
500 if (!batch->installPipeline(args)) { 528 if (!batch->installPipeline(args)) {
501 return false; 529 return false;
502 } 530 }
503 531
504 return true; 532 return true;
505 } 533 }
506 534
507 void GrDrawTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend erTarget* rt) { 535 void GrDrawTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend erTarget* rt) {
508 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt); 536 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt);
509 this->recordBatch(batch); 537 this->recordBatch(batch);
510 batch->unref(); 538 batch->unref();
511 } 539 }
OLDNEW
« no previous file with comments | « src/effects/SkPixelXorXfermode.cpp ('k') | src/gpu/GrGeometryProcessor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698