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

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

Issue 1592803002: Differentiate maxColorSamples and maxStencilSamples in GrCaps (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: updates Created 4 years, 11 months 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/GrContext.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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 glslCaps->fShaderDerivativeSupport = ctxInfo.version() >= GR_GL_VER(3, 0 ) || 276 glslCaps->fShaderDerivativeSupport = ctxInfo.version() >= GR_GL_VER(3, 0 ) ||
277 ctxInfo.hasExtension("GL_OES_standard_derivatives"); 277 ctxInfo.hasExtension("GL_OES_standard_derivatives");
278 } 278 }
279 279
280 /************************************************************************** 280 /**************************************************************************
281 * GrCaps fields 281 * GrCaps fields
282 **************************************************************************/ 282 **************************************************************************/
283 283
284 // We need dual source blending and the ability to disable multisample in or der to support mixed 284 // We need dual source blending and the ability to disable multisample in or der to support mixed
285 // samples in every corner case. 285 // samples in every corner case.
286 if (fMultisampleDisableSupport && glslCaps->dualSourceBlendingSupport()) { 286 if (fMultisampleDisableSupport &&
287 fMixedSamplesSupport = ctxInfo.hasExtension("GL_NV_framebuffer_mixed_sam ples") || 287 glslCaps->dualSourceBlendingSupport() &&
288 fShaderCaps->pathRenderingSupport()) {
289 fUsesMixedSamples = ctxInfo.hasExtension("GL_NV_framebuffer_mixed_sample s") ||
288 ctxInfo.hasExtension("GL_CHROMIUM_framebuffer_mixed_samples"); 290 ctxInfo.hasExtension("GL_CHROMIUM_framebuffer_mixed_samples");
289 // Workaround NVIDIA bug related to glInvalidateFramebuffer and mixed sa mples. 291 // Workaround NVIDIA bug related to glInvalidateFramebuffer and mixed sa mples.
290 if (fMixedSamplesSupport && kNVIDIA_GrGLDriver == ctxInfo.driver()) { 292 if (fUsesMixedSamples && kNVIDIA_GrGLDriver == ctxInfo.driver()) {
291 fDiscardRenderTargetSupport = false; 293 fDiscardRenderTargetSupport = false;
292 fInvalidateFBType = kNone_InvalidateFBType; 294 fInvalidateFBType = kNone_InvalidateFBType;
293 } 295 }
294 } 296 }
295 297
296 // fPathRenderingSupport and fMixedSamplesSupport must be set before calling initFSAASupport. 298 // fUsesMixedSamples must be set before calling initFSAASupport.
297 this->initFSAASupport(ctxInfo, gli); 299 this->initFSAASupport(ctxInfo, gli);
298 this->initBlendEqationSupport(ctxInfo); 300 this->initBlendEqationSupport(ctxInfo);
299 this->initStencilFormats(ctxInfo); 301 this->initStencilFormats(ctxInfo);
300 302
301 if (kGL_GrGLStandard == standard) { 303 if (kGL_GrGLStandard == standard) {
302 // we could also look for GL_ATI_separate_stencil extension or 304 // we could also look for GL_ATI_separate_stencil extension or
303 // GL_EXT_stencil_two_side but they use different function signatures 305 // GL_EXT_stencil_two_side but they use different function signatures
304 // than GL2.0+ (and than each other). 306 // than GL2.0+ (and than each other).
305 fTwoSidedStencilSupport = (ctxInfo.version() >= GR_GL_VER(2,0)); 307 fTwoSidedStencilSupport = (ctxInfo.version() >= GR_GL_VER(2,0));
306 // supported on GL 1.4 and higher or by extension 308 // supported on GL 1.4 and higher or by extension
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 fReuseScratchTextures = kARM_GrGLVendor != ctxInfo.vendor() && 397 fReuseScratchTextures = kARM_GrGLVendor != ctxInfo.vendor() &&
396 kQualcomm_GrGLVendor != ctxInfo.vendor(); 398 kQualcomm_GrGLVendor != ctxInfo.vendor();
397 399
398 #if 0 400 #if 0
399 fReuseScratchBuffers = kARM_GrGLVendor != ctxInfo.vendor() && 401 fReuseScratchBuffers = kARM_GrGLVendor != ctxInfo.vendor() &&
400 kQualcomm_GrGLVendor != ctxInfo.vendor(); 402 kQualcomm_GrGLVendor != ctxInfo.vendor();
401 #endif 403 #endif
402 404
403 // initFSAASupport() must have been called before this point 405 // initFSAASupport() must have been called before this point
404 if (GrGLCaps::kES_IMG_MsToTexture_MSFBOType == fMSFBOType) { 406 if (GrGLCaps::kES_IMG_MsToTexture_MSFBOType == fMSFBOType) {
405 GR_GL_GetIntegerv(gli, GR_GL_MAX_SAMPLES_IMG, &fMaxSampleCount); 407 GR_GL_GetIntegerv(gli, GR_GL_MAX_SAMPLES_IMG, &fMaxColorSampleCount);
406 } else if (GrGLCaps::kNone_MSFBOType != fMSFBOType) { 408 } else if (GrGLCaps::kNone_MSFBOType != fMSFBOType) {
407 GR_GL_GetIntegerv(gli, GR_GL_MAX_SAMPLES, &fMaxSampleCount); 409 GR_GL_GetIntegerv(gli, GR_GL_MAX_SAMPLES, &fMaxColorSampleCount);
408 } 410 }
411 fMaxStencilSampleCount = fMaxColorSampleCount;
409 412
410 if (kPowerVR54x_GrGLRenderer == ctxInfo.renderer() || 413 if (kPowerVR54x_GrGLRenderer == ctxInfo.renderer() ||
411 kPowerVRRogue_GrGLRenderer == ctxInfo.renderer() || 414 kPowerVRRogue_GrGLRenderer == ctxInfo.renderer() ||
412 kAdreno3xx_GrGLRenderer == ctxInfo.renderer()) { 415 kAdreno3xx_GrGLRenderer == ctxInfo.renderer()) {
413 fUseDrawInsteadOfClear = true; 416 fUseDrawInsteadOfClear = true;
414 } 417 }
415 418
416 if (kAdreno4xx_GrGLRenderer == ctxInfo.renderer()) { 419 if (kAdreno4xx_GrGLRenderer == ctxInfo.renderer()) {
417 fUseDrawInsteadOfPartialRenderTargetWrite = true; 420 fUseDrawInsteadOfPartialRenderTargetWrite = true;
418 } 421 }
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 void GrGLCaps::initFSAASupport(const GrGLContextInfo& ctxInfo, const GrGLInterfa ce* gli) { 680 void GrGLCaps::initFSAASupport(const GrGLContextInfo& ctxInfo, const GrGLInterfa ce* gli) {
678 681
679 fMSFBOType = kNone_MSFBOType; 682 fMSFBOType = kNone_MSFBOType;
680 if (kGL_GrGLStandard != ctxInfo.standard()) { 683 if (kGL_GrGLStandard != ctxInfo.standard()) {
681 // We prefer the EXT/IMG extension over ES3 MSAA because we've observed 684 // We prefer the EXT/IMG extension over ES3 MSAA because we've observed
682 // ES3 driver bugs on at least one device with a tiled GPU (N10). 685 // ES3 driver bugs on at least one device with a tiled GPU (N10).
683 if (ctxInfo.hasExtension("GL_EXT_multisampled_render_to_texture")) { 686 if (ctxInfo.hasExtension("GL_EXT_multisampled_render_to_texture")) {
684 fMSFBOType = kES_EXT_MsToTexture_MSFBOType; 687 fMSFBOType = kES_EXT_MsToTexture_MSFBOType;
685 } else if (ctxInfo.hasExtension("GL_IMG_multisampled_render_to_texture") ) { 688 } else if (ctxInfo.hasExtension("GL_IMG_multisampled_render_to_texture") ) {
686 fMSFBOType = kES_IMG_MsToTexture_MSFBOType; 689 fMSFBOType = kES_IMG_MsToTexture_MSFBOType;
687 } else if (fMixedSamplesSupport && fShaderCaps->pathRenderingSupport()) { 690 } else if (fUsesMixedSamples) {
688 fMSFBOType = kMixedSamples_MSFBOType; 691 fMSFBOType = kMixedSamples_MSFBOType;
689 } else if (ctxInfo.version() >= GR_GL_VER(3,0)) { 692 } else if (ctxInfo.version() >= GR_GL_VER(3,0)) {
690 fMSFBOType = GrGLCaps::kES_3_0_MSFBOType; 693 fMSFBOType = GrGLCaps::kES_3_0_MSFBOType;
691 } else if (ctxInfo.hasExtension("GL_CHROMIUM_framebuffer_multisample")) { 694 } else if (ctxInfo.hasExtension("GL_CHROMIUM_framebuffer_multisample")) {
692 // chrome's extension is equivalent to the EXT msaa 695 // chrome's extension is equivalent to the EXT msaa
693 // and fbo_blit extensions. 696 // and fbo_blit extensions.
694 fMSFBOType = kDesktop_EXT_MSFBOType; 697 fMSFBOType = kDesktop_EXT_MSFBOType;
695 } else if (ctxInfo.hasExtension("GL_APPLE_framebuffer_multisample")) { 698 } else if (ctxInfo.hasExtension("GL_APPLE_framebuffer_multisample")) {
696 fMSFBOType = kES_Apple_MSFBOType; 699 fMSFBOType = kES_Apple_MSFBOType;
697 } 700 }
698 } else { 701 } else {
699 if (fMixedSamplesSupport && fShaderCaps->pathRenderingSupport()) { 702 if (fUsesMixedSamples) {
700 fMSFBOType = kMixedSamples_MSFBOType; 703 fMSFBOType = kMixedSamples_MSFBOType;
701 } else if ((ctxInfo.version() >= GR_GL_VER(3,0)) || 704 } else if ((ctxInfo.version() >= GR_GL_VER(3,0)) ||
702 ctxInfo.hasExtension("GL_ARB_framebuffer_object")) { 705 ctxInfo.hasExtension("GL_ARB_framebuffer_object")) {
703 fMSFBOType = GrGLCaps::kDesktop_ARB_MSFBOType; 706 fMSFBOType = GrGLCaps::kDesktop_ARB_MSFBOType;
704 } else if (ctxInfo.hasExtension("GL_EXT_framebuffer_multisample") && 707 } else if (ctxInfo.hasExtension("GL_EXT_framebuffer_multisample") &&
705 ctxInfo.hasExtension("GL_EXT_framebuffer_blit")) { 708 ctxInfo.hasExtension("GL_EXT_framebuffer_blit")) {
706 fMSFBOType = GrGLCaps::kDesktop_EXT_MSFBOType; 709 fMSFBOType = GrGLCaps::kDesktop_EXT_MSFBOType;
707 } 710 }
708 } 711 }
709 } 712 }
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after
1579 for (int j = 0; j < kExternalFormatUsageCnt; ++j) { 1582 for (int j = 0; j < kExternalFormatUsageCnt; ++j) {
1580 SkASSERT(defaultEntry.fFormats.fExternalFormat[j] != 1583 SkASSERT(defaultEntry.fFormats.fExternalFormat[j] !=
1581 fConfigTable[i].fFormats.fExternalFormat[j]); 1584 fConfigTable[i].fFormats.fExternalFormat[j]);
1582 } 1585 }
1583 SkASSERT(defaultEntry.fFormats.fExternalType != fConfigTable[i].fFormats .fExternalType); 1586 SkASSERT(defaultEntry.fFormats.fExternalType != fConfigTable[i].fFormats .fExternalType);
1584 } 1587 }
1585 #endif 1588 #endif
1586 } 1589 }
1587 1590
1588 void GrGLCaps::onApplyOptionsOverrides(const GrContextOptions& options) {} 1591 void GrGLCaps::onApplyOptionsOverrides(const GrContextOptions& options) {}
OLDNEW
« no previous file with comments | « src/gpu/GrContext.cpp ('k') | src/gpu/gl/GrGLGpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698