Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: src/gpu/batches/GrDiscardBatch.h

Issue 1293563003: Put clear and discard into GrBatch. (Closed) Base URL: https://skia.googlesource.com/skia.git@protectedprepare
Patch Set: tiny Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/batches/GrClearBatch.h ('k') | src/gpu/batches/GrDrawBatch.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
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 GrDiscardBatch_DEFINED
9 #define GrDiscardBatch_DEFINED
10
11 #include "GrBatch.h"
12 #include "GrBatchFlushState.h"
13 #include "GrGpu.h"
14 #include "GrRenderTarget.h"
15
16 class GrDiscardBatch final : public GrBatch {
17 public:
18 GrDiscardBatch(GrRenderTarget* rt)
19 : fRenderTarget(rt) {
20 this->initClassID<GrDiscardBatch>();
21 fBounds = SkRect::MakeWH(SkIntToScalar(rt->width()), SkIntToScalar(rt->h eight()));
22 }
23
24 const char* name() const override { return "Discard"; }
25
26 uint32_t renderTargetUniqueID() const override { return fRenderTarget.get()- >getUniqueID(); }
27
28 SkString dumpInfo() const {
29 SkString string;
30 string.printf("RT: 0x%p", fRenderTarget.get());
31 return string;
32 }
33
34 private:
35 bool onCombineIfPossible(GrBatch* that, const GrCaps& caps) override {
36 return fRenderTarget == that->cast<GrDiscardBatch>()->fRenderTarget;
37 }
38
39 void onPrepare(GrBatchFlushState*) override {}
40
41 void onDraw(GrBatchFlushState* state) override {
42 state->gpu()->discard(fRenderTarget.get());
43 }
44
45 GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> fRenderTarget;
46 };
47
48 #endif
OLDNEW
« no previous file with comments | « src/gpu/batches/GrClearBatch.h ('k') | src/gpu/batches/GrDrawBatch.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698