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

Side by Side Diff: src/gpu/gl/GrGLTextureRenderTarget.h

Issue 1810323002: Cache render targets that render to wrapped textures Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 months 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
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 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 GrGLTextureRenderTarget_DEFINED 9 #ifndef GrGLTextureRenderTarget_DEFINED
10 #define GrGLTextureRenderTarget_DEFINED 10 #define GrGLTextureRenderTarget_DEFINED
11 11
12 #include "GrGLGpu.h" 12 #include "GrGLGpu.h"
13 #include "GrGLTexture.h" 13 #include "GrGLTexture.h"
14 #include "GrGLRenderTarget.h" 14 #include "GrGLRenderTarget.h"
15 15
16 class GrGLGpu; 16 class GrGLGpu;
17 17
18 #ifdef SK_BUILD_FOR_WIN 18 #ifdef SK_BUILD_FOR_WIN
19 // Windows gives bogus warnings about inheriting asTexture/asRenderTarget via do minance. 19 // Windows gives bogus warnings about inheriting asTexture/asRenderTarget via do minance.
20 #pragma warning(push) 20 #pragma warning(push)
21 #pragma warning(disable: 4250) 21 #pragma warning(disable: 4250)
22 #endif 22 #endif
23 23
24 class GrGLTextureRenderTarget : public GrGLTexture, public GrGLRenderTarget { 24 class GrGLTextureRenderTarget : public GrGLTexture, public GrGLRenderTarget {
25 public: 25 public:
26 // We're virtually derived from GrSurface (via both GrGLTexture and GrGLRend erTarget) so its 26 // We're virtually derived from GrSurface (via both GrGLTexture and GrGLRend erTarget) so its
27 // constructor must be explicitly called. 27 // constructor must be explicitly called.
28 GrGLTextureRenderTarget(GrGLGpu* gpu, 28 GrGLTextureRenderTarget(GrGLGpu* gpu,
29 SkBudgeted budgeted,
29 const GrSurfaceDesc& desc, 30 const GrSurfaceDesc& desc,
30 const GrGLTexture::IDDesc& texIDDesc, 31 const GrGLTexture::IDDesc& texIDDesc,
31 const GrGLRenderTarget::IDDesc& rtIDDesc) 32 const GrGLRenderTarget::IDDesc& rtIDDesc)
32 : GrSurface(gpu, texIDDesc.fLifeCycle, desc) 33 : GrSurface(gpu, budgeted, desc)
33 , GrGLTexture(gpu, desc, texIDDesc, GrGLTexture::kDerived) 34 , GrGLTexture(gpu, budgeted, desc, texIDDesc, GrGLTexture::kDerived)
34 , GrGLRenderTarget(gpu, desc, rtIDDesc, GrGLRenderTarget::kDerived) { 35 , GrGLRenderTarget(gpu, budgeted, desc, rtIDDesc, GrGLRenderTarget::kDer ived) {
35 this->registerWithCache(); 36 this->registerWithCache();
36 } 37 }
37 38
38 void dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const override ; 39 void dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const override ;
39 40
40 protected: 41 protected:
41 void onAbandon() override { 42 void onAbandon() override {
42 GrGLRenderTarget::onAbandon(); 43 GrGLRenderTarget::onAbandon();
43 GrGLTexture::onAbandon(); 44 GrGLTexture::onAbandon();
44 } 45 }
45 46
46 void onRelease() override { 47 void onRelease() override {
47 GrGLRenderTarget::onRelease(); 48 GrGLRenderTarget::onRelease();
48 GrGLTexture::onRelease(); 49 GrGLTexture::onRelease();
49 } 50 }
51 bool refsWrappedResources() const override;
50 52
51 private: 53 private:
52 // GrGLRenderTarget accounts for the texture's memory and any MSAA renderbuf fer's memory.
53 size_t onGpuMemorySize() const override { 54 size_t onGpuMemorySize() const override {
54 return GrGLRenderTarget::onGpuMemorySize(); 55 return GrGLTexture::onGpuMemorySize() +
56 GrGLRenderTarget::onGpuMemorySize();
55 } 57 }
56 58
57 }; 59 };
58 60
59 #ifdef SK_BUILD_FOR_WIN 61 #ifdef SK_BUILD_FOR_WIN
60 #pragma warning(pop) 62 #pragma warning(pop)
61 #endif 63 #endif
62 64
63 #endif 65 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698