aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl/GrGLBuffer.h
diff options
context:
space:
mode:
authorGravatar cdalton <cdalton@nvidia.com>2016-04-06 14:26:33 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-04-06 14:26:34 -0700
commitdeacc97bc63513b5eacaf21f858727f6e8b98ce5 (patch)
tree4c4c0f5e995f752b076c39fdf6c4eafc3057fdf4 /src/gpu/gl/GrGLBuffer.h
parent48156ed412410c9d27b560e8596e3f34d175a277 (diff)
Track GL buffer state based on unique resource ID
Reworks GrGLGpu to track GL buffer state based on the unique GrGpuResource ID. This eliminates the need to notify the gpu object whenever a buffer is deleted. This change also allows us to remove the type specifier from GrBuffer. At this point a buffer is just a chunk of memory, and the type given at creation time is just a suggestion to the GL backend about which target to bind to for updates. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1854283004 Review URL: https://codereview.chromium.org/1854283004
Diffstat (limited to 'src/gpu/gl/GrGLBuffer.h')
-rw-r--r--src/gpu/gl/GrGLBuffer.h21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/gpu/gl/GrGLBuffer.h b/src/gpu/gl/GrGLBuffer.h
index 90d2c43dfa..b3b4feb002 100644
--- a/src/gpu/gl/GrGLBuffer.h
+++ b/src/gpu/gl/GrGLBuffer.h
@@ -16,19 +16,20 @@ class GrGLCaps;
class GrGLBuffer : public GrBuffer {
public:
- static GrGLBuffer* Create(GrGLGpu*, GrBufferType, size_t size, GrAccessPattern);
+ static GrGLBuffer* Create(GrGLGpu*, size_t size, GrBufferType intendedType, GrAccessPattern,
+ const void* data = nullptr);
~GrGLBuffer() {
// either release or abandon should have been called by the owner of this object.
SkASSERT(0 == fBufferID);
}
- GrGLenum target() const { return fTarget; }
GrGLuint bufferID() const { return fBufferID; }
size_t baseOffset() const { return reinterpret_cast<size_t>(fCPUData); }
protected:
- GrGLBuffer(GrGLGpu*, GrBufferType, size_t size, GrAccessPattern, bool cpuBacked);
+ GrGLBuffer(GrGLGpu*, size_t size, GrBufferType intendedType, GrAccessPattern, bool cpuBacked,
+ const void* data);
void onAbandon() override;
void onRelease() override;
@@ -47,13 +48,13 @@ private:
void validate() const;
#endif
- void* fCPUData;
- GrGLenum fTarget; // GL_ARRAY_BUFFER or GL_ELEMENT_ARRAY_BUFFER, e.g.
- GrGLuint fBufferID;
- size_t fSizeInBytes;
- GrGLenum fUsage;
- size_t fGLSizeInBytes; // In certain cases we make the size of the GL buffer object
- // smaller or larger than the size in fDesc.
+ void* fCPUData;
+ GrBufferType fIntendedType;
+ GrGLuint fBufferID;
+ size_t fSizeInBytes;
+ GrGLenum fUsage;
+ size_t fGLSizeInBytes; // In certain cases we make the size of the GL buffer object
+ // smaller or larger than the size in fDesc.
typedef GrBuffer INHERITED;
};