| 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 "GrDrawState.h" | 10 #include "GrDrawState.h" |
| 11 #include "GrDrawTargetCaps.h" | 11 #include "GrDrawTargetCaps.h" |
| 12 #include "GrDefaultGeoProcFactory.h" |
| 12 | 13 |
| 13 GrOptDrawState::GrOptDrawState(const GrDrawState& drawState, | 14 GrOptDrawState::GrOptDrawState(const GrDrawState& drawState, |
| 14 BlendOptFlags blendOptFlags, | 15 BlendOptFlags blendOptFlags, |
| 15 GrBlendCoeff optSrcCoeff, | 16 GrBlendCoeff optSrcCoeff, |
| 16 GrBlendCoeff optDstCoeff, | 17 GrBlendCoeff optDstCoeff, |
| 17 const GrDrawTargetCaps& caps) { | 18 const GrDrawTargetCaps& caps) { |
| 18 fRenderTarget.set(SkSafeRef(drawState.getRenderTarget()), kWrite_GrIOType); | 19 fRenderTarget.set(SkSafeRef(drawState.getRenderTarget()), kWrite_GrIOType); |
| 19 fColor = drawState.getColor(); | 20 fColor = drawState.getColor(); |
| 20 fCoverage = drawState.getCoverage(); | 21 fCoverage = drawState.getCoverage(); |
| 21 fViewMatrix = drawState.getViewMatrix(); | 22 fViewMatrix = drawState.getViewMatrix(); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 51 if (0 != fixedFunctionVAToRemove) { | 52 if (0 != fixedFunctionVAToRemove) { |
| 52 this->removeFixedFunctionVertexAttribs(fixedFunctionVAToRemove); | 53 this->removeFixedFunctionVertexAttribs(fixedFunctionVAToRemove); |
| 53 } | 54 } |
| 54 this->getStageStats(drawState, firstColorStageIdx, firstCoverageStageIdx); | 55 this->getStageStats(drawState, firstColorStageIdx, firstCoverageStageIdx); |
| 55 this->setOutputStateInfo(drawState, caps, firstCoverageStageIdx, &separateCo
verageFromColor); | 56 this->setOutputStateInfo(drawState, caps, firstCoverageStageIdx, &separateCo
verageFromColor); |
| 56 | 57 |
| 57 // Copy GeometryProcesssor from DS or ODS | 58 // Copy GeometryProcesssor from DS or ODS |
| 58 if (drawState.hasGeometryProcessor()) { | 59 if (drawState.hasGeometryProcessor()) { |
| 59 fGeometryProcessor.initAndRef(drawState.fGeometryProcessor); | 60 fGeometryProcessor.initAndRef(drawState.fGeometryProcessor); |
| 60 } else { | 61 } else { |
| 61 fGeometryProcessor.reset(NULL); | 62 // Install default GP, this will be ignored if we are rendering with fra
gment shader only |
| 63 // TODO(joshualitt) processors should do this themselves |
| 64 fGeometryProcessor.reset(GrDefaultGeoProcFactory::Create()); |
| 62 } | 65 } |
| 63 | 66 |
| 64 // Copy Color Stages from DS to ODS | 67 // Copy Color Stages from DS to ODS |
| 65 if (firstColorStageIdx < drawState.numColorStages()) { | 68 if (firstColorStageIdx < drawState.numColorStages()) { |
| 66 fFragmentStages.reset(&drawState.getColorStage(firstColorStageIdx), | 69 fFragmentStages.reset(&drawState.getColorStage(firstColorStageIdx), |
| 67 drawState.numColorStages() - firstColorStageIdx); | 70 drawState.numColorStages() - firstColorStageIdx); |
| 68 } else { | 71 } else { |
| 69 fFragmentStages.reset(); | 72 fFragmentStages.reset(); |
| 70 } | 73 } |
| 71 | 74 |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 } | 378 } |
| 376 } | 379 } |
| 377 | 380 |
| 378 SkASSERT(0 == memcmp(this->fFixedFunctionVertexAttribIndices, | 381 SkASSERT(0 == memcmp(this->fFixedFunctionVertexAttribIndices, |
| 379 that.fFixedFunctionVertexAttribIndices, | 382 that.fFixedFunctionVertexAttribIndices, |
| 380 sizeof(this->fFixedFunctionVertexAttribIndices))); | 383 sizeof(this->fFixedFunctionVertexAttribIndices))); |
| 381 | 384 |
| 382 return true; | 385 return true; |
| 383 } | 386 } |
| 384 | 387 |
| OLD | NEW |