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

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

Issue 1862043002: Refactor to separate backend object lifecycle and GpuResource budget decision (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix unrelated GrBuffer::onGpuMemorySize() lack of override keyword compile error Created 4 years, 8 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
« no previous file with comments | « src/gpu/gl/GrGLTexture.cpp ('k') | src/gpu/gl/GrGLTextureRenderTarget.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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, desc)
33 , GrGLTexture(gpu, desc, texIDDesc, GrGLTexture::kDerived) 34 , GrGLTexture(gpu, desc, texIDDesc)
34 , GrGLRenderTarget(gpu, desc, rtIDDesc, GrGLRenderTarget::kDerived) { 35 , GrGLRenderTarget(gpu, desc, rtIDDesc) {
35 this->registerWithCache(); 36 this->registerWithCache(budgeted);
36 } 37 }
37 38
39 bool canAttemptStencilAttachment() const override;
40
38 void dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const override ; 41 void dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const override ;
39 42
43 static GrGLTextureRenderTarget* CreateWrapped(GrGLGpu* gpu, const GrSurfaceD esc& desc,
44 const GrGLTexture::IDDesc& tex IDDesc,
45 const GrGLRenderTarget::IDDesc & rtIDDesc);
40 protected: 46 protected:
41 void onAbandon() override { 47 void onAbandon() override {
42 GrGLRenderTarget::onAbandon(); 48 GrGLRenderTarget::onAbandon();
43 GrGLTexture::onAbandon(); 49 GrGLTexture::onAbandon();
44 } 50 }
45 51
46 void onRelease() override { 52 void onRelease() override {
47 GrGLRenderTarget::onRelease(); 53 GrGLRenderTarget::onRelease();
48 GrGLTexture::onRelease(); 54 GrGLTexture::onRelease();
49 } 55 }
50 56
51 private: 57 private:
58 // Constructor for instances wrapping backend objects.
59 GrGLTextureRenderTarget(GrGLGpu* gpu,
60 const GrSurfaceDesc& desc,
61 const GrGLTexture::IDDesc& texIDDesc,
62 const GrGLRenderTarget::IDDesc& rtIDDesc)
63 : GrSurface(gpu, desc)
64 , GrGLTexture(gpu, desc, texIDDesc)
65 , GrGLRenderTarget(gpu, desc, rtIDDesc) {
66 this->registerWithCacheWrapped();
67 }
68
52 // GrGLRenderTarget accounts for the texture's memory and any MSAA renderbuf fer's memory. 69 // GrGLRenderTarget accounts for the texture's memory and any MSAA renderbuf fer's memory.
53 size_t onGpuMemorySize() const override { 70 size_t onGpuMemorySize() const override {
54 return GrGLRenderTarget::onGpuMemorySize(); 71 return GrGLRenderTarget::onGpuMemorySize();
55 } 72 }
56 73
57 }; 74 };
58 75
59 #ifdef SK_BUILD_FOR_WIN 76 #ifdef SK_BUILD_FOR_WIN
60 #pragma warning(pop) 77 #pragma warning(pop)
61 #endif 78 #endif
62 79
63 #endif 80 #endif
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLTexture.cpp ('k') | src/gpu/gl/GrGLTextureRenderTarget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698