| 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 class GrGLStencilAttachment; | 17 class GrGLStencilAttachment; |
| 18 | 18 |
| 19 class GrGLRenderTarget : public GrRenderTarget { | 19 class GrGLRenderTarget : public GrRenderTarget { |
| 20 public: | 20 public: |
| 21 // set fTexFBOID to this value to indicate that it is multisampled but | 21 // set fTexFBOID to this value to indicate that it is multisampled but |
| 22 // Gr doesn't know how to resolve it. | 22 // Gr doesn't know how to resolve it. |
| 23 enum { kUnresolvableFBOID = 0 }; | 23 enum { kUnresolvableFBOID = 0 }; |
| 24 | 24 |
| 25 struct IDDesc { | 25 struct IDDesc { |
| 26 GrGLuint fRTFBOID; | 26 GrGLuint fRTFBOID; |
| 27 GrBackendObjectOwnership fRTFBOOwnership; | 27 GrBackendObjectOwnership fRTFBOOwnership; |
| 28 GrGLuint fTexFBOID; | 28 GrGLuint fTexFBOID; |
| 29 GrGLuint fMSColorRenderbufferID; | 29 GrGLuint fMSColorRenderbufferID; |
| 30 GrRenderTarget::SampleConfig fSampleConfig; | 30 bool fIsMixedSampled; |
| 31 }; | 31 }; |
| 32 | 32 |
| 33 static GrGLRenderTarget* CreateWrapped(GrGLGpu*, | 33 static GrGLRenderTarget* CreateWrapped(GrGLGpu*, |
| 34 const GrSurfaceDesc&, | 34 const GrSurfaceDesc&, |
| 35 const IDDesc&, | 35 const IDDesc&, |
| 36 int stencilBits); | 36 int stencilBits); |
| 37 | 37 |
| 38 void setViewport(const GrGLIRect& rect) { fViewport = rect; } | 38 void setViewport(const GrGLIRect& rect) { fViewport = rect; } |
| 39 const GrGLIRect& getViewport() const { return fViewport; } | 39 const GrGLIRect& getViewport() const { return fViewport; } |
| 40 | 40 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 void onAbandon() override; | 76 void onAbandon() override; |
| 77 void onRelease() override; | 77 void onRelease() override; |
| 78 | 78 |
| 79 // In protected because subclass GrGLTextureRenderTarget calls this version. | 79 // In protected because subclass GrGLTextureRenderTarget calls this version. |
| 80 size_t onGpuMemorySize() const override; | 80 size_t onGpuMemorySize() const override; |
| 81 | 81 |
| 82 private: | 82 private: |
| 83 // Constructor for instances wrapping backend objects. | 83 // Constructor for instances wrapping backend objects. |
| 84 GrGLRenderTarget(GrGLGpu*, const GrSurfaceDesc&, const IDDesc&, GrGLStencilA
ttachment*); | 84 GrGLRenderTarget(GrGLGpu*, const GrSurfaceDesc&, const IDDesc&, GrGLStencilA
ttachment*); |
| 85 | 85 |
| 86 static Flags ComputeFlags(const IDDesc&); |
| 87 |
| 86 GrGLGpu* getGLGpu() const; | 88 GrGLGpu* getGLGpu() const; |
| 87 bool completeStencilAttachment() override; | 89 bool completeStencilAttachment() override; |
| 88 | 90 |
| 89 // The total size of the resource (including all pixels) for a single sample
. | 91 // The total size of the resource (including all pixels) for a single sample
. |
| 90 size_t totalBytesPerSample() const; | 92 size_t totalBytesPerSample() const; |
| 91 int msaaSamples() const; | 93 int msaaSamples() const; |
| 92 // The number total number of samples, including both MSAA and resolve textu
re samples. | 94 // The number total number of samples, including both MSAA and resolve textu
re samples. |
| 93 int totalSamples() const; | 95 int totalSamples() const; |
| 94 | 96 |
| 95 GrGLuint fRTFBOID; | 97 GrGLuint fRTFBOID; |
| 96 GrGLuint fTexFBOID; | 98 GrGLuint fTexFBOID; |
| 97 GrGLuint fMSColorRenderbufferID; | 99 GrGLuint fMSColorRenderbufferID; |
| 98 | 100 |
| 99 GrBackendObjectOwnership fRTFBOOwnership; | 101 GrBackendObjectOwnership fRTFBOOwnership; |
| 100 | 102 |
| 101 // when we switch to this render target we want to set the viewport to | 103 // when we switch to this render target we want to set the viewport to |
| 102 // only render to content area (as opposed to the whole allocation) and | 104 // only render to content area (as opposed to the whole allocation) and |
| 103 // we want the rendering to be at top left (GL has origin in bottom left) | 105 // we want the rendering to be at top left (GL has origin in bottom left) |
| 104 GrGLIRect fViewport; | 106 GrGLIRect fViewport; |
| 105 | 107 |
| 106 // onGpuMemorySize() needs to know the VRAM footprint of the FBO(s). However
, abandon and | 108 // onGpuMemorySize() needs to know the VRAM footprint of the FBO(s). However
, abandon and |
| 107 // release zero out the IDs and the cache needs to know the size even after
those actions. | 109 // release zero out the IDs and the cache needs to know the size even after
those actions. |
| 108 size_t fGpuMemorySize; | 110 size_t fGpuMemorySize; |
| 109 | 111 |
| 110 typedef GrRenderTarget INHERITED; | 112 typedef GrRenderTarget INHERITED; |
| 111 }; | 113 }; |
| 112 | 114 |
| 113 #endif | 115 #endif |
| OLD | NEW |