| 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 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 SkDebugf("%d: %s\n", i, fBatches[i]->name()); | 106 SkDebugf("%d: %s\n", i, fBatches[i]->name()); |
| 107 #if 0 | 107 #if 0 |
| 108 SkString str = fBatches[i]->dumpInfo(); | 108 SkString str = fBatches[i]->dumpInfo(); |
| 109 SkDebugf("%s\n", str.c_str()); | 109 SkDebugf("%s\n", str.c_str()); |
| 110 #endif | 110 #endif |
| 111 } | 111 } |
| 112 } | 112 } |
| 113 #endif | 113 #endif |
| 114 | 114 |
| 115 bool GrDrawTarget::setupDstReadIfNecessary(const GrPipelineBuilder& pipelineBuil
der, | 115 bool GrDrawTarget::setupDstReadIfNecessary(const GrPipelineBuilder& pipelineBuil
der, |
| 116 const GrProcOptInfo& colorPOI, | 116 const GrPipelineOptimizations& optimi
zations, |
| 117 const GrProcOptInfo& coveragePOI, | |
| 118 GrXferProcessor::DstTexture* dstTextu
re, | 117 GrXferProcessor::DstTexture* dstTextu
re, |
| 119 const SkRect& batchBounds) { | 118 const SkRect& batchBounds) { |
| 120 SkRect bounds = batchBounds; | 119 SkRect bounds = batchBounds; |
| 121 bounds.outset(0.5f, 0.5f); | 120 bounds.outset(0.5f, 0.5f); |
| 122 | 121 |
| 123 if (!pipelineBuilder.willXPNeedDstTexture(*this->caps(), colorPOI, coverageP
OI)) { | 122 if (!pipelineBuilder.willXPNeedDstTexture(*this->caps(), optimizations)) { |
| 124 return true; | 123 return true; |
| 125 } | 124 } |
| 126 | 125 |
| 127 GrRenderTarget* rt = pipelineBuilder.getRenderTarget(); | 126 GrRenderTarget* rt = pipelineBuilder.getRenderTarget(); |
| 128 | 127 |
| 129 if (this->caps()->textureBarrierSupport()) { | 128 if (this->caps()->textureBarrierSupport()) { |
| 130 if (GrTexture* rtTex = rt->asTexture()) { | 129 if (GrTexture* rtTex = rt->asTexture()) { |
| 131 // The render target is a texture, so we can read from it directly i
n the shader. The XP | 130 // The render target is a texture, so we can read from it directly i
n the shader. The XP |
| 132 // will be responsible to detect this situation and request a textur
e barrier. | 131 // will be responsible to detect this situation and request a textur
e barrier. |
| 133 dstTexture->setTexture(rtTex); | 132 dstTexture->setTexture(rtTex); |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 GrPipeline::CreateArgs args; | 537 GrPipeline::CreateArgs args; |
| 539 args.fPipelineBuilder = pipelineBuilder; | 538 args.fPipelineBuilder = pipelineBuilder; |
| 540 args.fCaps = this->caps(); | 539 args.fCaps = this->caps(); |
| 541 args.fScissor = scissor; | 540 args.fScissor = scissor; |
| 542 batch->getPipelineOptimizations(&args.fOpts); | 541 batch->getPipelineOptimizations(&args.fOpts); |
| 543 args.fOpts.fColorPOI.completeCalculations(pipelineBuilder->fColorFragmentPro
cessors.begin(), | 542 args.fOpts.fColorPOI.completeCalculations(pipelineBuilder->fColorFragmentPro
cessors.begin(), |
| 544 pipelineBuilder->numColorFragmentP
rocessors()); | 543 pipelineBuilder->numColorFragmentP
rocessors()); |
| 545 args.fOpts.fCoveragePOI.completeCalculations( | 544 args.fOpts.fCoveragePOI.completeCalculations( |
| 546 pipelineBuilder->fCoverageFragmen
tProcessors.begin(), | 545 pipelineBuilder->fCoverageFragmen
tProcessors.begin(), |
| 547 pipelineBuilder->numCoverageFragm
entProcessors()); | 546 pipelineBuilder->numCoverageFragm
entProcessors()); |
| 548 if (!this->setupDstReadIfNecessary(*pipelineBuilder, args.fOpts.fColorPOI, | 547 if (!this->setupDstReadIfNecessary(*pipelineBuilder, args.fOpts, &args.fDstT
exture, |
| 549 args.fOpts.fCoveragePOI, &args.fDstTextur
e, | |
| 550 batch->bounds())) { | 548 batch->bounds())) { |
| 551 return false; | 549 return false; |
| 552 } | 550 } |
| 553 | 551 |
| 554 if (!batch->installPipeline(args)) { | 552 if (!batch->installPipeline(args)) { |
| 555 return false; | 553 return false; |
| 556 } | 554 } |
| 557 | 555 |
| 558 return true; | 556 return true; |
| 559 } | 557 } |
| 560 | 558 |
| 561 void GrDrawTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend
erTarget* rt) { | 559 void GrDrawTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend
erTarget* rt) { |
| 562 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt); | 560 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt); |
| 563 this->recordBatch(batch); | 561 this->recordBatch(batch); |
| 564 batch->unref(); | 562 batch->unref(); |
| 565 } | 563 } |
| OLD | NEW |