Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(602)

Side by Side Diff: src/gpu/gl/GrGLCaps.cpp

Issue 1410383011: Loosen requirements for mixed samples support (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/GrCaps.cpp ('k') | src/gpu/gl/GrGLGpu.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 glslCaps->fGeometryShaderSupport = ctxInfo.version() >= GR_GL_VER(3, 2) && 303 glslCaps->fGeometryShaderSupport = ctxInfo.version() >= GR_GL_VER(3, 2) &&
304 ctxInfo.glslGeneration() >= k150_GrGLSLGeneration; 304 ctxInfo.glslGeneration() >= k150_GrGLSLGeneration;
305 } 305 }
306 else { 306 else {
307 glslCaps->fDualSourceBlendingSupport = ctxInfo.hasExtension("GL_EXT_blen d_func_extended"); 307 glslCaps->fDualSourceBlendingSupport = ctxInfo.hasExtension("GL_EXT_blen d_func_extended");
308 308
309 glslCaps->fShaderDerivativeSupport = ctxInfo.version() >= GR_GL_VER(3, 0 ) || 309 glslCaps->fShaderDerivativeSupport = ctxInfo.version() >= GR_GL_VER(3, 0 ) ||
310 ctxInfo.hasExtension("GL_OES_standard_derivatives"); 310 ctxInfo.hasExtension("GL_OES_standard_derivatives");
311 } 311 }
312 312
313 // We need dual source blending and the ability to disable multisample in or der to support mixed
314 // samples in every corner case.
315 if (fMultisampleDisableSupport && glslCaps->fDualSourceBlendingSupport) {
316 // We understand "mixed samples" to mean the collective capability of 3 different extensions
317 glslCaps->fMixedSamplesSupport =
318 ctxInfo.hasExtension("GL_NV_framebuffer_mixed_samples") &&
319 ctxInfo.hasExtension("GL_NV_sample_mask_override_coverage") &&
320 ctxInfo.hasExtension("GL_EXT_raster_multisample");
321 }
322 // Workaround NVIDIA bug related to glInvalidateFramebuffer and mixed sample s.
323 if (kNVIDIA_GrGLDriver == ctxInfo.driver() && fShaderCaps->mixedSamplesSuppo rt()) {
324 fDiscardRenderTargetSupport = false;
325 fInvalidateFBType = kNone_InvalidateFBType;
326 }
327
328 if (kGL_GrGLStandard == standard) { 313 if (kGL_GrGLStandard == standard) {
329 glslCaps->fProgrammableSampleLocationsSupport = 314 glslCaps->fProgrammableSampleLocationsSupport =
330 ctxInfo.version() >= GR_GL_VER(4, 3) && 315 ctxInfo.version() >= GR_GL_VER(4, 3) &&
331 (ctxInfo.hasExtension("GL_ARB_sample_locations") || 316 (ctxInfo.hasExtension("GL_ARB_sample_locations") ||
332 ctxInfo.hasExtension("GL_NV_sample_locations")); 317 ctxInfo.hasExtension("GL_NV_sample_locations"));
333 } else { 318 } else {
334 glslCaps->fProgrammableSampleLocationsSupport = 319 glslCaps->fProgrammableSampleLocationsSupport =
335 ctxInfo.version() >= GR_GL_VER(3, 1) && 320 ctxInfo.version() >= GR_GL_VER(3, 1) &&
336 ctxInfo.hasExtension("GL_NV_sample_locations"); 321 ctxInfo.hasExtension("GL_NV_sample_locations");
337 } 322 }
338 323
339 /************************************************************************** 324 /**************************************************************************
340 * GrCaps fields 325 * GrCaps fields
341 **************************************************************************/ 326 **************************************************************************/
342 327
343 // fPathRenderingSupport and fMixedSampleSupport must be set before calling initFSAASupport. 328 // We need dual source blending and the ability to disable multisample in or der to support mixed
344 // Both of these are set in the GrShaderCaps. 329 // samples in every corner case.
330 if (fMultisampleDisableSupport && glslCaps->dualSourceBlendingSupport()) {
331 fMixedSamplesSupport = ctxInfo.hasExtension("GL_NV_framebuffer_mixed_sam ples");
332 // Workaround NVIDIA bug related to glInvalidateFramebuffer and mixed sa mples.
333 if (fMixedSamplesSupport && kNVIDIA_GrGLDriver == ctxInfo.driver()) {
334 fDiscardRenderTargetSupport = false;
335 fInvalidateFBType = kNone_InvalidateFBType;
336 }
337 }
338
339 // fPathRenderingSupport and fMixedSamplesSupport must be set before calling initFSAASupport.
345 this->initFSAASupport(ctxInfo, gli); 340 this->initFSAASupport(ctxInfo, gli);
346 this->initBlendEqationSupport(ctxInfo); 341 this->initBlendEqationSupport(ctxInfo);
347 this->initStencilFormats(ctxInfo); 342 this->initStencilFormats(ctxInfo);
348 343
349 if (kGL_GrGLStandard == standard) { 344 if (kGL_GrGLStandard == standard) {
350 // we could also look for GL_ATI_separate_stencil extension or 345 // we could also look for GL_ATI_separate_stencil extension or
351 // GL_EXT_stencil_two_side but they use different function signatures 346 // GL_EXT_stencil_two_side but they use different function signatures
352 // than GL2.0+ (and than each other). 347 // than GL2.0+ (and than each other).
353 fTwoSidedStencilSupport = (ctxInfo.version() >= GR_GL_VER(2,0)); 348 fTwoSidedStencilSupport = (ctxInfo.version() >= GR_GL_VER(2,0));
354 // supported on GL 1.4 and higher or by extension 349 // supported on GL 1.4 and higher or by extension
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
976 void GrGLCaps::initFSAASupport(const GrGLContextInfo& ctxInfo, const GrGLInterfa ce* gli) { 971 void GrGLCaps::initFSAASupport(const GrGLContextInfo& ctxInfo, const GrGLInterfa ce* gli) {
977 972
978 fMSFBOType = kNone_MSFBOType; 973 fMSFBOType = kNone_MSFBOType;
979 if (kGL_GrGLStandard != ctxInfo.standard()) { 974 if (kGL_GrGLStandard != ctxInfo.standard()) {
980 // We prefer the EXT/IMG extension over ES3 MSAA because we've observed 975 // We prefer the EXT/IMG extension over ES3 MSAA because we've observed
981 // ES3 driver bugs on at least one device with a tiled GPU (N10). 976 // ES3 driver bugs on at least one device with a tiled GPU (N10).
982 if (ctxInfo.hasExtension("GL_EXT_multisampled_render_to_texture")) { 977 if (ctxInfo.hasExtension("GL_EXT_multisampled_render_to_texture")) {
983 fMSFBOType = kES_EXT_MsToTexture_MSFBOType; 978 fMSFBOType = kES_EXT_MsToTexture_MSFBOType;
984 } else if (ctxInfo.hasExtension("GL_IMG_multisampled_render_to_texture") ) { 979 } else if (ctxInfo.hasExtension("GL_IMG_multisampled_render_to_texture") ) {
985 fMSFBOType = kES_IMG_MsToTexture_MSFBOType; 980 fMSFBOType = kES_IMG_MsToTexture_MSFBOType;
986 } else if (fShaderCaps->mixedSamplesSupport() && fShaderCaps->pathRender ingSupport()) { 981 } else if (fMixedSamplesSupport && fShaderCaps->pathRenderingSupport()) {
987 fMSFBOType = kMixedSamples_MSFBOType; 982 fMSFBOType = kMixedSamples_MSFBOType;
988 } else if (ctxInfo.version() >= GR_GL_VER(3,0)) { 983 } else if (ctxInfo.version() >= GR_GL_VER(3,0)) {
989 fMSFBOType = GrGLCaps::kES_3_0_MSFBOType; 984 fMSFBOType = GrGLCaps::kES_3_0_MSFBOType;
990 } else if (ctxInfo.hasExtension("GL_CHROMIUM_framebuffer_multisample")) { 985 } else if (ctxInfo.hasExtension("GL_CHROMIUM_framebuffer_multisample")) {
991 // chrome's extension is equivalent to the EXT msaa 986 // chrome's extension is equivalent to the EXT msaa
992 // and fbo_blit extensions. 987 // and fbo_blit extensions.
993 fMSFBOType = kDesktop_EXT_MSFBOType; 988 fMSFBOType = kDesktop_EXT_MSFBOType;
994 } else if (ctxInfo.hasExtension("GL_APPLE_framebuffer_multisample")) { 989 } else if (ctxInfo.hasExtension("GL_APPLE_framebuffer_multisample")) {
995 fMSFBOType = kES_Apple_MSFBOType; 990 fMSFBOType = kES_Apple_MSFBOType;
996 } 991 }
997 } else { 992 } else {
998 if (fShaderCaps->mixedSamplesSupport() && fShaderCaps->pathRenderingSupp ort()) { 993 if (fMixedSamplesSupport && fShaderCaps->pathRenderingSupport()) {
999 fMSFBOType = kMixedSamples_MSFBOType; 994 fMSFBOType = kMixedSamples_MSFBOType;
1000 } else if ((ctxInfo.version() >= GR_GL_VER(3,0)) || 995 } else if ((ctxInfo.version() >= GR_GL_VER(3,0)) ||
1001 ctxInfo.hasExtension("GL_ARB_framebuffer_object")) { 996 ctxInfo.hasExtension("GL_ARB_framebuffer_object")) {
1002 fMSFBOType = GrGLCaps::kDesktop_ARB_MSFBOType; 997 fMSFBOType = GrGLCaps::kDesktop_ARB_MSFBOType;
1003 } else if (ctxInfo.hasExtension("GL_EXT_framebuffer_multisample") && 998 } else if (ctxInfo.hasExtension("GL_EXT_framebuffer_multisample") &&
1004 ctxInfo.hasExtension("GL_EXT_framebuffer_blit")) { 999 ctxInfo.hasExtension("GL_EXT_framebuffer_blit")) {
1005 fMSFBOType = GrGLCaps::kDesktop_EXT_MSFBOType; 1000 fMSFBOType = GrGLCaps::kDesktop_EXT_MSFBOType;
1006 } 1001 }
1007 } 1002 }
1008 } 1003 }
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
1316 glslCaps->fConfigSwizzle[kR11_EAC_GrPixelConfig] = "rrrr"; 1311 glslCaps->fConfigSwizzle[kR11_EAC_GrPixelConfig] = "rrrr";
1317 glslCaps->fConfigSwizzle[kASTC_12x12_GrPixelConfig] = "rgba"; 1312 glslCaps->fConfigSwizzle[kASTC_12x12_GrPixelConfig] = "rgba";
1318 glslCaps->fConfigSwizzle[kRGBA_float_GrPixelConfig] = "rgba"; 1313 glslCaps->fConfigSwizzle[kRGBA_float_GrPixelConfig] = "rgba";
1319 glslCaps->fConfigSwizzle[kRGBA_half_GrPixelConfig] = "rgba"; 1314 glslCaps->fConfigSwizzle[kRGBA_half_GrPixelConfig] = "rgba";
1320 1315
1321 } 1316 }
1322 1317
1323 void GrGLCaps::onApplyOptionsOverrides(const GrContextOptions& options) {} 1318 void GrGLCaps::onApplyOptionsOverrides(const GrContextOptions& options) {}
1324 1319
1325 1320
OLDNEW
« no previous file with comments | « src/gpu/GrCaps.cpp ('k') | src/gpu/gl/GrGLGpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698