| 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 #include "GrGLContext.h" | 10 #include "GrGLContext.h" |
| 11 #include "SkTSearch.h" | 11 #include "SkTSearch.h" |
| 12 | 12 |
| 13 GrGLCaps::GrGLCaps() { | 13 GrGLCaps::GrGLCaps() { |
| 14 this->reset(); | 14 this->reset(); |
| 15 } | 15 } |
| 16 | 16 |
| 17 void GrGLCaps::reset() { | 17 void GrGLCaps::reset() { |
| 18 fVerifiedColorConfigs.reset(); | 18 fVerifiedColorConfigs.reset(); |
| 19 fStencilFormats.reset(); | 19 fStencilFormats.reset(); |
| 20 fStencilVerifiedColorConfigs.reset(); | 20 fStencilVerifiedColorConfigs.reset(); |
| 21 fMSFBOType = kNone_MSFBOType; | 21 fMSFBOType = kNone_MSFBOType; |
| 22 fMaxSampleCount = 0; | |
| 23 fCoverageAAType = kNone_CoverageAAType; | 22 fCoverageAAType = kNone_CoverageAAType; |
| 24 fMaxFragmentUniformVectors = 0; | 23 fMaxFragmentUniformVectors = 0; |
| 25 fMaxVertexAttributes = 0; | 24 fMaxVertexAttributes = 0; |
| 26 fRGBA8RenderbufferSupport = false; | 25 fRGBA8RenderbufferSupport = false; |
| 27 fBGRAFormatSupport = false; | 26 fBGRAFormatSupport = false; |
| 28 fBGRAIsInternalFormat = false; | 27 fBGRAIsInternalFormat = false; |
| 29 fTextureSwizzleSupport = false; | 28 fTextureSwizzleSupport = false; |
| 30 fUnpackRowLengthSupport = false; | 29 fUnpackRowLengthSupport = false; |
| 31 fUnpackFlipYSupport = false; | 30 fUnpackFlipYSupport = false; |
| 32 fPackRowLengthSupport = false; | 31 fPackRowLengthSupport = false; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 46 *this = caps; | 45 *this = caps; |
| 47 } | 46 } |
| 48 | 47 |
| 49 GrGLCaps& GrGLCaps::operator = (const GrGLCaps& caps) { | 48 GrGLCaps& GrGLCaps::operator = (const GrGLCaps& caps) { |
| 50 fVerifiedColorConfigs = caps.fVerifiedColorConfigs; | 49 fVerifiedColorConfigs = caps.fVerifiedColorConfigs; |
| 51 fStencilFormats = caps.fStencilFormats; | 50 fStencilFormats = caps.fStencilFormats; |
| 52 fStencilVerifiedColorConfigs = caps.fStencilVerifiedColorConfigs; | 51 fStencilVerifiedColorConfigs = caps.fStencilVerifiedColorConfigs; |
| 53 fMaxFragmentUniformVectors = caps.fMaxFragmentUniformVectors; | 52 fMaxFragmentUniformVectors = caps.fMaxFragmentUniformVectors; |
| 54 fMaxVertexAttributes = caps.fMaxVertexAttributes; | 53 fMaxVertexAttributes = caps.fMaxVertexAttributes; |
| 55 fMSFBOType = caps.fMSFBOType; | 54 fMSFBOType = caps.fMSFBOType; |
| 56 fMaxSampleCount = caps.fMaxSampleCount; | |
| 57 fCoverageAAType = caps.fCoverageAAType; | 55 fCoverageAAType = caps.fCoverageAAType; |
| 58 fMSAACoverageModes = caps.fMSAACoverageModes; | 56 fMSAACoverageModes = caps.fMSAACoverageModes; |
| 59 fRGBA8RenderbufferSupport = caps.fRGBA8RenderbufferSupport; | 57 fRGBA8RenderbufferSupport = caps.fRGBA8RenderbufferSupport; |
| 60 fBGRAFormatSupport = caps.fBGRAFormatSupport; | 58 fBGRAFormatSupport = caps.fBGRAFormatSupport; |
| 61 fBGRAIsInternalFormat = caps.fBGRAIsInternalFormat; | 59 fBGRAIsInternalFormat = caps.fBGRAIsInternalFormat; |
| 62 fTextureSwizzleSupport = caps.fTextureSwizzleSupport; | 60 fTextureSwizzleSupport = caps.fTextureSwizzleSupport; |
| 63 fUnpackRowLengthSupport = caps.fUnpackRowLengthSupport; | 61 fUnpackRowLengthSupport = caps.fUnpackRowLengthSupport; |
| 64 fUnpackFlipYSupport = caps.fUnpackFlipYSupport; | 62 fUnpackFlipYSupport = caps.fUnpackFlipYSupport; |
| 65 fPackRowLengthSupport = caps.fPackRowLengthSupport; | 63 fPackRowLengthSupport = caps.fPackRowLengthSupport; |
| 66 fPackFlipYSupport = caps.fPackFlipYSupport; | 64 fPackFlipYSupport = caps.fPackFlipYSupport; |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 GR_GL_MULTISAMPLE_COVERAGE_MODES, | 275 GR_GL_MULTISAMPLE_COVERAGE_MODES, |
| 278 (int*)&fMSAACoverageModes[0]); | 276 (int*)&fMSAACoverageModes[0]); |
| 279 // The NV driver seems to return the modes already sorted but the | 277 // The NV driver seems to return the modes already sorted but the |
| 280 // spec doesn't require this. So we sort. | 278 // spec doesn't require this. So we sort. |
| 281 qsort(&fMSAACoverageModes[0], | 279 qsort(&fMSAACoverageModes[0], |
| 282 count, | 280 count, |
| 283 sizeof(MSAACoverageMode), | 281 sizeof(MSAACoverageMode), |
| 284 SkCastForQSort(coverage_mode_compare)); | 282 SkCastForQSort(coverage_mode_compare)); |
| 285 } | 283 } |
| 286 } | 284 } |
| 287 if (kNone_MSFBOType != fMSFBOType) { | |
| 288 GR_GL_GetIntegerv(gli, GR_GL_MAX_SAMPLES, &fMaxSampleCount); | |
| 289 } | |
| 290 } | 285 } |
| 291 | 286 |
| 292 const GrGLCaps::MSAACoverageMode& GrGLCaps::getMSAACoverageMode( | 287 const GrGLCaps::MSAACoverageMode& GrGLCaps::getMSAACoverageMode(int desiredSampl
eCount) const { |
| 293 int desiredSampleCount) const { | |
| 294 static const MSAACoverageMode kNoneMode = {0, 0}; | 288 static const MSAACoverageMode kNoneMode = {0, 0}; |
| 295 if (0 == fMSAACoverageModes.count()) { | 289 if (0 == fMSAACoverageModes.count()) { |
| 296 return kNoneMode; | 290 return kNoneMode; |
| 297 } else { | 291 } else { |
| 298 GrAssert(kNone_CoverageAAType != fCoverageAAType); | 292 GrAssert(kNone_CoverageAAType != fCoverageAAType); |
| 299 int max = (fMSAACoverageModes.end() - 1)->fCoverageSampleCnt; | 293 int max = (fMSAACoverageModes.end() - 1)->fCoverageSampleCnt; |
| 300 desiredSampleCount = GrMin(desiredSampleCount, max); | 294 desiredSampleCount = GrMin(desiredSampleCount, max); |
| 301 MSAACoverageMode desiredMode = {desiredSampleCount, 0}; | 295 MSAACoverageMode desiredMode = {desiredSampleCount, 0}; |
| 302 int idx = SkTSearch<MSAACoverageMode>(&fMSAACoverageModes[0], | 296 int idx = SkTSearch<MSAACoverageMode>(&fMSAACoverageModes[0], |
| 303 fMSAACoverageModes.count(), | 297 fMSAACoverageModes.count(), |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 (fUnpackRowLengthSupport ? "YES": "NO")); | 438 (fUnpackRowLengthSupport ? "YES": "NO")); |
| 445 GrPrintf("Unpack Flip Y support: %s\n", | 439 GrPrintf("Unpack Flip Y support: %s\n", |
| 446 (fUnpackFlipYSupport ? "YES": "NO")); | 440 (fUnpackFlipYSupport ? "YES": "NO")); |
| 447 GrPrintf("Pack Row length support: %s\n", | 441 GrPrintf("Pack Row length support: %s\n", |
| 448 (fPackRowLengthSupport ? "YES": "NO")); | 442 (fPackRowLengthSupport ? "YES": "NO")); |
| 449 GrPrintf("Pack Flip Y support: %s\n", | 443 GrPrintf("Pack Flip Y support: %s\n", |
| 450 (fPackFlipYSupport ? "YES": "NO")); | 444 (fPackFlipYSupport ? "YES": "NO")); |
| 451 GrPrintf("Two Format Limit: %s\n", (fTwoFormatLimit ? "YES": "NO")); | 445 GrPrintf("Two Format Limit: %s\n", (fTwoFormatLimit ? "YES": "NO")); |
| 452 GrPrintf("Fragment coord conventions support: %s\n", (fFragCoordsConventionS
upport ? "YES": "NO")); | 446 GrPrintf("Fragment coord conventions support: %s\n", (fFragCoordsConventionS
upport ? "YES": "NO")); |
| 453 } | 447 } |
| OLD | NEW |