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