• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1  /*
2   * Copyright 2016 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  #include "src/gpu/GrMemoryPool.h"
9  #include "src/gpu/GrOpList.h"
10  
GrOpList(sk_sp<GrOpMemoryPool> opMemoryPool,sk_sp<GrSurfaceProxy> surfaceProxy,GrAuditTrail * auditTrail)11  GrOpList::GrOpList(sk_sp<GrOpMemoryPool> opMemoryPool,
12                     sk_sp<GrSurfaceProxy> surfaceProxy,
13                     GrAuditTrail* auditTrail)
14          : GrRenderTask(std::move(surfaceProxy))
15          , fOpMemoryPool(std::move(opMemoryPool))
16          , fAuditTrail(auditTrail) {
17      SkASSERT(fOpMemoryPool);
18  }
19  
~GrOpList()20  GrOpList::~GrOpList() {
21  }
22  
endFlush()23  void GrOpList::endFlush() {
24      if (fTarget && this == fTarget->getLastRenderTask()) {
25          fTarget->setLastRenderTask(nullptr);
26      }
27  
28      fTarget.reset();
29      fDeferredProxies.reset();
30      fAuditTrail = nullptr;
31  }
32  
33  #ifdef SK_DEBUG
op_to_name(GrLoadOp op)34  static const char* op_to_name(GrLoadOp op) {
35      return GrLoadOp::kLoad == op ? "load" : GrLoadOp::kClear == op ? "clear" : "discard";
36  }
37  
dump(bool printDependencies) const38  void GrOpList::dump(bool printDependencies) const {
39      GrRenderTask::dump(printDependencies);
40      SkDebugf("ColorLoadOp: %s %x StencilLoadOp: %s\n",
41               op_to_name(fColorLoadOp),
42               GrLoadOp::kClear == fColorLoadOp ? fLoadClearColor.toBytes_RGBA() : 0x0,
43               op_to_name(fStencilLoadOp));
44  }
45  #endif
46