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" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 this->computeEffectiveCoverageStages(drawState, &firstCoverageStageIdx); | 47 this->computeEffectiveCoverageStages(drawState, &firstCoverageStageIdx); |
48 this->adjustFromBlendOpts(drawState, &firstColorStageIdx, &firstCoverageStag
eIdx, | 48 this->adjustFromBlendOpts(drawState, &firstColorStageIdx, &firstCoverageStag
eIdx, |
49 &fixedFunctionVAToRemove); | 49 &fixedFunctionVAToRemove); |
50 // Should not be setting any more FFVA to be removed at this point | 50 // Should not be setting any more FFVA to be removed at this point |
51 this->removeFixedFunctionVertexAttribs(fixedFunctionVAToRemove); | 51 this->removeFixedFunctionVertexAttribs(fixedFunctionVAToRemove); |
52 this->getStageStats(drawState, firstColorStageIdx, firstCoverageStageIdx); | 52 this->getStageStats(drawState, firstColorStageIdx, firstCoverageStageIdx); |
53 this->setOutputStateInfo(drawState, caps, firstCoverageStageIdx, &separateCo
verageFromColor); | 53 this->setOutputStateInfo(drawState, caps, firstCoverageStageIdx, &separateCo
verageFromColor); |
54 | 54 |
55 // Copy GeometryProcesssor from DS or ODS | 55 // Copy GeometryProcesssor from DS or ODS |
56 if (drawState.hasGeometryProcessor()) { | 56 if (drawState.hasGeometryProcessor()) { |
57 fGeometryProcessor.reset(SkNEW_ARGS(GrGeometryStage, (*drawState.getGeom
etryProcessor()))); | 57 fGeometryProcessor.initAndRef(drawState.fGeometryProcessor); |
58 } else { | 58 } else { |
59 fGeometryProcessor.reset(NULL); | 59 fGeometryProcessor.reset(NULL); |
60 } | 60 } |
61 | 61 |
62 // Copy Color Stages from DS to ODS | 62 // Copy Color Stages from DS to ODS |
63 if (firstColorStageIdx < drawState.numColorStages()) { | 63 if (firstColorStageIdx < drawState.numColorStages()) { |
64 fFragmentStages.reset(&drawState.getColorStage(firstColorStageIdx), | 64 fFragmentStages.reset(&drawState.getColorStage(firstColorStageIdx), |
65 drawState.numColorStages() - firstColorStageIdx); | 65 drawState.numColorStages() - firstColorStageIdx); |
66 } else { | 66 } else { |
67 fFragmentStages.reset(); | 67 fFragmentStages.reset(); |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 | 298 |
299 for (int s = firstColorStageIdx; s < ds.numColorStages(); ++s) { | 299 for (int s = firstColorStageIdx; s < ds.numColorStages(); ++s) { |
300 const GrFragmentStage& stage = ds.getColorStage(s); | 300 const GrFragmentStage& stage = ds.getColorStage(s); |
301 get_stage_stats(stage, &fReadsDst, &fReadsFragPosition); | 301 get_stage_stats(stage, &fReadsDst, &fReadsFragPosition); |
302 } | 302 } |
303 for (int s = firstCoverageStageIdx; s < ds.numCoverageStages(); ++s) { | 303 for (int s = firstCoverageStageIdx; s < ds.numCoverageStages(); ++s) { |
304 const GrFragmentStage& stage = ds.getCoverageStage(s); | 304 const GrFragmentStage& stage = ds.getCoverageStage(s); |
305 get_stage_stats(stage, &fReadsDst, &fReadsFragPosition); | 305 get_stage_stats(stage, &fReadsDst, &fReadsFragPosition); |
306 } | 306 } |
307 if (ds.hasGeometryProcessor()) { | 307 if (ds.hasGeometryProcessor()) { |
308 const GrGeometryStage& stage = *ds.getGeometryProcessor(); | 308 const GrGeometryProcessor& gp = *ds.getGeometryProcessor(); |
309 fReadsFragPosition = fReadsFragPosition || stage.getProcessor()->willRea
dFragmentPosition(); | 309 fReadsFragPosition = fReadsFragPosition || gp.willReadFragmentPosition()
; |
310 } | 310 } |
311 } | 311 } |
312 | 312 |
313 //////////////////////////////////////////////////////////////////////////////// | 313 //////////////////////////////////////////////////////////////////////////////// |
314 | 314 |
315 bool GrOptDrawState::operator== (const GrOptDrawState& that) const { | 315 bool GrOptDrawState::operator== (const GrOptDrawState& that) const { |
316 return this->isEqual(that); | 316 return this->isEqual(that); |
317 } | 317 } |
318 | 318 |
319 bool GrOptDrawState::isEqual(const GrOptDrawState& that) const { | 319 bool GrOptDrawState::isEqual(const GrOptDrawState& that) const { |
(...skipping 27 matching lines...) Expand all Loading... |
347 | 347 |
348 bool usingVertexCoverage = this->hasCoverageVertexAttribute(); | 348 bool usingVertexCoverage = this->hasCoverageVertexAttribute(); |
349 if (!usingVertexCoverage && this->fCoverage != that.fCoverage) { | 349 if (!usingVertexCoverage && this->fCoverage != that.fCoverage) { |
350 return false; | 350 return false; |
351 } | 351 } |
352 | 352 |
353 bool explicitLocalCoords = this->hasLocalCoordAttribute(); | 353 bool explicitLocalCoords = this->hasLocalCoordAttribute(); |
354 if (this->hasGeometryProcessor()) { | 354 if (this->hasGeometryProcessor()) { |
355 if (!that.hasGeometryProcessor()) { | 355 if (!that.hasGeometryProcessor()) { |
356 return false; | 356 return false; |
357 } else if (!GrProcessorStage::AreCompatible(*this->getGeometryProcessor(
), | 357 } else if (!this->getGeometryProcessor()->isEqual(*that.getGeometryProce
ssor())) { |
358 *that.getGeometryProcessor()
, | |
359 explicitLocalCoords)) { | |
360 return false; | 358 return false; |
361 } | 359 } |
362 } else if (that.hasGeometryProcessor()) { | 360 } else if (that.hasGeometryProcessor()) { |
363 return false; | 361 return false; |
364 } | 362 } |
365 | 363 |
366 for (int i = 0; i < this->numFragmentStages(); i++) { | 364 for (int i = 0; i < this->numFragmentStages(); i++) { |
367 if (!GrProcessorStage::AreCompatible(this->getFragmentStage(i), that.get
FragmentStage(i), | 365 if (!GrFragmentStage::AreCompatible(this->getFragmentStage(i), that.getF
ragmentStage(i), |
368 explicitLocalCoords)) { | 366 explicitLocalCoords)) { |
369 return false; | 367 return false; |
370 } | 368 } |
371 } | 369 } |
372 | 370 |
373 SkASSERT(0 == memcmp(this->fFixedFunctionVertexAttribIndices, | 371 SkASSERT(0 == memcmp(this->fFixedFunctionVertexAttribIndices, |
374 that.fFixedFunctionVertexAttribIndices, | 372 that.fFixedFunctionVertexAttribIndices, |
375 sizeof(this->fFixedFunctionVertexAttribIndices))); | 373 sizeof(this->fFixedFunctionVertexAttribIndices))); |
376 | 374 |
377 return true; | 375 return true; |
378 } | 376 } |
379 | 377 |
OLD | NEW |