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 | |
bsalomon | eb1cb5c | 2015-05-22 08:01:09 -0700 | [diff] [blame] | 11 | #include "GrCaps.h" |
bsalomon | 4061b12 | 2015-05-29 10:26:19 -0700 | [diff] [blame] | 12 | #include "GrGpu.h" |
commit-bot@chromium.org | c4dc0ad | 2013-10-09 14:11:33 +0000 | [diff] [blame] | 13 | #include "GrPath.h" |
egdaniel | e36914c | 2015-02-13 09:00:33 -0800 | [diff] [blame] | 14 | #include "GrPipeline.h" |
joshualitt | b7133be | 2015-04-08 09:08:31 -0700 | [diff] [blame] | 15 | #include "GrMemoryPool.h" |
bsalomon@google.com | 8f9cbd6 | 2011-12-09 15:55:34 +0000 | [diff] [blame] | 16 | #include "GrRenderTarget.h" |
bsalomon | 4061b12 | 2015-05-29 10:26:19 -0700 | [diff] [blame] | 17 | #include "GrResourceProvider.h" |
bsalomon | 6bc1b5f | 2015-02-23 09:06:38 -0800 | [diff] [blame] | 18 | #include "GrRenderTargetPriv.h" |
bsalomon | afbf2d6 | 2014-09-30 12:18:44 -0700 | [diff] [blame] | 19 | #include "GrSurfacePriv.h" |
bsalomon@google.com | 86afc2a | 2011-02-16 16:12:19 +0000 | [diff] [blame] | 20 | #include "GrTexture.h" |
bsalomon@google.com | 25fb21f | 2011-06-21 18:17:25 +0000 | [diff] [blame] | 21 | #include "GrVertexBuffer.h" |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 22 | |
bsalomon | 5346983 | 2015-08-18 09:20:09 -0700 | [diff] [blame] | 23 | #include "batches/GrClearBatch.h" |
bsalomon | 872062c | 2015-08-18 12:12:35 -0700 | [diff] [blame] | 24 | #include "batches/GrCopySurfaceBatch.h" |
bsalomon | 5346983 | 2015-08-18 09:20:09 -0700 | [diff] [blame] | 25 | #include "batches/GrDiscardBatch.h" |
bsalomon | 16b9913 | 2015-08-13 14:55:50 -0700 | [diff] [blame] | 26 | #include "batches/GrDrawBatch.h" |
bsalomon | add79ef | 2015-08-19 13:26:49 -0700 | [diff] [blame] | 27 | #include "batches/GrDrawPathBatch.h" |
joshualitt | ecd1a69 | 2015-08-10 10:08:26 -0700 | [diff] [blame] | 28 | #include "batches/GrRectBatchFactory.h" |
bsalomon | a44919e | 2015-08-18 13:28:19 -0700 | [diff] [blame] | 29 | #include "batches/GrStencilPathBatch.h" |
joshualitt | 7441782 | 2015-08-07 11:42:16 -0700 | [diff] [blame] | 30 | |
sugoi@google.com | 5f74cf8 | 2012-12-17 21:16:45 +0000 | [diff] [blame] | 31 | #include "SkStrokeRec.h" |
sugoi@google.com | 12b4e27 | 2012-12-06 20:13:11 +0000 | [diff] [blame] | 32 | |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 33 | //////////////////////////////////////////////////////////////////////////////// |
| 34 | |
bsalomon | 4061b12 | 2015-05-29 10:26:19 -0700 | [diff] [blame] | 35 | GrDrawTarget::GrDrawTarget(GrGpu* gpu, GrResourceProvider* resourceProvider) |
| 36 | : fGpu(SkRef(gpu)) |
bsalomon | 4061b12 | 2015-05-29 10:26:19 -0700 | [diff] [blame] | 37 | , fResourceProvider(resourceProvider) |
joshualitt | f6d259b | 2015-10-02 11:27:14 -0700 | [diff] [blame] | 38 | , fFlushState(fGpu, fResourceProvider, 0) |
bsalomon | 512be53 | 2015-09-10 10:42:55 -0700 | [diff] [blame] | 39 | , fFlushing(false) |
robertphillips | a106c62 | 2015-10-16 09:07:06 -0700 | [diff] [blame] | 40 | , fFirstUnpreparedBatch(0) |
robertphillips | 6a18665 | 2015-10-20 07:37:58 -0700 | [diff] [blame^] | 41 | , fFlags(0) { |
bsalomon | b3b9aec | 2015-09-10 11:16:35 -0700 | [diff] [blame] | 42 | // TODO: Stop extracting the context (currently needed by GrClipMaskManager) |
| 43 | fContext = fGpu->getContext(); |
Brian Salomon | e66fec2 | 2015-09-10 14:40:20 -0400 | [diff] [blame] | 44 | fClipMaskManager.reset(new GrClipMaskManager(this)); |
bsalomon | 4061b12 | 2015-05-29 10:26:19 -0700 | [diff] [blame] | 45 | } |
| 46 | |
| 47 | GrDrawTarget::~GrDrawTarget() { |
| 48 | fGpu->unref(); |
bsalomon@google.com | 25fb21f | 2011-06-21 18:17:25 +0000 | [diff] [blame] | 49 | } |
| 50 | |
| 51 | //////////////////////////////////////////////////////////////////////////////// |
| 52 | |
robertphillips | 6a18665 | 2015-10-20 07:37:58 -0700 | [diff] [blame^] | 53 | // Add a GrDrawTarget-based dependency |
| 54 | void GrDrawTarget::addDependency(GrDrawTarget* dependedOn) { |
| 55 | SkASSERT(!dependedOn->dependsOn(this)); // loops are bad |
| 56 | |
| 57 | if (this->dependsOn(dependedOn)) { |
| 58 | return; // don't add duplicate dependencies |
| 59 | } |
| 60 | |
| 61 | *fDependencies.push() = dependedOn; |
| 62 | } |
| 63 | |
| 64 | // Convert from a GrSurface-based dependency to a GrDrawTarget one |
| 65 | void GrDrawTarget::addDependency(GrSurface* dependedOn) { |
| 66 | if (dependedOn->asRenderTarget() && dependedOn->asRenderTarget()->getLastDrawTarget()) { |
| 67 | // If it is still receiving dependencies, this DT shouldn't be closed |
| 68 | SkASSERT(!this->isClosed()); |
| 69 | |
| 70 | GrDrawTarget* dt = dependedOn->asRenderTarget()->getLastDrawTarget(); |
| 71 | if (dt == this) { |
| 72 | // self-read - presumably for dst reads |
| 73 | } else { |
| 74 | this->addDependency(dt); |
| 75 | |
| 76 | // Can't make it closed in the self-read case |
| 77 | dt->makeClosed(); |
| 78 | } |
| 79 | } |
| 80 | } |
| 81 | |
bsalomon | 50785a3 | 2015-02-06 07:02:37 -0800 | [diff] [blame] | 82 | bool GrDrawTarget::setupDstReadIfNecessary(const GrPipelineBuilder& pipelineBuilder, |
egdaniel | e36914c | 2015-02-13 09:00:33 -0800 | [diff] [blame] | 83 | const GrProcOptInfo& colorPOI, |
| 84 | const GrProcOptInfo& coveragePOI, |
bsalomon | 6a44c6a | 2015-05-26 09:49:05 -0700 | [diff] [blame] | 85 | GrXferProcessor::DstTexture* dstTexture, |
bsalomon | ad792c1 | 2015-09-10 11:10:50 -0700 | [diff] [blame] | 86 | const SkRect& batchBounds) { |
| 87 | SkRect bounds = batchBounds; |
| 88 | bounds.outset(0.5f, 0.5f); |
| 89 | |
bsalomon | 6a44c6a | 2015-05-26 09:49:05 -0700 | [diff] [blame] | 90 | if (!pipelineBuilder.willXPNeedDstTexture(*this->caps(), colorPOI, coveragePOI)) { |
bsalomon@google.com | 26e18b5 | 2013-03-29 19:22:36 +0000 | [diff] [blame] | 91 | return true; |
| 92 | } |
cdalton | 9954bc3 | 2015-04-29 14:17:00 -0700 | [diff] [blame] | 93 | |
bsalomon | 50785a3 | 2015-02-06 07:02:37 -0800 | [diff] [blame] | 94 | GrRenderTarget* rt = pipelineBuilder.getRenderTarget(); |
cdalton | 9954bc3 | 2015-04-29 14:17:00 -0700 | [diff] [blame] | 95 | |
| 96 | if (this->caps()->textureBarrierSupport()) { |
| 97 | if (GrTexture* rtTex = rt->asTexture()) { |
bsalomon | dc47ff7 | 2015-05-26 12:16:59 -0700 | [diff] [blame] | 98 | // 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] | 99 | // will be responsible to detect this situation and request a texture barrier. |
bsalomon | 6a44c6a | 2015-05-26 09:49:05 -0700 | [diff] [blame] | 100 | dstTexture->setTexture(rtTex); |
| 101 | dstTexture->setOffset(0, 0); |
cdalton | 9954bc3 | 2015-04-29 14:17:00 -0700 | [diff] [blame] | 102 | return true; |
| 103 | } |
| 104 | } |
| 105 | |
| 106 | SkIRect copyRect; |
joshualitt | 44701df | 2015-02-23 14:44:57 -0800 | [diff] [blame] | 107 | pipelineBuilder.clip().getConservativeBounds(rt, ©Rect); |
commit-bot@chromium.org | c4dc0ad | 2013-10-09 14:11:33 +0000 | [diff] [blame] | 108 | |
bsalomon | ad792c1 | 2015-09-10 11:10:50 -0700 | [diff] [blame] | 109 | SkIRect drawIBounds; |
| 110 | bounds.roundOut(&drawIBounds); |
| 111 | if (!copyRect.intersect(drawIBounds)) { |
commit-bot@chromium.org | 515dcd3 | 2013-08-28 14:17:03 +0000 | [diff] [blame] | 112 | #ifdef SK_DEBUG |
bsalomon | b3b9aec | 2015-09-10 11:16:35 -0700 | [diff] [blame] | 113 | GrCapsDebugf(this->caps(), "Missed an early reject. " |
| 114 | "Bailing on draw from setupDstReadIfNecessary.\n"); |
commit-bot@chromium.org | bb5c465 | 2013-04-01 12:49:31 +0000 | [diff] [blame] | 115 | #endif |
bsalomon | ad792c1 | 2015-09-10 11:10:50 -0700 | [diff] [blame] | 116 | return false; |
commit-bot@chromium.org | bb5c465 | 2013-04-01 12:49:31 +0000 | [diff] [blame] | 117 | } |
skia.committer@gmail.com | 05a2ee0 | 2013-04-02 07:01:34 +0000 | [diff] [blame] | 118 | |
commit-bot@chromium.org | 63150af | 2013-04-11 22:00:22 +0000 | [diff] [blame] | 119 | // MSAA consideration: When there is support for reading MSAA samples in the shader we could |
| 120 | // have per-sample dst values by making the copy multisampled. |
bsalomon | f2703d8 | 2014-10-28 14:33:06 -0700 | [diff] [blame] | 121 | GrSurfaceDesc desc; |
bsalomon | b3b9aec | 2015-09-10 11:16:35 -0700 | [diff] [blame] | 122 | if (!fGpu->initCopySurfaceDstDesc(rt, &desc)) { |
bsalomon | a73239a | 2015-04-28 13:35:17 -0700 | [diff] [blame] | 123 | desc.fOrigin = kDefault_GrSurfaceOrigin; |
| 124 | desc.fFlags = kRenderTarget_GrSurfaceFlag; |
| 125 | desc.fConfig = rt->config(); |
| 126 | } |
| 127 | |
commit-bot@chromium.org | bb5c465 | 2013-04-01 12:49:31 +0000 | [diff] [blame] | 128 | desc.fWidth = copyRect.width(); |
| 129 | desc.fHeight = copyRect.height(); |
bsalomon@google.com | 26e18b5 | 2013-03-29 19:22:36 +0000 | [diff] [blame] | 130 | |
bsalomon | eae6200 | 2015-07-31 13:59:30 -0700 | [diff] [blame] | 131 | static const uint32_t kFlags = 0; |
| 132 | SkAutoTUnref<GrTexture> copy(fResourceProvider->createApproxTexture(desc, kFlags)); |
bsalomon@google.com | 26e18b5 | 2013-03-29 19:22:36 +0000 | [diff] [blame] | 133 | |
bsalomon | e305973 | 2014-10-14 11:47:22 -0700 | [diff] [blame] | 134 | if (!copy) { |
tfarina | 38406c8 | 2014-10-31 07:11:12 -0700 | [diff] [blame] | 135 | SkDebugf("Failed to create temporary copy of destination texture.\n"); |
bsalomon@google.com | 26e18b5 | 2013-03-29 19:22:36 +0000 | [diff] [blame] | 136 | return false; |
| 137 | } |
bsalomon@google.com | e4617bf | 2013-04-03 14:56:40 +0000 | [diff] [blame] | 138 | SkIPoint dstPoint = {0, 0}; |
bsalomon | 6df8640 | 2015-06-01 10:41:49 -0700 | [diff] [blame] | 139 | this->copySurface(copy, rt, copyRect, dstPoint); |
| 140 | dstTexture->setTexture(copy); |
| 141 | dstTexture->setOffset(copyRect.fLeft, copyRect.fTop); |
| 142 | return true; |
bsalomon@google.com | 26e18b5 | 2013-03-29 19:22:36 +0000 | [diff] [blame] | 143 | } |
| 144 | |
bsalomon | a73239a | 2015-04-28 13:35:17 -0700 | [diff] [blame] | 145 | void GrDrawTarget::flush() { |
| 146 | if (fFlushing) { |
| 147 | return; |
| 148 | } |
| 149 | fFlushing = true; |
| 150 | |
robertphillips | a106c62 | 2015-10-16 09:07:06 -0700 | [diff] [blame] | 151 | // Semi-usually the drawTargets are already closed at this point, but sometimes Ganesh |
| 152 | // needs to flush mid-draw. In that case, the SkGpuDevice's drawTargets won't be closed |
| 153 | // but need to be flushed anyway. Closing such drawTargets here will mean new |
| 154 | // drawTargets will be created to replace them if the SkGpuDevice(s) write to them again. |
| 155 | this->makeClosed(); |
| 156 | |
bsalomon | 512be53 | 2015-09-10 10:42:55 -0700 | [diff] [blame] | 157 | // Loop over all batches and generate geometry |
joshualitt | f6d259b | 2015-10-02 11:27:14 -0700 | [diff] [blame] | 158 | for (; fFirstUnpreparedBatch < fBatches.count(); ++fFirstUnpreparedBatch) { |
| 159 | fBatches[fFirstUnpreparedBatch]->prepare(&fFlushState); |
bsalomon | 512be53 | 2015-09-10 10:42:55 -0700 | [diff] [blame] | 160 | } |
| 161 | |
| 162 | // Upload all data to the GPU |
joshualitt | f6d259b | 2015-10-02 11:27:14 -0700 | [diff] [blame] | 163 | fFlushState.preIssueDraws(); |
bsalomon | 512be53 | 2015-09-10 10:42:55 -0700 | [diff] [blame] | 164 | |
| 165 | // Draw all the generated geometry. |
| 166 | for (int i = 0; i < fBatches.count(); ++i) { |
joshualitt | f6d259b | 2015-10-02 11:27:14 -0700 | [diff] [blame] | 167 | fBatches[i]->draw(&fFlushState); |
bsalomon | 512be53 | 2015-09-10 10:42:55 -0700 | [diff] [blame] | 168 | } |
| 169 | |
joshualitt | f6d259b | 2015-10-02 11:27:14 -0700 | [diff] [blame] | 170 | SkASSERT(fFlushState.lastFlushedToken() == fFlushState.currentToken()); |
| 171 | this->reset(); |
bsalomon | a73239a | 2015-04-28 13:35:17 -0700 | [diff] [blame] | 172 | |
bsalomon | a73239a | 2015-04-28 13:35:17 -0700 | [diff] [blame] | 173 | fFlushing = false; |
bsalomon | a73239a | 2015-04-28 13:35:17 -0700 | [diff] [blame] | 174 | } |
| 175 | |
bsalomon | 512be53 | 2015-09-10 10:42:55 -0700 | [diff] [blame] | 176 | void GrDrawTarget::reset() { |
joshualitt | f6d259b | 2015-10-02 11:27:14 -0700 | [diff] [blame] | 177 | fFirstUnpreparedBatch = 0; |
bsalomon | 512be53 | 2015-09-10 10:42:55 -0700 | [diff] [blame] | 178 | fBatches.reset(); |
joshualitt | f6d259b | 2015-10-02 11:27:14 -0700 | [diff] [blame] | 179 | fFlushState.reset(); |
bsalomon | 512be53 | 2015-09-10 10:42:55 -0700 | [diff] [blame] | 180 | } |
| 181 | |
bsalomon | abd30f5 | 2015-08-13 13:34:48 -0700 | [diff] [blame] | 182 | void GrDrawTarget::drawBatch(const GrPipelineBuilder& pipelineBuilder, GrDrawBatch* batch) { |
joshualitt | 4d8da81 | 2015-01-28 12:53:54 -0800 | [diff] [blame] | 183 | // Setup clip |
| 184 | GrScissorState scissorState; |
joshualitt | 4d8da81 | 2015-01-28 12:53:54 -0800 | [diff] [blame] | 185 | GrPipelineBuilder::AutoRestoreStencil ars; |
bsalomon | 0ba8c24 | 2015-10-07 09:20:28 -0700 | [diff] [blame] | 186 | GrAppliedClip clip; |
| 187 | if (!fClipMaskManager->setupClipping(pipelineBuilder, &ars, &scissorState, &batch->bounds(), |
| 188 | &clip)) { |
joshualitt | 4d8da81 | 2015-01-28 12:53:54 -0800 | [diff] [blame] | 189 | return; |
| 190 | } |
bsalomon | 0ba8c24 | 2015-10-07 09:20:28 -0700 | [diff] [blame] | 191 | GrPipelineBuilder::AutoRestoreFragmentProcessorState arfps; |
| 192 | if (clip.clipCoverageFragmentProcessor()) { |
| 193 | arfps.set(&pipelineBuilder); |
| 194 | arfps.addCoverageFragmentProcessor(clip.clipCoverageFragmentProcessor()); |
| 195 | } |
joshualitt | 4d8da81 | 2015-01-28 12:53:54 -0800 | [diff] [blame] | 196 | |
bsalomon | ad792c1 | 2015-09-10 11:10:50 -0700 | [diff] [blame] | 197 | GrPipeline::CreateArgs args; |
| 198 | if (!this->installPipelineInDrawBatch(&pipelineBuilder, &scissorState, batch)) { |
egdaniel | e36914c | 2015-02-13 09:00:33 -0800 | [diff] [blame] | 199 | return; |
| 200 | } |
bsalomon | ad792c1 | 2015-09-10 11:10:50 -0700 | [diff] [blame] | 201 | |
bsalomon | 512be53 | 2015-09-10 10:42:55 -0700 | [diff] [blame] | 202 | this->recordBatch(batch); |
joshualitt | 4d8da81 | 2015-01-28 12:53:54 -0800 | [diff] [blame] | 203 | } |
| 204 | |
joshualitt | 2c93efe | 2014-11-06 12:57:13 -0800 | [diff] [blame] | 205 | static const GrStencilSettings& winding_path_stencil_settings() { |
| 206 | GR_STATIC_CONST_SAME_STENCIL_STRUCT(gSettings, |
| 207 | kIncClamp_StencilOp, |
| 208 | kIncClamp_StencilOp, |
| 209 | kAlwaysIfInClip_StencilFunc, |
| 210 | 0xFFFF, 0xFFFF, 0xFFFF); |
| 211 | return *GR_CONST_STENCIL_SETTINGS_PTR_FROM_STRUCT_PTR(&gSettings); |
| 212 | } |
| 213 | |
| 214 | static const GrStencilSettings& even_odd_path_stencil_settings() { |
| 215 | GR_STATIC_CONST_SAME_STENCIL_STRUCT(gSettings, |
| 216 | kInvert_StencilOp, |
| 217 | kInvert_StencilOp, |
| 218 | kAlwaysIfInClip_StencilFunc, |
| 219 | 0xFFFF, 0xFFFF, 0xFFFF); |
| 220 | return *GR_CONST_STENCIL_SETTINGS_PTR_FROM_STRUCT_PTR(&gSettings); |
| 221 | } |
| 222 | |
| 223 | void GrDrawTarget::getPathStencilSettingsForFilltype(GrPathRendering::FillType fill, |
egdaniel | 8dc7c3a | 2015-04-16 11:22:42 -0700 | [diff] [blame] | 224 | const GrStencilAttachment* sb, |
joshualitt | 2c93efe | 2014-11-06 12:57:13 -0800 | [diff] [blame] | 225 | GrStencilSettings* outStencilSettings) { |
| 226 | |
| 227 | switch (fill) { |
| 228 | default: |
| 229 | SkFAIL("Unexpected path fill."); |
| 230 | case GrPathRendering::kWinding_FillType: |
| 231 | *outStencilSettings = winding_path_stencil_settings(); |
| 232 | break; |
| 233 | case GrPathRendering::kEvenOdd_FillType: |
| 234 | *outStencilSettings = even_odd_path_stencil_settings(); |
| 235 | break; |
| 236 | } |
bsalomon | b3b9aec | 2015-09-10 11:16:35 -0700 | [diff] [blame] | 237 | fClipMaskManager->adjustPathStencilParams(sb, outStencilSettings); |
joshualitt | 2c93efe | 2014-11-06 12:57:13 -0800 | [diff] [blame] | 238 | } |
| 239 | |
joshualitt | 1c73548 | 2015-07-13 08:08:25 -0700 | [diff] [blame] | 240 | void GrDrawTarget::stencilPath(const GrPipelineBuilder& pipelineBuilder, |
joshualitt | f238469 | 2015-09-10 11:00:51 -0700 | [diff] [blame] | 241 | const SkMatrix& viewMatrix, |
joshualitt | 9853cce | 2014-11-17 14:22:48 -0800 | [diff] [blame] | 242 | const GrPath* path, |
| 243 | GrPathRendering::FillType fill) { |
bsalomon@google.com | 64aef2b | 2012-06-11 15:36:13 +0000 | [diff] [blame] | 244 | // TODO: extract portions of checkDraw that are relevant to path stenciling. |
bsalomon | 49f085d | 2014-09-05 13:34:00 -0700 | [diff] [blame] | 245 | SkASSERT(path); |
jvanverth | e9c0fc6 | 2015-04-29 11:18:05 -0700 | [diff] [blame] | 246 | SkASSERT(this->caps()->shaderCaps()->pathRenderingSupport()); |
joshualitt | 2c93efe | 2014-11-06 12:57:13 -0800 | [diff] [blame] | 247 | |
| 248 | // Setup clip |
bsalomon | 3e79124 | 2014-12-17 13:43:13 -0800 | [diff] [blame] | 249 | GrScissorState scissorState; |
egdaniel | 8dd688b | 2015-01-22 10:16:09 -0800 | [diff] [blame] | 250 | GrPipelineBuilder::AutoRestoreStencil ars; |
bsalomon | 0ba8c24 | 2015-10-07 09:20:28 -0700 | [diff] [blame] | 251 | GrAppliedClip clip; |
| 252 | if (!fClipMaskManager->setupClipping(pipelineBuilder, &ars, &scissorState, nullptr, &clip)) { |
joshualitt | 2c93efe | 2014-11-06 12:57:13 -0800 | [diff] [blame] | 253 | return; |
| 254 | } |
| 255 | |
bsalomon | 0ba8c24 | 2015-10-07 09:20:28 -0700 | [diff] [blame] | 256 | GrPipelineBuilder::AutoRestoreFragmentProcessorState arfps; |
| 257 | if (clip.clipCoverageFragmentProcessor()) { |
| 258 | arfps.set(&pipelineBuilder); |
| 259 | arfps.addCoverageFragmentProcessor(clip.clipCoverageFragmentProcessor()); |
| 260 | } |
| 261 | |
joshualitt | 2c93efe | 2014-11-06 12:57:13 -0800 | [diff] [blame] | 262 | // set stencil settings for path |
| 263 | GrStencilSettings stencilSettings; |
joshualitt | 1c73548 | 2015-07-13 08:08:25 -0700 | [diff] [blame] | 264 | GrRenderTarget* rt = pipelineBuilder.getRenderTarget(); |
egdaniel | ec00d94 | 2015-09-14 12:56:10 -0700 | [diff] [blame] | 265 | GrStencilAttachment* sb = fResourceProvider->attachStencilAttachment(rt); |
bsalomon | 6bc1b5f | 2015-02-23 09:06:38 -0800 | [diff] [blame] | 266 | this->getPathStencilSettingsForFilltype(fill, sb, &stencilSettings); |
joshualitt | 2c93efe | 2014-11-06 12:57:13 -0800 | [diff] [blame] | 267 | |
joshualitt | f238469 | 2015-09-10 11:00:51 -0700 | [diff] [blame] | 268 | GrBatch* batch = GrStencilPathBatch::Create(viewMatrix, |
bsalomon | a44919e | 2015-08-18 13:28:19 -0700 | [diff] [blame] | 269 | pipelineBuilder.isHWAntialias(), |
| 270 | stencilSettings, scissorState, |
| 271 | pipelineBuilder.getRenderTarget(), |
| 272 | path); |
bsalomon | 512be53 | 2015-09-10 10:42:55 -0700 | [diff] [blame] | 273 | this->recordBatch(batch); |
bsalomon | a44919e | 2015-08-18 13:28:19 -0700 | [diff] [blame] | 274 | batch->unref(); |
bsalomon@google.com | 64aef2b | 2012-06-11 15:36:13 +0000 | [diff] [blame] | 275 | } |
| 276 | |
joshualitt | 1c73548 | 2015-07-13 08:08:25 -0700 | [diff] [blame] | 277 | void GrDrawTarget::drawPath(const GrPipelineBuilder& pipelineBuilder, |
joshualitt | f238469 | 2015-09-10 11:00:51 -0700 | [diff] [blame] | 278 | const SkMatrix& viewMatrix, |
| 279 | GrColor color, |
joshualitt | 9853cce | 2014-11-17 14:22:48 -0800 | [diff] [blame] | 280 | const GrPath* path, |
| 281 | GrPathRendering::FillType fill) { |
bsalomon | 49f085d | 2014-09-05 13:34:00 -0700 | [diff] [blame] | 282 | SkASSERT(path); |
jvanverth | e9c0fc6 | 2015-04-29 11:18:05 -0700 | [diff] [blame] | 283 | SkASSERT(this->caps()->shaderCaps()->pathRenderingSupport()); |
commit-bot@chromium.org | c4dc0ad | 2013-10-09 14:11:33 +0000 | [diff] [blame] | 284 | |
joshualitt | f238469 | 2015-09-10 11:00:51 -0700 | [diff] [blame] | 285 | GrDrawPathBatchBase* batch = GrDrawPathBatch::Create(viewMatrix, color, path); |
bsalomon | 1fcc01c | 2015-09-09 09:48:06 -0700 | [diff] [blame] | 286 | this->drawPathBatch(pipelineBuilder, batch, fill); |
| 287 | batch->unref(); |
| 288 | } |
commit-bot@chromium.org | c4dc0ad | 2013-10-09 14:11:33 +0000 | [diff] [blame] | 289 | |
bsalomon | 1fcc01c | 2015-09-09 09:48:06 -0700 | [diff] [blame] | 290 | void GrDrawTarget::drawPathsFromRange(const GrPipelineBuilder& pipelineBuilder, |
joshualitt | f238469 | 2015-09-10 11:00:51 -0700 | [diff] [blame] | 291 | const SkMatrix& viewMatrix, |
| 292 | const SkMatrix& localMatrix, |
| 293 | GrColor color, |
cdalton | 8585dd2 | 2015-10-08 08:04:09 -0700 | [diff] [blame] | 294 | GrPathRange* range, |
bsalomon | 1fcc01c | 2015-09-09 09:48:06 -0700 | [diff] [blame] | 295 | GrPathRangeDraw* draw, |
| 296 | GrPathRendering::FillType fill) { |
cdalton | 8585dd2 | 2015-10-08 08:04:09 -0700 | [diff] [blame] | 297 | GrDrawPathBatchBase* batch = GrDrawPathRangeBatch::Create(viewMatrix, localMatrix, color, |
| 298 | range, draw); |
bsalomon | 1fcc01c | 2015-09-09 09:48:06 -0700 | [diff] [blame] | 299 | this->drawPathBatch(pipelineBuilder, batch, fill); |
| 300 | batch->unref(); |
| 301 | } |
| 302 | |
| 303 | void GrDrawTarget::drawPathBatch(const GrPipelineBuilder& pipelineBuilder, |
| 304 | GrDrawPathBatchBase* batch, |
| 305 | GrPathRendering::FillType fill) { |
bsalomon | add79ef | 2015-08-19 13:26:49 -0700 | [diff] [blame] | 306 | // This looks like drawBatch() but there is an added wrinkle that stencil settings get inserted |
bsalomon | b3b9aec | 2015-09-10 11:16:35 -0700 | [diff] [blame] | 307 | // after setting up clipping but before onDrawBatch(). TODO: Figure out a better model for |
| 308 | // handling stencil settings WRT interactions between pipeline(builder), clipmaskmanager, and |
| 309 | // batches. |
bsalomon | add79ef | 2015-08-19 13:26:49 -0700 | [diff] [blame] | 310 | |
bsalomon | 3e79124 | 2014-12-17 13:43:13 -0800 | [diff] [blame] | 311 | GrScissorState scissorState; |
egdaniel | 8dd688b | 2015-01-22 10:16:09 -0800 | [diff] [blame] | 312 | GrPipelineBuilder::AutoRestoreStencil ars; |
bsalomon | 0ba8c24 | 2015-10-07 09:20:28 -0700 | [diff] [blame] | 313 | GrAppliedClip clip; |
| 314 | if (!fClipMaskManager->setupClipping(pipelineBuilder, &ars, &scissorState, &batch->bounds(), |
| 315 | &clip)) { |
bsalomon | add79ef | 2015-08-19 13:26:49 -0700 | [diff] [blame] | 316 | return; |
joshualitt | 2c93efe | 2014-11-06 12:57:13 -0800 | [diff] [blame] | 317 | } |
| 318 | |
bsalomon | 0ba8c24 | 2015-10-07 09:20:28 -0700 | [diff] [blame] | 319 | GrPipelineBuilder::AutoRestoreFragmentProcessorState arfps; |
| 320 | if (clip.clipCoverageFragmentProcessor()) { |
| 321 | arfps.set(&pipelineBuilder); |
| 322 | arfps.addCoverageFragmentProcessor(clip.clipCoverageFragmentProcessor()); |
| 323 | } |
| 324 | |
bsalomon | add79ef | 2015-08-19 13:26:49 -0700 | [diff] [blame] | 325 | // Ensure the render target has a stencil buffer and get the stencil settings. |
joshualitt | 2c93efe | 2014-11-06 12:57:13 -0800 | [diff] [blame] | 326 | GrStencilSettings stencilSettings; |
joshualitt | 1c73548 | 2015-07-13 08:08:25 -0700 | [diff] [blame] | 327 | GrRenderTarget* rt = pipelineBuilder.getRenderTarget(); |
egdaniel | ec00d94 | 2015-09-14 12:56:10 -0700 | [diff] [blame] | 328 | GrStencilAttachment* sb = fResourceProvider->attachStencilAttachment(rt); |
bsalomon | 6bc1b5f | 2015-02-23 09:06:38 -0800 | [diff] [blame] | 329 | this->getPathStencilSettingsForFilltype(fill, sb, &stencilSettings); |
bsalomon | add79ef | 2015-08-19 13:26:49 -0700 | [diff] [blame] | 330 | batch->setStencilSettings(stencilSettings); |
joshualitt | 2c93efe | 2014-11-06 12:57:13 -0800 | [diff] [blame] | 331 | |
bsalomon | ad792c1 | 2015-09-10 11:10:50 -0700 | [diff] [blame] | 332 | GrPipeline::CreateArgs args; |
| 333 | if (!this->installPipelineInDrawBatch(&pipelineBuilder, &scissorState, batch)) { |
bsalomon | add79ef | 2015-08-19 13:26:49 -0700 | [diff] [blame] | 334 | return; |
| 335 | } |
egdaniel | e36914c | 2015-02-13 09:00:33 -0800 | [diff] [blame] | 336 | |
bsalomon | 512be53 | 2015-09-10 10:42:55 -0700 | [diff] [blame] | 337 | this->recordBatch(batch); |
commit-bot@chromium.org | 9b62aa1 | 2014-03-25 11:59:40 +0000 | [diff] [blame] | 338 | } |
| 339 | |
joshualitt | d2b23e0 | 2015-08-21 10:53:34 -0700 | [diff] [blame] | 340 | void GrDrawTarget::drawNonAARect(const GrPipelineBuilder& pipelineBuilder, |
joshualitt | 1c73548 | 2015-07-13 08:08:25 -0700 | [diff] [blame] | 341 | GrColor color, |
| 342 | const SkMatrix& viewMatrix, |
joshualitt | b6b513b | 2015-08-21 10:25:18 -0700 | [diff] [blame] | 343 | const SkRect& rect) { |
joshualitt | d2b23e0 | 2015-08-21 10:53:34 -0700 | [diff] [blame] | 344 | SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAFill(color, viewMatrix, rect, |
| 345 | nullptr, nullptr)); |
joshualitt | ad17cfc | 2015-05-05 10:45:57 -0700 | [diff] [blame] | 346 | this->drawBatch(pipelineBuilder, batch); |
| 347 | } |
| 348 | |
joshualitt | d2b23e0 | 2015-08-21 10:53:34 -0700 | [diff] [blame] | 349 | void GrDrawTarget::drawNonAARect(const GrPipelineBuilder& pipelineBuilder, |
joshualitt | b6b513b | 2015-08-21 10:25:18 -0700 | [diff] [blame] | 350 | GrColor color, |
| 351 | const SkMatrix& viewMatrix, |
| 352 | const SkRect& rect, |
| 353 | const SkMatrix& localMatrix) { |
joshualitt | d2b23e0 | 2015-08-21 10:53:34 -0700 | [diff] [blame] | 354 | SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAFill(color, viewMatrix, rect, |
| 355 | nullptr, &localMatrix)); |
joshualitt | b6b513b | 2015-08-21 10:25:18 -0700 | [diff] [blame] | 356 | this->drawBatch(pipelineBuilder, batch); |
| 357 | } |
| 358 | |
joshualitt | d2b23e0 | 2015-08-21 10:53:34 -0700 | [diff] [blame] | 359 | void GrDrawTarget::drawNonAARect(const GrPipelineBuilder& pipelineBuilder, |
joshualitt | b6b513b | 2015-08-21 10:25:18 -0700 | [diff] [blame] | 360 | GrColor color, |
| 361 | const SkMatrix& viewMatrix, |
| 362 | const SkRect& rect, |
| 363 | const SkRect& localRect) { |
joshualitt | d2b23e0 | 2015-08-21 10:53:34 -0700 | [diff] [blame] | 364 | SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAFill(color, viewMatrix, rect, |
| 365 | &localRect, nullptr)); |
joshualitt | b6b513b | 2015-08-21 10:25:18 -0700 | [diff] [blame] | 366 | this->drawBatch(pipelineBuilder, batch); |
| 367 | } |
| 368 | |
| 369 | |
joshualitt | 1c73548 | 2015-07-13 08:08:25 -0700 | [diff] [blame] | 370 | void GrDrawTarget::drawAARect(const GrPipelineBuilder& pipelineBuilder, |
robertphillips | ea46150 | 2015-05-26 11:38:03 -0700 | [diff] [blame] | 371 | GrColor color, |
| 372 | const SkMatrix& viewMatrix, |
| 373 | const SkRect& rect, |
| 374 | const SkRect& devRect) { |
joshualitt | d2b23e0 | 2015-08-21 10:53:34 -0700 | [diff] [blame] | 375 | SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateAAFill(color, viewMatrix, rect, |
bsalomon | abd30f5 | 2015-08-13 13:34:48 -0700 | [diff] [blame] | 376 | devRect)); |
joshualitt | 14205b1 | 2015-08-10 11:40:56 -0700 | [diff] [blame] | 377 | this->drawBatch(pipelineBuilder, batch); |
robertphillips | ea46150 | 2015-05-26 11:38:03 -0700 | [diff] [blame] | 378 | } |
| 379 | |
joshualitt | 9853cce | 2014-11-17 14:22:48 -0800 | [diff] [blame] | 380 | void GrDrawTarget::clear(const SkIRect* rect, |
| 381 | GrColor color, |
| 382 | bool canIgnoreRect, |
bsalomon | 63b2196 | 2014-11-05 07:05:34 -0800 | [diff] [blame] | 383 | GrRenderTarget* renderTarget) { |
egdaniel | 51c8d40 | 2015-08-06 10:54:13 -0700 | [diff] [blame] | 384 | SkIRect rtRect = SkIRect::MakeWH(renderTarget->width(), renderTarget->height()); |
| 385 | SkIRect clippedRect; |
| 386 | if (!rect || |
| 387 | (canIgnoreRect && this->caps()->fullClearIsFree()) || |
| 388 | rect->contains(rtRect)) { |
| 389 | rect = &rtRect; |
| 390 | } else { |
| 391 | clippedRect = *rect; |
| 392 | if (!clippedRect.intersect(rtRect)) { |
| 393 | return; |
| 394 | } |
| 395 | rect = &clippedRect; |
| 396 | } |
| 397 | |
bsalomon | b3b9aec | 2015-09-10 11:16:35 -0700 | [diff] [blame] | 398 | if (this->caps()->useDrawInsteadOfClear()) { |
bsalomon | 63b2196 | 2014-11-05 07:05:34 -0800 | [diff] [blame] | 399 | // This works around a driver bug with clear by drawing a rect instead. |
| 400 | // The driver will ignore a clear if it is the only thing rendered to a |
| 401 | // target before the target is read. |
egdaniel | 51c8d40 | 2015-08-06 10:54:13 -0700 | [diff] [blame] | 402 | if (rect == &rtRect) { |
bsalomon | 63b2196 | 2014-11-05 07:05:34 -0800 | [diff] [blame] | 403 | this->discard(renderTarget); |
| 404 | } |
bsalomon | 63b2196 | 2014-11-05 07:05:34 -0800 | [diff] [blame] | 405 | |
egdaniel | 8dd688b | 2015-01-22 10:16:09 -0800 | [diff] [blame] | 406 | GrPipelineBuilder pipelineBuilder; |
| 407 | pipelineBuilder.setRenderTarget(renderTarget); |
joshualitt | 9853cce | 2014-11-17 14:22:48 -0800 | [diff] [blame] | 408 | |
joshualitt | d2b23e0 | 2015-08-21 10:53:34 -0700 | [diff] [blame] | 409 | this->drawNonAARect(pipelineBuilder, color, SkMatrix::I(), *rect); |
bsalomon | 5346983 | 2015-08-18 09:20:09 -0700 | [diff] [blame] | 410 | } else { |
halcanary | 385fe4d | 2015-08-26 13:07:48 -0700 | [diff] [blame] | 411 | GrBatch* batch = new GrClearBatch(*rect, color, renderTarget); |
bsalomon | 512be53 | 2015-09-10 10:42:55 -0700 | [diff] [blame] | 412 | this->recordBatch(batch); |
bsalomon | 5346983 | 2015-08-18 09:20:09 -0700 | [diff] [blame] | 413 | batch->unref(); |
| 414 | } |
| 415 | } |
| 416 | |
| 417 | void GrDrawTarget::discard(GrRenderTarget* renderTarget) { |
| 418 | if (this->caps()->discardRenderTargetSupport()) { |
halcanary | 385fe4d | 2015-08-26 13:07:48 -0700 | [diff] [blame] | 419 | GrBatch* batch = new GrDiscardBatch(renderTarget); |
bsalomon | 512be53 | 2015-09-10 10:42:55 -0700 | [diff] [blame] | 420 | this->recordBatch(batch); |
bsalomon | 5346983 | 2015-08-18 09:20:09 -0700 | [diff] [blame] | 421 | batch->unref(); |
bsalomon | 63b2196 | 2014-11-05 07:05:34 -0800 | [diff] [blame] | 422 | } |
| 423 | } |
| 424 | |
bsalomon@google.com | 25fb21f | 2011-06-21 18:17:25 +0000 | [diff] [blame] | 425 | //////////////////////////////////////////////////////////////////////////////// |
bsalomon@google.com | 86afc2a | 2011-02-16 16:12:19 +0000 | [diff] [blame] | 426 | |
bsalomon | 6df8640 | 2015-06-01 10:41:49 -0700 | [diff] [blame] | 427 | void GrDrawTarget::copySurface(GrSurface* dst, |
bsalomon@google.com | 116ad84 | 2013-04-09 15:38:19 +0000 | [diff] [blame] | 428 | GrSurface* src, |
| 429 | const SkIRect& srcRect, |
| 430 | const SkIPoint& dstPoint) { |
bsalomon | 872062c | 2015-08-18 12:12:35 -0700 | [diff] [blame] | 431 | GrBatch* batch = GrCopySurfaceBatch::Create(dst, src, srcRect, dstPoint); |
| 432 | if (batch) { |
bsalomon | 512be53 | 2015-09-10 10:42:55 -0700 | [diff] [blame] | 433 | this->recordBatch(batch); |
bsalomon | 872062c | 2015-08-18 12:12:35 -0700 | [diff] [blame] | 434 | batch->unref(); |
bsalomon@google.com | e4617bf | 2013-04-03 14:56:40 +0000 | [diff] [blame] | 435 | } |
bsalomon@google.com | eb85117 | 2013-04-15 13:51:00 +0000 | [diff] [blame] | 436 | } |
| 437 | |
bsalomon | 512be53 | 2015-09-10 10:42:55 -0700 | [diff] [blame] | 438 | template <class Left, class Right> static bool intersect(const Left& a, const Right& b) { |
| 439 | SkASSERT(a.fLeft <= a.fRight && a.fTop <= a.fBottom && |
| 440 | b.fLeft <= b.fRight && b.fTop <= b.fBottom); |
| 441 | return a.fLeft < b.fRight && b.fLeft < a.fRight && a.fTop < b.fBottom && b.fTop < a.fBottom; |
| 442 | } |
| 443 | |
| 444 | void GrDrawTarget::recordBatch(GrBatch* batch) { |
robertphillips | a106c62 | 2015-10-16 09:07:06 -0700 | [diff] [blame] | 445 | // A closed drawTarget should never receive new/more batches |
robertphillips | 6a18665 | 2015-10-20 07:37:58 -0700 | [diff] [blame^] | 446 | SkASSERT(!this->isClosed()); |
robertphillips | a106c62 | 2015-10-16 09:07:06 -0700 | [diff] [blame] | 447 | |
bsalomon | 512be53 | 2015-09-10 10:42:55 -0700 | [diff] [blame] | 448 | // Check if there is a Batch Draw we can batch with by linearly searching back until we either |
| 449 | // 1) check every draw |
| 450 | // 2) intersect with something |
| 451 | // 3) find a 'blocker' |
| 452 | // Experimentally we have found that most batching occurs within the first 10 comparisons. |
| 453 | static const int kMaxLookback = 10; |
| 454 | |
| 455 | GrBATCH_INFO("Re-Recording (%s, B%u)\n" |
joshualitt | e2bcec3 | 2015-09-30 06:22:22 -0700 | [diff] [blame] | 456 | "\tBounds LRTB (%f, %f, %f, %f)\n", |
bsalomon | 512be53 | 2015-09-10 10:42:55 -0700 | [diff] [blame] | 457 | batch->name(), |
| 458 | batch->uniqueID(), |
| 459 | batch->bounds().fLeft, batch->bounds().fRight, |
| 460 | batch->bounds().fTop, batch->bounds().fBottom); |
| 461 | GrBATCH_INFO(SkTabString(batch->dumpInfo(), 1).c_str()); |
| 462 | GrBATCH_INFO("\tOutcome:\n"); |
| 463 | int maxCandidates = SkTMin(kMaxLookback, fBatches.count()); |
| 464 | if (maxCandidates) { |
| 465 | int i = 0; |
| 466 | while (true) { |
| 467 | GrBatch* candidate = fBatches.fromBack(i); |
| 468 | // We cannot continue to search backwards if the render target changes |
| 469 | if (candidate->renderTargetUniqueID() != batch->renderTargetUniqueID()) { |
| 470 | GrBATCH_INFO("\t\tBreaking because of (%s, B%u) Rendertarget\n", |
| 471 | candidate->name(), candidate->uniqueID()); |
| 472 | break; |
| 473 | } |
| 474 | if (candidate->combineIfPossible(batch, *this->caps())) { |
| 475 | GrBATCH_INFO("\t\tCombining with (%s, B%u)\n", candidate->name(), |
| 476 | candidate->uniqueID()); |
| 477 | return; |
| 478 | } |
| 479 | // Stop going backwards if we would cause a painter's order violation. |
| 480 | if (intersect(candidate->bounds(), batch->bounds())) { |
| 481 | GrBATCH_INFO("\t\tIntersects with (%s, B%u)\n", candidate->name(), |
| 482 | candidate->uniqueID()); |
| 483 | break; |
| 484 | } |
| 485 | ++i; |
| 486 | if (i == maxCandidates) { |
| 487 | GrBATCH_INFO("\t\tReached max lookback or beginning of batch array %d\n", i); |
| 488 | break; |
| 489 | } |
| 490 | } |
| 491 | } else { |
| 492 | GrBATCH_INFO("\t\tFirstBatch\n"); |
| 493 | } |
| 494 | fBatches.push_back().reset(SkRef(batch)); |
joshualitt | f6d259b | 2015-10-02 11:27:14 -0700 | [diff] [blame] | 495 | if (fBatches.count() > kMaxLookback) { |
| 496 | SkASSERT(fBatches.count() - kMaxLookback - fFirstUnpreparedBatch == 1); |
| 497 | fBatches[fFirstUnpreparedBatch++]->prepare(&fFlushState); |
| 498 | } |
bsalomon | 512be53 | 2015-09-10 10:42:55 -0700 | [diff] [blame] | 499 | } |
| 500 | |
egdaniel | e36914c | 2015-02-13 09:00:33 -0800 | [diff] [blame] | 501 | /////////////////////////////////////////////////////////////////////////////// |
| 502 | |
bsalomon | ad792c1 | 2015-09-10 11:10:50 -0700 | [diff] [blame] | 503 | bool GrDrawTarget::installPipelineInDrawBatch(const GrPipelineBuilder* pipelineBuilder, |
| 504 | const GrScissorState* scissor, |
| 505 | GrDrawBatch* batch) { |
| 506 | GrPipeline::CreateArgs args; |
| 507 | args.fPipelineBuilder = pipelineBuilder; |
| 508 | args.fCaps = this->caps(); |
| 509 | args.fScissor = scissor; |
| 510 | args.fColorPOI = pipelineBuilder->colorProcInfo(batch); |
| 511 | args.fCoveragePOI = pipelineBuilder->coverageProcInfo(batch); |
| 512 | if (!this->setupDstReadIfNecessary(*pipelineBuilder, args.fColorPOI, |
| 513 | args.fCoveragePOI, &args.fDstTexture, |
| 514 | batch->bounds())) { |
| 515 | return false; |
egdaniel | e36914c | 2015-02-13 09:00:33 -0800 | [diff] [blame] | 516 | } |
bsalomon | ad792c1 | 2015-09-10 11:10:50 -0700 | [diff] [blame] | 517 | |
| 518 | if (!batch->installPipeline(args)) { |
| 519 | return false; |
| 520 | } |
| 521 | |
| 522 | return true; |
egdaniel | e36914c | 2015-02-13 09:00:33 -0800 | [diff] [blame] | 523 | } |
| 524 | |
bsalomon | b3b9aec | 2015-09-10 11:16:35 -0700 | [diff] [blame] | 525 | void GrDrawTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRenderTarget* rt) { |
halcanary | 385fe4d | 2015-08-26 13:07:48 -0700 | [diff] [blame] | 526 | GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt); |
bsalomon | 512be53 | 2015-09-10 10:42:55 -0700 | [diff] [blame] | 527 | this->recordBatch(batch); |
bsalomon | 5ea0363 | 2015-08-18 10:33:30 -0700 | [diff] [blame] | 528 | batch->unref(); |
| 529 | } |