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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 | 285 |
286 // We need dual source blending and the ability to disable multisample in or
der to support mixed | 286 // We need dual source blending and the ability to disable multisample in or
der to support mixed |
287 // samples in every corner case. | 287 // samples in every corner case. |
288 if (fMultisampleDisableSupport && glslCaps->fDualSourceBlendingSupport) { | 288 if (fMultisampleDisableSupport && glslCaps->fDualSourceBlendingSupport) { |
289 // We understand "mixed samples" to mean the collective capability of 3
different extensions | 289 // We understand "mixed samples" to mean the collective capability of 3
different extensions |
290 glslCaps->fMixedSamplesSupport = | 290 glslCaps->fMixedSamplesSupport = |
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 // Workaround NVIDIA bug related to glInvalidateFramebuffer and mixed sample
s. |
| 296 if (kNVIDIA_GrGLDriver == ctxInfo.driver() && fShaderCaps->mixedSamplesSuppo
rt()) { |
| 297 fDiscardRenderTargetSupport = false; |
| 298 fInvalidateFBType = kNone_InvalidateFBType; |
| 299 } |
295 | 300 |
296 /************************************************************************** | 301 /************************************************************************** |
297 * GrCaps fields | 302 * GrCaps fields |
298 **************************************************************************/ | 303 **************************************************************************/ |
299 | 304 |
300 this->initFSAASupport(ctxInfo, gli); | 305 this->initFSAASupport(ctxInfo, gli); |
301 this->initStencilFormats(ctxInfo); | 306 this->initStencilFormats(ctxInfo); |
302 | 307 |
303 if (kGL_GrGLStandard == standard) { | 308 if (kGL_GrGLStandard == standard) { |
304 // we could also look for GL_ATI_separate_stencil extension or | 309 // we could also look for GL_ATI_separate_stencil extension or |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
782 void GrGLCaps::initFSAASupport(const GrGLContextInfo& ctxInfo, const GrGLInterfa
ce* gli) { | 787 void GrGLCaps::initFSAASupport(const GrGLContextInfo& ctxInfo, const GrGLInterfa
ce* gli) { |
783 | 788 |
784 fMSFBOType = kNone_MSFBOType; | 789 fMSFBOType = kNone_MSFBOType; |
785 if (kGL_GrGLStandard != ctxInfo.standard()) { | 790 if (kGL_GrGLStandard != ctxInfo.standard()) { |
786 // We prefer the EXT/IMG extension over ES3 MSAA because we've observed | 791 // We prefer the EXT/IMG extension over ES3 MSAA because we've observed |
787 // ES3 driver bugs on at least one device with a tiled GPU (N10). | 792 // ES3 driver bugs on at least one device with a tiled GPU (N10). |
788 if (ctxInfo.hasExtension("GL_EXT_multisampled_render_to_texture")) { | 793 if (ctxInfo.hasExtension("GL_EXT_multisampled_render_to_texture")) { |
789 fMSFBOType = kES_EXT_MsToTexture_MSFBOType; | 794 fMSFBOType = kES_EXT_MsToTexture_MSFBOType; |
790 } else if (ctxInfo.hasExtension("GL_IMG_multisampled_render_to_texture")
) { | 795 } else if (ctxInfo.hasExtension("GL_IMG_multisampled_render_to_texture")
) { |
791 fMSFBOType = kES_IMG_MsToTexture_MSFBOType; | 796 fMSFBOType = kES_IMG_MsToTexture_MSFBOType; |
| 797 } else if (fShaderCaps->mixedSamplesSupport() && fShaderCaps->pathRender
ingSupport()) { |
| 798 fMSFBOType = kMixedSamples_MSFBOType; |
792 } else if (ctxInfo.version() >= GR_GL_VER(3,0)) { | 799 } else if (ctxInfo.version() >= GR_GL_VER(3,0)) { |
793 fMSFBOType = GrGLCaps::kES_3_0_MSFBOType; | 800 fMSFBOType = GrGLCaps::kES_3_0_MSFBOType; |
794 } else if (ctxInfo.hasExtension("GL_CHROMIUM_framebuffer_multisample"))
{ | 801 } else if (ctxInfo.hasExtension("GL_CHROMIUM_framebuffer_multisample"))
{ |
795 // chrome's extension is equivalent to the EXT msaa | 802 // chrome's extension is equivalent to the EXT msaa |
796 // and fbo_blit extensions. | 803 // and fbo_blit extensions. |
797 fMSFBOType = kDesktop_EXT_MSFBOType; | 804 fMSFBOType = kDesktop_EXT_MSFBOType; |
798 } else if (ctxInfo.hasExtension("GL_APPLE_framebuffer_multisample")) { | 805 } else if (ctxInfo.hasExtension("GL_APPLE_framebuffer_multisample")) { |
799 fMSFBOType = kES_Apple_MSFBOType; | 806 fMSFBOType = kES_Apple_MSFBOType; |
800 } | 807 } |
801 } else { | 808 } else { |
802 if ((ctxInfo.version() >= GR_GL_VER(3,0)) || | 809 if (fShaderCaps->mixedSamplesSupport() && fShaderCaps->pathRenderingSupp
ort()) { |
| 810 fMSFBOType = kMixedSamples_MSFBOType; |
| 811 } else if ((ctxInfo.version() >= GR_GL_VER(3,0)) || |
803 ctxInfo.hasExtension("GL_ARB_framebuffer_object")) { | 812 ctxInfo.hasExtension("GL_ARB_framebuffer_object")) { |
804 fMSFBOType = GrGLCaps::kDesktop_ARB_MSFBOType; | 813 fMSFBOType = GrGLCaps::kDesktop_ARB_MSFBOType; |
805 } else if (ctxInfo.hasExtension("GL_EXT_framebuffer_multisample") && | 814 } else if (ctxInfo.hasExtension("GL_EXT_framebuffer_multisample") && |
806 ctxInfo.hasExtension("GL_EXT_framebuffer_blit")) { | 815 ctxInfo.hasExtension("GL_EXT_framebuffer_blit")) { |
807 fMSFBOType = GrGLCaps::kDesktop_EXT_MSFBOType; | 816 fMSFBOType = GrGLCaps::kDesktop_EXT_MSFBOType; |
808 } | 817 } |
809 } | 818 } |
810 } | 819 } |
811 | 820 |
812 namespace { | 821 namespace { |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
925 } | 934 } |
926 | 935 |
927 static const char* kMSFBOExtStr[] = { | 936 static const char* kMSFBOExtStr[] = { |
928 "None", | 937 "None", |
929 "ARB", | 938 "ARB", |
930 "EXT", | 939 "EXT", |
931 "ES 3.0", | 940 "ES 3.0", |
932 "Apple", | 941 "Apple", |
933 "IMG MS To Texture", | 942 "IMG MS To Texture", |
934 "EXT MS To Texture", | 943 "EXT MS To Texture", |
| 944 "MixedSamples", |
935 }; | 945 }; |
936 GR_STATIC_ASSERT(0 == kNone_MSFBOType); | 946 GR_STATIC_ASSERT(0 == kNone_MSFBOType); |
937 GR_STATIC_ASSERT(1 == kDesktop_ARB_MSFBOType); | 947 GR_STATIC_ASSERT(1 == kDesktop_ARB_MSFBOType); |
938 GR_STATIC_ASSERT(2 == kDesktop_EXT_MSFBOType); | 948 GR_STATIC_ASSERT(2 == kDesktop_EXT_MSFBOType); |
939 GR_STATIC_ASSERT(3 == kES_3_0_MSFBOType); | 949 GR_STATIC_ASSERT(3 == kES_3_0_MSFBOType); |
940 GR_STATIC_ASSERT(4 == kES_Apple_MSFBOType); | 950 GR_STATIC_ASSERT(4 == kES_Apple_MSFBOType); |
941 GR_STATIC_ASSERT(5 == kES_IMG_MsToTexture_MSFBOType); | 951 GR_STATIC_ASSERT(5 == kES_IMG_MsToTexture_MSFBOType); |
942 GR_STATIC_ASSERT(6 == kES_EXT_MsToTexture_MSFBOType); | 952 GR_STATIC_ASSERT(6 == kES_EXT_MsToTexture_MSFBOType); |
| 953 GR_STATIC_ASSERT(7 == kMixedSamples_MSFBOType); |
943 GR_STATIC_ASSERT(SK_ARRAY_COUNT(kMSFBOExtStr) == kLast_MSFBOType + 1); | 954 GR_STATIC_ASSERT(SK_ARRAY_COUNT(kMSFBOExtStr) == kLast_MSFBOType + 1); |
944 | 955 |
945 static const char* kInvalidateFBTypeStr[] = { | 956 static const char* kInvalidateFBTypeStr[] = { |
946 "None", | 957 "None", |
947 "Discard", | 958 "Discard", |
948 "Invalidate", | 959 "Invalidate", |
949 }; | 960 }; |
950 GR_STATIC_ASSERT(0 == kNone_InvalidateFBType); | 961 GR_STATIC_ASSERT(0 == kNone_InvalidateFBType); |
951 GR_STATIC_ASSERT(1 == kDiscard_InvalidateFBType); | 962 GR_STATIC_ASSERT(1 == kDiscard_InvalidateFBType); |
952 GR_STATIC_ASSERT(2 == kInvalidate_InvalidateFBType); | 963 GR_STATIC_ASSERT(2 == kInvalidate_InvalidateFBType); |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1109 if (fGeometryShaderSupport) { | 1120 if (fGeometryShaderSupport) { |
1110 for (int p = 0; p < kGrSLPrecisionCount; ++p) { | 1121 for (int p = 0; p < kGrSLPrecisionCount; ++p) { |
1111 fFloatPrecisions[kGeometry_GrShaderType][p] = fFloatPrecisions[kVert
ex_GrShaderType][p]; | 1122 fFloatPrecisions[kGeometry_GrShaderType][p] = fFloatPrecisions[kVert
ex_GrShaderType][p]; |
1112 } | 1123 } |
1113 } | 1124 } |
1114 } | 1125 } |
1115 | 1126 |
1116 | 1127 |
1117 | 1128 |
1118 | 1129 |
OLD | NEW |