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 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 * GrCaps fields | 299 * GrCaps fields |
300 **************************************************************************/ | 300 **************************************************************************/ |
301 | 301 |
302 // We need dual source blending and the ability to disable multisample in or
der to support mixed | 302 // We need dual source blending and the ability to disable multisample in or
der to support mixed |
303 // samples in every corner case. | 303 // samples in every corner case. |
304 if (fMultisampleDisableSupport && | 304 if (fMultisampleDisableSupport && |
305 glslCaps->dualSourceBlendingSupport() && | 305 glslCaps->dualSourceBlendingSupport() && |
306 fShaderCaps->pathRenderingSupport()) { | 306 fShaderCaps->pathRenderingSupport()) { |
307 fUsesMixedSamples = ctxInfo.hasExtension("GL_NV_framebuffer_mixed_sample
s") || | 307 fUsesMixedSamples = ctxInfo.hasExtension("GL_NV_framebuffer_mixed_sample
s") || |
308 ctxInfo.hasExtension("GL_CHROMIUM_framebuffer_mixed_samples"); | 308 ctxInfo.hasExtension("GL_CHROMIUM_framebuffer_mixed_samples"); |
309 // Workaround NVIDIA bug related to glInvalidateFramebuffer and mixed sa
mples. | 309 if (fUsesMixedSamples) { |
310 if (fUsesMixedSamples && (kNVIDIA_GrGLDriver == ctxInfo.driver() || | 310 if (kNVIDIA_GrGLDriver == ctxInfo.driver() || |
311 kChromium_GrGLDriver == ctxInfo.driver())) { | 311 kChromium_GrGLDriver == ctxInfo.driver()) { |
312 fDiscardRenderTargetSupport = false; | 312 // Workaround NVIDIA bug related to glInvalidateFramebuffer and
mixed samples. |
313 fInvalidateFBType = kNone_InvalidateFBType; | 313 fDiscardRenderTargetSupport = false; |
| 314 fInvalidateFBType = kNone_InvalidateFBType; |
| 315 } |
| 316 // Raster multisample is only useful to us when coverage modulation
is also supported, |
| 317 // as defined by mixed samples. |
| 318 fRasterMultisampleSupport = ctxInfo.hasExtension("GL_EXT_raster_mult
isample"); |
314 } | 319 } |
315 } | 320 } |
316 | 321 |
317 // fUsesMixedSamples must be set before calling initFSAASupport. | 322 // fUsesMixedSamples must be set before calling initFSAASupport. |
318 this->initFSAASupport(ctxInfo, gli); | 323 this->initFSAASupport(ctxInfo, gli); |
319 this->initBlendEqationSupport(ctxInfo); | 324 this->initBlendEqationSupport(ctxInfo); |
320 this->initStencilFormats(ctxInfo); | 325 this->initStencilFormats(ctxInfo); |
321 | 326 |
322 if (kGL_GrGLStandard == standard) { | 327 if (kGL_GrGLStandard == standard) { |
323 // we could also look for GL_ATI_separate_stencil extension or | 328 // we could also look for GL_ATI_separate_stencil extension or |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 fReuseScratchTextures = kARM_GrGLVendor != ctxInfo.vendor() && | 421 fReuseScratchTextures = kARM_GrGLVendor != ctxInfo.vendor() && |
417 kQualcomm_GrGLVendor != ctxInfo.vendor(); | 422 kQualcomm_GrGLVendor != ctxInfo.vendor(); |
418 | 423 |
419 #if 0 | 424 #if 0 |
420 fReuseScratchBuffers = kARM_GrGLVendor != ctxInfo.vendor() && | 425 fReuseScratchBuffers = kARM_GrGLVendor != ctxInfo.vendor() && |
421 kQualcomm_GrGLVendor != ctxInfo.vendor(); | 426 kQualcomm_GrGLVendor != ctxInfo.vendor(); |
422 #endif | 427 #endif |
423 | 428 |
424 // initFSAASupport() must have been called before this point | 429 // initFSAASupport() must have been called before this point |
425 if (GrGLCaps::kES_IMG_MsToTexture_MSFBOType == fMSFBOType) { | 430 if (GrGLCaps::kES_IMG_MsToTexture_MSFBOType == fMSFBOType) { |
426 GR_GL_GetIntegerv(gli, GR_GL_MAX_SAMPLES_IMG, &fMaxColorSampleCount); | 431 GR_GL_GetIntegerv(gli, GR_GL_MAX_SAMPLES_IMG, &fMaxStencilSampleCount); |
427 } else if (GrGLCaps::kNone_MSFBOType != fMSFBOType) { | 432 } else if (GrGLCaps::kNone_MSFBOType != fMSFBOType) { |
428 GR_GL_GetIntegerv(gli, GR_GL_MAX_SAMPLES, &fMaxColorSampleCount); | 433 GR_GL_GetIntegerv(gli, GR_GL_MAX_SAMPLES, &fMaxStencilSampleCount); |
429 } | 434 } |
430 fMaxStencilSampleCount = fMaxColorSampleCount; | 435 if (fRasterMultisampleSupport) { |
| 436 GR_GL_GetIntegerv(gli, GR_GL_MAX_RASTER_SAMPLES, &fMaxRasterSamples); |
| 437 // This is to guard against platforms that may not support as many sampl
es for |
| 438 // glRasterSamples as they do for framebuffers. |
| 439 fMaxStencilSampleCount = SkTMin(fMaxStencilSampleCount, fMaxRasterSample
s); |
| 440 } |
| 441 fMaxColorSampleCount = fMaxStencilSampleCount; |
431 | 442 |
432 if (kPowerVR54x_GrGLRenderer == ctxInfo.renderer() || | 443 if (kPowerVR54x_GrGLRenderer == ctxInfo.renderer() || |
433 kPowerVRRogue_GrGLRenderer == ctxInfo.renderer() || | 444 kPowerVRRogue_GrGLRenderer == ctxInfo.renderer() || |
434 kAdreno3xx_GrGLRenderer == ctxInfo.renderer()) { | 445 kAdreno3xx_GrGLRenderer == ctxInfo.renderer()) { |
435 fUseDrawInsteadOfClear = true; | 446 fUseDrawInsteadOfClear = true; |
436 } | 447 } |
437 | 448 |
438 if (kAdreno4xx_GrGLRenderer == ctxInfo.renderer()) { | 449 if (kAdreno4xx_GrGLRenderer == ctxInfo.renderer()) { |
439 fUseDrawInsteadOfPartialRenderTargetWrite = true; | 450 fUseDrawInsteadOfPartialRenderTargetWrite = true; |
440 } | 451 } |
(...skipping 1194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1635 for (int j = 0; j < kExternalFormatUsageCnt; ++j) { | 1646 for (int j = 0; j < kExternalFormatUsageCnt; ++j) { |
1636 SkASSERT(defaultEntry.fFormats.fExternalFormat[j] != | 1647 SkASSERT(defaultEntry.fFormats.fExternalFormat[j] != |
1637 fConfigTable[i].fFormats.fExternalFormat[j]); | 1648 fConfigTable[i].fFormats.fExternalFormat[j]); |
1638 } | 1649 } |
1639 SkASSERT(defaultEntry.fFormats.fExternalType != fConfigTable[i].fFormats
.fExternalType); | 1650 SkASSERT(defaultEntry.fFormats.fExternalType != fConfigTable[i].fFormats
.fExternalType); |
1640 } | 1651 } |
1641 #endif | 1652 #endif |
1642 } | 1653 } |
1643 | 1654 |
1644 void GrGLCaps::onApplyOptionsOverrides(const GrContextOptions& options) {} | 1655 void GrGLCaps::onApplyOptionsOverrides(const GrContextOptions& options) {} |
OLD | NEW |