aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/gpu/GrOnFlushResourceProvider.cpp11
-rw-r--r--src/gpu/GrOnFlushResourceProvider.h5
2 files changed, 16 insertions, 0 deletions
diff --git a/src/gpu/GrOnFlushResourceProvider.cpp b/src/gpu/GrOnFlushResourceProvider.cpp
index 7ecf63a54f..4ca773f000 100644
--- a/src/gpu/GrOnFlushResourceProvider.cpp
+++ b/src/gpu/GrOnFlushResourceProvider.cpp
@@ -64,3 +64,14 @@ sk_sp<GrRenderTargetContext> GrOnFlushResourceProvider::makeRenderTargetContext(
return renderTargetContext;
}
+sk_sp<GrBuffer> GrOnFlushResourceProvider::makeBuffer(GrBufferType intendedType, size_t size,
+ const void* data) {
+ GrResourceProvider* rp = fDrawingMgr->getContext()->resourceProvider();
+ return sk_sp<GrBuffer>(rp->createBuffer(size, intendedType, kDynamic_GrAccessPattern,
+ GrResourceProvider::kNoPendingIO_Flag,
+ data));
+}
+
+const GrCaps* GrOnFlushResourceProvider::caps() const {
+ return fDrawingMgr->getContext()->caps();
+}
diff --git a/src/gpu/GrOnFlushResourceProvider.h b/src/gpu/GrOnFlushResourceProvider.h
index 6b2570a3ac..fdf34fe40a 100644
--- a/src/gpu/GrOnFlushResourceProvider.h
+++ b/src/gpu/GrOnFlushResourceProvider.h
@@ -68,6 +68,11 @@ public:
sk_sp<SkColorSpace> colorSpace,
const SkSurfaceProps* props);
+ // Creates a GPU buffer with a "dynamic" access pattern.
+ sk_sp<GrBuffer> makeBuffer(GrBufferType, size_t, const void* data = nullptr);
+
+ const GrCaps* caps() const;
+
private:
explicit GrOnFlushResourceProvider(GrDrawingManager* drawingMgr) : fDrawingMgr(drawingMgr) {}
GrOnFlushResourceProvider(const GrOnFlushResourceProvider&) = delete;