OLD | NEW |
---|---|
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 Loading... | |
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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
516 /////////////////////////////////////////////////////////////////////////////// | 519 /////////////////////////////////////////////////////////////////////////////// |
517 | 520 |
518 bool GrDrawTarget::installPipelineInDrawBatch(const GrPipelineBuilder* pipelineB uilder, | 521 bool GrDrawTarget::installPipelineInDrawBatch(const GrPipelineBuilder* pipelineB uilder, |
519 const GrScissorState* scissor, | 522 const GrScissorState* scissor, |
520 GrDrawBatch* batch) { | 523 GrDrawBatch* batch) { |
521 GrPipeline::CreateArgs args; | 524 GrPipeline::CreateArgs args; |
522 args.fPipelineBuilder = pipelineBuilder; | 525 args.fPipelineBuilder = pipelineBuilder; |
523 args.fCaps = this->caps(); | 526 args.fCaps = this->caps(); |
524 args.fScissor = scissor; | 527 args.fScissor = scissor; |
525 batch->getPipelineOptimizations(&args.fOpts); | 528 batch->getPipelineOptimizations(&args.fOpts); |
529 #ifdef ENABLE_PLS | |
bsalomon
2016/01/13 19:15:33
untab
| |
530 GrScissorState finalScissor; | |
531 if (args.fOpts.fOverrides.fUsePLSDstRead) { | |
532 GrRenderTarget* rt = pipelineBuilder->getRenderTarget(); | |
533 GrGLIRect viewport; | |
534 viewport.fLeft = 0; | |
535 viewport.fBottom = 0; | |
536 viewport.fWidth = rt->width(); | |
537 viewport.fHeight = rt->height(); | |
538 SkIRect ibounds; | |
539 ibounds.fLeft = SkTPin(SkScalarFloorToInt(batch->bounds().fLeft), vi ewport.fLeft, | |
540 viewport.fWidth); | |
541 ibounds.fTop = SkTPin(SkScalarFloorToInt(batch->bounds().fTop), view port.fBottom, | |
542 viewport.fHeight); | |
543 ibounds.fRight = SkTPin(SkScalarCeilToInt(batch->bounds().fRight), v iewport.fLeft, | |
544 viewport.fWidth); | |
545 ibounds.fBottom = SkTPin(SkScalarCeilToInt(batch->bounds().fBottom), viewport.fBottom, | |
546 viewport.fHeight); | |
547 if (scissor != nullptr && scissor->enabled()) { | |
548 if (!ibounds.intersect(scissor->rect())) { | |
549 ibounds = scissor->rect(); | |
550 } | |
551 } | |
552 finalScissor.set(ibounds); | |
553 args.fScissor = &finalScissor; | |
554 } | |
555 #endif | |
526 args.fOpts.fColorPOI.completeCalculations(pipelineBuilder->fColorFragmentPro cessors.begin(), | 556 args.fOpts.fColorPOI.completeCalculations(pipelineBuilder->fColorFragmentPro cessors.begin(), |
527 pipelineBuilder->numColorFragmentP rocessors()); | 557 pipelineBuilder->numColorFragmentP rocessors()); |
528 args.fOpts.fCoveragePOI.completeCalculations( | 558 args.fOpts.fCoveragePOI.completeCalculations( |
529 pipelineBuilder->fCoverageFragmen tProcessors.begin(), | 559 pipelineBuilder->fCoverageFragmen tProcessors.begin(), |
530 pipelineBuilder->numCoverageFragm entProcessors()); | 560 pipelineBuilder->numCoverageFragm entProcessors()); |
531 if (!this->setupDstReadIfNecessary(*pipelineBuilder, args.fOpts, &args.fDstT exture, | 561 if (!this->setupDstReadIfNecessary(*pipelineBuilder, args.fOpts, &args.fDstT exture, |
532 batch->bounds())) { | 562 batch->bounds())) { |
533 return false; | 563 return false; |
534 } | 564 } |
535 | 565 |
536 if (!batch->installPipeline(args)) { | 566 if (!batch->installPipeline(args)) { |
537 return false; | 567 return false; |
538 } | 568 } |
539 | 569 |
540 return true; | 570 return true; |
541 } | 571 } |
542 | 572 |
543 void GrDrawTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend erTarget* rt) { | 573 void GrDrawTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend erTarget* rt) { |
544 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt); | 574 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt); |
545 this->recordBatch(batch); | 575 this->recordBatch(batch); |
546 batch->unref(); | 576 batch->unref(); |
547 } | 577 } |
OLD | NEW |