blob: 50bdedff9ec7d8d7c1743ffd764797b45635e70d [file] [log] [blame]
keyar@chromium.org5bdef292012-08-14 22:02:48 +00001/*
2 * Copyright 2011 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
halcanary96fcdcc2015-08-27 07:41:13 -07008#include "SkTypes.h"
9
keyar@chromium.org5bdef292012-08-14 22:02:48 +000010#if SK_SUPPORT_GPU
keyar@chromium.org5bdef292012-08-14 22:02:48 +000011
tfarina@chromium.org4ee16bf2014-01-10 22:08:27 +000012#include "GrContextFactory.h"
kkinnunena18a8bc2015-12-03 23:04:50 -080013#include "GrCaps.h"
tfarina@chromium.org4ee16bf2014-01-10 22:08:27 +000014#include "Test.h"
tfarina@chromium.org4ee16bf2014-01-10 22:08:27 +000015
kkinnunen5219fd92015-12-10 06:28:13 -080016DEF_GPUTEST(GrContextFactory_NVPRContextOptionHasPathRenderingSupport, reporter, /*factory*/) {
kkinnunena18a8bc2015-12-03 23:04:50 -080017 // Test that if NVPR is requested, the context always has path rendering
18 // or the context creation fails.
19 GrContextFactory testFactory;
reed4ff653c2015-12-14 05:58:25 -080020 GrContext* context = testFactory.get(GrContextFactory::kNative_GLContextType,
21 kNone_GrGLStandard,
22 GrContextFactory::kEnableNVPR_GLContextOptions);
23 if (context) {
kkinnunena18a8bc2015-12-03 23:04:50 -080024 REPORTER_ASSERT(
25 reporter,
26 context->caps()->shaderCaps()->pathRenderingSupport());
27 }
28}
29
30DEF_GPUTEST(GrContextFactory_NoPathRenderingUnlessNVPRRequested, reporter, /*factory*/) {
31 // Test that if NVPR is not requested, the context never has path rendering support.
32
33 GrContextFactory testFactory;
34 for (int i = 0; i <= GrContextFactory::kLastGLContextType; ++i) {
35 GrContextFactory::GLContextType glCtxType = (GrContextFactory::GLContextType)i;
kkinnunena18a8bc2015-12-03 23:04:50 -080036 GrContext* context = testFactory.get(glCtxType);
37 if (context) {
38 REPORTER_ASSERT(
39 reporter,
40 !context->caps()->shaderCaps()->pathRenderingSupport());
41 }
42 }
43}
keyar@chromium.org5bdef292012-08-14 22:02:48 +000044
keyar@chromium.org5bdef292012-08-14 22:02:48 +000045#endif