Cleanup after removal of IORefs from GrSurface
The removal of IORefs from GrSurface makes a lot of other cruft obsolete.
Change-Id: I0e02d680a17dc4f4ec705cb6ee4c294738271e28
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/239919
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrResourceCache.cpp b/src/gpu/GrResourceCache.cpp
index afb2b38..e6655d2 100644
--- a/src/gpu/GrResourceCache.cpp
+++ b/src/gpu/GrResourceCache.cpp
@@ -285,8 +285,7 @@
SkASSERT(!resource->getUniqueKey().isValid() &&
resource->resourcePriv().getScratchKey().isValid());
- // isScratch() also tests that the resource is budgeted. TODO: why are unbudgeted
- // scratch resouces in the scratchMap?
+ // isScratch() also tests that the resource is budgeted.
if (resource->internalHasRef() || !resource->cacheAccess().isScratch()) {
return false;
}
@@ -294,32 +293,10 @@
}
};
-GrGpuResource* GrResourceCache::findAndRefScratchResource(const GrScratchKey& scratchKey,
- size_t resourceSize,
- ScratchFlags flags) {
+GrGpuResource* GrResourceCache::findAndRefScratchResource(const GrScratchKey& scratchKey) {
SkASSERT(scratchKey.isValid());
- GrGpuResource* resource;
- // TODO: remove these conditions and fuse the two code paths!
- if (flags & (ScratchFlags::kPreferNoPendingIO | ScratchFlags::kRequireNoPendingIO)) {
- resource = fScratchMap.find(scratchKey, AvailableForScratchUse());
- if (resource) {
- this->refAndMakeResourceMRU(resource);
- this->validate();
- return resource;
- } else if (flags & ScratchFlags::kRequireNoPendingIO) {
- return nullptr;
- }
- // We would prefer to consume more available VRAM rather than flushing
- // immediately, but on ANGLE this can lead to starving of the GPU.
- if (fPreferVRAMUseOverFlushes && this->wouldFit(resourceSize)) {
- // kPrefer is specified, we didn't find a resource without pending io,
- // but there is still space in our budget for the resource so force
- // the caller to allocate a new resource.
- return nullptr;
- }
- }
- resource = fScratchMap.find(scratchKey, AvailableForScratchUse());
+ GrGpuResource* resource = fScratchMap.find(scratchKey, AvailableForScratchUse());
if (resource) {
this->refAndMakeResourceMRU(resource);
this->validate();