diff options
author | bsalomon <bsalomon@google.com> | 2016-04-11 14:21:33 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-04-11 14:21:33 -0700 |
commit | dc0fcd41e75682a8bfd5e285d684461475226330 (patch) | |
tree | a88c9ae58427a3d3afbd3bfb9705db49cb9fa298 /tests | |
parent | 849b175c029bcb5d4abb7fdadc45e8ed36f29a78 (diff) |
Vulkan config in dm
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1872283003
Review URL: https://codereview.chromium.org/1872283003
Diffstat (limited to 'tests')
-rw-r--r-- | tests/GrContextFactoryTest.cpp | 8 | ||||
-rw-r--r-- | tests/Test.h | 3 | ||||
-rw-r--r-- | tests/TestConfigParsing.cpp | 15 | ||||
-rw-r--r-- | tests/VkClearTests.cpp | 27 | ||||
-rw-r--r-- | tests/VkUploadPixelsTests.cpp | 31 | ||||
-rwxr-xr-x | tests/VkWrapTests.cpp | 21 |
6 files changed, 42 insertions, 63 deletions
diff --git a/tests/GrContextFactoryTest.cpp b/tests/GrContextFactoryTest.cpp index 395fa6a37f..fe4f1ef82f 100644 --- a/tests/GrContextFactoryTest.cpp +++ b/tests/GrContextFactoryTest.cpp @@ -78,7 +78,9 @@ DEF_GPUTEST(GrContextFactory_abandon, reporter, /*factory*/) { if (!info1.fGrContext) { continue; } - REPORTER_ASSERT(reporter, info1.fGLContext); + if (GrContextFactory::ContextTypeBackend(ctxType) == kOpenGL_GrBackend) { + REPORTER_ASSERT(reporter, info1.fGLContext); + } // Ref for comparison. The API does not explicitly say that this stays alive. info1.fGrContext->ref(); testFactory.abandonContexts(); @@ -86,7 +88,9 @@ DEF_GPUTEST(GrContextFactory_abandon, reporter, /*factory*/) { // Test that we get different context after abandon. ContextInfo info2 = testFactory.getContextInfo(ctxType); REPORTER_ASSERT(reporter, info2.fGrContext); - REPORTER_ASSERT(reporter, info2.fGLContext); + if (GrContextFactory::ContextTypeBackend(ctxType) == kOpenGL_GrBackend) { + REPORTER_ASSERT(reporter, info2.fGLContext); + } REPORTER_ASSERT(reporter, info1.fGrContext != info2.fGrContext); // fGLContext should also change, but it also could get the same address. diff --git a/tests/Test.h b/tests/Test.h index ac68cccf95..b2cb180353 100644 --- a/tests/Test.h +++ b/tests/Test.h @@ -88,6 +88,7 @@ typedef void GrContextTestFn(Reporter*, const sk_gpu_test::ContextInfo&); typedef bool GrContextTypeFilterFn(GrContextFactoryContextType); extern bool IsGLContextType(GrContextFactoryContextType); +extern bool IsVulkanContextType(GrContextFactoryContextType); extern bool IsRenderingGLContextType(GrContextFactoryContextType); extern bool IsNullGLContextType(GrContextFactoryContextType); @@ -173,6 +174,8 @@ private: DEF_GPUTEST_FOR_CONTEXTS(name, &skiatest::IsRenderingGLContextType, reporter, context_info) #define DEF_GPUTEST_FOR_NULLGL_CONTEXT(name, reporter, context_info) \ DEF_GPUTEST_FOR_CONTEXTS(name, &skiatest::IsNullGLContextType, reporter, context_info) +#define DEF_GPUTEST_FOR_VULKAN_CONTEXT(name, reporter, context_info) \ + DEF_GPUTEST_FOR_CONTEXTS(name, &skiatest::IsVulkanContextType, reporter, context_info) #define REQUIRE_PDF_DOCUMENT(TEST_NAME, REPORTER) \ do { \ diff --git a/tests/TestConfigParsing.cpp b/tests/TestConfigParsing.cpp index ac7037f9d2..4d64cafb16 100644 --- a/tests/TestConfigParsing.cpp +++ b/tests/TestConfigParsing.cpp @@ -77,7 +77,7 @@ DEF_TEST(ParseConfigs_DefaultConfigs, reporter) { "565", "8888", "debug", "gpu", "gpudebug", "gpudft", "gpunull", "msaa16", "msaa4", "nonrendering", "null", "nullgpu", "nvpr16", "nvpr4", "nvprdit16", "nvprdit4", "pdf", "skp", "svg", "xps", "angle", "angle-gl", "commandbuffer", "mesa", "hwui", - "gpuf16", "gpusrgb", "gl", "glnvpr4", "glnvprdit4", "glsrgb", "glmsaa4" + "gpuf16", "gpusrgb", "gl", "glnvpr4", "glnvprdit4", "glsrgb", "glmsaa4", "vk" }); SkCommandLineConfigArray configs; @@ -161,6 +161,9 @@ DEF_TEST(ParseConfigs_DefaultConfigs, reporter) { kSRGB_SkColorProfileType); REPORTER_ASSERT(reporter, configs[31]->asConfigGpu()); REPORTER_ASSERT(reporter, configs[31]->asConfigGpu()->getSamples() == 4); +#ifdef SK_VULKAN + REPORTER_ASSERT(reporter, configs[32]->asConfigGpu()); +#endif #endif } @@ -173,7 +176,8 @@ DEF_TEST(ParseConfigs_ExtendedGpuConfigsCorrect, reporter) { "gpu(dit=true,api=commandbuffer)", "gpu()", "gpu(api=gles)", - "gpu(api=gl)" + "gpu(api=gl)", + "gpu(api=vulkan)", }); SkCommandLineConfigArray configs; @@ -229,6 +233,13 @@ DEF_TEST(ParseConfigs_ExtendedGpuConfigsCorrect, reporter) { REPORTER_ASSERT(reporter, !configs[7]->asConfigGpu()->getUseNVPR()); REPORTER_ASSERT(reporter, !configs[7]->asConfigGpu()->getUseDIText()); REPORTER_ASSERT(reporter, configs[7]->asConfigGpu()->getSamples() == 0); +#ifdef SK_VULKAN + REPORTER_ASSERT(reporter, configs[8]->asConfigGpu()->getContextType() == + GrContextFactory::kVulkan_ContextType); + REPORTER_ASSERT(reporter, !configs[7]->asConfigGpu()->getUseNVPR()); + REPORTER_ASSERT(reporter, !configs[7]->asConfigGpu()->getUseDIText()); + REPORTER_ASSERT(reporter, configs[7]->asConfigGpu()->getSamples() == 0); +#endif #endif } diff --git a/tests/VkClearTests.cpp b/tests/VkClearTests.cpp index 5b8a30bc1b..1f8e4970a7 100644 --- a/tests/VkClearTests.cpp +++ b/tests/VkClearTests.cpp @@ -59,7 +59,7 @@ void basic_clear_test(skiatest::Reporter* reporter, GrContext* context, GrPixelC surfDesc.fHeight = 5; surfDesc.fConfig = config; surfDesc.fSampleCnt = 0; - GrTexture* tex = gpu->createTexture(surfDesc, SkBudgeted::kNo, nullptr, 0); + GrTexture* tex = gpu->createTexture(surfDesc, SkBudgeted::kNo); SkASSERT(tex); SkASSERT(tex->asRenderTarget()); SkIRect rect = SkIRect::MakeWH(5, 5); @@ -114,7 +114,7 @@ void sub_clear_test(skiatest::Reporter* reporter, GrContext* context, GrPixelCon surfDesc.fHeight = height; surfDesc.fConfig = config; surfDesc.fSampleCnt = 0; - GrTexture* tex = gpu->createTexture(surfDesc, SkBudgeted::kNo, nullptr, 0); + GrTexture* tex = gpu->createTexture(surfDesc, SkBudgeted::kNo); SkASSERT(tex); SkASSERT(tex->asRenderTarget()); @@ -196,24 +196,11 @@ void sub_clear_test(skiatest::Reporter* reporter, GrContext* context, GrPixelCon subHeight)); } -DEF_GPUTEST(VkClearTests, reporter, factory) { - GrContextOptions opts; - opts.fSuppressPrints = true; - GrContextFactory debugFactory(opts); - for (int type = 0; type < GrContextFactory::kContextTypeCnt; ++type) { - if (static_cast<GrContextFactory::ContextType>(type) != - GrContextFactory::kNativeGL_ContextType) { - continue; - } - GrContext* context = debugFactory.get(static_cast<GrContextFactory::ContextType>(type)); - if (context) { - basic_clear_test(reporter, context, kRGBA_8888_GrPixelConfig); - basic_clear_test(reporter, context, kBGRA_8888_GrPixelConfig); - sub_clear_test(reporter, context, kRGBA_8888_GrPixelConfig); - sub_clear_test(reporter, context, kBGRA_8888_GrPixelConfig); - } - - } +DEF_GPUTEST_FOR_VULKAN_CONTEXT(VkClearTests, reporter, ctxInfo) { + basic_clear_test(reporter, ctxInfo.fGrContext, kRGBA_8888_GrPixelConfig); + basic_clear_test(reporter, ctxInfo.fGrContext, kBGRA_8888_GrPixelConfig); + sub_clear_test(reporter, ctxInfo.fGrContext, kRGBA_8888_GrPixelConfig); + sub_clear_test(reporter, ctxInfo.fGrContext, kBGRA_8888_GrPixelConfig); } #endif diff --git a/tests/VkUploadPixelsTests.cpp b/tests/VkUploadPixelsTests.cpp index e5f72dd635..d4604e8b1b 100644 --- a/tests/VkUploadPixelsTests.cpp +++ b/tests/VkUploadPixelsTests.cpp @@ -133,28 +133,15 @@ void basic_texture_test(skiatest::Reporter* reporter, GrContext* context, GrPixe } } -DEF_GPUTEST(VkUploadPixelsTests, reporter, factory) { - GrContextOptions opts; - opts.fSuppressPrints = true; - GrContextFactory debugFactory(opts); - for (int type = 0; type < GrContextFactory::kContextTypeCnt; ++type) { - if (static_cast<GrContextFactory::ContextType>(type) != - GrContextFactory::kNativeGL_ContextType) { - continue; - } - GrContext* context = debugFactory.get(static_cast<GrContextFactory::ContextType>(type)); - if (context) { - basic_texture_test(reporter, context, kRGBA_8888_GrPixelConfig, false, false); - basic_texture_test(reporter, context, kRGBA_8888_GrPixelConfig, true, false); - basic_texture_test(reporter, context, kRGBA_8888_GrPixelConfig, false, true); - basic_texture_test(reporter, context, kRGBA_8888_GrPixelConfig, true, true); - basic_texture_test(reporter, context, kBGRA_8888_GrPixelConfig, false, false); - basic_texture_test(reporter, context, kBGRA_8888_GrPixelConfig, true, false); - basic_texture_test(reporter, context, kBGRA_8888_GrPixelConfig, false, true); - basic_texture_test(reporter, context, kBGRA_8888_GrPixelConfig, true, true); - } - - } +DEF_GPUTEST_FOR_VULKAN_CONTEXT(VkUploadPixelsTests, reporter, ctxInfo) { + basic_texture_test(reporter, ctxInfo.fGrContext, kRGBA_8888_GrPixelConfig, false, false); + basic_texture_test(reporter, ctxInfo.fGrContext, kRGBA_8888_GrPixelConfig, true, false); + basic_texture_test(reporter, ctxInfo.fGrContext, kRGBA_8888_GrPixelConfig, false, true); + basic_texture_test(reporter, ctxInfo.fGrContext, kRGBA_8888_GrPixelConfig, true, true); + basic_texture_test(reporter, ctxInfo.fGrContext, kBGRA_8888_GrPixelConfig, false, false); + basic_texture_test(reporter, ctxInfo.fGrContext, kBGRA_8888_GrPixelConfig, true, false); + basic_texture_test(reporter, ctxInfo.fGrContext, kBGRA_8888_GrPixelConfig, false, true); + basic_texture_test(reporter, ctxInfo.fGrContext, kBGRA_8888_GrPixelConfig, true, true); } #endif diff --git a/tests/VkWrapTests.cpp b/tests/VkWrapTests.cpp index a4fec0876d..626ee4c4b1 100755 --- a/tests/VkWrapTests.cpp +++ b/tests/VkWrapTests.cpp @@ -158,23 +158,10 @@ void wrap_trt_test(skiatest::Reporter* reporter, GrContext* context) { gpu->deleteTestingOnlyBackendTexture(backendObj, true); } -DEF_GPUTEST(VkWrapTests, reporter, factory) { - GrContextOptions opts; - opts.fSuppressPrints = true; - GrContextFactory debugFactory(opts); - for (int type = 0; type < GrContextFactory::kLastContextType; ++type) { - if (static_cast<GrContextFactory::ContextType>(type) != - GrContextFactory::kNativeGL_ContextType) { - continue; - } - GrContext* context = debugFactory.get(static_cast<GrContextFactory::ContextType>(type)); - if (context) { - wrap_tex_test(reporter, context); - wrap_rt_test(reporter, context); - wrap_trt_test(reporter, context); - } - - } +DEF_GPUTEST_FOR_VULKAN_CONTEXT(VkWrapTests, reporter, ctxInfo) { + wrap_tex_test(reporter, ctxInfo.fGrContext); + wrap_rt_test(reporter, ctxInfo.fGrContext); + wrap_trt_test(reporter, ctxInfo.fGrContext); } #endif |