Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
GrMockOpsRenderPass.h
Go to the documentation of this file.
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 GrMockOpsRenderPass_DEFINED
9#define GrMockOpsRenderPass_DEFINED
10
18
19#include <array>
20#include <cstddef>
21#include <cstdint>
22
23class GrBuffer;
25class GrGpu;
26class GrOpFlushState;
27class GrPipeline;
28class GrProgramInfo;
29class GrScissorState;
30class GrSurfaceProxy;
31enum GrSurfaceOrigin : int;
32struct SkIRect;
33struct SkRect;
34
36public:
38 LoadAndStoreInfo colorInfo)
39 : INHERITED(rt, origin)
40 , fGpu(gpu)
41 , fColorLoadOp(colorInfo.fLoadOp) {
42 }
43
44 GrGpu* gpu() override { return fGpu; }
46
47 int numDraws() const { return fNumDraws; }
48
49private:
50 void onBegin() override {
51 if (GrLoadOp::kClear == fColorLoadOp) {
52 this->markRenderTargetDirty();
53 }
54 }
55 bool onBindPipeline(const GrProgramInfo&, const SkRect&) override { return true; }
56 void onSetScissorRect(const SkIRect&) override {}
58 const GrSurfaceProxy* const geomProcTextures[],
59 const GrPipeline&) override {
60 return true;
61 }
63 sk_sp<const GrBuffer> vertexBuffer, GrPrimitiveRestart) override {}
64 void onDraw(int, int) override { this->noopDraw(); }
65 void onDrawIndexed(int, int, uint16_t, uint16_t, int) override { this->noopDraw(); }
66 void onDrawInstanced(int, int, int, int) override { this->noopDraw(); }
67 void onDrawIndexedInstanced(int, int, int, int, int) override { this->noopDraw(); }
68 void onDrawIndirect(const GrBuffer*, size_t, int) override { this->noopDraw(); }
69 void onDrawIndexedIndirect(const GrBuffer*, size_t, int) override { this->noopDraw(); }
70 void onClear(const GrScissorState& scissor, std::array<float, 4>) override {
71 this->markRenderTargetDirty();
72 }
73 void onClearStencilClip(const GrScissorState& scissor, bool insideStencilMask) override {}
74 void noopDraw() {
75 this->markRenderTargetDirty();
76 ++fNumDraws;
77 }
78 void markRenderTargetDirty() {
79 if (auto* tex = fRenderTarget->asTexture()) {
80 tex->markMipmapsDirty();
81 }
82 }
83
84 GrMockGpu* fGpu;
85 GrLoadOp fColorLoadOp;
86 int fNumDraws = 0;
87
88 using INHERITED = GrOpsRenderPass;
89};
90
91#endif
std::function< void(GrDeferredTextureUploadWritePixelsFn &)> GrDeferredTextureUploadFn
GrPrimitiveRestart
Definition GrTypesPriv.h:55
GrLoadOp
GrSurfaceOrigin
Definition GrTypes.h:147
Type::kYUV Type::kRGBA() int(0.7 *637)
Definition GrGpu.h:62
GrGpu * gpu() override
void onSetScissorRect(const SkIRect &) override
GrMockOpsRenderPass(GrMockGpu *gpu, GrRenderTarget *rt, GrSurfaceOrigin origin, LoadAndStoreInfo colorInfo)
void onDrawIndexedInstanced(int, int, int, int, int) override
void onDrawInstanced(int, int, int, int) override
void onDrawIndirect(const GrBuffer *, size_t, int) override
void onDrawIndexedIndirect(const GrBuffer *, size_t, int) override
void onClearStencilClip(const GrScissorState &scissor, bool insideStencilMask) override
void onDraw(int, int) override
void inlineUpload(GrOpFlushState *, GrDeferredTextureUploadFn &) override
void onBindBuffers(sk_sp< const GrBuffer > indexBuffer, sk_sp< const GrBuffer > instanceBuffer, sk_sp< const GrBuffer > vertexBuffer, GrPrimitiveRestart) override
void onDrawIndexed(int, int, uint16_t, uint16_t, int) override
bool onBindTextures(const GrGeometryProcessor &, const GrSurfaceProxy *const geomProcTextures[], const GrPipeline &) override
bool onBindPipeline(const GrProgramInfo &, const SkRect &) override
void onClear(const GrScissorState &scissor, std::array< float, 4 >) override
GrRenderTarget * fRenderTarget
virtual GrTexture * asTexture()
Definition GrSurface.h:59