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 23 matching lines...) Expand all Loading... | |
34 sizeof(fFixedFunctionVertexAttribIndices)); | 34 sizeof(fFixedFunctionVertexAttribIndices)); |
35 | 35 |
36 | 36 |
37 fInputColorIsUsed = true; | 37 fInputColorIsUsed = true; |
38 fInputCoverageIsUsed = true; | 38 fInputCoverageIsUsed = true; |
39 | 39 |
40 this->copyEffectiveColorStages(drawState); | 40 this->copyEffectiveColorStages(drawState); |
41 this->copyEffectiveCoverageStages(drawState); | 41 this->copyEffectiveCoverageStages(drawState); |
42 this->adjustFromBlendOpts(); | 42 this->adjustFromBlendOpts(); |
43 this->remapEffectStagesVAIndices(); | 43 this->remapEffectStagesVAIndices(); |
44 this->getStageStats(); | |
44 }; | 45 }; |
45 | 46 |
46 void GrOptDrawState::initializeVAIndexMap() { | 47 void GrOptDrawState::initializeVAIndexMap() { |
47 fVAIndexMap.reset(fVACount); | 48 fVAIndexMap.reset(fVACount); |
48 int* map = fVAIndexMap.get(); | 49 int* map = fVAIndexMap.get(); |
49 for (int i = 0; i < fVACount; ++i) { | 50 for (int i = 0; i < fVACount; ++i) { |
50 map[i] = i; | 51 map[i] = i; |
51 } | 52 } |
52 } | 53 } |
53 | 54 |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
206 } | 207 } |
207 } | 208 } |
208 if (ds.numCoverageStages() > 0) { | 209 if (ds.numCoverageStages() > 0) { |
209 fCoverageStages.reset(&ds.getCoverageStage(firstCoverageStage), | 210 fCoverageStages.reset(&ds.getCoverageStage(firstCoverageStage), |
210 ds.numCoverageStages() - firstCoverageStage); | 211 ds.numCoverageStages() - firstCoverageStage); |
211 } else { | 212 } else { |
212 fCoverageStages.reset(); | 213 fCoverageStages.reset(); |
213 } | 214 } |
214 } | 215 } |
215 | 216 |
217 static void get_stage_stats(const GrEffectStage& stage, bool* readsDst, | |
218 bool* readsFragPosition, bool* requiresVertexShader) { | |
219 if (stage.getEffect()->willReadDstColor()) { | |
220 *readsDst = true; | |
221 } | |
222 if (stage.getEffect()->willReadFragmentPosition()) { | |
223 *readsFragPosition = true; | |
224 } | |
225 if (stage.getEffect()->requiresVertexShader()) { | |
bsalomon
2014/09/05 15:27:54
this is going away... reqVS will be equivalent to
| |
226 *requiresVertexShader = true; | |
227 } | |
228 } | |
229 | |
230 void GrOptDrawState::getStageStats() { | |
231 fReadsDst = false; | |
232 fReadsFragPosition = false; | |
233 fRequiresVertexShader = false; | |
234 | |
235 for (int s = 0; s < this->numColorStages(); ++s) { | |
236 const GrEffectStage& stage = this->getColorStage(s); | |
237 get_stage_stats(stage, &fReadsDst, &fReadsFragPosition, &fRequiresVertex Shader); | |
238 } | |
239 for (int s = 0; s < this->numCoverageStages(); ++s) { | |
240 const GrEffectStage& stage = this->getCoverageStage(s); | |
241 get_stage_stats(stage, &fReadsDst, &fReadsFragPosition, &fRequiresVertex Shader); | |
242 } | |
243 } | |
244 | |
216 bool GrOptDrawState::operator== (const GrOptDrawState& that) const { | 245 bool GrOptDrawState::operator== (const GrOptDrawState& that) const { |
217 return this->isEqual(that); | 246 return this->isEqual(that); |
218 } | 247 } |
219 | 248 |
OLD | NEW |