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 24 matching lines...) Expand all Loading... |
35 | 35 |
36 // The following two functions return the same ID when a | 36 // The following two functions return the same ID when a |
37 // texture/render target is multisampled, and different IDs when | 37 // texture/render target is multisampled, and different IDs when |
38 // it is. | 38 // it is. |
39 // FBO ID used to render into | 39 // FBO ID used to render into |
40 GrGLuint renderFBOID() const { return fRTFBOID; } | 40 GrGLuint renderFBOID() const { return fRTFBOID; } |
41 // FBO ID that has texture ID attached. | 41 // FBO ID that has texture ID attached. |
42 GrGLuint textureFBOID() const { return fTexFBOID; } | 42 GrGLuint textureFBOID() const { return fTexFBOID; } |
43 | 43 |
44 // override of GrRenderTarget | 44 // override of GrRenderTarget |
45 ResolveType getResolveType() const SK_OVERRIDE { | 45 ResolveType getResolveType() const override { |
46 if (!this->isMultisampled() || | 46 if (!this->isMultisampled() || |
47 fRTFBOID == fTexFBOID) { | 47 fRTFBOID == fTexFBOID) { |
48 // catches FBO 0 and non MSAA case | 48 // catches FBO 0 and non MSAA case |
49 return kAutoResolves_ResolveType; | 49 return kAutoResolves_ResolveType; |
50 } else if (kUnresolvableFBOID == fTexFBOID) { | 50 } else if (kUnresolvableFBOID == fTexFBOID) { |
51 return kCantResolve_ResolveType; | 51 return kCantResolve_ResolveType; |
52 } else { | 52 } else { |
53 return kCanResolve_ResolveType; | 53 return kCanResolve_ResolveType; |
54 } | 54 } |
55 } | 55 } |
56 | 56 |
57 /** When we don't own the FBO ID we don't attempt to modify its attachments.
*/ | 57 /** When we don't own the FBO ID we don't attempt to modify its attachments.
*/ |
58 bool canAttemptStencilAttachment() const SK_OVERRIDE { return !fIsWrapped; } | 58 bool canAttemptStencilAttachment() const override { return !fIsWrapped; } |
59 | 59 |
60 protected: | 60 protected: |
61 // The public constructor registers this object with the cache. However, onl
y the most derived | 61 // The public constructor registers this object with the cache. However, onl
y the most derived |
62 // class should register with the cache. This constructor does not do the re
gistration and | 62 // class should register with the cache. This constructor does not do the re
gistration and |
63 // rather moves that burden onto the derived class. | 63 // rather moves that burden onto the derived class. |
64 enum Derived { kDerived }; | 64 enum Derived { kDerived }; |
65 GrGLRenderTarget(GrGLGpu*, const GrSurfaceDesc&, const IDDesc&, Derived); | 65 GrGLRenderTarget(GrGLGpu*, const GrSurfaceDesc&, const IDDesc&, Derived); |
66 | 66 |
67 void init(const GrSurfaceDesc&, const IDDesc&); | 67 void init(const GrSurfaceDesc&, const IDDesc&); |
68 | 68 |
69 void onAbandon() SK_OVERRIDE; | 69 void onAbandon() override; |
70 void onRelease() SK_OVERRIDE; | 70 void onRelease() override; |
71 | 71 |
72 // In protected because subclass GrGLTextureRenderTarget calls this version. | 72 // In protected because subclass GrGLTextureRenderTarget calls this version. |
73 size_t onGpuMemorySize() const SK_OVERRIDE; | 73 size_t onGpuMemorySize() const override; |
74 | 74 |
75 private: | 75 private: |
76 GrGLuint fRTFBOID; | 76 GrGLuint fRTFBOID; |
77 GrGLuint fTexFBOID; | 77 GrGLuint fTexFBOID; |
78 GrGLuint fMSColorRenderbufferID; | 78 GrGLuint fMSColorRenderbufferID; |
79 | 79 |
80 // We track this separately from GrGpuResource because this may be both a te
xture and a render | 80 // We track this separately from GrGpuResource because this may be both a te
xture and a render |
81 // target, and the texture may be wrapped while the render target is not. | 81 // target, and the texture may be wrapped while the render target is not. |
82 bool fIsWrapped; | 82 bool fIsWrapped; |
83 | 83 |
84 // when we switch to this render target we want to set the viewport to | 84 // when we switch to this render target we want to set the viewport to |
85 // only render to content area (as opposed to the whole allocation) and | 85 // only render to content area (as opposed to the whole allocation) and |
86 // we want the rendering to be at top left (GL has origin in bottom left) | 86 // we want the rendering to be at top left (GL has origin in bottom left) |
87 GrGLIRect fViewport; | 87 GrGLIRect fViewport; |
88 | 88 |
89 // onGpuMemorySize() needs to know what how many color values are owned per
pixel. However, | 89 // onGpuMemorySize() needs to know what how many color values are owned per
pixel. However, |
90 // abandon and release zero out the IDs and the cache needs to know the size
even after those | 90 // abandon and release zero out the IDs and the cache needs to know the size
even after those |
91 // actions. | 91 // actions. |
92 uint8_t fColorValuesPerPixel; | 92 uint8_t fColorValuesPerPixel; |
93 | 93 |
94 typedef GrRenderTarget INHERITED; | 94 typedef GrRenderTarget INHERITED; |
95 }; | 95 }; |
96 | 96 |
97 #endif | 97 #endif |
OLD | NEW |