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

Unified Diff: include/gpu/GrBuffer.h

Issue 1862043002: Refactor to separate backend object lifecycle and GpuResource budget decision (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 4 years, 8 months 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 side-by-side diff with in-line comments
Download patch
Index: include/gpu/GrBuffer.h
diff --git a/include/gpu/GrBuffer.h b/include/gpu/GrBuffer.h
index 7e04577543f2922a816c7199081d740c676297a4..923453c24cd387637738077e19206cadb171a5ef 100644
--- a/include/gpu/GrBuffer.h
+++ b/include/gpu/GrBuffer.h
@@ -110,15 +110,17 @@ public:
protected:
GrBuffer(GrGpu* gpu, size_t gpuMemorySize, GrBufferType intendedType,
GrAccessPattern accessPattern, bool cpuBacked)
- : INHERITED(gpu, kCached_LifeCycle),
+ : INHERITED(gpu),
fMapPtr(nullptr),
fGpuMemorySize(gpuMemorySize), // TODO: Zero for cpu backed buffers?
fAccessPattern(accessPattern),
- fCPUBacked(cpuBacked) {
+ fCPUBacked(cpuBacked),
+ fIntendedType(intendedType) {
+ }
+
+ void computeScratchKey(GrScratchKey* key) const override {
if (!fCPUBacked && SkIsPow2(fGpuMemorySize) && kDynamic_GrAccessPattern == fAccessPattern) {
- GrScratchKey key;
- ComputeScratchKeyForDynamicBuffer(fGpuMemorySize, intendedType, &key);
- this->setScratchKey(key);
+ ComputeScratchKeyForDynamicBuffer(fGpuMemorySize, fIntendedType, key);
}
}
@@ -134,7 +136,7 @@ private:
size_t fGpuMemorySize;
GrAccessPattern fAccessPattern;
bool fCPUBacked;
-
+ GrBufferType fIntendedType;
typedef GrGpuResource INHERITED;
};

Powered by Google App Engine
This is Rietveld 408576698