OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 GrGLCaps_DEFINED | 9 #ifndef GrGLCaps_DEFINED |
10 #define GrGLCaps_DEFINED | 10 #define GrGLCaps_DEFINED |
(...skipping 10 matching lines...) Expand all Loading... |
21 * version and the extensions string. It also tracks formats that have passed | 21 * version and the extensions string. It also tracks formats that have passed |
22 * the FBO completeness test. | 22 * the FBO completeness test. |
23 */ | 23 */ |
24 class GrGLCaps : public GrDrawTargetCaps { | 24 class GrGLCaps : public GrDrawTargetCaps { |
25 public: | 25 public: |
26 SK_DECLARE_INST_COUNT(GrGLCaps) | 26 SK_DECLARE_INST_COUNT(GrGLCaps) |
27 | 27 |
28 typedef GrGLStencilBuffer::Format StencilFormat; | 28 typedef GrGLStencilBuffer::Format StencilFormat; |
29 | 29 |
30 /** | 30 /** |
31 * Represents a supported multisampling/coverage-sampling mode. | |
32 */ | |
33 struct MSAACoverageMode { | |
34 // "Coverage samples" includes samples that actually have color, depth, | |
35 // stencil, ... as well as those that don't (coverage only). All samples | |
36 // are coverage samples. (We're using the word "coverage sample" to | |
37 // match the NV extension language.) | |
38 int fCoverageSampleCnt; | |
39 | |
40 // Color samples are samples that store data values (color, stencil, | |
41 // depth) rather than just representing coverage. They are a subset | |
42 // of coverage samples. (Again the wording was chosen to match the | |
43 // extension.) | |
44 int fColorSampleCnt; | |
45 }; | |
46 | |
47 /** | |
48 * The type of MSAA for FBOs supported. Different extensions have different | 31 * The type of MSAA for FBOs supported. Different extensions have different |
49 * semantics of how / when a resolve is performed. | 32 * semantics of how / when a resolve is performed. |
50 */ | 33 */ |
51 enum MSFBOType { | 34 enum MSFBOType { |
52 /** | 35 /** |
53 * no support for MSAA FBOs | 36 * no support for MSAA FBOs |
54 */ | 37 */ |
55 kNone_MSFBOType = 0, | 38 kNone_MSFBOType = 0, |
56 /** | 39 /** |
57 * GL3.0-style MSAA FBO (GL_ARB_framebuffer_object). | 40 * GL3.0-style MSAA FBO (GL_ARB_framebuffer_object). |
(...skipping 30 matching lines...) Expand all Loading... |
88 enum FBFetchType { | 71 enum FBFetchType { |
89 kNone_FBFetchType, | 72 kNone_FBFetchType, |
90 /** GL_EXT_shader_framebuffer_fetch */ | 73 /** GL_EXT_shader_framebuffer_fetch */ |
91 kEXT_FBFetchType, | 74 kEXT_FBFetchType, |
92 /** GL_NV_shader_framebuffer_fetch */ | 75 /** GL_NV_shader_framebuffer_fetch */ |
93 kNV_FBFetchType, | 76 kNV_FBFetchType, |
94 | 77 |
95 kLast_FBFetchType = kNV_FBFetchType, | 78 kLast_FBFetchType = kNV_FBFetchType, |
96 }; | 79 }; |
97 | 80 |
98 enum CoverageAAType { | |
99 /** | |
100 * No coverage sample support | |
101 */ | |
102 kNone_CoverageAAType, | |
103 | |
104 /** | |
105 * GL_NV_framebuffer_multisample_coverage | |
106 */ | |
107 kNVDesktop_CoverageAAType, | |
108 }; | |
109 | |
110 /** | 81 /** |
111 * Creates a GrGLCaps that advertises no support for any extensions, | 82 * Creates a GrGLCaps that advertises no support for any extensions, |
112 * formats, etc. Call init to initialize from a GrGLContextInfo. | 83 * formats, etc. Call init to initialize from a GrGLContextInfo. |
113 */ | 84 */ |
114 GrGLCaps(); | 85 GrGLCaps(); |
115 | 86 |
116 GrGLCaps(const GrGLCaps& caps); | 87 GrGLCaps(const GrGLCaps& caps); |
117 | 88 |
118 GrGLCaps& operator = (const GrGLCaps& caps); | 89 GrGLCaps& operator = (const GrGLCaps& caps); |
119 | 90 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 | 150 |
180 /** | 151 /** |
181 * Is the MSAA FBO extension one where the texture is multisampled when boun
d to an FBO and | 152 * Is the MSAA FBO extension one where the texture is multisampled when boun
d to an FBO and |
182 * then implicitly resolved when read. | 153 * then implicitly resolved when read. |
183 */ | 154 */ |
184 bool usesImplicitMSAAResolve() const { | 155 bool usesImplicitMSAAResolve() const { |
185 return kES_IMG_MsToTexture_MSFBOType == fMSFBOType || | 156 return kES_IMG_MsToTexture_MSFBOType == fMSFBOType || |
186 kES_EXT_MsToTexture_MSFBOType == fMSFBOType; | 157 kES_EXT_MsToTexture_MSFBOType == fMSFBOType; |
187 } | 158 } |
188 | 159 |
189 /** | |
190 * Reports the type of coverage sample AA support. | |
191 */ | |
192 CoverageAAType coverageAAType() const { return fCoverageAAType; } | |
193 | |
194 /** | |
195 * Chooses a supported coverage mode based on a desired sample count. The | |
196 * desired sample count is rounded up the next supported coverage sample | |
197 * count unless a it is larger than the max in which case it is rounded | |
198 * down. Once a coverage sample count is decided, the supported mode with | |
199 * the fewest color samples is chosen. | |
200 */ | |
201 const MSAACoverageMode& getMSAACoverageMode(int desiredSampleCount) const; | |
202 | |
203 FBFetchType fbFetchType() const { return fFBFetchType; } | 160 FBFetchType fbFetchType() const { return fFBFetchType; } |
204 | 161 |
205 /** | 162 /** |
206 * Prints the caps info using GrPrintf. | 163 * Prints the caps info using GrPrintf. |
207 */ | 164 */ |
208 virtual void print() const SK_OVERRIDE; | 165 virtual void print() const SK_OVERRIDE; |
209 | 166 |
210 /** | 167 /** |
211 * Gets an array of legal stencil formats. These formats are not guaranteed | 168 * Gets an array of legal stencil formats. These formats are not guaranteed |
212 * to be supported by the driver but are legal GLenum names given the GL | 169 * to be supported by the driver but are legal GLenum names given the GL |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 // used as a color attachment when a particular stencil format is used | 298 // used as a color attachment when a particular stencil format is used |
342 // as a stencil attachment. | 299 // as a stencil attachment. |
343 SkTArray<VerifiedColorConfigs, true> fStencilVerifiedColorConfigs; | 300 SkTArray<VerifiedColorConfigs, true> fStencilVerifiedColorConfigs; |
344 | 301 |
345 int fMaxFragmentUniformVectors; | 302 int fMaxFragmentUniformVectors; |
346 int fMaxVertexAttributes; | 303 int fMaxVertexAttributes; |
347 int fMaxFragmentTextureUnits; | 304 int fMaxFragmentTextureUnits; |
348 int fMaxFixedFunctionTextureCoords; | 305 int fMaxFixedFunctionTextureCoords; |
349 | 306 |
350 MSFBOType fMSFBOType; | 307 MSFBOType fMSFBOType; |
351 CoverageAAType fCoverageAAType; | |
352 SkTDArray<MSAACoverageMode> fMSAACoverageModes; | |
353 | 308 |
354 FBFetchType fFBFetchType; | 309 FBFetchType fFBFetchType; |
355 | 310 |
356 bool fRGBA8RenderbufferSupport : 1; | 311 bool fRGBA8RenderbufferSupport : 1; |
357 bool fBGRAFormatSupport : 1; | 312 bool fBGRAFormatSupport : 1; |
358 bool fBGRAIsInternalFormat : 1; | 313 bool fBGRAIsInternalFormat : 1; |
359 bool fTextureSwizzleSupport : 1; | 314 bool fTextureSwizzleSupport : 1; |
360 bool fUnpackRowLengthSupport : 1; | 315 bool fUnpackRowLengthSupport : 1; |
361 bool fUnpackFlipYSupport : 1; | 316 bool fUnpackFlipYSupport : 1; |
362 bool fPackRowLengthSupport : 1; | 317 bool fPackRowLengthSupport : 1; |
363 bool fPackFlipYSupport : 1; | 318 bool fPackFlipYSupport : 1; |
364 bool fTextureUsageSupport : 1; | 319 bool fTextureUsageSupport : 1; |
365 bool fTexStorageSupport : 1; | 320 bool fTexStorageSupport : 1; |
366 bool fTextureRedSupport : 1; | 321 bool fTextureRedSupport : 1; |
367 bool fImagingSupport : 1; | 322 bool fImagingSupport : 1; |
368 bool fTwoFormatLimit : 1; | 323 bool fTwoFormatLimit : 1; |
369 bool fFragCoordsConventionSupport : 1; | 324 bool fFragCoordsConventionSupport : 1; |
370 bool fVertexArrayObjectSupport : 1; | 325 bool fVertexArrayObjectSupport : 1; |
371 bool fUseNonVBOVertexAndIndexDynamicData : 1; | 326 bool fUseNonVBOVertexAndIndexDynamicData : 1; |
372 bool fIsCoreProfile : 1; | 327 bool fIsCoreProfile : 1; |
373 bool fFixedFunctionSupport : 1; | 328 bool fFixedFunctionSupport : 1; |
374 bool fDiscardFBSupport : 1; | 329 bool fDiscardFBSupport : 1; |
375 | 330 |
376 typedef GrDrawTargetCaps INHERITED; | 331 typedef GrDrawTargetCaps INHERITED; |
377 }; | 332 }; |
378 | 333 |
379 #endif | 334 #endif |
OLD | NEW |