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

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

Issue 1132093004: Move DstCoordTexture to GrXP, rename and remove the word "copy" from dstcopytexture names. (Closed) Base URL: https://skia.googlesource.com/skia.git@copy
Patch Set: remove asserts Created 5 years, 6 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/gpu/GrDrawTarget.h ('k') | src/gpu/GrPipeline.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
(...skipping 25 matching lines...) Expand all
36 , fGpuTraceMarkerCount(0) 36 , fGpuTraceMarkerCount(0)
37 , fFlushing(false) { 37 , fFlushing(false) {
38 SkASSERT(context); 38 SkASSERT(context);
39 } 39 }
40 40
41 //////////////////////////////////////////////////////////////////////////////// 41 ////////////////////////////////////////////////////////////////////////////////
42 42
43 bool GrDrawTarget::setupDstReadIfNecessary(const GrPipelineBuilder& pipelineBuil der, 43 bool GrDrawTarget::setupDstReadIfNecessary(const GrPipelineBuilder& pipelineBuil der,
44 const GrProcOptInfo& colorPOI, 44 const GrProcOptInfo& colorPOI,
45 const GrProcOptInfo& coveragePOI, 45 const GrProcOptInfo& coveragePOI,
46 GrDeviceCoordTexture* dstCopy, 46 GrXferProcessor::DstTexture* dstTextu re,
47 const SkRect* drawBounds) { 47 const SkRect* drawBounds) {
48 if (!pipelineBuilder.willXPNeedDstCopy(*this->caps(), colorPOI, coveragePOI) ) { 48 if (!pipelineBuilder.willXPNeedDstTexture(*this->caps(), colorPOI, coverageP OI)) {
49 return true; 49 return true;
50 } 50 }
51 51
52 GrRenderTarget* rt = pipelineBuilder.getRenderTarget(); 52 GrRenderTarget* rt = pipelineBuilder.getRenderTarget();
53 53
54 if (this->caps()->textureBarrierSupport()) { 54 if (this->caps()->textureBarrierSupport()) {
55 if (GrTexture* rtTex = rt->asTexture()) { 55 if (GrTexture* rtTex = rt->asTexture()) {
56 // The render target is a texture, se we can read from it directly i n the shader. The XP 56 // The render target is a texture, se we can read from it directly i n the shader. The XP
57 // will be responsible to detect this situation and request a textur e barrier. 57 // will be responsible to detect this situation and request a textur e barrier.
58 dstCopy->setTexture(rtTex); 58 dstTexture->setTexture(rtTex);
59 dstCopy->setOffset(0, 0); 59 dstTexture->setOffset(0, 0);
60 return true; 60 return true;
61 } 61 }
62 } 62 }
63 63
64 SkIRect copyRect; 64 SkIRect copyRect;
65 pipelineBuilder.clip().getConservativeBounds(rt, &copyRect); 65 pipelineBuilder.clip().getConservativeBounds(rt, &copyRect);
66 66
67 if (drawBounds) { 67 if (drawBounds) {
68 SkIRect drawIBounds; 68 SkIRect drawIBounds;
69 drawBounds->roundOut(&drawIBounds); 69 drawBounds->roundOut(&drawIBounds);
(...skipping 25 matching lines...) Expand all
95 95
96 SkAutoTUnref<GrTexture> copy(fContext->textureProvider()->refScratchTexture( desc, 96 SkAutoTUnref<GrTexture> copy(fContext->textureProvider()->refScratchTexture( desc,
97 GrTextureProvider::kApprox_ScratchTexMatch)); 97 GrTextureProvider::kApprox_ScratchTexMatch));
98 98
99 if (!copy) { 99 if (!copy) {
100 SkDebugf("Failed to create temporary copy of destination texture.\n"); 100 SkDebugf("Failed to create temporary copy of destination texture.\n");
101 return false; 101 return false;
102 } 102 }
103 SkIPoint dstPoint = {0, 0}; 103 SkIPoint dstPoint = {0, 0};
104 if (this->copySurface(copy, rt, copyRect, dstPoint)) { 104 if (this->copySurface(copy, rt, copyRect, dstPoint)) {
105 dstCopy->setTexture(copy); 105 dstTexture->setTexture(copy);
106 dstCopy->setOffset(copyRect.fLeft, copyRect.fTop); 106 dstTexture->setOffset(copyRect.fLeft, copyRect.fTop);
107 return true; 107 return true;
108 } else { 108 } else {
109 return false; 109 return false;
110 } 110 }
111 } 111 }
112 112
113 void GrDrawTarget::flush() { 113 void GrDrawTarget::flush() {
114 if (fFlushing) { 114 if (fFlushing) {
115 return; 115 return;
116 } 116 }
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 this->getGpu()->canCopySurface(dst, src, clippedSrcRect, clippedDstPo int); 490 this->getGpu()->canCopySurface(dst, src, clippedSrcRect, clippedDstPo int);
491 } 491 }
492 492
493 void GrDrawTarget::setupPipeline(const PipelineInfo& pipelineInfo, 493 void GrDrawTarget::setupPipeline(const PipelineInfo& pipelineInfo,
494 GrPipeline* pipeline) { 494 GrPipeline* pipeline) {
495 SkNEW_PLACEMENT_ARGS(pipeline, GrPipeline, (*pipelineInfo.fPipelineBuilder, 495 SkNEW_PLACEMENT_ARGS(pipeline, GrPipeline, (*pipelineInfo.fPipelineBuilder,
496 pipelineInfo.fColorPOI, 496 pipelineInfo.fColorPOI,
497 pipelineInfo.fCoveragePOI, 497 pipelineInfo.fCoveragePOI,
498 *this->caps(), 498 *this->caps(),
499 *pipelineInfo.fScissor, 499 *pipelineInfo.fScissor,
500 &pipelineInfo.fDstCopy)); 500 &pipelineInfo.fDstTexture));
501 } 501 }
502 /////////////////////////////////////////////////////////////////////////////// 502 ///////////////////////////////////////////////////////////////////////////////
503 503
504 GrDrawTarget::PipelineInfo::PipelineInfo(GrPipelineBuilder* pipelineBuilder, 504 GrDrawTarget::PipelineInfo::PipelineInfo(GrPipelineBuilder* pipelineBuilder,
505 GrScissorState* scissor, 505 GrScissorState* scissor,
506 const GrPrimitiveProcessor* primProc, 506 const GrPrimitiveProcessor* primProc,
507 const SkRect* devBounds, 507 const SkRect* devBounds,
508 GrDrawTarget* target) 508 GrDrawTarget* target)
509 : fPipelineBuilder(pipelineBuilder) 509 : fPipelineBuilder(pipelineBuilder)
510 , fScissor(scissor) { 510 , fScissor(scissor) {
511 fColorPOI = fPipelineBuilder->colorProcInfo(primProc); 511 fColorPOI = fPipelineBuilder->colorProcInfo(primProc);
512 fCoveragePOI = fPipelineBuilder->coverageProcInfo(primProc); 512 fCoveragePOI = fPipelineBuilder->coverageProcInfo(primProc);
513 if (!target->setupDstReadIfNecessary(*fPipelineBuilder, fColorPOI, fCoverage POI, 513 if (!target->setupDstReadIfNecessary(*fPipelineBuilder, fColorPOI, fCoverage POI,
514 &fDstCopy, devBounds)) { 514 &fDstTexture, devBounds)) {
515 fPipelineBuilder = NULL; 515 fPipelineBuilder = NULL;
516 } 516 }
517 } 517 }
518 518
519 GrDrawTarget::PipelineInfo::PipelineInfo(GrPipelineBuilder* pipelineBuilder, 519 GrDrawTarget::PipelineInfo::PipelineInfo(GrPipelineBuilder* pipelineBuilder,
520 GrScissorState* scissor, 520 GrScissorState* scissor,
521 const GrBatch* batch, 521 const GrBatch* batch,
522 const SkRect* devBounds, 522 const SkRect* devBounds,
523 GrDrawTarget* target) 523 GrDrawTarget* target)
524 : fPipelineBuilder(pipelineBuilder) 524 : fPipelineBuilder(pipelineBuilder)
525 , fScissor(scissor) { 525 , fScissor(scissor) {
526 fColorPOI = fPipelineBuilder->colorProcInfo(batch); 526 fColorPOI = fPipelineBuilder->colorProcInfo(batch);
527 fCoveragePOI = fPipelineBuilder->coverageProcInfo(batch); 527 fCoveragePOI = fPipelineBuilder->coverageProcInfo(batch);
528 if (!target->setupDstReadIfNecessary(*fPipelineBuilder, fColorPOI, fCoverage POI, 528 if (!target->setupDstReadIfNecessary(*fPipelineBuilder, fColorPOI, fCoverage POI,
529 &fDstCopy, devBounds)) { 529 &fDstTexture, devBounds)) {
530 fPipelineBuilder = NULL; 530 fPipelineBuilder = NULL;
531 } 531 }
532 } 532 }
533 533
534 /////////////////////////////////////////////////////////////////////////////// 534 ///////////////////////////////////////////////////////////////////////////////
535 535
536 GrShaderCaps::GrShaderCaps() { 536 GrShaderCaps::GrShaderCaps() {
537 fShaderDerivativeSupport = false; 537 fShaderDerivativeSupport = false;
538 fGeometryShaderSupport = false; 538 fGeometryShaderSupport = false;
539 fPathRenderingSupport = false; 539 fPathRenderingSupport = false;
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 GrPipelineBuilder::AutoRestoreFragmentProcessors* a rfp, 742 GrPipelineBuilder::AutoRestoreFragmentProcessors* a rfp,
743 GrPipelineBuilder::AutoRestoreStencil* ars, 743 GrPipelineBuilder::AutoRestoreStencil* ars,
744 GrScissorState* scissorState, 744 GrScissorState* scissorState,
745 const SkRect* devBounds) { 745 const SkRect* devBounds) {
746 return fClipMaskManager.setupClipping(pipelineBuilder, 746 return fClipMaskManager.setupClipping(pipelineBuilder,
747 arfp, 747 arfp,
748 ars, 748 ars,
749 scissorState, 749 scissorState,
750 devBounds); 750 devBounds);
751 } 751 }
OLDNEW
« no previous file with comments | « src/gpu/GrDrawTarget.h ('k') | src/gpu/GrPipeline.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698