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 AdvBlendEqInteraction { |
| 387 kNotSupported_AdvBlendEqInteraction, //<! No _blend_equation_advance
d extension |
| 388 kAutomatic_AdvBlendEqInteraction, //<! No interaction required |
| 389 kGeneralEnable_AdvBlendEqInteraction, //<! layout(blend_support_all_e
quations) out |
| 390 kSpecificEnables_AdvBlendEqInteraction, //<! Specific layout qualifiers
per equation |
| 391 |
| 392 kLast_AdvBlendEqInteraction = kSpecificEnables_AdvBlendEqInteraction |
| 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 AdvBlendEqInteraction advBlendEqInteraction() const { return fAdvBlendEqInte
raction; } |
| 433 |
| 434 bool mustEnableAdvBlendEqs() const { |
| 435 return fAdvBlendEqInteraction >= kGeneralEnable_AdvBlendEqInteraction; |
| 436 } |
| 437 |
| 438 bool mustEnableSpecificAdvBlendEqs() const { |
| 439 return fAdvBlendEqInteraction == kSpecificEnables_AdvBlendEqInteraction; |
| 440 } |
| 441 |
419 /** | 442 /** |
420 * Returns a string containing the caps info. | 443 * Returns a string containing the caps info. |
421 */ | 444 */ |
422 SkString dump() const override; | 445 SkString dump() const override; |
423 | 446 |
424 private: | 447 private: |
425 // Must be called after fGeometryShaderSupport is initialized. | 448 // Must be called after fGeometryShaderSupport is initialized. |
426 void initShaderPrecisionTable(const GrGLContextInfo&, const GrGLInterface*); | 449 void initShaderPrecisionTable(const GrGLContextInfo&, const GrGLInterface*); |
427 | 450 |
428 bool fDropsTileOnZeroDivide : 1; | 451 bool fDropsTileOnZeroDivide : 1; |
429 bool fFBFetchSupport : 1; | 452 bool fFBFetchSupport : 1; |
430 bool fFBFetchNeedsCustomOutput : 1; | 453 bool fFBFetchNeedsCustomOutput : 1; |
431 | 454 |
432 const char* fFBFetchColorName; | 455 const char* fFBFetchColorName; |
433 const char* fFBFetchExtensionString; | 456 const char* fFBFetchExtensionString; |
434 | 457 |
| 458 AdvBlendEqInteraction fAdvBlendEqInteraction; |
| 459 |
435 typedef GrShaderCaps INHERITED; | 460 typedef GrShaderCaps INHERITED; |
436 }; | 461 }; |
437 | 462 |
438 | 463 |
439 #endif | 464 #endif |
OLD | NEW |