OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 #if SK_SUPPORT_GPU | 9 #if SK_SUPPORT_GPU |
10 #include "GrContextFactory.h" | 10 #include "GrContextFactory.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 void rasterToGpu(skiatest::Reporter* reporter, GrContext* context) { | 85 void rasterToGpu(skiatest::Reporter* reporter, GrContext* context) { |
86 SkImageInfo info = SkImageInfo::MakeN32Premul(5, 5); | 86 SkImageInfo info = SkImageInfo::MakeN32Premul(5, 5); |
87 | 87 |
88 SkAutoTUnref<SkSurface> srcSurface(SkSurface::NewRaster(info)); | 88 SkAutoTUnref<SkSurface> srcSurface(SkSurface::NewRaster(info)); |
89 SkAutoTUnref<SkSurface> dstSurface(SkSurface::NewRenderTarget(context, info)
); | 89 SkAutoTUnref<SkSurface> dstSurface(SkSurface::NewRenderTarget(context, info)
); |
90 | 90 |
91 runShaderTest(reporter, srcSurface.get(), dstSurface.get(), info); | 91 runShaderTest(reporter, srcSurface.get(), dstSurface.get(), info); |
92 } | 92 } |
93 | 93 |
94 DEF_GPUTEST(ImageNewShader_GPU, reporter, factory) { | 94 DEF_GPUTEST(ImageNewShader_GPU, reporter, factory) { |
95 GrContext* context = factory->get(GrContextFactory::kNative_GLContextType); | 95 for (int i= 0; i < GrContextFactory::kGLContextTypeCnt; ++i) { |
| 96 GrContextFactory::GLContextType glCtxType = (GrContextFactory::GLContext
Type) i; |
96 | 97 |
97 // GPU -> GPU | 98 if (!GrContextFactory::IsRenderingGLContext(glCtxType)) { |
98 gpuToGpu(reporter, context); | 99 continue; |
| 100 } |
99 | 101 |
100 // GPU -> RASTER | 102 GrContext* context = factory->get(glCtxType); |
101 gpuToRaster(reporter, context); | 103 |
| 104 if (NULL == context) { |
| 105 continue; |
| 106 } |
| 107 |
| 108 // GPU -> GPU |
| 109 gpuToGpu(reporter, context); |
| 110 |
| 111 // GPU -> RASTER |
| 112 gpuToRaster(reporter, context); |
102 | 113 |
103 | 114 |
104 // RASTER -> GPU | 115 // RASTER -> GPU |
105 rasterToGpu(reporter, context); | 116 rasterToGpu(reporter, context); |
| 117 } |
106 } | 118 } |
107 | 119 |
108 #endif | 120 #endif |
OLD | NEW |