Update shadow render code to use lookup texture

Optimizes performance on low end devices by avoiding exp() in the
fragment shader and lowering the precision of the shadow attributes
used in the shaders.

Test: adb shell su root dumpsys SurfaceFlinger --timestats -dump -maxlayers 0 on wembley
Test: atest SurfaceFlinger_test librenderengine_test
Test: shadows still look like shadows
Change-Id: I0e6e35a2f4f2d31b3126438ebb8b34d92a7d98c0
diff --git a/libs/renderengine/gl/GLSkiaShadowPort.cpp b/libs/renderengine/gl/GLSkiaShadowPort.cpp
index 224ce6c..da8b435 100644
--- a/libs/renderengine/gl/GLSkiaShadowPort.cpp
+++ b/libs/renderengine/gl/GLSkiaShadowPort.cpp
@@ -644,6 +644,13 @@
                              2.0f * devSpaceSpotBlur, std::abs(insetWidth));
 }
 
+void fillShadowTextureData(uint8_t* data, size_t shadowTextureWidth) {
+    for (int i = 0; i < shadowTextureWidth; i++) {
+        const float d = 1 - i / ((shadowTextureWidth * 1.0f) - 1.0f);
+        data[i] = static_cast<uint8_t>((exp(-4.0f * d * d) - 0.018f) * 255);
+    }
+}
+
 } // namespace gl
 } // namespace renderengine
 } // namespace android