LCOV - code coverage report
Current view: top level - gfx/skia/skia/src/gpu - GrOpList.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 35 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 7 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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 "GrOpList.h"
       9             : 
      10             : #include "GrRenderTargetOpList.h"
      11             : #include "GrSurface.h"
      12             : #include "GrSurfaceProxy.h"
      13             : 
      14           0 : uint32_t GrOpList::CreateUniqueID() {
      15             :     static int32_t gUniqueID = SK_InvalidUniqueID;
      16             :     uint32_t id;
      17             :     // Loop in case our global wraps around, as we never want to return a 0.
      18           0 :     do {
      19           0 :         id = static_cast<uint32_t>(sk_atomic_inc(&gUniqueID) + 1);
      20           0 :     } while (id == SK_InvalidUniqueID);
      21           0 :     return id;
      22             : }
      23             : 
      24           0 : GrOpList::GrOpList(GrSurfaceProxy* surfaceProxy, GrAuditTrail* auditTrail)
      25           0 :     : fUniqueID(CreateUniqueID())
      26             :     , fFlags(0)
      27             :     , fTarget(surfaceProxy)
      28           0 :     , fAuditTrail(auditTrail) {
      29             : 
      30           0 :     surfaceProxy->setLastOpList(this);
      31           0 : }
      32             : 
      33           0 : GrOpList::~GrOpList() {
      34           0 :     if (fTarget && this == fTarget->getLastOpList()) {
      35           0 :         fTarget->setLastOpList(nullptr);
      36             :     }
      37           0 : }
      38             : 
      39             : // Add a GrOpList-based dependency
      40           0 : void GrOpList::addDependency(GrOpList* dependedOn) {
      41           0 :     SkASSERT(!dependedOn->dependsOn(this));  // loops are bad
      42             : 
      43           0 :     if (this->dependsOn(dependedOn)) {
      44           0 :         return;  // don't add duplicate dependencies
      45             :     }
      46             : 
      47           0 :     *fDependencies.push() = dependedOn;
      48             : }
      49             : 
      50             : // Convert from a GrSurface-based dependency to a GrOpList one
      51           0 : void GrOpList::addDependency(GrSurface* dependedOn) {
      52           0 :     if (dependedOn->getLastOpList()) {
      53             :         // If it is still receiving dependencies, this GrOpList shouldn't be closed
      54           0 :         SkASSERT(!this->isClosed());
      55             : 
      56           0 :         GrOpList* opList = dependedOn->getLastOpList();
      57           0 :         if (opList == this) {
      58             :             // self-read - presumably for dst reads
      59             :         } else {
      60           0 :             this->addDependency(opList);
      61             : 
      62             :             // Can't make it closed in the self-read case
      63           0 :             opList->makeClosed();
      64             :         }
      65             :     }
      66           0 : }
      67             : 
      68             : #ifdef SK_DEBUG
      69           0 : void GrOpList::dump() const {
      70           0 :     SkDebugf("--------------------------------------------------------------\n");
      71           0 :     SkDebugf("node: %d -> RT: %d\n", fUniqueID, fTarget ? fTarget->uniqueID().asUInt() : -1);
      72           0 :     SkDebugf("relies On (%d): ", fDependencies.count());
      73           0 :     for (int i = 0; i < fDependencies.count(); ++i) {
      74           0 :         SkDebugf("%d, ", fDependencies[i]->fUniqueID);
      75             :     }
      76           0 :     SkDebugf("\n");
      77           0 : }
      78             : #endif

Generated by: LCOV version 1.13