diff options
Diffstat (limited to 'libs/hwui/Extensions.cpp')
-rw-r--r-- | libs/hwui/Extensions.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libs/hwui/Extensions.cpp b/libs/hwui/Extensions.cpp index 02caaa49e99c..1d675791b851 100644 --- a/libs/hwui/Extensions.cpp +++ b/libs/hwui/Extensions.cpp @@ -22,6 +22,7 @@ #include <GLES2/gl2.h> #include <GLES2/gl2ext.h> + #include <utils/Log.h> namespace android { @@ -45,6 +46,19 @@ Extensions::Extensions() { mHas4BitStencil = extensions.has("GL_OES_stencil4"); mHasUnpackSubImage = extensions.has("GL_EXT_unpack_subimage"); +#ifdef ANDROID_ENABLE_LINEAR_BLENDING + mHasSRGB = mVersionMajor >= 3 || extensions.has("GL_EXT_sRGB"); + mHasSRGBWriteControl = extensions.has("GL_EXT_sRGB_write_control"); + + // If linear blending is enabled, the device must have (ES3.0 or EXT_sRGB) + // and EXT_sRGB_write_control + LOG_ALWAYS_FATAL_IF(!mHasSRGB, "Linear blending requires ES 3.0 or EXT_sRGB"); + LOG_ALWAYS_FATAL_IF(!mHasSRGBWriteControl, "Linear blending requires EXT_sRGB_write_control"); +#else + mHasSRGB = false; + mHasSRGBWriteControl = false; +#endif + const char* version = (const char*) glGetString(GL_VERSION); // Section 6.1.5 of the OpenGL ES specification indicates the GL version |