blob: aa753783d6ad71079a6f8fb0f3178783f10ee5aa [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
Mike Kleinc0bd9f92019-04-23 12:05:21 -050011#include "src/gpu/GrGpuCommandBuffer.h"
12#include "src/gpu/mock/GrMockGpu.h"
Brian Salomoncfe910d2017-07-06 16:40:18 -040013
Greg Daniel500d58b2017-08-24 15:59:33 -040014class GrMockGpuTextureCommandBuffer : public GrGpuTextureCommandBuffer {
Brian Salomoncfe910d2017-07-06 16:40:18 -040015public:
Greg Daniel500d58b2017-08-24 15:59:33 -040016 GrMockGpuTextureCommandBuffer(GrTexture* texture, GrSurfaceOrigin origin)
17 : INHERITED(texture, origin) {
18 }
19
20 ~GrMockGpuTextureCommandBuffer() override {}
21
Greg Daniel46cfbc62019-06-07 11:43:30 -040022 void copy(GrSurface* src, const SkIRect& srcRect, const SkIPoint& dstPoint) override {}
Brian Salomonf77c1462019-08-01 15:19:29 -040023 void transferFrom(const SkIRect& srcRect, GrColorType surfaceColorType,
24 GrColorType bufferColorType, GrGpuBuffer* transferBuffer,
25 size_t offset) override {}
Greg Daniel500d58b2017-08-24 15:59:33 -040026 void insertEventMarker(const char*) override {}
27
28private:
Greg Daniel500d58b2017-08-24 15:59:33 -040029 typedef GrGpuTextureCommandBuffer INHERITED;
30};
31
32class GrMockGpuRTCommandBuffer : public GrGpuRTCommandBuffer {
33public:
34 GrMockGpuRTCommandBuffer(GrMockGpu* gpu, GrRenderTarget* rt, GrSurfaceOrigin origin)
Robert Phillips19e51dc2017-08-09 09:30:51 -040035 : INHERITED(rt, origin)
36 , fGpu(gpu) {
37 }
Brian Salomoncfe910d2017-07-06 16:40:18 -040038
39 GrGpu* gpu() override { return fGpu; }
Brian Salomon943ed792017-10-30 09:37:55 -040040 void inlineUpload(GrOpFlushState*, GrDeferredTextureUploadFn&) override {}
Robert Phillips19e51dc2017-08-09 09:30:51 -040041 void insertEventMarker(const char*) override {}
Robert Phillips95214472017-08-08 18:00:03 -040042 void begin() override {}
Brian Salomoncfe910d2017-07-06 16:40:18 -040043 void end() override {}
Greg Daniel46cfbc62019-06-07 11:43:30 -040044 void copy(GrSurface* src, const SkIRect& srcRect, const SkIPoint& dstPoint) override {}
Brian Salomonf77c1462019-08-01 15:19:29 -040045 void transferFrom(const SkIRect& srcRect, GrColorType surfaceColorType,
46 GrColorType bufferColorType, GrGpuBuffer* transferBuffer,
47 size_t offset) override {}
Brian Salomoncfe910d2017-07-06 16:40:18 -040048
49 int numDraws() const { return fNumDraws; }
50
51private:
Brian Salomon49348902018-06-26 09:12:38 -040052 void onDraw(const GrPrimitiveProcessor&, const GrPipeline&,
53 const GrPipeline::FixedDynamicState*, const GrPipeline::DynamicStateArrays*,
54 const GrMesh[], int meshCount, const SkRect& bounds) override {
Brian Salomoncfe910d2017-07-06 16:40:18 -040055 ++fNumDraws;
56 }
Brian Osman9a9baae2018-11-05 15:06:26 -050057 void onClear(const GrFixedClip&, const SkPMColor4f&) override {}
Robert Phillips19e51dc2017-08-09 09:30:51 -040058 void onClearStencilClip(const GrFixedClip&, bool insideStencilMask) override {}
Brian Salomoncfe910d2017-07-06 16:40:18 -040059
60 GrMockGpu* fGpu;
61 int fNumDraws = 0;
62
Greg Daniel500d58b2017-08-24 15:59:33 -040063 typedef GrGpuRTCommandBuffer INHERITED;
Brian Salomoncfe910d2017-07-06 16:40:18 -040064};
65
66#endif