From 6081ebb6892e1779678b9d638f4b2a398e412f00 Mon Sep 17 00:00:00 2001 From: Chris Dalton Date: Tue, 20 Jun 2017 11:35:59 -0700 Subject: Add makeBuffer and caps to GrOnFlushResourceProvider Bug: skia: Change-Id: Ie3101ca20743a953621815bdae886c995d39c9e6 Reviewed-on: https://skia-review.googlesource.com/20315 Reviewed-by: Robert Phillips Commit-Queue: Chris Dalton --- src/gpu/GrOnFlushResourceProvider.cpp | 11 +++++++++++ src/gpu/GrOnFlushResourceProvider.h | 5 +++++ 2 files changed, 16 insertions(+) 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 GrOnFlushResourceProvider::makeRenderTargetContext( return renderTargetContext; } +sk_sp GrOnFlushResourceProvider::makeBuffer(GrBufferType intendedType, size_t size, + const void* data) { + GrResourceProvider* rp = fDrawingMgr->getContext()->resourceProvider(); + return sk_sp(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 colorSpace, const SkSurfaceProps* props); + // Creates a GPU buffer with a "dynamic" access pattern. + sk_sp makeBuffer(GrBufferType, size_t, const void* data = nullptr); + + const GrCaps* caps() const; + private: explicit GrOnFlushResourceProvider(GrDrawingManager* drawingMgr) : fDrawingMgr(drawingMgr) {} GrOnFlushResourceProvider(const GrOnFlushResourceProvider&) = delete; -- cgit v1.2.3