| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 | 8 |
| 9 #ifndef GrGLRenderTarget_DEFINED | 9 #ifndef GrGLRenderTarget_DEFINED |
| 10 #define GrGLRenderTarget_DEFINED | 10 #define GrGLRenderTarget_DEFINED |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 } | 59 } |
| 60 } | 60 } |
| 61 | 61 |
| 62 GrBackendObject getRenderTargetHandle() const override { return fRTFBOID; } | 62 GrBackendObject getRenderTargetHandle() const override { return fRTFBOID; } |
| 63 | 63 |
| 64 /** When we don't own the FBO ID we don't attempt to modify its attachments.
*/ | 64 /** When we don't own the FBO ID we don't attempt to modify its attachments.
*/ |
| 65 bool canAttemptStencilAttachment() const override { | 65 bool canAttemptStencilAttachment() const override { |
| 66 return kCached_LifeCycle == fRTLifecycle || kUncached_LifeCycle == fRTLi
fecycle; | 66 return kCached_LifeCycle == fRTLifecycle || kUncached_LifeCycle == fRTLi
fecycle; |
| 67 } | 67 } |
| 68 | 68 |
| 69 // GrGLRenderTarget overrides dumpMemoryStatistics so it can log its texture
and renderbuffer |
| 70 // components seperately. |
| 71 void dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const override
; |
| 72 |
| 69 protected: | 73 protected: |
| 70 // The public constructor registers this object with the cache. However, onl
y the most derived | 74 // The public constructor registers this object with the cache. However, onl
y the most derived |
| 71 // class should register with the cache. This constructor does not do the re
gistration and | 75 // class should register with the cache. This constructor does not do the re
gistration and |
| 72 // rather moves that burden onto the derived class. | 76 // rather moves that burden onto the derived class. |
| 73 enum Derived { kDerived }; | 77 enum Derived { kDerived }; |
| 74 GrGLRenderTarget(GrGLGpu*, const GrSurfaceDesc&, const IDDesc&, Derived); | 78 GrGLRenderTarget(GrGLGpu*, const GrSurfaceDesc&, const IDDesc&, Derived); |
| 75 | 79 |
| 76 void init(const GrSurfaceDesc&, const IDDesc&); | 80 void init(const GrSurfaceDesc&, const IDDesc&); |
| 77 | 81 |
| 78 void onAbandon() override; | 82 void onAbandon() override; |
| 79 void onRelease() override; | 83 void onRelease() override; |
| 80 | 84 |
| 81 // In protected because subclass GrGLTextureRenderTarget calls this version. | 85 // In protected because subclass GrGLTextureRenderTarget calls this version. |
| 82 size_t onGpuMemorySize() const override; | 86 size_t onGpuMemorySize() const override; |
| 83 | 87 |
| 84 private: | 88 private: |
| 85 // This ctor is used only for creating wrapped render targets and is only ca
lled for the static | 89 // This ctor is used only for creating wrapped render targets and is only ca
lled for the static |
| 86 // create function CreateWrapped(...). | 90 // create function CreateWrapped(...). |
| 87 GrGLRenderTarget(GrGLGpu*, const GrSurfaceDesc&, const IDDesc&, GrGLStencilA
ttachment*); | 91 GrGLRenderTarget(GrGLGpu*, const GrSurfaceDesc&, const IDDesc&, GrGLStencilA
ttachment*); |
| 88 | 92 |
| 89 GrGLGpu* getGLGpu() const; | 93 GrGLGpu* getGLGpu() const; |
| 90 bool completeStencilAttachment() override; | 94 bool completeStencilAttachment() override; |
| 91 | 95 |
| 96 // The total size of the resource (including all pixels) for a single sample
. |
| 97 size_t totalBytesPerSample() const; |
| 98 int msaaSamples() const; |
| 99 // The number total number of samples, including both MSAA and resolve textu
re samples. |
| 100 int totalSamples() const; |
| 101 |
| 92 GrGLuint fRTFBOID; | 102 GrGLuint fRTFBOID; |
| 93 GrGLuint fTexFBOID; | 103 GrGLuint fTexFBOID; |
| 94 GrGLuint fMSColorRenderbufferID; | 104 GrGLuint fMSColorRenderbufferID; |
| 95 | 105 |
| 96 // We track this separately from GrGpuResource because this may be both a te
xture and a render | 106 // We track this separately from GrGpuResource because this may be both a te
xture and a render |
| 97 // target, and the texture may be wrapped while the render target is not. | 107 // target, and the texture may be wrapped while the render target is not. |
| 98 LifeCycle fRTLifecycle; | 108 LifeCycle fRTLifecycle; |
| 99 | 109 |
| 100 // when we switch to this render target we want to set the viewport to | 110 // when we switch to this render target we want to set the viewport to |
| 101 // only render to content area (as opposed to the whole allocation) and | 111 // only render to content area (as opposed to the whole allocation) and |
| 102 // we want the rendering to be at top left (GL has origin in bottom left) | 112 // we want the rendering to be at top left (GL has origin in bottom left) |
| 103 GrGLIRect fViewport; | 113 GrGLIRect fViewport; |
| 104 | 114 |
| 105 // onGpuMemorySize() needs to know the VRAM footprint of the FBO(s). However
, abandon and | 115 // onGpuMemorySize() needs to know the VRAM footprint of the FBO(s). However
, abandon and |
| 106 // release zero out the IDs and the cache needs to know the size even after
those actions. | 116 // release zero out the IDs and the cache needs to know the size even after
those actions. |
| 107 size_t fGpuMemorySize; | 117 size_t fGpuMemorySize; |
| 108 | 118 |
| 109 typedef GrRenderTarget INHERITED; | 119 typedef GrRenderTarget INHERITED; |
| 110 }; | 120 }; |
| 111 | 121 |
| 112 #endif | 122 #endif |
| OLD | NEW |