summaryrefslogtreecommitdiff
path: root/libs/hwui/Extensions.cpp
diff options
context:
space:
mode:
author Romain Guy <romainguy@google.com> 2016-10-12 12:14:07 -0700
committer Romain Guy <romainguy@google.com> 2016-10-12 13:28:26 -0700
commit8762e332e3797fb41929a1c6069207f4906ca329 (patch)
treeb97249defbda418d2adc8af6f4bb22dfa3def07f /libs/hwui/Extensions.cpp
parent21986f2ae73e9ae3395a37dd3976af55e75d4f9d (diff)
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
Diffstat (limited to 'libs/hwui/Extensions.cpp')
-rw-r--r--libs/hwui/Extensions.cpp15
1 files changed, 10 insertions, 5 deletions
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);