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->fWindowRectsState = *args.fWindowRectsState; | 30 pipeline->fWindowRects = *args.fWindowRects; |
31 if (builder.hasUserStencilSettings() || args.fHasStencilClip) { | 31 if (builder.hasUserStencilSettings() || args.fHasStencilClip) { |
32 const GrRenderTargetPriv& rtPriv = rt->renderTargetPriv(); | 32 const GrRenderTargetPriv& rtPriv = rt->renderTargetPriv(); |
33 pipeline->fStencilSettings.reset(*builder.getUserStencil(), args.fHasSte
ncilClip, | 33 pipeline->fStencilSettings.reset(*builder.getUserStencil(), args.fHasSte
ncilClip, |
34 rtPriv.numStencilBits()); | 34 rtPriv.numStencilBits()); |
35 SkASSERT(!pipeline->fStencilSettings.usesWrapOp() || args.fCaps->stencil
WrapOpsSupport()); | 35 SkASSERT(!pipeline->fStencilSettings.usesWrapOp() || args.fCaps->stencil
WrapOpsSupport()); |
36 } | 36 } |
37 pipeline->fDrawFace = builder.getDrawFace(); | 37 pipeline->fDrawFace = builder.getDrawFace(); |
38 | 38 |
39 pipeline->fFlags = 0; | 39 pipeline->fFlags = 0; |
40 if (builder.isHWAntialias()) { | 40 if (builder.isHWAntialias()) { |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 //////////////////////////////////////////////////////////////////////////////// | 223 //////////////////////////////////////////////////////////////////////////////// |
224 | 224 |
225 bool GrPipeline::AreEqual(const GrPipeline& a, const GrPipeline& b, | 225 bool GrPipeline::AreEqual(const GrPipeline& a, const GrPipeline& b, |
226 bool ignoreCoordTransforms) { | 226 bool ignoreCoordTransforms) { |
227 SkASSERT(&a != &b); | 227 SkASSERT(&a != &b); |
228 | 228 |
229 if (a.getRenderTarget() != b.getRenderTarget() || | 229 if (a.getRenderTarget() != b.getRenderTarget() || |
230 a.fFragmentProcessors.count() != b.fFragmentProcessors.count() || | 230 a.fFragmentProcessors.count() != b.fFragmentProcessors.count() || |
231 a.fNumColorProcessors != b.fNumColorProcessors || | 231 a.fNumColorProcessors != b.fNumColorProcessors || |
232 a.fScissorState != b.fScissorState || | 232 a.fScissorState != b.fScissorState || |
233 !a.fWindowRectsState.cheapEqualTo(b.fWindowRectsState) || | 233 a.fWindowRects != b.fWindowRects || |
234 a.fFlags != b.fFlags || | 234 a.fFlags != b.fFlags || |
235 a.fStencilSettings != b.fStencilSettings || | 235 a.fStencilSettings != b.fStencilSettings || |
236 a.fDrawFace != b.fDrawFace || | 236 a.fDrawFace != b.fDrawFace || |
237 a.fIgnoresCoverage != b.fIgnoresCoverage) { | 237 a.fIgnoresCoverage != b.fIgnoresCoverage) { |
238 return false; | 238 return false; |
239 } | 239 } |
240 | 240 |
241 // Most of the time both are nullptr | 241 // Most of the time both are nullptr |
242 if (a.fXferProcessor.get() || b.fXferProcessor.get()) { | 242 if (a.fXferProcessor.get() || b.fXferProcessor.get()) { |
243 if (!a.getXferProcessor().isEqual(b.getXferProcessor())) { | 243 if (!a.getXferProcessor().isEqual(b.getXferProcessor())) { |
244 return false; | 244 return false; |
245 } | 245 } |
246 } | 246 } |
247 | 247 |
248 for (int i = 0; i < a.numFragmentProcessors(); i++) { | 248 for (int i = 0; i < a.numFragmentProcessors(); i++) { |
249 if (!a.getFragmentProcessor(i).isEqual(b.getFragmentProcessor(i), ignore
CoordTransforms)) { | 249 if (!a.getFragmentProcessor(i).isEqual(b.getFragmentProcessor(i), ignore
CoordTransforms)) { |
250 return false; | 250 return false; |
251 } | 251 } |
252 } | 252 } |
253 return true; | 253 return true; |
254 } | 254 } |
OLD | NEW |