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