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