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

Unified Diff: src/gpu/GrBuffer.h

Issue 1854283004: Track GL buffer state based on unique resource ID (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix for GR_GL_USE_BUFFER_DATA_NULL_HINT=0 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 | « include/gpu/GrTypesPriv.h ('k') | src/gpu/GrBufferAllocPool.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrBuffer.h
diff --git a/src/gpu/GrBuffer.h b/src/gpu/GrBuffer.h
index 4fadba6aa72f7bc3d4252a38b63259053a80a472..7e04577543f2922a816c7199081d740c676297a4 100644
--- a/src/gpu/GrBuffer.h
+++ b/src/gpu/GrBuffer.h
@@ -18,22 +18,20 @@ public:
* Computes a scratch key for a buffer with a "dynamic" access pattern. (Buffers with "static"
* and "stream" access patterns are disqualified by nature from being cached and reused.)
*/
- static void ComputeScratchKeyForDynamicBuffer(GrBufferType type, size_t size,
+ static void ComputeScratchKeyForDynamicBuffer(size_t size, GrBufferType intendedType,
GrScratchKey* key) {
static const GrScratchKey::ResourceType kType = GrScratchKey::GenerateResourceType();
GrScratchKey::Builder builder(key, kType, 1 + (sizeof(size_t) + 3) / 4);
// TODO: There's not always reason to cache a buffer by type. In some (all?) APIs it's just
// a chunk of memory we can use/reuse for any type of data. We really only need to
// differentiate between the "read" types (e.g. kGpuToCpu_BufferType) and "draw" types.
- builder[0] = type;
+ builder[0] = intendedType;
builder[1] = (uint32_t)size;
if (sizeof(size_t) > 4) {
builder[2] = (uint32_t)((uint64_t)size >> 32);
}
}
- GrBufferType type() const { return fType; }
-
GrAccessPattern accessPattern() const { return fAccessPattern; }
/**
@@ -110,17 +108,16 @@ public:
}
protected:
- GrBuffer(GrGpu* gpu, GrBufferType type, size_t gpuMemorySize, GrAccessPattern accessPattern,
- bool cpuBacked)
+ GrBuffer(GrGpu* gpu, size_t gpuMemorySize, GrBufferType intendedType,
+ GrAccessPattern accessPattern, bool cpuBacked)
: INHERITED(gpu, kCached_LifeCycle),
fMapPtr(nullptr),
- fType(type),
fGpuMemorySize(gpuMemorySize), // TODO: Zero for cpu backed buffers?
fAccessPattern(accessPattern),
fCPUBacked(cpuBacked) {
if (!fCPUBacked && SkIsPow2(fGpuMemorySize) && kDynamic_GrAccessPattern == fAccessPattern) {
GrScratchKey key;
- ComputeScratchKeyForDynamicBuffer(fType, fGpuMemorySize, &key);
+ ComputeScratchKeyForDynamicBuffer(fGpuMemorySize, intendedType, &key);
this->setScratchKey(key);
}
}
@@ -134,7 +131,6 @@ private:
virtual void onUnmap() = 0;
virtual bool onUpdateData(const void* src, size_t srcSizeInBytes) = 0;
- GrBufferType fType;
size_t fGpuMemorySize;
GrAccessPattern fAccessPattern;
bool fCPUBacked;
« no previous file with comments | « include/gpu/GrTypesPriv.h ('k') | src/gpu/GrBufferAllocPool.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698