aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrGpuResource.cpp
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2015-01-14 10:42:08 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-01-14 10:42:08 -0800
commit5236cf480daf82b2f36e42795abdbbc915533a59 (patch)
treeb3e76998aabf4849c60d7bc0c701de47b2aaf4e9 /src/gpu/GrGpuResource.cpp
parent028b98a08072bd1764936e47c54fa2da5cf92744 (diff)
Make uncached textures uncached from the get go.
This avoids the problem of a newly created uncached texture causing a purge of cached resources. BUG=chromium:445885 Review URL: https://codereview.chromium.org/846303002
Diffstat (limited to 'src/gpu/GrGpuResource.cpp')
-rw-r--r--src/gpu/GrGpuResource.cpp28
1 files changed, 3 insertions, 25 deletions
diff --git a/src/gpu/GrGpuResource.cpp b/src/gpu/GrGpuResource.cpp
index b2fad0b3f7..a2df7e13e8 100644
--- a/src/gpu/GrGpuResource.cpp
+++ b/src/gpu/GrGpuResource.cpp
@@ -18,16 +18,12 @@ static inline GrResourceCache2* get_resource_cache2(GrGpu* gpu) {
return gpu->getContext()->getResourceCache2();
}
-GrGpuResource::GrGpuResource(GrGpu* gpu, bool isWrapped)
+GrGpuResource::GrGpuResource(GrGpu* gpu, LifeCycle lifeCycle)
: fGpu(gpu)
, fGpuMemorySize(kInvalidGpuMemorySize)
+ , fFlags(0)
+ , fLifeCycle(lifeCycle)
, fUniqueID(CreateUniqueID()) {
- if (isWrapped) {
- fFlags = kWrapped_Flag;
- } else {
- // By default all non-wrapped resources are budgeted.
- fFlags = kBudgeted_Flag;
- }
}
void GrGpuResource::registerWithCache() {
@@ -146,21 +142,3 @@ uint32_t GrGpuResource::CreateUniqueID() {
} while (id == SK_InvalidUniqueID);
return id;
}
-
-void GrGpuResource::setBudgeted(bool countsAgainstBudget) {
- // Wrapped resources never count against the budget, nothing to do. No point in changing the
- // budgeting of destroyed resources.
- if (this->isWrapped() || this->wasDestroyed()) {
- return;
- }
-
- uint32_t oldFlags = fFlags;
- if (countsAgainstBudget) {
- fFlags |= kBudgeted_Flag;
- } else {
- fFlags &= ~kBudgeted_Flag;
- }
- if (fFlags != oldFlags) {
- get_resource_cache2(fGpu)->resourceAccess().didChangeBudgetStatus(this);
- }
-}