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

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: fix unrelated GrBuffer::onGpuMemorySize() lack of override keyword compile error 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
« no previous file with comments | « bench/GrResourceCacheBench.cpp ('k') | include/gpu/GrGpuResource.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/gpu/GrBuffer.h
diff --git a/include/gpu/GrBuffer.h b/include/gpu/GrBuffer.h
index 7e04577543f2922a816c7199081d740c676297a4..829596e73456f82cc6cc5ba66f08f3fe7f92afda 100644
--- a/include/gpu/GrBuffer.h
+++ b/include/gpu/GrBuffer.h
@@ -110,22 +110,24 @@ 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);
}
}
void* fMapPtr;
private:
- virtual size_t onGpuMemorySize() const { return fGpuMemorySize; }
+ size_t onGpuMemorySize() const override { return fGpuMemorySize; }
virtual void onMap() = 0;
virtual void onUnmap() = 0;
@@ -134,7 +136,7 @@ private:
size_t fGpuMemorySize;
GrAccessPattern fAccessPattern;
bool fCPUBacked;
-
+ GrBufferType fIntendedType;
typedef GrGpuResource INHERITED;
};
« no previous file with comments | « bench/GrResourceCacheBench.cpp ('k') | include/gpu/GrGpuResource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698