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 #include "GrGLCaps.h" | 9 #include "GrGLCaps.h" |
10 | 10 |
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 if (kGLES_GrGLStandard == standard) { | 557 if (kGLES_GrGLStandard == standard) { |
558 return "#version 300 es\n"; | 558 return "#version 300 es\n"; |
559 } else { | 559 } else { |
560 SkASSERT(kGL_GrGLStandard == standard); | 560 SkASSERT(kGL_GrGLStandard == standard); |
561 if (isCoreProfile) { | 561 if (isCoreProfile) { |
562 return "#version 330\n"; | 562 return "#version 330\n"; |
563 } else { | 563 } else { |
564 return "#version 330 compatibility\n"; | 564 return "#version 330 compatibility\n"; |
565 } | 565 } |
566 } | 566 } |
| 567 case k400_GrGLSLGeneration: |
| 568 SkASSERT(kGL_GrGLStandard == standard); |
| 569 if (isCoreProfile) { |
| 570 return "#version 400\n"; |
| 571 } else { |
| 572 return "#version 400 compatibility\n"; |
| 573 } |
567 case k310es_GrGLSLGeneration: | 574 case k310es_GrGLSLGeneration: |
568 SkASSERT(kGLES_GrGLStandard == standard); | 575 SkASSERT(kGLES_GrGLStandard == standard); |
569 return "#version 310 es\n"; | 576 return "#version 310 es\n"; |
| 577 case k320es_GrGLSLGeneration: |
| 578 SkASSERT(kGLES_GrGLStandard == standard); |
| 579 return "#version 320 es\n"; |
570 } | 580 } |
571 return "<no version>"; | 581 return "<no version>"; |
572 } | 582 } |
573 | 583 |
574 void GrGLCaps::initGLSL(const GrGLContextInfo& ctxInfo) { | 584 void GrGLCaps::initGLSL(const GrGLContextInfo& ctxInfo) { |
575 GrGLStandard standard = ctxInfo.standard(); | 585 GrGLStandard standard = ctxInfo.standard(); |
576 GrGLVersion version = ctxInfo.version(); | 586 GrGLVersion version = ctxInfo.version(); |
577 | 587 |
578 /************************************************************************** | 588 /************************************************************************** |
579 * Caps specific to GrGLSLCaps | 589 * Caps specific to GrGLSLCaps |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 glslCaps->fNoPerspectiveInterpolationSupport = | 628 glslCaps->fNoPerspectiveInterpolationSupport = |
619 ctxInfo.glslGeneration() >= k130_GrGLSLGeneration; | 629 ctxInfo.glslGeneration() >= k130_GrGLSLGeneration; |
620 } else { | 630 } else { |
621 if (ctxInfo.hasExtension("GL_NV_shader_noperspective_interpolation")) { | 631 if (ctxInfo.hasExtension("GL_NV_shader_noperspective_interpolation")) { |
622 glslCaps->fNoPerspectiveInterpolationSupport = true; | 632 glslCaps->fNoPerspectiveInterpolationSupport = true; |
623 glslCaps->fNoPerspectiveInterpolationExtensionString = | 633 glslCaps->fNoPerspectiveInterpolationExtensionString = |
624 "GL_NV_shader_noperspective_interpolation"; | 634 "GL_NV_shader_noperspective_interpolation"; |
625 } | 635 } |
626 } | 636 } |
627 | 637 |
| 638 if (kGL_GrGLStandard == standard) { |
| 639 glslCaps->fSampleVariablesSupport = ctxInfo.glslGeneration() >= k400_GrG
LSLGeneration; |
| 640 } else { |
| 641 if (ctxInfo.glslGeneration() >= k320es_GrGLSLGeneration) { |
| 642 glslCaps->fSampleVariablesSupport = true; |
| 643 } else if (ctxInfo.hasExtension("GL_OES_sample_variables")) { |
| 644 glslCaps->fSampleVariablesSupport = true; |
| 645 glslCaps->fSampleVariablesExtensionString = "GL_OES_sample_variables
"; |
| 646 } |
| 647 } |
| 648 |
| 649 if (glslCaps->fSampleVariablesSupport) { |
| 650 glslCaps->fSampleMaskOverrideCoverageSupport = |
| 651 ctxInfo.hasExtension("GL_NV_sample_mask_override_coverage"); |
| 652 } |
| 653 |
628 // Adreno GPUs have a tendency to drop tiles when there is a divide-by-zero
in a shader | 654 // Adreno GPUs have a tendency to drop tiles when there is a divide-by-zero
in a shader |
629 glslCaps->fDropsTileOnZeroDivide = kQualcomm_GrGLVendor == ctxInfo.vendor(); | 655 glslCaps->fDropsTileOnZeroDivide = kQualcomm_GrGLVendor == ctxInfo.vendor(); |
630 | 656 |
631 // On the NexusS and GalaxyNexus, the use of 'any' causes the compilation er
ror "Calls to any | 657 // On the NexusS and GalaxyNexus, the use of 'any' causes the compilation er
ror "Calls to any |
632 // function that may require a gradient calculation inside a conditional blo
ck may return | 658 // function that may require a gradient calculation inside a conditional blo
ck may return |
633 // undefined results". This appears to be an issue with the 'any' call since
even the simple | 659 // undefined results". This appears to be an issue with the 'any' call since
even the simple |
634 // "result=black; if (any()) result=white;" code fails to compile. This issu
e comes into play | 660 // "result=black; if (any()) result=white;" code fails to compile. This issu
e comes into play |
635 // from our GrTextureDomain processor. | 661 // from our GrTextureDomain processor. |
636 glslCaps->fCanUseAnyFunctionInShader = kImagination_GrGLVendor != ctxInfo.ve
ndor(); | 662 glslCaps->fCanUseAnyFunctionInShader = kImagination_GrGLVendor != ctxInfo.ve
ndor(); |
637 | 663 |
(...skipping 1070 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1708 for (int j = 0; j < kExternalFormatUsageCnt; ++j) { | 1734 for (int j = 0; j < kExternalFormatUsageCnt; ++j) { |
1709 SkASSERT(defaultEntry.fFormats.fExternalFormat[j] != | 1735 SkASSERT(defaultEntry.fFormats.fExternalFormat[j] != |
1710 fConfigTable[i].fFormats.fExternalFormat[j]); | 1736 fConfigTable[i].fFormats.fExternalFormat[j]); |
1711 } | 1737 } |
1712 SkASSERT(defaultEntry.fFormats.fExternalType != fConfigTable[i].fFormats
.fExternalType); | 1738 SkASSERT(defaultEntry.fFormats.fExternalType != fConfigTable[i].fFormats
.fExternalType); |
1713 } | 1739 } |
1714 #endif | 1740 #endif |
1715 } | 1741 } |
1716 | 1742 |
1717 void GrGLCaps::onApplyOptionsOverrides(const GrContextOptions& options) {} | 1743 void GrGLCaps::onApplyOptionsOverrides(const GrContextOptions& options) {} |
OLD | NEW |