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