blob: d30aa5a8c54ac2217bcf8fd82b90dc215b96e00d [file] [log] [blame]
Robert Phillips54190c42017-08-09 20:09:38 +00001/*
2 * Copyright 2015 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 GrDiscardOp_DEFINED
9#define GrDiscardOp_DEFINED
10
11#include "GrGpuCommandBuffer.h"
12#include "GrOp.h"
13#include "GrOpFlushState.h"
14#include "GrRenderTargetProxy.h"
15
16class GrDiscardOp final : public GrOp {
17public:
18 DEFINE_OP_CLASS_ID
19
20 static std::unique_ptr<GrOp> Make(GrRenderTargetProxy* proxy) {
21 return std::unique_ptr<GrOp>(new GrDiscardOp(proxy));
22 }
23
24 const char* name() const override { return "Discard"; }
25
26 SkString dumpInfo() const override {
27 SkString string;
28 string.append(INHERITED::dumpInfo());
29 return string;
30 }
31
32private:
33 GrDiscardOp(GrRenderTargetProxy* proxy) : INHERITED(ClassID()) {
34 this->makeFullScreen(proxy);
35 }
36
37 bool onCombineIfPossible(GrOp* that, const GrCaps& caps) override { return false; }
38
39 void onPrepare(GrOpFlushState*) override {}
40
41 void onExecute(GrOpFlushState* state) override {
42 state->commandBuffer()->discard();
43 }
44
45 typedef GrOp INHERITED;
46};
47
48#endif