| 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 |
| 11 | 11 |
| 12 #include "GrCaps.h" |
| 12 #include "glsl/GrGLSL.h" | 13 #include "glsl/GrGLSL.h" |
| 13 #include "GrCaps.h" | |
| 14 #include "GrGLStencilAttachment.h" | 14 #include "GrGLStencilAttachment.h" |
| 15 #include "GrSwizzle.h" | |
| 16 #include "SkChecksum.h" | 15 #include "SkChecksum.h" |
| 17 #include "SkTHash.h" | 16 #include "SkTHash.h" |
| 18 #include "SkTArray.h" | 17 #include "SkTArray.h" |
| 19 | 18 |
| 20 class GrGLContextInfo; | 19 class GrGLContextInfo; |
| 21 class GrGLSLCaps; | 20 class GrGLSLCaps; |
| 22 | 21 |
| 23 /** | 22 /** |
| 24 * Stores some capabilities of a GL context. Most are determined by the GL | 23 * Stores some capabilities of a GL context. Most are determined by the GL |
| 25 * version and the extensions string. It also tracks formats that have passed | 24 * version and the extensions string. It also tracks formats that have passed |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 } else { | 135 } else { |
| 137 return SkToBool(fConfigTable[config].fFlags & ConfigInfo::kRenderabl
e_Flag); | 136 return SkToBool(fConfigTable[config].fFlags & ConfigInfo::kRenderabl
e_Flag); |
| 138 } | 137 } |
| 139 } | 138 } |
| 140 | 139 |
| 141 /** Returns conversions to various GL format parameters for a GrPixelCfonig.
*/ | 140 /** Returns conversions to various GL format parameters for a GrPixelCfonig.
*/ |
| 142 const ConfigFormats& configGLFormats(GrPixelConfig config) const { | 141 const ConfigFormats& configGLFormats(GrPixelConfig config) const { |
| 143 return fConfigTable[config].fFormats; | 142 return fConfigTable[config].fFormats; |
| 144 } | 143 } |
| 145 | 144 |
| 146 /** Returns the mapping between GrPixelConfig components and GL internal for
mat components. */ | |
| 147 const GrSwizzle& configSwizzle(GrPixelConfig config) const { | |
| 148 return fConfigTable[config].fSwizzle; | |
| 149 } | |
| 150 | |
| 151 /** | 145 /** |
| 152 * 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 |
| 153 * 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 |
| 154 * version and extensions supported. | 148 * version and extensions supported. |
| 155 */ | 149 */ |
| 156 const SkTArray<StencilFormat, true>& stencilFormats() const { | 150 const SkTArray<StencilFormat, true>& stencilFormats() const { |
| 157 return fStencilFormats; | 151 return fStencilFormats; |
| 158 } | 152 } |
| 159 | 153 |
| 160 /** | 154 /** |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 | 300 |
| 307 bool isCoreProfile() const { return fIsCoreProfile; } | 301 bool isCoreProfile() const { return fIsCoreProfile; } |
| 308 | 302 |
| 309 bool bindFragDataLocationSupport() const { return fBindFragDataLocationSuppo
rt; } | 303 bool bindFragDataLocationSupport() const { return fBindFragDataLocationSuppo
rt; } |
| 310 | 304 |
| 311 bool bindUniformLocationSupport() const { return fBindUniformLocationSupport
; } | 305 bool bindUniformLocationSupport() const { return fBindUniformLocationSupport
; } |
| 312 | 306 |
| 313 /// Are textures with GL_TEXTURE_EXTERNAL_OES type supported. | 307 /// Are textures with GL_TEXTURE_EXTERNAL_OES type supported. |
| 314 bool externalTextureSupport() const { return fExternalTextureSupport; } | 308 bool externalTextureSupport() const { return fExternalTextureSupport; } |
| 315 | 309 |
| 316 /// GL_ARB_texture_swizzle | |
| 317 bool textureSwizzleSupport() const { return fTextureSwizzleSupport; } | |
| 318 | |
| 319 /** | 310 /** |
| 320 * Is there support for enabling/disabling sRGB writes for sRGB-capable colo
r attachments? | 311 * Is there support for enabling/disabling sRGB writes for sRGB-capable colo
r attachments? |
| 321 * 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 |
| 322 * it cannot be turned off for configs that support it. | 313 * it cannot be turned off for configs that support it. |
| 323 */ | 314 */ |
| 324 bool srgbWriteControl() const { return fSRGBWriteControl; } | 315 bool srgbWriteControl() const { return fSRGBWriteControl; } |
| 325 | 316 |
| 326 /** | 317 /** |
| 327 * Returns a string containing the caps info. | 318 * Returns a string containing the caps info. |
| 328 */ | 319 */ |
| 329 SkString dump() const override; | 320 SkString dump() const override; |
| 330 | 321 |
| 331 bool rgba8888PixelsOpsAreSlow() const { return fRGBA8888PixelsOpsAreSlow; } | 322 bool rgba8888PixelsOpsAreSlow() const { return fRGBA8888PixelsOpsAreSlow; } |
| 332 bool partialFBOReadIsSlow() const { return fPartialFBOReadIsSlow; } | 323 bool partialFBOReadIsSlow() const { return fPartialFBOReadIsSlow; } |
| 333 | 324 |
| 334 const GrGLSLCaps* glslCaps() const { return reinterpret_cast<GrGLSLCaps*>(fS
haderCaps.get()); } | 325 const GrGLSLCaps* glslCaps() const { return reinterpret_cast<GrGLSLCaps*>(fS
haderCaps.get()); } |
| 335 | 326 |
| 336 private: | 327 private: |
| 337 void init(const GrContextOptions&, const GrGLContextInfo&, const GrGLInterfa
ce*); | 328 void init(const GrContextOptions&, const GrGLContextInfo&, const GrGLInterfa
ce*); |
| 338 void initGLSL(const GrGLContextInfo&); | 329 void initGLSL(const GrGLContextInfo&); |
| 339 bool hasPathRenderingSupport(const GrGLContextInfo&, const GrGLInterface*); | 330 bool hasPathRenderingSupport(const GrGLContextInfo&, const GrGLInterface*); |
| 340 | 331 |
| 341 void onApplyOptionsOverrides(const GrContextOptions& options) override; | 332 void onApplyOptionsOverrides(const GrContextOptions& options) override; |
| 342 | 333 |
| 343 void initFSAASupport(const GrGLContextInfo&, const GrGLInterface*); | 334 void initFSAASupport(const GrGLContextInfo&, const GrGLInterface*); |
| 344 void initBlendEqationSupport(const GrGLContextInfo&); | 335 void initBlendEqationSupport(const GrGLContextInfo&); |
| 345 void initStencilFormats(const GrGLContextInfo&); | 336 void initStencilFormats(const GrGLContextInfo&); |
| 346 // This must be called after initFSAASupport(). | 337 // This must be called after initFSAASupport(). |
| 347 void initConfigTable(const GrGLContextInfo&, const GrGLInterface* gli, GrGLS
LCaps* glslCaps); | 338 void initConfigTable(const GrGLContextInfo&, const GrGLInterface* gli); |
| 348 | 339 |
| 349 void initShaderPrecisionTable(const GrGLContextInfo& ctxInfo, | 340 void initShaderPrecisionTable(const GrGLContextInfo& ctxInfo, |
| 350 const GrGLInterface* intf, | 341 const GrGLInterface* intf, |
| 351 GrGLSLCaps* glslCaps); | 342 GrGLSLCaps* glslCaps); |
| 352 | 343 |
| 344 void initConfigSwizzleTable(const GrGLContextInfo& ctxInfo, GrGLSLCaps* glsl
Caps); |
| 345 |
| 346 |
| 353 SkTArray<StencilFormat, true> fStencilFormats; | 347 SkTArray<StencilFormat, true> fStencilFormats; |
| 354 | 348 |
| 355 int fMaxFragmentUniformVectors; | 349 int fMaxFragmentUniformVectors; |
| 356 int fMaxVertexAttributes; | 350 int fMaxVertexAttributes; |
| 357 int fMaxFragmentTextureUnits; | 351 int fMaxFragmentTextureUnits; |
| 358 | 352 |
| 359 MSFBOType fMSFBOType; | 353 MSFBOType fMSFBOType; |
| 360 InvalidateFBType fInvalidateFBType; | 354 InvalidateFBType fInvalidateFBType; |
| 361 MapBufferType fMapBufferType; | 355 MapBufferType fMapBufferType; |
| 362 TransferBufferType fTransferBufferType; | 356 TransferBufferType fTransferBufferType; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 375 bool fES2CompatibilitySupport : 1; | 369 bool fES2CompatibilitySupport : 1; |
| 376 bool fMultisampleDisableSupport : 1; | 370 bool fMultisampleDisableSupport : 1; |
| 377 bool fUseNonVBOVertexAndIndexDynamicData : 1; | 371 bool fUseNonVBOVertexAndIndexDynamicData : 1; |
| 378 bool fIsCoreProfile : 1; | 372 bool fIsCoreProfile : 1; |
| 379 bool fBindFragDataLocationSupport : 1; | 373 bool fBindFragDataLocationSupport : 1; |
| 380 bool fSRGBWriteControl : 1; | 374 bool fSRGBWriteControl : 1; |
| 381 bool fRGBA8888PixelsOpsAreSlow : 1; | 375 bool fRGBA8888PixelsOpsAreSlow : 1; |
| 382 bool fPartialFBOReadIsSlow : 1; | 376 bool fPartialFBOReadIsSlow : 1; |
| 383 bool fBindUniformLocationSupport : 1; | 377 bool fBindUniformLocationSupport : 1; |
| 384 bool fExternalTextureSupport : 1; | 378 bool fExternalTextureSupport : 1; |
| 385 bool fTextureSwizzleSupport : 1; | |
| 386 | 379 |
| 387 /** Number type of the components (with out considering number of bits.) */ | 380 /** Number type of the components (with out considering number of bits.) */ |
| 388 enum FormatType { | 381 enum FormatType { |
| 389 kNormalizedFixedPoint_FormatType, | 382 kNormalizedFixedPoint_FormatType, |
| 390 kFloat_FormatType, | 383 kFloat_FormatType, |
| 391 }; | 384 }; |
| 392 | 385 |
| 393 struct ReadPixelsFormat { | 386 struct ReadPixelsFormat { |
| 394 ReadPixelsFormat() : fFormat(0), fType(0) {} | 387 ReadPixelsFormat() : fFormat(0), fType(0) {} |
| 395 GrGLenum fFormat; | 388 GrGLenum fFormat; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 418 // Index fStencilFormats. | 411 // Index fStencilFormats. |
| 419 int fStencilFormatIndex; | 412 int fStencilFormatIndex; |
| 420 | 413 |
| 421 enum { | 414 enum { |
| 422 kVerifiedColorAttachment_Flag = 0x1, | 415 kVerifiedColorAttachment_Flag = 0x1, |
| 423 kTextureable_Flag = 0x2, | 416 kTextureable_Flag = 0x2, |
| 424 kRenderable_Flag = 0x4, | 417 kRenderable_Flag = 0x4, |
| 425 kRenderableWithMSAA_Flag = 0x8, | 418 kRenderableWithMSAA_Flag = 0x8, |
| 426 }; | 419 }; |
| 427 uint32_t fFlags; | 420 uint32_t fFlags; |
| 428 | |
| 429 GrSwizzle fSwizzle; | |
| 430 }; | 421 }; |
| 431 | 422 |
| 432 ConfigInfo fConfigTable[kGrPixelConfigCnt]; | 423 ConfigInfo fConfigTable[kGrPixelConfigCnt]; |
| 433 | 424 |
| 434 typedef GrCaps INHERITED; | 425 typedef GrCaps INHERITED; |
| 435 }; | 426 }; |
| 436 | 427 |
| 437 #endif | 428 #endif |
| OLD | NEW |