aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/GrSurfaceTest.cpp
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2018-01-16 08:06:32 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-01-16 13:28:43 +0000
commit0bd24dc41f2351d84f5fce32130668a5792d134b (patch)
treec46dc6fb7636fd7c2185e1f855f1dd582512fcc4 /tests/GrSurfaceTest.cpp
parent3167aa0c9c84cab1b0252031166e4a345e2afe2d (diff)
Funnel most proxy creation through GrProxyProvider
This is to provide a choke point for DDL to create Lazy Proxies. Change-Id: If178da13bc6447b31b7601810236d34502d9efbd Reviewed-on: https://skia-review.googlesource.com/93303 Commit-Queue: Robert Phillips <robertphillips@google.com> Reviewed-by: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'tests/GrSurfaceTest.cpp')
-rw-r--r--tests/GrSurfaceTest.cpp32
1 files changed, 14 insertions, 18 deletions
diff --git a/tests/GrSurfaceTest.cpp b/tests/GrSurfaceTest.cpp
index ecfd9f2433..582510c1b4 100644
--- a/tests/GrSurfaceTest.cpp
+++ b/tests/GrSurfaceTest.cpp
@@ -12,6 +12,7 @@
#include "GrContext.h"
#include "GrContextPriv.h"
#include "GrGpu.h"
+#include "GrProxyProvider.h"
#include "GrRenderTarget.h"
#include "GrResourceProvider.h"
#include "GrTest.h"
@@ -126,10 +127,10 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(GrSurfaceRenderability, reporter, ctxInfo) {
texels[i].fPixels = pixelData.get();
texels[i].fRowBytes = rowBytes >> i;
}
- sk_sp<GrTextureProxy> proxy = GrSurfaceProxy::MakeDeferredMipMap(proxyProvider,
- desc, SkBudgeted::kNo,
- texels.get(),
- levelCount);
+
+ sk_sp<GrTextureProxy> proxy = proxyProvider->createMipMapProxy(
+ desc, SkBudgeted::kNo,
+ texels.get(), levelCount);
REPORTER_ASSERT(reporter, SkToBool(proxy.get()) ==
(caps->isConfigTexturable(desc.fConfig) &&
caps->mipMapSupport() &&
@@ -155,7 +156,10 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(InitialTextureClear, reporter, context_info)
GrSurfaceDesc desc;
desc.fWidth = desc.fHeight = kSize;
std::unique_ptr<uint32_t[]> data(new uint32_t[kSize * kSize]);
+
GrContext* context = context_info.grContext();
+ GrProxyProvider* proxyProvider = context->contextPriv().proxyProvider();
+
for (int c = 0; c <= kLast_GrPixelConfig; ++c) {
desc.fConfig = static_cast<GrPixelConfig>(c);
if (!context_info.grContext()->caps()->isConfigTexturable(desc.fConfig)) {
@@ -170,22 +174,16 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(InitialTextureClear, reporter, context_info)
for (GrSurfaceOrigin origin :
{kTopLeft_GrSurfaceOrigin, kBottomLeft_GrSurfaceOrigin}) {
desc.fOrigin = origin;
- for (bool approx : {false, true}) {
- auto resourceProvider = context->resourceProvider();
+ for (auto fit : { SkBackingFit::kApprox, SkBackingFit::kExact }) {
// Try directly creating the texture.
// Do this twice in an attempt to hit the cache on the second time through.
for (int i = 0; i < 2; ++i) {
- sk_sp<GrTexture> tex;
- if (approx) {
- tex = sk_sp<GrTexture>(
- resourceProvider->createApproxTexture(desc, 0));
- } else {
- tex = resourceProvider->createTexture(desc, SkBudgeted::kYes);
- }
- if (!tex) {
+ sk_sp<GrTextureProxy> proxy = proxyProvider->createInstantiatedProxy(
+ desc, fit, SkBudgeted::kYes);
+ if (!proxy) {
continue;
}
- auto proxy = GrSurfaceProxy::MakeWrapped(std::move(tex), desc.fOrigin);
+
auto texCtx = context->contextPriv().makeWrappedSurfaceContext(
std::move(proxy), nullptr);
SkImageInfo info = SkImageInfo::Make(
@@ -212,9 +210,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(InitialTextureClear, reporter, context_info)
// Try creating the texture as a deferred proxy.
for (int i = 0; i < 2; ++i) {
auto surfCtx = context->contextPriv().makeDeferredSurfaceContext(
- desc, GrMipMapped::kNo,
- approx ? SkBackingFit::kApprox : SkBackingFit::kExact,
- SkBudgeted::kYes);
+ desc, GrMipMapped::kNo, fit, SkBudgeted::kYes);
if (!surfCtx) {
continue;
}