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 |
11 | 11 |
12 #include "GrGLIRect.h" | 12 #include "GrGLIRect.h" |
13 #include "GrRenderTarget.h" | 13 #include "GrRenderTarget.h" |
14 #include "SkScalar.h" | 14 #include "SkScalar.h" |
15 | 15 |
16 class GrGLGpu; | 16 class GrGLGpu; |
17 | 17 |
18 class GrGLRenderTarget : public GrRenderTarget { | 18 class GrGLRenderTarget : public GrRenderTarget { |
19 public: | 19 public: |
20 // set fTexFBOID to this value to indicate that it is multisampled but | 20 // set fTexFBOID to this value to indicate that it is multisampled but |
21 // Gr doesn't know how to resolve it. | 21 // Gr doesn't know how to resolve it. |
22 enum { kUnresolvableFBOID = 0 }; | 22 enum { kUnresolvableFBOID = 0 }; |
23 | 23 |
24 struct IDDesc { | 24 struct IDDesc { |
25 GrGLuint fRTFBOID; | 25 GrGLuint fRTFBOID; |
26 GrGLuint fTexFBOID; | 26 GrGLuint fTexFBOID; |
27 GrGLuint fMSColorRenderbufferID; | 27 GrGLuint fMSColorRenderbufferID; |
28 GrGpuResource::LifeCycle fLifeCycle; | 28 GrGpuResource::LifeCycle fLifeCycle; |
| 29 GrRenderTarget::SampleConfig fSampleConfig; |
29 }; | 30 }; |
30 | 31 |
31 GrGLRenderTarget(GrGLGpu*, const GrSurfaceDesc&, const IDDesc&); | 32 GrGLRenderTarget(GrGLGpu*, const GrSurfaceDesc&, const IDDesc&); |
32 | 33 |
33 void setViewport(const GrGLIRect& rect) { fViewport = rect; } | 34 void setViewport(const GrGLIRect& rect) { fViewport = rect; } |
34 const GrGLIRect& getViewport() const { return fViewport; } | 35 const GrGLIRect& getViewport() const { return fViewport; } |
35 | 36 |
36 // The following two functions return the same ID when a | 37 // The following two functions return the same ID when a |
37 // texture/render target is multisampled, and different IDs when | 38 // texture/render target is multisampled, and different IDs when |
38 // it is. | 39 // it is. |
39 // FBO ID used to render into | 40 // FBO ID used to render into |
40 GrGLuint renderFBOID() const { return fRTFBOID; } | 41 GrGLuint renderFBOID() const { return fRTFBOID; } |
41 // FBO ID that has texture ID attached. | 42 // FBO ID that has texture ID attached. |
42 GrGLuint textureFBOID() const { return fTexFBOID; } | 43 GrGLuint textureFBOID() const { return fTexFBOID; } |
43 | 44 |
44 // override of GrRenderTarget | 45 // override of GrRenderTarget |
45 ResolveType getResolveType() const override { | 46 ResolveType getResolveType() const override { |
46 if (!this->isMultisampled() || | 47 if (!this->isUnifiedMultisampled() || |
47 fRTFBOID == fTexFBOID) { | 48 fRTFBOID == fTexFBOID) { |
48 // catches FBO 0 and non MSAA case | 49 // catches FBO 0 and non MSAA case |
49 return kAutoResolves_ResolveType; | 50 return kAutoResolves_ResolveType; |
50 } else if (kUnresolvableFBOID == fTexFBOID) { | 51 } else if (kUnresolvableFBOID == fTexFBOID) { |
51 return kCantResolve_ResolveType; | 52 return kCantResolve_ResolveType; |
52 } else { | 53 } else { |
53 return kCanResolve_ResolveType; | 54 return kCanResolve_ResolveType; |
54 } | 55 } |
55 } | 56 } |
56 | 57 |
(...skipping 30 matching lines...) Expand all Loading... |
87 GrGLIRect fViewport; | 88 GrGLIRect fViewport; |
88 | 89 |
89 // onGpuMemorySize() needs to know the VRAM footprint of the FBO(s). However
, abandon and | 90 // onGpuMemorySize() needs to know the VRAM footprint of the FBO(s). However
, abandon and |
90 // release zero out the IDs and the cache needs to know the size even after
those actions. | 91 // release zero out the IDs and the cache needs to know the size even after
those actions. |
91 size_t fGpuMemorySize; | 92 size_t fGpuMemorySize; |
92 | 93 |
93 typedef GrRenderTarget INHERITED; | 94 typedef GrRenderTarget INHERITED; |
94 }; | 95 }; |
95 | 96 |
96 #endif | 97 #endif |
OLD | NEW |