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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 return fMultisampleDisableSupport; | 278 return fMultisampleDisableSupport; |
279 } | 279 } |
280 | 280 |
281 /// Use indices or vertices in CPU arrays rather than VBOs for dynamic conte
nt. | 281 /// Use indices or vertices in CPU arrays rather than VBOs for dynamic conte
nt. |
282 bool useNonVBOVertexAndIndexDynamicData() const { | 282 bool useNonVBOVertexAndIndexDynamicData() const { |
283 return fUseNonVBOVertexAndIndexDynamicData; | 283 return fUseNonVBOVertexAndIndexDynamicData; |
284 } | 284 } |
285 | 285 |
286 /// Does ReadPixels support the provided format/type combo? | 286 /// Does ReadPixels support the provided format/type combo? |
287 bool readPixelsSupported(const GrGLInterface* intf, | 287 bool readPixelsSupported(const GrGLInterface* intf, |
288 GrGLenum format, | 288 GrPixelConfig readConfig, |
289 GrGLenum type, | 289 GrPixelConfig currFBOConfig) const; |
290 GrGLenum currFboFormat) const; | |
291 | 290 |
292 bool isCoreProfile() const { return fIsCoreProfile; } | 291 bool isCoreProfile() const { return fIsCoreProfile; } |
293 | 292 |
294 bool bindFragDataLocationSupport() const { return fBindFragDataLocationSuppo
rt; } | 293 bool bindFragDataLocationSupport() const { return fBindFragDataLocationSuppo
rt; } |
295 | 294 |
296 bool bindUniformLocationSupport() const { return fBindUniformLocationSupport
; } | 295 bool bindUniformLocationSupport() const { return fBindUniformLocationSupport
; } |
297 | 296 |
298 /// Are textures with GL_TEXTURE_EXTERNAL_OES type supported. | 297 /// Are textures with GL_TEXTURE_EXTERNAL_OES type supported. |
299 bool externalTextureSupport() const { return fExternalTextureSupport; } | 298 bool externalTextureSupport() const { return fExternalTextureSupport; } |
300 | 299 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 | 334 |
336 void onApplyOptionsOverrides(const GrContextOptions& options) override; | 335 void onApplyOptionsOverrides(const GrContextOptions& options) override; |
337 | 336 |
338 void initFSAASupport(const GrGLContextInfo&, const GrGLInterface*); | 337 void initFSAASupport(const GrGLContextInfo&, const GrGLInterface*); |
339 void initBlendEqationSupport(const GrGLContextInfo&); | 338 void initBlendEqationSupport(const GrGLContextInfo&); |
340 void initStencilFormats(const GrGLContextInfo&); | 339 void initStencilFormats(const GrGLContextInfo&); |
341 // This must be called after initFSAASupport(). | 340 // This must be called after initFSAASupport(). |
342 void initConfigRenderableTable(const GrGLContextInfo&, bool srgbSupport); | 341 void initConfigRenderableTable(const GrGLContextInfo&, bool srgbSupport); |
343 void initConfigTexturableTable(const GrGLContextInfo&, const GrGLInterface*,
bool srgbSupport); | 342 void initConfigTexturableTable(const GrGLContextInfo&, const GrGLInterface*,
bool srgbSupport); |
344 | 343 |
345 bool doReadPixelsSupported(const GrGLInterface* intf, GrGLenum format, GrGLe
num type) const; | |
346 | |
347 void initShaderPrecisionTable(const GrGLContextInfo& ctxInfo, | 344 void initShaderPrecisionTable(const GrGLContextInfo& ctxInfo, |
348 const GrGLInterface* intf, | 345 const GrGLInterface* intf, |
349 GrGLSLCaps* glslCaps); | 346 GrGLSLCaps* glslCaps); |
350 | 347 |
351 void initConfigSwizzleTable(const GrGLContextInfo& ctxInfo, GrGLSLCaps* glsl
Caps); | 348 void initConfigSwizzleTable(const GrGLContextInfo& ctxInfo, GrGLSLCaps* glsl
Caps); |
352 | 349 |
353 void initConfigTable(const GrGLContextInfo&); | 350 void initConfigTable(const GrGLContextInfo&); |
354 | 351 |
355 SkTArray<StencilFormat, true> fStencilFormats; | 352 SkTArray<StencilFormat, true> fStencilFormats; |
356 | 353 |
(...skipping 10 matching lines...) Expand all Loading... |
367 bool fRGBA8RenderbufferSupport : 1; | 364 bool fRGBA8RenderbufferSupport : 1; |
368 bool fBGRAIsInternalFormat : 1; | 365 bool fBGRAIsInternalFormat : 1; |
369 bool fUnpackRowLengthSupport : 1; | 366 bool fUnpackRowLengthSupport : 1; |
370 bool fUnpackFlipYSupport : 1; | 367 bool fUnpackFlipYSupport : 1; |
371 bool fPackRowLengthSupport : 1; | 368 bool fPackRowLengthSupport : 1; |
372 bool fPackFlipYSupport : 1; | 369 bool fPackFlipYSupport : 1; |
373 bool fTextureUsageSupport : 1; | 370 bool fTextureUsageSupport : 1; |
374 bool fTexStorageSupport : 1; | 371 bool fTexStorageSupport : 1; |
375 bool fTextureRedSupport : 1; | 372 bool fTextureRedSupport : 1; |
376 bool fImagingSupport : 1; | 373 bool fImagingSupport : 1; |
377 bool fTwoFormatLimit : 1; | |
378 bool fVertexArrayObjectSupport : 1; | 374 bool fVertexArrayObjectSupport : 1; |
379 bool fDirectStateAccessSupport : 1; | 375 bool fDirectStateAccessSupport : 1; |
380 bool fDebugSupport : 1; | 376 bool fDebugSupport : 1; |
381 bool fES2CompatibilitySupport : 1; | 377 bool fES2CompatibilitySupport : 1; |
382 bool fMultisampleDisableSupport : 1; | 378 bool fMultisampleDisableSupport : 1; |
383 bool fUseNonVBOVertexAndIndexDynamicData : 1; | 379 bool fUseNonVBOVertexAndIndexDynamicData : 1; |
384 bool fIsCoreProfile : 1; | 380 bool fIsCoreProfile : 1; |
385 bool fBindFragDataLocationSupport : 1; | 381 bool fBindFragDataLocationSupport : 1; |
386 bool fSRGBWriteControl : 1; | 382 bool fSRGBWriteControl : 1; |
387 bool fRGBA8888PixelsOpsAreSlow : 1; | 383 bool fRGBA8888PixelsOpsAreSlow : 1; |
388 bool fPartialFBOReadIsSlow : 1; | 384 bool fPartialFBOReadIsSlow : 1; |
389 bool fBindUniformLocationSupport : 1; | 385 bool fBindUniformLocationSupport : 1; |
390 bool fExternalTextureSupport : 1; | 386 bool fExternalTextureSupport : 1; |
391 | 387 |
| 388 /** Number type of the components (with out considering number of bits.) */ |
| 389 enum FormatType { |
| 390 kNormalizedFixedPoint_FormatType, |
| 391 kFloat_FormatType, |
| 392 }; |
| 393 |
| 394 struct ReadPixelsFormat { |
| 395 ReadPixelsFormat() : fFormat(0), fType(0) {} |
| 396 GrGLenum fFormat; |
| 397 GrGLenum fType; |
| 398 }; |
| 399 |
392 struct ConfigInfo { | 400 struct ConfigInfo { |
393 ConfigInfo() : fStencilFormatIndex(kUnknown_StencilIndex), fFlags(0) {}; | 401 ConfigInfo() : fStencilFormatIndex(kUnknown_StencilIndex), fFlags(0) {} |
394 | 402 |
395 ConfigFormats fFormats; | 403 ConfigFormats fFormats; |
396 | 404 |
| 405 FormatType fFormatType; |
| 406 |
| 407 // On ES contexts there are restrictions on type type/format that may be
used for |
| 408 // ReadPixels. One is implicitly specified by the current FBO's format.
The other is |
| 409 // queryable. This stores the queried option (lazily). |
| 410 ReadPixelsFormat fSecondReadPixelsFormat; |
| 411 |
397 enum { | 412 enum { |
398 // This indicates that a stencil format has not yet been determined
for the config. | 413 // This indicates that a stencil format has not yet been determined
for the config. |
399 kUnknown_StencilIndex = -1, | 414 kUnknown_StencilIndex = -1, |
400 // This indicates that there is no supported stencil format for the
config. | 415 // This indicates that there is no supported stencil format for the
config. |
401 kUnsupported_StencilFormatIndex = -2 | 416 kUnsupported_StencilFormatIndex = -2 |
402 }; | 417 }; |
403 | 418 |
404 // Index fStencilFormats. | 419 // Index fStencilFormats. |
405 int fStencilFormatIndex; | 420 int fStencilFormatIndex; |
406 | 421 |
407 enum { | 422 enum { |
408 kVerifiedColorAttachment_Flag = 0x1 | 423 kVerifiedColorAttachment_Flag = 0x1 |
409 }; | 424 }; |
410 uint32_t fFlags; | 425 uint32_t fFlags; |
411 }; | 426 }; |
412 | 427 |
413 ConfigInfo fConfigTable[kGrPixelConfigCnt]; | 428 ConfigInfo fConfigTable[kGrPixelConfigCnt]; |
414 | 429 |
415 struct ReadPixelsSupportedFormat { | |
416 GrGLenum fFormat; | |
417 GrGLenum fType; | |
418 GrGLenum fFboFormat; | |
419 | |
420 bool operator==(const ReadPixelsSupportedFormat& rhs) const { | |
421 return fFormat == rhs.fFormat | |
422 && fType == rhs.fType | |
423 && fFboFormat == rhs.fFboFormat; | |
424 } | |
425 }; | |
426 mutable SkTHashMap<ReadPixelsSupportedFormat, bool> fReadPixelsSupportedCach
e; | |
427 | |
428 typedef GrCaps INHERITED; | 430 typedef GrCaps INHERITED; |
429 }; | 431 }; |
430 | 432 |
431 #endif | 433 #endif |
OLD | NEW |