epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 1 | |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 2 | /* |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 3 | * Copyright 2010 Google Inc. |
| 4 | * |
| 5 | * Use of this source code is governed by a BSD-style license that can be |
| 6 | * found in the LICENSE file. |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 7 | */ |
| 8 | |
joshualitt | c2893c5 | 2015-01-28 06:54:30 -0800 | [diff] [blame] | 9 | #include "GrDrawTarget.h" |
joshualitt | 4d8da81 | 2015-01-28 12:53:54 -0800 | [diff] [blame] | 10 | |
robertphillips | ea46150 | 2015-05-26 11:38:03 -0700 | [diff] [blame] | 11 | #include "GrAARectRenderer.h" |
joshualitt | 4d8da81 | 2015-01-28 12:53:54 -0800 | [diff] [blame] | 12 | #include "GrBatch.h" |
bsalomon | eb1cb5c | 2015-05-22 08:01:09 -0700 | [diff] [blame] | 13 | #include "GrCaps.h" |
bsalomon@google.com | 26e18b5 | 2013-03-29 19:22:36 +0000 | [diff] [blame] | 14 | #include "GrContext.h" |
commit-bot@chromium.org | c4dc0ad | 2013-10-09 14:11:33 +0000 | [diff] [blame] | 15 | #include "GrPath.h" |
egdaniel | e36914c | 2015-02-13 09:00:33 -0800 | [diff] [blame] | 16 | #include "GrPipeline.h" |
joshualitt | b7133be | 2015-04-08 09:08:31 -0700 | [diff] [blame] | 17 | #include "GrMemoryPool.h" |
joshualitt | ad17cfc | 2015-05-05 10:45:57 -0700 | [diff] [blame] | 18 | #include "GrRectBatch.h" |
bsalomon@google.com | 8f9cbd6 | 2011-12-09 15:55:34 +0000 | [diff] [blame] | 19 | #include "GrRenderTarget.h" |
bsalomon | 6bc1b5f | 2015-02-23 09:06:38 -0800 | [diff] [blame] | 20 | #include "GrRenderTargetPriv.h" |
bsalomon | afbf2d6 | 2014-09-30 12:18:44 -0700 | [diff] [blame] | 21 | #include "GrSurfacePriv.h" |
bsalomon | 62c447d | 2014-08-08 08:08:50 -0700 | [diff] [blame] | 22 | #include "GrTemplates.h" |
bsalomon@google.com | 86afc2a | 2011-02-16 16:12:19 +0000 | [diff] [blame] | 23 | #include "GrTexture.h" |
bsalomon@google.com | 25fb21f | 2011-06-21 18:17:25 +0000 | [diff] [blame] | 24 | #include "GrVertexBuffer.h" |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 25 | |
sugoi@google.com | 5f74cf8 | 2012-12-17 21:16:45 +0000 | [diff] [blame] | 26 | #include "SkStrokeRec.h" |
sugoi@google.com | 12b4e27 | 2012-12-06 20:13:11 +0000 | [diff] [blame] | 27 | |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 28 | //////////////////////////////////////////////////////////////////////////////// |
| 29 | |
bsalomon@google.com | 25fb21f | 2011-06-21 18:17:25 +0000 | [diff] [blame] | 30 | #define DEBUG_INVAL_BUFFER 0xdeadcafe |
| 31 | #define DEBUG_INVAL_START_IDX -1 |
| 32 | |
robertphillips | e40d397 | 2015-05-07 09:51:43 -0700 | [diff] [blame] | 33 | GrDrawTarget::GrDrawTarget(GrContext* context) |
joshualitt | 44701df | 2015-02-23 14:44:57 -0800 | [diff] [blame] | 34 | : fContext(context) |
bsalomon | a73239a | 2015-04-28 13:35:17 -0700 | [diff] [blame] | 35 | , fCaps(SkRef(context->getGpu()->caps())) |
| 36 | , fGpuTraceMarkerCount(0) |
bsalomon | a73239a | 2015-04-28 13:35:17 -0700 | [diff] [blame] | 37 | , fFlushing(false) { |
bsalomon | 49f085d | 2014-09-05 13:34:00 -0700 | [diff] [blame] | 38 | SkASSERT(context); |
bsalomon@google.com | 25fb21f | 2011-06-21 18:17:25 +0000 | [diff] [blame] | 39 | } |
| 40 | |
| 41 | //////////////////////////////////////////////////////////////////////////////// |
| 42 | |
bsalomon | 50785a3 | 2015-02-06 07:02:37 -0800 | [diff] [blame] | 43 | bool GrDrawTarget::setupDstReadIfNecessary(const GrPipelineBuilder& pipelineBuilder, |
egdaniel | e36914c | 2015-02-13 09:00:33 -0800 | [diff] [blame] | 44 | const GrProcOptInfo& colorPOI, |
| 45 | const GrProcOptInfo& coveragePOI, |
bsalomon | 6a44c6a | 2015-05-26 09:49:05 -0700 | [diff] [blame] | 46 | GrXferProcessor::DstTexture* dstTexture, |
joshualitt | 9853cce | 2014-11-17 14:22:48 -0800 | [diff] [blame] | 47 | const SkRect* drawBounds) { |
bsalomon | 6a44c6a | 2015-05-26 09:49:05 -0700 | [diff] [blame] | 48 | if (!pipelineBuilder.willXPNeedDstTexture(*this->caps(), colorPOI, coveragePOI)) { |
bsalomon@google.com | 26e18b5 | 2013-03-29 19:22:36 +0000 | [diff] [blame] | 49 | return true; |
| 50 | } |
cdalton | 9954bc3 | 2015-04-29 14:17:00 -0700 | [diff] [blame] | 51 | |
bsalomon | 50785a3 | 2015-02-06 07:02:37 -0800 | [diff] [blame] | 52 | GrRenderTarget* rt = pipelineBuilder.getRenderTarget(); |
cdalton | 9954bc3 | 2015-04-29 14:17:00 -0700 | [diff] [blame] | 53 | |
| 54 | if (this->caps()->textureBarrierSupport()) { |
| 55 | if (GrTexture* rtTex = rt->asTexture()) { |
bsalomon | dc47ff7 | 2015-05-26 12:16:59 -0700 | [diff] [blame^] | 56 | // The render target is a texture, so we can read from it directly in the shader. The XP |
cdalton | 9954bc3 | 2015-04-29 14:17:00 -0700 | [diff] [blame] | 57 | // will be responsible to detect this situation and request a texture barrier. |
bsalomon | 6a44c6a | 2015-05-26 09:49:05 -0700 | [diff] [blame] | 58 | dstTexture->setTexture(rtTex); |
| 59 | dstTexture->setOffset(0, 0); |
cdalton | 9954bc3 | 2015-04-29 14:17:00 -0700 | [diff] [blame] | 60 | return true; |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | SkIRect copyRect; |
joshualitt | 44701df | 2015-02-23 14:44:57 -0800 | [diff] [blame] | 65 | pipelineBuilder.clip().getConservativeBounds(rt, ©Rect); |
commit-bot@chromium.org | c4dc0ad | 2013-10-09 14:11:33 +0000 | [diff] [blame] | 66 | |
bsalomon | 49f085d | 2014-09-05 13:34:00 -0700 | [diff] [blame] | 67 | if (drawBounds) { |
commit-bot@chromium.org | c4dc0ad | 2013-10-09 14:11:33 +0000 | [diff] [blame] | 68 | SkIRect drawIBounds; |
| 69 | drawBounds->roundOut(&drawIBounds); |
commit-bot@chromium.org | bb5c465 | 2013-04-01 12:49:31 +0000 | [diff] [blame] | 70 | if (!copyRect.intersect(drawIBounds)) { |
commit-bot@chromium.org | 515dcd3 | 2013-08-28 14:17:03 +0000 | [diff] [blame] | 71 | #ifdef SK_DEBUG |
bsalomon | 682c269 | 2015-05-22 14:01:46 -0700 | [diff] [blame] | 72 | GrCapsDebugf(fCaps, "Missed an early reject. " |
| 73 | "Bailing on draw from setupDstReadIfNecessary.\n"); |
commit-bot@chromium.org | bb5c465 | 2013-04-01 12:49:31 +0000 | [diff] [blame] | 74 | #endif |
| 75 | return false; |
| 76 | } |
| 77 | } else { |
commit-bot@chromium.org | 515dcd3 | 2013-08-28 14:17:03 +0000 | [diff] [blame] | 78 | #ifdef SK_DEBUG |
tfarina | 38406c8 | 2014-10-31 07:11:12 -0700 | [diff] [blame] | 79 | //SkDebugf("No dev bounds when dst copy is made.\n"); |
commit-bot@chromium.org | bb5c465 | 2013-04-01 12:49:31 +0000 | [diff] [blame] | 80 | #endif |
| 81 | } |
skia.committer@gmail.com | 05a2ee0 | 2013-04-02 07:01:34 +0000 | [diff] [blame] | 82 | |
commit-bot@chromium.org | 63150af | 2013-04-11 22:00:22 +0000 | [diff] [blame] | 83 | // MSAA consideration: When there is support for reading MSAA samples in the shader we could |
| 84 | // have per-sample dst values by making the copy multisampled. |
bsalomon | f2703d8 | 2014-10-28 14:33:06 -0700 | [diff] [blame] | 85 | GrSurfaceDesc desc; |
bsalomon | a73239a | 2015-04-28 13:35:17 -0700 | [diff] [blame] | 86 | if (!this->getGpu()->initCopySurfaceDstDesc(rt, &desc)) { |
| 87 | desc.fOrigin = kDefault_GrSurfaceOrigin; |
| 88 | desc.fFlags = kRenderTarget_GrSurfaceFlag; |
| 89 | desc.fConfig = rt->config(); |
| 90 | } |
| 91 | |
| 92 | |
commit-bot@chromium.org | bb5c465 | 2013-04-01 12:49:31 +0000 | [diff] [blame] | 93 | desc.fWidth = copyRect.width(); |
| 94 | desc.fHeight = copyRect.height(); |
bsalomon@google.com | 26e18b5 | 2013-03-29 19:22:36 +0000 | [diff] [blame] | 95 | |
bsalomon | d309e7a | 2015-04-30 14:18:54 -0700 | [diff] [blame] | 96 | SkAutoTUnref<GrTexture> copy(fContext->textureProvider()->refScratchTexture(desc, |
| 97 | GrTextureProvider::kApprox_ScratchTexMatch)); |
bsalomon@google.com | 26e18b5 | 2013-03-29 19:22:36 +0000 | [diff] [blame] | 98 | |
bsalomon | e305973 | 2014-10-14 11:47:22 -0700 | [diff] [blame] | 99 | if (!copy) { |
tfarina | 38406c8 | 2014-10-31 07:11:12 -0700 | [diff] [blame] | 100 | SkDebugf("Failed to create temporary copy of destination texture.\n"); |
bsalomon@google.com | 26e18b5 | 2013-03-29 19:22:36 +0000 | [diff] [blame] | 101 | return false; |
| 102 | } |
bsalomon@google.com | e4617bf | 2013-04-03 14:56:40 +0000 | [diff] [blame] | 103 | SkIPoint dstPoint = {0, 0}; |
mtklein | 404b3b2 | 2015-05-18 09:29:10 -0700 | [diff] [blame] | 104 | if (this->copySurface(copy, rt, copyRect, dstPoint)) { |
bsalomon | 6a44c6a | 2015-05-26 09:49:05 -0700 | [diff] [blame] | 105 | dstTexture->setTexture(copy); |
| 106 | dstTexture->setOffset(copyRect.fLeft, copyRect.fTop); |
mtklein | 404b3b2 | 2015-05-18 09:29:10 -0700 | [diff] [blame] | 107 | return true; |
| 108 | } else { |
| 109 | return false; |
| 110 | } |
bsalomon@google.com | 26e18b5 | 2013-03-29 19:22:36 +0000 | [diff] [blame] | 111 | } |
| 112 | |
bsalomon | a73239a | 2015-04-28 13:35:17 -0700 | [diff] [blame] | 113 | void GrDrawTarget::flush() { |
| 114 | if (fFlushing) { |
| 115 | return; |
| 116 | } |
| 117 | fFlushing = true; |
| 118 | |
| 119 | this->getGpu()->saveActiveTraceMarkers(); |
| 120 | |
| 121 | this->onFlush(); |
| 122 | |
| 123 | this->getGpu()->restoreActiveTraceMarkers(); |
| 124 | |
| 125 | fFlushing = false; |
| 126 | this->reset(); |
| 127 | } |
| 128 | |
joshualitt | 4d8da81 | 2015-01-28 12:53:54 -0800 | [diff] [blame] | 129 | void GrDrawTarget::drawBatch(GrPipelineBuilder* pipelineBuilder, |
joshualitt | 99c7c07 | 2015-05-01 13:43:30 -0700 | [diff] [blame] | 130 | GrBatch* batch) { |
joshualitt | 4d8da81 | 2015-01-28 12:53:54 -0800 | [diff] [blame] | 131 | SkASSERT(pipelineBuilder); |
| 132 | // TODO some kind of checkdraw, but not at this level |
| 133 | |
| 134 | // Setup clip |
| 135 | GrScissorState scissorState; |
bsalomon | 6be6f7c | 2015-02-26 13:05:21 -0800 | [diff] [blame] | 136 | GrPipelineBuilder::AutoRestoreFragmentProcessors arfp; |
joshualitt | 4d8da81 | 2015-01-28 12:53:54 -0800 | [diff] [blame] | 137 | GrPipelineBuilder::AutoRestoreStencil ars; |
joshualitt | 99c7c07 | 2015-05-01 13:43:30 -0700 | [diff] [blame] | 138 | if (!this->setupClip(pipelineBuilder, &arfp, &ars, &scissorState, &batch->bounds())) { |
joshualitt | 4d8da81 | 2015-01-28 12:53:54 -0800 | [diff] [blame] | 139 | return; |
| 140 | } |
| 141 | |
joshualitt | 99c7c07 | 2015-05-01 13:43:30 -0700 | [diff] [blame] | 142 | // Batch bounds are tight, so for dev copies |
| 143 | // TODO move this into setupDstReadIfNecessary when paths are in batch |
| 144 | SkRect bounds = batch->bounds(); |
| 145 | bounds.outset(0.5f, 0.5f); |
| 146 | |
| 147 | GrDrawTarget::PipelineInfo pipelineInfo(pipelineBuilder, &scissorState, batch, &bounds, |
| 148 | this); |
egdaniel | e36914c | 2015-02-13 09:00:33 -0800 | [diff] [blame] | 149 | if (pipelineInfo.mustSkipDraw()) { |
| 150 | return; |
| 151 | } |
| 152 | |
| 153 | this->onDrawBatch(batch, pipelineInfo); |
joshualitt | 4d8da81 | 2015-01-28 12:53:54 -0800 | [diff] [blame] | 154 | } |
| 155 | |
joshualitt | 2c93efe | 2014-11-06 12:57:13 -0800 | [diff] [blame] | 156 | static const GrStencilSettings& winding_path_stencil_settings() { |
| 157 | GR_STATIC_CONST_SAME_STENCIL_STRUCT(gSettings, |
| 158 | kIncClamp_StencilOp, |
| 159 | kIncClamp_StencilOp, |
| 160 | kAlwaysIfInClip_StencilFunc, |
| 161 | 0xFFFF, 0xFFFF, 0xFFFF); |
| 162 | return *GR_CONST_STENCIL_SETTINGS_PTR_FROM_STRUCT_PTR(&gSettings); |
| 163 | } |
| 164 | |
| 165 | static const GrStencilSettings& even_odd_path_stencil_settings() { |
| 166 | GR_STATIC_CONST_SAME_STENCIL_STRUCT(gSettings, |
| 167 | kInvert_StencilOp, |
| 168 | kInvert_StencilOp, |
| 169 | kAlwaysIfInClip_StencilFunc, |
| 170 | 0xFFFF, 0xFFFF, 0xFFFF); |
| 171 | return *GR_CONST_STENCIL_SETTINGS_PTR_FROM_STRUCT_PTR(&gSettings); |
| 172 | } |
| 173 | |
| 174 | void GrDrawTarget::getPathStencilSettingsForFilltype(GrPathRendering::FillType fill, |
egdaniel | 8dc7c3a | 2015-04-16 11:22:42 -0700 | [diff] [blame] | 175 | const GrStencilAttachment* sb, |
joshualitt | 2c93efe | 2014-11-06 12:57:13 -0800 | [diff] [blame] | 176 | GrStencilSettings* outStencilSettings) { |
| 177 | |
| 178 | switch (fill) { |
| 179 | default: |
| 180 | SkFAIL("Unexpected path fill."); |
| 181 | case GrPathRendering::kWinding_FillType: |
| 182 | *outStencilSettings = winding_path_stencil_settings(); |
| 183 | break; |
| 184 | case GrPathRendering::kEvenOdd_FillType: |
| 185 | *outStencilSettings = even_odd_path_stencil_settings(); |
| 186 | break; |
| 187 | } |
joshualitt | 9853cce | 2014-11-17 14:22:48 -0800 | [diff] [blame] | 188 | this->clipMaskManager()->adjustPathStencilParams(sb, outStencilSettings); |
joshualitt | 2c93efe | 2014-11-06 12:57:13 -0800 | [diff] [blame] | 189 | } |
| 190 | |
egdaniel | 8dd688b | 2015-01-22 10:16:09 -0800 | [diff] [blame] | 191 | void GrDrawTarget::stencilPath(GrPipelineBuilder* pipelineBuilder, |
joshualitt | 56995b5 | 2014-12-11 15:44:02 -0800 | [diff] [blame] | 192 | const GrPathProcessor* pathProc, |
joshualitt | 9853cce | 2014-11-17 14:22:48 -0800 | [diff] [blame] | 193 | const GrPath* path, |
| 194 | GrPathRendering::FillType fill) { |
bsalomon@google.com | 64aef2b | 2012-06-11 15:36:13 +0000 | [diff] [blame] | 195 | // TODO: extract portions of checkDraw that are relevant to path stenciling. |
bsalomon | 49f085d | 2014-09-05 13:34:00 -0700 | [diff] [blame] | 196 | SkASSERT(path); |
jvanverth | e9c0fc6 | 2015-04-29 11:18:05 -0700 | [diff] [blame] | 197 | SkASSERT(this->caps()->shaderCaps()->pathRenderingSupport()); |
egdaniel | 8dd688b | 2015-01-22 10:16:09 -0800 | [diff] [blame] | 198 | SkASSERT(pipelineBuilder); |
joshualitt | 2c93efe | 2014-11-06 12:57:13 -0800 | [diff] [blame] | 199 | |
| 200 | // Setup clip |
bsalomon | 3e79124 | 2014-12-17 13:43:13 -0800 | [diff] [blame] | 201 | GrScissorState scissorState; |
bsalomon | 6be6f7c | 2015-02-26 13:05:21 -0800 | [diff] [blame] | 202 | GrPipelineBuilder::AutoRestoreFragmentProcessors arfp; |
egdaniel | 8dd688b | 2015-01-22 10:16:09 -0800 | [diff] [blame] | 203 | GrPipelineBuilder::AutoRestoreStencil ars; |
bsalomon | 6be6f7c | 2015-02-26 13:05:21 -0800 | [diff] [blame] | 204 | if (!this->setupClip(pipelineBuilder, &arfp, &ars, &scissorState, NULL)) { |
joshualitt | 2c93efe | 2014-11-06 12:57:13 -0800 | [diff] [blame] | 205 | return; |
| 206 | } |
| 207 | |
| 208 | // set stencil settings for path |
| 209 | GrStencilSettings stencilSettings; |
bsalomon | 6bc1b5f | 2015-02-23 09:06:38 -0800 | [diff] [blame] | 210 | GrRenderTarget* rt = pipelineBuilder->getRenderTarget(); |
egdaniel | 8dc7c3a | 2015-04-16 11:22:42 -0700 | [diff] [blame] | 211 | GrStencilAttachment* sb = rt->renderTargetPriv().attachStencilAttachment(); |
bsalomon | 6bc1b5f | 2015-02-23 09:06:38 -0800 | [diff] [blame] | 212 | this->getPathStencilSettingsForFilltype(fill, sb, &stencilSettings); |
joshualitt | 2c93efe | 2014-11-06 12:57:13 -0800 | [diff] [blame] | 213 | |
egdaniel | 8dd688b | 2015-01-22 10:16:09 -0800 | [diff] [blame] | 214 | this->onStencilPath(*pipelineBuilder, pathProc, path, scissorState, stencilSettings); |
bsalomon@google.com | 64aef2b | 2012-06-11 15:36:13 +0000 | [diff] [blame] | 215 | } |
| 216 | |
egdaniel | 8dd688b | 2015-01-22 10:16:09 -0800 | [diff] [blame] | 217 | void GrDrawTarget::drawPath(GrPipelineBuilder* pipelineBuilder, |
joshualitt | 56995b5 | 2014-12-11 15:44:02 -0800 | [diff] [blame] | 218 | const GrPathProcessor* pathProc, |
joshualitt | 9853cce | 2014-11-17 14:22:48 -0800 | [diff] [blame] | 219 | const GrPath* path, |
| 220 | GrPathRendering::FillType fill) { |
commit-bot@chromium.org | c4dc0ad | 2013-10-09 14:11:33 +0000 | [diff] [blame] | 221 | // TODO: extract portions of checkDraw that are relevant to path rendering. |
bsalomon | 49f085d | 2014-09-05 13:34:00 -0700 | [diff] [blame] | 222 | SkASSERT(path); |
jvanverth | e9c0fc6 | 2015-04-29 11:18:05 -0700 | [diff] [blame] | 223 | SkASSERT(this->caps()->shaderCaps()->pathRenderingSupport()); |
egdaniel | 8dd688b | 2015-01-22 10:16:09 -0800 | [diff] [blame] | 224 | SkASSERT(pipelineBuilder); |
commit-bot@chromium.org | c4dc0ad | 2013-10-09 14:11:33 +0000 | [diff] [blame] | 225 | |
joshualitt | 92e496f | 2014-10-31 13:56:50 -0700 | [diff] [blame] | 226 | SkRect devBounds = path->getBounds(); |
joshualitt | 8059eb9 | 2014-12-29 15:10:07 -0800 | [diff] [blame] | 227 | pathProc->viewMatrix().mapRect(&devBounds); |
commit-bot@chromium.org | c4dc0ad | 2013-10-09 14:11:33 +0000 | [diff] [blame] | 228 | |
joshualitt | 2c93efe | 2014-11-06 12:57:13 -0800 | [diff] [blame] | 229 | // Setup clip |
bsalomon | 3e79124 | 2014-12-17 13:43:13 -0800 | [diff] [blame] | 230 | GrScissorState scissorState; |
bsalomon | 6be6f7c | 2015-02-26 13:05:21 -0800 | [diff] [blame] | 231 | GrPipelineBuilder::AutoRestoreFragmentProcessors arfp; |
egdaniel | 8dd688b | 2015-01-22 10:16:09 -0800 | [diff] [blame] | 232 | GrPipelineBuilder::AutoRestoreStencil ars; |
bsalomon | 6be6f7c | 2015-02-26 13:05:21 -0800 | [diff] [blame] | 233 | if (!this->setupClip(pipelineBuilder, &arfp, &ars, &scissorState, &devBounds)) { |
joshualitt | 2c93efe | 2014-11-06 12:57:13 -0800 | [diff] [blame] | 234 | return; |
| 235 | } |
| 236 | |
| 237 | // set stencil settings for path |
| 238 | GrStencilSettings stencilSettings; |
bsalomon | 6bc1b5f | 2015-02-23 09:06:38 -0800 | [diff] [blame] | 239 | GrRenderTarget* rt = pipelineBuilder->getRenderTarget(); |
egdaniel | 8dc7c3a | 2015-04-16 11:22:42 -0700 | [diff] [blame] | 240 | GrStencilAttachment* sb = rt->renderTargetPriv().attachStencilAttachment(); |
bsalomon | 6bc1b5f | 2015-02-23 09:06:38 -0800 | [diff] [blame] | 241 | this->getPathStencilSettingsForFilltype(fill, sb, &stencilSettings); |
joshualitt | 2c93efe | 2014-11-06 12:57:13 -0800 | [diff] [blame] | 242 | |
egdaniel | e36914c | 2015-02-13 09:00:33 -0800 | [diff] [blame] | 243 | GrDrawTarget::PipelineInfo pipelineInfo(pipelineBuilder, &scissorState, pathProc, &devBounds, |
| 244 | this); |
| 245 | if (pipelineInfo.mustSkipDraw()) { |
| 246 | return; |
| 247 | } |
| 248 | |
| 249 | this->onDrawPath(pathProc, path, stencilSettings, pipelineInfo); |
commit-bot@chromium.org | c4dc0ad | 2013-10-09 14:11:33 +0000 | [diff] [blame] | 250 | } |
| 251 | |
egdaniel | 8dd688b | 2015-01-22 10:16:09 -0800 | [diff] [blame] | 252 | void GrDrawTarget::drawPaths(GrPipelineBuilder* pipelineBuilder, |
joshualitt | 56995b5 | 2014-12-11 15:44:02 -0800 | [diff] [blame] | 253 | const GrPathProcessor* pathProc, |
joshualitt | 9853cce | 2014-11-17 14:22:48 -0800 | [diff] [blame] | 254 | const GrPathRange* pathRange, |
cdalton | 55b24af | 2014-11-25 11:00:56 -0800 | [diff] [blame] | 255 | const void* indices, |
| 256 | PathIndexType indexType, |
| 257 | const float transformValues[], |
| 258 | PathTransformType transformType, |
joshualitt | 9853cce | 2014-11-17 14:22:48 -0800 | [diff] [blame] | 259 | int count, |
joshualitt | 92e496f | 2014-10-31 13:56:50 -0700 | [diff] [blame] | 260 | GrPathRendering::FillType fill) { |
jvanverth | e9c0fc6 | 2015-04-29 11:18:05 -0700 | [diff] [blame] | 261 | SkASSERT(this->caps()->shaderCaps()->pathRenderingSupport()); |
bsalomon | 49f085d | 2014-09-05 13:34:00 -0700 | [diff] [blame] | 262 | SkASSERT(pathRange); |
| 263 | SkASSERT(indices); |
cdalton | 55b24af | 2014-11-25 11:00:56 -0800 | [diff] [blame] | 264 | SkASSERT(0 == reinterpret_cast<long>(indices) % GrPathRange::PathIndexSizeInBytes(indexType)); |
| 265 | SkASSERT(transformValues); |
egdaniel | 8dd688b | 2015-01-22 10:16:09 -0800 | [diff] [blame] | 266 | SkASSERT(pipelineBuilder); |
commit-bot@chromium.org | 9b62aa1 | 2014-03-25 11:59:40 +0000 | [diff] [blame] | 267 | |
joshualitt | 2c93efe | 2014-11-06 12:57:13 -0800 | [diff] [blame] | 268 | // Setup clip |
bsalomon | 3e79124 | 2014-12-17 13:43:13 -0800 | [diff] [blame] | 269 | GrScissorState scissorState; |
bsalomon | 6be6f7c | 2015-02-26 13:05:21 -0800 | [diff] [blame] | 270 | GrPipelineBuilder::AutoRestoreFragmentProcessors arfp; |
egdaniel | 8dd688b | 2015-01-22 10:16:09 -0800 | [diff] [blame] | 271 | GrPipelineBuilder::AutoRestoreStencil ars; |
joshualitt | 2c93efe | 2014-11-06 12:57:13 -0800 | [diff] [blame] | 272 | |
bsalomon | 6be6f7c | 2015-02-26 13:05:21 -0800 | [diff] [blame] | 273 | if (!this->setupClip(pipelineBuilder, &arfp, &ars, &scissorState, NULL)) { |
joshualitt | 2c93efe | 2014-11-06 12:57:13 -0800 | [diff] [blame] | 274 | return; |
| 275 | } |
| 276 | |
| 277 | // set stencil settings for path |
| 278 | GrStencilSettings stencilSettings; |
bsalomon | 6bc1b5f | 2015-02-23 09:06:38 -0800 | [diff] [blame] | 279 | GrRenderTarget* rt = pipelineBuilder->getRenderTarget(); |
egdaniel | 8dc7c3a | 2015-04-16 11:22:42 -0700 | [diff] [blame] | 280 | GrStencilAttachment* sb = rt->renderTargetPriv().attachStencilAttachment(); |
bsalomon | 6bc1b5f | 2015-02-23 09:06:38 -0800 | [diff] [blame] | 281 | this->getPathStencilSettingsForFilltype(fill, sb, &stencilSettings); |
joshualitt | 2c93efe | 2014-11-06 12:57:13 -0800 | [diff] [blame] | 282 | |
bsalomon | 50785a3 | 2015-02-06 07:02:37 -0800 | [diff] [blame] | 283 | // Don't compute a bounding box for dst copy texture, we'll opt |
cdalton | b85a0aa | 2014-07-21 15:32:44 -0700 | [diff] [blame] | 284 | // instead for it to just copy the entire dst. Realistically this is a moot |
| 285 | // point, because any context that supports NV_path_rendering will also |
| 286 | // support NV_blend_equation_advanced. |
egdaniel | e36914c | 2015-02-13 09:00:33 -0800 | [diff] [blame] | 287 | GrDrawTarget::PipelineInfo pipelineInfo(pipelineBuilder, &scissorState, pathProc, NULL, this); |
| 288 | if (pipelineInfo.mustSkipDraw()) { |
| 289 | return; |
| 290 | } |
| 291 | |
| 292 | this->onDrawPaths(pathProc, pathRange, indices, indexType, transformValues, |
| 293 | transformType, count, stencilSettings, pipelineInfo); |
commit-bot@chromium.org | 9b62aa1 | 2014-03-25 11:59:40 +0000 | [diff] [blame] | 294 | } |
| 295 | |
robertphillips | ea46150 | 2015-05-26 11:38:03 -0700 | [diff] [blame] | 296 | void GrDrawTarget::drawBWRect(GrPipelineBuilder* pipelineBuilder, |
joshualitt | ad17cfc | 2015-05-05 10:45:57 -0700 | [diff] [blame] | 297 | GrColor color, |
| 298 | const SkMatrix& viewMatrix, |
| 299 | const SkRect& rect, |
| 300 | const SkRect* localRect, |
| 301 | const SkMatrix* localMatrix) { |
| 302 | SkAutoTUnref<GrBatch> batch(GrRectBatch::Create(color, viewMatrix, rect, localRect, |
| 303 | localMatrix)); |
| 304 | this->drawBatch(pipelineBuilder, batch); |
| 305 | } |
| 306 | |
robertphillips | ea46150 | 2015-05-26 11:38:03 -0700 | [diff] [blame] | 307 | void GrDrawTarget::drawAARect(GrPipelineBuilder* pipelineBuilder, |
| 308 | GrColor color, |
| 309 | const SkMatrix& viewMatrix, |
| 310 | const SkRect& rect, |
| 311 | const SkRect& devRect) { |
| 312 | GrAARectRenderer::FillAARect(this, pipelineBuilder, color, viewMatrix, rect, devRect); |
| 313 | } |
| 314 | |
joshualitt | 9853cce | 2014-11-17 14:22:48 -0800 | [diff] [blame] | 315 | void GrDrawTarget::clear(const SkIRect* rect, |
| 316 | GrColor color, |
| 317 | bool canIgnoreRect, |
bsalomon | 63b2196 | 2014-11-05 07:05:34 -0800 | [diff] [blame] | 318 | GrRenderTarget* renderTarget) { |
| 319 | if (fCaps->useDrawInsteadOfClear()) { |
| 320 | // This works around a driver bug with clear by drawing a rect instead. |
| 321 | // The driver will ignore a clear if it is the only thing rendered to a |
| 322 | // target before the target is read. |
| 323 | SkIRect rtRect = SkIRect::MakeWH(renderTarget->width(), renderTarget->height()); |
| 324 | if (NULL == rect || canIgnoreRect || rect->contains(rtRect)) { |
| 325 | rect = &rtRect; |
| 326 | // We first issue a discard() since that may help tilers. |
| 327 | this->discard(renderTarget); |
| 328 | } |
bsalomon | 63b2196 | 2014-11-05 07:05:34 -0800 | [diff] [blame] | 329 | |
egdaniel | 8dd688b | 2015-01-22 10:16:09 -0800 | [diff] [blame] | 330 | GrPipelineBuilder pipelineBuilder; |
| 331 | pipelineBuilder.setRenderTarget(renderTarget); |
joshualitt | 9853cce | 2014-11-17 14:22:48 -0800 | [diff] [blame] | 332 | |
egdaniel | 8dd688b | 2015-01-22 10:16:09 -0800 | [diff] [blame] | 333 | this->drawSimpleRect(&pipelineBuilder, color, SkMatrix::I(), *rect); |
bsalomon | 63b2196 | 2014-11-05 07:05:34 -0800 | [diff] [blame] | 334 | } else { |
| 335 | this->onClear(rect, color, canIgnoreRect, renderTarget); |
| 336 | } |
| 337 | } |
| 338 | |
egdaniel | 3eee383 | 2014-06-18 13:09:11 -0700 | [diff] [blame] | 339 | typedef GrTraceMarkerSet::Iter TMIter; |
| 340 | void GrDrawTarget::saveActiveTraceMarkers() { |
| 341 | if (this->caps()->gpuTracingSupport()) { |
| 342 | SkASSERT(0 == fStoredTraceMarkers.count()); |
| 343 | fStoredTraceMarkers.addSet(fActiveTraceMarkers); |
| 344 | for (TMIter iter = fStoredTraceMarkers.begin(); iter != fStoredTraceMarkers.end(); ++iter) { |
| 345 | this->removeGpuTraceMarker(&(*iter)); |
| 346 | } |
| 347 | } |
| 348 | } |
| 349 | |
| 350 | void GrDrawTarget::restoreActiveTraceMarkers() { |
| 351 | if (this->caps()->gpuTracingSupport()) { |
| 352 | SkASSERT(0 == fActiveTraceMarkers.count()); |
| 353 | for (TMIter iter = fStoredTraceMarkers.begin(); iter != fStoredTraceMarkers.end(); ++iter) { |
| 354 | this->addGpuTraceMarker(&(*iter)); |
| 355 | } |
| 356 | for (TMIter iter = fActiveTraceMarkers.begin(); iter != fActiveTraceMarkers.end(); ++iter) { |
| 357 | this->fStoredTraceMarkers.remove(*iter); |
| 358 | } |
| 359 | } |
| 360 | } |
| 361 | |
| 362 | void GrDrawTarget::addGpuTraceMarker(const GrGpuTraceMarker* marker) { |
commit-bot@chromium.org | a3baf3b | 2014-02-21 18:45:30 +0000 | [diff] [blame] | 363 | if (this->caps()->gpuTracingSupport()) { |
commit-bot@chromium.org | 2a05de0 | 2014-03-25 15:17:32 +0000 | [diff] [blame] | 364 | SkASSERT(fGpuTraceMarkerCount >= 0); |
| 365 | this->fActiveTraceMarkers.add(*marker); |
commit-bot@chromium.org | 2a05de0 | 2014-03-25 15:17:32 +0000 | [diff] [blame] | 366 | ++fGpuTraceMarkerCount; |
commit-bot@chromium.org | a3baf3b | 2014-02-21 18:45:30 +0000 | [diff] [blame] | 367 | } |
| 368 | } |
| 369 | |
egdaniel | 3eee383 | 2014-06-18 13:09:11 -0700 | [diff] [blame] | 370 | void GrDrawTarget::removeGpuTraceMarker(const GrGpuTraceMarker* marker) { |
commit-bot@chromium.org | a3baf3b | 2014-02-21 18:45:30 +0000 | [diff] [blame] | 371 | if (this->caps()->gpuTracingSupport()) { |
commit-bot@chromium.org | 2a05de0 | 2014-03-25 15:17:32 +0000 | [diff] [blame] | 372 | SkASSERT(fGpuTraceMarkerCount >= 1); |
| 373 | this->fActiveTraceMarkers.remove(*marker); |
commit-bot@chromium.org | 2a05de0 | 2014-03-25 15:17:32 +0000 | [diff] [blame] | 374 | --fGpuTraceMarkerCount; |
commit-bot@chromium.org | a3baf3b | 2014-02-21 18:45:30 +0000 | [diff] [blame] | 375 | } |
| 376 | } |
| 377 | |
bsalomon@google.com | 25fb21f | 2011-06-21 18:17:25 +0000 | [diff] [blame] | 378 | //////////////////////////////////////////////////////////////////////////////// |
bsalomon@google.com | 86afc2a | 2011-02-16 16:12:19 +0000 | [diff] [blame] | 379 | |
bsalomon@google.com | 116ad84 | 2013-04-09 15:38:19 +0000 | [diff] [blame] | 380 | namespace { |
| 381 | // returns true if the read/written rect intersects the src/dst and false if not. |
| 382 | bool clip_srcrect_and_dstpoint(const GrSurface* dst, |
| 383 | const GrSurface* src, |
bsalomon@google.com | e4617bf | 2013-04-03 14:56:40 +0000 | [diff] [blame] | 384 | const SkIRect& srcRect, |
bsalomon@google.com | 116ad84 | 2013-04-09 15:38:19 +0000 | [diff] [blame] | 385 | const SkIPoint& dstPoint, |
| 386 | SkIRect* clippedSrcRect, |
| 387 | SkIPoint* clippedDstPoint) { |
| 388 | *clippedSrcRect = srcRect; |
| 389 | *clippedDstPoint = dstPoint; |
skia.committer@gmail.com | a9493a3 | 2013-04-04 07:01:12 +0000 | [diff] [blame] | 390 | |
bsalomon@google.com | 116ad84 | 2013-04-09 15:38:19 +0000 | [diff] [blame] | 391 | // clip the left edge to src and dst bounds, adjusting dstPoint if necessary |
| 392 | if (clippedSrcRect->fLeft < 0) { |
| 393 | clippedDstPoint->fX -= clippedSrcRect->fLeft; |
| 394 | clippedSrcRect->fLeft = 0; |
bsalomon@google.com | e4617bf | 2013-04-03 14:56:40 +0000 | [diff] [blame] | 395 | } |
bsalomon@google.com | 116ad84 | 2013-04-09 15:38:19 +0000 | [diff] [blame] | 396 | if (clippedDstPoint->fX < 0) { |
| 397 | clippedSrcRect->fLeft -= clippedDstPoint->fX; |
| 398 | clippedDstPoint->fX = 0; |
bsalomon@google.com | e4617bf | 2013-04-03 14:56:40 +0000 | [diff] [blame] | 399 | } |
| 400 | |
bsalomon@google.com | 116ad84 | 2013-04-09 15:38:19 +0000 | [diff] [blame] | 401 | // clip the top edge to src and dst bounds, adjusting dstPoint if necessary |
| 402 | if (clippedSrcRect->fTop < 0) { |
| 403 | clippedDstPoint->fY -= clippedSrcRect->fTop; |
| 404 | clippedSrcRect->fTop = 0; |
bsalomon@google.com | e4617bf | 2013-04-03 14:56:40 +0000 | [diff] [blame] | 405 | } |
bsalomon@google.com | 116ad84 | 2013-04-09 15:38:19 +0000 | [diff] [blame] | 406 | if (clippedDstPoint->fY < 0) { |
| 407 | clippedSrcRect->fTop -= clippedDstPoint->fY; |
| 408 | clippedDstPoint->fY = 0; |
bsalomon@google.com | e4617bf | 2013-04-03 14:56:40 +0000 | [diff] [blame] | 409 | } |
skia.committer@gmail.com | a9493a3 | 2013-04-04 07:01:12 +0000 | [diff] [blame] | 410 | |
bsalomon@google.com | e4617bf | 2013-04-03 14:56:40 +0000 | [diff] [blame] | 411 | // clip the right edge to the src and dst bounds. |
bsalomon@google.com | 116ad84 | 2013-04-09 15:38:19 +0000 | [diff] [blame] | 412 | if (clippedSrcRect->fRight > src->width()) { |
| 413 | clippedSrcRect->fRight = src->width(); |
bsalomon@google.com | e4617bf | 2013-04-03 14:56:40 +0000 | [diff] [blame] | 414 | } |
bsalomon@google.com | 116ad84 | 2013-04-09 15:38:19 +0000 | [diff] [blame] | 415 | if (clippedDstPoint->fX + clippedSrcRect->width() > dst->width()) { |
| 416 | clippedSrcRect->fRight = clippedSrcRect->fLeft + dst->width() - clippedDstPoint->fX; |
bsalomon@google.com | e4617bf | 2013-04-03 14:56:40 +0000 | [diff] [blame] | 417 | } |
| 418 | |
| 419 | // clip the bottom edge to the src and dst bounds. |
bsalomon@google.com | 116ad84 | 2013-04-09 15:38:19 +0000 | [diff] [blame] | 420 | if (clippedSrcRect->fBottom > src->height()) { |
| 421 | clippedSrcRect->fBottom = src->height(); |
bsalomon@google.com | e4617bf | 2013-04-03 14:56:40 +0000 | [diff] [blame] | 422 | } |
bsalomon@google.com | 116ad84 | 2013-04-09 15:38:19 +0000 | [diff] [blame] | 423 | if (clippedDstPoint->fY + clippedSrcRect->height() > dst->height()) { |
| 424 | clippedSrcRect->fBottom = clippedSrcRect->fTop + dst->height() - clippedDstPoint->fY; |
bsalomon@google.com | e4617bf | 2013-04-03 14:56:40 +0000 | [diff] [blame] | 425 | } |
skia.committer@gmail.com | a9493a3 | 2013-04-04 07:01:12 +0000 | [diff] [blame] | 426 | |
bsalomon@google.com | e4617bf | 2013-04-03 14:56:40 +0000 | [diff] [blame] | 427 | // The above clipping steps may have inverted the rect if it didn't intersect either the src or |
| 428 | // dst bounds. |
bsalomon@google.com | 116ad84 | 2013-04-09 15:38:19 +0000 | [diff] [blame] | 429 | return !clippedSrcRect->isEmpty(); |
| 430 | } |
| 431 | } |
| 432 | |
mtklein | 404b3b2 | 2015-05-18 09:29:10 -0700 | [diff] [blame] | 433 | bool GrDrawTarget::copySurface(GrSurface* dst, |
bsalomon@google.com | 116ad84 | 2013-04-09 15:38:19 +0000 | [diff] [blame] | 434 | GrSurface* src, |
| 435 | const SkIRect& srcRect, |
| 436 | const SkIPoint& dstPoint) { |
bsalomon | 49f085d | 2014-09-05 13:34:00 -0700 | [diff] [blame] | 437 | SkASSERT(dst); |
| 438 | SkASSERT(src); |
bsalomon@google.com | 116ad84 | 2013-04-09 15:38:19 +0000 | [diff] [blame] | 439 | |
| 440 | SkIRect clippedSrcRect; |
| 441 | SkIPoint clippedDstPoint; |
| 442 | // If the rect is outside the src or dst then we've already succeeded. |
| 443 | if (!clip_srcrect_and_dstpoint(dst, |
| 444 | src, |
| 445 | srcRect, |
| 446 | dstPoint, |
| 447 | &clippedSrcRect, |
| 448 | &clippedDstPoint)) { |
mtklein | 404b3b2 | 2015-05-18 09:29:10 -0700 | [diff] [blame] | 449 | return true; |
bsalomon@google.com | e4617bf | 2013-04-03 14:56:40 +0000 | [diff] [blame] | 450 | } |
| 451 | |
mtklein | 404b3b2 | 2015-05-18 09:29:10 -0700 | [diff] [blame] | 452 | if (this->getGpu()->canCopySurface(dst, src, clippedSrcRect, clippedDstPoint)) { |
| 453 | this->onCopySurface(dst, src, clippedSrcRect, clippedDstPoint); |
| 454 | return true; |
| 455 | } |
| 456 | |
| 457 | GrRenderTarget* rt = dst->asRenderTarget(); |
| 458 | GrTexture* tex = src->asTexture(); |
| 459 | |
| 460 | if ((dst == src) || !rt || !tex) { |
| 461 | return false; |
| 462 | } |
| 463 | |
| 464 | GrPipelineBuilder pipelineBuilder; |
| 465 | pipelineBuilder.setRenderTarget(rt); |
| 466 | SkMatrix matrix; |
| 467 | matrix.setTranslate(SkIntToScalar(clippedSrcRect.fLeft - clippedDstPoint.fX), |
| 468 | SkIntToScalar(clippedSrcRect.fTop - clippedDstPoint.fY)); |
| 469 | matrix.postIDiv(tex->width(), tex->height()); |
| 470 | pipelineBuilder.addColorTextureProcessor(tex, matrix); |
| 471 | SkIRect dstRect = SkIRect::MakeXYWH(clippedDstPoint.fX, |
| 472 | clippedDstPoint.fY, |
| 473 | clippedSrcRect.width(), |
| 474 | clippedSrcRect.height()); |
| 475 | this->drawSimpleRect(&pipelineBuilder, GrColor_WHITE, SkMatrix::I(), dstRect); |
| 476 | return true; |
| 477 | } |
| 478 | |
| 479 | bool GrDrawTarget::canCopySurface(const GrSurface* dst, |
| 480 | const GrSurface* src, |
| 481 | const SkIRect& srcRect, |
| 482 | const SkIPoint& dstPoint) { |
| 483 | SkASSERT(dst); |
| 484 | SkASSERT(src); |
| 485 | |
| 486 | SkIRect clippedSrcRect; |
| 487 | SkIPoint clippedDstPoint; |
| 488 | // If the rect is outside the src or dst then we're guaranteed success |
| 489 | if (!clip_srcrect_and_dstpoint(dst, |
| 490 | src, |
| 491 | srcRect, |
| 492 | dstPoint, |
| 493 | &clippedSrcRect, |
| 494 | &clippedDstPoint)) { |
| 495 | return true; |
| 496 | } |
| 497 | return ((dst != src) && dst->asRenderTarget() && src->asTexture()) || |
| 498 | this->getGpu()->canCopySurface(dst, src, clippedSrcRect, clippedDstPoint); |
bsalomon@google.com | eb85117 | 2013-04-15 13:51:00 +0000 | [diff] [blame] | 499 | } |
| 500 | |
egdaniel | e36914c | 2015-02-13 09:00:33 -0800 | [diff] [blame] | 501 | void GrDrawTarget::setupPipeline(const PipelineInfo& pipelineInfo, |
| 502 | GrPipeline* pipeline) { |
| 503 | SkNEW_PLACEMENT_ARGS(pipeline, GrPipeline, (*pipelineInfo.fPipelineBuilder, |
| 504 | pipelineInfo.fColorPOI, |
| 505 | pipelineInfo.fCoveragePOI, |
| 506 | *this->caps(), |
| 507 | *pipelineInfo.fScissor, |
bsalomon | 6a44c6a | 2015-05-26 09:49:05 -0700 | [diff] [blame] | 508 | &pipelineInfo.fDstTexture)); |
egdaniel | e36914c | 2015-02-13 09:00:33 -0800 | [diff] [blame] | 509 | } |
| 510 | /////////////////////////////////////////////////////////////////////////////// |
| 511 | |
| 512 | GrDrawTarget::PipelineInfo::PipelineInfo(GrPipelineBuilder* pipelineBuilder, |
| 513 | GrScissorState* scissor, |
| 514 | const GrPrimitiveProcessor* primProc, |
| 515 | const SkRect* devBounds, |
| 516 | GrDrawTarget* target) |
| 517 | : fPipelineBuilder(pipelineBuilder) |
| 518 | , fScissor(scissor) { |
| 519 | fColorPOI = fPipelineBuilder->colorProcInfo(primProc); |
| 520 | fCoveragePOI = fPipelineBuilder->coverageProcInfo(primProc); |
| 521 | if (!target->setupDstReadIfNecessary(*fPipelineBuilder, fColorPOI, fCoveragePOI, |
bsalomon | 6a44c6a | 2015-05-26 09:49:05 -0700 | [diff] [blame] | 522 | &fDstTexture, devBounds)) { |
egdaniel | e36914c | 2015-02-13 09:00:33 -0800 | [diff] [blame] | 523 | fPipelineBuilder = NULL; |
| 524 | } |
| 525 | } |
| 526 | |
| 527 | GrDrawTarget::PipelineInfo::PipelineInfo(GrPipelineBuilder* pipelineBuilder, |
| 528 | GrScissorState* scissor, |
| 529 | const GrBatch* batch, |
| 530 | const SkRect* devBounds, |
| 531 | GrDrawTarget* target) |
| 532 | : fPipelineBuilder(pipelineBuilder) |
| 533 | , fScissor(scissor) { |
| 534 | fColorPOI = fPipelineBuilder->colorProcInfo(batch); |
| 535 | fCoveragePOI = fPipelineBuilder->coverageProcInfo(batch); |
| 536 | if (!target->setupDstReadIfNecessary(*fPipelineBuilder, fColorPOI, fCoveragePOI, |
bsalomon | 6a44c6a | 2015-05-26 09:49:05 -0700 | [diff] [blame] | 537 | &fDstTexture, devBounds)) { |
egdaniel | e36914c | 2015-02-13 09:00:33 -0800 | [diff] [blame] | 538 | fPipelineBuilder = NULL; |
| 539 | } |
| 540 | } |
| 541 | |
bsalomon@google.com | bcce892 | 2013-03-25 15:38:39 +0000 | [diff] [blame] | 542 | /////////////////////////////////////////////////////////////////////////////// |
| 543 | |
egdaniel | 8dd688b | 2015-01-22 10:16:09 -0800 | [diff] [blame] | 544 | bool GrClipTarget::setupClip(GrPipelineBuilder* pipelineBuilder, |
bsalomon | 6be6f7c | 2015-02-26 13:05:21 -0800 | [diff] [blame] | 545 | GrPipelineBuilder::AutoRestoreFragmentProcessors* arfp, |
egdaniel | 8dd688b | 2015-01-22 10:16:09 -0800 | [diff] [blame] | 546 | GrPipelineBuilder::AutoRestoreStencil* ars, |
joshualitt | 8059eb9 | 2014-12-29 15:10:07 -0800 | [diff] [blame] | 547 | GrScissorState* scissorState, |
| 548 | const SkRect* devBounds) { |
egdaniel | 8dd688b | 2015-01-22 10:16:09 -0800 | [diff] [blame] | 549 | return fClipMaskManager.setupClipping(pipelineBuilder, |
bsalomon | 6be6f7c | 2015-02-26 13:05:21 -0800 | [diff] [blame] | 550 | arfp, |
joshualitt | 2c93efe | 2014-11-06 12:57:13 -0800 | [diff] [blame] | 551 | ars, |
joshualitt | 9853cce | 2014-11-17 14:22:48 -0800 | [diff] [blame] | 552 | scissorState, |
joshualitt | 9853cce | 2014-11-17 14:22:48 -0800 | [diff] [blame] | 553 | devBounds); |
joshualitt | 2c93efe | 2014-11-06 12:57:13 -0800 | [diff] [blame] | 554 | } |