From 52e943a4693af75b40b62200191981da7458db62 Mon Sep 17 00:00:00 2001 From: Brian Salomon Date: Tue, 13 Mar 2018 09:32:39 -0400 Subject: Add testing-only backend render target support to GrVkGpu. Update unit tests to use backend render targets on non-GL contexts Add named DM configs for rendering to Vulkan backend render targets and textures. Make src data ptr param to createTestingOnlyBackendTexture be const. Change-Id: I17f5375ed9bb08422006698956469d3151c4954c Reviewed-on: https://skia-review.googlesource.com/113276 Commit-Queue: Brian Salomon Reviewed-by: Greg Daniel --- tests/ProxyTest.cpp | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) (limited to 'tests/ProxyTest.cpp') diff --git a/tests/ProxyTest.cpp b/tests/ProxyTest.cpp index 911c430dc1..4970e43a20 100644 --- a/tests/ProxyTest.cpp +++ b/tests/ProxyTest.cpp @@ -201,12 +201,28 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) { static const int kWidthHeight = 100; - if (kOpenGL_GrBackend != ctxInfo.backend()) { - return; - } for (auto origin : { kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin }) { for (auto colorType : { kAlpha_8_SkColorType, kRGBA_8888_SkColorType, kRGBA_1010102_SkColorType }) { + // External on-screen render target. + // Tests wrapBackendRenderTarget with a GrBackendRenderTarget + // Our test-only function that creates a backend render target doesn't currently support + // sample counts :(. + if (ctxInfo.grContext()->colorTypeSupportedAsSurface(colorType)) { + GrBackendRenderTarget backendRT = gpu->createTestingOnlyBackendRenderTarget( + kWidthHeight, kWidthHeight, SkColorTypeToGrColorType(colorType), + GrSRGBEncoded::kNo); + sk_sp sProxy( + proxyProvider->wrapBackendRenderTarget(backendRT, origin)); + check_surface(reporter, sProxy.get(), origin, kWidthHeight, kWidthHeight, + backendRT.testingOnly_getPixelConfig(), SkBudgeted::kNo); + static constexpr int kExpectedNumSamples = 1; + check_rendertarget(reporter, caps, resourceProvider, sProxy->asRenderTargetProxy(), + kExpectedNumSamples, SkBackingFit::kExact, + caps.maxWindowRectangles()); + gpu->deleteTestingOnlyBackendRenderTarget(backendRT); + } + for (auto numSamples : {1, 4}) { GrPixelConfig config = SkImageInfo2GrPixelConfig(colorType, nullptr, caps); SkASSERT(kUnknown_GrPixelConfig != config); @@ -216,14 +232,14 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) { continue; } - // External on-screen render target. - // Tests wrapBackendRenderTarget with a GrBackendRenderTarget - { + // Test wrapping FBO 0 (with made up properties). This tests sample count and the + // special case where FBO 0 doesn't support window rectangles. + if (kOpenGL_GrBackend == ctxInfo.backend()) { GrGLFramebufferInfo fboInfo; fboInfo.fFBOID = 0; - GrBackendRenderTarget backendRT(kWidthHeight, kWidthHeight, numSamples, 8, - config, fboInfo); - + static constexpr int kStencilBits = 8; + GrBackendRenderTarget backendRT(kWidthHeight, kWidthHeight, numSamples, + kStencilBits, config, fboInfo); sk_sp sProxy( proxyProvider->wrapBackendRenderTarget(backendRT, origin)); check_surface(reporter, sProxy.get(), origin, -- cgit v1.2.3