| 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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 | 373 |
| 374 typedef GrDrawTargetCaps INHERITED; | 374 typedef GrDrawTargetCaps INHERITED; |
| 375 }; | 375 }; |
| 376 | 376 |
| 377 | 377 |
| 378 class GrGLSLCaps : public GrShaderCaps { | 378 class GrGLSLCaps : public GrShaderCaps { |
| 379 public: | 379 public: |
| 380 SK_DECLARE_INST_COUNT(GrGLSLCaps) | 380 SK_DECLARE_INST_COUNT(GrGLSLCaps) |
| 381 | 381 |
| 382 /** | 382 /** |
| 383 * Indicates how GLSL must interact with advanced blend equations. The KHR ex
tension requires |
| 384 * special layout qualifiers in the fragment shader. |
| 385 */ |
| 386 enum AdvancedBlendEqnInteraction { |
| 387 kNotSupported_AdvancedBlendEqnInteraction, //<! No advanced blen
d equation support |
| 388 kAutomatic_AdvancedBlendEqnInteraction, //<! No interaction r
equired |
| 389 kMustEnable_AdvancedBlendEqnInteraction, //<! Blanket qualifie
r for all equations |
| 390 kMustEnableSeparately_AdvancedBlendEqnInteraction, //<! Separate qualifi
ers per equation |
| 391 |
| 392 kLast_AdvancedBlendEqnInteraction = kMustEnableSeparately_AdvancedBlendE
qnInteraction |
| 393 }; |
| 394 |
| 395 /** |
| 383 * Creates a GrGLSLCaps that advertises no support for any extensions, | 396 * Creates a GrGLSLCaps that advertises no support for any extensions, |
| 384 * formats, etc. Call init to initialize from a GrGLContextInfo. | 397 * formats, etc. Call init to initialize from a GrGLContextInfo. |
| 385 */ | 398 */ |
| 386 GrGLSLCaps(); | 399 GrGLSLCaps(); |
| 387 ~GrGLSLCaps() override {} | 400 ~GrGLSLCaps() override {} |
| 388 | 401 |
| 389 GrGLSLCaps(const GrGLSLCaps& caps); | 402 GrGLSLCaps(const GrGLSLCaps& caps); |
| 390 | 403 |
| 391 GrGLSLCaps& operator = (const GrGLSLCaps& caps); | 404 GrGLSLCaps& operator = (const GrGLSLCaps& caps); |
| 392 | 405 |
| 393 /** | 406 /** |
| 394 * Resets the caps such that nothing is supported. | 407 * Resets the caps such that nothing is supported. |
| 395 */ | 408 */ |
| 396 void reset() override; | 409 void reset() override; |
| 397 | 410 |
| 398 /** | 411 /** |
| 399 * Initializes the GrGLSLCaps to the set of features supported in the curren
t | 412 * Initializes the GrGLSLCaps to the set of features supported in the curren
t |
| 400 * OpenGL context accessible via ctxInfo. | 413 * OpenGL context accessible via ctxInfo. |
| 401 */ | 414 */ |
| 402 bool init(const GrGLContextInfo& ctxInfo, const GrGLInterface* glInterface); | 415 bool init(const GrGLContextInfo&, const GrGLInterface*, const GrGLCaps&); |
| 403 | 416 |
| 404 /** | 417 /** |
| 405 * Some helper functions for encapsulating various extensions to read FB Buf
fer on openglES | 418 * Some helper functions for encapsulating various extensions to read FB Buf
fer on openglES |
| 406 * | 419 * |
| 407 * TODO(joshualitt) On desktop opengl 4.2+ we can achieve something similar
to this effect | 420 * TODO(joshualitt) On desktop opengl 4.2+ we can achieve something similar
to this effect |
| 408 */ | 421 */ |
| 409 bool fbFetchSupport() const { return fFBFetchSupport; } | 422 bool fbFetchSupport() const { return fFBFetchSupport; } |
| 410 | 423 |
| 411 bool fbFetchNeedsCustomOutput() const { return fFBFetchNeedsCustomOutput; } | 424 bool fbFetchNeedsCustomOutput() const { return fFBFetchNeedsCustomOutput; } |
| 412 | 425 |
| 413 const char* fbFetchColorName() const { return fFBFetchColorName; } | 426 const char* fbFetchColorName() const { return fFBFetchColorName; } |
| 414 | 427 |
| 415 const char* fbFetchExtensionString() const { return fFBFetchExtensionString;
} | 428 const char* fbFetchExtensionString() const { return fFBFetchExtensionString;
} |
| 416 | 429 |
| 417 bool dropsTileOnZeroDivide() const { return fDropsTileOnZeroDivide; } | 430 bool dropsTileOnZeroDivide() const { return fDropsTileOnZeroDivide; } |
| 418 | 431 |
| 432 AdvancedBlendEqnInteraction advancedBlendEqnInteraction() const { |
| 433 return fAdvancedBlendEqnInteraction; |
| 434 } |
| 435 |
| 436 bool mustEnableAdvancedBlendEquations() const { |
| 437 return fAdvancedBlendEqnInteraction >= kMustEnable_AdvancedBlendEqnInter
action; |
| 438 } |
| 439 |
| 419 /** | 440 /** |
| 420 * Returns a string containing the caps info. | 441 * Returns a string containing the caps info. |
| 421 */ | 442 */ |
| 422 SkString dump() const override; | 443 SkString dump() const override; |
| 423 | 444 |
| 424 private: | 445 private: |
| 425 // Must be called after fGeometryShaderSupport is initialized. | 446 // Must be called after fGeometryShaderSupport is initialized. |
| 426 void initShaderPrecisionTable(const GrGLContextInfo&, const GrGLInterface*); | 447 void initShaderPrecisionTable(const GrGLContextInfo&, const GrGLInterface*); |
| 427 | 448 |
| 428 bool fDropsTileOnZeroDivide : 1; | 449 bool fDropsTileOnZeroDivide : 1; |
| 429 bool fFBFetchSupport : 1; | 450 bool fFBFetchSupport : 1; |
| 430 bool fFBFetchNeedsCustomOutput : 1; | 451 bool fFBFetchNeedsCustomOutput : 1; |
| 431 | 452 |
| 432 const char* fFBFetchColorName; | 453 const char* fFBFetchColorName; |
| 433 const char* fFBFetchExtensionString; | 454 const char* fFBFetchExtensionString; |
| 434 | 455 |
| 456 AdvancedBlendEqnInteraction fAdvancedBlendEqnInteraction; |
| 457 |
| 435 typedef GrShaderCaps INHERITED; | 458 typedef GrShaderCaps INHERITED; |
| 436 }; | 459 }; |
| 437 | 460 |
| 438 | 461 |
| 439 #endif | 462 #endif |
| OLD | NEW |