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

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

Issue 2215323003: Start using RenderTargetProxy (omnibus) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update Created 4 years, 1 month 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/GrCopySurfaceBatch.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
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef GrDiscardBatch_DEFINED 8 #ifndef GrDiscardBatch_DEFINED
9 #define GrDiscardBatch_DEFINED 9 #define GrDiscardBatch_DEFINED
10 10
11 #include "GrBatch.h" 11 #include "GrBatch.h"
12 #include "GrBatchFlushState.h" 12 #include "GrBatchFlushState.h"
13 #include "GrGpu.h" 13 #include "GrGpu.h"
14 #include "GrRenderTarget.h" 14 #include "GrRenderTarget.h"
15 15
16 class GrDiscardBatch final : public GrBatch { 16 class GrDiscardBatch final : public GrBatch {
17 public: 17 public:
18 DEFINE_BATCH_CLASS_ID 18 DEFINE_BATCH_CLASS_ID
19 19
20 GrDiscardBatch(GrRenderTarget* rt) 20 GrDiscardBatch(GrRenderTargetProxy* rtp)
21 : INHERITED(ClassID()) 21 : INHERITED(ClassID())
22 , fRenderTarget(rt) { 22 , fRenderTargetProxy(rtp) {
23 this->setBounds(SkRect::MakeIWH(rt->width(), rt->height()), HasAABloat:: kNo, 23 this->setBounds(SkRect::MakeIWH(rtp->width(), rtp->height()), HasAABloat ::kNo,
24 IsZeroArea::kNo); 24 IsZeroArea::kNo);
25 } 25 }
26 26
27 const char* name() const override { return "Discard"; } 27 const char* name() const override { return "Discard"; }
28 28
29 uint32_t renderTargetUniqueID() const override { return fRenderTarget.get()- >uniqueID(); } 29 uint32_t renderTargetUniqueID() const override { return fRenderTargetProxy.g et()->uniqueID(); }
30 GrRenderTarget* renderTarget() const override { return fRenderTarget.get(); } 30 GrRenderTargetProxy* rtp() const override { return fRenderTargetProxy.get(); }
31 31
32 SkString dumpInfo() const override { 32 SkString dumpInfo() const override {
33 SkString string; 33 SkString string;
34 string.printf("RT: %d", fRenderTarget.get()->uniqueID()); 34 string.printf("RT: %d", fRenderTargetProxy.get()->uniqueID());
35 string.append(INHERITED::dumpInfo()); 35 string.append(INHERITED::dumpInfo());
36 return string; 36 return string;
37 } 37 }
38 38
39 private: 39 private:
40 bool onCombineIfPossible(GrBatch* that, const GrCaps& caps) override { 40 bool onCombineIfPossible(GrBatch* that, const GrCaps& caps) override {
41 return this->renderTargetUniqueID() == that->renderTargetUniqueID(); 41 return this->renderTargetUniqueID() == that->renderTargetUniqueID();
42 } 42 }
43 43
44 void onPrepare(GrBatchFlushState*) override {} 44 void onPrepare(GrBatchFlushState*) override {}
45 45
46 void onDraw(GrBatchFlushState* state, const SkRect& /*bounds*/) override { 46 void onDraw(GrBatchFlushState* state, const SkRect& /*bounds*/) override {
47 state->commandBuffer()->discard(); 47 state->commandBuffer()->discard();
48 } 48 }
49 49
50 GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> fRenderTarget; 50 GrPendingIOResource<GrRenderTargetProxy, kWrite_GrIOType> fRenderTargetProxy ;
51 51
52 typedef GrBatch INHERITED; 52 typedef GrBatch INHERITED;
53 }; 53 };
54 54
55 #endif 55 #endif
OLDNEW
« no previous file with comments | « src/gpu/batches/GrCopySurfaceBatch.h ('k') | src/gpu/batches/GrDrawBatch.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698