Index: tests/ProxyTest.cpp |
diff --git a/tests/ProxyTest.cpp b/tests/ProxyTest.cpp |
index 2ed4591a723c83eb562f3d0f7d63fd6e71821c29..45d3945c7ff6995a08f3a401656c00298501c3d6 100644 |
--- a/tests/ProxyTest.cpp |
+++ b/tests/ProxyTest.cpp |
@@ -10,6 +10,7 @@ |
#include "Test.h" |
#if SK_SUPPORT_GPU |
+#include "GrGpu.h" |
#include "GrSurfaceProxy.h" |
#include "GrTextureProxy.h" |
#include "GrRenderTargetProxy.h" |
@@ -50,7 +51,8 @@ static void check_rendertarget(skiatest::Reporter* reporter, |
rtProxy->isStencilBufferMultisampled()); |
REPORTER_ASSERT(reporter, rt->numColorSamples() == rtProxy->numColorSamples()); |
REPORTER_ASSERT(reporter, rt->numStencilSamples() == rtProxy->numStencilSamples()); |
- REPORTER_ASSERT(reporter, rt->hasMixedSamples() == rtProxy->hasMixedSamples()); |
+ REPORTER_ASSERT(reporter, rt->isMixedSampled() == rtProxy->isMixedSampled()); |
+ REPORTER_ASSERT(reporter, rt->renderTargetPriv().flags() == rtProxy->testingOnly_getFlags()); |
} |
static void check_texture(skiatest::Reporter* reporter, |
@@ -124,6 +126,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(AllocedProxyTest, reporter, ctxInfo) { |
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) { |
GrTextureProvider* provider = ctxInfo.grContext()->textureProvider(); |
+ const GrCaps& caps = *ctxInfo.grContext()->caps(); |
static const int kWidthHeight = 100; |
@@ -131,8 +134,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) { |
for (auto config : { kAlpha_8_GrPixelConfig, kRGBA_8888_GrPixelConfig }) { |
for (auto budgeted : { SkBudgeted::kYes, SkBudgeted::kNo }) { |
for (auto numSamples: { 0, 4}) { |
- bool renderable = ctxInfo.grContext()->caps()->isConfigRenderable( |
- config, numSamples > 0); |
+ bool renderable = caps.isConfigRenderable(config, numSamples > 0); |
GrSurfaceDesc desc; |
desc.fOrigin = origin; |
@@ -141,14 +143,40 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) { |
desc.fConfig = config; |
desc.fSampleCnt = numSamples; |
+ // External on-screen render target. |
+ if (renderable && kOpenGL_GrBackend == ctxInfo.backend()) { |
+ GrBackendRenderTargetDesc backendDesc; |
+ backendDesc.fWidth = kWidthHeight; |
+ backendDesc.fHeight = kWidthHeight; |
+ backendDesc.fConfig = config; |
+ backendDesc.fOrigin = origin; |
+ backendDesc.fSampleCnt = numSamples; |
+ backendDesc.fStencilBits = 8; |
+ backendDesc.fRenderTargetHandle = 0; |
+ |
+ GrGpu* gpu = ctxInfo.grContext()->getGpu(); |
+ sk_sp<GrRenderTarget> defaultFBO( |
+ gpu->wrapBackendRenderTarget(backendDesc, kBorrow_GrWrapOwnership)); |
+ SkASSERT(!defaultFBO->renderTargetPriv().supportsWindowRectangles()); |
+ |
+ sk_sp<GrRenderTargetProxy> rtProxy( |
+ GrRenderTargetProxy::Make(caps, defaultFBO)); |
+ check_surface(reporter, rtProxy.get(), origin, |
+ kWidthHeight, kWidthHeight, config); |
+ check_rendertarget(reporter, provider, rtProxy.get(), SkBackingFit::kExact); |
+ } |
+ |
sk_sp<GrTexture> tex; |
+ // Internal offscreen render target. |
if (renderable) { |
desc.fFlags = kRenderTarget_GrSurfaceFlag; |
tex.reset(provider->createTexture(desc, budgeted)); |
sk_sp<GrRenderTarget> rt(sk_ref_sp(tex->asRenderTarget())); |
+ SkASSERT(caps.maxWindowRectangles() <= 0 || |
+ rt->renderTargetPriv().supportsWindowRectangles()); |
- sk_sp<GrRenderTargetProxy> rtProxy(GrRenderTargetProxy::Make(rt)); |
+ sk_sp<GrRenderTargetProxy> rtProxy(GrRenderTargetProxy::Make(caps, rt)); |
check_surface(reporter, rtProxy.get(), origin, |
kWidthHeight, kWidthHeight, config); |
check_rendertarget(reporter, provider, rtProxy.get(), SkBackingFit::kExact); |