OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "GrPipeline.h" | 8 #include "GrPipeline.h" |
9 | 9 |
10 #include "GrCaps.h" | 10 #include "GrCaps.h" |
11 #include "GrDrawContext.h" | 11 #include "GrDrawContext.h" |
12 #include "GrDrawTarget.h" | 12 #include "GrDrawTarget.h" |
13 #include "GrGpu.h" | 13 #include "GrGpu.h" |
14 #include "GrPipelineBuilder.h" | 14 #include "GrPipelineBuilder.h" |
15 #include "GrProcOptInfo.h" | 15 #include "GrProcOptInfo.h" |
16 #include "GrRenderTargetPriv.h" | 16 #include "GrRenderTargetPriv.h" |
17 #include "GrXferProcessor.h" | 17 #include "GrXferProcessor.h" |
18 | 18 |
19 #include "batches/GrBatch.h" | 19 #include "batches/GrBatch.h" |
20 | 20 |
21 GrPipeline* GrPipeline::CreateAt(void* memory, const CreateArgs& args, | 21 GrPipeline* GrPipeline::CreateAt(void* memory, const CreateArgs& args, |
22 GrXPOverridesForBatch* overrides) { | 22 GrXPOverridesForBatch* overrides) { |
23 const GrPipelineBuilder& builder = *args.fPipelineBuilder; | 23 const GrPipelineBuilder& builder = *args.fPipelineBuilder; |
24 | 24 |
25 GrPipeline* pipeline = new (memory) GrPipeline; | 25 GrPipeline* pipeline = new (memory) GrPipeline; |
26 GrRenderTarget* rt = args.fDrawContext->accessRenderTarget(); | 26 GrRenderTarget* rt = args.fDrawContext->accessRenderTarget(); |
27 pipeline->fRenderTarget.reset(rt); | 27 pipeline->fRenderTarget.reset(rt); |
28 SkASSERT(pipeline->fRenderTarget); | 28 SkASSERT(pipeline->fRenderTarget); |
29 pipeline->fScissorState = *args.fScissor; | 29 pipeline->fScissorState = *args.fScissor; |
| 30 pipeline->fWindowRects = *args.fWindowRects; |
30 if (builder.hasUserStencilSettings() || args.fHasStencilClip) { | 31 if (builder.hasUserStencilSettings() || args.fHasStencilClip) { |
31 const GrRenderTargetPriv& rtPriv = rt->renderTargetPriv(); | 32 const GrRenderTargetPriv& rtPriv = rt->renderTargetPriv(); |
32 pipeline->fStencilSettings.reset(*builder.getUserStencil(), args.fHasSte
ncilClip, | 33 pipeline->fStencilSettings.reset(*builder.getUserStencil(), args.fHasSte
ncilClip, |
33 rtPriv.numStencilBits()); | 34 rtPriv.numStencilBits()); |
34 SkASSERT(!pipeline->fStencilSettings.usesWrapOp() || args.fCaps->stencil
WrapOpsSupport()); | 35 SkASSERT(!pipeline->fStencilSettings.usesWrapOp() || args.fCaps->stencil
WrapOpsSupport()); |
35 } | 36 } |
36 pipeline->fDrawFace = builder.getDrawFace(); | 37 pipeline->fDrawFace = builder.getDrawFace(); |
37 | 38 |
38 pipeline->fFlags = 0; | 39 pipeline->fFlags = 0; |
39 if (builder.isHWAntialias()) { | 40 if (builder.isHWAntialias()) { |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 //////////////////////////////////////////////////////////////////////////////// | 223 //////////////////////////////////////////////////////////////////////////////// |
223 | 224 |
224 bool GrPipeline::AreEqual(const GrPipeline& a, const GrPipeline& b, | 225 bool GrPipeline::AreEqual(const GrPipeline& a, const GrPipeline& b, |
225 bool ignoreCoordTransforms) { | 226 bool ignoreCoordTransforms) { |
226 SkASSERT(&a != &b); | 227 SkASSERT(&a != &b); |
227 | 228 |
228 if (a.getRenderTarget() != b.getRenderTarget() || | 229 if (a.getRenderTarget() != b.getRenderTarget() || |
229 a.fFragmentProcessors.count() != b.fFragmentProcessors.count() || | 230 a.fFragmentProcessors.count() != b.fFragmentProcessors.count() || |
230 a.fNumColorProcessors != b.fNumColorProcessors || | 231 a.fNumColorProcessors != b.fNumColorProcessors || |
231 a.fScissorState != b.fScissorState || | 232 a.fScissorState != b.fScissorState || |
| 233 a.fWindowRects != b.fWindowRects || |
232 a.fFlags != b.fFlags || | 234 a.fFlags != b.fFlags || |
233 a.fStencilSettings != b.fStencilSettings || | 235 a.fStencilSettings != b.fStencilSettings || |
234 a.fDrawFace != b.fDrawFace || | 236 a.fDrawFace != b.fDrawFace || |
235 a.fIgnoresCoverage != b.fIgnoresCoverage) { | 237 a.fIgnoresCoverage != b.fIgnoresCoverage) { |
236 return false; | 238 return false; |
237 } | 239 } |
238 | 240 |
239 // Most of the time both are nullptr | 241 // Most of the time both are nullptr |
240 if (a.fXferProcessor.get() || b.fXferProcessor.get()) { | 242 if (a.fXferProcessor.get() || b.fXferProcessor.get()) { |
241 if (!a.getXferProcessor().isEqual(b.getXferProcessor())) { | 243 if (!a.getXferProcessor().isEqual(b.getXferProcessor())) { |
242 return false; | 244 return false; |
243 } | 245 } |
244 } | 246 } |
245 | 247 |
246 for (int i = 0; i < a.numFragmentProcessors(); i++) { | 248 for (int i = 0; i < a.numFragmentProcessors(); i++) { |
247 if (!a.getFragmentProcessor(i).isEqual(b.getFragmentProcessor(i), ignore
CoordTransforms)) { | 249 if (!a.getFragmentProcessor(i).isEqual(b.getFragmentProcessor(i), ignore
CoordTransforms)) { |
248 return false; | 250 return false; |
249 } | 251 } |
250 } | 252 } |
251 return true; | 253 return true; |
252 } | 254 } |
OLD | NEW |