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