aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/mtl/GrMtlGpu.h
diff options
context:
space:
mode:
authorGravatar Timothy Liang <timliang@google.com>2018-07-02 17:03:30 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-07-02 21:34:42 +0000
commitef21d7e47963c716895684f9f397e7cbcdb845ab (patch)
treed8425a1cb4d28bdcbb8c50ed8f9f439da11d5d17 /src/gpu/mtl/GrMtlGpu.h
parent24289e05d55ccdc04ef239c7972d2b52e402ad0f (diff)
implement onreadpixels for metal gpu backend
Bug: skia: Change-Id: I1645f7e4e65766558f2b6744ce28d5f98ce852c6 Reviewed-on: https://skia-review.googlesource.com/138982 Commit-Queue: Timothy Liang <timliang@google.com> Reviewed-by: Greg Daniel <egdaniel@google.com> Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Diffstat (limited to 'src/gpu/mtl/GrMtlGpu.h')
-rw-r--r--src/gpu/mtl/GrMtlGpu.h17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/gpu/mtl/GrMtlGpu.h b/src/gpu/mtl/GrMtlGpu.h
index 22fc733217..f8254031d1 100644
--- a/src/gpu/mtl/GrMtlGpu.h
+++ b/src/gpu/mtl/GrMtlGpu.h
@@ -31,6 +31,13 @@ public:
id<MTLDevice> device() const { return fDevice; }
+ id<MTLCommandBuffer> commandBuffer() const { return fCmdBuffer; }
+
+ enum SyncQueue {
+ kForce_SyncQueue,
+ kSkip_SyncQueue
+ };
+
bool onCopySurface(GrSurface* dst, GrSurfaceOrigin dstOrigin,
GrSurface* src, GrSurfaceOrigin srcOrigin,
const SkIRect& srcRect,
@@ -89,9 +96,7 @@ private:
}
bool onReadPixels(GrSurface* surface, int left, int top, int width, int height, GrColorType,
- void* buffer, size_t rowBytes) override {
- return false;
- }
+ void* buffer, size_t rowBytes) override;
bool onWritePixels(GrSurface*, int left, int top, int width, int height, GrColorType,
const GrMipLevel[], int) override {
@@ -111,6 +116,11 @@ private:
void onFinishFlush(bool insertedSemaphores) override {}
+ // Commits the current command buffer to the queue and then creates a new command buffer. If
+ // sync is set to kForce_SyncQueue, the function will wait for all work in the committed
+ // command buffer to finish before creating a new buffer and returning.
+ void submitCommandBuffer(SyncQueue sync);
+
GrStencilAttachment* createStencilAttachmentForRenderTarget(const GrRenderTarget*,
int width,
int height) override {
@@ -142,6 +152,7 @@ private:
id<MTLDevice> fDevice;
id<MTLCommandQueue> fQueue;
+ id<MTLCommandBuffer> fCmdBuffer;
typedef GrGpu INHERITED;
};