| Index: tests/GLProgramsTest.cpp
|
| diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp
|
| index 81d1013dd0104775a937408f0978d38cae105885..8bd74456c078bfd74ac2fdcb49ff889a912b2b24 100644
|
| --- a/tests/GLProgramsTest.cpp
|
| +++ b/tests/GLProgramsTest.cpp
|
| @@ -262,17 +262,19 @@ static void set_random_color_coverage_stages(GrPipelineBuilder* pipelineBuilder,
|
| }
|
| }
|
|
|
| -static void set_random_state(GrPipelineBuilder* pipelineBuilder, SkRandom* random) {
|
| - int state = 0;
|
| - for (int i = 1; i <= GrPipelineBuilder::kLast_Flag; i <<= 1) {
|
| - state |= random->nextBool() * i;
|
| - }
|
| -
|
| +static void set_random_state(GrPipelineBuilder* pipelineBuilder, SkRandom* random,
|
| + const GrCaps& caps) {
|
| + enum { kStateMask = GrPipelineBuilder::kLast_Flag | (GrPipelineBuilder::kLast_Flag - 1) };
|
| + int state = random->nextU() & kStateMask;
|
| // If we don't have an MSAA rendertarget then we have to disable useHWAA
|
| if ((state | GrPipelineBuilder::kHWAntialias_Flag) &&
|
| - !pipelineBuilder->getRenderTarget()->isUnifiedMultisampled()) {
|
| + !pipelineBuilder->getRenderTarget()->isStencilBufferMultisampled()) {
|
| state &= ~GrPipelineBuilder::kHWAntialias_Flag;
|
| }
|
| + // We can only use sample locations if they are supported and we have HWAA.
|
| + if (!caps.sampleLocationsSupport() || !(state & GrPipelineBuilder::kHWAntialias_Flag)) {
|
| + state &= ~GrPipelineBuilder::kSampleLocations_Flag;
|
| + }
|
| pipelineBuilder->enableState(state);
|
| }
|
|
|
| @@ -352,7 +354,7 @@ bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages) {
|
| GrProcessorTestData ptd(&random, context, context->caps(), rt, dummyTextures);
|
| set_random_color_coverage_stages(&pipelineBuilder, &ptd, maxStages);
|
| set_random_xpf(&pipelineBuilder, &ptd);
|
| - set_random_state(&pipelineBuilder, &random);
|
| + set_random_state(&pipelineBuilder, &random, *context->caps());
|
| set_random_stencil(&pipelineBuilder, &random);
|
|
|
| SkAutoTUnref<GrDrawContext> drawContext(context->drawContext(rt));
|
|
|