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