Brian Salomon | cfe910d | 2017-07-06 16:40:18 -0400 | [diff] [blame] | 1 | /* |
| 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 | |
| 14 | class GrMockGpuCommandBuffer : public GrGpuCommandBuffer { |
| 15 | public: |
Robert Phillips | 19e51dc | 2017-08-09 09:30:51 -0400 | [diff] [blame^] | 16 | GrMockGpuCommandBuffer(GrMockGpu* gpu, GrRenderTarget* rt, GrSurfaceOrigin origin) |
| 17 | : INHERITED(rt, origin) |
| 18 | , fGpu(gpu) { |
| 19 | } |
Brian Salomon | cfe910d | 2017-07-06 16:40:18 -0400 | [diff] [blame] | 20 | |
| 21 | GrGpu* gpu() override { return fGpu; } |
Robert Phillips | 19e51dc | 2017-08-09 09:30:51 -0400 | [diff] [blame^] | 22 | void inlineUpload(GrOpFlushState*, GrDrawOp::DeferredUploadFn&) override {} |
| 23 | void discard() override {} |
| 24 | void insertEventMarker(const char*) override {} |
Robert Phillips | 9521447 | 2017-08-08 18:00:03 -0400 | [diff] [blame] | 25 | void begin() override {} |
Brian Salomon | cfe910d | 2017-07-06 16:40:18 -0400 | [diff] [blame] | 26 | void end() override {} |
| 27 | |
| 28 | int numDraws() const { return fNumDraws; } |
| 29 | |
| 30 | private: |
| 31 | void onSubmit() override { fGpu->submitCommandBuffer(this); } |
| 32 | void onDraw(const GrPipeline&, const GrPrimitiveProcessor&, const GrMesh[], |
| 33 | const GrPipeline::DynamicState[], int meshCount, const SkRect& bounds) override { |
| 34 | ++fNumDraws; |
| 35 | } |
Robert Phillips | 19e51dc | 2017-08-09 09:30:51 -0400 | [diff] [blame^] | 36 | void onClear(const GrFixedClip&, GrColor) override {} |
| 37 | void onClearStencilClip(const GrFixedClip&, bool insideStencilMask) override {} |
Brian Salomon | cfe910d | 2017-07-06 16:40:18 -0400 | [diff] [blame] | 38 | |
| 39 | GrMockGpu* fGpu; |
| 40 | int fNumDraws = 0; |
| 41 | |
| 42 | typedef GrGpuCommandBuffer INHERITED; |
| 43 | }; |
| 44 | |
| 45 | #endif |