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 <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
diff --git a/tests/ProxyTest.cpp b/tests/ProxyTest.cpp
index 911c430..4970e43 100644
--- a/tests/ProxyTest.cpp
+++ b/tests/ProxyTest.cpp
@@ -201,12 +201,28 @@
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<GrSurfaceProxy> 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 @@
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<GrSurfaceProxy> sProxy(
proxyProvider->wrapBackendRenderTarget(backendRT, origin));
check_surface(reporter, sProxy.get(), origin,