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 837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
848 !gli->fFunctions.fStencilThenCoverStrokePathInstanced || | 848 !gli->fFunctions.fStencilThenCoverStrokePathInstanced || |
849 !gli->fFunctions.fProgramPathFragmentInputGen) { | 849 !gli->fFunctions.fProgramPathFragmentInputGen) { |
850 return false; | 850 return false; |
851 } | 851 } |
852 return true; | 852 return true; |
853 } | 853 } |
854 | 854 |
855 bool GrGLCaps::readPixelsSupported(GrPixelConfig surfaceConfig, | 855 bool GrGLCaps::readPixelsSupported(GrPixelConfig surfaceConfig, |
856 GrPixelConfig readConfig, | 856 GrPixelConfig readConfig, |
857 std::function<void (GrGLenum, GrGLint*)> getI
ntegerv, | 857 std::function<void (GrGLenum, GrGLint*)> getI
ntegerv, |
858 std::function<bool ()> bindRenderTarget) cons
t { | 858 std::function<bool ()> bindRenderTarget, |
| 859 std::function<void ()> unbindRenderTarget) co
nst { |
859 // If it's not possible to even have a color attachment of surfaceConfig the
n read pixels is | 860 // If it's not possible to even have a color attachment of surfaceConfig the
n read pixels is |
860 // not supported regardless of readConfig. | 861 // not supported regardless of readConfig. |
861 if (!this->canConfigBeFBOColorAttachment(surfaceConfig)) { | 862 if (!this->canConfigBeFBOColorAttachment(surfaceConfig)) { |
862 return false; | 863 return false; |
863 } | 864 } |
864 | 865 |
865 GrGLenum readFormat; | 866 GrGLenum readFormat; |
866 GrGLenum readType; | 867 GrGLenum readType; |
867 if (!this->getReadPixelsFormat(surfaceConfig, readConfig, &readFormat, &read
Type)) { | 868 if (!this->getReadPixelsFormat(surfaceConfig, readConfig, &readFormat, &read
Type)) { |
868 return false; | 869 return false; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
905 ReadPixelsFormat* rpFormat = | 906 ReadPixelsFormat* rpFormat = |
906 const_cast<ReadPixelsFormat*>(&fConfigTable[surfaceConfig].fSecondRe
adPixelsFormat); | 907 const_cast<ReadPixelsFormat*>(&fConfigTable[surfaceConfig].fSecondRe
adPixelsFormat); |
907 GrGLint format = 0, type = 0; | 908 GrGLint format = 0, type = 0; |
908 if (!bindRenderTarget()) { | 909 if (!bindRenderTarget()) { |
909 return false; | 910 return false; |
910 } | 911 } |
911 getIntegerv(GR_GL_IMPLEMENTATION_COLOR_READ_FORMAT, &format); | 912 getIntegerv(GR_GL_IMPLEMENTATION_COLOR_READ_FORMAT, &format); |
912 getIntegerv(GR_GL_IMPLEMENTATION_COLOR_READ_TYPE, &type); | 913 getIntegerv(GR_GL_IMPLEMENTATION_COLOR_READ_TYPE, &type); |
913 rpFormat->fFormat = format; | 914 rpFormat->fFormat = format; |
914 rpFormat->fType = type; | 915 rpFormat->fType = type; |
| 916 unbindRenderTarget(); |
915 } | 917 } |
916 | 918 |
917 return fConfigTable[surfaceConfig].fSecondReadPixelsFormat.fFormat == readFo
rmat && | 919 return fConfigTable[surfaceConfig].fSecondReadPixelsFormat.fFormat == readFo
rmat && |
918 fConfigTable[surfaceConfig].fSecondReadPixelsFormat.fType == readType
; | 920 fConfigTable[surfaceConfig].fSecondReadPixelsFormat.fType == readType
; |
919 } | 921 } |
920 | 922 |
921 void GrGLCaps::initFSAASupport(const GrGLContextInfo& ctxInfo, const GrGLInterfa
ce* gli) { | 923 void GrGLCaps::initFSAASupport(const GrGLContextInfo& ctxInfo, const GrGLInterfa
ce* gli) { |
922 if (kGL_GrGLStandard != ctxInfo.standard()) { | 924 if (kGL_GrGLStandard != ctxInfo.standard()) { |
923 // We prefer the EXT/IMG extension over ES3 MSAA because we've observed | 925 // We prefer the EXT/IMG extension over ES3 MSAA because we've observed |
924 // ES3 driver bugs on at least one device with a tiled GPU (N10). | 926 // ES3 driver bugs on at least one device with a tiled GPU (N10). |
(...skipping 1041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1966 void GrGLCaps::onApplyOptionsOverrides(const GrContextOptions& options) { | 1968 void GrGLCaps::onApplyOptionsOverrides(const GrContextOptions& options) { |
1967 if (options.fEnableInstancedRendering) { | 1969 if (options.fEnableInstancedRendering) { |
1968 fInstancedSupport = gr_instanced::GLInstancedRendering::CheckSupport(*th
is); | 1970 fInstancedSupport = gr_instanced::GLInstancedRendering::CheckSupport(*th
is); |
1969 #ifndef SK_BUILD_FOR_MAC | 1971 #ifndef SK_BUILD_FOR_MAC |
1970 // OS X doesn't seem to write correctly to floating point textures when
using | 1972 // OS X doesn't seem to write correctly to floating point textures when
using |
1971 // glDraw*Indirect, regardless of the underlying GPU. | 1973 // glDraw*Indirect, regardless of the underlying GPU. |
1972 fAvoidInstancedDrawsToFPTargets = true; | 1974 fAvoidInstancedDrawsToFPTargets = true; |
1973 #endif | 1975 #endif |
1974 } | 1976 } |
1975 } | 1977 } |
OLD | NEW |