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 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame^] | 11 | #include "src/gpu/GrGpuCommandBuffer.h" |
| 12 | #include "src/gpu/mock/GrMockGpu.h" |
Brian Salomon | cfe910d | 2017-07-06 16:40:18 -0400 | [diff] [blame] | 13 | |
Greg Daniel | 500d58b | 2017-08-24 15:59:33 -0400 | [diff] [blame] | 14 | class GrMockGpuTextureCommandBuffer : public GrGpuTextureCommandBuffer { |
Brian Salomon | cfe910d | 2017-07-06 16:40:18 -0400 | [diff] [blame] | 15 | public: |
Greg Daniel | 500d58b | 2017-08-24 15:59:33 -0400 | [diff] [blame] | 16 | GrMockGpuTextureCommandBuffer(GrTexture* texture, GrSurfaceOrigin origin) |
| 17 | : INHERITED(texture, origin) { |
| 18 | } |
| 19 | |
| 20 | ~GrMockGpuTextureCommandBuffer() override {} |
| 21 | |
Robert Phillips | b0e93a2 | 2017-08-29 08:26:54 -0400 | [diff] [blame] | 22 | void copy(GrSurface* src, GrSurfaceOrigin srcOrigin, const SkIRect& srcRect, |
| 23 | const SkIPoint& dstPoint) override {} |
Greg Daniel | 500d58b | 2017-08-24 15:59:33 -0400 | [diff] [blame] | 24 | void insertEventMarker(const char*) override {} |
| 25 | |
| 26 | private: |
Greg Daniel | 500d58b | 2017-08-24 15:59:33 -0400 | [diff] [blame] | 27 | typedef GrGpuTextureCommandBuffer INHERITED; |
| 28 | }; |
| 29 | |
| 30 | class GrMockGpuRTCommandBuffer : public GrGpuRTCommandBuffer { |
| 31 | public: |
| 32 | GrMockGpuRTCommandBuffer(GrMockGpu* gpu, GrRenderTarget* rt, GrSurfaceOrigin origin) |
Robert Phillips | 19e51dc | 2017-08-09 09:30:51 -0400 | [diff] [blame] | 33 | : INHERITED(rt, origin) |
| 34 | , fGpu(gpu) { |
| 35 | } |
Brian Salomon | cfe910d | 2017-07-06 16:40:18 -0400 | [diff] [blame] | 36 | |
| 37 | GrGpu* gpu() override { return fGpu; } |
Brian Salomon | 943ed79 | 2017-10-30 09:37:55 -0400 | [diff] [blame] | 38 | void inlineUpload(GrOpFlushState*, GrDeferredTextureUploadFn&) override {} |
Robert Phillips | 19e51dc | 2017-08-09 09:30:51 -0400 | [diff] [blame] | 39 | void discard() override {} |
| 40 | void insertEventMarker(const char*) override {} |
Robert Phillips | 9521447 | 2017-08-08 18:00:03 -0400 | [diff] [blame] | 41 | void begin() override {} |
Brian Salomon | cfe910d | 2017-07-06 16:40:18 -0400 | [diff] [blame] | 42 | void end() override {} |
Robert Phillips | b0e93a2 | 2017-08-29 08:26:54 -0400 | [diff] [blame] | 43 | void copy(GrSurface* src, GrSurfaceOrigin srcOrigin, const SkIRect& srcRect, |
| 44 | const SkIPoint& dstPoint) override {} |
Brian Salomon | cfe910d | 2017-07-06 16:40:18 -0400 | [diff] [blame] | 45 | |
| 46 | int numDraws() const { return fNumDraws; } |
| 47 | |
| 48 | private: |
Brian Salomon | 4934890 | 2018-06-26 09:12:38 -0400 | [diff] [blame] | 49 | void onDraw(const GrPrimitiveProcessor&, const GrPipeline&, |
| 50 | const GrPipeline::FixedDynamicState*, const GrPipeline::DynamicStateArrays*, |
| 51 | const GrMesh[], int meshCount, const SkRect& bounds) override { |
Brian Salomon | cfe910d | 2017-07-06 16:40:18 -0400 | [diff] [blame] | 52 | ++fNumDraws; |
| 53 | } |
Brian Osman | 9a9baae | 2018-11-05 15:06:26 -0500 | [diff] [blame] | 54 | void onClear(const GrFixedClip&, const SkPMColor4f&) override {} |
Robert Phillips | 19e51dc | 2017-08-09 09:30:51 -0400 | [diff] [blame] | 55 | void onClearStencilClip(const GrFixedClip&, bool insideStencilMask) override {} |
Brian Salomon | cfe910d | 2017-07-06 16:40:18 -0400 | [diff] [blame] | 56 | |
| 57 | GrMockGpu* fGpu; |
| 58 | int fNumDraws = 0; |
| 59 | |
Greg Daniel | 500d58b | 2017-08-24 15:59:33 -0400 | [diff] [blame] | 60 | typedef GrGpuRTCommandBuffer INHERITED; |
Brian Salomon | cfe910d | 2017-07-06 16:40:18 -0400 | [diff] [blame] | 61 | }; |
| 62 | |
| 63 | #endif |