blob: df1738d4e8c7eae8bb604794e73ccf19c7056033 [file] [log] [blame]
Timothy Liange70604e2018-07-19 09:49:46 -04001/*
2 * Copyright 2018 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef GrMtlGpuCommandBuffer_DEFINED
9#define GrMtlGpuCommandBuffer_DEFINED
10
11#include "GrGpuCommandBuffer.h"
12
13class GrMtlGpu;
14class GrMtlRenderTarget;
15
16class GrMtlGpuTextureCommandBuffer : public GrGpuTextureCommandBuffer {
17public:
18 GrMtlGpuTextureCommandBuffer(GrMtlGpu* gpu, GrTexture* texture, GrSurfaceOrigin origin)
19 : INHERITED(texture, origin)
20 , fGpu(gpu) {
Timothy Liange70604e2018-07-19 09:49:46 -040021 }
22
23 ~GrMtlGpuTextureCommandBuffer() override {}
24
25 void copy(GrSurface* src, GrSurfaceOrigin srcOrigin, const SkIRect& srcRect,
Timothy Liange35055f2018-07-20 16:53:00 -040026 const SkIPoint& dstPoint) override {
27 fGpu->copySurface(fTexture, fOrigin, src, srcOrigin, srcRect, dstPoint);
28 }
Timothy Liange70604e2018-07-19 09:49:46 -040029
30 void insertEventMarker(const char* msg) override {}
31
32private:
33 void submit() override {}
34
35 GrMtlGpu* fGpu;
36
37 typedef GrGpuTextureCommandBuffer INHERITED;
38};
39
40class GrMtlGpuRTCommandBuffer : public GrGpuRTCommandBuffer {
41public:
42 GrMtlGpuRTCommandBuffer(GrMtlGpu* gpu, GrRenderTarget* rt, GrSurfaceOrigin origin,
43 const GrGpuRTCommandBuffer::LoadAndStoreInfo& colorInfo,
44 const GrGpuRTCommandBuffer::StencilLoadAndStoreInfo& stencilInfo)
45 : INHERITED(rt, origin)
46 , fGpu(gpu)
47 , fColorLoadAndStoreInfo(colorInfo)
48 , fStencilLoadAndStoreInfo(stencilInfo) {
49 // Silence unused var warning
50 (void)fColorLoadAndStoreInfo;
51 (void)fStencilLoadAndStoreInfo;
52 }
53
54 ~GrMtlGpuRTCommandBuffer() override {}
55
56 void begin() override {}
57 void end() override {}
58
59 void discard() override {}
60
61 void insertEventMarker(const char* msg) override {}
62
63 void inlineUpload(GrOpFlushState* state, GrDeferredTextureUploadFn& upload) override {}
64
65 void copy(GrSurface* src, GrSurfaceOrigin srcOrigin, const SkIRect& srcRect,
Timothy Liange35055f2018-07-20 16:53:00 -040066 const SkIPoint& dstPoint) override {
67 fGpu->copySurface(fRenderTarget, fOrigin, src, srcOrigin, srcRect, dstPoint);
68 }
Timothy Liange70604e2018-07-19 09:49:46 -040069
70 void submit() override {}
71
72private:
73 GrGpu* gpu() override { return fGpu; }
74
75 void onDraw(const GrPrimitiveProcessor& primProc,
76 const GrPipeline& pipeline,
77 const GrPipeline::FixedDynamicState* fixedDynamicState,
78 const GrPipeline::DynamicStateArrays* dynamicStateArrays,
79 const GrMesh mesh[],
80 int meshCount,
81 const SkRect& bounds) override {}
82
83 void onClear(const GrFixedClip& clip, GrColor color) override {}
84
85 void onClearStencilClip(const GrFixedClip& clip, bool insideStencilMask) override {}
86
87 GrMtlGpu* fGpu;
88 GrGpuRTCommandBuffer::LoadAndStoreInfo fColorLoadAndStoreInfo;
89 GrGpuRTCommandBuffer::StencilLoadAndStoreInfo fStencilLoadAndStoreInfo;
90
91 typedef GrGpuRTCommandBuffer INHERITED;
92};
93
94#endif
95