| 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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 ctxInfo.hasExtension("GL_NV_framebuffer_mixed_samples") && | 291 ctxInfo.hasExtension("GL_NV_framebuffer_mixed_samples") && |
| 292 ctxInfo.hasExtension("GL_NV_sample_mask_override_coverage") && | 292 ctxInfo.hasExtension("GL_NV_sample_mask_override_coverage") && |
| 293 ctxInfo.hasExtension("GL_EXT_raster_multisample"); | 293 ctxInfo.hasExtension("GL_EXT_raster_multisample"); |
| 294 } | 294 } |
| 295 | 295 |
| 296 /************************************************************************** | 296 /************************************************************************** |
| 297 * GrCaps fields | 297 * GrCaps fields |
| 298 **************************************************************************/ | 298 **************************************************************************/ |
| 299 | 299 |
| 300 this->initFSAASupport(ctxInfo, gli); | 300 this->initFSAASupport(ctxInfo, gli); |
| 301 this->initBlendEqationSupport(ctxInfo); |
| 301 this->initStencilFormats(ctxInfo); | 302 this->initStencilFormats(ctxInfo); |
| 302 | 303 |
| 303 if (kGL_GrGLStandard == standard) { | 304 if (kGL_GrGLStandard == standard) { |
| 304 // we could also look for GL_ATI_separate_stencil extension or | 305 // we could also look for GL_ATI_separate_stencil extension or |
| 305 // GL_EXT_stencil_two_side but they use different function signatures | 306 // GL_EXT_stencil_two_side but they use different function signatures |
| 306 // than GL2.0+ (and than each other). | 307 // than GL2.0+ (and than each other). |
| 307 fTwoSidedStencilSupport = (ctxInfo.version() >= GR_GL_VER(2,0)); | 308 fTwoSidedStencilSupport = (ctxInfo.version() >= GR_GL_VER(2,0)); |
| 308 // supported on GL 1.4 and higher or by extension | 309 // supported on GL 1.4 and higher or by extension |
| 309 fStencilWrapOpsSupport = (ctxInfo.version() >= GR_GL_VER(1,4)) || | 310 fStencilWrapOpsSupport = (ctxInfo.version() >= GR_GL_VER(1,4)) || |
| 310 ctxInfo.hasExtension("GL_EXT_stencil_wrap"); | 311 ctxInfo.hasExtension("GL_EXT_stencil_wrap"); |
| 311 } else { | 312 } else { |
| 312 // ES 2 has two sided stencil and stencil wrap | 313 // ES 2 has two sided stencil and stencil wrap |
| 313 fTwoSidedStencilSupport = true; | 314 fTwoSidedStencilSupport = true; |
| 314 fStencilWrapOpsSupport = true; | 315 fStencilWrapOpsSupport = true; |
| 315 } | 316 } |
| 316 | 317 |
| 317 // Disabling advanced blend until we can resolve various bugs | |
| 318 #if 0 | |
| 319 if (kIntel_GrGLVendor != ctxInfo.vendor()) { | |
| 320 if (ctxInfo.hasExtension("GL_NV_blend_equation_advanced_coherent")) { | |
| 321 fBlendEquationSupport = kAdvancedCoherent_BlendEquationSupport; | |
| 322 glslCaps->fAdvBlendEqInteraction = GrGLSLCaps::kAutomatic_AdvBlendEq
Interaction; | |
| 323 } else if (ctxInfo.hasExtension("GL_KHR_blend_equation_advanced_coherent
")) { | |
| 324 fBlendEquationSupport = kAdvancedCoherent_BlendEquationSupport; | |
| 325 glslCaps->fAdvBlendEqInteraction = GrGLSLCaps::kGeneralEnable_AdvBle
ndEqInteraction; | |
| 326 } else if (ctxInfo.hasExtension("GL_NV_blend_equation_advanced")) { | |
| 327 fBlendEquationSupport = kAdvanced_BlendEquationSupport; | |
| 328 glslCaps->fAdvBlendEqInteraction = GrGLSLCaps::kAutomatic_AdvBlendEq
Interaction; | |
| 329 } else if (ctxInfo.hasExtension("GL_KHR_blend_equation_advanced")) { | |
| 330 fBlendEquationSupport = kAdvanced_BlendEquationSupport; | |
| 331 glslCaps->fAdvBlendEqInteraction = GrGLSLCaps::kGeneralEnable_AdvBle
ndEqInteraction; | |
| 332 } | |
| 333 } | |
| 334 #endif | |
| 335 if (kGL_GrGLStandard == standard) { | 318 if (kGL_GrGLStandard == standard) { |
| 336 fMapBufferFlags = kCanMap_MapFlag; // we require VBO support and the des
ktop VBO | 319 fMapBufferFlags = kCanMap_MapFlag; // we require VBO support and the des
ktop VBO |
| 337 // extension includes glMapBuffer. | 320 // extension includes glMapBuffer. |
| 338 if (version >= GR_GL_VER(3, 0) || ctxInfo.hasExtension("GL_ARB_map_buffe
r_range")) { | 321 if (version >= GR_GL_VER(3, 0) || ctxInfo.hasExtension("GL_ARB_map_buffe
r_range")) { |
| 339 fMapBufferFlags |= kSubset_MapFlag; | 322 fMapBufferFlags |= kSubset_MapFlag; |
| 340 fMapBufferType = kMapBufferRange_MapBufferType; | 323 fMapBufferType = kMapBufferRange_MapBufferType; |
| 341 } else { | 324 } else { |
| 342 fMapBufferType = kMapBuffer_MapBufferType; | 325 fMapBufferType = kMapBuffer_MapBufferType; |
| 343 } | 326 } |
| 344 } else { | 327 } else { |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 802 if ((ctxInfo.version() >= GR_GL_VER(3,0)) || | 785 if ((ctxInfo.version() >= GR_GL_VER(3,0)) || |
| 803 ctxInfo.hasExtension("GL_ARB_framebuffer_object")) { | 786 ctxInfo.hasExtension("GL_ARB_framebuffer_object")) { |
| 804 fMSFBOType = GrGLCaps::kDesktop_ARB_MSFBOType; | 787 fMSFBOType = GrGLCaps::kDesktop_ARB_MSFBOType; |
| 805 } else if (ctxInfo.hasExtension("GL_EXT_framebuffer_multisample") && | 788 } else if (ctxInfo.hasExtension("GL_EXT_framebuffer_multisample") && |
| 806 ctxInfo.hasExtension("GL_EXT_framebuffer_blit")) { | 789 ctxInfo.hasExtension("GL_EXT_framebuffer_blit")) { |
| 807 fMSFBOType = GrGLCaps::kDesktop_EXT_MSFBOType; | 790 fMSFBOType = GrGLCaps::kDesktop_EXT_MSFBOType; |
| 808 } | 791 } |
| 809 } | 792 } |
| 810 } | 793 } |
| 811 | 794 |
| 795 void GrGLCaps::initBlendEqationSupport(const GrGLContextInfo& ctxInfo) { |
| 796 GrGLSLCaps* glslCaps = static_cast<GrGLSLCaps*>(fShaderCaps.get()); |
| 797 |
| 798 // Disabling advanced blend on various platforms with major known issues. We
also block Chrome |
| 799 // for now until its own blacklists can be updated. |
| 800 if (kAdreno4xx_GrGLRenderer == ctxInfo.renderer() || |
| 801 kIntel_GrGLDriver == ctxInfo.driver() || |
| 802 kChromium_GrGLDriver == ctxInfo.driver()) { |
| 803 return; |
| 804 } |
| 805 |
| 806 if (ctxInfo.hasExtension("GL_NV_blend_equation_advanced_coherent")) { |
| 807 fBlendEquationSupport = kAdvancedCoherent_BlendEquationSupport; |
| 808 glslCaps->fAdvBlendEqInteraction = GrGLSLCaps::kAutomatic_AdvBlendEqInte
raction; |
| 809 } else if (ctxInfo.hasExtension("GL_KHR_blend_equation_advanced_coherent"))
{ |
| 810 fBlendEquationSupport = kAdvancedCoherent_BlendEquationSupport; |
| 811 glslCaps->fAdvBlendEqInteraction = GrGLSLCaps::kGeneralEnable_AdvBlendEq
Interaction; |
| 812 } else if (kNVIDIA_GrGLDriver == ctxInfo.driver() && |
| 813 ctxInfo.driverVersion() < GR_GL_DRIVER_VER(337,00)) { |
| 814 // Non-coherent advanced blend has an issue on NVIDIA pre 337.00. |
| 815 return; |
| 816 } else if (ctxInfo.hasExtension("GL_NV_blend_equation_advanced")) { |
| 817 fBlendEquationSupport = kAdvanced_BlendEquationSupport; |
| 818 glslCaps->fAdvBlendEqInteraction = GrGLSLCaps::kAutomatic_AdvBlendEqInte
raction; |
| 819 } else if (ctxInfo.hasExtension("GL_KHR_blend_equation_advanced")) { |
| 820 fBlendEquationSupport = kAdvanced_BlendEquationSupport; |
| 821 glslCaps->fAdvBlendEqInteraction = GrGLSLCaps::kGeneralEnable_AdvBlendEq
Interaction; |
| 822 // TODO: Use kSpecificEnables_AdvBlendEqInteraction if "blend_support_al
l_equations" is |
| 823 // slow on a particular platform. |
| 824 } else { |
| 825 return; // No advanced blend support. |
| 826 } |
| 827 |
| 828 SkASSERT(this->advancedBlendEquationSupport()); |
| 829 |
| 830 if (kNVIDIA_GrGLDriver == ctxInfo.driver()) { |
| 831 // Blacklist color-dodge and color-burn on NVIDIA until the fix is relea
sed. |
| 832 fAdvBlendEqBlacklist |= (1 << kColorDodge_GrBlendEquation) | |
| 833 (1 << kColorBurn_GrBlendEquation); |
| 834 } |
| 835 } |
| 836 |
| 812 namespace { | 837 namespace { |
| 813 const GrGLuint kUnknownBitCount = GrGLStencilAttachment::kUnknownBitCount; | 838 const GrGLuint kUnknownBitCount = GrGLStencilAttachment::kUnknownBitCount; |
| 814 } | 839 } |
| 815 | 840 |
| 816 void GrGLCaps::initStencilFormats(const GrGLContextInfo& ctxInfo) { | 841 void GrGLCaps::initStencilFormats(const GrGLContextInfo& ctxInfo) { |
| 817 | 842 |
| 818 // Build up list of legal stencil formats (though perhaps not supported on | 843 // Build up list of legal stencil formats (though perhaps not supported on |
| 819 // the particular gpu/driver) from most preferred to least. | 844 // the particular gpu/driver) from most preferred to least. |
| 820 | 845 |
| 821 // these consts are in order of most preferred to least preferred | 846 // these consts are in order of most preferred to least preferred |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1109 if (fGeometryShaderSupport) { | 1134 if (fGeometryShaderSupport) { |
| 1110 for (int p = 0; p < kGrSLPrecisionCount; ++p) { | 1135 for (int p = 0; p < kGrSLPrecisionCount; ++p) { |
| 1111 fFloatPrecisions[kGeometry_GrShaderType][p] = fFloatPrecisions[kVert
ex_GrShaderType][p]; | 1136 fFloatPrecisions[kGeometry_GrShaderType][p] = fFloatPrecisions[kVert
ex_GrShaderType][p]; |
| 1112 } | 1137 } |
| 1113 } | 1138 } |
| 1114 } | 1139 } |
| 1115 | 1140 |
| 1116 | 1141 |
| 1117 | 1142 |
| 1118 | 1143 |
| OLD | NEW |