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

          Line data    Source code
       1             : /*
       2             :  * Copyright 2011 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             : 
       9             : #ifndef GrGLRenderTarget_DEFINED
      10             : #define GrGLRenderTarget_DEFINED
      11             : 
      12             : #include "GrGLIRect.h"
      13             : #include "GrRenderTarget.h"
      14             : #include "SkScalar.h"
      15             : 
      16             : class GrGLCaps;
      17             : class GrGLGpu;
      18             : class GrGLStencilAttachment;
      19             : 
      20           0 : class GrGLRenderTarget : public GrRenderTarget {
      21             : public:
      22             :     // set fTexFBOID to this value to indicate that it is multisampled but
      23             :     // Gr doesn't know how to resolve it.
      24             :     enum { kUnresolvableFBOID = 0 };
      25             : 
      26             :     struct IDDesc {
      27             :         GrGLuint                   fRTFBOID;
      28             :         GrBackendObjectOwnership   fRTFBOOwnership;
      29             :         GrGLuint                   fTexFBOID;
      30             :         GrGLuint                   fMSColorRenderbufferID;
      31             :         bool                       fIsMixedSampled;
      32             :     };
      33             : 
      34             :     static sk_sp<GrGLRenderTarget> MakeWrapped(GrGLGpu*,
      35             :                                                const GrSurfaceDesc&,
      36             :                                                const IDDesc&,
      37             :                                                int stencilBits);
      38             : 
      39             :     void setViewport(const GrGLIRect& rect) { fViewport = rect; }
      40           0 :     const GrGLIRect& getViewport() const { return fViewport; }
      41             : 
      42             :     // The following two functions return the same ID when a texture/render target is not
      43             :     // multisampled, and different IDs when it is multisampled.
      44             :     // FBO ID used to render into
      45           0 :     GrGLuint renderFBOID() const { return fRTFBOID; }
      46             :     // FBO ID that has texture ID attached.
      47           0 :     GrGLuint textureFBOID() const { return fTexFBOID; }
      48             : 
      49             :     // override of GrRenderTarget
      50           0 :     ResolveType getResolveType() const override {
      51           0 :         if (!this->isUnifiedMultisampled() ||
      52           0 :             fRTFBOID == fTexFBOID) {
      53             :             // catches FBO 0 and non MSAA case
      54           0 :             return kAutoResolves_ResolveType;
      55           0 :         } else if (kUnresolvableFBOID == fTexFBOID) {
      56           0 :             return kCantResolve_ResolveType;
      57             :         } else {
      58           0 :             return kCanResolve_ResolveType;
      59             :         }
      60             :     }
      61             : 
      62           0 :     GrBackendObject getRenderTargetHandle() const override { return fRTFBOID; }
      63             : 
      64             :     bool canAttemptStencilAttachment() const override;
      65             : 
      66             :     // GrGLRenderTarget overrides dumpMemoryStatistics so it can log its texture and renderbuffer
      67             :     // components seperately.
      68             :     void dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const override;
      69             : 
      70             : protected:
      71             :     // Constructor for subclasses.
      72             :     GrGLRenderTarget(GrGLGpu*, const GrSurfaceDesc&, const IDDesc&);
      73             : 
      74             :     void init(const GrSurfaceDesc&, const IDDesc&);
      75             : 
      76             :     void onAbandon() override;
      77             :     void onRelease() override;
      78             : 
      79           0 :     int numSamplesOwnedPerPixel() const { return fNumSamplesOwnedPerPixel; }
      80             : 
      81             : private:
      82             :     // Constructor for instances wrapping backend objects.
      83             :     GrGLRenderTarget(GrGLGpu*, const GrSurfaceDesc&, const IDDesc&, GrGLStencilAttachment*);
      84             : 
      85             :     static Flags ComputeFlags(const GrGLCaps&, const IDDesc&);
      86             : 
      87             :     GrGLGpu* getGLGpu() const;
      88             :     bool completeStencilAttachment() override;
      89             : 
      90             :     size_t onGpuMemorySize() const override;
      91             : 
      92             :     int msaaSamples() const;
      93             :     // The number total number of samples, including both MSAA and resolve texture samples.
      94             :     int totalSamples() const;
      95             : 
      96             :     GrGLuint    fRTFBOID;
      97             :     GrGLuint    fTexFBOID;
      98             :     GrGLuint    fMSColorRenderbufferID;
      99             : 
     100             :     GrBackendObjectOwnership fRTFBOOwnership;
     101             : 
     102             :     // when we switch to this render target we want to set the viewport to
     103             :     // only render to content area (as opposed to the whole allocation) and
     104             :     // we want the rendering to be at top left (GL has origin in bottom left)
     105             :     GrGLIRect   fViewport;
     106             : 
     107             :     // The RenderTarget needs to be able to report its VRAM footprint even after abandon and
     108             :     // release have potentially zeroed out the IDs (e.g., so the cache can reset itself). Since
     109             :     // the IDs are just required for the computation in totalSamples we cache that result here.
     110             :     int         fNumSamplesOwnedPerPixel;
     111             : 
     112             :     typedef GrRenderTarget INHERITED;
     113             : };
     114             : 
     115             : #endif

Generated by: LCOV version 1.13