| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 // This is a GPU-backend specific test. It relies on static intializers to work | 9 // This is a GPU-backend specific test. It relies on static intializers to work |
| 10 | 10 |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 | 165 |
| 166 bool useFixedFunctionTexturing = this->shouldUseFixedFunctionTexturing()
; | 166 bool useFixedFunctionTexturing = this->shouldUseFixedFunctionTexturing()
; |
| 167 | 167 |
| 168 for (int s = 0; s < numStages;) { | 168 for (int s = 0; s < numStages;) { |
| 169 SkAutoTUnref<const GrEffectRef> effect(GrEffectTestFactory::CreateSt
age( | 169 SkAutoTUnref<const GrEffectRef> effect(GrEffectTestFactory::CreateSt
age( |
| 170 &ran
dom, | 170 &ran
dom, |
| 171 this
->getContext(), | 171 this
->getContext(), |
| 172 *thi
s->caps(), | 172 *thi
s->caps(), |
| 173 dumm
yTextures)); | 173 dumm
yTextures)); |
| 174 SkASSERT(effect); | 174 SkASSERT(effect); |
| 175 int numAttribs = effect->numVertexAttribs(); | 175 int numAttribs = (*effect)->numVertexAttribs(); |
| 176 | 176 |
| 177 // If adding this effect would exceed the max attrib count then gene
rate a | 177 // If adding this effect would exceed the max attrib count then gene
rate a |
| 178 // new random effect. | 178 // new random effect. |
| 179 if (currAttribIndex + numAttribs > GrDrawState::kMaxVertexAttribCnt)
{ | 179 if (currAttribIndex + numAttribs > GrDrawState::kMaxVertexAttribCnt)
{ |
| 180 continue; | 180 continue; |
| 181 } | 181 } |
| 182 | 182 |
| 183 | 183 |
| 184 // If adding this effect would exceed the max texture coord set coun
t then generate a | 184 // If adding this effect would exceed the max texture coord set coun
t then generate a |
| 185 // new random effect. | 185 // new random effect. |
| 186 if (useFixedFunctionTexturing && !effect->hasVertexCode()) { | 186 if (useFixedFunctionTexturing && !(*effect)->hasVertexCode()) { |
| 187 int numTransforms = effect->numTransforms(); | 187 int numTransforms = (*effect)->numTransforms(); |
| 188 if (currTextureCoordSet + numTransforms > this->glCaps().maxFixe
dFunctionTextureCoords()) { | 188 if (currTextureCoordSet + numTransforms > this->glCaps().maxFixe
dFunctionTextureCoords()) { |
| 189 continue; | 189 continue; |
| 190 } | 190 } |
| 191 currTextureCoordSet += numTransforms; | 191 currTextureCoordSet += numTransforms; |
| 192 } | 192 } |
| 193 | 193 |
| 194 useFixedFunctionTexturing = useFixedFunctionTexturing && !effect->ha
sVertexCode(); | 194 useFixedFunctionTexturing = useFixedFunctionTexturing && !(*effect)-
>hasVertexCode(); |
| 195 | 195 |
| 196 for (int i = 0; i < numAttribs; ++i) { | 196 for (int i = 0; i < numAttribs; ++i) { |
| 197 attribIndices[i] = currAttribIndex++; | 197 attribIndices[i] = currAttribIndex++; |
| 198 } | 198 } |
| 199 GrEffectStage* stage = SkNEW_ARGS(GrEffectStage, | 199 GrEffectStage* stage = SkNEW_ARGS(GrEffectStage, |
| 200 (effect.get(), attribIndices[0], a
ttribIndices[1])); | 200 (effect.get(), attribIndices[0], a
ttribIndices[1])); |
| 201 stages[s] = stage; | 201 stages[s] = stage; |
| 202 ++s; | 202 ++s; |
| 203 } | 203 } |
| 204 const GrTexture* dstTexture = random.nextBool() ? dummyTextures[0] : dum
myTextures[1]; | 204 const GrTexture* dstTexture = random.nextBool() ? dummyTextures[0] : dum
myTextures[1]; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 SkRect::MakeWH(SK_Scalar1, SK_Scalar1), SK_Scalar1)); | 261 SkRect::MakeWH(SK_Scalar1, SK_Scalar1), SK_Scalar1)); |
| 262 GrConfigConversionEffect::Create(NULL, | 262 GrConfigConversionEffect::Create(NULL, |
| 263 false, | 263 false, |
| 264 GrConfigConversionEffect::kNone_PMConversio
n, | 264 GrConfigConversionEffect::kNone_PMConversio
n, |
| 265 SkMatrix::I()); | 265 SkMatrix::I()); |
| 266 SkScalar matrix[20]; | 266 SkScalar matrix[20]; |
| 267 SkAutoTUnref<SkColorMatrixFilter> cmf(SkColorMatrixFilter::Create(matrix)); | 267 SkAutoTUnref<SkColorMatrixFilter> cmf(SkColorMatrixFilter::Create(matrix)); |
| 268 } | 268 } |
| 269 | 269 |
| 270 #endif | 270 #endif |
| OLD | NEW |