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 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 if (nullptr == gli->fFunctions.fStencilThenCoverFillPath || | 635 if (nullptr == gli->fFunctions.fStencilThenCoverFillPath || |
636 nullptr == gli->fFunctions.fStencilThenCoverStrokePath || | 636 nullptr == gli->fFunctions.fStencilThenCoverStrokePath || |
637 nullptr == gli->fFunctions.fStencilThenCoverFillPathInstanced || | 637 nullptr == gli->fFunctions.fStencilThenCoverFillPathInstanced || |
638 nullptr == gli->fFunctions.fStencilThenCoverStrokePathInstanced || | 638 nullptr == gli->fFunctions.fStencilThenCoverStrokePathInstanced || |
639 nullptr == gli->fFunctions.fProgramPathFragmentInputGen) { | 639 nullptr == gli->fFunctions.fProgramPathFragmentInputGen) { |
640 return false; | 640 return false; |
641 } | 641 } |
642 return true; | 642 return true; |
643 } | 643 } |
644 | 644 |
645 bool GrGLCaps::readPixelsSupported(GrGLRenderTarget* target, | 645 bool GrGLCaps::readPixelsSupported(GrPixelConfig rtConfig, |
646 GrPixelConfig readConfig, | 646 GrPixelConfig readConfig, |
647 std::function<void (GrGLenum, GrGLint*)> getI
ntegerv, | 647 std::function<void (GrGLenum, GrGLint*)> getI
ntegerv, |
648 std::function<void (GrGLRenderTarget*)> bindR
enderTarget) const { | 648 std::function<bool ()> bindRenderTarget) cons
t { |
649 GrPixelConfig rtConfig = target->config(); | |
650 SkASSERT(this->isConfigRenderable(rtConfig, false)); | 649 SkASSERT(this->isConfigRenderable(rtConfig, false)); |
651 | 650 |
652 GrGLenum readFormat; | 651 GrGLenum readFormat; |
653 GrGLenum readType; | 652 GrGLenum readType; |
654 if (!this->getReadPixelsFormat(rtConfig, readConfig, &readFormat, &readType)
) { | 653 if (!this->getReadPixelsFormat(rtConfig, readConfig, &readFormat, &readType)
) { |
655 return false; | 654 return false; |
656 } | 655 } |
657 | 656 |
658 if (kGL_GrGLStandard == fStandard) { | 657 if (kGL_GrGLStandard == fStandard) { |
659 // All of our renderable configs can be converted to each other by glRea
dPixels in OpenGL. | 658 // All of our renderable configs can be converted to each other by glRea
dPixels in OpenGL. |
(...skipping 10 matching lines...) Expand all Loading... |
670 SkASSERT(kFloat_FormatType == fConfigTable[rtConfig].fFormatType); | 669 SkASSERT(kFloat_FormatType == fConfigTable[rtConfig].fFormatType); |
671 if (GR_GL_RGBA == readFormat && GR_GL_FLOAT == readType) { | 670 if (GR_GL_RGBA == readFormat && GR_GL_FLOAT == readType) { |
672 return true; | 671 return true; |
673 } | 672 } |
674 } | 673 } |
675 | 674 |
676 if (0 == fConfigTable[rtConfig].fSecondReadPixelsFormat.fFormat) { | 675 if (0 == fConfigTable[rtConfig].fSecondReadPixelsFormat.fFormat) { |
677 ReadPixelsFormat* rpFormat = | 676 ReadPixelsFormat* rpFormat = |
678 const_cast<ReadPixelsFormat*>(&fConfigTable[rtConfig].fSecondReadPix
elsFormat); | 677 const_cast<ReadPixelsFormat*>(&fConfigTable[rtConfig].fSecondReadPix
elsFormat); |
679 GrGLint format = 0, type = 0; | 678 GrGLint format = 0, type = 0; |
680 bindRenderTarget(target); | 679 if (!bindRenderTarget()) { |
| 680 return false; |
| 681 } |
681 getIntegerv(GR_GL_IMPLEMENTATION_COLOR_READ_FORMAT, &format); | 682 getIntegerv(GR_GL_IMPLEMENTATION_COLOR_READ_FORMAT, &format); |
682 getIntegerv(GR_GL_IMPLEMENTATION_COLOR_READ_TYPE, &type); | 683 getIntegerv(GR_GL_IMPLEMENTATION_COLOR_READ_TYPE, &type); |
683 rpFormat->fFormat = format; | 684 rpFormat->fFormat = format; |
684 rpFormat->fType = type; | 685 rpFormat->fType = type; |
685 } | 686 } |
686 | 687 |
687 return fConfigTable[rtConfig].fSecondReadPixelsFormat.fFormat == readFormat
&& | 688 return fConfigTable[rtConfig].fSecondReadPixelsFormat.fFormat == readFormat
&& |
688 fConfigTable[rtConfig].fSecondReadPixelsFormat.fType == readType; | 689 fConfigTable[rtConfig].fSecondReadPixelsFormat.fType == readType; |
689 } | 690 } |
690 | 691 |
(...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1593 for (int j = 0; j < kExternalFormatUsageCnt; ++j) { | 1594 for (int j = 0; j < kExternalFormatUsageCnt; ++j) { |
1594 SkASSERT(defaultEntry.fFormats.fExternalFormat[j] != | 1595 SkASSERT(defaultEntry.fFormats.fExternalFormat[j] != |
1595 fConfigTable[i].fFormats.fExternalFormat[j]); | 1596 fConfigTable[i].fFormats.fExternalFormat[j]); |
1596 } | 1597 } |
1597 SkASSERT(defaultEntry.fFormats.fExternalType != fConfigTable[i].fFormats
.fExternalType); | 1598 SkASSERT(defaultEntry.fFormats.fExternalType != fConfigTable[i].fFormats
.fExternalType); |
1598 } | 1599 } |
1599 #endif | 1600 #endif |
1600 } | 1601 } |
1601 | 1602 |
1602 void GrGLCaps::onApplyOptionsOverrides(const GrContextOptions& options) {} | 1603 void GrGLCaps::onApplyOptionsOverrides(const GrContextOptions& options) {} |
OLD | NEW |