Give GrResourceAllocator a GrDirectContext
This allows it to access the resource cache as well as the provider,
and paves the way for memory budgeting inside the resource allocator.
Bug: skia:10877
Change-Id: I01e9c02e445494ac431b288f41006ae7360ff791
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/394116
Auto-Submit: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp
index 6d822cd..512911a 100644
--- a/src/gpu/GrDrawingManager.cpp
+++ b/src/gpu/GrDrawingManager.cpp
@@ -117,18 +117,18 @@
}
}
- auto direct = fContext->asDirectContext();
- SkASSERT(direct);
- direct->priv().clientMappedBufferManager()->process();
+ auto dContext = fContext->asDirectContext();
+ SkASSERT(dContext);
+ dContext->priv().clientMappedBufferManager()->process();
- GrGpu* gpu = direct->priv().getGpu();
+ GrGpu* gpu = dContext->priv().getGpu();
// We have a non abandoned and direct GrContext. It must have a GrGpu.
SkASSERT(gpu);
fFlushing = true;
- auto resourceProvider = direct->priv().resourceProvider();
- auto resourceCache = direct->priv().getResourceCache();
+ auto resourceProvider = dContext->priv().resourceProvider();
+ auto resourceCache = dContext->priv().getResourceCache();
// Semi-usually the GrRenderTasks are already closed at this point, but sometimes Ganesh needs
// to flush mid-draw. In that case, the SkGpuDevice's opsTasks won't be closed but need to be
@@ -205,7 +205,7 @@
bool flushed = false;
{
- GrResourceAllocator alloc(resourceProvider SkDEBUGCODE(, fDAG.count()));
+ GrResourceAllocator alloc(dContext SkDEBUGCODE(, fDAG.count()));
for (const auto& task : fDAG) {
SkASSERT(task);
task->gatherProxyIntervals(&alloc);