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