| 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 "GrGpu.h" | 12 #include "GrGpu.h" |
| 13 #include "GrProcOptInfo.h" | 13 #include "GrProcOptInfo.h" |
| 14 | 14 |
| 15 GrOptDrawState::GrOptDrawState(const GrDrawState& drawState, | 15 GrOptDrawState::GrOptDrawState(const GrDrawState& drawState, |
| 16 GrGpu* gpu, | 16 const GrDrawTargetCaps& caps, |
| 17 const ScissorState& scissorState, | 17 const ScissorState& scissorState, |
| 18 const GrDeviceCoordTexture* dstCopy, | 18 const GrDeviceCoordTexture* dstCopy, |
| 19 GrGpu::DrawType drawType) { | 19 GrGpu::DrawType drawType) |
| 20 | 20 : fFinalized(false) { |
| 21 fDrawType = drawType; |
| 21 GrBlendCoeff optSrcCoeff; | 22 GrBlendCoeff optSrcCoeff; |
| 22 GrBlendCoeff optDstCoeff; | 23 GrBlendCoeff optDstCoeff; |
| 23 GrDrawState::BlendOpt blendOpt = drawState.getBlendOpt(false, &optSrcCoeff,
&optDstCoeff); | 24 GrDrawState::BlendOpt blendOpt = drawState.getBlendOpt(false, &optSrcCoeff,
&optDstCoeff); |
| 24 | 25 |
| 25 // When path rendering the stencil settings are not always set on the draw s
tate | 26 // When path rendering the stencil settings are not always set on the draw s
tate |
| 26 // so we must check the draw type. In cases where we will skip drawing we si
mply return a | 27 // so we must check the draw type. In cases where we will skip drawing we si
mply return a |
| 27 // null GrOptDrawState. | 28 // null GrOptDrawState. |
| 28 if (GrDrawState::kSkipDraw_BlendOpt == blendOpt && GrGpu::kStencilPath_DrawT
ype != drawType) { | 29 if (GrDrawState::kSkipDraw_BlendOpt == blendOpt && GrGpu::kStencilPath_DrawT
ype != drawType) { |
| 29 // Set the fields that don't default init and return. The lack of a rend
er target will | 30 // Set the fields that don't default init and return. The lack of a rend
er target will |
| 30 // indicate that this can be skipped. | 31 // indicate that this can be skipped. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 45 fStencilSettings = drawState.getStencil(); | 46 fStencilSettings = drawState.getStencil(); |
| 46 fDrawFace = drawState.getDrawFace(); | 47 fDrawFace = drawState.getDrawFace(); |
| 47 fSrcBlend = optSrcCoeff; | 48 fSrcBlend = optSrcCoeff; |
| 48 fDstBlend = optDstCoeff; | 49 fDstBlend = optDstCoeff; |
| 49 | 50 |
| 50 // TODO move this out of optDrawState | 51 // TODO move this out of optDrawState |
| 51 if (dstCopy) { | 52 if (dstCopy) { |
| 52 fDstCopy = *dstCopy; | 53 fDstCopy = *dstCopy; |
| 53 } | 54 } |
| 54 | 55 |
| 55 GrProgramDesc::DescInfo descInfo; | |
| 56 | |
| 57 fFlags = 0; | 56 fFlags = 0; |
| 58 if (drawState.isHWAntialias()) { | 57 if (drawState.isHWAntialias()) { |
| 59 fFlags |= kHWAA_Flag; | 58 fFlags |= kHWAA_Flag; |
| 60 } | 59 } |
| 61 if (drawState.isColorWriteDisabled()) { | 60 if (drawState.isColorWriteDisabled()) { |
| 62 fFlags |= kDisableColorWrite_Flag; | 61 fFlags |= kDisableColorWrite_Flag; |
| 63 } | 62 } |
| 64 if (drawState.isDither()) { | 63 if (drawState.isDither()) { |
| 65 fFlags |= kDither_Flag; | 64 fFlags |= kDither_Flag; |
| 66 } | 65 } |
| 67 | 66 |
| 68 descInfo.fHasVertexColor = drawState.hasGeometryProcessor() && | 67 fDescInfo.fHasVertexColor = drawState.hasGeometryProcessor() && |
| 69 drawState.getGeometryProcessor()->hasVertexColor(
); | 68 drawState.getGeometryProcessor()->hasVertexColor
(); |
| 70 | 69 |
| 71 descInfo.fHasVertexCoverage = drawState.hasGeometryProcessor() && | 70 fDescInfo.fHasVertexCoverage = drawState.hasGeometryProcessor() && |
| 72 drawState.getGeometryProcessor()->hasVertexCove
rage(); | 71 drawState.getGeometryProcessor()->hasVertexCo
verage(); |
| 73 | 72 |
| 74 bool hasLocalCoords = drawState.hasGeometryProcessor() && | 73 bool hasLocalCoords = drawState.hasGeometryProcessor() && |
| 75 drawState.getGeometryProcessor()->hasLocalCoords(); | 74 drawState.getGeometryProcessor()->hasLocalCoords(); |
| 76 | 75 |
| 77 const GrProcOptInfo& colorPOI = drawState.colorProcInfo(); | 76 const GrProcOptInfo& colorPOI = drawState.colorProcInfo(); |
| 78 int firstColorStageIdx = colorPOI.firstEffectiveStageIndex(); | 77 int firstColorStageIdx = colorPOI.firstEffectiveStageIndex(); |
| 79 descInfo.fInputColorIsUsed = colorPOI.inputColorIsUsed(); | 78 fDescInfo.fInputColorIsUsed = colorPOI.inputColorIsUsed(); |
| 80 fColor = colorPOI.inputColorToEffectiveStage(); | 79 fColor = colorPOI.inputColorToEffectiveStage(); |
| 81 if (colorPOI.removeVertexAttrib()) { | 80 if (colorPOI.removeVertexAttrib()) { |
| 82 descInfo.fHasVertexColor = false; | 81 fDescInfo.fHasVertexColor = false; |
| 83 } | 82 } |
| 84 | 83 |
| 85 // TODO: Once we can handle single or four channel input into coverage stage
s then we can use | 84 // TODO: Once we can handle single or four channel input into coverage stage
s then we can use |
| 86 // drawState's coverageProcInfo (like color above) to set this initial infor
mation. | 85 // drawState's coverageProcInfo (like color above) to set this initial infor
mation. |
| 87 int firstCoverageStageIdx = 0; | 86 int firstCoverageStageIdx = 0; |
| 88 descInfo.fInputCoverageIsUsed = true; | 87 fDescInfo.fInputCoverageIsUsed = true; |
| 89 fCoverage = drawState.getCoverage(); | 88 fCoverage = drawState.getCoverage(); |
| 90 | 89 |
| 91 this->adjustProgramForBlendOpt(drawState, blendOpt, &descInfo, &firstColorSt
ageIdx, | 90 this->adjustProgramForBlendOpt(drawState, blendOpt, &firstColorStageIdx, |
| 92 &firstCoverageStageIdx); | 91 &firstCoverageStageIdx); |
| 93 | 92 |
| 94 this->getStageStats(drawState, firstColorStageIdx, firstCoverageStageIdx, ha
sLocalCoords, | 93 this->getStageStats(drawState, firstColorStageIdx, firstCoverageStageIdx, ha
sLocalCoords); |
| 95 &descInfo); | |
| 96 | 94 |
| 97 // Copy GeometryProcesssor from DS or ODS | 95 // Copy GeometryProcesssor from DS or ODS |
| 98 SkASSERT(GrGpu::IsPathRenderingDrawType(drawType) || | 96 SkASSERT(GrGpu::IsPathRenderingDrawType(drawType) || |
| 99 GrGpu::kStencilPath_DrawType || | 97 GrGpu::kStencilPath_DrawType || |
| 100 drawState.hasGeometryProcessor()); | 98 drawState.hasGeometryProcessor()); |
| 101 fGeometryProcessor.reset(drawState.getGeometryProcessor()); | 99 fGeometryProcessor.reset(drawState.getGeometryProcessor()); |
| 102 | 100 |
| 103 // Copy Stages from DS to ODS | 101 // Copy Stages from DS to ODS |
| 104 for (int i = firstColorStageIdx; i < drawState.numColorStages(); ++i) { | 102 for (int i = firstColorStageIdx; i < drawState.numColorStages(); ++i) { |
| 105 SkNEW_APPEND_TO_TARRAY(&fFragmentStages, | 103 SkNEW_APPEND_TO_TARRAY(&fFragmentStages, |
| 106 GrPendingFragmentStage, | 104 GrPendingFragmentStage, |
| 107 (drawState.fColorStages[i], hasLocalCoords)); | 105 (drawState.fColorStages[i], hasLocalCoords)); |
| 108 } | 106 } |
| 109 fNumColorStages = fFragmentStages.count(); | 107 fNumColorStages = fFragmentStages.count(); |
| 110 for (int i = firstCoverageStageIdx; i < drawState.numCoverageStages(); ++i)
{ | 108 for (int i = firstCoverageStageIdx; i < drawState.numCoverageStages(); ++i)
{ |
| 111 SkNEW_APPEND_TO_TARRAY(&fFragmentStages, | 109 SkNEW_APPEND_TO_TARRAY(&fFragmentStages, |
| 112 GrPendingFragmentStage, | 110 GrPendingFragmentStage, |
| 113 (drawState.fCoverageStages[i], hasLocalCoords)); | 111 (drawState.fCoverageStages[i], hasLocalCoords)); |
| 114 } | 112 } |
| 115 | 113 |
| 116 this->setOutputStateInfo(drawState, blendOpt, *gpu->caps(), &descInfo); | 114 this->setOutputStateInfo(drawState, blendOpt, caps); |
| 117 | |
| 118 // now create a key | |
| 119 gpu->buildProgramDesc(*this, descInfo, drawType, &fDesc); | |
| 120 }; | 115 }; |
| 121 | 116 |
| 122 void GrOptDrawState::setOutputStateInfo(const GrDrawState& ds, | 117 void GrOptDrawState::setOutputStateInfo(const GrDrawState& ds, |
| 123 GrDrawState::BlendOpt blendOpt, | 118 GrDrawState::BlendOpt blendOpt, |
| 124 const GrDrawTargetCaps& caps, | 119 const GrDrawTargetCaps& caps) { |
| 125 GrProgramDesc::DescInfo* descInfo) { | |
| 126 // Set this default and then possibly change our mind if there is coverage. | 120 // Set this default and then possibly change our mind if there is coverage. |
| 127 descInfo->fPrimaryOutputType = GrProgramDesc::kModulate_PrimaryOutputType; | 121 fDescInfo.fPrimaryOutputType = GrProgramDesc::kModulate_PrimaryOutputType; |
| 128 descInfo->fSecondaryOutputType = GrProgramDesc::kNone_SecondaryOutputType; | 122 fDescInfo.fSecondaryOutputType = GrProgramDesc::kNone_SecondaryOutputType; |
| 129 | 123 |
| 130 // Determine whether we should use dual source blending or shader code to ke
ep coverage | 124 // Determine whether we should use dual source blending or shader code to ke
ep coverage |
| 131 // separate from color. | 125 // separate from color. |
| 132 bool keepCoverageSeparate = !(GrDrawState::kCoverageAsAlpha_BlendOpt == blen
dOpt || | 126 bool keepCoverageSeparate = !(GrDrawState::kCoverageAsAlpha_BlendOpt == blen
dOpt || |
| 133 GrDrawState::kEmitCoverage_BlendOpt == blendOp
t); | 127 GrDrawState::kEmitCoverage_BlendOpt == blendOp
t); |
| 134 if (keepCoverageSeparate && !ds.hasSolidCoverage()) { | 128 if (keepCoverageSeparate && !ds.hasSolidCoverage()) { |
| 135 if (caps.dualSourceBlendingSupport()) { | 129 if (caps.dualSourceBlendingSupport()) { |
| 136 if (kZero_GrBlendCoeff == fDstBlend) { | 130 if (kZero_GrBlendCoeff == fDstBlend) { |
| 137 // write the coverage value to second color | 131 // write the coverage value to second color |
| 138 descInfo->fSecondaryOutputType = GrProgramDesc::kCoverage_Second
aryOutputType; | 132 fDescInfo.fSecondaryOutputType = GrProgramDesc::kCoverage_Second
aryOutputType; |
| 139 fDstBlend = (GrBlendCoeff)GrGpu::kIS2C_GrBlendCoeff; | 133 fDstBlend = (GrBlendCoeff)GrGpu::kIS2C_GrBlendCoeff; |
| 140 } else if (kSA_GrBlendCoeff == fDstBlend) { | 134 } else if (kSA_GrBlendCoeff == fDstBlend) { |
| 141 // SA dst coeff becomes 1-(1-SA)*coverage when dst is partially
covered. | 135 // SA dst coeff becomes 1-(1-SA)*coverage when dst is partially
covered. |
| 142 descInfo->fSecondaryOutputType = GrProgramDesc::kCoverageISA_Sec
ondaryOutputType; | 136 fDescInfo.fSecondaryOutputType = GrProgramDesc::kCoverageISA_Sec
ondaryOutputType; |
| 143 fDstBlend = (GrBlendCoeff)GrGpu::kIS2C_GrBlendCoeff; | 137 fDstBlend = (GrBlendCoeff)GrGpu::kIS2C_GrBlendCoeff; |
| 144 } else if (kSC_GrBlendCoeff == fDstBlend) { | 138 } else if (kSC_GrBlendCoeff == fDstBlend) { |
| 145 // SA dst coeff becomes 1-(1-SA)*coverage when dst is partially
covered. | 139 // SA dst coeff becomes 1-(1-SA)*coverage when dst is partially
covered. |
| 146 descInfo->fSecondaryOutputType = GrProgramDesc::kCoverageISC_Sec
ondaryOutputType; | 140 fDescInfo.fSecondaryOutputType = GrProgramDesc::kCoverageISC_Sec
ondaryOutputType; |
| 147 fDstBlend = (GrBlendCoeff)GrGpu::kIS2C_GrBlendCoeff; | 141 fDstBlend = (GrBlendCoeff)GrGpu::kIS2C_GrBlendCoeff; |
| 148 } | 142 } |
| 149 } else if (descInfo->fReadsDst && | 143 } else if (fDescInfo.fReadsDst && |
| 150 kOne_GrBlendCoeff == fSrcBlend && | 144 kOne_GrBlendCoeff == fSrcBlend && |
| 151 kZero_GrBlendCoeff == fDstBlend) { | 145 kZero_GrBlendCoeff == fDstBlend) { |
| 152 descInfo->fPrimaryOutputType = GrProgramDesc::kCombineWithDst_Primar
yOutputType; | 146 fDescInfo.fPrimaryOutputType = GrProgramDesc::kCombineWithDst_Primar
yOutputType; |
| 153 } | 147 } |
| 154 } | 148 } |
| 155 } | 149 } |
| 156 | 150 |
| 157 void GrOptDrawState::adjustProgramForBlendOpt(const GrDrawState& ds, | 151 void GrOptDrawState::adjustProgramForBlendOpt(const GrDrawState& ds, |
| 158 GrDrawState::BlendOpt blendOpt, | 152 GrDrawState::BlendOpt blendOpt, |
| 159 GrProgramDesc::DescInfo* descInfo, | |
| 160 int* firstColorStageIdx, | 153 int* firstColorStageIdx, |
| 161 int* firstCoverageStageIdx) { | 154 int* firstCoverageStageIdx) { |
| 162 switch (blendOpt) { | 155 switch (blendOpt) { |
| 163 case GrDrawState::kNone_BlendOpt: | 156 case GrDrawState::kNone_BlendOpt: |
| 164 case GrDrawState::kSkipDraw_BlendOpt: | 157 case GrDrawState::kSkipDraw_BlendOpt: |
| 165 case GrDrawState::kCoverageAsAlpha_BlendOpt: | 158 case GrDrawState::kCoverageAsAlpha_BlendOpt: |
| 166 break; | 159 break; |
| 167 case GrDrawState::kEmitCoverage_BlendOpt: | 160 case GrDrawState::kEmitCoverage_BlendOpt: |
| 168 fColor = 0xffffffff; | 161 fColor = 0xffffffff; |
| 169 descInfo->fInputColorIsUsed = true; | 162 fDescInfo.fInputColorIsUsed = true; |
| 170 *firstColorStageIdx = ds.numColorStages(); | 163 *firstColorStageIdx = ds.numColorStages(); |
| 171 descInfo->fHasVertexColor = false; | 164 fDescInfo.fHasVertexColor = false; |
| 172 break; | 165 break; |
| 173 case GrDrawState::kEmitTransBlack_BlendOpt: | 166 case GrDrawState::kEmitTransBlack_BlendOpt: |
| 174 fColor = 0; | 167 fColor = 0; |
| 175 fCoverage = 0xff; | 168 fCoverage = 0xff; |
| 176 descInfo->fInputColorIsUsed = true; | 169 fDescInfo.fInputColorIsUsed = true; |
| 177 descInfo->fInputCoverageIsUsed = true; | 170 fDescInfo.fInputCoverageIsUsed = true; |
| 178 *firstColorStageIdx = ds.numColorStages(); | 171 *firstColorStageIdx = ds.numColorStages(); |
| 179 *firstCoverageStageIdx = ds.numCoverageStages(); | 172 *firstCoverageStageIdx = ds.numCoverageStages(); |
| 180 descInfo->fHasVertexColor = false; | 173 fDescInfo.fHasVertexColor = false; |
| 181 descInfo->fHasVertexCoverage = false; | 174 fDescInfo.fHasVertexCoverage = false; |
| 182 break; | 175 break; |
| 183 } | 176 } |
| 184 } | 177 } |
| 185 | 178 |
| 186 static void get_stage_stats(const GrFragmentStage& stage, bool* readsDst, bool*
readsFragPosition) { | 179 static void get_stage_stats(const GrFragmentStage& stage, bool* readsDst, bool*
readsFragPosition) { |
| 187 if (stage.getProcessor()->willReadDstColor()) { | 180 if (stage.getProcessor()->willReadDstColor()) { |
| 188 *readsDst = true; | 181 *readsDst = true; |
| 189 } | 182 } |
| 190 if (stage.getProcessor()->willReadFragmentPosition()) { | 183 if (stage.getProcessor()->willReadFragmentPosition()) { |
| 191 *readsFragPosition = true; | 184 *readsFragPosition = true; |
| 192 } | 185 } |
| 193 } | 186 } |
| 194 | 187 |
| 195 void GrOptDrawState::getStageStats(const GrDrawState& ds, int firstColorStageIdx
, | 188 void GrOptDrawState::getStageStats(const GrDrawState& ds, int firstColorStageIdx
, |
| 196 int firstCoverageStageIdx, bool hasLocalCoord
s, | 189 int firstCoverageStageIdx, bool hasLocalCoord
s) { |
| 197 GrProgramDesc::DescInfo* descInfo) { | |
| 198 // We will need a local coord attrib if there is one currently set on the op
tState and we are | 190 // We will need a local coord attrib if there is one currently set on the op
tState and we are |
| 199 // actually generating some effect code | 191 // actually generating some effect code |
| 200 descInfo->fRequiresLocalCoordAttrib = hasLocalCoords && | 192 fDescInfo.fRequiresLocalCoordAttrib = hasLocalCoords && |
| 201 ds.numTotalStages() - firstColorStageIdx - firstCoverageStageIdx > 0; | 193 ds.numTotalStages() - firstColorStageIdx - firstCoverageStageIdx > 0; |
| 202 | 194 |
| 203 descInfo->fReadsDst = false; | 195 fDescInfo.fReadsDst = false; |
| 204 descInfo->fReadsFragPosition = false; | 196 fDescInfo.fReadsFragPosition = false; |
| 205 | 197 |
| 206 for (int s = firstColorStageIdx; s < ds.numColorStages(); ++s) { | 198 for (int s = firstColorStageIdx; s < ds.numColorStages(); ++s) { |
| 207 const GrFragmentStage& stage = ds.getColorStage(s); | 199 const GrFragmentStage& stage = ds.getColorStage(s); |
| 208 get_stage_stats(stage, &descInfo->fReadsDst, &descInfo->fReadsFragPositi
on); | 200 get_stage_stats(stage, &fDescInfo.fReadsDst, &fDescInfo.fReadsFragPositi
on); |
| 209 } | 201 } |
| 210 for (int s = firstCoverageStageIdx; s < ds.numCoverageStages(); ++s) { | 202 for (int s = firstCoverageStageIdx; s < ds.numCoverageStages(); ++s) { |
| 211 const GrFragmentStage& stage = ds.getCoverageStage(s); | 203 const GrFragmentStage& stage = ds.getCoverageStage(s); |
| 212 get_stage_stats(stage, &descInfo->fReadsDst, &descInfo->fReadsFragPositi
on); | 204 get_stage_stats(stage, &fDescInfo.fReadsDst, &fDescInfo.fReadsFragPositi
on); |
| 213 } | 205 } |
| 214 if (ds.hasGeometryProcessor()) { | 206 if (ds.hasGeometryProcessor()) { |
| 215 const GrGeometryProcessor& gp = *ds.getGeometryProcessor(); | 207 const GrGeometryProcessor& gp = *ds.getGeometryProcessor(); |
| 216 descInfo->fReadsFragPosition = descInfo->fReadsFragPosition || gp.willRe
adFragmentPosition(); | 208 fDescInfo.fReadsFragPosition = fDescInfo.fReadsFragPosition || gp.willRe
adFragmentPosition(); |
| 217 } | 209 } |
| 218 } | 210 } |
| 219 | 211 |
| 212 void GrOptDrawState::finalize(GrGpu* gpu) { |
| 213 gpu->buildProgramDesc(*this, fDescInfo, fDrawType, &fDesc); |
| 214 fFinalized = true; |
| 215 } |
| 216 |
| 220 //////////////////////////////////////////////////////////////////////////////// | 217 //////////////////////////////////////////////////////////////////////////////// |
| 221 | 218 |
| 222 bool GrOptDrawState::operator== (const GrOptDrawState& that) const { | 219 bool GrOptDrawState::operator== (const GrOptDrawState& that) const { |
| 223 if (this->fDesc != that.fDesc) { | 220 if (!fDescInfo.fHasVertexColor && this->fColor != that.fColor) { |
| 224 return false; | |
| 225 } | |
| 226 bool hasVertexColors = this->fDesc.header().fColorInput == GrProgramDesc::kA
ttribute_ColorInput; | |
| 227 if (!hasVertexColors && this->fColor != that.fColor) { | |
| 228 return false; | 221 return false; |
| 229 } | 222 } |
| 230 | 223 |
| 231 if (this->getRenderTarget() != that.getRenderTarget() || | 224 if (this->getRenderTarget() != that.getRenderTarget() || |
| 225 this->fFragmentStages.count() != that.fFragmentStages.count() || |
| 226 this->fNumColorStages != that.fNumColorStages || |
| 232 this->fScissorState != that.fScissorState || | 227 this->fScissorState != that.fScissorState || |
| 233 !this->fViewMatrix.cheapEqualTo(that.fViewMatrix) || | 228 !this->fViewMatrix.cheapEqualTo(that.fViewMatrix) || |
| 234 this->fSrcBlend != that.fSrcBlend || | 229 this->fSrcBlend != that.fSrcBlend || |
| 235 this->fDstBlend != that.fDstBlend || | 230 this->fDstBlend != that.fDstBlend || |
| 231 this->fDrawType != that.fDrawType || |
| 232 fDescInfo.fInputColorIsUsed != that.fDescInfo.fInputColorIsUsed || |
| 233 fDescInfo.fInputCoverageIsUsed != that.fDescInfo.fInputCoverageIsUsed || |
| 234 fDescInfo.fReadsDst != that.fDescInfo.fReadsDst || |
| 235 fDescInfo.fReadsFragPosition != that.fDescInfo.fReadsFragPosition || |
| 236 fDescInfo.fRequiresLocalCoordAttrib != that.fDescInfo.fRequiresLocalCoor
dAttrib || |
| 237 fDescInfo.fPrimaryOutputType != that.fDescInfo.fPrimaryOutputType || |
| 238 fDescInfo.fSecondaryOutputType != that.fDescInfo.fSecondaryOutputType || |
| 239 this->fScissorState != that.fScissorState || |
| 236 this->fBlendConstant != that.fBlendConstant || | 240 this->fBlendConstant != that.fBlendConstant || |
| 237 this->fFlags != that.fFlags || | 241 this->fFlags != that.fFlags || |
| 238 this->fStencilSettings != that.fStencilSettings || | 242 this->fStencilSettings != that.fStencilSettings || |
| 239 this->fDrawFace != that.fDrawFace || | 243 this->fDrawFace != that.fDrawFace || |
| 240 this->fDstCopy.texture() != that.fDstCopy.texture()) { | 244 this->fDstCopy.texture() != that.fDstCopy.texture()) { |
| 241 return false; | 245 return false; |
| 242 } | 246 } |
| 243 | 247 |
| 244 bool hasVertexCoverage = | 248 if (!fDescInfo.fHasVertexCoverage && this->fCoverage != that.fCoverage) { |
| 245 this->fDesc.header().fCoverageInput == GrProgramDesc::kAttribute_Col
orInput; | |
| 246 if (!hasVertexCoverage && this->fCoverage != that.fCoverage) { | |
| 247 return false; | 249 return false; |
| 248 } | 250 } |
| 249 | 251 |
| 250 if (this->hasGeometryProcessor()) { | 252 if (this->hasGeometryProcessor()) { |
| 251 if (!that.hasGeometryProcessor()) { | 253 if (!that.hasGeometryProcessor()) { |
| 252 return false; | 254 return false; |
| 253 } else if (!this->getGeometryProcessor()->isEqual(*that.getGeometryProce
ssor())) { | 255 } else if (!this->getGeometryProcessor()->isEqual(*that.getGeometryProce
ssor())) { |
| 254 return false; | 256 return false; |
| 255 } | 257 } |
| 256 } else if (that.hasGeometryProcessor()) { | 258 } else if (that.hasGeometryProcessor()) { |
| 257 return false; | 259 return false; |
| 258 } | 260 } |
| 259 | 261 |
| 260 // The program desc comparison should have already assured that the stage co
unts match. | 262 // The program desc comparison should have already assured that the stage co
unts match. |
| 261 SkASSERT(this->numFragmentStages() == that.numFragmentStages()); | 263 SkASSERT(this->numFragmentStages() == that.numFragmentStages()); |
| 262 for (int i = 0; i < this->numFragmentStages(); i++) { | 264 for (int i = 0; i < this->numFragmentStages(); i++) { |
| 263 | 265 |
| 264 if (this->getFragmentStage(i) != that.getFragmentStage(i)) { | 266 if (this->getFragmentStage(i) != that.getFragmentStage(i)) { |
| 265 return false; | 267 return false; |
| 266 } | 268 } |
| 267 } | 269 } |
| 268 return true; | 270 return true; |
| 269 } | 271 } |
| 270 | 272 |
| OLD | NEW |