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" |
(...skipping 10 matching lines...) Expand all Loading... |
21 if (grbackendtex1) { | 21 if (grbackendtex1) { |
22 GrGLGpu* gpu1 = static_cast<GrGLGpu*>(grctx1->getGpu()); | 22 GrGLGpu* gpu1 = static_cast<GrGLGpu*>(grctx1->getGpu()); |
23 GrBackendObject handle = reinterpret_cast<GrBackendObject>(grbac
kendtex1); | 23 GrBackendObject handle = reinterpret_cast<GrBackendObject>(grbac
kendtex1); |
24 gpu1->deleteTestingOnlyBackendTexture(handle, false); | 24 gpu1->deleteTestingOnlyBackendTexture(handle, false); |
25 } | 25 } |
26 grctx1->unref(); | 26 grctx1->unref(); |
27 } | 27 } |
28 if (GR_EGL_NO_IMAGE != image1) { | 28 if (GR_EGL_NO_IMAGE != image1) { |
29 glctx1->destroyEGLImage(image1); | 29 glctx1->destroyEGLImage(image1); |
30 } | 30 } |
31 glctx1->unref(); | |
32 } | 31 } |
33 | 32 |
34 glctx0->makeCurrent(); | 33 glctx0->makeCurrent(); |
35 if (texID0) { | 34 if (texID0) { |
36 GR_GL_CALL(glctx0->gl(), DeleteTextures(1, &texID0)); | 35 GR_GL_CALL(glctx0->gl(), DeleteTextures(1, &texID0)); |
37 } | 36 } |
38 } | 37 } |
39 | 38 |
40 static void test_read_pixels(skiatest::Reporter* reporter, GrContext* context, | 39 static void test_read_pixels(skiatest::Reporter* reporter, GrContext* context, |
41 GrTexture* externalTexture, uint32_t expectedPixelV
alues[]) { | 40 GrTexture* externalTexture, uint32_t expectedPixelV
alues[]) { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 // extensions to run this test. | 83 // extensions to run this test. |
85 | 84 |
86 if (kGLES_GrGLStandard != glCtx0->gl()->fStandard) { | 85 if (kGLES_GrGLStandard != glCtx0->gl()->fStandard) { |
87 return; | 86 return; |
88 } | 87 } |
89 GrGLGpu* gpu0 = static_cast<GrGLGpu*>(context0->getGpu()); | 88 GrGLGpu* gpu0 = static_cast<GrGLGpu*>(context0->getGpu()); |
90 if (!gpu0->glCaps().externalTextureSupport()) { | 89 if (!gpu0->glCaps().externalTextureSupport()) { |
91 return; | 90 return; |
92 } | 91 } |
93 | 92 |
94 SkGLContext* glCtx1 = glCtx0->createNew(); | 93 SkAutoTDelete<SkGLContext> glCtx1 = glCtx0->createNew(); |
95 if (!glCtx1) { | 94 if (!glCtx1) { |
96 return; | 95 return; |
97 } | 96 } |
98 GrContext* context1 = GrContext::Create(kOpenGL_GrBackend, (GrBackendContext
)glCtx1->gl()); | 97 GrContext* context1 = GrContext::Create(kOpenGL_GrBackend, (GrBackendContext
)glCtx1->gl()); |
99 const GrGLTextureInfo* backendTexture1 = nullptr; | 98 const GrGLTextureInfo* backendTexture1 = nullptr; |
100 GrEGLImage image = GR_EGL_NO_IMAGE; | 99 GrEGLImage image = GR_EGL_NO_IMAGE; |
101 GrGLTextureInfo externalTexture; | 100 GrGLTextureInfo externalTexture; |
102 externalTexture.fID = 0; | 101 externalTexture.fID = 0; |
103 | 102 |
104 if (!context1) { | 103 if (!context1) { |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 test_read_pixels(reporter, context0, externalTextureObj, pixels.get()); | 196 test_read_pixels(reporter, context0, externalTextureObj, pixels.get()); |
198 | 197 |
199 test_write_pixels(reporter, context0, externalTextureObj); | 198 test_write_pixels(reporter, context0, externalTextureObj); |
200 | 199 |
201 test_copy_surface(reporter, context0, externalTextureObj, pixels.get()); | 200 test_copy_surface(reporter, context0, externalTextureObj, pixels.get()); |
202 | 201 |
203 cleanup(glCtx0, externalTexture.fID, glCtx1, context1, backendTexture1, imag
e); | 202 cleanup(glCtx0, externalTexture.fID, glCtx1, context1, backendTexture1, imag
e); |
204 } | 203 } |
205 | 204 |
206 #endif | 205 #endif |
OLD | NEW |