| 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 kLast_TransferBufferType = kChromium_TransferBufferType, | 116 kLast_TransferBufferType = kChromium_TransferBufferType, |
| 117 }; | 117 }; |
| 118 | 118 |
| 119 /** | 119 /** |
| 120 * Initializes the GrGLCaps to the set of features supported in the current | 120 * Initializes the GrGLCaps to the set of features supported in the current |
| 121 * OpenGL context accessible via ctxInfo. | 121 * OpenGL context accessible via ctxInfo. |
| 122 */ | 122 */ |
| 123 GrGLCaps(const GrContextOptions& contextOptions, const GrGLContextInfo& ctxI
nfo, | 123 GrGLCaps(const GrContextOptions& contextOptions, const GrGLContextInfo& ctxI
nfo, |
| 124 const GrGLInterface* glInterface); | 124 const GrGLInterface* glInterface); |
| 125 | 125 |
| 126 bool isConfigTexturable(GrPixelConfig config) const override { |
| 127 SkASSERT(kGrPixelConfigCnt > config); |
| 128 return SkToBool(fConfigTable[config].fFlags & ConfigInfo::kTextureable_F
lag); |
| 129 } |
| 130 |
| 131 bool isConfigRenderable(GrPixelConfig config, bool withMSAA) const override
{ |
| 132 SkASSERT(kGrPixelConfigCnt > config); |
| 133 if (withMSAA) { |
| 134 return SkToBool(fConfigTable[config].fFlags & ConfigInfo::kRenderabl
eWithMSAA_Flag); |
| 135 } else { |
| 136 return SkToBool(fConfigTable[config].fFlags & ConfigInfo::kRenderabl
e_Flag); |
| 137 } |
| 138 } |
| 139 |
| 126 /** Returns conversions to various GL format parameters for a GrPixelCfonig.
*/ | 140 /** Returns conversions to various GL format parameters for a GrPixelCfonig.
*/ |
| 127 const ConfigFormats& configGLFormats(GrPixelConfig config) const { | 141 const ConfigFormats& configGLFormats(GrPixelConfig config) const { |
| 128 return fConfigTable[config].fFormats; | 142 return fConfigTable[config].fFormats; |
| 129 } | 143 } |
| 130 | 144 |
| 131 | |
| 132 /** | 145 /** |
| 133 * Gets an array of legal stencil formats. These formats are not guaranteed | 146 * Gets an array of legal stencil formats. These formats are not guaranteed |
| 134 * to be supported by the driver but are legal GLenum names given the GL | 147 * to be supported by the driver but are legal GLenum names given the GL |
| 135 * version and extensions supported. | 148 * version and extensions supported. |
| 136 */ | 149 */ |
| 137 const SkTArray<StencilFormat, true>& stencilFormats() const { | 150 const SkTArray<StencilFormat, true>& stencilFormats() const { |
| 138 return fStencilFormats; | 151 return fStencilFormats; |
| 139 } | 152 } |
| 140 | 153 |
| 141 /** | 154 /** |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 | 233 |
| 221 /// The maximum number of fragment uniform vectors (GLES has min. 16). | 234 /// The maximum number of fragment uniform vectors (GLES has min. 16). |
| 222 int maxFragmentUniformVectors() const { return fMaxFragmentUniformVectors; } | 235 int maxFragmentUniformVectors() const { return fMaxFragmentUniformVectors; } |
| 223 | 236 |
| 224 /// maximum number of attribute values per vertex | 237 /// maximum number of attribute values per vertex |
| 225 int maxVertexAttributes() const { return fMaxVertexAttributes; } | 238 int maxVertexAttributes() const { return fMaxVertexAttributes; } |
| 226 | 239 |
| 227 /// maximum number of texture units accessible in the fragment shader. | 240 /// maximum number of texture units accessible in the fragment shader. |
| 228 int maxFragmentTextureUnits() const { return fMaxFragmentTextureUnits; } | 241 int maxFragmentTextureUnits() const { return fMaxFragmentTextureUnits; } |
| 229 | 242 |
| 230 /// ES requires an extension to support RGBA8 in RenderBufferStorage | |
| 231 bool rgba8RenderbufferSupport() const { return fRGBA8RenderbufferSupport; } | |
| 232 | |
| 233 /** | 243 /** |
| 234 * Depending on the ES extensions present the BGRA external format may | 244 * Depending on the ES extensions present the BGRA external format may |
| 235 * correspond either a BGRA or RGBA internalFormat. On desktop GL it is | 245 * correspond to either a BGRA or RGBA internalFormat. On desktop GL it is |
| 236 * RGBA. | 246 * RGBA. |
| 237 */ | 247 */ |
| 238 bool bgraIsInternalFormat() const { return fBGRAIsInternalFormat; } | 248 bool bgraIsInternalFormat() const; |
| 239 | 249 |
| 240 /// Is there support for GL_UNPACK_ROW_LENGTH | 250 /// Is there support for GL_UNPACK_ROW_LENGTH |
| 241 bool unpackRowLengthSupport() const { return fUnpackRowLengthSupport; } | 251 bool unpackRowLengthSupport() const { return fUnpackRowLengthSupport; } |
| 242 | 252 |
| 243 /// Is there support for GL_UNPACK_FLIP_Y | 253 /// Is there support for GL_UNPACK_FLIP_Y |
| 244 bool unpackFlipYSupport() const { return fUnpackFlipYSupport; } | 254 bool unpackFlipYSupport() const { return fUnpackFlipYSupport; } |
| 245 | 255 |
| 246 /// Is there support for GL_PACK_ROW_LENGTH | 256 /// Is there support for GL_PACK_ROW_LENGTH |
| 247 bool packRowLengthSupport() const { return fPackRowLengthSupport; } | 257 bool packRowLengthSupport() const { return fPackRowLengthSupport; } |
| 248 | 258 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 * If false this does not mean sRGB is not supported but rather that if it i
s supported | 312 * If false this does not mean sRGB is not supported but rather that if it i
s supported |
| 303 * it cannot be turned off for configs that support it. | 313 * it cannot be turned off for configs that support it. |
| 304 */ | 314 */ |
| 305 bool srgbWriteControl() const { return fSRGBWriteControl; } | 315 bool srgbWriteControl() const { return fSRGBWriteControl; } |
| 306 | 316 |
| 307 /** | 317 /** |
| 308 * Returns a string containing the caps info. | 318 * Returns a string containing the caps info. |
| 309 */ | 319 */ |
| 310 SkString dump() const override; | 320 SkString dump() const override; |
| 311 | 321 |
| 312 /** | |
| 313 * LATC can appear under one of three possible names. In order to know | |
| 314 * which GL internal format to use, we need to keep track of which name | |
| 315 * we found LATC under. The default is LATC. | |
| 316 */ | |
| 317 enum LATCAlias { | |
| 318 kLATC_LATCAlias, | |
| 319 kRGTC_LATCAlias, | |
| 320 k3DC_LATCAlias | |
| 321 }; | |
| 322 | |
| 323 LATCAlias latcAlias() const { return fLATCAlias; } | |
| 324 | |
| 325 bool rgba8888PixelsOpsAreSlow() const { return fRGBA8888PixelsOpsAreSlow; } | 322 bool rgba8888PixelsOpsAreSlow() const { return fRGBA8888PixelsOpsAreSlow; } |
| 326 bool partialFBOReadIsSlow() const { return fPartialFBOReadIsSlow; } | 323 bool partialFBOReadIsSlow() const { return fPartialFBOReadIsSlow; } |
| 327 | 324 |
| 328 const GrGLSLCaps* glslCaps() const { return reinterpret_cast<GrGLSLCaps*>(fS
haderCaps.get()); } | 325 const GrGLSLCaps* glslCaps() const { return reinterpret_cast<GrGLSLCaps*>(fS
haderCaps.get()); } |
| 329 | 326 |
| 330 private: | 327 private: |
| 331 void init(const GrContextOptions&, const GrGLContextInfo&, const GrGLInterfa
ce*); | 328 void init(const GrContextOptions&, const GrGLContextInfo&, const GrGLInterfa
ce*); |
| 332 void initGLSL(const GrGLContextInfo&); | 329 void initGLSL(const GrGLContextInfo&); |
| 333 bool hasPathRenderingSupport(const GrGLContextInfo&, const GrGLInterface*); | 330 bool hasPathRenderingSupport(const GrGLContextInfo&, const GrGLInterface*); |
| 334 | 331 |
| 335 void onApplyOptionsOverrides(const GrContextOptions& options) override; | 332 void onApplyOptionsOverrides(const GrContextOptions& options) override; |
| 336 | 333 |
| 337 void initFSAASupport(const GrGLContextInfo&, const GrGLInterface*); | 334 void initFSAASupport(const GrGLContextInfo&, const GrGLInterface*); |
| 338 void initBlendEqationSupport(const GrGLContextInfo&); | 335 void initBlendEqationSupport(const GrGLContextInfo&); |
| 339 void initStencilFormats(const GrGLContextInfo&); | 336 void initStencilFormats(const GrGLContextInfo&); |
| 340 // This must be called after initFSAASupport(). | 337 // This must be called after initFSAASupport(). |
| 341 void initConfigRenderableTable(const GrGLContextInfo&, bool srgbSupport); | 338 void initConfigTable(const GrGLContextInfo&, const GrGLInterface* gli); |
| 342 void initConfigTexturableTable(const GrGLContextInfo&, const GrGLInterface*,
bool srgbSupport); | |
| 343 | 339 |
| 344 void initShaderPrecisionTable(const GrGLContextInfo& ctxInfo, | 340 void initShaderPrecisionTable(const GrGLContextInfo& ctxInfo, |
| 345 const GrGLInterface* intf, | 341 const GrGLInterface* intf, |
| 346 GrGLSLCaps* glslCaps); | 342 GrGLSLCaps* glslCaps); |
| 347 | 343 |
| 348 void initConfigSwizzleTable(const GrGLContextInfo& ctxInfo, GrGLSLCaps* glsl
Caps); | 344 void initConfigSwizzleTable(const GrGLContextInfo& ctxInfo, GrGLSLCaps* glsl
Caps); |
| 349 | 345 |
| 350 void initConfigTable(const GrGLContextInfo&); | |
| 351 | 346 |
| 352 SkTArray<StencilFormat, true> fStencilFormats; | 347 SkTArray<StencilFormat, true> fStencilFormats; |
| 353 | 348 |
| 354 int fMaxFragmentUniformVectors; | 349 int fMaxFragmentUniformVectors; |
| 355 int fMaxVertexAttributes; | 350 int fMaxVertexAttributes; |
| 356 int fMaxFragmentTextureUnits; | 351 int fMaxFragmentTextureUnits; |
| 357 | 352 |
| 358 MSFBOType fMSFBOType; | 353 MSFBOType fMSFBOType; |
| 359 InvalidateFBType fInvalidateFBType; | 354 InvalidateFBType fInvalidateFBType; |
| 360 MapBufferType fMapBufferType; | 355 MapBufferType fMapBufferType; |
| 361 TransferBufferType fTransferBufferType; | 356 TransferBufferType fTransferBufferType; |
| 362 LATCAlias fLATCAlias; | |
| 363 | 357 |
| 364 bool fRGBA8RenderbufferSupport : 1; | |
| 365 bool fBGRAIsInternalFormat : 1; | |
| 366 bool fUnpackRowLengthSupport : 1; | 358 bool fUnpackRowLengthSupport : 1; |
| 367 bool fUnpackFlipYSupport : 1; | 359 bool fUnpackFlipYSupport : 1; |
| 368 bool fPackRowLengthSupport : 1; | 360 bool fPackRowLengthSupport : 1; |
| 369 bool fPackFlipYSupport : 1; | 361 bool fPackFlipYSupport : 1; |
| 370 bool fTextureUsageSupport : 1; | 362 bool fTextureUsageSupport : 1; |
| 371 bool fTexStorageSupport : 1; | 363 bool fTexStorageSupport : 1; |
| 372 bool fTextureRedSupport : 1; | 364 bool fTextureRedSupport : 1; |
| 373 bool fImagingSupport : 1; | 365 bool fImagingSupport : 1; |
| 374 bool fVertexArrayObjectSupport : 1; | 366 bool fVertexArrayObjectSupport : 1; |
| 375 bool fDirectStateAccessSupport : 1; | 367 bool fDirectStateAccessSupport : 1; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 // This indicates that a stencil format has not yet been determined
for the config. | 405 // This indicates that a stencil format has not yet been determined
for the config. |
| 414 kUnknown_StencilIndex = -1, | 406 kUnknown_StencilIndex = -1, |
| 415 // This indicates that there is no supported stencil format for the
config. | 407 // This indicates that there is no supported stencil format for the
config. |
| 416 kUnsupported_StencilFormatIndex = -2 | 408 kUnsupported_StencilFormatIndex = -2 |
| 417 }; | 409 }; |
| 418 | 410 |
| 419 // Index fStencilFormats. | 411 // Index fStencilFormats. |
| 420 int fStencilFormatIndex; | 412 int fStencilFormatIndex; |
| 421 | 413 |
| 422 enum { | 414 enum { |
| 423 kVerifiedColorAttachment_Flag = 0x1 | 415 kVerifiedColorAttachment_Flag = 0x1, |
| 416 kTextureable_Flag = 0x2, |
| 417 kRenderable_Flag = 0x4, |
| 418 kRenderableWithMSAA_Flag = 0x8, |
| 424 }; | 419 }; |
| 425 uint32_t fFlags; | 420 uint32_t fFlags; |
| 426 }; | 421 }; |
| 427 | 422 |
| 428 ConfigInfo fConfigTable[kGrPixelConfigCnt]; | 423 ConfigInfo fConfigTable[kGrPixelConfigCnt]; |
| 429 | 424 |
| 430 typedef GrCaps INHERITED; | 425 typedef GrCaps INHERITED; |
| 431 }; | 426 }; |
| 432 | 427 |
| 433 #endif | 428 #endif |
| OLD | NEW |