| 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 | 146 |
| 147 static void set_random_color_coverage_stages(GrGLGpu* gpu, | 147 static void set_random_color_coverage_stages(GrGLGpu* gpu, |
| 148 GrPipelineBuilder* pipelineBuilder, | 148 GrPipelineBuilder* pipelineBuilder, |
| 149 int maxStages, | 149 int maxStages, |
| 150 bool usePathRendering, | 150 bool usePathRendering, |
| 151 SkRandom* random, | 151 SkRandom* random, |
| 152 GrTexture* dummyTextures[]) { | 152 GrTexture* dummyTextures[]) { |
| 153 int numProcs = random->nextULessThan(maxStages + 1); | 153 int numProcs = random->nextULessThan(maxStages + 1); |
| 154 int numColorProcs = random->nextULessThan(numProcs + 1); | 154 int numColorProcs = random->nextULessThan(numProcs + 1); |
| 155 | 155 |
| 156 int currTextureCoordSet = 0; | |
| 157 for (int s = 0; s < numProcs;) { | 156 for (int s = 0; s < numProcs;) { |
| 158 SkAutoTUnref<const GrFragmentProcessor> fp( | 157 SkAutoTUnref<const GrFragmentProcessor> fp( |
| 159 GrProcessorTestFactory<GrFragmentProcessor>::CreateStage(random, | 158 GrProcessorTestFactory<GrFragmentProcessor>::CreateStage(random, |
| 160 gpu->ge
tContext(), | 159 gpu->ge
tContext(), |
| 161 *gpu->c
aps(), | 160 *gpu->c
aps(), |
| 162 dummyTe
xtures)); | 161 dummyTe
xtures)); |
| 163 SkASSERT(fp); | 162 SkASSERT(fp); |
| 164 | 163 |
| 165 // If adding this effect would exceed the max texture coord set count th
en generate a | |
| 166 // new random effect. | |
| 167 if (usePathRendering && gpu->glPathRendering()->texturingMode() == | |
| 168 GrGLPathRendering::FixedFunction_TexturingMode)
{; | |
| 169 int numTransforms = fp->numTransforms(); | |
| 170 if (currTextureCoordSet + numTransforms > | |
| 171 gpu->glCaps().maxFixedFunctionTextureCoords()) { | |
| 172 continue; | |
| 173 } | |
| 174 currTextureCoordSet += numTransforms; | |
| 175 } | |
| 176 | |
| 177 // finally add the stage to the correct pipeline in the drawstate | 164 // finally add the stage to the correct pipeline in the drawstate |
| 178 if (s < numColorProcs) { | 165 if (s < numColorProcs) { |
| 179 pipelineBuilder->addColorProcessor(fp); | 166 pipelineBuilder->addColorProcessor(fp); |
| 180 } else { | 167 } else { |
| 181 pipelineBuilder->addCoverageProcessor(fp); | 168 pipelineBuilder->addCoverageProcessor(fp); |
| 182 } | 169 } |
| 183 ++s; | 170 ++s; |
| 184 } | 171 } |
| 185 } | 172 } |
| 186 | 173 |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 } | 360 } |
| 374 #endif | 361 #endif |
| 375 GrTestTarget target; | 362 GrTestTarget target; |
| 376 context->getTestTarget(&target); | 363 context->getTestTarget(&target); |
| 377 REPORTER_ASSERT(reporter, target.target()->programUnitTest(maxStages
)); | 364 REPORTER_ASSERT(reporter, target.target()->programUnitTest(maxStages
)); |
| 378 } | 365 } |
| 379 } | 366 } |
| 380 } | 367 } |
| 381 | 368 |
| 382 #endif | 369 #endif |
| OLD | NEW |