OLD | NEW |
---|---|
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | |
10 #include "GrGpuResource.h" | 9 #include "GrGpuResource.h" |
11 #include "GrResourceCache2.h" | 10 #include "GrResourceCache2.h" |
12 #include "GrGpu.h" | 11 #include "GrGpu.h" |
13 | 12 |
14 static inline GrResourceCache2* get_resource_cache2(GrGpu* gpu) { | 13 static inline GrResourceCache2* get_resource_cache2(GrGpu* gpu) { |
15 SkASSERT(gpu); | 14 SkASSERT(gpu); |
16 SkASSERT(gpu->getContext()); | 15 SkASSERT(gpu->getContext()); |
17 SkASSERT(gpu->getContext()->getResourceCache2()); | 16 SkASSERT(gpu->getContext()->getResourceCache2()); |
18 return gpu->getContext()->getResourceCache2(); | 17 return gpu->getContext()->getResourceCache2(); |
19 } | 18 } |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
127 fScratchKey = scratchKey; | 126 fScratchKey = scratchKey; |
128 } | 127 } |
129 | 128 |
130 void GrGpuResource::removeScratchKey() { | 129 void GrGpuResource::removeScratchKey() { |
131 if (!this->wasDestroyed() && fScratchKey.isValid()) { | 130 if (!this->wasDestroyed() && fScratchKey.isValid()) { |
132 get_resource_cache2(fGpu)->resourceAccess().willRemoveScratchKey(this); | 131 get_resource_cache2(fGpu)->resourceAccess().willRemoveScratchKey(this); |
133 fScratchKey.reset(); | 132 fScratchKey.reset(); |
134 } | 133 } |
135 } | 134 } |
136 | 135 |
136 void GrGpuResource::makeBudgeted() { | |
robertphillips
2015/01/15 20:48:17
Should we add an assert that we're not trying to m
bsalomon
2015/01/15 21:14:05
Seems ok to just ignore the request to me...
| |
137 if (GrGpuResource::kUncached_LifeCycle == fLifeCycle) { | |
138 fLifeCycle = kCached_LifeCycle; | |
139 get_resource_cache2(fGpu)->resourceAccess().didChangeBudgetStatus(this); | |
140 } | |
141 } | |
142 | |
137 uint32_t GrGpuResource::CreateUniqueID() { | 143 uint32_t GrGpuResource::CreateUniqueID() { |
138 static int32_t gUniqueID = SK_InvalidUniqueID; | 144 static int32_t gUniqueID = SK_InvalidUniqueID; |
139 uint32_t id; | 145 uint32_t id; |
140 do { | 146 do { |
141 id = static_cast<uint32_t>(sk_atomic_inc(&gUniqueID) + 1); | 147 id = static_cast<uint32_t>(sk_atomic_inc(&gUniqueID) + 1); |
142 } while (id == SK_InvalidUniqueID); | 148 } while (id == SK_InvalidUniqueID); |
143 return id; | 149 return id; |
144 } | 150 } |
OLD | NEW |