diff options
author | jvanverth <jvanverth@google.com> | 2015-07-13 07:19:57 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-07-13 07:19:57 -0700 |
commit | 672bb7fc6640e3fc68107354ed4ae45a2a1e2d29 (patch) | |
tree | bc9247fd24909a5dd3c38e2114ba1628126da130 /tests | |
parent | ab9cb427f45cdd51a5f8f6df9c19e955e555fc13 (diff) |
Remove GL-specific code from GMs and tests
TBR=bsalomon@google.com
Review URL: https://codereview.chromium.org/1232173002
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ResourceCacheTest.cpp | 33 | ||||
-rw-r--r-- | tests/SurfaceTest.cpp | 34 |
2 files changed, 15 insertions, 52 deletions
diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp index 07cd65518e..a870a084ec 100644 --- a/tests/ResourceCacheTest.cpp +++ b/tests/ResourceCacheTest.cpp @@ -12,7 +12,6 @@ #include "GrContext.h" #include "GrContextFactory.h" -#include "gl/GrGLInterface.h" #include "GrGpu.h" #include "GrGpuResourceCacheAccess.h" #include "GrGpuResourcePriv.h" @@ -25,8 +24,6 @@ #include "SkMessageBus.h" #include "SkSurface.h" #include "Test.h" -#include "../src/gpu/gl/GrGLDefines.h" -#include "../src/gpu/gl/GrGLUtil.h" static const int gWidth = 640; static const int gHeight = 480; @@ -178,26 +175,18 @@ static void test_stencil_buffers(skiatest::Reporter* reporter, GrContext* contex } static void test_wrapped_resources(skiatest::Reporter* reporter, GrContext* context) { - GrTestTarget tt; - context->getTestTarget(&tt); - - const GrGLInterface* gl = tt.glContext()->interface(); - if (!gl) { + const GrGpu* gpu = context->getGpu(); + if (!gpu) { return; } - GrGLuint texIDs[2]; + GrBackendObject texIDs[2]; static const int kW = 100; static const int kH = 100; - GR_GL_CALL(gl, GenTextures(2, texIDs)); - GR_GL_CALL(gl, ActiveTexture(GR_GL_TEXTURE0)); - GR_GL_CALL(gl, PixelStorei(GR_GL_UNPACK_ALIGNMENT, 1)); - GR_GL_CALL(gl, BindTexture(GR_GL_TEXTURE_2D, texIDs[0])); - GR_GL_CALL(gl, TexImage2D(GR_GL_TEXTURE_2D, 0, GR_GL_RGBA, kW, kH, 0, GR_GL_RGBA, - GR_GL_UNSIGNED_BYTE, NULL)); - GR_GL_CALL(gl, BindTexture(GR_GL_TEXTURE_2D, texIDs[1])); - GR_GL_CALL(gl, TexImage2D(GR_GL_TEXTURE_2D, 0, GR_GL_RGBA, kW, kH, 0, GR_GL_RGBA, - GR_GL_UNSIGNED_BYTE, NULL)); + + texIDs[0] = gpu->createBackendTexture(NULL, kW, kH, kRGBA_8888_GrPixelConfig); + texIDs[1] = gpu->createBackendTexture(NULL, kW, kH, kRGBA_8888_GrPixelConfig); + context->resetContext(); GrBackendTextureDesc desc; @@ -223,15 +212,13 @@ static void test_wrapped_resources(skiatest::Reporter* reporter, GrContext* cont context->flush(); - GrGLboolean borrowedIsAlive; - GrGLboolean adoptedIsAlive; - GR_GL_CALL_RET(gl, borrowedIsAlive, IsTexture(texIDs[0])); - GR_GL_CALL_RET(gl, adoptedIsAlive, IsTexture(texIDs[1])); + bool borrowedIsAlive = gpu->isBackendTexture(texIDs[0]); + bool adoptedIsAlive = gpu->isBackendTexture(texIDs[1]); REPORTER_ASSERT(reporter, borrowedIsAlive); REPORTER_ASSERT(reporter, !adoptedIsAlive); - GR_GL_CALL(gl, GenTextures(1, &texIDs[0])); + gpu->deleteBackendTexture(texIDs[0]); context->resetContext(); } diff --git a/tests/SurfaceTest.cpp b/tests/SurfaceTest.cpp index 57ad5e0ca8..7e1b3c90c5 100644 --- a/tests/SurfaceTest.cpp +++ b/tests/SurfaceTest.cpp @@ -18,8 +18,6 @@ #if SK_SUPPORT_GPU #include "GrContextFactory.h" #include "GrTest.h" -#include "gl/GrGLInterface.h" -#include "gl/GrGLUtil.h" #else class GrContextFactory; class GrContext; @@ -107,42 +105,20 @@ static void test_wrapped_texture_surface(skiatest::Reporter* reporter, GrContext return; } - GrTestTarget tt; - ctx->getTestTarget(&tt); - if (!tt.target()) { - SkDEBUGFAIL("Couldn't get Gr test target."); + const GrGpu* gpu = ctx->getGpu(); + if (!gpu) { return; } - // We currently have only implemented the texture uploads for GL. - const GrGLInterface* gl = tt.glContext()->interface(); - if (!gl) { - return; - } - - // Test the wrapped factory for SkSurface by creating a texture using GL and then wrap it in + // Test the wrapped factory for SkSurface by creating a backend texture and then wrap it in // a SkSurface. - GrGLuint texID; static const int kW = 100; static const int kH = 100; static const uint32_t kOrigColor = 0xFFAABBCC; SkAutoTArray<uint32_t> pixels(kW * kH); sk_memset32(pixels.get(), kOrigColor, kW * kH); - GR_GL_CALL(gl, GenTextures(1, &texID)); - GR_GL_CALL(gl, ActiveTexture(GR_GL_TEXTURE0)); - GR_GL_CALL(gl, PixelStorei(GR_GL_UNPACK_ALIGNMENT, 1)); - GR_GL_CALL(gl, BindTexture(GR_GL_TEXTURE_2D, texID)); - GR_GL_CALL(gl, TexParameteri(GR_GL_TEXTURE_2D, GR_GL_TEXTURE_MAG_FILTER, - GR_GL_NEAREST)); - GR_GL_CALL(gl, TexParameteri(GR_GL_TEXTURE_2D, GR_GL_TEXTURE_MIN_FILTER, - GR_GL_NEAREST)); - GR_GL_CALL(gl, TexParameteri(GR_GL_TEXTURE_2D, GR_GL_TEXTURE_WRAP_S, - GR_GL_CLAMP_TO_EDGE)); - GR_GL_CALL(gl, TexParameteri(GR_GL_TEXTURE_2D, GR_GL_TEXTURE_WRAP_T, - GR_GL_CLAMP_TO_EDGE)); - GR_GL_CALL(gl, TexImage2D(GR_GL_TEXTURE_2D, 0, GR_GL_RGBA, kW, kH, 0, GR_GL_RGBA, - GR_GL_UNSIGNED_BYTE, - pixels.get())); + GrBackendObject texID = gpu->createBackendTexture(pixels.get(), kW, kH, + kRGBA_8888_GrPixelConfig); GrBackendTextureDesc wrappedDesc; wrappedDesc.fConfig = kRGBA_8888_GrPixelConfig; |