OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "GrOptDrawState.h" | 8 #include "GrOptDrawState.h" |
9 | 9 |
| 10 #include "GrDefaultGeoProcFactory.h" |
10 #include "GrDrawState.h" | 11 #include "GrDrawState.h" |
11 #include "GrDrawTargetCaps.h" | 12 #include "GrDrawTargetCaps.h" |
12 #include "gl/GrGpuGL.h" | 13 #include "GrGpu.h" |
13 | 14 |
14 GrOptDrawState::GrOptDrawState(const GrDrawState& drawState, | 15 GrOptDrawState::GrOptDrawState(const GrDrawState& drawState, |
15 BlendOptFlags blendOptFlags, | 16 BlendOptFlags blendOptFlags, |
16 GrBlendCoeff optSrcCoeff, | 17 GrBlendCoeff optSrcCoeff, |
17 GrBlendCoeff optDstCoeff, | 18 GrBlendCoeff optDstCoeff, |
18 GrGpu* gpu, | 19 GrGpu* gpu, |
19 const GrDeviceCoordTexture* dstCopy, | 20 const GrDeviceCoordTexture* dstCopy, |
20 GrGpu::DrawType drawType) { | 21 GrGpu::DrawType drawType) { |
21 fRenderTarget.set(SkSafeRef(drawState.getRenderTarget()), kWrite_GrIOType); | 22 fRenderTarget.set(SkSafeRef(drawState.getRenderTarget()), kWrite_GrIOType); |
22 fColor = drawState.getColor(); | 23 fColor = drawState.getColor(); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 if (0 != fixedFunctionVAToRemove) { | 57 if (0 != fixedFunctionVAToRemove) { |
57 this->removeFixedFunctionVertexAttribs(fixedFunctionVAToRemove, &descInf
o); | 58 this->removeFixedFunctionVertexAttribs(fixedFunctionVAToRemove, &descInf
o); |
58 } | 59 } |
59 this->getStageStats(drawState, firstColorStageIdx, firstCoverageStageIdx, &d
escInfo); | 60 this->getStageStats(drawState, firstColorStageIdx, firstCoverageStageIdx, &d
escInfo); |
60 this->setOutputStateInfo(drawState, *gpu->caps(), firstCoverageStageIdx, &de
scInfo, | 61 this->setOutputStateInfo(drawState, *gpu->caps(), firstCoverageStageIdx, &de
scInfo, |
61 &separateCoverageFromColor); | 62 &separateCoverageFromColor); |
62 | 63 |
63 // Copy GeometryProcesssor from DS or ODS | 64 // Copy GeometryProcesssor from DS or ODS |
64 if (drawState.hasGeometryProcessor()) { | 65 if (drawState.hasGeometryProcessor()) { |
65 fGeometryProcessor.initAndRef(drawState.fGeometryProcessor); | 66 fGeometryProcessor.initAndRef(drawState.fGeometryProcessor); |
| 67 } else if (!GrGpu::IsPathRenderingDrawType(drawType)) { |
| 68 // Install default GP, this will be ignored if we are rendering with fra
gment shader only |
| 69 // TODO(joshualitt) rendering code should do this |
| 70 fGeometryProcessor.reset(GrDefaultGeoProcFactory::Create()); |
66 } else { | 71 } else { |
67 fGeometryProcessor.reset(NULL); | 72 fGeometryProcessor.reset(NULL); |
68 } | 73 } |
69 | 74 |
70 // Copy Color Stages from DS to ODS | 75 // Copy Color Stages from DS to ODS |
71 if (firstColorStageIdx < drawState.numColorStages()) { | 76 if (firstColorStageIdx < drawState.numColorStages()) { |
72 fFragmentStages.reset(&drawState.getColorStage(firstColorStageIdx), | 77 fFragmentStages.reset(&drawState.getColorStage(firstColorStageIdx), |
73 drawState.numColorStages() - firstColorStageIdx); | 78 drawState.numColorStages() - firstColorStageIdx); |
74 } else { | 79 } else { |
75 fFragmentStages.reset(); | 80 fFragmentStages.reset(); |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 bool explicitLocalCoords = this->fDesc.header().fLocalCoordAttributeIndex !=
-1; | 387 bool explicitLocalCoords = this->fDesc.header().fLocalCoordAttributeIndex !=
-1; |
383 for (int i = 0; i < this->numFragmentStages(); i++) { | 388 for (int i = 0; i < this->numFragmentStages(); i++) { |
384 if (!GrFragmentStage::AreCompatible(this->getFragmentStage(i), that.getF
ragmentStage(i), | 389 if (!GrFragmentStage::AreCompatible(this->getFragmentStage(i), that.getF
ragmentStage(i), |
385 explicitLocalCoords)) { | 390 explicitLocalCoords)) { |
386 return false; | 391 return false; |
387 } | 392 } |
388 } | 393 } |
389 return true; | 394 return true; |
390 } | 395 } |
391 | 396 |
OLD | NEW |