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

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

Issue 1001503002: Implement support for mixed sampled render targets (Closed) Base URL: https://skia.googlesource.com/skia.git@mix1
Patch Set: Created 5 years, 9 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 | « no previous file | include/gpu/GrTypes.h » ('j') | include/gpu/GrTypes.h » ('J')
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
(...skipping 14 matching lines...) Expand all
25 public: 25 public:
26 SK_DECLARE_INST_COUNT(GrRenderTarget) 26 SK_DECLARE_INST_COUNT(GrRenderTarget)
27 27
28 // GrSurface overrides 28 // GrSurface overrides
29 GrRenderTarget* asRenderTarget() SK_OVERRIDE { return this; } 29 GrRenderTarget* asRenderTarget() SK_OVERRIDE { return this; }
30 const GrRenderTarget* asRenderTarget() const SK_OVERRIDE { return this; } 30 const GrRenderTarget* asRenderTarget() const SK_OVERRIDE { return this; }
31 31
32 // GrRenderTarget 32 // GrRenderTarget
33 /** 33 /**
34 * @return true if the surface is multisampled, false otherwise 34 * @return true if the surface is multisampled, false otherwise
35 */ 35 */
Chris Dalton 2015/03/12 07:43:35 Comment may need some work. @param requestedConfi
vbuzinov 2015/03/13 13:37:22 Done.
36 bool isMultisampled() const { return 0 != fDesc.fSampleCnt; } 36 bool isMultisampled(GrSampleConfig requestedConfig = kUnified_GrSampleConfig ) const {
37 return 0 != numSamples(requestedConfig);
38 }
37 39
38 /** 40 /**
39 * @return the number of samples-per-pixel or zero if non-MSAA. 41 * @return the number of samples-per-pixel or zero if non-MSAA.
Chris Dalton 2015/03/12 07:43:35 Comment: @return the number of samples-per-pixel
vbuzinov 2015/03/13 13:37:22 Done.
40 */ 42 */
41 int numSamples() const { return fDesc.fSampleCnt; } 43 int numSamples(GrSampleConfig requestedConfig = kUnified_GrSampleConfig) con st {
44 if (kStencil_GrSampleConfig == fSampleConfig &&
45 kUnified_GrSampleConfig == requestedConfig) {
46 return 0;
47 }
48 return fDesc.fSampleCnt;
49 }
50
51 /**
52 * @return sample config.
53 */
54 GrSampleConfig sampleConfig() {
55 return fSampleConfig;
56 }
42 57
43 /** 58 /**
44 * Call to indicate the multisample contents were modified such that the 59 * Call to indicate the multisample contents were modified such that the
45 * render target needs to be resolved before it can be used as texture. Gr 60 * render target needs to be resolved before it can be used as texture. Gr
46 * tracks this for its own drawing and thus this only needs to be called 61 * tracks this for its own drawing and thus this only needs to be called
47 * when the render target has been modified outside of Gr. This has no 62 * when the render target has been modified outside of Gr. This has no
48 * effect on wrapped backend render targets. 63 * effect on wrapped backend render targets.
49 * 64 *
50 * @param rect a rect bounding the area needing resolve. NULL indicates 65 * @param rect a rect bounding the area needing resolve. NULL indicates
51 * the whole RT needs resolving. 66 * the whole RT needs resolving.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 kAutoResolves_ResolveType, 102 kAutoResolves_ResolveType,
88 kCantResolve_ResolveType, 103 kCantResolve_ResolveType,
89 }; 104 };
90 virtual ResolveType getResolveType() const = 0; 105 virtual ResolveType getResolveType() const = 0;
91 106
92 // Provides access to functions that aren't part of the public API. 107 // Provides access to functions that aren't part of the public API.
93 GrRenderTargetPriv renderTargetPriv(); 108 GrRenderTargetPriv renderTargetPriv();
94 const GrRenderTargetPriv renderTargetPriv() const; 109 const GrRenderTargetPriv renderTargetPriv() const;
95 110
96 protected: 111 protected:
97 GrRenderTarget(GrGpu* gpu, LifeCycle lifeCycle, const GrSurfaceDesc& desc) 112 GrRenderTarget(GrGpu* gpu, LifeCycle lifeCycle, const GrSurfaceDesc& desc,
113 GrSampleConfig sampleConfig = kUnified_GrSampleConfig)
Chris Dalton 2015/03/13 03:11:32 I don't think sampleConfig needs a default value.
vbuzinov 2015/03/13 13:37:22 Done.
98 : INHERITED(gpu, lifeCycle, desc) 114 : INHERITED(gpu, lifeCycle, desc)
115 , fSampleConfig(sampleConfig)
99 , fStencilBuffer(NULL) { 116 , fStencilBuffer(NULL) {
100 fResolveRect.setLargestInverted(); 117 fResolveRect.setLargestInverted();
101 } 118 }
102 119
103 // override of GrResource 120 // override of GrResource
104 void onAbandon() SK_OVERRIDE; 121 void onAbandon() SK_OVERRIDE;
105 void onRelease() SK_OVERRIDE; 122 void onRelease() SK_OVERRIDE;
106 123
107 private: 124 private:
108 // Checked when this object is asked to attach a stencil buffer. 125 // Checked when this object is asked to attach a stencil buffer.
109 virtual bool canAttemptStencilAttachment() const = 0; 126 virtual bool canAttemptStencilAttachment() const = 0;
110 127
111 friend class GrRenderTargetPriv; 128 friend class GrRenderTargetPriv;
112 129
130 GrSampleConfig fSampleConfig;
131
113 GrStencilBuffer* fStencilBuffer; 132 GrStencilBuffer* fStencilBuffer;
114 133
115 SkIRect fResolveRect; 134 SkIRect fResolveRect;
116 135
117 typedef GrSurface INHERITED; 136 typedef GrSurface INHERITED;
118 }; 137 };
119 138
120 #endif 139 #endif
OLDNEW
« no previous file with comments | « no previous file | include/gpu/GrTypes.h » ('j') | include/gpu/GrTypes.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698