Remove fAssignedSurface from GrResourceAllocator::Interval
The surface on the proxy should be the source of truth here. Bug: skia:10877 Change-Id: Id2126a259202be4c426f2cbf8f025ef69dd50551 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/384702 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Adlai Holler <adlai@google.com>
This commit is contained in:
parent
cfdae5a56c
commit
729ba5e83c
@ -28,12 +28,6 @@
|
||||
}
|
||||
#endif
|
||||
|
||||
void GrResourceAllocator::Interval::assign(sk_sp<GrSurface> s) {
|
||||
SkASSERT(!fAssignedSurface);
|
||||
fAssignedSurface = s;
|
||||
fProxy->priv().assign(std::move(s));
|
||||
}
|
||||
|
||||
void GrResourceAllocator::determineRecyclability() {
|
||||
for (Interval* cur = fIntvlList.peekHead(); cur; cur = cur->next()) {
|
||||
if (cur->proxy()->canSkipResourceAllocator()) {
|
||||
@ -267,14 +261,12 @@ sk_sp<GrSurface> GrResourceAllocator::findSurfaceFor(const GrSurfaceProxy* proxy
|
||||
// to the free pool if possible.
|
||||
void GrResourceAllocator::expire(unsigned int curIndex) {
|
||||
while (!fActiveIntvls.empty() && fActiveIntvls.peekHead()->end() < curIndex) {
|
||||
Interval* temp = fActiveIntvls.popHead();
|
||||
SkASSERT(!temp->next());
|
||||
Interval* intvl = fActiveIntvls.popHead();
|
||||
SkASSERT(!intvl->next());
|
||||
|
||||
if (temp->wasAssignedSurface()) {
|
||||
sk_sp<GrSurface> surface = temp->detachSurface();
|
||||
|
||||
if (temp->isRecyclable()) {
|
||||
this->recycleSurface(std::move(surface));
|
||||
if (GrSurface* surf = intvl->proxy()->peekSurface()) {
|
||||
if (intvl->isRecyclable()) {
|
||||
this->recycleSurface(sk_ref_sp(surf));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -329,7 +321,8 @@ bool GrResourceAllocator::assign() {
|
||||
cur->proxy()->uniqueID().asUInt());
|
||||
#endif
|
||||
|
||||
cur->assign(std::move(surface));
|
||||
SkASSERT(!cur->proxy()->peekSurface());
|
||||
cur->proxy()->priv().assign(std::move(surface));
|
||||
} else {
|
||||
SkASSERT(!cur->proxy()->isInstantiated());
|
||||
fFailedInstantiation = true;
|
||||
|
@ -137,10 +137,6 @@ private:
|
||||
#endif
|
||||
}
|
||||
|
||||
~Interval() {
|
||||
SkASSERT(!fAssignedSurface);
|
||||
}
|
||||
|
||||
const GrSurfaceProxy* proxy() const { return fProxy; }
|
||||
GrSurfaceProxy* proxy() { return fProxy; }
|
||||
|
||||
@ -166,10 +162,6 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
void assign(sk_sp<GrSurface>);
|
||||
bool wasAssignedSurface() const { return fAssignedSurface != nullptr; }
|
||||
sk_sp<GrSurface> detachSurface() { return std::move(fAssignedSurface); }
|
||||
|
||||
// for SkTDynamicHash
|
||||
static const uint32_t& GetKey(const Interval& intvl) {
|
||||
return intvl.fProxyID;
|
||||
@ -177,8 +169,6 @@ private:
|
||||
static uint32_t Hash(const uint32_t& key) { return key; }
|
||||
|
||||
private:
|
||||
// TODO: Do we really need this variable?
|
||||
sk_sp<GrSurface> fAssignedSurface;
|
||||
GrSurfaceProxy* fProxy;
|
||||
uint32_t fProxyID; // This is here b.c. DynamicHash requires a ref to the key
|
||||
unsigned int fStart;
|
||||
|
Loading…
Reference in New Issue
Block a user