aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Chris Dalton <csmartdalton@google.com>2017-06-20 11:35:59 -0700
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-06-20 19:08:19 +0000
commit6081ebb6892e1779678b9d638f4b2a398e412f00 (patch)
treee9faf01868d7a1b90eae63992c3a87133fd5e1ad
parentffa8484eb0610048a0e8cc4f1594fd9607c5b555 (diff)
Add makeBuffer and caps to GrOnFlushResourceProvider
Bug: skia: Change-Id: Ie3101ca20743a953621815bdae886c995d39c9e6 Reviewed-on: https://skia-review.googlesource.com/20315 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Chris Dalton <csmartdalton@google.com>
-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;