keyar@chromium.org | 5bdef29 | 2012-08-14 22:02:48 +0000 | [diff] [blame] | 1 | /* |
| 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 | |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 8 | #include "SkTypes.h" |
| 9 | |
keyar@chromium.org | 5bdef29 | 2012-08-14 22:02:48 +0000 | [diff] [blame] | 10 | #if SK_SUPPORT_GPU |
keyar@chromium.org | 5bdef29 | 2012-08-14 22:02:48 +0000 | [diff] [blame] | 11 | |
tfarina@chromium.org | 4ee16bf | 2014-01-10 22:08:27 +0000 | [diff] [blame] | 12 | #include "GrContextFactory.h" |
kkinnunen | a18a8bc | 2015-12-03 23:04:50 -0800 | [diff] [blame] | 13 | #include "GrCaps.h" |
tfarina@chromium.org | 4ee16bf | 2014-01-10 22:08:27 +0000 | [diff] [blame] | 14 | #include "Test.h" |
tfarina@chromium.org | 4ee16bf | 2014-01-10 22:08:27 +0000 | [diff] [blame] | 15 | |
kkinnunen | 5219fd9 | 2015-12-10 06:28:13 -0800 | [diff] [blame] | 16 | DEF_GPUTEST(GrContextFactory_NVPRContextOptionHasPathRenderingSupport, reporter, /*factory*/) { |
kkinnunen | a18a8bc | 2015-12-03 23:04:50 -0800 | [diff] [blame] | 17 | // Test that if NVPR is requested, the context always has path rendering |
| 18 | // or the context creation fails. |
| 19 | GrContextFactory testFactory; |
reed | 4ff653c | 2015-12-14 05:58:25 -0800 | [diff] [blame^] | 20 | GrContext* context = testFactory.get(GrContextFactory::kNative_GLContextType, |
| 21 | kNone_GrGLStandard, |
| 22 | GrContextFactory::kEnableNVPR_GLContextOptions); |
| 23 | if (context) { |
kkinnunen | a18a8bc | 2015-12-03 23:04:50 -0800 | [diff] [blame] | 24 | REPORTER_ASSERT( |
| 25 | reporter, |
| 26 | context->caps()->shaderCaps()->pathRenderingSupport()); |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | DEF_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; |
kkinnunen | a18a8bc | 2015-12-03 23:04:50 -0800 | [diff] [blame] | 36 | GrContext* context = testFactory.get(glCtxType); |
| 37 | if (context) { |
| 38 | REPORTER_ASSERT( |
| 39 | reporter, |
| 40 | !context->caps()->shaderCaps()->pathRenderingSupport()); |
| 41 | } |
| 42 | } |
| 43 | } |
keyar@chromium.org | 5bdef29 | 2012-08-14 22:02:48 +0000 | [diff] [blame] | 44 | |
keyar@chromium.org | 5bdef29 | 2012-08-14 22:02:48 +0000 | [diff] [blame] | 45 | #endif |