aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench/GrResourceCacheBench.cpp
diff options
context:
space:
mode:
authorGravatar kkinnunen <kkinnunen@nvidia.com>2016-04-22 01:48:29 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-04-22 01:48:29 -0700
commit2e6055b3ea14a04fcde1ac1974a70bf00b1e295b (patch)
tree38513879d9f2840cb7d08f85365722016448f787 /bench/GrResourceCacheBench.cpp
parentcb61a6452fbf9b147dc9d3f31bf520efb0e2c7fd (diff)
Refactor to separate backend object lifecycle and GpuResource budget decision
Refactor GrGpuResource to contain two different pieces of state: a) instance is budgeted or not budgeted b) instance references wrapped backend objects or not The "object lifecycle" was also attached to backend object handles (ids), which made the code a bit unclear. Backend objects would be associated with GrGpuResource::LifeCycle, even though GrGpuResource::LifeCycle refers to the GpuResource, and individual backend objects in one GpuResource might be governed with different "lifecycle". Mark the budgeted/not budgeted with SkBudgeted::kYes, SkBudgeted::kNo. This was previously GrGpuResource::kCached_LifeCycle, GrGpuResource::kUncached_LifeCycle. Mark the "references wrapped object" with boolean. This was previously GrGpuResource::kBorrowed_LifeCycle, GrGpuResource::kAdopted_LifeCycle for GrGpuResource. Associate the backend object ownership status with GrBackendObjectOwnership for the backend object handles. The resource type leaf constuctors, such has GrGLTexture or GrGLTextureRenderTarget take "budgeted" parameter. This parameter is passed to GrGpuResource::registerWithCache(). The resource type intermediary constructors, such as GrGLTexture constructors for class GrGLTextureRenderTarget do not take "budgeted" parameters, intermediary construtors do not call registerWithCache. Removes the need for tagging GrGpuResource -derived subclass constructors with "Derived" parameter. Makes instances that wrap backend objects be registered with a new function GrGpuResource::registerWithCacheWrapped(). Removes "budgeted" parameter from classes such as StencilAttahment, as they are always cached and never wrap any external backend objects. Removes the use of concept "external" from the member function names. The API refers to the objects as "wrapped", so make all related functions use the term consistently. No change in functionality. Resources referencing wrapped objects are always inserted to the cache with budget decision kNo. BUG=594928 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1862043002 Review URL: https://codereview.chromium.org/1862043002
Diffstat (limited to 'bench/GrResourceCacheBench.cpp')
-rw-r--r--bench/GrResourceCacheBench.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/bench/GrResourceCacheBench.cpp b/bench/GrResourceCacheBench.cpp
index 890bc96004..295a5bcec1 100644
--- a/bench/GrResourceCacheBench.cpp
+++ b/bench/GrResourceCacheBench.cpp
@@ -23,8 +23,8 @@ enum {
class BenchResource : public GrGpuResource {
public:
BenchResource (GrGpu* gpu)
- : INHERITED(gpu, kCached_LifeCycle) {
- this->registerWithCache();
+ : INHERITED(gpu) {
+ this->registerWithCache(SkBudgeted::kYes);
}
static void ComputeKey(int i, int keyData32Count, GrUniqueKey* key) {