OLD | NEW |
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 |
OLD | NEW |