39f1a9589b
This reverts commit 6ec9a4ffe4
.
Reason for revert: Maybe breaking iOS bots
Original change's description:
> Add initial version of GrResourceAllocator's free pool
>
> Change-Id: Ibd60303ffb1d3ea814dad0cee3a521f94da63ca8
> Reviewed-on: https://skia-review.googlesource.com/24262
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>
TBR=bsalomon@google.com,robertphillips@google.com
Change-Id: I0195f64503a6f2f7b416f75b57fb9141e5b9f796
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/25540
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
52 lines
1.7 KiB
C++
52 lines
1.7 KiB
C++
/*
|
|
* Copyright 2017 Google Inc.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
// Include here to ensure SK_SUPPORT_GPU is set correctly before it is examined.
|
|
#include "SkTypes.h"
|
|
|
|
#if SK_SUPPORT_GPU
|
|
#include "Test.h"
|
|
|
|
#include "GrResourceAllocator.h"
|
|
#include "GrSurfaceProxyPriv.h"
|
|
#include "GrTextureProxy.h"
|
|
|
|
// Basic test that two proxies with overlapping intervals and compatible descriptors are
|
|
// assigned different GrSurfaces.
|
|
static void overlap_test(skiatest::Reporter* reporter, GrResourceProvider* resourceProvider) {
|
|
GrSurfaceDesc desc;
|
|
desc.fConfig = kRGBA_8888_GrPixelConfig;
|
|
desc.fWidth = 64;
|
|
desc.fHeight = 64;
|
|
|
|
sk_sp<GrSurfaceProxy> p1 = GrSurfaceProxy::MakeDeferred(resourceProvider, desc,
|
|
SkBackingFit::kApprox,
|
|
SkBudgeted::kNo);
|
|
sk_sp<GrSurfaceProxy> p2 = GrSurfaceProxy::MakeDeferred(resourceProvider, desc,
|
|
SkBackingFit::kApprox,
|
|
SkBudgeted::kNo);
|
|
|
|
GrResourceAllocator alloc(resourceProvider);
|
|
|
|
alloc.addInterval(p1.get(), 0, 4);
|
|
alloc.addInterval(p2.get(), 1, 2);
|
|
|
|
alloc.assign();
|
|
|
|
REPORTER_ASSERT(reporter, p1->priv().peekSurface());
|
|
REPORTER_ASSERT(reporter, p2->priv().peekSurface());
|
|
REPORTER_ASSERT(reporter, p1->underlyingUniqueID() != p2->underlyingUniqueID());
|
|
}
|
|
|
|
DEF_GPUTEST_FOR_ALL_CONTEXTS(ResourceAllocatorTest, reporter, ctxInfo) {
|
|
GrResourceProvider* resourceProvider = ctxInfo.grContext()->resourceProvider();
|
|
|
|
overlap_test(reporter, resourceProvider);
|
|
}
|
|
|
|
#endif
|