Expose gpu cache knobs
Change-Id: I5911593812ebf6fd235c6a3fc2acfa740c7687aa
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/203164
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/modules/canvaskit/canvaskit_bindings.cpp b/modules/canvaskit/canvaskit_bindings.cpp
index 19b82a5..0130ed7 100644
--- a/modules/canvaskit/canvaskit_bindings.cpp
+++ b/modules/canvaskit/canvaskit_bindings.cpp
@@ -740,7 +740,25 @@
#if SK_SUPPORT_GPU
class_<GrContext>("GrContext")
- .smart_ptr<sk_sp<GrContext>>("sk_sp<GrContext>");
+ .smart_ptr<sk_sp<GrContext>>("sk_sp<GrContext>")
+ .function("getResourceCacheLimitBytes", optional_override([](GrContext& self)->size_t {
+ int maxResources = 0;// ignored
+ size_t currMax = 0;
+ self.getResourceCacheLimits(&maxResources, &currMax);
+ return currMax;
+ }))
+ .function("getResourceCacheUsageBytes", optional_override([](GrContext& self)->size_t {
+ int usedResources = 0;// ignored
+ size_t currUsage = 0;
+ self.getResourceCacheUsage(&usedResources, &currUsage);
+ return currUsage;
+ }))
+ .function("setResourceCacheLimitBytes", optional_override([](GrContext& self, size_t maxResourceBytes)->void {
+ int maxResources = 0;
+ size_t currMax = 0; // ignored
+ self.getResourceCacheLimits(&maxResources, &currMax);
+ self.setResourceCacheLimits(maxResources, maxResourceBytes);
+ }));
#endif
class_<SkCanvas>("SkCanvas")