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

Side by Side Diff: include/gpu/GrRenderTarget.h

Issue 938383004: Dynamically create stencil buffer when needed. (Closed) Base URL: https://skia.googlesource.com/skia.git@bigstencil
Patch Set: Actually save file before uploading Created 5 years, 10 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 | « gyp/gpu.gypi ('k') | include/gpu/GrTypes.h » ('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 #ifndef GrRenderTarget_DEFINED 8 #ifndef GrRenderTarget_DEFINED
9 #define GrRenderTarget_DEFINED 9 #define GrRenderTarget_DEFINED
10 10
11 #include "GrSurface.h" 11 #include "GrSurface.h"
12 #include "SkRect.h" 12 #include "SkRect.h"
13 13
14 class GrStencilBuffer; 14 class GrStencilBuffer;
15 class GrRenderTargetPriv;
15 16
16 /** 17 /**
17 * GrRenderTarget represents a 2D buffer of pixels that can be rendered to. 18 * GrRenderTarget represents a 2D buffer of pixels that can be rendered to.
18 * A context's render target is set by setRenderTarget(). Render targets are 19 * A context's render target is set by setRenderTarget(). Render targets are
19 * created by a createTexture with the kRenderTarget_SurfaceFlag flag. 20 * created by a createTexture with the kRenderTarget_SurfaceFlag flag.
20 * Additionally, GrContext provides methods for creating GrRenderTargets 21 * Additionally, GrContext provides methods for creating GrRenderTargets
21 * that wrap externally created render targets. 22 * that wrap externally created render targets.
22 */ 23 */
23 class GrRenderTarget : virtual public GrSurface { 24 class GrRenderTarget : virtual public GrSurface {
24 public: 25 public:
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 // a MSAA RT may require explicit resolving , it may auto-resolve (e.g. FBO 82 // a MSAA RT may require explicit resolving , it may auto-resolve (e.g. FBO
82 // 0 in GL), or be unresolvable because the client didn't give us the 83 // 0 in GL), or be unresolvable because the client didn't give us the
83 // resolve destination. 84 // resolve destination.
84 enum ResolveType { 85 enum ResolveType {
85 kCanResolve_ResolveType, 86 kCanResolve_ResolveType,
86 kAutoResolves_ResolveType, 87 kAutoResolves_ResolveType,
87 kCantResolve_ResolveType, 88 kCantResolve_ResolveType,
88 }; 89 };
89 virtual ResolveType getResolveType() const = 0; 90 virtual ResolveType getResolveType() const = 0;
90 91
91 /** 92 // Provides access to functions that aren't part of the public API.
92 * GrStencilBuffer is not part of the public API. 93 GrRenderTargetPriv renderTargetPriv();
93 */ 94 const GrRenderTargetPriv renderTargetPriv() const;
94 GrStencilBuffer* getStencilBuffer() const { return fStencilBuffer; }
95 void setStencilBuffer(GrStencilBuffer* stencilBuffer);
96 95
97 protected: 96 protected:
98 GrRenderTarget(GrGpu* gpu, LifeCycle lifeCycle, const GrSurfaceDesc& desc) 97 GrRenderTarget(GrGpu* gpu, LifeCycle lifeCycle, const GrSurfaceDesc& desc)
99 : INHERITED(gpu, lifeCycle, desc) 98 : INHERITED(gpu, lifeCycle, desc)
100 , fStencilBuffer(NULL) { 99 , fStencilBuffer(NULL) {
101 fResolveRect.setLargestInverted(); 100 fResolveRect.setLargestInverted();
102 } 101 }
103 102
104 // override of GrResource 103 // override of GrResource
105 void onAbandon() SK_OVERRIDE; 104 void onAbandon() SK_OVERRIDE;
106 void onRelease() SK_OVERRIDE; 105 void onRelease() SK_OVERRIDE;
107 106
108 private: 107 private:
108 // Checked when this object is asked to attach a stencil buffer.
109 virtual bool canAttemptStencilAttachment() const = 0;
110
111 friend class GrRenderTargetPriv;
112
109 GrStencilBuffer* fStencilBuffer; 113 GrStencilBuffer* fStencilBuffer;
110 114
111 SkIRect fResolveRect; 115 SkIRect fResolveRect;
112 116
113 typedef GrSurface INHERITED; 117 typedef GrSurface INHERITED;
114 }; 118 };
115 119
116 #endif 120 #endif
OLDNEW
« no previous file with comments | « gyp/gpu.gypi ('k') | include/gpu/GrTypes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698