diff options
Diffstat (limited to 'tests/VkUploadPixelsTests.cpp')
-rw-r--r-- | tests/VkUploadPixelsTests.cpp | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/tests/VkUploadPixelsTests.cpp b/tests/VkUploadPixelsTests.cpp index f2d6af3af7..acadf7dc1d 100644 --- a/tests/VkUploadPixelsTests.cpp +++ b/tests/VkUploadPixelsTests.cpp @@ -13,9 +13,9 @@ #include "GrContextFactory.h" #include "GrContextPriv.h" -#include "GrProxyProvider.h" #include "GrSurfaceProxy.h" #include "GrTest.h" +#include "ProxyUtils.h" #include "SkGr.h" #include "Test.h" #include "vk/GrVkGpu.h" @@ -52,10 +52,8 @@ bool does_full_buffer_contain_correct_color(GrColor* srcBuffer, return true; } -void basic_texture_test(skiatest::Reporter* reporter, GrContext* context, GrPixelConfig config, +void basic_texture_test(skiatest::Reporter* reporter, GrContext* context, SkColorType ct, bool renderTarget) { - GrProxyProvider* proxyProvider = context->contextPriv().proxyProvider(); - const int kWidth = 16; const int kHeight = 16; SkAutoTMalloc<GrColor> srcBuffer(kWidth*kHeight); @@ -63,18 +61,8 @@ void basic_texture_test(skiatest::Reporter* reporter, GrContext* context, GrPixe fill_pixel_data(kWidth, kHeight, srcBuffer.get()); - GrSurfaceDesc surfDesc; - surfDesc.fFlags = renderTarget ? kRenderTarget_GrSurfaceFlag : kNone_GrSurfaceFlags; - surfDesc.fWidth = kWidth; - surfDesc.fHeight = kHeight; - surfDesc.fConfig = config; - surfDesc.fSampleCnt = 1; - - SkColorType ct; - SkAssertResult(GrPixelConfigToColorType(config, &ct)); - - sk_sp<GrTextureProxy> proxy = proxyProvider->createTextureProxy( - surfDesc, kTopLeft_GrSurfaceOrigin, SkBudgeted::kNo, srcBuffer, 0); + auto proxy = sk_gpu_test::MakeTextureProxyFromData(context, renderTarget, kWidth, kHeight, ct, + kTopLeft_GrSurfaceOrigin, srcBuffer, 0); REPORTER_ASSERT(reporter, proxy); if (proxy) { sk_sp<GrSurfaceContext> sContext = context->contextPriv().makeWrappedSurfaceContext(proxy); @@ -103,8 +91,8 @@ void basic_texture_test(skiatest::Reporter* reporter, GrContext* context, GrPixe 2)); } - proxy = proxyProvider->createTextureProxy(surfDesc, kBottomLeft_GrSurfaceOrigin, - SkBudgeted::kNo, srcBuffer, 0); + proxy = sk_gpu_test::MakeTextureProxyFromData(context, renderTarget, kWidth, kHeight, ct, + kBottomLeft_GrSurfaceOrigin, srcBuffer, 0); REPORTER_ASSERT(reporter, proxy); if (proxy) { sk_sp<GrSurfaceContext> sContext = context->contextPriv().makeWrappedSurfaceContext(proxy); @@ -137,12 +125,12 @@ void basic_texture_test(skiatest::Reporter* reporter, GrContext* context, GrPixe DEF_GPUTEST_FOR_VULKAN_CONTEXT(VkUploadPixelsTests, reporter, ctxInfo) { // RGBA - basic_texture_test(reporter, ctxInfo.grContext(), kRGBA_8888_GrPixelConfig, false); - basic_texture_test(reporter, ctxInfo.grContext(), kRGBA_8888_GrPixelConfig, true); + basic_texture_test(reporter, ctxInfo.grContext(), kRGBA_8888_SkColorType, false); + basic_texture_test(reporter, ctxInfo.grContext(), kRGBA_8888_SkColorType, true); // BGRA - basic_texture_test(reporter, ctxInfo.grContext(), kBGRA_8888_GrPixelConfig, false); - basic_texture_test(reporter, ctxInfo.grContext(), kBGRA_8888_GrPixelConfig, true); + basic_texture_test(reporter, ctxInfo.grContext(), kBGRA_8888_SkColorType, false); + basic_texture_test(reporter, ctxInfo.grContext(), kBGRA_8888_SkColorType, true); } #endif |