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