Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(237)

Side by Side Diff: src/gpu/gl/GrGLRenderTarget.h

Issue 1333383002: Move some of the adding stencil attachment logic of Gpu and into Render Target. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: spelling Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/gl/GrGLGpu.cpp ('k') | src/gpu/gl/GrGLRenderTarget.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 18
18 class GrGLRenderTarget : public GrRenderTarget { 19 class GrGLRenderTarget : public GrRenderTarget {
19 public: 20 public:
20 // 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
21 // Gr doesn't know how to resolve it. 22 // Gr doesn't know how to resolve it.
22 enum { kUnresolvableFBOID = 0 }; 23 enum { kUnresolvableFBOID = 0 };
23 24
24 struct IDDesc { 25 struct IDDesc {
25 GrGLuint fRTFBOID; 26 GrGLuint fRTFBOID;
26 GrGLuint fTexFBOID; 27 GrGLuint fTexFBOID;
27 GrGLuint fMSColorRenderbufferID; 28 GrGLuint fMSColorRenderbufferID;
28 GrGpuResource::LifeCycle fLifeCycle; 29 GrGpuResource::LifeCycle fLifeCycle;
29 GrRenderTarget::SampleConfig fSampleConfig; 30 GrRenderTarget::SampleConfig fSampleConfig;
30 }; 31 };
31 32
32 GrGLRenderTarget(GrGLGpu*, const GrSurfaceDesc&, const IDDesc&); 33 static GrGLRenderTarget* CreateWrapped(GrGLGpu*,
34 const GrSurfaceDesc&,
35 const IDDesc&,
36 int stencilBits);
33 37
34 void setViewport(const GrGLIRect& rect) { fViewport = rect; } 38 void setViewport(const GrGLIRect& rect) { fViewport = rect; }
35 const GrGLIRect& getViewport() const { return fViewport; } 39 const GrGLIRect& getViewport() const { return fViewport; }
36 40
37 // The following two functions return the same ID when a 41 // The following two functions return the same ID when a
38 // texture/render target is multisampled, and different IDs when 42 // texture/render target is multisampled, and different IDs when
39 // it is. 43 // it is.
40 // FBO ID used to render into 44 // FBO ID used to render into
41 GrGLuint renderFBOID() const { return fRTFBOID; } 45 GrGLuint renderFBOID() const { return fRTFBOID; }
42 // FBO ID that has texture ID attached. 46 // FBO ID that has texture ID attached.
(...skipping 28 matching lines...) Expand all
71 75
72 void init(const GrSurfaceDesc&, const IDDesc&); 76 void init(const GrSurfaceDesc&, const IDDesc&);
73 77
74 void onAbandon() override; 78 void onAbandon() override;
75 void onRelease() override; 79 void onRelease() override;
76 80
77 // In protected because subclass GrGLTextureRenderTarget calls this version. 81 // In protected because subclass GrGLTextureRenderTarget calls this version.
78 size_t onGpuMemorySize() const override; 82 size_t onGpuMemorySize() const override;
79 83
80 private: 84 private:
85 // This ctor is used only for creating wrapped render targets and is only ca lled for the static
86 // create function CreateWrapped(...).
87 GrGLRenderTarget(GrGLGpu*, const GrSurfaceDesc&, const IDDesc&, GrGLStencilA ttachment*);
88
89 GrGLGpu* getGLGpu() const;
90 bool completeStencilAttachment() override;
91
81 GrGLuint fRTFBOID; 92 GrGLuint fRTFBOID;
82 GrGLuint fTexFBOID; 93 GrGLuint fTexFBOID;
83 GrGLuint fMSColorRenderbufferID; 94 GrGLuint fMSColorRenderbufferID;
84 95
85 // We track this separately from GrGpuResource because this may be both a te xture and a render 96 // We track this separately from GrGpuResource because this may be both a te xture and a render
86 // target, and the texture may be wrapped while the render target is not. 97 // target, and the texture may be wrapped while the render target is not.
87 LifeCycle fRTLifecycle; 98 LifeCycle fRTLifecycle;
88 99
89 // when we switch to this render target we want to set the viewport to 100 // when we switch to this render target we want to set the viewport to
90 // only render to content area (as opposed to the whole allocation) and 101 // only render to content area (as opposed to the whole allocation) and
91 // we want the rendering to be at top left (GL has origin in bottom left) 102 // we want the rendering to be at top left (GL has origin in bottom left)
92 GrGLIRect fViewport; 103 GrGLIRect fViewport;
93 104
94 // onGpuMemorySize() needs to know the VRAM footprint of the FBO(s). However , abandon and 105 // onGpuMemorySize() needs to know the VRAM footprint of the FBO(s). However , abandon and
95 // release zero out the IDs and the cache needs to know the size even after those actions. 106 // release zero out the IDs and the cache needs to know the size even after those actions.
96 size_t fGpuMemorySize; 107 size_t fGpuMemorySize;
97 108
98 typedef GrRenderTarget INHERITED; 109 typedef GrRenderTarget INHERITED;
99 }; 110 };
100 111
101 #endif 112 #endif
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLGpu.cpp ('k') | src/gpu/gl/GrGLRenderTarget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698