blob: c5719a51707ee12903b68f07558422eac65a28a0 [file] [log] [blame]
Brian Salomoncfe910d2017-07-06 16:40:18 -04001/*
2 * Copyright 2017 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 GrMockGpuCommandBuffer_DEFINED
9#define GrMockGpuCommandBuffer_DEFINED
10
11#include "GrGpuCommandBuffer.h"
12#include "GrMockGpu.h"
13
14class GrMockGpuCommandBuffer : public GrGpuCommandBuffer {
15public:
16 GrMockGpuCommandBuffer(GrMockGpu* gpu) : fGpu(gpu) {}
17
18 GrGpu* gpu() override { return fGpu; }
19 void inlineUpload(GrOpFlushState*, GrDrawOp::DeferredUploadFn&, GrRenderTarget*) override {}
20 void discard(GrRenderTarget*) override {}
21 void end() override {}
22
23 int numDraws() const { return fNumDraws; }
24
25private:
26 void onSubmit() override { fGpu->submitCommandBuffer(this); }
27 void onDraw(const GrPipeline&, const GrPrimitiveProcessor&, const GrMesh[],
28 const GrPipeline::DynamicState[], int meshCount, const SkRect& bounds) override {
29 ++fNumDraws;
30 }
31 void onClear(GrRenderTarget*, const GrFixedClip&, GrColor) override {}
32 void onClearStencilClip(GrRenderTarget*, const GrFixedClip&, bool insideStencilMask) override {}
33 GrRenderTarget* renderTarget() override { return nullptr; }
34
35 GrMockGpu* fGpu;
36 int fNumDraws = 0;
37
38 typedef GrGpuCommandBuffer INHERITED;
39};
40
41#endif