OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "Test.h" | 8 #include "Test.h" |
9 #if SK_SUPPORT_GPU | 9 #if SK_SUPPORT_GPU |
10 #include "GrContext.h" | 10 #include "GrContext.h" |
11 #include "GrContextFactory.h" | 11 #include "GrContextFactory.h" |
12 #include "gl/GrGLGpu.h" | 12 #include "gl/GrGLGpu.h" |
13 #include "gl/GrGLUtil.h" | 13 #include "gl/GrGLUtil.h" |
14 #include "gl/GLContext.h" | 14 #include "gl/SkGLContext.h" |
15 | 15 |
16 using sk_gpu_test::GLContext; | 16 static void cleanup(SkGLContext* glctx0, GrGLuint texID0, SkGLContext* glctx1, G
rContext* grctx1, |
17 | |
18 static void cleanup(GLContext* glctx0, GrGLuint texID0, GLContext* glctx1, GrCon
text* grctx1, | |
19 const GrGLTextureInfo* grbackendtex1, GrEGLImage image1) { | 17 const GrGLTextureInfo* grbackendtex1, GrEGLImage image1) { |
20 if (glctx1) { | 18 if (glctx1) { |
21 glctx1->makeCurrent(); | 19 glctx1->makeCurrent(); |
22 if (grctx1) { | 20 if (grctx1) { |
23 if (grbackendtex1) { | 21 if (grbackendtex1) { |
24 GrGLGpu* gpu1 = static_cast<GrGLGpu*>(grctx1->getGpu()); | 22 GrGLGpu* gpu1 = static_cast<GrGLGpu*>(grctx1->getGpu()); |
25 GrBackendObject handle = reinterpret_cast<GrBackendObject>(grbac
kendtex1); | 23 GrBackendObject handle = reinterpret_cast<GrBackendObject>(grbac
kendtex1); |
26 gpu1->deleteTestingOnlyBackendTexture(handle, false); | 24 gpu1->deleteTestingOnlyBackendTexture(handle, false); |
27 } | 25 } |
28 grctx1->unref(); | 26 grctx1->unref(); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 // extensions to run this test. | 84 // extensions to run this test. |
87 | 85 |
88 if (kGLES_GrGLStandard != glCtx0->gl()->fStandard) { | 86 if (kGLES_GrGLStandard != glCtx0->gl()->fStandard) { |
89 return; | 87 return; |
90 } | 88 } |
91 GrGLGpu* gpu0 = static_cast<GrGLGpu*>(context0->getGpu()); | 89 GrGLGpu* gpu0 = static_cast<GrGLGpu*>(context0->getGpu()); |
92 if (!gpu0->glCaps().glslCaps()->externalTextureSupport()) { | 90 if (!gpu0->glCaps().glslCaps()->externalTextureSupport()) { |
93 return; | 91 return; |
94 } | 92 } |
95 | 93 |
96 SkAutoTDelete<GLContext> glCtx1 = glCtx0->createNew(); | 94 SkAutoTDelete<SkGLContext> glCtx1 = glCtx0->createNew(); |
97 if (!glCtx1) { | 95 if (!glCtx1) { |
98 return; | 96 return; |
99 } | 97 } |
100 GrContext* context1 = GrContext::Create(kOpenGL_GrBackend, (GrBackendContext
)glCtx1->gl()); | 98 GrContext* context1 = GrContext::Create(kOpenGL_GrBackend, (GrBackendContext
)glCtx1->gl()); |
101 const GrGLTextureInfo* backendTexture1 = nullptr; | 99 const GrGLTextureInfo* backendTexture1 = nullptr; |
102 GrEGLImage image = GR_EGL_NO_IMAGE; | 100 GrEGLImage image = GR_EGL_NO_IMAGE; |
103 GrGLTextureInfo externalTexture; | 101 GrGLTextureInfo externalTexture; |
104 externalTexture.fID = 0; | 102 externalTexture.fID = 0; |
105 | 103 |
106 if (!context1) { | 104 if (!context1) { |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 test_read_pixels(reporter, context0, externalTextureObj, pixels.get()); | 197 test_read_pixels(reporter, context0, externalTextureObj, pixels.get()); |
200 | 198 |
201 test_write_pixels(reporter, context0, externalTextureObj); | 199 test_write_pixels(reporter, context0, externalTextureObj); |
202 | 200 |
203 test_copy_surface(reporter, context0, externalTextureObj, pixels.get()); | 201 test_copy_surface(reporter, context0, externalTextureObj, pixels.get()); |
204 | 202 |
205 cleanup(glCtx0, externalTexture.fID, glCtx1, context1, backendTexture1, imag
e); | 203 cleanup(glCtx0, externalTexture.fID, glCtx1, context1, backendTexture1, imag
e); |
206 } | 204 } |
207 | 205 |
208 #endif | 206 #endif |
OLD | NEW |