From 8762e332e3797fb41929a1c6069207f4906ca329 Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Wed, 12 Oct 2016 12:14:07 -0700 Subject: Various fixes for linear blending and gradients With linear blending turned off some textures were still created as sRGB textures instead of linear textures. Multi-stop gradients were not behaving properly on devices with no support for float textures. Gradients are now always interpolated in linear space even if linear blending is off. New functions to always force sRGB->linear->sRGB conversions. Test: Manual testing Bug: 29940137 Change-Id: Ie2f84ee2a65fd85570e88af813e841e0e625df6c --- libs/hwui/Extensions.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'libs/hwui/Extensions.cpp') diff --git a/libs/hwui/Extensions.cpp b/libs/hwui/Extensions.cpp index 4dc7536d60bc..1d675791b851 100644 --- a/libs/hwui/Extensions.cpp +++ b/libs/hwui/Extensions.cpp @@ -45,13 +45,18 @@ Extensions::Extensions() { mHas1BitStencil = extensions.has("GL_OES_stencil1"); mHas4BitStencil = extensions.has("GL_OES_stencil4"); mHasUnpackSubImage = extensions.has("GL_EXT_unpack_subimage"); - mHasSRGB = extensions.has("GL_EXT_sRGB"); - mHasSRGBWriteControl = extensions.has("GL_EXT_sRGB_write_control"); - // If linear blending is enabled, the device must have ES3.0 and GL_EXT_sRGB_write_control #ifdef ANDROID_ENABLE_LINEAR_BLENDING - assert(mVersionMajor >= 3 || mHasSRGB); - assert(mHasSRGBWriteControl); + 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); -- cgit v1.2.3-59-g8ed1b