| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "SkTypes.h" | 8 #include "SkTypes.h" |
| 9 | 9 |
| 10 #if SK_SUPPORT_GPU | 10 #if SK_SUPPORT_GPU |
| 11 | 11 |
| 12 #include "GrContextFactory.h" | 12 #include "GrContextFactory.h" |
| 13 #include "GrCaps.h" | 13 #include "GrCaps.h" |
| 14 #include "Test.h" | 14 #include "Test.h" |
| 15 | 15 |
| 16 DEF_GPUTEST(GrContextFactory_NVPRContextOptionHasPathRenderingSupport, reporter,
/*factory*/) { | 16 DEF_GPUTEST(GrContextFactory_NVPRContextOptionHasPathRenderingSupport, reporter,
/*factory*/) { |
| 17 // Test that if NVPR is requested, the context always has path rendering | 17 // Test that if NVPR is requested, the context always has path rendering |
| 18 // or the context creation fails. | 18 // or the context creation fails. |
| 19 GrContextFactory testFactory; | 19 GrContextFactory testFactory; |
| 20 GrContext* context = testFactory.get(GrContextFactory::kNative_GLContextType
, | 20 // Test that if NVPR is possible, caps are in sync. |
| 21 kNone_GrGLStandard, | 21 for (int i = 0; i < GrContextFactory::kGLContextTypeCnt; ++i) { |
| 22 GrContextFactory::kEnableNVPR_GLContext
Options); | 22 GrContextFactory::GLContextType glCtxType = static_cast<GrContextFactory
::GLContextType>(i); |
| 23 if (context) { | 23 GrContext* context = testFactory.get(glCtxType, |
| 24 GrContextFactory::kEnableNVPR_GLCon
textOptions); |
| 25 if (!context) { |
| 26 continue; |
| 27 } |
| 24 REPORTER_ASSERT( | 28 REPORTER_ASSERT( |
| 25 reporter, | 29 reporter, |
| 26 context->caps()->shaderCaps()->pathRenderingSupport()); | 30 context->caps()->shaderCaps()->pathRenderingSupport()); |
| 27 } | 31 } |
| 28 } | 32 } |
| 29 | 33 |
| 30 DEF_GPUTEST(GrContextFactory_NoPathRenderingUnlessNVPRRequested, reporter, /*fac
tory*/) { | 34 DEF_GPUTEST(GrContextFactory_NoPathRenderingUnlessNVPRRequested, reporter, /*fac
tory*/) { |
| 31 // Test that if NVPR is not requested, the context never has path rendering
support. | 35 // Test that if NVPR is not requested, the context never has path rendering
support. |
| 32 | 36 |
| 33 GrContextFactory testFactory; | 37 GrContextFactory testFactory; |
| 34 for (int i = 0; i <= GrContextFactory::kLastGLContextType; ++i) { | 38 for (int i = 0; i <= GrContextFactory::kLastGLContextType; ++i) { |
| 35 GrContextFactory::GLContextType glCtxType = (GrContextFactory::GLContext
Type)i; | 39 GrContextFactory::GLContextType glCtxType = (GrContextFactory::GLContext
Type)i; |
| 36 GrContext* context = testFactory.get(glCtxType); | 40 GrContext* context = testFactory.get(glCtxType); |
| 37 if (context) { | 41 if (context) { |
| 38 REPORTER_ASSERT( | 42 REPORTER_ASSERT( |
| 39 reporter, | 43 reporter, |
| 40 !context->caps()->shaderCaps()->pathRenderingSupport()); | 44 !context->caps()->shaderCaps()->pathRenderingSupport()); |
| 41 } | 45 } |
| 42 } | 46 } |
| 43 } | 47 } |
| 44 | 48 |
| 45 #endif | 49 #endif |
| OLD | NEW |