Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/gpu/GrGpuResource.cpp

Issue 747043004: Use scratch keys for stencil buffers. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address comment Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/GrGpu.cpp ('k') | src/gpu/GrGpuResourceCacheAccess.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 9
10 #include "GrGpuResource.h" 10 #include "GrGpuResource.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 SkASSERT(fScratchKey.isNullScratch()); 121 SkASSERT(fScratchKey.isNullScratch());
122 SkASSERT(scratchKey.isScratch()); 122 SkASSERT(scratchKey.isScratch());
123 SkASSERT(!scratchKey.isNullScratch()); 123 SkASSERT(!scratchKey.isNullScratch());
124 // Wrapped resources can never have a key. 124 // Wrapped resources can never have a key.
125 if (this->isWrapped()) { 125 if (this->isWrapped()) {
126 return; 126 return;
127 } 127 }
128 fScratchKey = scratchKey; 128 fScratchKey = scratchKey;
129 } 129 }
130 130
131 void GrGpuResource::removeScratchKey() {
132 if (!this->wasDestroyed() && !fScratchKey.isNullScratch()) {
133 get_resource_cache2(fGpu)->resourceAccess().willRemoveScratchKey(this);
134 fScratchKey = GrResourceKey::NullScratchKey();
135 }
136 }
137
131 uint32_t GrGpuResource::CreateUniqueID() { 138 uint32_t GrGpuResource::CreateUniqueID() {
132 static int32_t gUniqueID = SK_InvalidUniqueID; 139 static int32_t gUniqueID = SK_InvalidUniqueID;
133 uint32_t id; 140 uint32_t id;
134 do { 141 do {
135 id = static_cast<uint32_t>(sk_atomic_inc(&gUniqueID) + 1); 142 id = static_cast<uint32_t>(sk_atomic_inc(&gUniqueID) + 1);
136 } while (id == SK_InvalidUniqueID); 143 } while (id == SK_InvalidUniqueID);
137 return id; 144 return id;
138 } 145 }
139 146
140 void GrGpuResource::setBudgeted(bool countsAgainstBudget) { 147 void GrGpuResource::setBudgeted(bool countsAgainstBudget) {
141 // Wrapped resources never count against the budget, nothing to do. No point in changing the 148 // Wrapped resources never count against the budget, nothing to do. No point in changing the
142 // budgeting of destroyed resources. 149 // budgeting of destroyed resources.
143 if (this->isWrapped() || this->wasDestroyed()) { 150 if (this->isWrapped() || this->wasDestroyed()) {
144 return; 151 return;
145 } 152 }
146 153
147 uint32_t oldFlags = fFlags; 154 uint32_t oldFlags = fFlags;
148 if (countsAgainstBudget) { 155 if (countsAgainstBudget) {
149 fFlags |= kBudgeted_Flag; 156 fFlags |= kBudgeted_Flag;
150 } else { 157 } else {
151 fFlags &= ~kBudgeted_Flag; 158 fFlags &= ~kBudgeted_Flag;
152 } 159 }
153 if (fFlags != oldFlags) { 160 if (fFlags != oldFlags) {
154 get_resource_cache2(fGpu)->resourceAccess().didChangeBudgetStatus(this); 161 get_resource_cache2(fGpu)->resourceAccess().didChangeBudgetStatus(this);
155 } 162 }
156 } 163 }
OLDNEW
« no previous file with comments | « src/gpu/GrGpu.cpp ('k') | src/gpu/GrGpuResourceCacheAccess.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698